include/boost/corosio/detail/local_stream_acceptor_service.hpp

100.0% Lines (2/2) 100.0% List of functions (2/2)
local_stream_acceptor_service.hpp
f(x) Functions (2)
Line TLA Hits Source Code
1 //
2 // Copyright (c) 2026 Michael Vandeberg
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/corosio
8 //
9
10 #ifndef BOOST_COROSIO_DETAIL_LOCAL_STREAM_ACCEPTOR_SERVICE_HPP
11 #define BOOST_COROSIO_DETAIL_LOCAL_STREAM_ACCEPTOR_SERVICE_HPP
12
13 #include <boost/corosio/detail/config.hpp>
14 #include <boost/corosio/local_stream_acceptor.hpp>
15 #include <boost/corosio/local_endpoint.hpp>
16 #include <boost/capy/ex/execution_context.hpp>
17 #include <system_error>
18
19 namespace boost::corosio::detail {
20
21 /* Abstract local stream acceptor service base class.
22
23 Concrete implementations (epoll, select, kqueue) inherit
24 from this class and provide platform-specific acceptor
25 operations for Unix domain sockets.
26 */
27 class BOOST_COROSIO_DECL local_stream_acceptor_service
28 : public capy::execution_context::service
29 , public io_object::io_service
30 {
31 public:
32 /// Identifies this service for execution_context lookup.
33 using key_type = local_stream_acceptor_service;
34
35 /** Create the acceptor socket.
36
37 @param impl The acceptor implementation to open.
38 @param family Address family (AF_UNIX).
39 @param type Socket type (SOCK_STREAM).
40 @param protocol Protocol number (0).
41 @return Error code on failure, empty on success.
42 */
43 virtual std::error_code open_acceptor_socket(
44 local_stream_acceptor::implementation& impl,
45 int family,
46 int type,
47 int protocol) = 0;
48
49 /** Bind an open acceptor to a local endpoint.
50
51 @param impl The acceptor implementation to bind.
52 @param ep The local endpoint (path) to bind to.
53 @return Error code on failure, empty on success.
54 */
55 virtual std::error_code bind_acceptor(
56 local_stream_acceptor::implementation& impl,
57 local_endpoint ep) = 0;
58
59 /** Start listening for incoming connections.
60
61 @param impl The acceptor implementation to listen on.
62 @param backlog The maximum pending connection queue length.
63 @return Error code on failure, empty on success.
64 */
65 virtual std::error_code listen_acceptor(
66 local_stream_acceptor::implementation& impl,
67 int backlog) = 0;
68
69 protected:
70 587x local_stream_acceptor_service() = default;
71 587x ~local_stream_acceptor_service() override = default;
72 };
73
74 } // namespace boost::corosio::detail
75
76 #endif // BOOST_COROSIO_DETAIL_LOCAL_STREAM_ACCEPTOR_SERVICE_HPP
77