MALOC 0.1
|
00001 00039 #ifndef _VIO_H_ 00040 #define _VIO_H_ 00041 00042 #include <maloc/maloc_base.h> 00043 00044 #include <maloc/vnm.h> 00045 00046 /* 00047 * *************************************************************************** 00048 * Class Vio: Parameters and datatypes 00049 * *************************************************************************** 00050 */ 00051 00053 #define VPORTNUMBER 14916 00054 00055 #define VIO_MAXBUF 10 00056 00062 typedef enum VIOtype { 00063 VIO_NO_TYPE, 00064 VIO_SDIO, 00065 VIO_BUFF, 00066 VIO_FILE, 00067 VIO_UNIX, 00068 VIO_INET 00069 } VIOtype; 00070 00076 typedef enum VIOfrmt { 00077 VIO_NO_FRMT, 00078 VIO_XDR, 00079 VIO_ASC 00080 } VIOfrmt; 00081 00087 typedef enum VIOrwkey { 00088 VIO_NO_RW, 00089 VIO_R, 00090 VIO_W 00091 } VIOrwkey; 00092 00098 struct sVio { 00099 00100 VIOtype type; 00108 VIOfrmt frmt; 00113 VIOrwkey rwkey; 00118 char file[VMAX_ARGLEN]; 00119 char lhost[VMAX_ARGLEN]; 00120 char rhost[VMAX_ARGLEN]; 00122 int error; 00123 int dirty; 00125 FILE *fp; 00126 int so; 00127 int soc; 00128 void *name; 00129 void *axdr; 00131 char whiteChars[VMAX_ARGNUM]; 00132 char commChars[VMAX_ARGNUM]; 00134 char ioBuffer[VMAX_BUFSIZE]; 00135 int ioBufferLen; 00137 char putBuffer[VMAX_BUFSIZE]; 00138 int putBufferLen; 00140 char *VIObuffer; 00141 int VIObufferLen; 00142 int VIObufferPtr; 00144 }; 00145 00151 typedef struct sVio Vio; 00152 00153 /* 00154 * *************************************************************************** 00155 * Class Vio: Inlineable methods (vio.c) 00156 * *************************************************************************** 00157 */ 00158 00159 #if !defined(VINLINE_MALOC) 00160 #else /* if defined(VINLINE_MALOC) */ 00161 #endif /* if !defined(VINLINE_MALOC) */ 00162 00163 /* 00164 * *************************************************************************** 00165 * Class Vio: Non-Inlineable methods (vio.c) 00166 * *************************************************************************** 00167 */ 00168 00176 void Vio_start(void); 00177 00185 void Vio_stop(void); 00186 00199 Vio* Vio_ctor(const char *socktype, const char *datafrmt, 00200 const char *hostname, const char *filename, const char *rwkey); 00201 00215 int Vio_ctor2(Vio *thee, const char *socktype, const char *datafrmt, 00216 const char *hostname, const char *filename, const char *rwkey); 00217 00226 void Vio_dtor(Vio **thee); 00227 00236 void Vio_dtor2(Vio *thee); 00237 00247 void Vio_setWhiteChars(Vio *thee, char *whiteChars); 00248 00258 void Vio_setCommChars(Vio *thee, char *commChars); 00259 00272 int Vio_accept(Vio *thee, int nonblock); 00273 00282 void Vio_acceptFree(Vio *thee); 00283 00296 int Vio_connect(Vio *thee, int nonblock); 00297 00306 void Vio_connectFree(Vio *thee); 00307 00317 int Vio_scanf(Vio *thee, char *parms, ...); 00318 00328 int Vio_printf(Vio *thee, char *parms, ...); 00329 00340 int Vio_read(Vio *thee, char *buf, int bufsize); 00341 00352 int Vio_write(Vio *thee, char *buf, int bufsize); 00353 00364 void Vio_bufTake(Vio *thee, char *buf, int bufsize); 00365 00374 char* Vio_bufGive(Vio *thee); 00375 00384 int Vio_bufSize(Vio *thee); 00385 00398 Vio *Vio_socketOpen(char *key, 00399 const char *iodev, const char *iofmt, 00400 const char *iohost, const char *iofile); 00401 00410 void Vio_socketClose(Vio **sock); 00411 00412 #endif /* _VIO_H_ */ 00413 00414