Line data Source code
1 : //
2 : // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
3 : //
4 : // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 : //
7 : // Official repository: https://github.com/cppalliance/beast2
8 : //
9 :
10 : #ifndef BOOST_BEAST2_SERVER_HTTP_SERVER_HPP
11 : #define BOOST_BEAST2_SERVER_HTTP_SERVER_HPP
12 :
13 : #include <boost/beast2/detail/config.hpp>
14 : #include <boost/beast2/server/router_asio.hpp>
15 : #include <boost/asio/any_io_executor.hpp>
16 : #include <boost/asio/ip/tcp.hpp>
17 :
18 : namespace boost {
19 : namespace beast2 {
20 :
21 : class application;
22 :
23 : template<class Stream>
24 : class http_server
25 : {
26 : public:
27 0 : ~http_server() = default;
28 :
29 0 : http_server() = default;
30 :
31 : router_asio<Stream> wwwroot;
32 :
33 : /** Run the server
34 :
35 : This function attaches the current thread to I/O context
36 : so that it may be used for executing submitted function
37 : objects. Blocks the calling thread until the part is stopped
38 : and has no outstanding work.
39 : */
40 : virtual void attach() = 0;
41 : };
42 :
43 : //------------------------------------------------
44 :
45 : BOOST_BEAST2_DECL
46 : auto
47 : install_plain_http_server(
48 : application& app,
49 : char const* addr,
50 : unsigned short port,
51 : std::size_t num_workers) ->
52 : http_server<asio::basic_stream_socket<
53 : asio::ip::tcp,
54 : asio::io_context::executor_type>>&;
55 :
56 : } // beast2
57 : } // boost
58 :
59 : #endif
|