asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design
Examples

http/server/server.hpp

Go to the documentation of this file.
00001 //
00002 // server.hpp
00003 // ~~~~~~~~~~
00004 //
00005 // Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
00006 //
00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 //
00010 
00011 #ifndef HTTP_SERVER_HPP
00012 #define HTTP_SERVER_HPP
00013 
00014 #include <asio.hpp>
00015 #include <string>
00016 #include <boost/noncopyable.hpp>
00017 #include "connection.hpp"
00018 #include "connection_manager.hpp"
00019 #include "request_handler.hpp"
00020 
00021 namespace http {
00022 namespace server {
00023 
00025 class server
00026   : private boost::noncopyable
00027 {
00028 public:
00031   explicit server(const std::string& address, const std::string& port,
00032       const std::string& doc_root);
00033 
00035   void run();
00036 
00038   void stop();
00039 
00040 private:
00042   void handle_accept(const asio::error_code& e);
00043 
00045   void handle_stop();
00046 
00048   asio::io_service io_service_;
00049 
00051   asio::ip::tcp::acceptor acceptor_;
00052 
00054   connection_manager connection_manager_;
00055 
00057   connection_ptr new_connection_;
00058 
00060   request_handler request_handler_;
00061 };
00062 
00063 } // namespace server
00064 } // namespace http
00065 
00066 #endif // HTTP_SERVER_HPP
asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design