A class to handle XML RPC requests. More...
#include <XmlRpcServer.h>
Public Member Functions | |
void | addMethod (XmlRpcServerMethod *method) |
Add a command to the RPC server. More... | |
bool | bindAndListen (int port, int backlog=5) |
void | enableIntrospection (bool enabled=true) |
Specify whether introspection is enabled or not. Default is not enabled. More... | |
void | exit () |
Temporarily stop processing client requests and exit the work() method. More... | |
XmlRpcServerMethod * | findMethod (const std::string &name) const |
Look up a method by name. More... | |
XmlRpcDispatch * | get_dispatch () |
int | get_port () |
virtual unsigned | handleEvent (unsigned eventType) |
Handle client connection requests. More... | |
void | listMethods (XmlRpcValue &result) |
Introspection support. More... | |
virtual void | removeConnection (XmlRpcServerConnection *) |
Remove a connection from the dispatcher. More... | |
void | removeMethod (const std::string &methodName) |
Remove a command from the RPC server by name. More... | |
void | removeMethod (XmlRpcServerMethod *method) |
Remove a command from the RPC server. More... | |
void | shutdown () |
Close all connections with clients and the socket file descriptor. More... | |
void | work (double msTime) |
Process client requests for the specified time. More... | |
XmlRpcServer () | |
Create a server object. More... | |
virtual | ~XmlRpcServer () |
Destructor. More... | |
Public Member Functions inherited from XmlRpc::XmlRpcSource | |
virtual void | close () |
Close the owned fd. If deleteOnClose was specified at construction, the object is deleted. More... | |
int | getfd () const |
Return the file descriptor being monitored. More... | |
bool | getKeepOpen () const |
Return whether the file descriptor should be kept open if it is no longer monitored. More... | |
void | setfd (int fd) |
Specify the file descriptor to monitor. More... | |
void | setKeepOpen (bool b=true) |
Specify whether the file descriptor should be kept open if it is no longer monitored. More... | |
XmlRpcSource (int fd=-1, bool deleteOnClose=false) | |
virtual | ~XmlRpcSource () |
Destructor. More... | |
Protected Types | |
typedef std::map< std::string, XmlRpcServerMethod * > | MethodMap |
Protected Member Functions | |
virtual unsigned | acceptConnection () |
Accept a client connection request. More... | |
virtual XmlRpcServerConnection * | createConnection (int socket) |
Create a new connection object for processing requests from a specific client. More... | |
bool | enoughFreeFDs () |
Check if enough number of free file descriptors. More... | |
Protected Attributes | |
bool | _accept_error |
double | _accept_retry_time_sec |
XmlRpcDispatch | _disp |
bool | _introspectionEnabled |
XmlRpcServerMethod * | _listMethods |
XmlRpcServerMethod * | _methodHelp |
MethodMap | _methods |
int | _port |
std::vector< struct pollfd > | pollfds |
Static Protected Attributes | |
static const double | ACCEPT_RETRY_INTERVAL_SEC = 1.0 |
static const int | FREE_FD_BUFFER = 32 |
A class to handle XML RPC requests.
Definition at line 41 of file XmlRpcServer.h.
|
protected |
Definition at line 109 of file XmlRpcServer.h.
XmlRpcServer::XmlRpcServer | ( | ) |
Create a server object.
Definition at line 25 of file XmlRpcServer.cpp.
|
virtual |
Destructor.
Definition at line 58 of file XmlRpcServer.cpp.
|
protectedvirtual |
Accept a client connection request.
Definition at line 186 of file XmlRpcServer.cpp.
void XmlRpcServer::addMethod | ( | XmlRpcServerMethod * | method | ) |
Add a command to the RPC server.
Definition at line 69 of file XmlRpcServer.cpp.
bool XmlRpcServer::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.
Definition at line 107 of file XmlRpcServer.cpp.
|
protectedvirtual |
Create a new connection object for processing requests from a specific client.
Definition at line 275 of file XmlRpcServer.cpp.
void XmlRpcServer::enableIntrospection | ( | bool | enabled = true | ) |
Specify whether introspection is enabled or not. Default is not enabled.
Definition at line 351 of file XmlRpcServer.cpp.
|
protected |
Check if enough number of free file descriptors.
Definition at line 219 of file XmlRpcServer.cpp.
void XmlRpcServer::exit | ( | ) |
Temporarily stop processing client requests and exit the work() method.
Definition at line 291 of file XmlRpcServer.cpp.
XmlRpcServerMethod * XmlRpcServer::findMethod | ( | const std::string & | name | ) | const |
Look up a method by name.
Definition at line 95 of file XmlRpcServer.cpp.
|
inline |
Definition at line 89 of file XmlRpcServer.h.
|
inline |
Definition at line 87 of file XmlRpcServer.h.
|
virtual |
Handle client connection requests.
Implements XmlRpc::XmlRpcSource.
Definition at line 177 of file XmlRpcServer.cpp.
void XmlRpcServer::listMethods | ( | XmlRpcValue & | result | ) |
Introspection support.
Definition at line 378 of file XmlRpcServer.cpp.
|
virtual |
Remove a connection from the dispatcher.
Definition at line 283 of file XmlRpcServer.cpp.
void XmlRpcServer::removeMethod | ( | const std::string & | methodName | ) |
Remove a command from the RPC server by name.
Definition at line 85 of file XmlRpcServer.cpp.
void XmlRpcServer::removeMethod | ( | XmlRpcServerMethod * | method | ) |
Remove a command from the RPC server.
Definition at line 76 of file XmlRpcServer.cpp.
void XmlRpcServer::shutdown | ( | ) |
Close all connections with clients and the socket file descriptor.
Definition at line 299 of file XmlRpcServer.cpp.
void XmlRpcServer::work | ( | double | msTime | ) |
Process client requests for the specified time.
Definition at line 163 of file XmlRpcServer.cpp.
|
protected |
Definition at line 119 of file XmlRpcServer.h.
|
protected |
Definition at line 124 of file XmlRpcServer.h.
|
protected |
Definition at line 106 of file XmlRpcServer.h.
|
protected |
Definition at line 103 of file XmlRpcServer.h.
|
protected |
Definition at line 113 of file XmlRpcServer.h.
|
protected |
Definition at line 114 of file XmlRpcServer.h.
|
protected |
Definition at line 110 of file XmlRpcServer.h.
|
protected |
Definition at line 116 of file XmlRpcServer.h.
|
staticprotected |
Definition at line 122 of file XmlRpcServer.h.
|
staticprotected |
Definition at line 127 of file XmlRpcServer.h.
|
protected |
Definition at line 130 of file XmlRpcServer.h.