packet_queue_mgr6.cc 1.22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// 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_mgr6.h>

#include <boost/scoped_ptr.hpp>

namespace isc {
namespace dhcp {

15
const std::string PacketQueueMgr6::DEFAULT_QUEUE_TYPE6 = "kea-ring6";
16

17
PacketQueueMgr6::PacketQueueMgr6() {
18
    // Register default queue factory
19
    registerPacketQueueFactory(DEFAULT_QUEUE_TYPE6, [](data::ConstElementPtr parameters)
20
                                          -> PacketQueue6Ptr {
21 22 23 24
            size_t capacity;
            try {
                capacity = data::SimpleParser::getInteger(parameters, "capacity");
            } catch (const std::exception& ex) {
25
                isc_throw(InvalidQueueParameter, DEFAULT_QUEUE_TYPE6 << " factory:"
26 27 28
                          " 'capacity' parameter is missing/invalid: " << ex.what());
            }

29
            PacketQueue6Ptr queue(new PacketQueueRing6(DEFAULT_QUEUE_TYPE6, capacity));
30 31 32 33 34 35
            return (queue);
        });
}

} // end of isc::dhcp namespace
} // end of isc namespace