Main Page | Modules | Data Structures | File List | Globals | Examples

Server-side functions and structures


Data Structures

struct  CMrpc_options

Defines

#define CMrpc_set_option(X, OPT)   ((X)->flags |= (OPT))
#define CMrpc_clear_option(X, OPT)   ((X)->flags &= ~(OPT))
#define CMrpc_call_cleanup_function   (0x1)
#define CMrpc_async_call   (0x1)

Typedefs

typedef void(* CMrpc_HandlerFunc )(void *in_param_msg, void *out_param_msg, CMrpc_options options)
typedef void(* CMrpc_OnewayHandlerFunc )(void *in_param_msg, CMrpc_options options)
typedef void(* CMrpc_HandlerCleanupFunc )(CManager cm, void *out_msg)

Functions

int CMrpc_register_rpc_handler (CManager cm, const char *rpc_name, CMrpc_HandlerFunc func, CMrpc_OnewayHandlerFunc oneway_func, CMrpc_HandlerCleanupFunc cleanup_func)
int CMrpc_unregister_rpc (const char *rpc_name)

Variables

typedef CMrpc_options_t

Define Documentation

#define CMrpc_set_option X,
OPT   )     ((X)->flags |= (OPT))
 

Options manipulation for the CMrpc_options struct. The set and clear functions are shortcuts to change the flags member of the struct. call_cleanup_function indicates that there is a cleanup function for the handler that should be called after the handler completes and any data is returned to the caller.


Typedef Documentation

typedef void(* CMrpc_HandlerCleanupFunc)(CManager cm, void *out_msg)
 

Type of handler cleanup functions. A handler cleanup function is run after the handler function has been executed and the data returned to the caller. Typically, these free up temporary memory allocated by the handler or release other resources.

Parameters:
cm The CManager used by the handler. The function needs access to this to release CM resources (such as memory buffers using take_buffer()).
out_msg The output message sent from the handler. If this structure contained any memory that was dynamically allocated, it can be freed using this pointer.

typedef void(* CMrpc_HandlerFunc)(void *in_param_msg, void *out_param_msg, CMrpc_options options)
 

Type of most RPC handler functions. The in_param and out_param structures must be cast to user types (which themselves must already have been registered) before use.

Parameters:
in_param_msg the input data to the handler.
out_param_msg the output data from the handler function.
options the options structure used by the handler.

typedef void(* CMrpc_OnewayHandlerFunc)(void *in_param_msg, CMrpc_options options)
 

Type of "one-way" functions, which are RPC calls for which the caller does not expect a reply.

Parameters:
in_param_msg the input data to the handler.
options the options structure used by the handler.


Function Documentation

int CMrpc_register_rpc_handler CManager  cm,
const char *  rpc_name,
CMrpc_HandlerFunc  func,
CMrpc_OnewayHandlerFunc  oneway_func,
CMrpc_HandlerCleanupFunc  cleanup_func
 

Used from server-side (i.e. CMrpc assumes that if you use this function in a process, you intend for that process to receive RPC requests). Registers the given function and, if desired, cleanup function as handlers for the given rpc name.

Parameters:
cm The CManager in use.
rpc_name The RPC for which this handler is being registered.
func The handler function to be called by CMrpc. Must not be NULL.
oneway_func A handler function to be called if a client makes a oneway RPC. Specify NULL if not needed.
cleanup_func A cleanup function if one is needed for this RPC. Specify NULL if not needed.
Returns:
Returns 1 if successful, -1 otherwise (and sets CMrpc_errno).
CMrpc_errno values used:
EEXISTS if an RPC handler is already registered with the name rpc_name.
Examples:
ts.c.

int CMrpc_unregister_rpc const char *  rpc_name  ) 
 

Removes the registration information for the named RPC.

Parameters:
rpc_name The RPC to remove.
Returns:
Returns 1 if successful, -1 otherwise (and sets CMrpc_errno).
CMrpc_errno values used:
ENOENT if the name doesn't match any registered RPC.


Generated on Thu Oct 14 18:34:49 2004 for CMrpc by  doxygen 1.3.9.1