From f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:15:43 +0200 Subject: Adding upstream version 2.4.1. Signed-off-by: Daniel Baumann --- src/lib/dhcp/option.cc | 389 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 389 insertions(+) create mode 100644 src/lib/dhcp/option.cc (limited to 'src/lib/dhcp/option.cc') diff --git a/src/lib/dhcp/option.cc b/src/lib/dhcp/option.cc new file mode 100644 index 0000000..95353ef --- /dev/null +++ b/src/lib/dhcp/option.cc @@ -0,0 +1,389 @@ +// Copyright (C) 2011-2023 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 +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + +using namespace std; +using namespace isc::util; + +namespace isc { +namespace dhcp { + +OptionPtr +Option::factory(Option::Universe u, + uint16_t type, + const OptionBuffer& buf) { + return (LibDHCP::optionFactory(u, type, buf)); +} + +Option::Option(Universe u, uint16_t type) + : universe_(u), type_(type) { + check(); +} + +Option::Option(Universe u, uint16_t type, const OptionBuffer& data) + : universe_(u), type_(type), data_(data) { + check(); +} + +Option::Option(Universe u, uint16_t type, OptionBufferConstIter first, + OptionBufferConstIter last) + : universe_(u), type_(type), data_(first, last) { + check(); +} + +Option::Option(const Option& option) + : universe_(option.universe_), type_(option.type_), + data_(option.data_), options_(), + encapsulated_space_(option.encapsulated_space_) { + option.getOptionsCopy(options_); +} + +OptionPtr +Option::create(Universe u, uint16_t type) { + return (boost::make_shared