![]() |
Home | Libraries | People | FAQ | More |
00001 #ifndef HTTP_CONNECTION_HPP 00002 #define HTTP_CONNECTION_HPP 00003 00004 #include <boost/asio.hpp> 00005 #include <boost/array.hpp> 00006 #include <boost/noncopyable.hpp> 00007 #include <boost/shared_ptr.hpp> 00008 #include <boost/enable_shared_from_this.hpp> 00009 #include "reply.hpp" 00010 #include "request.hpp" 00011 #include "request_handler.hpp" 00012 #include "request_parser.hpp" 00013 00014 namespace http { 00015 namespace server { 00016 00017 class connection_manager; 00018 00020 class connection 00021 : public boost::enable_shared_from_this<connection>, 00022 private boost::noncopyable 00023 { 00024 public: 00026 explicit connection(boost::asio::io_service& io_service, 00027 connection_manager& manager, request_handler& handler); 00028 00030 boost::asio::ip::tcp::socket& socket(); 00031 00033 void start(); 00034 00036 void stop(); 00037 00038 private: 00040 void handle_read(const boost::asio::error& e, std::size_t bytes_transferred); 00041 00043 void handle_write(const boost::asio::error& e); 00044 00046 boost::asio::ip::tcp::socket socket_; 00047 00049 connection_manager& connection_manager_; 00050 00052 request_handler& request_handler_; 00053 00055 boost::array<char, 8192> buffer_; 00056 00058 request request_; 00059 00061 request_parser request_parser_; 00062 00064 reply reply_; 00065 }; 00066 00067 typedef boost::shared_ptr<connection> connection_ptr; 00068 00069 } // namespace server 00070 } // namespace http 00071 00072 #endif // HTTP_CONNECTION_HPP
Copyright © 2003 - 2006 Christopher M. Kohlhoff |