BOSS 8.0.0
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 // An abstract class supporting XML RPC methods
23
24 // Class representing connections to specific clients
26
27 // Class representing argument and result values
28 class XmlRpcValue;
29
30 //! A class to handle XML RPC requests
31 class XmlRpcServer : public XmlRpcSource {
32 public:
33 //! Create a server object.
35 //! Destructor.
36 virtual ~XmlRpcServer();
37
38 //! Specify whether introspection is enabled or not. Default is not enabled.
39 void enableIntrospection( bool enabled = true );
40
41 //! Add a command to the RPC server
42 void addMethod( XmlRpcServerMethod* method );
43
44 //! Remove a command from the RPC server
45 void removeMethod( XmlRpcServerMethod* method );
46
47 //! Remove a command from the RPC server by name
48 void removeMethod( const std::string& methodName );
49
50 //! Look up a method by name
51 XmlRpcServerMethod* findMethod( const std::string& name ) const;
52
53 //! Create a socket, bind to the specified port, and
54 //! set it in listen mode to make it available for clients.
55 bool bindAndListen( int port, int backlog = 5 );
56
57 //! Process client requests for the specified time
58 void work( double msTime );
59
60 //! Temporarily stop processing client requests and exit the work() method.
61 void exit();
62
63 //! Close all connections with clients and the socket file descriptor
64 void shutdown();
65
66 //! Introspection support
67 void listMethods( XmlRpcValue& result );
68
69 // XmlRpcSource interface implementation
70
71 //! Handle client connection requests
72 virtual unsigned handleEvent( unsigned eventType );
73
74 //! Remove a connection from the dispatcher
76
77 protected:
78 //! Accept a client connection request
79 virtual void acceptConnection();
80
81 //! Create a new connection object for processing requests from a specific client.
82 virtual XmlRpcServerConnection* createConnection( int socket );
83
84 // Whether the introspection API is supported by this server
86
87 // Event dispatcher
89
90 // Collection of methods. This could be a set keyed on method name if we wanted...
91 typedef std::map<std::string, XmlRpcServerMethod*> MethodMap;
93
94 // system methods
97 };
98} // namespace XmlRpc
99
100#endif //_XMLRPCSERVER_H_
A class to handle XML RPC requests from a particular client.
Abstract class representing a single RPC method.
void shutdown()
Close all connections with clients and the socket file descriptor.
XmlRpcServerMethod * _listMethods
std::map< std::string, XmlRpcServerMethod * > MethodMap
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.
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
XmlRpcSource(int fd=-1, bool deleteOnClose=false)
RPC method arguments and results are represented by Values.
Definition XmlRpcValue.h:22