Kea 3.1.1
mt_lease_query_mgr.cc
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#include <config.h>
10#include <asiolink/io_error.h>
11#include <asiolink/io_service.h>
12#include <mt_lease_query_mgr.h>
14
15#include <boost/pointer_cast.hpp>
16
17using namespace isc::asiolink;
18using namespace isc::tcp;
19using namespace isc::util;
20
21namespace ph = std::placeholders;
22
23namespace isc {
24namespace lease_query {
25
27 const uint16_t port,
28 const uint16_t family,
29 const tcp::TcpListener::IdleTimeout& idle_timeout,
30 const uint16_t thread_pool_size /* = 1 */,
31 TlsContextPtr context /* = () */,
32 TcpConnectionFilterCallback connection_filter /* = 0 */,
33 const size_t max_concurrent_queries /* = 0 */)
35 this, ph::_1, ph::_2, ph::_3, ph::_4, ph::_5,
36 ph::_6),
37 address, port, thread_pool_size, context,
38 connection_filter),
39 family_(family),
40 max_concurrent_queries_(max_concurrent_queries) {
41 setIdleTimeout(idle_timeout.value_);
42}
43
46 const asiolink::IOAddress& server_address,
47 const unsigned short server_port,
48 const asiolink::TlsContextPtr& tls_context,
49 const TcpListener::IdleTimeout& idle_timeout,
50 const TcpConnectionFilterCallback& connection_filter) {
51 TcpListenerPtr listener(new LeaseQueryListener(io_service,
52 server_address,
53 server_port,
54 tls_context,
55 idle_timeout,
56 connection_filter,
57 family_,
58 max_concurrent_queries_));
59 return (listener);
60}
61
62
66
67} // namespace isc::lease_query
68} // namespace isc
Derivation of TcpListener specific to Bulk Lease Query.
tcp::TcpListenerPtr listenerFactory(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 &connection_filter)
Defines a factory function for creating listeners.
MtLeaseQueryListenerMgr(const asiolink::IOAddress &address, const uint16_t port, const uint16_t family, const tcp::TcpListener::IdleTimeout &idle_timeout, const uint16_t thread_pool_size=1, asiolink::TlsContextPtr context=asiolink::TlsContextPtr(), tcp::TcpConnectionFilterCallback connection_filter=0, const size_t max_concurrent_queries=0)
Constructor.
MtTcpListenerMgr(TcpListenerFactory listener_factory, const asiolink::IOAddress &address, const uint16_t port, const uint16_t thread_pool_size=1, asiolink::TlsContextPtr context=asiolink::TlsContextPtr(), TcpConnectionFilterCallback connection_filter=0)
Constructor.
void setIdleTimeout(long milliseconds)
Sets the idle time per connection.
void stop()
Stops the listener's thread pool.
std::function< bool(const boost::asio::ip::tcp::endpoint &)> TcpConnectionFilterCallback
Type of the callback for filtering new connections by ip address.
boost::shared_ptr< TcpListener > TcpListenerPtr
Pointer to a TcpListener.
Defines the logger used by the top-level component of kea-lfc.
Idle connection timeout.
long value_
Connection idle timeout value specified.