} // namespace isc
// static array with factories for options
-std::map<unsigned short, Option::Factory*> LibDHCP::v4factories_;
+map<unsigned short, Option::Factory*> LibDHCP::v4factories_;
// static array with factories for options
-std::map<unsigned short, Option::Factory*> LibDHCP::v6factories_;
+map<unsigned short, Option::Factory*> LibDHCP::v6factories_;
// Static container with option definitions grouped by option space.
OptionDefContainers LibDHCP::option_defs_;
bool LibDHCP::initialized_ = LibDHCP::initOptionDefs();
const OptionDefContainerPtr
-LibDHCP::getOptionDefs(const std::string& space) {
+LibDHCP::getOptionDefs(const string& space) {
auto const& container = option_defs_.find(space);
if (container != option_defs_.end()) {
return (container->second);
}
OptionDefinitionPtr
-LibDHCP::getOptionDef(const std::string& space, const uint16_t code) {
+LibDHCP::getOptionDef(const string& space, const uint16_t code) {
const OptionDefContainerPtr& defs = getOptionDefs(space);
const OptionDefContainerTypeIndex& idx = defs->get<1>();
const OptionDefContainerTypeRange& range = idx.equal_range(code);
}
OptionDefinitionPtr
-LibDHCP::getOptionDef(const std::string& space, const std::string& name) {
+LibDHCP::getOptionDef(const string& space, const string& name) {
const OptionDefContainerPtr& defs = getOptionDefs(space);
const OptionDefContainerNameIndex& idx = defs->get<2>();
const OptionDefContainerNameRange& range = idx.equal_range(name);
OptionDefinitionPtr
LibDHCP::getVendorOptionDef(const Option::Universe u, const uint32_t vendor_id,
- const std::string& name) {
+ const string& name) {
const OptionDefContainerPtr& defs = getVendorOptionDefs(u, vendor_id);
if (!defs) {
}
OptionDefinitionPtr
-LibDHCP::getRuntimeOptionDef(const std::string& space, const uint16_t code) {
+LibDHCP::getRuntimeOptionDef(const string& space, const uint16_t code) {
OptionDefContainerPtr container = runtime_option_defs_.getValue().getItems(space);
const OptionDefContainerTypeIndex& index = container->get<1>();
const OptionDefContainerTypeRange& range = index.equal_range(code);
}
OptionDefinitionPtr
-LibDHCP::getRuntimeOptionDef(const std::string& space, const std::string& name) {
+LibDHCP::getRuntimeOptionDef(const string& space, const string& name) {
OptionDefContainerPtr container = runtime_option_defs_.getValue().getItems(space);
const OptionDefContainerNameIndex& index = container->get<2>();
const OptionDefContainerNameRange& range = index.equal_range(name);
}
OptionDefContainerPtr
-LibDHCP::getRuntimeOptionDefs(const std::string& space) {
+LibDHCP::getRuntimeOptionDefs(const string& space) {
return (runtime_option_defs_.getValue().getItems(space));
}
void
LibDHCP::setRuntimeOptionDefs(const OptionDefSpaceContainer& defs) {
OptionDefSpaceContainer defs_copy;
- std::list<std::string> option_space_names = defs.getOptionSpaceNames();
+ list<string> option_space_names = defs.getOptionSpaceNames();
for (auto const& name : option_space_names) {
OptionDefContainerPtr container = defs.getItems(name);
for (auto const& def : *container) {
}
OptionDefinitionPtr
-LibDHCP::getLastResortOptionDef(const std::string& space, const uint16_t code) {
+LibDHCP::getLastResortOptionDef(const string& space, const uint16_t code) {
OptionDefContainerPtr container = getLastResortOptionDefs(space);
const OptionDefContainerTypeIndex& index = container->get<1>();
const OptionDefContainerTypeRange& range = index.equal_range(code);
}
OptionDefinitionPtr
-LibDHCP::getLastResortOptionDef(const std::string& space, const std::string& name) {
+LibDHCP::getLastResortOptionDef(const string& space, const string& name) {
OptionDefContainerPtr container = getLastResortOptionDefs(space);
const OptionDefContainerNameIndex& index = container->get<2>();
const OptionDefContainerNameRange& range = index.equal_range(name);
}
OptionDefContainerPtr
-LibDHCP::getLastResortOptionDefs(const std::string& space) {
+LibDHCP::getLastResortOptionDefs(const string& space) {
if (space == DHCP4_OPTION_SPACE) {
return getOptionDefs(LAST_RESORT_V4_OPTION_SPACE);
}
}
bool
-LibDHCP::shouldDeferOptionUnpack(const std::string& space, const uint16_t code) {
+LibDHCP::shouldDeferOptionUnpack(const string& space, const uint16_t code) {
return ((space == DHCP4_OPTION_SPACE) &&
((code == DHO_VENDOR_ENCAPSULATED_OPTIONS) ||
((code >= 224) && (code <= 254))));
}
size_t
-LibDHCP::unpackOptions6(const OptionBuffer& buf,
- const std::string& option_space,
- isc::dhcp::OptionCollection& options,
+LibDHCP::unpackOptions6(const OptionBuffer& buf, const string& option_space,
+ OptionCollection& options,
size_t* relay_msg_offset /* = 0 */,
size_t* relay_msg_len /* = 0 */) {
size_t offset = 0;
}
// Parse the option header
- uint16_t opt_type = isc::util::readUint16(&buf[offset], 2);
+ uint16_t opt_type = readUint16(&buf[offset], 2);
offset += 2;
- uint16_t opt_len = isc::util::readUint16(&buf[offset], 2);
+ uint16_t opt_len = readUint16(&buf[offset], 2);
offset += 2;
if (offset + opt_len > length) {
}
size_t
-LibDHCP::unpackOptions4(const OptionBuffer& buf,
- const std::string& option_space,
- isc::dhcp::OptionCollection& options,
- std::list<uint16_t>& deferred,
+LibDHCP::unpackOptions4(const OptionBuffer& buf, const string& option_space,
+ OptionCollection& options, list<uint16_t>& deferred,
bool check) {
size_t offset = 0;
size_t last_offset = 0;
}
void
-LibDHCP::extendVendorOptions4(isc::dhcp::OptionCollection& options) {
+LibDHCP::extendVendorOptions4(OptionCollection& options) {
map<uint32_t, OptionCollection> vendors_data;
auto const& it = options.find(DHO_VIVSO_SUBOPTIONS);
// After calling fuseOptions4 there should be at most one option of
"Truncated vendor-specific information option"
<< ", length=" << size);
}
- uint32_t vendor_id = isc::util::readUint32(&(*begin) + offset, data.size());
+ uint32_t vendor_id = readUint32(&data[offset], data.size());
offset += 4;
const OptionBuffer vendor_buffer(begin + offset, data.end());
try {
- offset += LibDHCP::unpackVendorOptions4(vendor_id, vendor_buffer, vendors_data[vendor_id]);
+ offset += LibDHCP::unpackVendorOptions4(vendor_id, vendor_buffer,
+ vendors_data[vendor_id]);
} catch (const SkipThisOptionError&) {
// Ignore this kind of error and continue.
} catch (const Exception&) {
}
size_t
-LibDHCP::unpackVendorOptions6(const uint32_t vendor_id,
- const OptionBuffer& buf,
- isc::dhcp::OptionCollection& options) {
+LibDHCP::unpackVendorOptions6(const uint32_t vendor_id, const OptionBuffer& buf,
+ OptionCollection& options) {
size_t offset = 0;
size_t length = buf.size();
"Vendor option parse failed: truncated header");
}
- uint16_t opt_type = isc::util::readUint16(&buf[offset], 2);
+ uint16_t opt_type = readUint16(&buf[offset], 2);
offset += 2;
- uint16_t opt_len = isc::util::readUint16(&buf[offset], 2);
+ uint16_t opt_len = readUint16(&buf[offset], 2);
offset += 2;
if (offset + opt_len > length) {
size_t
LibDHCP::unpackVendorOptions4(const uint32_t vendor_id, const OptionBuffer& buf,
- isc::dhcp::OptionCollection& options) {
+ OptionCollection& options) {
size_t offset = 0;
// Get the list of standard option definitions.
}
void
-LibDHCP::packOptions4(isc::util::OutputBuffer& buf,
- const OptionCollection& options,
+LibDHCP::packOptions4(OutputBuffer& buf, const OptionCollection& options,
bool top, bool check) {
OptionCollection agent;
OptionPtr end;
}
void
-LibDHCP::packOptions6(isc::util::OutputBuffer& buf,
- const OptionCollection& options) {
+LibDHCP::packOptions6(OutputBuffer& buf, const OptionCollection& options) {
for (auto const& option : options) {
option.second->pack(buf);
}
}
void
-LibDHCP::OptionFactoryRegister(Option::Universe u,
- uint16_t opt_type,
+LibDHCP::OptionFactoryRegister(Option::Universe u, uint16_t opt_type,
Option::Factory* factory) {
switch (u) {
case Option::V6:
bool
LibDHCP::initOptionDefs() {
for (uint32_t i = 0; OPTION_DEF_PARAMS[i].optionDefParams; ++i) {
- std::string space = OPTION_DEF_PARAMS[i].space;
+ string space = OPTION_DEF_PARAMS[i].space;
option_defs_[space] = OptionDefContainerPtr(new OptionDefContainer);
initOptionSpace(option_defs_[space],
OPTION_DEF_PARAMS[i].optionDefParams,
}
uint32_t
-LibDHCP::optionSpaceToVendorId(const std::string& option_space) {
+LibDHCP::optionSpaceToVendorId(const string& option_space) {
// 8 is a minimal length of "vendor-X" format
if ((option_space.size() < 8) || (option_space.substr(0,7) != "vendor-")) {
return (0);
int64_t check;
try {
// text after "vendor-", supposedly numbers only
- std::string x = option_space.substr(7);
+ string x = option_space.substr(7);
check = boost::lexical_cast<int64_t>(x);
} catch (const boost::bad_lexical_cast &) {
}
void
-initOptionSpace(OptionDefContainerPtr& defs,
- const OptionDefParams* params,
+initOptionSpace(OptionDefContainerPtr& defs, const OptionDefParams* params,
size_t params_size) {
// Container holding vendor options is typically not initialized, as it
// is held in map of null pointers. We need to initialize here in this
}
for (size_t i = 0; i < params_size; ++i) {
- std::string encapsulates(params[i].encapsulates);
+ string encapsulates(params[i].encapsulates);
if (!encapsulates.empty() && params[i].array) {
isc_throw(isc::BadValue, "invalid standard option definition: "
<< "option with code '" << params[i].code