Repository navigation
Expand file tree
/
Copy pathserver.hpp
More file actions
77 lines (60 loc) · 1.95 KB
/
Copy pathserver.hpp
File metadata and controls
77 lines (60 loc) · 1.95 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright 2009 Tarroo, Inc.
// Copyright 2010 Glyn Matthews
// Copyright 2003-2008 Chris Kholhoff
// Copyright 2009-2012 Dean Michael Berris <dberris@gmail.com>
// Copyright 2012 Google, Inc.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef NETWORK_HTTP_SERVER_HPP_
#define NETWORK_HTTP_SERVER_HPP_
#include <boost/shared_ptr.hpp>
namespace network {
namespace utils {
struct thread_pool;
} // namespace utils
} // namespace network
namespace network {
namespace http {
class server_options;
class sync_server_impl;
class async_server_impl;
class async_server_connection;
struct request;
struct response;
template <class SyncHandler> class sync_server {
public:
sync_server(server_options const& options, SyncHandler& handler);
void run();
void stop();
void listen();
~sync_server();
typedef http::request request;
typedef http::response response;
private:
sync_server_impl* pimpl_;
sync_server(sync_server const& other); // = delete
sync_server& operator=(sync_server other); // = delete
};
template <class AsyncHandler> class async_server {
public:
explicit async_server(server_options const& options,
AsyncHandler& handler,
utils::thread_pool& pool);
void run();
void stop();
void listen();
~async_server();
typedef http::request request;
typedef boost::shared_ptr<async_server_connection> connection_ptr;
private:
async_server_impl* pimpl_;
async_server(async_server const& other); // = delete
async_server& operator=(async_server other); // = delete
};
} // namespace http
} // namespace network
// We're hiding the implementation from here, but still explicitly including
// it here. This is mostly a style point, to keep this header clean.
#include <network/protocol/http/server/server.ipp>
#endif // NETWORK_HTTP_SERVER_HPP_