libiqxmlrpc  0.12.4
 All Classes Namespaces Files Functions Typedefs Enumerations
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 
77 
78 
79  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