LLSDRPCClient Class Reference

Client class for a structured data remote procedure call. More...

#include <llsdrpcclient.h>

Inheritance diagram for LLSDRPCClient:

Inheritance graph
[legend]
Collaboration diagram for LLSDRPCClient:

Collaboration graph
[legend]
List of all members.

Public Types

 EPBQ_PROCESS
 EPBQ_CALLBACK
enum  EPassBackQueue { EPBQ_PROCESS, EPBQ_CALLBACK }
 Enumeration for tracking which queue to process the response. More...

Public Member Functions

 LLSDRPCClient ()
virtual ~LLSDRPCClient ()
bool call (const std::string &uri, const std::string &method, const LLSD &parameter, LLSDRPCResponse *response, EPassBackQueue queue)
 Call a method on a remote LLSDRPCServer.
bool call (const std::string &uri, const std::string &method, const std::string &parameter, LLSDRPCResponse *response, EPassBackQueue queue)
 Call a method on a remote LLSDRPCServer.

Protected Types

 STATE_NONE
 STATE_READY
 STATE_WAITING_FOR_RESPONSE
 STATE_DONE
enum  EState { STATE_NONE, STATE_READY, STATE_WAITING_FOR_RESPONSE, STATE_DONE }
 Enumeration for tracking client state. More...

Protected Member Functions

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

Protected Attributes

EState mState
std::string mURI
std::string mRequest
EPassBackQueue mQueue
LLIOPipe::ptr_t mResponse

Detailed Description

Client class for a structured data remote procedure call.

This class helps deal with making structured data calls to a remote server. You can visualize the calls as: response = uri.method(parameter) where you pass in everything to call and this class takes care of the rest of the details. In typical usage, you will derive a class from this class and provide an API more useful for the specific application at hand. For example, if you were writing a service to send an instant message, you could create an API for it to send the messsage, and that class would do the work of translating it into the method and parameter, find the destination, and invoke call</call> with a useful implementation of LLSDRPCResponse passed in to handle the response from the network.

Definition at line 134 of file llsdrpcclient.h.


Member Enumeration Documentation

enum LLSDRPCClient::EPassBackQueue

Enumeration for tracking which queue to process the response.

Enumerator:
EPBQ_PROCESS 
EPBQ_CALLBACK 

Definition at line 144 of file llsdrpcclient.h.

enum LLSDRPCClient::EState [protected]

Enumeration for tracking client state.

Enumerator:
STATE_NONE 
STATE_READY 
STATE_WAITING_FOR_RESPONSE 
STATE_DONE 

Definition at line 196 of file llsdrpcclient.h.


Constructor & Destructor Documentation

LLSDRPCClient::LLSDRPCClient (  ) 

LLSDRPCClient

Definition at line 120 of file llsdrpcclient.cpp.

References LLMemType::MTYPE_IO_SD_CLIENT.

LLSDRPCClient::~LLSDRPCClient (  )  [virtual]

Definition at line 128 of file llsdrpcclient.cpp.

References LLMemType::MTYPE_IO_SD_CLIENT.


Member Function Documentation

bool LLSDRPCClient::call ( const std::string &  uri,
const std::string &  method,
const std::string &  parameter,
LLSDRPCResponse response,
EPassBackQueue  queue 
)

Call a method on a remote LLSDRPCServer.

Parameters:
uri The remote object to call, eg, http://localhost/usher. If you are using a factory with a fixed url, the uri passed in will probably be ignored.
method The method to call on the remote object
parameter The seriailized parameter to pass into the remote object.
response The object which gets the response.
queue Specifies to call the response on the process or callback queue.
Returns:
Returns true if this object will be able to make the RPC call.

Definition at line 160 of file llsdrpcclient.cpp.

References LLSDRPC_REQUEST_FOOTER, LLSDRPC_REQUEST_HEADER_1, LLSDRPC_REQUEST_HEADER_2, mQueue, mRequest, mResponse, mState, LLMemType::MTYPE_IO_SD_CLIENT, mURI, and STATE_READY.

bool LLSDRPCClient::call ( const std::string &  uri,
const std::string &  method,
const LLSD parameter,
LLSDRPCResponse response,
EPassBackQueue  queue 
)

Call a method on a remote LLSDRPCServer.

Parameters:
uri The remote object to call, eg, http://localhost/usher. If you are using a factory with a fixed url, the uri passed in will probably be ignored.
method The method to call on the remote object
parameter The parameter to pass into the remote object. It is up to the caller to delete the value passed in.
response The object which gets the response.
queue Specifies to call the response on the process or callback queue.
Returns:
Returns true if this object will be able to make the RPC call.

Definition at line 133 of file llsdrpcclient.cpp.

References LLSDRPC_REQUEST_FOOTER, LLSDRPC_REQUEST_HEADER_1, LLSDRPC_REQUEST_HEADER_2, mQueue, mRequest, mResponse, mState, LLMemType::MTYPE_IO_SD_CLIENT, mURI, STATE_READY, and LLSDSerialize::toNotation().

Referenced by tut::rpc_server_data::LLSimpleRPCClient::echo().

LLIOPipe::EStatus LLSDRPCClient::process_impl ( const LLChannelDescriptors channels,
buffer_ptr_t buffer,
bool &  eos,
LLSD context,
LLPumpIO pump 
) [protected, virtual]

Process the data in buffer.

Definition at line 187 of file llsdrpcclient.cpp.

References LLPumpIO::addChain(), CONTEXT_DEST_URI_SD_LABEL, DEFAULT_CHAIN_EXPIRY_SECS, EPBQ_PROCESS, LLSDRPCResponse::extractResponse(), LLSDSerialize::fromNotation(), llendl, llinfos, mQueue, mRequest, mResponse, mState, LLMemType::MTYPE_IO_SD_CLIENT, mURI, LLChannelDescriptors::out(), PUMP_DEBUG, LLPumpIO::respond(), tut::sd(), STATE_DONE, STATE_NONE, STATE_READY, STATE_WAITING_FOR_RESPONSE, LLIOPipe::STATUS_DONE, LLIOPipe::STATUS_ERROR, and LLIOPipe::STATUS_PRECONDITION_NOT_MET.


Member Data Documentation

EPassBackQueue LLSDRPCClient::mQueue [protected]

Definition at line 222 of file llsdrpcclient.h.

Referenced by call(), and process_impl().

std::string LLSDRPCClient::mRequest [protected]

Definition at line 221 of file llsdrpcclient.h.

Referenced by call(), and process_impl().

LLIOPipe::ptr_t LLSDRPCClient::mResponse [protected]

Definition at line 223 of file llsdrpcclient.h.

Referenced by call(), and process_impl().

EState LLSDRPCClient::mState [protected]

Definition at line 219 of file llsdrpcclient.h.

Referenced by call(), and process_impl().

std::string LLSDRPCClient::mURI [protected]

Definition at line 220 of file llsdrpcclient.h.

Referenced by call(), and process_impl().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:45 2010 for Second Life Viewer by  doxygen 1.4.7