blob: 0fd601f6ad6ad48480aacb5913f93ab313cbb089 (
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 {
typedef boost::function<void (Connection::p)> Handler;
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);
tcp::acceptor acceptor_;
std::map<std::string, Handler> handlers;
};
}
#endif
|