27#include <boost/foreach.hpp> 
   28#include <boost/lexical_cast.hpp> 
   29#include <boost/shared_array.hpp> 
   30#include <boost/shared_ptr.hpp> 
   34#include <unordered_map> 
   50    { STANDARD_V4_OPTION_DEFINITIONS,       STANDARD_V4_OPTION_DEFINITIONS_SIZE,     
DHCP4_OPTION_SPACE           },
 
   51    { STANDARD_V6_OPTION_DEFINITIONS,       STANDARD_V6_OPTION_DEFINITIONS_SIZE,     
DHCP6_OPTION_SPACE           },
 
   61    { CABLELABS_CLIENT_CONF_DEFINITIONS,    CABLELABS_CLIENT_CONF_DEFINITIONS_SIZE,
 
   74map<unsigned short, Option::Factory*> LibDHCP::v4factories_;
 
   77map<unsigned short, Option::Factory*> LibDHCP::v6factories_;
 
  102bool LibDHCP::initialized_ = LibDHCP::initOptionDefs();
 
  106    auto const& container = option_defs_.find(space);
 
  107    if (container != option_defs_.end()) {
 
  108        return (container->second);
 
 
  123        } 
else if (ENTERPRISE_ID_ISC == vendor_id) {
 
 
  136    if (range.first != range.second) {
 
  137        return (*range.first);
 
 
  148    if (range.first != range.second) {
 
  149        return (*range.first);
 
 
  157                            const string& name) {
 
  166    if (range.first != range.second) {
 
  167        return (*range.first);
 
 
  175                            const uint16_t code) {
 
  187    if (range.first != range.second) {
 
  188        return (*range.first);
 
 
  199    if (range.first != range.second) {
 
  200        return (*range.first);
 
 
  211    if (range.first != range.second) {
 
  212        return (*range.first);
 
 
  220    return (runtime_option_defs_.getValue().getItems(space));
 
 
  227    for (
auto const& name : option_space_names) {
 
  229        for (
auto const& def : *container) {
 
  234    runtime_option_defs_ = defs_copy;
 
 
  239    runtime_option_defs_.reset();
 
 
  244    runtime_option_defs_.revert();
 
 
  249    runtime_option_defs_.commit();
 
 
  257    if (range.first != range.second) {
 
  258        return (*range.first);
 
 
  269    if (range.first != range.second) {
 
  270        return (*range.first);
 
 
  289             ((code >= 224) && (code <= 254))));
 
 
  296    FactoryMap::iterator it;
 
  298        it = v4factories_.find(type);
 
  299        if (it == v4factories_.end()) {
 
  301            "for DHCP v4 option type " << type);
 
  304        it = v6factories_.find(type);
 
  305        if (it == v6factories_.end()) {
 
  307                      "for DHCPv6 option type " << type);
 
  311                  "Option::V4 or Option::V6");
 
  313    return (it->second(u, type, buf));
 
 
  319                        size_t* relay_msg_offset ,
 
  320                        size_t* relay_msg_len ) {
 
  322    size_t length = buf.size();
 
  323    size_t last_offset = 0;
 
  342    while (offset < length) {
 
  344        last_offset = offset;
 
  347        if (offset + 4 > length) {
 
  349            return (last_offset);
 
  353        uint16_t opt_type = 
readUint16(&buf[offset], 2);
 
  356        uint16_t opt_len = 
readUint16(&buf[offset], 2);
 
  359        if (offset + opt_len > length) {
 
  368            return (last_offset);
 
  371        if (opt_type == 
D6O_RELAY_MSG && relay_msg_offset && relay_msg_len) {
 
  373            *relay_msg_offset = offset;
 
  374            *relay_msg_len = opt_len;
 
  382            if (offset + 4 > length) {
 
  386                return (last_offset);
 
  391                                                  buf.begin() + offset + opt_len));
 
  392            options.insert(std::make_pair(opt_type, vendor_opt));
 
  409        range = idx.equal_range(opt_type);
 
  410        num_defs = std::distance(range.first, range.second);
 
  416            range = runtime_idx.equal_range(opt_type);
 
  417            num_defs = std::distance(range.first, range.second);
 
  424                      " definitions for option type " << opt_type <<
 
  425                      " returned. Currently it is not supported to initialize" 
  426                      " multiple option definitions for the same option code." 
  427                      " This will be supported once support for option spaces" 
  429        } 
else if (num_defs == 0) {
 
  436                                       buf.begin() + offset,
 
  437                                       buf.begin() + offset + opt_len));
 
  444                opt = def->optionFactory(
Option::V6, opt_type,
 
  445                                         buf.begin() + offset,
 
  446                                         buf.begin() + offset + opt_len);
 
  451            } 
catch (
const std::exception& ex) {
 
  453                                            << 
", opt_len " << 
static_cast<uint16_t
>(opt_len)
 
  454                                            << 
", error: " << ex.what());
 
  460            options.insert(std::make_pair(opt_type, opt));
 
  466    last_offset = offset;
 
  467    return (last_offset);
 
 
  475    size_t last_offset = 0;
 
  492    bool flex_pad = (check && (runtime_idx.count(
DHO_PAD) == 0));
 
  493    bool flex_end = (check && (runtime_idx.count(
DHO_END) == 0));
 
  499    vector<uint32_t> count(256, 0);
 
  500    while (offset < buf.size()) {
 
  502        uint8_t opt_type = buf[offset++];
 
  507        if ((opt_type == 
DHO_END) && (space_is_dhcp4 || flex_end)) {
 
  516        if ((opt_type == 
DHO_PAD) && (space_is_dhcp4 || flex_pad)) {
 
  520        if (offset + 1 > buf.size()) {
 
  525        uint8_t opt_len = buf[offset++];
 
  526        if (offset + opt_len > buf.size()) {
 
  532        if (space_is_dhcp4 && opt_len == 0 && opt_type == 
DHO_HOST_NAME) {
 
  539        count[opt_type] += 1;
 
  543    unordered_map<uint8_t, pair<OptionBuffer, uint32_t>> fused;
 
  547    while (offset < buf.size()) {
 
  549        last_offset = offset;
 
  552        uint8_t opt_type = buf[offset++];
 
  557        if ((opt_type == 
DHO_END) && (space_is_dhcp4 || flex_end)) {
 
  561            return (last_offset);
 
  568        if ((opt_type == 
DHO_PAD) && (space_is_dhcp4 || flex_pad)) {
 
  572        if (offset + 1 > buf.size()) {
 
  580            return (last_offset);
 
  583        uint8_t opt_len = buf[offset++];
 
  584        if (offset + opt_len > buf.size()) {
 
  589            return (last_offset);
 
  597        if (space_is_dhcp4 && opt_len == 0 && opt_type == 
DHO_HOST_NAME) {
 
  601        OptionBuffer obuf(buf.begin() + offset, buf.begin() + offset + opt_len);
 
  605        uint32_t opt_count = count[opt_type];
 
  608            previous.insert(previous.end(), obuf.begin(), obuf.end());
 
  609            uint32_t& already_seen = fused[opt_type].second;
 
  611            if (already_seen != opt_count) {
 
  631        range = idx.equal_range(opt_type);
 
  632        num_defs = std::distance(range.first, range.second);
 
  638            range = runtime_idx.equal_range(opt_type);
 
  639            num_defs = std::distance(range.first, range.second);
 
  647            for (
auto const& existing : deferred) {
 
  648                if (existing == opt_type) {
 
  654                deferred.push_back(opt_type);
 
  658        if (space_is_dhcp4 &&
 
  668                      " definitions for option type " <<
 
  669                      static_cast<int>(opt_type) <<
 
  670                      " returned. Currently it is not supported to initialize" 
  671                      " multiple option definitions for the same option code." 
  672                      " This will be supported once support for option spaces" 
  674        } 
else if (num_defs == 0) {
 
  682                opt = def->optionFactory(
Option::V4, opt_type, obuf);
 
  687            } 
catch (
const std::exception& ex) {
 
  689                                            << 
", opt_len: " << 
static_cast<uint16_t
>(opt_len)
 
  690                                            << 
", error: " << ex.what());
 
  696            options.insert(std::make_pair(opt_type, opt));
 
  699    last_offset = offset;
 
  700    return (last_offset);
 
 
  709    typedef vector<OpaqueDataTuple> TuplesCollection;
 
  710    map<uint32_t, TuplesCollection> vendors_tuples;
 
  712    BOOST_FOREACH(
auto const& it, range) {
 
  714        auto const& 
data = it.second->getData();
 
  716        while ((size = 
data.size() - offset) != 0) {
 
  717            if (size < 
sizeof(uint32_t)) {
 
  720                          "Truncated vendor-class information option" 
  721                          << 
", length=" << size);
 
  729                vendors_tuples[vendor_id].push_back(tuple);
 
  730                offset += tuple.getTotalLength();
 
  734            } 
catch (
const isc::Exception&) {
 
  740    if (vendors_tuples.empty()) {
 
  746    for (
auto const& vendor : vendors_tuples) {
 
  747        if (vendor.second.empty()) {
 
  752        for (
size_t i = 0; i < vendor.second.size(); ++i) {
 
  754                vendor_opt->setTuple(0, vendor.second[0]);
 
  756                vendor_opt->addTuple(vendor.second[i]);
 
  769    map<uint32_t, OptionCollection> vendors_data;
 
  771    BOOST_FOREACH(
auto const& it, range) {
 
  773        auto const& data = it.second->getData();
 
  775        while ((size = data.size() - offset) != 0) {
 
  776            if (size < 
sizeof(uint32_t)) {
 
  779                          "Truncated vendor-specific information option" 
  780                          << 
", length=" << size);
 
  782            uint32_t vendor_id = 
readUint32(&data[offset], data.size());
 
  784            const OptionBuffer vendor_buffer(data.begin() + offset, data.end());
 
  787                                                        vendors_data[vendor_id]);
 
  791            } 
catch (
const isc::Exception&) {
 
  797    if (vendors_data.empty()) {
 
  803    for (
auto const& vendor : vendors_data) {
 
  805        for (
auto const& option : vendor.second) {
 
  806            vendor_opt->addOption(option.second);
 
  818    extendVivco(options);
 
  819    extendVivso(options);
 
 
  826    size_t length = buf.size();
 
  837        idx = &(option_defs->get<1>());
 
  842    while (offset < length) {
 
  843        if (offset + 4 > length) {
 
  845                      "Vendor option parse failed: truncated header");
 
  848        uint16_t opt_type = 
readUint16(&buf[offset], 2);
 
  851        uint16_t opt_len = 
readUint16(&buf[offset], 2);
 
  854        if (offset + opt_len > length) {
 
  856                      "Vendor option parse failed. Tried to parse " 
  857                      << offset + opt_len << 
" bytes from " << length
 
  858                      << 
"-byte long buffer.");
 
  872                idx->equal_range(opt_type);
 
  875            size_t num_defs = std::distance(range.first, range.second);
 
  881                          " definitions for option type " << opt_type <<
 
  882                          " returned. Currently it is not supported to" 
  883                          " initialize multiple option definitions for the" 
  884                          " same option code. This will be supported once" 
  885                          " support for option spaces is implemented");
 
  886            } 
else if (num_defs == 1) {
 
  891                opt = def->optionFactory(
Option::V6, opt_type,
 
  892                                         buf.begin() + offset,
 
  893                                         buf.begin() + offset + opt_len);
 
  904                                       buf.begin() + offset,
 
  905                                       buf.begin() + offset + opt_len));
 
  910            options.insert(std::make_pair(opt_type, opt));
 
 
  930        idx = &(option_defs->get<1>());
 
  935    while (offset < buf.size()) {
 
  939        uint8_t data_len = buf[offset++];
 
  941        if (offset + data_len > buf.size()) {
 
  944                      "Attempt to parse truncated vendor option");
 
  947        uint8_t offset_end = offset + data_len;
 
  950        while (offset < offset_end) {
 
  951            uint8_t opt_type = buf[offset++];
 
  955            if (offset + 1 > offset_end) {
 
  960                          "Attempt to parse truncated vendor option " 
  961                          << 
static_cast<int>(opt_type));
 
  964            uint8_t opt_len = buf[offset++];
 
  965            if (offset + opt_len > offset_end) {
 
  967                          "Option parse failed. Tried to parse " 
  968                          << offset + opt_len << 
" bytes from " << buf.size()
 
  969                          << 
"-byte long buffer.");
 
  982                    idx->equal_range(opt_type);
 
  985                size_t num_defs = std::distance(range.first, range.second);
 
  991                              " option definitions for option type " 
  992                              << opt_type << 
" returned. Currently it is" 
  993                              " not supported to initialize multiple option" 
  994                              " definitions for the same option code." 
  995                              " This will be supported once support for" 
  996                              " option spaces is implemented");
 
  997                } 
else if (num_defs == 1) {
 
 1002                    opt = def->optionFactory(
Option::V4, opt_type,
 
 1003                                             buf.begin() + offset,
 
 1004                                             buf.begin() + offset + opt_len);
 
 1010                                           buf.begin() + offset,
 
 1011                                           buf.begin() + offset + opt_len));
 
 1014            options.insert(std::make_pair(opt_type, opt));
 
 
 1026                      bool top, 
bool check) {
 
 1036        if (x != options.end()) {
 
 1037            x->second->pack(buf, check);
 
 1041    for (
auto const& option : options) {
 
 1043        switch (option.first) {
 
 1050                end = option.second;
 
 1053                option.second->pack(buf, check);
 
 1059    for (
auto const& option : 
agent) {
 
 1060        option.second->pack(buf, check);
 
 1065        end->pack(buf, check);
 
 
 1073    bool result = 
false;
 
 1079        if (tries == std::numeric_limits<uint16_t>::max()) {
 
 1081                     << tries << 
" times.");
 
 1088        for (
auto const& option : options) {
 
 1093            bool updated = 
false;
 
 1094            bool found_suboptions = 
false;
 
 1109            if (sub_options.size()) {
 
 1113                                                          used + candidate->getHeaderLen());
 
 1128                if (found_suboptions || candidate->len() > (255 - used)) {
 
 1131                    scoped_options.push_back(candidate_scoped_options);
 
 1134                    copy.erase(option.first);
 
 1144                    for (
auto const& sub_option : candidate->getMutableOptions()) {
 
 1146                                                             candidate->getType(),
 
 1148                        data_sub_option->addOption(sub_option.second);
 
 1149                        distinct_options.insert(make_pair(candidate->getType(), data_sub_option));
 
 1158                                             candidate->getType(),
 
 1160                                                          candidate->getData().end())));
 
 1162            data_option->pack(buf, 
false);
 
 1163            uint32_t header_len = candidate->getHeaderLen();
 
 1165            if (used >= 255 - header_len) {
 
 1167                         << candidate->getType() << 
" after parent already used " 
 1172            uint8_t len = 255 - header_len - used;
 
 1177            uint32_t size = buf.
getLength() - header_len;
 
 1195                    copy.erase(option.first);
 
 1198                uint32_t offset = 0;
 
 1201                for (; offset != size;) {
 
 1205                    if (size - offset < len) {
 
 1206                        len = size - offset;
 
 1213                                                    candidate->getType(),
 
 1215                                                                 data + offset + len)));
 
 1220                    copy.insert(make_pair(candidate->getType(), new_option));
 
 1222            } 
else if ((candidate->len() > (255 - used)) && size) {
 
 1227                copy.insert(make_pair(candidate->getType(), data_option));
 
 1232                copy.insert(distinct_options.begin(), distinct_options.end());
 
 
 1252    for (
auto const& option : options) {
 
 1253        option.second->pack(buf);
 
 
 1259    pair<OptionCollection::const_iterator, OptionCollection::const_iterator>
 
 1261    if (range.first == range.second) {
 
 1265    static_cast<void>(options.erase(range.first, range.second));
 
 1267    for (
auto const& opt : ntp_servers) {
 
 1268        for (
auto const& sub : opt.second->getOptions()) {
 
 1270            new_option->addOption(sub.second);
 
 
 1282        if (v6factories_.find(opt_type) != v6factories_.end()) {
 
 1284                     << 
"for option type " << opt_type);
 
 1286        v6factories_[opt_type] = factory;
 
 1293        if (opt_type == 0) {
 
 1299        if (opt_type > 254) {
 
 1302        if (v4factories_.find(opt_type) != v4factories_.end()) {
 
 1304                     << 
"for option type " << opt_type);
 
 1306        v4factories_[opt_type] = factory;
 
 
 1317LibDHCP::initOptionDefs() {
 
 1318    for (uint32_t i = 0; OPTION_DEF_PARAMS[i].optionDefParams; ++i) {
 
 1319        string space = OPTION_DEF_PARAMS[i].space;
 
 1322                        OPTION_DEF_PARAMS[i].optionDefParams,
 
 1323                        OPTION_DEF_PARAMS[i].size);
 
 1347    if ((option_space.size() < 8) || (option_space.substr(0,7) != 
"vendor-")) {
 
 1354        string x = option_space.substr(7);
 
 1356        check = boost::lexical_cast<int64_t>(x);
 
 1357    } 
catch (
const boost::bad_lexical_cast &) {
 
 1361    if ((check < 0) || (check > std::numeric_limits<uint32_t>::max())) {
 
 1366    return (
static_cast<uint32_t
>(check));
 
 
 1371                size_t params_size) {
 
 1381    for (
size_t i = 0; i < params_size; ++i) {
 
 1382        string encapsulates(params[i].encapsulates);
 
 1383        if (!encapsulates.empty() && params[i].
array) {
 
 1385                      << 
"option with code '" << params[i].code
 
 1386                      << 
"' may not encapsulate option space '" 
 1387                      << encapsulates << 
"' because the definition" 
 1388                      << 
" indicates that this option comprises an array" 
 1396        if (encapsulates.empty()) {
 
 1409                                                  params[i].encapsulates));
 
 1413        for (
size_t rec = 0; rec < params[i].
records_size; ++rec) {
 
 1414            definition->addRecordField(params[i].records[rec]);
 
 1418            definition->validate();
 
 1430        static_cast<void>(defs->push_back(definition));
 
 
 1438    static bool check_once(
true);
 
 
 1456    static bool check_once(
true);
 
 
 1474    static bool check_once(
true);
 
 
 1492    static bool check_once(
true);
 
 
 1510    static bool check_once(
true);
 
 
 1528    static bool check_once(
true);
 
 
 1546    static bool check_once(
true);
 
 
 1564    static bool check_once(
true);
 
 
 1582    static bool check_once(
true);
 
 
 1600    static bool check_once(
true);
 
 
 1618    static bool check_once(
true);
 
 
 1636    static bool check_once(
true);
 
 
 1654    static bool check_once(
true);
 
 
 1672    static bool check_once(
true);
 
 
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
This is a base class for exceptions thrown from the DNS library module.
A generic exception that is thrown when an unexpected error condition occurs.
static size_t unpackOptions4(const OptionBuffer &buf, const std::string &option_space, isc::dhcp::OptionCollection &options, std::list< uint16_t > &deferred, bool flexible_pad_end=false)
Parses provided buffer as DHCPv4 options and creates Option objects.
static void OptionFactoryRegister(Option::Universe u, uint16_t type, Option::Factory *factory)
Registers factory method that produces options of specific option types.
static const OptionDefinition & D6O_LQ_RELAY_DATA_DEF()
Get definition of D6O_LQ_RELAY_DATA option.
static const OptionDefinition & D6O_NTP_SERVER_DEF()
Get definition of D6O_NTP_SERVER option.
static const OptionDefinition & D6O_RSOO_DEF()
Get definition of D6O_RSOO option.
static size_t unpackVendorOptions6(const uint32_t vendor_id, const OptionBuffer &buf, isc::dhcp::OptionCollection &options)
Parses provided buffer as DHCPv6 vendor options and creates Option objects.
static const OptionDefContainerPtr getOptionDefs(const std::string &space)
Returns collection of option definitions.
static void splitNtpServerOptions6(isc::dhcp::OptionCollection &options)
Split NTP server option to one suboption per instance.
static bool shouldDeferOptionUnpack(const std::string &space, const uint16_t code)
Checks if an option unpacking has to be deferred.
static isc::dhcp::OptionPtr optionFactory(isc::dhcp::Option::Universe u, uint16_t type, const OptionBuffer &buf)
Factory function to create instance of option.
static void setRuntimeOptionDefs(const OptionDefSpaceContainer &defs)
Copies option definitions created at runtime.
static OptionDefinitionPtr getOptionDef(const std::string &space, const uint16_t code)
Return the first option definition matching a particular option code.
static OptionDefinitionPtr getVendorOptionDef(const Option::Universe u, const uint32_t vendor_id, const uint16_t code)
Returns vendor option definition for a given vendor-id and code.
static OptionDefContainerPtr getLastResortOptionDefs(const std::string &space)
Returns last resort option definitions for specified option space name.
static const OptionDefinition & D6O_LQ_QUERY_DEF()
Get definition of D6O_LQ_QUERY option.
static OptionDefContainerPtr getRuntimeOptionDefs(const std::string &space)
Returns runtime (non-standard) option definitions for specified option space name.
static void commitRuntimeOptionDefs()
Commits runtime option definitions.
static void clearRuntimeOptionDefs()
Removes runtime option definitions.
static const OptionDefinition & D6O_IAADDR_DEF()
Get definition of D6O_IAADDR option.
static void extendVendorOptions4(isc::dhcp::OptionCollection &options)
Extend vendor options from fused options in multiple OptionVendor or OptionVendorClass options and ad...
static const OptionDefinition & D6O_CLIENT_DATA_DEF()
Get definition of D6O_CLIENT_DATA option.
static void packOptions4(isc::util::OutputBuffer &buf, const isc::dhcp::OptionCollection &options, bool top=false, bool check=true)
Stores DHCPv4 options in a buffer.
static bool splitOptions4(isc::dhcp::OptionCollection &options, ScopedOptionsCopyContainer &scopedOptions, uint32_t used=0)
Split long options in multiple options with the same option code (RFC3396).
static const OptionDefinition & DHO_DHCP_REQUESTED_ADDRESS_DEF()
Get definition of DHO_DHCP_REQUESTED_ADDRESS option.
static const OptionDefinition & D6O_BOOTFILE_URL_DEF()
Get definition of D6O_BOOTFILE_URL option.
static const OptionDefinition & DHO_DHCP_SERVER_IDENTIFIER_DEF()
Get definition of DHO_DHCP_SERVER_IDENTIFIER option.
static const OptionDefinition & DHO_SUBNET_SELECTION_DEF()
Get definition of DHO_SUBNET_SELECTION option.
static void revertRuntimeOptionDefs()
Reverts uncommitted changes to runtime option definitions.
static const OptionDefinition & DHO_DOMAIN_SEARCH_DEF()
Get definition of DHO_DOMAIN_SEARCH option.
static const OptionDefContainerPtr getVendorOptionDefs(Option::Universe u, const uint32_t vendor_id)
Returns option definitions for given universe and vendor.
static const OptionDefinition & D6O_CLIENT_FQDN_DEF()
Get definition of D6O_CLIENT_FQDN option.
static const OptionDefinition & DHO_DHCP_AGENT_OPTIONS_DEF()
Get definition of DHO_DHCP_AGENT_OPTIONS option.
static uint32_t optionSpaceToVendorId(const std::string &option_space)
Converts option space name to vendor id.
static OptionDefinitionPtr getRuntimeOptionDef(const std::string &space, const uint16_t code)
Returns runtime (non-standard) option definition by space and option code.
static size_t unpackOptions6(const OptionBuffer &buf, const std::string &option_space, isc::dhcp::OptionCollection &options, size_t *relay_msg_offset=0, size_t *relay_msg_len=0)
Parses provided buffer as DHCPv6 options and creates Option objects.
static void packOptions6(isc::util::OutputBuffer &buf, const isc::dhcp::OptionCollection &options)
Stores DHCPv6 options in a buffer.
static const OptionDefinition & DHO_STATUS_CODE_DEF()
Get definition of DHO_STATUS_CODE option.
static OptionDefinitionPtr getLastResortOptionDef(const std::string &space, const uint16_t code)
Returns last resort option definition by space and option code.
static size_t unpackVendorOptions4(const uint32_t vendor_id, const OptionBuffer &buf, isc::dhcp::OptionCollection &options)
Parses provided buffer as DHCPv4 vendor options and creates Option objects.
Exception to be thrown when the operation on OpaqueDataTuple object results in an error.
Represents a single instance of the opaque data preceded by length.
Option with defined data fields represented as buffers that can be accessed using data field index.
Class of option definition space container.
void addItem(const OptionDefinitionPtr &def)
Adds a new option definition to the container.
Base class representing a DHCP option definition.
Wrapper exception thrown by unpackOptionsX functions to add option type and len to the underlying err...
std::list< Selector > getOptionSpaceNames() const
Get a list of existing option spaces.
ItemsContainerPtr getItems(const Selector &option_space) const
Get all items for the particular option space.
This class encapsulates DHCPv6 Vendor Class and DHCPv4 V-I Vendor Class options.
This class represents vendor-specific information option.
Universe
defines option universe DHCPv4 or DHCPv6
OptionPtr Factory(Option::Universe u, uint16_t type, const OptionBuffer &buf)
a factory function prototype
RAII object enabling duplication of the stored options and restoring the original options on destruct...
Exception thrown during option unpacking This exception is thrown when an error has occurred,...
Exception thrown during option unpacking This exception is thrown when an error has occurred unpackin...
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
const uint8_t * getData() const
Return a pointer to the head of the data stored in the buffer.
size_t getLength() const
Return the length of data written in the buffer.
This class implements set/commit mechanism for a single object.
#define DOCSIS3_V6_OPTION_SPACE
#define VENDOR_ID_CABLE_LABS
#define DOCSIS3_V4_OPTION_SPACE
global docsis3 option spaces
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define isc_throw_assert(expr)
Replacement for assert() that throws if the expression is false.
void initOptionSpace(OptionDefContainerPtr &defs, const OptionDefParams *params, size_t params_size)
const OptionDefContainerPtr null_option_def_container_(new OptionDefContainer())
ElementPtr copy(ConstElementPtr from, int level)
Copy the data up to a nesting level.
boost::shared_ptr< OptionVendor > OptionVendorPtr
Pointer to a vendor option.
@ DHO_DHCP_SERVER_IDENTIFIER
@ DHO_DHCP_REQUESTED_ADDRESS
@ DHO_VENDOR_ENCAPSULATED_OPTIONS
std::multimap< unsigned int, OptionPtr > OptionCollection
A collection of DHCP (v4 or v6) options.
const OptionDefParams DOCSIS3_V4_OPTION_DEFINITIONS[]
Definitions of standard DHCPv4 options.
const char * DOCSIS3_CLASS_EROUTER
The class as specified in vendor-class option by the devices.
boost::shared_ptr< OptionDefinition > OptionDefinitionPtr
Pointer to option definition object.
const int DOCSIS3_V6_OPTION_DEFINITIONS_SIZE
Number of option definitions defined.
std::pair< OptionDefContainerNameIndex::const_iterator, OptionDefContainerNameIndex::const_iterator > OptionDefContainerNameRange
Pair of iterators to represent the range of options definitions having the same option name.
const char * DOCSIS3_CLASS_MODEM
DOCSIS3.0 compatible cable modem.
boost::shared_ptr< OptionVendorClass > OptionVendorClassPtr
Defines a pointer to the OptionVendorClass.
std::map< std::string, OptionDefContainerPtr > OptionDefContainers
Container that holds option definitions for various option spaces.
std::shared_ptr< ScopedSubOptionsCopy > ScopedOptionsCopyPtr
A pointer to a ScopedSubOptionsCopy object.
OptionDefContainer::nth_index< 2 >::type OptionDefContainerNameIndex
Type of the index #2 - option name.
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
std::pair< OptionDefContainerTypeIndex::const_iterator, OptionDefContainerTypeIndex::const_iterator > OptionDefContainerTypeRange
Pair of iterators to represent the range of options definitions having the same option type value.
boost::multi_index_container< OptionDefinitionPtr, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_non_unique< boost::multi_index::const_mem_fun< OptionDefinition, uint16_t, &OptionDefinition::getCode > >, boost::multi_index::hashed_non_unique< boost::multi_index::const_mem_fun< OptionDefinition, std::string, &OptionDefinition::getName > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< data::BaseStampedElement, boost::posix_time::ptime, &data::StampedElement::getModificationTime > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< OptionIdIndexTag >, boost::multi_index::const_mem_fun< data::BaseStampedElement, uint64_t, &data::BaseStampedElement::getId > > > > OptionDefContainer
Multi index container for DHCP option definitions.
const int DOCSIS3_V4_OPTION_DEFINITIONS_SIZE
Number of option definitions defined.
OptionDefContainer::nth_index< 1 >::type OptionDefContainerTypeIndex
Type of the index #1 - option type.
boost::shared_ptr< Option > OptionPtr
std::vector< ScopedOptionsCopyPtr > ScopedOptionsCopyContainer
A container of ScopedOptionsCopyPtr objects.
const OptionDefParams DOCSIS3_V6_OPTION_DEFINITIONS[]
Definitions of standard DHCPv6 options.
boost::shared_ptr< OptionDefContainer > OptionDefContainerPtr
Pointer to an option definition container.
uint16_t readUint16(void const *const buffer, size_t const length)
uint16_t wrapper over readUint.
uint32_t readUint32(void const *const buffer, size_t const length)
uint32_t wrapper over readUint.
Defines the logger used by the top-level component of kea-lfc.
#define V4V6_BIND_OPTION_SPACE
#define LAST_RESORT_V4_OPTION_SPACE
#define DHCP4_OPTION_SPACE
global std option spaces
#define ISC_V6_OPTION_SPACE
#define V6_NTP_SERVER_SPACE
#define V4V6_RULE_OPTION_SPACE
#define MAPE_V6_OPTION_SPACE
#define DHCP_AGENT_OPTION_SPACE
encapsulated option spaces
#define LW_V6_OPTION_SPACE
#define DHCP6_OPTION_SPACE
#define MAPT_V6_OPTION_SPACE
#define CABLELABS_CLIENT_CONF_SPACE
Encapsulation of option definition parameters and the structure size.
Parameters being used to make up an option definition.