| Kea 3.0.2-git

tls_acceptor.h
Go to the documentation of this file.
1// Copyright (C) 2016-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 TLS_ACCEPTOR_H
8#define TLS_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
14#include <asiolink/io_acceptor.h>
15#include <asiolink/io_service.h>
16#include <asiolink/io_socket.h>
17#include <asiolink/tcp_acceptor.h>
18#include <asiolink/tcp_endpoint.h>
19#include <asiolink/tcp_socket.h>
20#include <asiolink/tls_socket.h>
21#include <boost/shared_ptr.hpp>
22#include <netinet/in.h>
23
24 namespace isc {
25 namespace asiolink {
26
30 template<typename C>
31 class TLSAcceptor : public TCPAcceptor<C> {
32 public:
33
37 explicit TLSAcceptor(const IOServicePtr& io_service) : TCPAcceptor<C>(io_service) {
38 }
39
41 virtual ~TLSAcceptor() {
42 }
43
54 template<typename SocketCallback>
55 void asyncAccept(const TLSSocket<SocketCallback>& socket, C& callback) {
56 TCPAcceptor<C>::acceptor_->async_accept(socket.getASIOSocket(), callback);
57 }
58};
59
60} // namespace asiolink
61} // namespace isc
62
63#endif
isc::asiolink::IOAcceptor< boost::asio::ip::tcp, C >::acceptor_
boost::shared_ptr< typename boost::asio::ip::tcp::acceptor > acceptor_
Definition io_acceptor.h:126
isc::asiolink::TCPAcceptor::TCPAcceptor
TCPAcceptor(const IOServicePtr &io_service)
Constructor.
Definition tcp_acceptor.h:38
isc::asiolink::TLSAcceptor::asyncAccept
void asyncAccept(const TLSSocket< SocketCallback > &socket, C &callback)
Asynchronously accept new connection.
Definition tls_acceptor.h:55
isc::asiolink::TLSAcceptor::~TLSAcceptor
virtual ~TLSAcceptor()
Destructor.
Definition tls_acceptor.h:41
isc::asiolink::TLSAcceptor::TLSAcceptor
TLSAcceptor(const IOServicePtr &io_service)
Constructor.
Definition tls_acceptor.h:37
isc::asiolink::TLSSocket
The TLSSocket class is a concrete derived class of IOAsioSocket that represents a TLS socket.
Definition tls_socket.h:28
isc::asiolink::TLSSocket::getASIOSocket
virtual TlsStream< C >::lowest_layer_type & getASIOSocket() const
Returns reference to the underlying ASIO socket.
Definition tls_socket.h:212
io_acceptor.h
io_service.h
io_socket.h
isc::asiolink
Definition addr_utilities.cc:170
isc::asiolink::IOServicePtr
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Definition io_service.h:28
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
tcp_acceptor.h
tcp_endpoint.h
tcp_socket.h
tls_socket.h