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/rts/application.hpp>
16 : #include <boost/asio/ip/tcp.hpp>
17 :
18 : namespace boost {
19 : namespace beast2 {
20 :
21 : template<class AsyncStream>
22 : class http_server
23 : {
24 : public:
25 0 : ~http_server() = default;
26 :
27 0 : http_server() = default;
28 :
29 : router_asio<AsyncStream&> wwwroot;
30 :
31 : /** Run the server
32 :
33 : This function attaches the current thread to I/O context
34 : so that it may be used for executing submitted function
35 : objects. Blocks the calling thread until the part is stopped
36 : and has no outstanding work.
37 : */
38 : virtual void attach() = 0;
39 : };
40 :
41 : //------------------------------------------------
42 :
43 : BOOST_BEAST2_DECL
44 : auto
45 : install_plain_http_server(
46 : rts::application& app,
47 : char const* addr,
48 : unsigned short port,
49 : std::size_t num_workers) ->
50 : http_server<asio::basic_stream_socket<
51 : asio::ip::tcp,
52 : asio::io_context::executor_type>>&;
53 :
54 : } // beast2
55 : } // boost
56 :
57 : #endif
|