libiqxmlrpc  0.12.4
 All Classes Namespaces Files Functions Typedefs Enumerations
http_server.h
1 // Libiqxmlrpc - an object-oriented XML-RPC solution.
2 // Copyright (C) 2011 Anton Dedov
3 
4 #ifndef _libiqxmlrpc_http_server_h_
5 #define _libiqxmlrpc_http_server_h_
6 
7 #include "connector.h"
8 #include "inet_addr.h"
9 #include "server.h"
10 #include "server_conn.h"
11 
12 namespace iqxmlrpc
13 {
14 
16 class LIBIQXMLRPC_API Http_server_connection:
17  public iqnet::Connection,
18  public Server_connection
19 {
20  iqnet::Reactor_base* reactor;
21 
22 public:
24 
25  void set_reactor( iqnet::Reactor_base* r ) { reactor = r; }
26 
27  void post_accept();
28  void finish();
29 
30  void handle_input( bool& );
31  void handle_output( bool& );
32 
33 
34  bool catch_in_reactor() const { return true; }
35  void log_exception( const std::exception& );
36  void log_unknown_exception();
37 
38 private:
39  virtual void do_schedule_response();
40 };
41 
43 class LIBIQXMLRPC_API Http_server: public Server {
45 
46 public:
47  Http_server(const iqnet::Inet_addr& bind_addr, Executor_factory_base* ef):
48  Server(bind_addr, new Conn_factory, ef)
49  {
50  static_cast<Conn_factory*>(get_conn_factory())->post_init(this, get_reactor());
51  }
52 };
53 
54 } // namespace iqxmlrpc
55 
56 #endif