XmlRpcServer.h
Go to the documentation of this file.
1 // this file modified by Morgan Quigley on 22 Apr 2008.
2 // added features: server can be opened on port 0 and you can read back
3 // what port the OS gave you
4 
5 #ifndef _XMLRPCSERVER_H_
6 #define _XMLRPCSERVER_H_
7 //
8 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
9 //
10 #if defined(_MSC_VER)
11 # pragma warning(disable:4786) // identifier was truncated in debug info
12 #endif
13 
14 #ifndef MAKEDEPEND
15 # include <map>
16 # include <string>
17 #endif
18 
20 #include "xmlrpcpp/XmlRpcSource.h"
21 #include "xmlrpcpp/XmlRpcDecl.h"
22 
23 namespace XmlRpc {
24 
25 
26  // An abstract class supporting XML RPC methods
27  class XmlRpcServerMethod;
28 
29  // Class representing connections to specific clients
30  class XmlRpcServerConnection;
31 
32  // Class representing argument and result values
33  class XmlRpcValue;
34 
35 
38  public:
40  XmlRpcServer();
42  virtual ~XmlRpcServer();
43 
45  void enableIntrospection(bool enabled=true);
46 
48  void addMethod(XmlRpcServerMethod* method);
49 
51  void removeMethod(XmlRpcServerMethod* method);
52 
54  void removeMethod(const std::string& methodName);
55 
57  XmlRpcServerMethod* findMethod(const std::string& name) const;
58 
61  bool bindAndListen(int port, int backlog = 5);
62 
64  void work(double msTime);
65 
67  void exit();
68 
70  void shutdown();
71 
73  void listMethods(XmlRpcValue& result);
74 
75  // XmlRpcSource interface implementation
76 
78  virtual unsigned handleEvent(unsigned eventType);
79 
81  virtual void removeConnection(XmlRpcServerConnection*);
82 
83  inline int get_port() { return _port; }
84 
85  XmlRpcDispatch *get_dispatch() { return &_disp; }
86 
87  protected:
88 
90  virtual void acceptConnection();
91 
93  virtual XmlRpcServerConnection* createConnection(int socket);
94 
95  // Whether the introspection API is supported by this server
97 
98  // Event dispatcher
100 
101  // Collection of methods. This could be a set keyed on method name if we wanted...
102  typedef std::map< std::string, XmlRpcServerMethod* > MethodMap;
103  MethodMap _methods;
104 
105  // system methods
108 
109  int _port;
110 
111  };
112 } // namespace XmlRpc
113 
114 #endif //_XMLRPCSERVER_H_
A class to handle XML RPC requests from a particular client.
Definition: XmlRpc.h:39
RPC method arguments and results are represented by Values.
Definition: XmlRpcValue.h:24
XmlRpcDispatch * get_dispatch()
Definition: XmlRpcServer.h:85
Abstract class representing a single RPC method.
XmlRpcServerMethod * _listMethods
Definition: XmlRpcServer.h:106
std::map< std::string, XmlRpcServerMethod * > MethodMap
Definition: XmlRpcServer.h:102
XmlRpcDispatch _disp
Definition: XmlRpcServer.h:99
An RPC source represents a file descriptor to monitor.
Definition: XmlRpcSource.h:16
#define XMLRPCPP_DECL
Definition: XmlRpcDecl.h:52
A class to handle XML RPC requests.
Definition: XmlRpcServer.h:37
XmlRpcServerMethod * _methodHelp
Definition: XmlRpcServer.h:107


xmlrpcpp
Author(s): Chris Morley, Konstantin Pilipchuk, Morgan Quigley
autogenerated on Mon Jun 10 2019 14:48:08