Branch data Line data Source code
1 : : /*
2 : : * Copyright 2025 Jinwoo Sung
3 : : *
4 : : * Licensed under the Apache License, Version 2.0 (the "License");
5 : : * you may not use this file except in compliance with the License.
6 : : * You may obtain a copy of the License at
7 : : *
8 : : * http://www.apache.org/licenses/LICENSE-2.0
9 : : *
10 : : * Unless required by applicable law or agreed to in writing, software
11 : : * distributed under the License is distributed on an "AS IS" BASIS,
12 : : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : : * See the License for the specific language governing permissions and
14 : : * limitations under the License.
15 : : */
16 : :
17 : : #include "wirestead/transport/uds/boost_uds_acceptor.hpp"
18 : :
19 : : namespace wirestead {
20 : : namespace transport {
21 : :
22 : : namespace net = boost::asio;
23 : : using uds = net::local::stream_protocol;
24 : :
25 : 38 : BoostUdsAcceptor::BoostUdsAcceptor(boost::asio::io_context& ioc) : acceptor_(ioc) {}
26 : :
27 : 24 : void BoostUdsAcceptor::open(const uds& protocol, boost::system::error_code& ec) { acceptor_.open(protocol, ec); }
28 : :
29 : 24 : void BoostUdsAcceptor::bind(const uds::endpoint& endpoint, boost::system::error_code& ec) {
30 : 24 : acceptor_.bind(endpoint, ec);
31 : 24 : }
32 : :
33 : 23 : void BoostUdsAcceptor::listen(int backlog, boost::system::error_code& ec) { acceptor_.listen(backlog, ec); }
34 : :
35 : 0 : bool BoostUdsAcceptor::is_open() const { return acceptor_.is_open(); }
36 : :
37 : 27 : void BoostUdsAcceptor::close(boost::system::error_code& ec) { acceptor_.close(ec); }
38 : :
39 : 45 : void BoostUdsAcceptor::async_accept(std::function<void(const boost::system::error_code&, uds::socket)> handler) {
40 : 45 : acceptor_.async_accept(std::move(handler));
41 : 45 : }
42 : :
43 : : } // namespace transport
44 : : } // namespace wirestead
|