Although the same DataIPC module is used for both the server and the client, the applications contain significant differences between them. On the server side the DataIPC module is treated like any other DataFun interface: a file is opened, datasets are read, and the file is closed. On the client side a DataFun object is set into the DataIPC object and DataIPC is put in a listening mode to process requests from the server. Once the server is done with the interprocess communication it tells the client to terminate the listening mode.
The DataIPC module can use either the VSocket module for interprocess communication or a user-defined communication mechanism. If a user-defined mechanism is employed, callback functions for sending and receiving data must be implemented. In this case, it is the user's responsibility to ensure that byte swapping between different platforms is properly accounted for.
The DataIPC module contains the following functions.
*vdm_DataIPCBegin - create an instance of a DataIPC object vdm_DataIPCEnd - destroy an instance of a DataIPC object vdm_DataIPCError - return DataIPC object error flag
vdm_DataIPCDef - specify client/server and connection type vdm_DataIPCInq - inquire for client/server and connection type
vdm_DataIPCSetSwap - set user interface swap toggle
vdm_DataIPCDataFun - fill a DataFun object vdm_DataIPCStartServer - initiate server's listening mode
vdm_DataIPCStopServer - terminate server's listening mode vdm_DataIPCSetObject - set a DataFun object for processing vdm_DataIPCGetObject - get DataFun object used for processing vdm_DataIPCSetFunction - set monitoring, read, and write functions vdm_DataIPCGetInteger - retrieve integer parameters from client vdm_DataIPCGetString - retrieve string parameters from client vdm_DataIPCAbort - abort client vdm_DataIPCUser - communicate user data to server
On the client side use vdm_DataIPCDataFun to fill a DataFun object. Once a connection to the client is established, use the DataFun object to retrieve information from the client using vdm_DataFunOpen, vdm_DataFunReadDataset, etc. The client application can interact directly with the server using function vdm_DataIPCUser. If this function is called its parameters are passed to the server via a call-back mechanism whose function pointer is set with vdm_DataIPCSetFunction. If the client is no longer required, terminate the connection with the server with vdm_DataIPCStopServer.
On the server side use vdm_DataIPCSetObject to set a DataFun object. This DataFun object must be filled with the format that will be required of the server when it issues vdm_DataFunOpen. Start the server's communication with a particular client with vdm_DataIPCStartServer. This function call can only be terminated in two ways: either by issuing vdm_DataIPCAbort via a monitor function, or by having the client call vdm_DataIPCStopServer.
*vdm_DataIPCBegin - create an instance of a DataIPC object
vdm_DAtaIPC *vdm_DataIPCBegin ()
None
Destroy an instance of a DataIPC object using
void vdm_DataIPCEnd (vdm_DataIPC *dataipc)
Return the current value of a DataIPC object error flag using
Vint vdm_DataIPCError (vdm_DataIPC *dataipc)
vdm_DataIPCDef - define client or server and connection type
void vdm_DataIPCDef (vdm_DataIPC *dataipc, Vint type)
dataipc Pointer to DataIPC object. type Connection type =DATAIPC_SERVER Server type =DATAIPC_CLIENT Client type
None
Inquire of defined type as output arguments using
void vdm_DataIPCInq (vdm_DataIPC *dataipc, Vint *type)
vdm_DataIPCSetSwap - Set swap flag for user connection callback
void vdm_DataIPCSetSwap (vdm_DataIPC *dataipc, Vint swap)
dataipc Pointer to DataIPC object. swap Swap toggle =SYS_ON =SYS_OFF
None
None
vdm_DataIPCDataFun - Server function to fill a DataFun object
void vdm_DataIPCDataFun (vdm_DataIPC *dataipc, vdm_DataFun *datafun)
dataipc Pointer to DataIPC object. datafun Pointer to DataFun object to be filled with data functions
None
vdm_DataIPCStopServer - Client function to stop server's communication mode
void vdm_DataIPCStopServer (vdm_DataIPC *dataipc)
dataipc Pointer to DataIPC object.
None
vdm_DataIPCSetObject - Client function to store an object
void vdm_DataIPCSetObject (vdm_DataIPC *dataipc, Vint type, Vobject *obj)
dataipc Pointer to DataIPC object. type Object type =VDM_DATAFUN obj Object to be stored
None
void vis_DataIPCGetObject (vdm_DataIPC *dataipc, Vint type, Vobject **obj)
vdm_DataIPCStartServer - Server function to start communication with client
void vdm_DataIPCStartServer (vdm_DataIPC *dataipc)
dataipc Pointer to DataIPC object.
None
vdm_DataIPCSetFunction - set a function pointer
void vdm_DataIPCSetFunction (vdm_DataIPC *dataipc, Vint functype, Vfunc *function, Vobject *object)
dataipc Pointer to DataIPC object. functype The function type identifier =DATAIPC_FUN_MONITOR Monitoring function =DATAIPC_FUN_READ Reading function =DATAIPC_FUN_WRITE Writing function =DATAIPC_FUN_USER Function to interact with client function Pointer to the function to be called object Pointer to a user object to be passed to the monitoring function
None
The DATAIPC_FUN_MONITOR prototype is
void function (vdm_DataIPC *dataipc, Vobject *object)A callback is not invoked if it is NULL. The methods vdm_DataIPCAbort, vdm_DataIPCGetInteger, and vdm_DataIPCGetString can be called from within the monitoring function if necessary. The first aborts the client's listening mode, while the second and third functions provides information on its status.
The DATAIPC_FUN_READ prototype is
void function (Vobject *obj, Vint size, Vchar *buffer)
The first argument object is the user's object. The second argument size is the number of bytes being sent. The third argument buffer is the binary data being received. If vdm_DataIPCSetSwap is called indicating that swapping is to take place, then DataIPC will perform the swapping after the data is received. DataIPC will not swap character strings.
The DATAIPC_FUN_WRITE prototype is
void function (Vobject *object, Vint size, Vchar *buffer)
The first argument object is the user's object. The second argument size is the number of bytes being sent. The third argument buffer is the binary data being sent.
The DATAIPC_FUN_USER prototype is
void function (vdm_DataIPC *dataipc, vdm_DataFun *datafun, Vint nchars, Vchar chars[], Vint nints, Vint ints[], Vint nfloats, Vfloat floats[], Vint ndoubles, Vdouble doubles[])
This function uses no user object. The first argument is the server's DataIPC object. The second is the DataFun object set on the server. The remaining arguments come directly from the client through function vdm_DataIPCUser. These arguments can be updated by the user and are sent back to the client once the function terminates.
vdm_DataIPCGetInteger - retrieve integer status information
void vdm_DataIPCGetInteger (vdm_DataIPC *dataipc, Vint type, Vint iparam[])
dataipc Pointer to DataIPC object. type Type of parameter to be queried =DATAIPC_DATAFUN The DataFun callback being executed =DATAIPC_STATE Toggle for call before or after execution =DATAIPC_FILETYPE Enumerated format currently in use
iparam Values(s) retrieved
vdm_DataIPCGetString - retrieve character string status information
void vdm_DataIPCGetString (vdm_DataIPC *dataipc, Vint type, Vchar cparam[])
dataipc Pointer to DataIPC object. type Type of parameter to be queried =DATAIPC_FILENAME The file name
cparam Values retrieved
vdm_DataIPCAbort - abort the client's listening mode
void vdm_DataIPCAbort (vdm_DataIPC *dataipc)
dataipc Pointer to DataIPC object.
None
None
vdm_DataIPCUser - communicate user data to server
void vdm_DataIPCUser (vdm_DataIPC *dataipc, Vint nchars, Vchar chars[], Vint nints, Vint ints[], Vint nfloats[], Vfloat floats[], Vint ndoubles, Vdouble doubles[])
dataipc Pointer to DataIPC object. nchars Number of entries in character array chars chars String array nints Number of entries in integer array ints ints Integer array nfloats Number of entries in float array floats floats Float array ndouble Number of entries in double array doubles doubles Double array
None
None
On the server side the call-back function is set with vdm_DataIPCSetFunction with function type set to DATAIPC_FUN_USER. The call-back function's arguments are described in vdm_DataIPCSetFunction.