Main Page | Class List | File List | Class Members | File Members | Related Pages

tcpc.h

Go to the documentation of this file.
00001 /* 00002 * $Id: tcpc.h,v 1.5 2003/10/16 18:50:55 jasta Exp $ 00003 * 00004 * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2, or (at your option) any 00009 * later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 */ 00016 00017 #ifndef __TCPC_H 00018 #define __TCPC_H 00019 00020 /*****************************************************************************/ 00021 00032 /*****************************************************************************/ 00033 00034 #include "fdbuf.h" 00035 00036 /*****************************************************************************/ 00037 00042 typedef struct tcp_conn 00043 { 00047 FDBuf *buf; 00048 void *udata; 00054 int fd; 00056 in_addr_t host; 00057 in_port_t port; 00058 unsigned char outgoing : 1; 00061 unsigned long in; 00062 unsigned long out; 00067 Array *wqueue; 00068 input_id wqueue_id; 00069 float adjust; 00071 } TCPC; 00072 00073 typedef TCPC Connection; 00075 /*****************************************************************************/ 00076 00077 EXTERN_C_BEGIN 00078 00079 /*****************************************************************************/ 00080 00089 LIBGIFT_EXPORT 00090 TCPC *tcp_open (in_addr_t host, in_port_t port, int block); 00091 00098 LIBGIFT_EXPORT 00099 TCPC *tcp_accept (TCPC *listening, int block); 00100 00108 LIBGIFT_EXPORT 00109 TCPC *tcp_bind (in_port_t port, int block); 00110 00116 LIBGIFT_EXPORT 00117 void tcp_close (TCPC *c); 00118 00125 LIBGIFT_EXPORT 00126 void tcp_close_null (TCPC **c); 00127 00128 /*****************************************************************************/ 00129 00139 LIBGIFT_EXPORT 00140 int tcp_flush (TCPC *c, int write); 00141 00146 LIBGIFT_EXPORT 00147 int tcp_write (TCPC *c, unsigned char *data, size_t len); 00148 00152 LIBGIFT_EXPORT 00153 int tcp_writestr (TCPC *c, char *data); 00154 00158 LIBGIFT_EXPORT 00159 int tcp_send (TCPC *c, unsigned char *data, size_t len); 00160 00164 LIBGIFT_EXPORT 00165 FDBuf *tcp_readbuf (TCPC *c); 00166 00170 LIBGIFT_EXPORT 00171 int tcp_recv (TCPC *c, unsigned char *buf, size_t len); 00172 00176 LIBGIFT_EXPORT 00177 int tcp_peek (TCPC *c, unsigned char *buf, size_t len); 00178 00179 /*****************************************************************************/ 00180 00181 EXTERN_C_END 00182 00183 /*****************************************************************************/ 00184 00185 #endif /* __TCPC_H */

Generated on Sun Aug 22 08:07:10 2004 by doxygen 1.3.7