BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
XmlRpcServer.h
Go to the documentation of this file.
1
2#ifndef _XMLRPCSERVER_H_
3#define _XMLRPCSERVER_H_
4//
5// XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
6//
7#if defined(_MSC_VER)
8# pragma warning(disable:4786) // identifier was truncated in debug info
9#endif
10
11#ifndef MAKEDEPEND
12# include <map>
13# include <string>
14#endif
15
16#include "XmlRpcDispatch.h"
17#include "XmlRpcSource.h"
18
19namespace XmlRpc {
20
21
22 // An abstract class supporting XML RPC methods
23 class XmlRpcServerMethod;
24
25 // Class representing connections to specific clients
26 class XmlRpcServerConnection;
27
28 // Class representing argument and result values
29 class XmlRpcValue;
30
31
32 //! A class to handle XML RPC requests
33 class XmlRpcServer : public XmlRpcSource {
34 public:
35 //! Create a server object.
37 //! Destructor.
38 virtual ~XmlRpcServer();
39
40 //! Specify whether introspection is enabled or not. Default is not enabled.
41 void enableIntrospection(bool enabled=true);
42
43 //! Add a command to the RPC server
44 void addMethod(XmlRpcServerMethod* method);
45
46 //! Remove a command from the RPC server
47 void removeMethod(XmlRpcServerMethod* method);
48
49 //! Remove a command from the RPC server by name
50 void removeMethod(const std::string& methodName);
51
52 //! Look up a method by name
53 XmlRpcServerMethod* findMethod(const std::string& name) const;
54
55 //! Create a socket, bind to the specified port, and
56 //! set it in listen mode to make it available for clients.
57 bool bindAndListen(int port, int backlog = 5);
58
59 //! Process client requests for the specified time
60 void work(double msTime);
61
62 //! Temporarily stop processing client requests and exit the work() method.
63 void exit();
64
65 //! Close all connections with clients and the socket file descriptor
66 void shutdown();
67
68 //! Introspection support
69 void listMethods(XmlRpcValue& result);
70
71 // XmlRpcSource interface implementation
72
73 //! Handle client connection requests
74 virtual unsigned handleEvent(unsigned eventType);
75
76 //! Remove a connection from the dispatcher
78
79 protected:
80
81 //! Accept a client connection request
82 virtual void acceptConnection();
83
84 //! Create a new connection object for processing requests from a specific client.
85 virtual XmlRpcServerConnection* createConnection(int socket);
86
87 // Whether the introspection API is supported by this server
89
90 // Event dispatcher
92
93 // Collection of methods. This could be a set keyed on method name if we wanted...
94 typedef std::map< std::string, XmlRpcServerMethod* > MethodMap;
96
97 // system methods
100
101 };
102} // namespace XmlRpc
103
104#endif //_XMLRPCSERVER_H_
A class to handle XML RPC requests from a particular client.
Abstract class representing a single RPC method.
A class to handle XML RPC requests.
Definition: XmlRpcServer.h:33
void shutdown()
Close all connections with clients and the socket file descriptor.
std::map< std::string, XmlRpcServerMethod * > MethodMap
Definition: XmlRpcServer.h:94
XmlRpcServerMethod * _listMethods
Definition: XmlRpcServer.h:98
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
Definition: XmlRpcServer.h:99
virtual unsigned handleEvent(unsigned eventType)
Handle client connection requests.
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.
XmlRpcDispatch _disp
Definition: XmlRpcServer.h:91
An RPC source represents a file descriptor to monitor.
Definition: XmlRpcSource.h:14
RPC method arguments and results are represented by Values.
Definition: XmlRpcValue.h:22
Definition: XmlRpc.h:35