vio.h
Go to the documentation of this file.
#ifndef _VIO_H_
#define _VIO_H_
#include <maloc/maloc_base.h>
#include <maloc/vnm.h>
/*
* ***************************************************************************
* Class Vio: Parameters and datatypes
* ***************************************************************************
*/
#define VPORTNUMBER 14916
#define VIO_MAXBUF 10
typedef enum VIOtype {
VIO_NO_TYPE,
VIO_SDIO,
VIO_BUFF,
VIO_FILE,
VIO_UNIX,
VIO_INET
} VIOtype;
typedef enum VIOfrmt {
VIO_NO_FRMT,
VIO_XDR,
VIO_ASC
} VIOfrmt;
typedef enum VIOrwkey {
VIO_NO_RW,
VIO_R,
VIO_W
} VIOrwkey;
struct sVio {
VIOtype type;
VIOfrmt frmt;
VIOrwkey rwkey;
char file[VMAX_ARGLEN];
char lhost[VMAX_ARGLEN];
char rhost[VMAX_ARGLEN];
int error;
int dirty;
FILE *fp;
int so;
int soc;
void *name;
void *axdr;
char whiteChars[VMAX_ARGNUM];
char commChars[VMAX_ARGNUM];
char ioBuffer[VMAX_BUFSIZE];
int ioBufferLen;
char putBuffer[VMAX_BUFSIZE];
int putBufferLen;
char *VIObuffer;
int VIObufferLen;
int VIObufferPtr;
};
typedef struct sVio Vio;
/*
* ***************************************************************************
* Class Vio: Inlineable methods (vio.c)
* ***************************************************************************
*/
#if !defined(VINLINE_MALOC)
#else /* if defined(VINLINE_MALOC) */
#endif /* if !defined(VINLINE_MALOC) */
/*
* ***************************************************************************
* Class Vio: Non-Inlineable methods (vio.c)
* ***************************************************************************
*/
void Vio_start(void);
void Vio_stop(void);
Vio* Vio_ctor(const char *socktype, const char *datafrmt,
const char *hostname, const char *filename, const char *rwkey);
int Vio_ctor2(Vio *thee, const char *socktype, const char *datafrmt,
const char *hostname, const char *filename, const char *rwkey);
void Vio_dtor(Vio **thee);
void Vio_dtor2(Vio *thee);
void Vio_setWhiteChars(Vio *thee, char *whiteChars);
void Vio_setCommChars(Vio *thee, char *commChars);
int Vio_accept(Vio *thee, int nonblock);
void Vio_acceptFree(Vio *thee);
int Vio_connect(Vio *thee, int nonblock);
void Vio_connectFree(Vio *thee);
int Vio_scanf(Vio *thee, char *parms, ...);
int Vio_printf(Vio *thee, char *parms, ...);
int Vio_read(Vio *thee, char *buf, int bufsize);
int Vio_write(Vio *thee, char *buf, int bufsize);
void Vio_bufTake(Vio *thee, char *buf, int bufsize);
char* Vio_bufGive(Vio *thee);
int Vio_bufSize(Vio *thee);
Vio *Vio_socketOpen(char *key,
const char *iodev, const char *iofmt,
const char *iohost, const char *iofile);
void Vio_socketClose(Vio **sock);
#endif /* _VIO_H_ */
maloc_base.h
The base (or foundation) header for MALOC.
VMAX_ARGNUM
#define VMAX_ARGNUM
Global constant.
Definition maloc_base.h:225
VMAX_BUFSIZE
#define VMAX_BUFSIZE
Global constant.
Definition maloc_base.h:229
VMAX_ARGLEN
#define VMAX_ARGLEN
Global constant.
Definition maloc_base.h:227
vnm.h
Header file for an ISO C [V]irtual [N]umerical [M]achine.
Vio_bufSize
int Vio_bufSize(Vio *thee)
Return the length to the internal buffer.
Vio_stop
void Vio_stop(void)
Shutdown Vio communication layer.
Vio_write
int Vio_write(Vio *thee, char *buf, int bufsize)
Write bufsize characters from buf to output device.
Vio_scanf
int Vio_scanf(Vio *thee, char *parms,...)
Mimic "scanf" from an arbitrary Vio device.
Vio_acceptFree
void Vio_acceptFree(Vio *thee)
Free the socket child that was used for the last accept.
Vio_start
void Vio_start(void)
Start Vio communication layer (init internal variables/buffers)
Vio_printf
int Vio_printf(Vio *thee, char *parms,...)
Mimic "printf" from an arbitrary Vio device.
Vio_socketOpen
Vio * Vio_socketOpen(char *key, const char *iodev, const char *iofmt, const char *iohost, const char *iofile)
Socket open for read or write.
Vio_setWhiteChars
void Vio_setWhiteChars(Vio *thee, char *whiteChars)
Set the white character set for I/O stream.
Vio_socketClose
void Vio_socketClose(Vio **sock)
Socket close from read or write.
Vio_connect
int Vio_connect(Vio *thee, int nonblock)
Connect to some socket on a remote machine (or on our machine)
VIOfrmt
VIOfrmt
Parameter for compression type (XDR,ASC)
Definition vio.h:76
Vio_accept
int Vio_accept(Vio *thee, int nonblock)
Accept any waiting connect attempt to our socket on our machine.
Vio_ctor
Vio * Vio_ctor(const char *socktype, const char *datafrmt, const char *hostname, const char *filename, const char *rwkey)
Construct the Vio object.
VIOtype
VIOtype
Parameter for I/O type (sdio,buff,file,unix,inet)
Definition vio.h:62
Vio_dtor
void Vio_dtor(Vio **thee)
Destruct the Vio object.
Vio_read
int Vio_read(Vio *thee, char *buf, int bufsize)
Read (up to) bufsize characters into buf from input device.
Vio_bufTake
void Vio_bufTake(Vio *thee, char *buf, int bufsize)
Set the pointer to the internal buffer.
Vio_connectFree
void Vio_connectFree(Vio *thee)
Purge any output buffers (for <UNIX/INET>, else a no-op)
Vio_setCommChars
void Vio_setCommChars(Vio *thee, char *commChars)
Set the comment character set for I/O stream.
Vio_bufGive
char * Vio_bufGive(Vio *thee)
Return the pointer to the internal buffer.
VIOrwkey
VIOrwkey
Parameter for rw type (R,RW)
Definition vio.h:87
Vio_dtor2
void Vio_dtor2(Vio *thee)
Work routine that Vio_dtor calls to do most of the destruction.
Vio_ctor2
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_XDR
@ VIO_XDR
Definition vio.h:78
VIO_NO_FRMT
@ VIO_NO_FRMT
Definition vio.h:77
VIO_ASC
@ VIO_ASC
Definition vio.h:79
VIO_NO_TYPE
@ VIO_NO_TYPE
Definition vio.h:63
VIO_FILE
@ VIO_FILE
Definition vio.h:66
VIO_UNIX
@ VIO_UNIX
Definition vio.h:67
VIO_BUFF
@ VIO_BUFF
Definition vio.h:65
VIO_SDIO
@ VIO_SDIO
Definition vio.h:64
VIO_INET
@ VIO_INET
Definition vio.h:68
VIO_NO_RW
@ VIO_NO_RW
Definition vio.h:88
VIO_W
@ VIO_W
Definition vio.h:90
VIO_R
@ VIO_R
Definition vio.h:89
sVio
Contains public data members for Vio class.
Definition vio.h:98
sVio::putBuffer
char putBuffer[VMAX_BUFSIZE]
Definition vio.h:137
sVio::type
VIOtype type
Definition vio.h:100
sVio::ioBufferLen
int ioBufferLen
Definition vio.h:135
sVio::rwkey
VIOrwkey rwkey
Definition vio.h:113
sVio::commChars
char commChars[VMAX_ARGNUM]
Definition vio.h:132
sVio::VIObufferPtr
int VIObufferPtr
Definition vio.h:142
sVio::fp
FILE * fp
Definition vio.h:125
sVio::frmt
VIOfrmt frmt
Definition vio.h:108
sVio::dirty
int dirty
Definition vio.h:123
sVio::soc
int soc
Definition vio.h:127
sVio::lhost
char lhost[VMAX_ARGLEN]
Definition vio.h:119
sVio::whiteChars
char whiteChars[VMAX_ARGNUM]
Definition vio.h:131
sVio::ioBuffer
char ioBuffer[VMAX_BUFSIZE]
Definition vio.h:134
sVio::VIObufferLen
int VIObufferLen
Definition vio.h:141
sVio::file
char file[VMAX_ARGLEN]
Definition vio.h:118
sVio::name
void * name
Definition vio.h:128
sVio::axdr
void * axdr
Definition vio.h:129
sVio::VIObuffer
char * VIObuffer
Definition vio.h:140
sVio::putBufferLen
int putBufferLen
Definition vio.h:138
sVio::so
int so
Definition vio.h:126
sVio::rhost
char rhost[VMAX_ARGLEN]
Definition vio.h:120
sVio::error
int error
Definition vio.h:122