Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAVERNnet_rpcManager_c Class Reference

#include <CAVERNnet_rpc_c.hxx>

List of all members.

Public Methods

 CAVERNnet_rpcManager_c ()
int init (int maxRPCs=CAVERNnet_rpcManager_c::DEFAULT_RPCS, int inPort=CAVERNnet_rpcManager_c::DEFAULT_PORT)
int manage (char *procedureName, int(*callback)(char *indata, int inlen, char **outdata, int *outlen))
int unmanage (char *procedureName)
void process ()
void showStats (char *streamInfo, char *comment)
int logStats (char *streamInfo, char *comment, FILE *filePtr)
int sendStats (char *streamInfo, char *comment)
int initSendStats (char *monitorClientIP, int port=PERF_DAEMON_DEFAULT_PORT)
void exitSendStats ()

Static Public Attributes

const int DEFAULT_RPCS
const int DEFAULT_PORT
const int OK
 RPC status ok.

const int CANNOT_MANAGE_ANY_MORE
 RPC run out of space for handlers.

const int RPC_NOT_FOUND
 RPC not found in manager.

const int MEM_ALLOC_ERR
 Mem alloc error occured in RPC call.

const int FAILED
 RPC call failed.


Private Methods

int replyRPC (CAVERNnet_tcpClient_c *client, char *returnValue, int returnSize)
CAVERNnet_rpcHandle_c* findRPC (char *)
int handleRPC (CAVERNnet_tcpClient_c *client)

Private Attributes

int maxNumRPCs
CAVERNnet_rpcHandle_c* handleList
CAVERNnet_tcpServer_c server
CAVERNnet_perfMonitor_c pmonitor


Detailed Description

Remote Procedure Call Manager class. This class handles incoming RPC calls.


Member Function Documentation

void CAVERNnet_rpcManager_c::exitSendStats ( )
 

Properly delete the perfDaemonClient after sendStats is done

int CAVERNnet_rpcManager_c::init ( int maxRPCs = CAVERNnet_rpcManager_c :: DEFAULT_RPCS,
int inPort = CAVERNnet_rpcManager_c :: DEFAULT_PORT )
 

Initialize RPC manager.

Parameters:
maxRPCs   maximum number of RPCs the manager can handle.
inPort   listening port of manager.
Returns:
FAILED or OK

int CAVERNnet_rpcManager_c::initSendStats ( char * monitorClientIP,
int port = PERF_DAEMON_DEFAULT_PORT )
 

Initialize sendStats - provide the IP of the perfDaemon and an optional port number to connect to. This should be done initially before using the sendStats API.

Parameters:
monitorClientIP   IP address of the perfDameon to connect to
port   Port number at which the perfDaemon is running -this is optional. The default port number for perfDaemon is 9500 -so a different port number has to be specified if the perfDaemon is running ona different port.

Returns:
Either CAVERNnet_perfMonitor_c::OK or CAVERNnet_perfMonitor_c::FAILED

int CAVERNnet_rpcManager_c::logStats ( char * streamInfo,
char * comment,
FILE * filePtr )
 

This logs performance statistics in a file. The user opens a file and passes the file pointer with this function and results of monitoring are written into the logfile.

Parameters:
streamInfo   A label describing the stream that is being monitored.
comment   A comment on the event that marks the time at which the stream is being monitored
filePtr   File pointer to the file in which the results of monitoring are to be stored

Returns:
Either CAVERNnet_perfMonitor_c::OK or CAVERNnet_perfMonitor_c::FAILED

int CAVERNnet_rpcManager_c::manage ( char * procedureName,
int(* callback)(char *indata, int inlen,char **outdata, int *outlen) )
 

Manage a procedure.

Parameters:
procedureName   name of procedure.
callback   user callback to call in response to RPC
Returns:
MEM_ALLOC_ERR, OK, CANNOT_MANAGE_ANY_MORE

void CAVERNnet_rpcManager_c::process ( )
 

Process RPCs. Do this in a while loop.

int CAVERNnet_rpcManager_c::sendStats ( char * streamInfo,
char * comment )
 

Sends the performance statistics to a remote perfdaemon -for further analysis of the monitored data - the initSendStats API should be called first, before calling a sendStats (In order to connect to the perfdaemon initially)

Parameters:
streamInfo   A label describing the stream that is being monitored.
comment   A comment on the event that marks the time at which the stream is being monitored

Returns:
Either CAVERNnet_perfMonitor_c::OK or CAVERNnet_perfMonitor_c::FAILED

void CAVERNnet_rpcManager_c::showStats ( char * streamInfo,
char * comment )
 

Displays the resultant statistics instantaneously in the netlogger format - this should be typically done after a read/write is done a network.

Also, it should be noted that a showStats call should be made at the end of atleast one send and receive for two-way information (the same applies for logStats and sendStats)

Parameters:
streamInfo   A label describing the stream that is being monitored.
comment   A comment on the event that marks the time at which the stream is being monitored

int CAVERNnet_rpcManager_c::unmanage ( char * procedureName )
 

Unmanage a procedure.

Returns:
OK or RPC_NOT_FOUND


Member Data Documentation

const int CAVERNnet_rpcManager_c::DEFAULT_PORT [static]
 

Default RPC listening port. Default is 9000.

const int CAVERNnet_rpcManager_c::DEFAULT_RPCS [static]
 

Default setting for the number of RPCs a manager can handle. Default is 64


The documentation for this class was generated from the following file:
Generated at Mon Jul 2 14:24:44 2001 for CAVERNsoft by doxygen1.2.8-20010617 written by Dimitri van Heesch, © 1997-2001