diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
commit | f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 (patch) | |
tree | 49e44c6f87febed37efb953ab5485aa49f6481a7 /src/lib/dhcp/packet_queue_mgr4.cc | |
parent | Initial commit. (diff) | |
download | isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.tar.xz isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.zip |
Adding upstream version 2.4.1.upstream/2.4.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib/dhcp/packet_queue_mgr4.cc')
-rw-r--r-- | src/lib/dhcp/packet_queue_mgr4.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/dhcp/packet_queue_mgr4.cc b/src/lib/dhcp/packet_queue_mgr4.cc new file mode 100644 index 0000000..1918a6d --- /dev/null +++ b/src/lib/dhcp/packet_queue_mgr4.cc @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> +#include <dhcp/packet_queue_ring.h> +#include <dhcp/packet_queue_mgr4.h> + +#include <boost/scoped_ptr.hpp> + +namespace isc { +namespace dhcp { + +const std::string PacketQueueMgr4::DEFAULT_QUEUE_TYPE4 = "kea-ring4"; + +PacketQueueMgr4::PacketQueueMgr4() { + // Register default queue factory + registerPacketQueueFactory(DEFAULT_QUEUE_TYPE4, [](data::ConstElementPtr parameters) + -> PacketQueue4Ptr { + size_t capacity; + try { + capacity = data::SimpleParser::getInteger(parameters, "capacity"); + } catch (const std::exception& ex) { + isc_throw(InvalidQueueParameter, DEFAULT_QUEUE_TYPE4 << " factory:" + " 'capacity' parameter is missing/invalid: " << ex.what()); + } + + PacketQueue4Ptr queue(new PacketQueueRing4(DEFAULT_QUEUE_TYPE4, capacity)); + return (queue); + }); +} + +} // end of isc::dhcp namespace +} // end of isc namespace |