/*
 *  include/comm.h
 *
 *  Communication subsystem 
 *
 *  Copyright (C) 2004  Phoenix Grid Computing Project
 *                      ( http://www.logos.ic.i.u-tokyo.ac.jp/phoenix/ )
 *
 *  2004-12-07  Comm_select () added 
 *              by Kaneda Kenji
 *  2004-11-26  Implemented basic functions 
 *              by Kaneda Kenji
 */


#ifndef _COMM_H
#define _COMM_H


#include "common.h"
#include "comm/common.h"
#include "opt.h"


struct comm_t *Comm_new ( const struct opt_t *opt );
void           Comm_destroy ( struct comm_t *x );

int            Comm_connect ( struct comm_t *comm, int sockfd, const struct sockaddr *serv_addr, 
			     socklen_t addrlen );
int            Comm_accept ( struct comm_t *comm, int s, struct sockaddr *addr, socklen_t *addrlen );
ssize_t        Comm_send ( struct comm_t *comm, int s, const void *buf, size_t len, int flags );
ssize_t        Comm_recv ( struct comm_t *comm, int s, void *buf, size_t len, int flags );
int            Comm_shutdown ( struct comm_t *comm, int s, int how );
int            Comm_select ( struct comm_t *comm,
			     int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
			     struct timeval *timeout );


#endif /* _COMM_H */
