libiqxmlrpc  0.12.12
server.h
1 // Libiqxmlrpc - an object-oriented XML-RPC solution.
2 // Copyright (C) 2011 Anton Dedov
3 
4 #ifndef _iqxmlrpc_server_h_
5 #define _iqxmlrpc_server_h_
6 
7 #include "acceptor.h"
8 #include "builtins.h"
9 #include "connection.h"
10 #include "conn_factory.h"
11 #include "dispatcher_manager.h"
12 #include "executor.h"
13 #include "firewall.h"
14 #include "http.h"
15 #include "util.h"
16 
17 namespace iqnet
18 {
19  class Reactor_base;
20  class Reactor_interrupter;
21 }
22 
23 namespace iqxmlrpc {
24 
25 class Auth_Plugin_base;
26 
27 #ifdef _MSC_VER
28 #pragma warning(push)
29 #pragma warning(disable: 4251)
30 #pragma warning(disable: 4275)
31 #endif
32 
34 class LIBIQXMLRPC_API Server: boost::noncopyable {
35 public:
36  Server(
37  const iqnet::Inet_addr& addr,
38  iqnet::Accepted_conn_factory* conn_factory,
39  Executor_factory_base* executor_factory );
40 
41  virtual ~Server();
42 
44  void register_method(const std::string& name, Method_factory_base*);
45 
50  void push_dispatcher(Method_dispatcher_base*);
51 
54  void push_interceptor(Interceptor*);
55 
58  void enable_introspection();
59 
61  void log_errors( std::ostream* );
62 
64  void set_max_request_sz( size_t );
65  size_t get_max_request_sz() const;
66 
68  void set_firewall( iqnet::Firewall_base* );
69 
70  void set_verification_level(http::Verification_level);
71  http::Verification_level get_verification_level() const;
72 
73  void set_auth_plugin(const Auth_Plugin_base&);
76 
78  void work();
80 
82  void set_exit_flag();
83 
85  void interrupt();
88  iqnet::Reactor_base* get_reactor();
89 
90  void schedule_execute( http::Packet*, Server_connection* );
91  void schedule_response( const Response&, Server_connection*, Executor* );
92 
93  void log_err_msg( const std::string& );
94 
95 protected:
96  iqnet::Accepted_conn_factory* get_conn_factory();
97 
98 private:
99  class Impl;
100  Impl *impl;
101 };
102 
103 #ifdef _MSC_VER
104 #pragma warning(pop)
105 #endif
106 
108 template <class Method_class>
109 inline void register_method(Server& server, const std::string& name)
110 {
111 // typedef typename Method_class::Help Help;
112 // Introspector::register_help_obj( meth_name, new Help );
113 
115 }
116 
118 inline void LIBIQXMLRPC_API
119 register_method(Server& server, const std::string& name, Method_function fn)
120 {
122 }
123 
124 } // namespace iqxmlrpc
125 
126 #endif
127 // vim:ts=2:sw=2:et
HTTP Authentication plugin.
Definition: auth_plugin.h:14
XML-RPC response.
Definition: response.h:28
HTTP packet: Header + Content.
Definition: http.h:146
void register_method(const std::string &name, Method_factory_base *)
Register method using abstract factory.
Definition: server.cc:75
void register_method(Server &server, const std::string &name)
Register class Method_class as handler for call "name" with specific server.
Definition: server.h:109
Abstract base for Executor's factories.
Definition: executor.h:78
Object-oriented networking/multithreading infrastructure.
Definition: acceptor.h:11
void(* Method_function)(Method *, const Param_list &, Value &)
Type of pointer to function that can be used as server method.
Definition: method.h:28
An object representation of internet address.
Definition: inet_addr.h:27
Template for simple Method factory.
Definition: method.h:164
XML-RPC server.
Definition: server.h:34
Abstract factory for accepted connections.
Definition: conn_factory.h:13
Abstract executor class. Defines the policy for method execution.
Definition: executor.h:53
Base class for XML-RPC server connections.
Definition: server_conn.h:26
XML-RPC library.
Definition: auth_plugin.cc:6
Specialization for funciton adapters.
Definition: method.h:172
Interceptor's base class.
Definition: method.h:99
Method dispatcher base class.
Definition: method.h:185
Verification_level
The level of HTTP sanity checks.
Definition: http.h:28
Firewall base class.
Definition: firewall.h:13
Abstract factory for Method.
Definition: method.h:154
Definition: reactor.h:44