MALOC  0.1
vio.h
Go to the documentation of this file.
1 
39 #ifndef _VIO_H_
40 #define _VIO_H_
41 
42 #include <maloc/maloc_base.h>
43 
44 #include <maloc/vnm.h>
45 
46 /*
47  * ***************************************************************************
48  * Class Vio: Parameters and datatypes
49  * ***************************************************************************
50  */
51 
53 #define VPORTNUMBER 14916
54 
55 #define VIO_MAXBUF 10
56 
62 typedef enum VIOtype {
69 } VIOtype;
70 
76 typedef enum VIOfrmt {
80 } VIOfrmt;
81 
87 typedef enum VIOrwkey {
91 } VIOrwkey;
92 
98 struct sVio {
99 
122  int error;
123  int dirty;
125  FILE *fp;
126  int so;
127  int soc;
128  void *name;
129  void *axdr;
140  char *VIObuffer;
144 };
145 
151 typedef struct sVio Vio;
152 
153 /*
154  * ***************************************************************************
155  * Class Vio: Inlineable methods (vio.c)
156  * ***************************************************************************
157  */
158 
159 #if !defined(VINLINE_MALOC)
160 #else /* if defined(VINLINE_MALOC) */
161 #endif /* if !defined(VINLINE_MALOC) */
162 
163 /*
164  * ***************************************************************************
165  * Class Vio: Non-Inlineable methods (vio.c)
166  * ***************************************************************************
167  */
168 
176 void Vio_start(void);
177 
185 void Vio_stop(void);
186 
199 Vio* Vio_ctor(const char *socktype, const char *datafrmt,
200  const char *hostname, const char *filename, const char *rwkey);
201 
215 int Vio_ctor2(Vio *thee, const char *socktype, const char *datafrmt,
216  const char *hostname, const char *filename, const char *rwkey);
217 
226 void Vio_dtor(Vio **thee);
227 
236 void Vio_dtor2(Vio *thee);
237 
247 void Vio_setWhiteChars(Vio *thee, char *whiteChars);
248 
258 void Vio_setCommChars(Vio *thee, char *commChars);
259 
272 int Vio_accept(Vio *thee, int nonblock);
273 
282 void Vio_acceptFree(Vio *thee);
283 
296 int Vio_connect(Vio *thee, int nonblock);
297 
306 void Vio_connectFree(Vio *thee);
307 
317 int Vio_scanf(Vio *thee, char *parms, ...);
318 
328 int Vio_printf(Vio *thee, char *parms, ...);
329 
340 int Vio_read(Vio *thee, char *buf, int bufsize);
341 
352 int Vio_write(Vio *thee, char *buf, int bufsize);
353 
364 void Vio_bufTake(Vio *thee, char *buf, int bufsize);
365 
374 char* Vio_bufGive(Vio *thee);
375 
384 int Vio_bufSize(Vio *thee);
385 
398 Vio *Vio_socketOpen(char *key,
399  const char *iodev, const char *iofmt,
400  const char *iohost, const char *iofile);
401 
410 void Vio_socketClose(Vio **sock);
411 
412 #endif /* _VIO_H_ */
413 
void Vio_dtor2(Vio *thee)
Work routine that Vio_dtor calls to do most of the destruction.
Definition: vio.h:65
void Vio_start(void)
Start Vio communication layer (init internal variables/buffers)
int Vio_bufSize(Vio *thee)
Return the length to the internal buffer.
void Vio_stop(void)
Shutdown Vio communication layer.
VIOfrmt
Parameter for compression type (XDR,ASC)
Definition: vio.h:76
Definition: vio.h:78
#define VMAX_BUFSIZE
Global constant.
Definition: maloc_base.h:229
Definition: vio.h:90
int Vio_connect(Vio *thee, int nonblock)
Connect to some socket on a remote machine (or on our machine)
char commChars[VMAX_ARGNUM]
Definition: vio.h:132
Contains public data members for Vio class.
Definition: vio.h:98
char whiteChars[VMAX_ARGNUM]
Definition: vio.h:131
int soc
Definition: vio.h:127
void Vio_acceptFree(Vio *thee)
Free the socket child that was used for the last accept.
VIOrwkey rwkey
Definition: vio.h:113
void * axdr
Definition: vio.h:129
int error
Definition: vio.h:122
int Vio_write(Vio *thee, char *buf, int bufsize)
Write bufsize characters from buf to output device.
char putBuffer[VMAX_BUFSIZE]
Definition: vio.h:137
void Vio_connectFree(Vio *thee)
Purge any output buffers (for <UNIX/INET>, else a no-op)
Definition: vio.h:63
void Vio_dtor(Vio **thee)
Destruct the Vio object.
void Vio_socketClose(Vio **sock)
Socket close from read or write.
int Vio_printf(Vio *thee, char *parms,...)
Mimic "printf" from an arbitrary Vio device.
VIOtype type
Definition: vio.h:100
VIOtype
Parameter for I/O type (sdio,buff,file,unix,inet)
Definition: vio.h:62
int ioBufferLen
Definition: vio.h:135
int Vio_ctor2(Vio *thee, const char *socktype, const char *datafrmt, const char *hostname, const char *filename, const char *rwkey)
Work routine that Vio_ctor calls to do most of the construction.
Vio * Vio_socketOpen(char *key, const char *iodev, const char *iofmt, const char *iohost, const char *iofile)
Socket open for read or write.
int VIObufferLen
Definition: vio.h:141
Definition: vio.h:68
char * VIObuffer
Definition: vio.h:140
VIOfrmt frmt
Definition: vio.h:108
#define VMAX_ARGLEN
Global constant.
Definition: maloc_base.h:227
Vio * Vio_ctor(const char *socktype, const char *datafrmt, const char *hostname, const char *filename, const char *rwkey)
Construct the Vio object.
int VIObufferPtr
Definition: vio.h:142
int so
Definition: vio.h:126
char ioBuffer[VMAX_BUFSIZE]
Definition: vio.h:134
Definition: vio.h:88
char rhost[VMAX_ARGLEN]
Definition: vio.h:120
Definition: vio.h:77
The base (or foundation) header for MALOC.
#define VMAX_ARGNUM
Global constant.
Definition: maloc_base.h:225
int dirty
Definition: vio.h:123
int Vio_scanf(Vio *thee, char *parms,...)
Mimic "scanf" from an arbitrary Vio device.
int putBufferLen
Definition: vio.h:138
void Vio_setCommChars(Vio *thee, char *commChars)
Set the comment character set for I/O stream.
Definition: vio.h:66
void * name
Definition: vio.h:128
Definition: vio.h:64
void Vio_setWhiteChars(Vio *thee, char *whiteChars)
Set the white character set for I/O stream.
Definition: vio.h:67
void Vio_bufTake(Vio *thee, char *buf, int bufsize)
Set the pointer to the internal buffer.
Definition: vio.h:79
char file[VMAX_ARGLEN]
Definition: vio.h:118
int Vio_accept(Vio *thee, int nonblock)
Accept any waiting connect attempt to our socket on our machine.
FILE * fp
Definition: vio.h:125
int Vio_read(Vio *thee, char *buf, int bufsize)
Read (up to) bufsize characters into buf from input device.
VIOrwkey
Parameter for rw type (R,RW)
Definition: vio.h:87
char * Vio_bufGive(Vio *thee)
Return the pointer to the internal buffer.
char lhost[VMAX_ARGLEN]
Definition: vio.h:119
Definition: vio.h:89
Header file for an ISO C [V]irtual [N]umerical [M]achine.