include/boost/corosio/native/detail/epoll/epoll_local_stream_socket.hpp
0.0% Lines (0/2)
0.0% List of functions (0/1)
Functions (1)
Function
Calls
Lines
Blocks
boost::corosio::detail::epoll_local_stream_socket::shutdown(boost::corosio::shutdown_type)
:93
0
0.0%
0.0%
| 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_NATIVE_DETAIL_EPOLL_EPOLL_LOCAL_STREAM_SOCKET_HPP | ||
| 11 | #define BOOST_COROSIO_NATIVE_DETAIL_EPOLL_EPOLL_LOCAL_STREAM_SOCKET_HPP | ||
| 12 | |||
| 13 | #include <boost/corosio/detail/platform.hpp> | ||
| 14 | |||
| 15 | #if BOOST_COROSIO_HAS_EPOLL | ||
| 16 | |||
| 17 | #include <boost/corosio/native/detail/reactor/reactor_stream_socket.hpp> | ||
| 18 | #include <boost/corosio/local_endpoint.hpp> | ||
| 19 | #include <boost/corosio/native/detail/reactor/reactor_op.hpp> | ||
| 20 | #include <boost/corosio/native/detail/epoll/epoll_op.hpp> | ||
| 21 | #include <boost/corosio/local_stream_socket.hpp> | ||
| 22 | #include <boost/capy/ex/executor_ref.hpp> | ||
| 23 | |||
| 24 | namespace boost::corosio::detail { | ||
| 25 | |||
| 26 | // Forward declarations | ||
| 27 | class epoll_local_stream_service; | ||
| 28 | class epoll_local_stream_socket; | ||
| 29 | class epoll_local_stream_acceptor; | ||
| 30 | |||
| 31 | /// Base operation for local stream sockets on epoll. | ||
| 32 | struct epoll_local_stream_op | ||
| 33 | : reactor_op<epoll_local_stream_socket, epoll_local_stream_acceptor> | ||
| 34 | { | ||
| 35 | void operator()() override; | ||
| 36 | }; | ||
| 37 | |||
| 38 | /// Connect operation for local stream sockets. | ||
| 39 | struct epoll_local_connect_op final | ||
| 40 | : reactor_connect_op<epoll_local_stream_op, local_endpoint> | ||
| 41 | { | ||
| 42 | void operator()() override; | ||
| 43 | void cancel() noexcept override; | ||
| 44 | }; | ||
| 45 | |||
| 46 | /// Scatter-read operation for local stream sockets. | ||
| 47 | struct epoll_local_read_op final : reactor_read_op<epoll_local_stream_op> | ||
| 48 | { | ||
| 49 | void cancel() noexcept override; | ||
| 50 | }; | ||
| 51 | |||
| 52 | /// Gather-write operation for local stream sockets. | ||
| 53 | struct epoll_local_write_op final | ||
| 54 | : reactor_write_op<epoll_local_stream_op, epoll_write_policy> | ||
| 55 | { | ||
| 56 | void cancel() noexcept override; | ||
| 57 | }; | ||
| 58 | |||
| 59 | /// Accept operation for local stream sockets. | ||
| 60 | struct epoll_local_accept_op final | ||
| 61 | : reactor_accept_op<epoll_local_stream_op, epoll_accept_policy> | ||
| 62 | { | ||
| 63 | void operator()() override; | ||
| 64 | void cancel() noexcept override; | ||
| 65 | }; | ||
| 66 | |||
| 67 | /// Stream socket implementation for local (Unix) sockets on epoll. | ||
| 68 | class epoll_local_stream_socket final | ||
| 69 | : public reactor_stream_socket< | ||
| 70 | epoll_local_stream_socket, | ||
| 71 | epoll_local_stream_service, | ||
| 72 | epoll_local_connect_op, | ||
| 73 | epoll_local_read_op, | ||
| 74 | epoll_local_write_op, | ||
| 75 | descriptor_state, | ||
| 76 | local_stream_socket::implementation, | ||
| 77 | corosio::local_endpoint> | ||
| 78 | { | ||
| 79 | friend class epoll_local_stream_service; | ||
| 80 | |||
| 81 | public: | ||
| 82 | explicit epoll_local_stream_socket( | ||
| 83 | epoll_local_stream_service& svc) noexcept; | ||
| 84 | ~epoll_local_stream_socket() override; | ||
| 85 | |||
| 86 | std::coroutine_handle<> connect( | ||
| 87 | std::coroutine_handle<>, | ||
| 88 | capy::executor_ref, | ||
| 89 | corosio::local_endpoint, | ||
| 90 | std::stop_token, | ||
| 91 | std::error_code*) override; | ||
| 92 | |||
| 93 | ✗ | std::error_code shutdown( | |
| 94 | local_stream_socket::shutdown_type what) noexcept override | ||
| 95 | { | ||
| 96 | ✗ | return do_shutdown(static_cast<int>(what)); | |
| 97 | } | ||
| 98 | |||
| 99 | std::coroutine_handle<> read_some( | ||
| 100 | std::coroutine_handle<>, | ||
| 101 | capy::executor_ref, | ||
| 102 | buffer_param, | ||
| 103 | std::stop_token, | ||
| 104 | std::error_code*, | ||
| 105 | std::size_t*) override; | ||
| 106 | |||
| 107 | std::coroutine_handle<> write_some( | ||
| 108 | std::coroutine_handle<>, | ||
| 109 | capy::executor_ref, | ||
| 110 | buffer_param, | ||
| 111 | std::stop_token, | ||
| 112 | std::error_code*, | ||
| 113 | std::size_t*) override; | ||
| 114 | |||
| 115 | void cancel() noexcept override; | ||
| 116 | void close_socket() noexcept; | ||
| 117 | native_handle_type release_socket() noexcept override; | ||
| 118 | }; | ||
| 119 | |||
| 120 | } // namespace boost::corosio::detail | ||
| 121 | |||
| 122 | #endif // BOOST_COROSIO_HAS_EPOLL | ||
| 123 | |||
| 124 | #endif // BOOST_COROSIO_NATIVE_DETAIL_EPOLL_EPOLL_LOCAL_STREAM_SOCKET_HPP | ||
| 125 |