// Copyright (C) 2011-2016 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 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) { // END option (type 255 is forbidden as well) if ((u == V4) && ((type == 0) || (type > 254))) { isc_throw(BadValue, "Can't create V4 option of type " << type << ", V4 options are in range 1..254"); } } 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_); } Option& Option::operator=(const Option& rhs) { if (&rhs != this) { universe_ = rhs.universe_; type_ = rhs.type_; data_ = rhs.data_; rhs.getOptionsCopy(options_); encapsulated_space_ = rhs.encapsulated_space_; } return (*this); } OptionPtr Option::clone() const { return (cloneInternal