Examples |
00001 #ifndef HTTP_SERVER_HPP 00002 #define HTTP_SERVER_HPP 00003 00004 #include <asio.hpp> 00005 #include <string> 00006 #include <boost/noncopyable.hpp> 00007 #include "connection.hpp" 00008 #include "connection_manager.hpp" 00009 #include "request_handler.hpp" 00010 00011 namespace http { 00012 namespace server { 00013 00015 class server 00016 : private boost::noncopyable 00017 { 00018 public: 00021 explicit server(const std::string& address, const std::string& port, 00022 const std::string& doc_root); 00023 00025 void run(); 00026 00028 void stop(); 00029 00030 private: 00032 void handle_accept(const asio::error& e); 00033 00035 void handle_stop(); 00036 00038 asio::io_service io_service_; 00039 00041 asio::ip::tcp::acceptor acceptor_; 00042 00044 connection_manager connection_manager_; 00045 00047 connection_ptr new_connection_; 00048 00050 request_handler request_handler_; 00051 }; 00052 00053 } // namespace server 00054 } // namespace http 00055 00056 #endif // HTTP_SERVER_HPP