50 MethodMap::iterator i =
_methods.find(methodName);
60 MethodMap::const_iterator i =
_methods.find(name);
113 XmlRpcUtil::log(2,
"XmlRpcServer::bindAndListen: server listening on port %d fd %d", port, fd);
161 XmlRpcUtil::log(2,
"XmlRpcServer::acceptConnection: creating a connection");
201static const std::string LIST_METHODS(
"system.listMethods");
202static const std::string METHOD_HELP(
"system.methodHelp");
203static const std::string MULTICALL(
"system.multicall");
214 _server->listMethods(result);
217 std::string
help() {
return std::string(
"List all methods available on a server as an array of strings"); }
239 std::string
help() {
return std::string(
"Retrieve the help string for a named method"); }
277 result[i++] = it->first;
280 result[i] = MULTICALL;
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
ListMethods(XmlRpcServer *s)
MethodHelp(XmlRpcServer *s)
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
Execute the method. Subclasses must provide a definition for this method.
void removeSource(XmlRpcSource *source)
@ ReadableEvent
data available to read
void exit()
Exit from work routine.
void clear()
Clear all sources from the monitored sources list. Sources are closed.
void addSource(XmlRpcSource *source, unsigned eventMask)
A class to handle XML RPC requests from a particular client.
Abstract class representing a single RPC method.
virtual std::string help()
std::string & name()
Returns the name of the method.
A class to handle XML RPC requests.
void shutdown()
Close all connections with clients and the socket file descriptor.
XmlRpcServerMethod * _listMethods
bool bindAndListen(int port, int backlog=5)
void enableIntrospection(bool enabled=true)
Specify whether introspection is enabled or not. Default is not enabled.
XmlRpcServer()
Create a server object.
void removeMethod(XmlRpcServerMethod *method)
Remove a command from the RPC server.
virtual void removeConnection(XmlRpcServerConnection *)
Remove a connection from the dispatcher.
virtual XmlRpcServerConnection * createConnection(int socket)
Create a new connection object for processing requests from a specific client.
XmlRpcServerMethod * _methodHelp
virtual unsigned handleEvent(unsigned eventType)
Handle client connection requests.
bool _introspectionEnabled
void addMethod(XmlRpcServerMethod *method)
Add a command to the RPC server.
XmlRpcServerMethod * findMethod(const std::string &name) const
Look up a method by name.
void work(double msTime)
Process client requests for the specified time.
virtual ~XmlRpcServer()
Destructor.
virtual void acceptConnection()
Accept a client connection request.
void listMethods(XmlRpcValue &result)
Introspection support.
void exit()
Temporarily stop processing client requests and exit the work() method.
static int socket()
Creates a stream (TCP) socket. Returns -1 on failure.
static bool listen(int socket, int backlog)
Set socket in listen mode.
static int accept(int socket)
Accept a client connection request.
static bool setReuseAddr(int socket)
static bool setNonBlocking(int socket)
Sets a stream (TCP) socket to perform non-blocking IO. Returns false on failure.
static void close(int socket)
Closes a socket.
static bool bind(int socket, int port)
Bind to a specified port.
static std::string getErrorMsg()
Returns message corresponding to last error.
virtual void close()
Close the owned fd. If deleteOnClose was specified at construction, the object is deleted.
int getfd() const
Return the file descriptor being monitored.
void setfd(int fd)
Specify the file descriptor to monitor.
static void error(const char *fmt,...)
Dump error messages somewhere.
static void log(int level, const char *fmt,...)
Dump messages somewhere.
RPC method arguments and results are represented by Values.
void setSize(int size)
Specify the size for array values. Array values will grow beyond this size if needed.