/*
 *  include/conn.h
 *
 *  Connection Management
 *
 *  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 _CONN_H
#define _CONN_H


#include "common.h"
#include "conn/common.h"

struct conn_t *Conn_connect ( SSL_CTX *ctx, int sockfd, const struct sockaddr *serv_addr, 
			      socklen_t addrlen, int *ret );
struct conn_t *Conn_accept ( SSL_CTX *ctx, int s, struct sockaddr *addr, socklen_t *addrlen, int *ret );
ssize_t        Conn_send ( struct conn_t *conn, const void *buf, size_t len, int flags );
ssize_t        Conn_recv ( struct conn_t *conn, void *buf, size_t len, int flags );
int            Conn_shutdown ( struct conn_t *conn, int how );
int            Conn_pending ( struct conn_t *conn );

struct conn_list_t       *ConnList_new ( void );
struct conn_t            *ConnList_find ( const struct conn_list_t *t, int sockfd );
void                      ConnList_add ( struct conn_list_t *t, struct conn_t *conn);
bool_t                    ConnList_delete ( struct conn_list_t *t, int sockfd );
void                      ConnList_destroy ( struct conn_list_t *t );

#endif /* _CONN_H */
