summaryrefslogtreecommitdiff
path: root/httpd.h
blob: cee209333e1716df547c854760c900b2736f8f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef HTTPD_H
#define HTTPD_H

#include "http_connection.h"

#include <string>
#include <map>

#include <boost/function.hpp>

namespace HTTP {
	class Server {
		public:
			Server(boost::asio::io_service& io_service, const tcp::endpoint& endpoint);
			
			void add_handler(const std::string& name, Handler handler);
			
		private:
			void start_accept();
			void handle_accept(Connection::p new_connection, const boost::system::error_code& error);
			
			void handle_request(Connection::p connection);
			
			tcp::acceptor acceptor_;
			
			std::map<std::string, Handler> handlers;
	};
}

#endif