From 9f78196611d8065f63ae4a81297723663d222ebe Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 27 Dec 2010 02:47:56 +0100 Subject: Added a simple HTTP service which doesn't yet do anything useful. --- httpd.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 httpd.h (limited to 'httpd.h') diff --git a/httpd.h b/httpd.h new file mode 100644 index 0000000..f5a3414 --- /dev/null +++ b/httpd.h @@ -0,0 +1,35 @@ +#ifndef HTTPD_H +#define HTTPD_H + +#include +#include + +using boost::asio::ip::tcp; + +class HTTPConnection : public boost::enable_shared_from_this { + friend class HTTPServer; + + private: + HTTPConnection(boost::asio::io_service& io_service); + void handle_write(const boost::system::error_code& error, size_t bytes_transferred); + tcp::socket socket; + + public: + typedef boost::shared_ptr pointer; + + static pointer create(boost::asio::io_service& io_service); + void start(); +}; + +class HTTPServer { + private: + void start_accept(); + void handle_accept(HTTPConnection::pointer new_connection, const boost::system::error_code& error); + + tcp::acceptor acceptor_; + + public: + HTTPServer(boost::asio::io_service& io_service); +}; + +#endif -- cgit v1.2.3