vocMsg.c File Reference

#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <pthread.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <errno.h>
#include <signal.h>
#include <netdb.h>
#include <fcntl.h>
#include <sys/uio.h>
#include "VOClient.h"

Defines

#define _VOCLIENT_LIB_
#define SELWIDTH   32
#define SZ_CHUNK   4096
#define SZ_BULKDATA   1024000

Functions

vocMsg_t * msg_newCallMsg (ObjectID objid, char *method, int nparams)
 Create a CALL message structure initialized w/ parameters.
vocMsg_t * msg_newResultMsg (int status, int type, int nitems)
 Create a RESULT message structure initialized w/ parameters.
vocMsg_t * msg_newMsg (char *msgclass, char *str)
 Create a MSG message initialized w/ parameters.
vocMsg_t * msg_shutdownMsg ()
 Create a END message to shutdown the server.
vocMsg_t * msg_quitMsg ()
 Create a QUIT message.
vocMsg_t * msg_ackMsg ()
 Create an ACK message.
vocMsg_t * msg_noackMsg ()
 Create a NOACK message.
vocRes_t * msg_sendMsg (int fd, vocMsg_t *msg)
 Send the message to the VOClient server.
int msg_sendRawMsg (int fd, vocMsg_t *msg)
 Send the message to the VOClient server.
vocRes_t * msg_getResult (int fd)
 Read and parse a result message.
vocRes_t * msg_getResultToFile (int fd, char *fname, int overwrite)
 Read and parse a result message, saving data to named file.
void msg_addIntParam (vocMsg_t *msg, int ival)
 Add a int parameter to an outgoing CALL message.
void msg_addFloatParam (vocMsg_t *msg, double dval)
 Add a float parameter to an outgoing CALL message.
void msg_addStringParam (vocMsg_t *msg, char *str)
 Add a string parameter to an outgoing CALL message.
void msg_addIntResult (vocMsg_t *msg, int ival)
 Add a integer value to a RESULT string.
void msg_addFloatResult (vocMsg_t *msg, double dval)
void msg_addStringResult (vocMsg_t *msg, char *str)
 Add a string value to a RESULT string.
int msg_resultStatus (vocRes_t *res)
 Get result status.
int msg_resultType (vocRes_t *res)
 Get result type.
int msg_resultLength (vocRes_t *res)
 Get result length.
int msg_getIntResult (vocRes_t *res, int index)
 Get an integer result by index.
double msg_getFloatResult (vocRes_t *res, int index)
 Get a float result by index.
char * msg_getStringResult (vocRes_t *res, int index)
 Get a string result by index.
void * msg_getBuffer (vocRes_t *res)
 Get result buffer.

Variables

VOClient * vo

Detailed Description

VOCMSG.C -- VOClient Messaging Interface. This interface is used internally to communicate between the API and the VOClient Daemon.

msg = newCallMsg (objid, method, nparams) msg = newResultMsg (status, type, nitems) msg = newMsg (msgclass, str)

msgAddIntParam (msg, ival) msgAddFloatParam (msg, dval) msgAddStringParam (msg, str)

msgAddIntResult (msg, ival) msgAddFloatResult (msg, dval) msgAddStringResult (msg, str)

sendMsg (fd, msg) freeMsg (msg)

res = getResult (fd) # for reading RESULT msgs freeResult (res)

stat = resultStatus (res) type = resultType (res) nitems = resultLength (res)

ival = getIntResult (res, index) dval = getFloatResult (res, index) str = getStringResult (res, index)

Author:
Michael Fitzpatrick
Version:
June 2006

Function Documentation

msg msg_ackMsg ( void   ) 

Create an ACK message.

MSG_ACKMSG -- Create an ACK message to the VOClient Server.

Returns:
a new message object

msg_addFloatParam ( vocMsg_t *  msg,
double  dval 
)

Add a float parameter to an outgoing CALL message.

MSG_ADDFLOATPARAM -- Add a float parameter to an outgoing CALL message. We simply append to an existing message.

Parameters:
msg outgoing message
dval double value
Returns:
nothing

msg_addIntParam ( vocMsg_t *  msg,
int  ival 
)

Add a int parameter to an outgoing CALL message.

MSG_ADDINTPARAM -- Add a int parameter to an outgoing CALL message. We simply append to an existing message.

Parameters:
msg outgoing message
ival integer value
Returns:
nothing

msg_addIntResult ( vocMsg_t *  msg,
int  ival 
)

Add a integer value to a RESULT string.

MSG_ADDINTRESULT -- Add an integer value to a RESULT string.

Parameters:
msg result string
ival integer value
Returns:
nothing

msg_addStringParam ( vocMsg_t *  msg,
char *  str 
)

