Kea: lease_query_listener.h Source File

| Kea 3.0.2-git

lease_query_listener.h
Go to the documentation of this file.
1// Copyright (C) 2022-2025 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 LEASE_QUERY_LISTENER_H
8#define LEASE_QUERY_LISTENER_H
9
10#include <config.h>
11#include <asiolink/asio_wrapper.h>
12#include <asiolink/io_service.h>
13#include <dhcp/pkt.h>
14#include <tcp/tcp_listener.h>
15#include <tcp/tcp_connection.h>
16#include <lease_query_connection.h>
17
18namespace isc {
19namespace lease_query {
20
22 class LeaseQueryListener : public tcp::TcpListener {
23public:
36 LeaseQueryListener(const asiolink::IOServicePtr& io_service,
37 const asiolink::IOAddress& server_address,
38 const unsigned short server_port,
39 const asiolink::TlsContextPtr& tls_context,
40 const tcp::TcpListener::IdleTimeout& idle_timeout,
41 const tcp::TcpConnectionFilterCallback& filter_callback,
42 const uint16_t family,
43 const size_t max_concurrent_queries = 0)
44 : tcp::TcpListener(io_service,
45 server_address,
46 server_port,
47 tls_context,
48 idle_timeout,
49 filter_callback),
50 family_(family),
51 max_concurrent_queries_(max_concurrent_queries) {
52 }
53
55 virtual ~LeaseQueryListener() {
56 }
57
58protected:
65 virtual tcp::TcpConnectionPtr createConnection(
66 const tcp::TcpConnectionAcceptorCallback& acceptor_callback,
67 const tcp::TcpConnectionFilterCallback& connection_filter) {
68 LeaseQueryConnectionPtr conn(new LeaseQueryConnection(io_service_,
69 acceptor_,
70 tls_context_,
71 connections_,
72 acceptor_callback,
73 connection_filter,
74 idle_timeout_,
75 family_,
76 max_concurrent_queries_));
77 return (conn);
78 }
79
81 uint16_t family_;
82
85 size_t max_concurrent_queries_;
86};
87
89 typedef boost::shared_ptr<LeaseQueryListener> LeaseQueryListenerPtr;
90
91} // end of namespace isc::lease_query
92} // end of namespace isc
93
94#endif // LEASE_QUERY_LISTENER_H
asio_wrapper.h
isc::asiolink::IOAddress
The IOAddress class represents an IP addresses (version agnostic).
Definition io_address.h:45
isc::lease_query::LeaseQueryConnection
Derivation of TcpConnection used for Bulk LeaseQuery.
Definition lease_query_connection.h:156
isc::lease_query::LeaseQueryListener::family_
uint16_t family_
Protocol family AF_INET or AF_INET6.
Definition lease_query_listener.h:81
isc::lease_query::LeaseQueryListener::createConnection
virtual tcp::TcpConnectionPtr createConnection(const tcp::TcpConnectionAcceptorCallback &acceptor_callback, const tcp::TcpConnectionFilterCallback &connection_filter)
Creates an instance of the TcpConnection.
Definition lease_query_listener.h:65
isc::lease_query::LeaseQueryListener::LeaseQueryListener
LeaseQueryListener(const asiolink::IOServicePtr &io_service, const asiolink::IOAddress &server_address, const unsigned short server_port, const asiolink::TlsContextPtr &tls_context, const tcp::TcpListener::IdleTimeout &idle_timeout, const tcp::TcpConnectionFilterCallback &filter_callback, const uint16_t family, const size_t max_concurrent_queries=0)
Constructor.
Definition lease_query_listener.h:36
isc::lease_query::LeaseQueryListener::~LeaseQueryListener
virtual ~LeaseQueryListener()
Destructor.
Definition lease_query_listener.h:55
isc::lease_query::LeaseQueryListener::max_concurrent_queries_
size_t max_concurrent_queries_
Maximum number of concurrent queries allowed.
Definition lease_query_listener.h:85
isc::tcp::TcpListener
Implements a class that listens for, accepts, and manages TCP connections.
Definition tcp_listener.h:28
isc::tcp::TcpListener::io_service_
asiolink::IOServicePtr io_service_
Pointer to the IO service.
Definition tcp_listener.h:139
isc::tcp::TcpListener::TcpListener
TcpListener(const asiolink::IOServicePtr &io_service, const asiolink::IOAddress &server_address, const unsigned short server_port, const asiolink::TlsContextPtr &tls_context, const IdleTimeout &idle_timeout, const TcpConnectionFilterCallback &connection_filter=0)
Constructor.
Definition tcp_listener.cc:17
isc::tcp::TcpListener::tls_context_
asiolink::TlsContextPtr tls_context_
TLS context.
Definition tcp_listener.h:142
isc::tcp::TcpListener::connections_
TcpConnectionPool connections_
Pool of active connections.
Definition tcp_listener.h:152
isc::tcp::TcpListener::idle_timeout_
long idle_timeout_
Timeout after which idle connection is closed by the server.
Definition tcp_listener.h:156
isc::tcp::TcpListener::acceptor_
TcpConnectionAcceptorPtr acceptor_
Acceptor instance.
Definition tcp_listener.h:145
io_service.h
lease_query_connection.h
isc::asiolink::TlsContextPtr
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
Definition common_tls.h:37
isc::asiolink::IOServicePtr
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Definition io_service.h:28
isc::lease_query
Definition blq_msg.h:15
isc::lease_query::LeaseQueryConnectionPtr
boost::shared_ptr< LeaseQueryConnection > LeaseQueryConnectionPtr
Defines a shared pointer to a LeaseQueryConnection.
Definition lease_query_connection.h:150
isc::lease_query::LeaseQueryListenerPtr
boost::shared_ptr< LeaseQueryListener > LeaseQueryListenerPtr
Defines a pointer to a LeaseQueryListener.
Definition lease_query_listener.h:89
isc::tcp
Definition mt_tcp_listener_mgr.cc:23
isc::tcp::TcpConnectionFilterCallback
std::function< bool(const boost::asio::ip::tcp::endpoint &)> TcpConnectionFilterCallback
Type of the callback for filtering new connections by ip address.
Definition tcp_connection.h:154
isc::tcp::TcpConnectionPtr
boost::shared_ptr< TcpConnection > TcpConnectionPtr
Pointer to the TcpConnection.
Definition tcp_connection.h:467
isc::tcp::TcpConnectionAcceptorCallback
std::function< void(const boost::system::error_code &)> TcpConnectionAcceptorCallback
Type of the callback for the TCP acceptor used in this library.
Definition tcp_connection_acceptor.h:21
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
pkt.h
isc::tcp::TcpListener::IdleTimeout
Idle connection timeout.
Definition tcp_listener.h:31
tcp_connection.h
tcp_listener.h