Kea: packet_queue_mgr6.cc Source File

| Kea 3.2.0-git

packet_queue_mgr6.cc
Go to the documentation of this file.
1// Copyright (C) 2018 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>
8#include <dhcp/packet_queue_ring.h>
9#include <dhcp/packet_queue_mgr6.h>
10
11#include <boost/scoped_ptr.hpp>
12
13namespace isc {
14namespace dhcp {
15
16const std::string PacketQueueMgr6::DEFAULT_QUEUE_TYPE6 = "kea-ring6";
17
18PacketQueueMgr6::PacketQueueMgr6() {
19 // Register default queue factory
20 registerPacketQueueFactory(DEFAULT_QUEUE_TYPE6, [](data::ConstElementPtr parameters)
21 -> PacketQueue6Ptr {
22 size_t capacity;
23 try {
24 capacity = data::SimpleParser::getInteger(parameters, "capacity");
25 } catch (const std::exception& ex) {
26 isc_throw(InvalidQueueParameter, DEFAULT_QUEUE_TYPE6 << " factory:"
27 " 'capacity' parameter is missing/invalid: " << ex.what());
28 }
29
30 PacketQueue6Ptr queue(new PacketQueueRing6(DEFAULT_QUEUE_TYPE6, capacity));
31 return (queue);
32 });
33}
34
35} // end of isc::dhcp namespace
36} // end of isc namespace
isc::data::SimpleParser::getInteger
static int64_t getInteger(isc::data::ConstElementPtr scope, const std::string &name)
Returns an integer parameter from a scope.
Definition lib/cc/simple_parser.cc:77
isc::dhcp::InvalidQueueParameter
Invalid queue parameter exception.
Definition packet_queue.h:24
isc::dhcp::PacketQueueMgr6::PacketQueueMgr6
PacketQueueMgr6()
constructor.
Definition packet_queue_mgr6.cc:18
isc::dhcp::PacketQueueMgr6::DEFAULT_QUEUE_TYPE6
static const std::string DEFAULT_QUEUE_TYPE6
Logical name of the pre-registered, default queue implementation.
Definition packet_queue_mgr6.h:26
isc::dhcp::PacketQueueMgr< PacketQueue6Ptr >::registerPacketQueueFactory
bool registerPacketQueueFactory(const std::string &queue_type, Factory factory)
Definition packet_queue_mgr.h:70
isc::dhcp::PacketQueueRing6
DHCPv6 packet queue buffer implementation.
Definition packet_queue_ring.h:246
isc_throw
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Definition exceptions/exceptions.h:210
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:30
isc::dhcp
Definition dhcp4/client_handler.cc:20
isc::dhcp::PacketQueue6Ptr
boost::shared_ptr< PacketQueue< Pkt6Ptr > > PacketQueue6Ptr
Defines pointer to the DHCPv6 queue interface used at the application level.
Definition packet_queue.h:136
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
packet_queue_mgr6.h
packet_queue_ring.h