Add a string parameter to an outgoing CALL message.

MSG_ADDSTRINGPARAM -- Add a string parameter to an outgoing CALL message. We simply append to an existing message.

Parameters:
msg outgoing message
str string value
Returns:
nothing

msg_addStringResult ( vocMsg_t *  msg,
char *  str 
)

Add a string value to a RESULT string.

MSG_ADDSTRINGRESULT -- Add a string value to a RESULT string.

Parameters:
msg result string
str string value
Returns:
nothing

len msg_getBuffer ( vocRes_t *  res  ) 

Get result buffer.

MSG_GETBUFFER -- Get result buffer.

Parameters:
res result message
Returns:
pointer to result buffer

dval msg_getFloatResult ( vocRes_t *  res,
int  index 
)

Get a float result by index.

MSG_GETFLOATRESULT -- Get a float result by index.

Parameters:
res result message
index result index
Returns:
float value

ival msg_getIntResult ( vocRes_t *  res,
int  index 
)

Get an integer result by index.

MSG_GETINTRESULT -- Get an integer result by index.

Parameters:
res result message
index result index
Returns:
integer value

res msg_getResult ( int  fd  ) 

Read and parse a result message.

MSG_GETRESULT -- Read and parse a result message.

Parameters:
fd message channel descriptor
Returns:
result message object

res msg_getResultToFile ( int  fd,
char *  fname,
int  overwrite 
)

Read and parse a result message, saving data to named file.

MSG_GETRESULTTOFILE -- Read and parse a result message, save bulk data to the named file.

Parameters:
fd message channel descriptor
Returns:
result message object

str msg_getStringResult ( vocRes_t *  res,
int  index 
)

Get a string result by index.

MSG_GETSTRINGRESULT -- Get a string result by index.

Parameters:
res result message
index result index
Returns:
string value

msg msg_newCallMsg ( ObjectID  objid,
char *  method,
int  nparams 
)

Create a CALL message structure initialized w/ parameters.

MSG_NEWCALLMSG -- Create a CALL message structure and initialize with the requested parameters. Structures are allocated dynamically, the caller is responsible for freeing the struct when finished.

Parameters:
objid object id
method name of method to call
nparams number of parameters in message
Returns:
a new message object

msg msg_newMsg ( char *  msgclass,
char *  str 
)

Create a MSG message initialized w/ parameters.

MSG_NEWMSG -- Create a new MSG message context and initialize with the requested parameters. The caller is responsible for freeing the struct when complete.

Parameters:
msgclass message class
str message string
Returns:
a new message object

msg msg_newResultMsg ( int  status,
int  type,
int  nitems 
)

Create a RESULT message structure initialized w/ parameters.

MSG_NEWRESULTMSG -- Create a new RESULT message context and initialize with the requested parameters. The caller is responsible for freeing the struct when complete.

Parameters:
status result status
type result type
nitems number of items in message
Returns:
a new message object

msg msg_noackMsg ( void   ) 

Create a NOACK message.

MSG_NOACKMSG -- Create an NO-ACK message to the VOClient Server.

Returns:
a new message object

msg msg_quitMsg ( void   ) 

Create a QUIT message.

MSG_QUITMSG -- Create a QUIT message to the VOClient Server to tell it we're leaving but that it should keep running

Returns:
a new message object

len msg_resultLength ( vocRes_t *  res  ) 

Get result length.

MSG_RESULTLENGTH -- Get result length.

Parameters:
msg result string
Returns:
result length

status msg_resultStatus ( vocRes_t *  res  ) 

Get result status.

MSG_RESULTSTATUS -- Get result status.

Parameters:
msg result string
Returns:
result status

type msg_resultType ( vocRes_t *  res  ) 

Get result type.

MSG_RESULTTYPE -- Get result type.

Parameters:
msg result string
Returns:
result type

msg msg_sendMsg ( int  fd,
vocMsg_t *  msg 
)

Send the message to the VOClient server.

MSG_SENDMSG -- Send the message to the VOClient Server and wait for the ACK. The simple form of the message returns the result handle, for the raw message we only send to allow to a bullk return object.

Parameters:
fd message channel descriptor
str message string
Returns:
a new message object

len msg_sendRawMsg ( int  fd,
vocMsg_t *  msg 
)

Send the message to the VOClient server.

MSG_SENDRAWMSG -- Send the message to the VOClient Server.

Parameters:
fd message channel descriptor
str message string
Returns:
a new message object

msg msg_shutdownMsg ( void   ) 

Create a END message to shutdown the server.

MSG_SHUTDOWNMSG -- Create an END message to the VOClient Server to shut it down.

Returns:
a new message object


Generated on Wed Feb 27 21:08:58 2013 for VOClient API by  doxygen 1.5.9