Files | |
| file | vio.h |
| Class Vio: virtual <SDIO/FILE/BUFF/UNIX/INET> I/O layer. | |
Classes | |
| struct | sVio |
| Contains public data members for Vio class. More... | |
Typedefs | |
| typedef struct sVio | Vio |
| Declaration of the Vio class as the Vio structure. | |
Enumerations | |
| enum | VIOtype { VIO_NO_TYPE, VIO_SDIO, VIO_BUFF, VIO_FILE, VIO_UNIX, VIO_INET } |
| Parameter for I/O type (sdio,buff,file,unix,inet). More... | |
| enum | VIOfrmt { VIO_NO_FRMT, VIO_XDR, VIO_ASC } |
| Parameter for compression type (XDR,ASC). More... | |
| enum | VIOrwkey { VIO_NO_RW, VIO_R, VIO_W } |
| Parameter for rw type (R,RW). More... | |
Functions | |
| void | Vio_start (void) |
| Start Vio communication layer (init internal variables/buffers). | |
| void | Vio_stop (void) |
| Shutdown Vio communication layer. | |
| Vio * | Vio_ctor (const char *socktype, const char *datafrmt, const char *hostname, const char *filename, const char *rwkey) |
| Construct the Vio object. | |
| 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. | |
| void | Vio_dtor (Vio **thee) |
| Destruct the Vio object. | |
| void | Vio_dtor2 (Vio *thee) |
| Work routine that Vio_dtor calls to do most of the destruction. | |
| void | Vio_setWhiteChars (Vio *thee, char *whiteChars) |
| Set the white character set for I/O stream. | |
| void | Vio_setCommChars (Vio *thee, char *commChars) |
| Set the comment character set for I/O stream. | |
| int | Vio_accept (Vio *thee, int nonblock) |
| Accept any waiting connect attempt to our socket on our machine. | |
| void | Vio_acceptFree (Vio *thee) |
| Free the socket child that was used for the last accept. | |
| int | Vio_connect (Vio *thee, int nonblock) |
| Connect to some socket on a remote machine (or on our machine). | |
| void | Vio_connectFree (Vio *thee) |
| Purge any output buffers (for <UNIX/INET>, else a no-op). | |
| int | Vio_scanf (Vio *thee, char *parms,...) |
| Mimic "scanf" from an arbitrary Vio device. | |
| int | Vio_printf (Vio *thee, char *parms,...) |
| Mimic "printf" from an arbitrary Vio device. | |
| int | Vio_read (Vio *thee, char *buf, int bufsize) |
| Read (up to) bufsize characters into buf from input device. | |
| int | Vio_write (Vio *thee, char *buf, int bufsize) |
| Write bufsize characters from buf to output device. | |
| void | Vio_bufTake (Vio *thee, char *buf, int bufsize) |
| Set the pointer to the internal buffer. | |
| char * | Vio_bufGive (Vio *thee) |
| Return the pointer to the internal buffer. | |
| int | Vio_bufSize (Vio *thee) |
| Return the length to the internal buffer. | |
| Vio * | Vio_socketOpen (char *key, const char *iodev, const char *iofmt, const char *iohost, const char *iofile) |
| Socket open for read or write. | |
| void | Vio_socketClose (Vio **sock) |
| Socket close from read or write. | |
This class provides an abstraction of I/O to give acess to files, buffers, pipes, UNIX sockets, and INET sockets.
| enum VIOfrmt |
Parameter for compression type (XDR,ASC).
00076 { 00077 VIO_NO_FRMT, 00078 VIO_XDR, 00079 VIO_ASC 00080 } VIOfrmt;
| enum VIOrwkey |
| enum VIOtype |
| int Vio_accept | ( | Vio * | thee, | |
| int | nonblock | |||
| ) |
Accept any waiting connect attempt to our socket on our machine.
| thee | Pointer to the Vio object | |
| nonblock | index for a non-blocking socket Only for <UNIX/INET>; othewise it is ignored. nonblock==0 ==> block until a connect is attempted nonblock==1 ==> DO NOT block at all |
| void Vio_acceptFree | ( | Vio * | thee | ) |
Free the socket child that was used for the last accept.
| thee | Pointer to the Vio object |
| char* Vio_bufGive | ( | Vio * | thee | ) |
Return the pointer to the internal buffer.
| thee | Pointer to the Vio object |
| int Vio_bufSize | ( | Vio * | thee | ) |
Return the length to the internal buffer.
| thee | Pointer to the Vio object |
| void Vio_bufTake | ( | Vio * | thee, | |
| char * | buf, | |||
| int | bufsize | |||
| ) |
Set the pointer to the internal buffer.
| thee | Pointer to the Vio object | |
| buf | buffer containing message | |
| bufsize | number of items (of declared type) in buffer |
| int Vio_connect | ( | Vio * | thee, | |
| int | nonblock | |||
| ) |
Connect to some socket on a remote machine (or on our machine).
| thee | Pointer to the Vio object | |
| nonblock | index for a non-blocking socket Only for <UNIX/INET>; othewise it is ignored. nonblock==0 ==> block until a connect is attempted nonblock==1 ==> DO NOT block at all |
| void Vio_connectFree | ( | Vio * | thee | ) |
Purge any output buffers (for <UNIX/INET>, else a no-op).
| thee | Pointer to the Vio object |
| Vio* Vio_ctor | ( | const char * | socktype, | |
| const char * | datafrmt, | |||
| const char * | hostname, | |||
| const char * | filename, | |||
| const char * | rwkey | |||
| ) |
Construct the Vio object.
| socktype | Pointer to the socket type | |
| datafrmt | Pointer to the data format | |
| hostname | Pointer to network address of port | |
| filename | Pointer to the i/o file name | |
| rwkey | Pointer to the read/write options |
| 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.
| thee | Pointer to the Vio object | |
| socktype | Pointer to the socket type | |
| datafrmt | Pointer to the data format | |
| hostname | Pointer to network address of port | |
| filename | Pointer to the i/o file name | |
| rwkey | Pointer to the read/write options |
| void Vio_dtor | ( | Vio ** | thee | ) |
Destruct the Vio object.
| thee | Pointer to the Vio object |
| void Vio_dtor2 | ( | Vio * | thee | ) |
Work routine that Vio_dtor calls to do most of the destruction.
| thee | Pointer to the Vio object |
| int Vio_printf | ( | Vio * | thee, | |
| char * | parms, | |||
| ... | ||||
| ) |
Mimic "printf" from an arbitrary Vio device.
| thee | Pointer to the Vio object | |
| parms | Pointer to output parameters |
| int Vio_read | ( | Vio * | thee, | |
| char * | buf, | |||
| int | bufsize | |||
| ) |
Read (up to) bufsize characters into buf from input device.
| thee | Pointer to the Vio object | |
| buf | buffer containing message | |
| bufsize | number of items (of declared type) in buffer |
| int Vio_scanf | ( | Vio * | thee, | |
| char * | parms, | |||
| ... | ||||
| ) |
Mimic "scanf" from an arbitrary Vio device.
| thee | Pointer to the Vio object | |
| parms | Pointer to input parameters |
| void Vio_setCommChars | ( | Vio * | thee, | |
| char * | commChars | |||
| ) |
Set the comment character set for I/O stream.
| thee | Pointer to the Vio object | |
| commChars | comment character set |
| void Vio_setWhiteChars | ( | Vio * | thee, | |
| char * | whiteChars | |||
| ) |
Set the white character set for I/O stream.
| thee | Pointer to the Vio object | |
| whiteChars | white space character set |
| void Vio_socketClose | ( | Vio ** | sock | ) |
Socket close from read or write.
| sock | Socket for reading/writing the external data |
| Vio* Vio_socketOpen | ( | char * | key, | |
| const char * | iodev, | |||
| const char * | iofmt, | |||
| const char * | iohost, | |||
| const char * | iofile | |||
| ) |
Socket open for read or write.
| key | Pointer to the read/write option | |
| iodev | Pointer to open device for read/write | |
| iofmt | Pointer to i/o data format | |
| iohost | Pointer to i/o address of port | |
| iofile | Pointer to the i/o file name |
| void Vio_start | ( | void | ) |
Start Vio communication layer (init internal variables/buffers).
| void Vio_stop | ( | void | ) |
Shutdown Vio communication layer.
| int Vio_write | ( | Vio * | thee, | |
| char * | buf, | |||
| int | bufsize | |||
| ) |
Write bufsize characters from buf to output device.
| thee | Pointer to the Vio object | |
| buf | buffer containing message | |
| bufsize | number of items (of declared type) in buffer |
1.5.6