Kea 2.5.8
unix_domain_socket_acceptor.h
Go to the documentation of this file.
1// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef UNIX_DOMAIN_SOCKET_ACCEPTOR_H
8#define UNIX_DOMAIN_SOCKET_ACCEPTOR_H
9
10#ifndef BOOST_ASIO_HPP
11#error "asio.hpp must be included before including this, see asiolink.h as to why"
12#endif
13
16#include <functional>
17
18namespace isc {
19namespace asiolink {
20
25class UnixDomainSocketAcceptor : public IOAcceptor<boost::asio::local::stream_protocol,
26 std::function<void(const boost::system::error_code&)> > {
27public:
28
30 typedef std::function<void(const boost::system::error_code&)> AcceptHandler;
31
35 explicit UnixDomainSocketAcceptor(const IOServicePtr& io_service)
36 : IOAcceptor<boost::asio::local::stream_protocol,
37 std::function<void(const boost::system::error_code&)> >(io_service) {
38 }
39
43 virtual int getProtocol() const final {
44 return (AF_LOCAL);
45 }
46
57 void asyncAccept(const UnixDomainSocket& socket, const AcceptHandler& callback) {
58 asyncAcceptInternal(socket, callback);
59 }
60};
61
62} // end of namespace isc::asiolink
63} // end of namespace isc
64
65#endif // UNIX_DOMAIN_SOCKET_ACCEPTOR_H
Defines the logger used by the top-level component of kea-lfc.