link.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
00003 Copyright (C) 2005- The University of Notre Dame
00004 This software is distributed under the GNU General Public License.
00005 See the file COPYING for details.
00006 */
00007 
00008 #ifndef LINK_H
00009 #define LINK_H
00010 
00044 #include "int_sizes.h"
00045 
00046 #include <time.h>
00047 #include <limits.h>
00048 #include <stdio.h>
00049 #include <sys/types.h>
00050 
00052 #define LINK_ADDRESS_MAX 48
00053 
00055 #define LINK_PORT_ANY 0
00056 
00058 #define LINK_FOREVER ((time_t)INT_MAX)
00059 
00066 struct link * link_connect( const char *addr, int port, time_t stoptime );
00067 
00074 struct link * link_serve( int port );
00075 
00083 struct link * link_serve_address( const char *addr, int port );
00084 
00090 struct link * link_accept( struct link *master, time_t stoptime );
00091 
00101 int  link_read( struct link *link, char *data, int length, time_t stoptime );
00102 
00112 int  link_read_avail( struct link *link, char *data, int length, time_t stoptime );
00113 
00121 int  link_write( struct link *link, const char *data, int length, time_t stoptime );
00122 
00130 int  link_usleep( struct link *link, int usec, int reading, int writing );
00131 
00135 void link_close( struct link *link );
00136 
00148 void link_window_set( int send_window, int recv_window );
00149 
00156 void link_window_get( struct link *link, int *send_window, int *recv_window );
00157 
00169 int  link_readline( struct link *link, char *line, int length, time_t stoptime );
00170 
00175 int  link_fd( struct link *link );
00176 
00177 int  link_nonblocking( struct link *link, int onoff );
00178 
00185 int  link_address_local( struct link *link, char *addr, int *port );
00186 
00193 int  link_address_remote( struct link *link, char *addr, int *port );
00194 
00195 INT64_T link_stream_to_buffer( struct link *link, char **buffer, time_t stoptime );
00196 
00197 INT64_T link_stream_to_fd( struct link *link, int fd, INT64_T length, time_t stoptime );
00198 INT64_T link_stream_to_file( struct link *link, FILE *file, INT64_T length, time_t stoptime );
00199 
00200 INT64_T link_stream_from_fd( struct link *link, int fd, INT64_T length, time_t stoptime );
00201 INT64_T link_stream_from_file( struct link *link, FILE *file, INT64_T length, time_t stoptime );
00202 
00203 INT64_T link_soak( struct link *link, INT64_T length, time_t stoptime );
00204 
00206 typedef enum {
00207         LINK_TUNE_INTERACTIVE,  
00208         LINK_TUNE_BULK          
00209 } link_tune_t;
00210 
00217 int  link_tune( struct link *link, link_tune_t mode );
00218 
00220 #define LINK_READ 1
00221 
00223 #define LINK_WRITE 2
00224 
00226 struct link_info {
00227         struct link *link;  
00228         int events;         
00229         int revents;        
00230 };
00231 
00240 int  link_poll( struct link_info *array, int nlinks, int msec );
00241 
00242 #endif
00243 
00244 
00245 
00246 
00247 
00248 
00249 
00250 
00251 
00252 
00253 
00254 
00255 

Generated on Mon Oct 18 08:38:06 2010 for cctools by  doxygen 1.4.7