sipxtacklib  Version 3.3
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
XmlRpcDispatch Class Reference

A XmlRpcDispatch is a object that monitors the incoming XML-RPC requests, parses XmlRpcRequest messages, invokes the correct XmlRpcMethod calls, and sends back the corresponding XmlRpcResponse responses. More...

#include <XmlRpcDispatch.h>

Inheritance diagram for XmlRpcDispatch:
Inheritance graph
[legend]
Collaboration diagram for XmlRpcDispatch:
Collaboration graph
[legend]

Public Member Functions

 XmlRpcDispatch (int httpServerPort, bool isSecureServer, const char *uriPath=DEFAULT_URL_PATH, const char *httpBindAddress=NULL)
 Create a dispatch object. More...
 
virtual ~XmlRpcDispatch ()
 Destructor. More...
 
void processRequest (const HttpRequestContext &requestContext, const HttpMessage &request, HttpMessage *&response)
 Handler for XML-RPC requests. More...
 
void addMethod (const char *methodName, XmlRpcMethod::Get *method, void *userData=NULL)
 Add a method to the RPC dispatch. More...
 
void removeMethod (const char *methodName)
 Remove a method from the RPC dispatch by name. More...
 
HttpServergetHttpServer ()
 Return the HTTP server that services RPC requests. More...
 
- Public Member Functions inherited from HttpService
 HttpService ()
 Constructor. More...
 
virtual ~HttpService ()
 Destructor. More...
 

Static Public Member Functions

static bool parseValue (TiXmlNode *valueNode, int index, UtlSList &params)
 Parse a value in the XML-RPC request. More...
 
static void cleanUp (UtlHashMap *members)
 Clean up the memory in a struct. More...
 
static void cleanUp (UtlSList *array)
 Clean up the memory in an array. More...
 

Static Public Attributes

static const char * DEFAULT_URL_PATH = "/RPC2"
 

Protected Member Functions

bool parseXmlRpcRequest (UtlString &requestContent, XmlRpcMethodContainer *&method, UtlSList &params, XmlRpcResponse &response)
 Parse the XML-RPC request. More...
 

Friends

class XmlRpcTest
 

Detailed Description

A XmlRpcDispatch is a object that monitors the incoming XML-RPC requests, parses XmlRpcRequest messages, invokes the correct XmlRpcMethod calls, and sends back the corresponding XmlRpcResponse responses.

If the correspnding method does not exit, it will send back a 404 response. Otherwise, it will always send back a 200 OK response with XmlRpcResponse content.

For each XML-RPC server, it needs to instantiate a XmlRpcDispatch object first, and then register each service method using addMethod() or remove the method using removeMethod().

Constructor & Destructor Documentation

XmlRpcDispatch ( int  httpServerPort,
bool  isSecureServer,
const char *  uriPath = DEFAULT_URL_PATH,
const char *  httpBindAddress = NULL 
)

Create a dispatch object.

Parameters
httpServerPortport number for HttpServer
isSecureServeroption for HTTP or HTTPS
uriPathuri path
httpBindAddressIP address/interface to bind http server to
~XmlRpcDispatch ( )
virtual

Destructor.

Member Function Documentation

void processRequest ( const HttpRequestContext requestContext,
const HttpMessage request,
HttpMessage *&  response 
)
virtual

Handler for XML-RPC requests.

Implements HttpService.

bool parseValue ( TiXmlNode *  valueNode,
int  index,
UtlSList &  params 
)
static

Parse a value in the XML-RPC request.

void cleanUp ( UtlHashMap *  members)
static

Clean up the memory in a struct.

void cleanUp ( UtlSList *  array)
static

Clean up the memory in an array.

void addMethod ( const char *  methodName,
XmlRpcMethod::Get method,
void *  userData = NULL 
)

Add a method to the RPC dispatch.

void removeMethod ( const char *  methodName)

Remove a method from the RPC dispatch by name.

HttpServer * getHttpServer ( )

Return the HTTP server that services RPC requests.

bool parseXmlRpcRequest ( UtlString &  requestContent,
XmlRpcMethodContainer *&  method,
UtlSList &  params,
XmlRpcResponse response 
)
protected

Parse the XML-RPC request.

Friends And Related Function Documentation

friend class XmlRpcTest
friend

Member Data Documentation

const char * DEFAULT_URL_PATH = "/RPC2"
static

sipXtackLib home page