OverSim
|
A class to handle multiple simultaneous XML RPC requests. More...
#include <XmlRpcThreadedServer.h>
Classes | |
class | Worker |
Execute a request. More... |
Public Member Functions | |
XmlRpcThreadedServer (int nWorkers=6) | |
Create a server object with a specified number of worker threads. | |
Public Member Functions inherited from XmlRpc::XmlRpcServer | |
XmlRpcServer () | |
Create a server object. | |
virtual | ~XmlRpcServer () |
Destructor. | |
void | enableIntrospection (bool enabled=true) |
Specify whether introspection is enabled or not. Default is not enabled. | |
void | addMethod (XmlRpcServerMethod *method) |
Add a command to the RPC server. | |
void | removeMethod (XmlRpcServerMethod *method) |
Remove a command from the RPC server. | |
void | removeMethod (const std::string &methodName) |
Remove a command from the RPC server by name. | |
XmlRpcServerMethod * | findMethod (const std::string &name) const |
Look up a method by name. | |
bool | bindAndListen (int port, int backlog=5) |
Create a socket, bind to the specified port, and set it in listen mode to make it available for clients. | |
int | getPort (void) const |
Get the port number this server is listening on. | |
void | work (double msTime) |
Process client requests for the specified time. | |
void | exit () |
Temporarily stop processing client requests and exit the work() method. | |
void | shutdown () |
Close all connections with clients and the socket file descriptor. | |
void | listMethods (XmlRpcValue &result) |
Introspection support. | |
virtual std::string | executeRequest (std::string const &request) |
Parses the request xml, runs the method, generates the response (header+xml). | |
virtual unsigned | handleEvent (unsigned eventType) |
Handle client connection requests. | |
virtual void | removeConnection (XmlRpcServerConnection *) |
Remove a connection from the dispatcher. | |
Public Member Functions inherited from XmlRpc::XmlRpcSource | |
XmlRpcSource (int fd=-1, bool deleteOnClose=false) | |
Constructor. | |
virtual | ~XmlRpcSource () |
Destructor. | |
int | getfd () const |
Return the file descriptor being monitored. | |
void | setfd (int fd) |
Specify the file descriptor to monitor. | |
bool | getKeepOpen () const |
Return whether the file descriptor should be kept open if it is no longer monitored. | |
void | setKeepOpen (bool b=true) |
Specify whether the file descriptor should be kept open if it is no longer monitored. | |
virtual void | close () |
Close the owned fd. If deleteOnClose was specified at construction, the object is deleted. |
Protected Attributes | |
std::vector< Worker > | _workers |
The worker pool. | |
XmlRpcMutex | _mutex |
Serialize dispatcher access. | |
Protected Attributes inherited from XmlRpc::XmlRpcServer | |
bool | _introspectionEnabled |
Whether the introspection API is supported by this server. | |
XmlRpcDispatch | _disp |
Event dispatcher. | |
MethodMap | _methods |
Registered RPC methods. | |
XmlRpcServerMethod * | _listMethods |
List all registered RPC methods (only available if introspection is enabled) | |
XmlRpcServerMethod * | _methodHelp |
Return help string for a specified method (only available if introspection is enabled) |
Additional Inherited Members | |
Public Attributes inherited from XmlRpc::XmlRpcSource | |
bool | _ssl |
SSL_CTX * | _ssl_ctx |
SSL * | _ssl_ssl |
SSL_METHOD * | _ssl_meth |
Protected Types inherited from XmlRpc::XmlRpcServer | |
typedef std::map< std::string, XmlRpcServerMethod * > | MethodMap |
Collection of methods. This could be a set keyed on method name if we wanted... | |
Protected Member Functions inherited from XmlRpc::XmlRpcServer | |
virtual void | acceptConnection () |
Accept a client connection request. | |
virtual XmlRpcServerConnection * | createConnection (int socket) |
Create a new connection object for processing requests from a specific client. | |
virtual void | dispatchConnection (XmlRpcServerConnection *sc) |
Hand off a new connection object to a dispatcher. | |
std::string | parseRequest (std::string const &request, XmlRpcValue ¶ms) |
Parse the methodName and parameters from the request. | |
bool | executeMethod (const std::string &methodName, XmlRpcValue ¶ms, XmlRpcValue &result) |
Execute a named method with the specified params. | |
bool | executeMulticall (const std::string &methodName, XmlRpcValue ¶ms, XmlRpcValue &result) |
Execute multiple calls and return the results in an array. | |
std::string | generateResponse (std::string const &resultXml) |
Construct a response from the result XML. | |
std::string | generateFaultResponse (std::string const &msg, int errorCode=-1) |
Construct a fault response. | |
std::string | generateHeader (std::string const &body) |
Return the appropriate headers for the response. | |
Static Protected Attributes inherited from XmlRpc::XmlRpcServer | |
static const char | METHODNAME_TAG [] = "<methodName>" |
static const char | PARAMS_TAG [] = "<params>" |
static const char | PARAMS_ETAG [] = "</params>" |
static const char | PARAM_TAG [] = "<param>" |
static const char | PARAM_ETAG [] = "</param>" |
static const std::string | SYSTEM_MULTICALL |
static const std::string | METHODNAME = "methodName" |
static const std::string | PARAMS = "params" |
static const std::string | FAULTCODE = "faultCode" |
static const std::string | FAULTSTRING = "faultString" |
A class to handle multiple simultaneous XML RPC requests.
Definition at line 31 of file XmlRpcThreadedServer.h.
|
inline |
Create a server object with a specified number of worker threads.
Definition at line 35 of file XmlRpcThreadedServer.h.
|
protected |
Serialize dispatcher access.
Definition at line 66 of file XmlRpcThreadedServer.h.
|
protected |
The worker pool.
Definition at line 62 of file XmlRpcThreadedServer.h.