Once a request arrives on a CCS server socket, the CCS server runtime looks up the appropriate handler and calls it. If no handler is found, the runtime prints a diagnostic and ignores the message.
CCS calls its handlers in the usual CONVERSE fashion- the request data is passed as a newly-allocated message, and the actual user data begins CmiMsgHeaderSizeBytes into the message. The handler is responsible for CmiFree'ing the passed-in message.
The interface for the server side of CCS is included in ``converse.h''; if CCS is disabled (in conv-mach.h), all CCS routines become macros returning 0.
The handler registration interface is:
void CcsUseHandler(char *id, int hdlr);
int CcsRegisterHandler(char *id, CmiHandler fn);
Associate this handler ID string with this function.
hdlr is a CONVERSE handler index; fn is a function pointer.
The ID string cannot be more than 32 characters, including the
terminating NULL.
After a handler has been registered to CCS, the user can also setup a merging function. This function will be passed in to CmiReduce to combine replies to multicast and broadcast requests.
void CcsSetMergeFn(const char *name, CmiReduceMergeFn newMerge);
Associate the given merge function to the CCS identified by id. This will
be used for CCS request received as broadcast or multicast.
These calls can be used from within a CCS handler:
int CcsEnabled(void);
Return 1 if CCS routines are available (from conv-mach.h).
This routine does not determine if a CCS server port is
actually open.
int CcsIsRemoteRequest(void);
Return 1 if this handler was called via CCS; 0 if it was
called as the result of a normal CONVERSE message.
void CcsCallerId(skt_ip_t *pip, unsigned int *pport);
Return the IP address and TCP port number
of the CCS client that invoked this method.
Can only be called from a CCS handler invoked remotely.
void CcsSendReply(int size, const void *reply);
Send the given data back to the client as a reply.
Can only be called from a CCS handler invoked remotely.
In case of broadcast or multicast CCS requests, the handlers in
all processors involved must call this function.
CcsDelayedReply CcsDelayReply(void);
Allows a CCS reply to be delayed until after the handler
has completed. Returns a token used below.
void CcsSendDelayedReply(CcsDelayedReply d,int size, const void *reply);
Send a CCS reply for the given request. Unlike
CcsSendReply, can be invoked from any handler on any processor.
February 13, 2012
Converse Homepage
Charm Homepage