Made to Order Software Corporation Logo

LLChatLib: LLSDRPCServer Class Reference

LLSDRPCServer Class Reference

Basic implementation of a structure data rpc server. More...

#include <llsdrpcserver.h>

Inheritance diagram for LLSDRPCServer:
Collaboration diagram for LLSDRPCServer:

List of all members.

Public Types

enum  

Public Member Functions

void clearLock ()
 unlock a service that as ESDRPCS_DEFERRED

 LLSDRPCServer ()

Static Public Member Functions

static void buildFault (const LLChannelDescriptors &channels, LLBufferArray *data, S32 code, const std::string &msg)
 Call this method to return an rpc fault.

static void buildResponse (const LLChannelDescriptors &channels, LLBufferArray *data, const LLSD &response)
 Call this method to build an rpc response.

Protected Types

enum  EState
 

Enumeration to track the state of the rpc server instance.



Protected Member Functions

virtual ESDRPCSStatus callbackMethod (const std::string &method, const LLSD &params, const LLChannelDescriptors &channels, LLBufferArray *data)
 This method is called when a pump callback is processed.

virtual ESDRPCSStatus callMethod (const std::string &method, const LLSD &params, const LLChannelDescriptors &channels, LLBufferArray *data)
 This method is called when an http post comes in.

virtual ESDRPCSStatus deferredResponse (const LLChannelDescriptors &channels, LLBufferArray *data)
 Called after a deferred service is unlocked.

virtual EStatus process_impl (const LLChannelDescriptors &channels, buffer_ptr_t &buffer, bool &eos, LLSD &context, LLPumpIO *pump)
 Process the data in buffer.


Detailed Description

Basic implementation of a structure data rpc server.

The rpc server is also designed to appropriately straddle the pump process() and callback() to specify which thread you want to work on when handling a method call. The mMethods methods are called from process(), while the mCallbackMethods are called when a pump is in a callback() cycle.


Member Enumeration Documentation

anonymous enum

enumeration for generic fault codes


Constructor & Destructor Documentation

LLSDRPCServer::LLSDRPCServer (  ) 

Member Function Documentation

void LLSDRPCServer::buildFault ( const LLChannelDescriptors channels,
LLBufferArray data,
S32  code,
const std::string &  msg 
) [static]

Call this method to return an rpc fault.

Parameters:
channel The channel for output on the data buffer
data buffer which will recieve the final output
code The fault code
msg The fault message
void LLSDRPCServer::buildResponse ( const LLChannelDescriptors channels,
LLBufferArray data,
const LLSD response 
) [static]

Call this method to build an rpc response.

Parameters:
channel The channel for output on the data buffer
data buffer which will recieve the final output
response The return value from the method call
ESDRPCSStatus LLSDRPCServer::callbackMethod ( const std::string &  method,
const LLSD params,
const LLChannelDescriptors channels,
LLBufferArray data 
) [protected, virtual]

This method is called when a pump callback is processed.

The default behavior is to look at the method name, look up the method in the callback method table, and call it. If the method is not found, this function will build a fault response. You can implement your own version of this function if you want to hard wire some behavior or optimize things a bit.

Parameters:
method The method name being called
params The parameters
channel The channel for output on the data buffer
data The http data
Returns:
Returns the status of the method call, done/deferred/etc

Here is the call graph for this function:

ESDRPCSStatus LLSDRPCServer::callMethod ( const std::string &  method,
const LLSD params,
const LLChannelDescriptors channels,
LLBufferArray data 
) [protected, virtual]

This method is called when an http post comes in.

The default behavior is to look at the method name, look up the method in the method table, and call it. If the method is not found, this function will build a fault response. You can implement your own version of this function if you want to hard wire some behavior or optimize things a bit.

Parameters:
method The method name being called
params The parameters
channel The channel for output on the data buffer
data The http data
Returns:
Returns the status of the method call, done/deferred/etc

Here is the call graph for this function:

ESDRPCSStatus LLSDRPCServer::deferredResponse ( const LLChannelDescriptors channels,
LLBufferArray data 
) [protected, virtual]

Called after a deferred service is unlocked.

If a method returns ESDRPCS_DEFERRED, then the service chain will be locked and not processed until some other system calls clearLock() on the service instance again. At that point, once the pump starts processing the chain again, this method will be called so the service can output the final result into the buffers.


The documentation for this class was generated from the following files:
Generated on Thu Sep 23 17:18:45 2010 for LLChatLib by  doxygen 1.6.3