summaryrefslogtreecommitdiff
path: root/httpd.h
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-12-27 02:47:56 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2010-12-27 02:47:56 +0100
commit9f78196611d8065f63ae4a81297723663d222ebe (patch)
treeb70e94f4f581db1298d86d3a44b3a2e2851c076d /httpd.h
parent6e376f69305dabe59362bb80051e4265c6409fe3 (diff)
Added a simple HTTP service which doesn't yet do anything useful.
Diffstat (limited to 'httpd.h')
-rw-r--r--httpd.h35
1 files changed, 35 insertions, 0 deletions
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 <boost/asio.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+using boost::asio::ip::tcp;
+
+class HTTPConnection : public boost::enable_shared_from_this<HTTPConnection> {
+ 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<HTTPConnection> 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