![]() |
Kea
1.5.0
|
#include <libdhcp++.h>
Public Types | |
| typedef std::map< unsigned short, Option::Factory * > | FactoryMap |
| Map of factory functions. More... | |
Static Public Member Functions | |
| static void | clearRuntimeOptionDefs () |
| Removes runtime option definitions. More... | |
| static void | commitRuntimeOptionDefs () |
| Commits runtime option definitions. More... | |
| static OptionDefinitionPtr | getLastResortOptionDef (const std::string &space, const std::string &name) |
| Returns last resort option definition by space and option name. More... | |
| static OptionDefinitionPtr | getLastResortOptionDef (const std::string &space, const uint16_t code) |
| Returns last resort option definition by space and option code. More... | |
| static OptionDefContainerPtr | getLastResortOptionDefs (const std::string &space) |
| Returns last resort option definitions for specified option space name. More... | |
| static OptionDefinitionPtr | getOptionDef (const std::string &space, const std::string &name) |
| Return the definition of option having a specified name. More... | |
| static OptionDefinitionPtr | getOptionDef (const std::string &space, const uint16_t code) |
| Return the first option definition matching a particular option code. More... | |
| static const OptionDefContainerPtr & | getOptionDefs (const std::string &space) |
| Returns collection of option definitions. More... | |
| static OptionDefinitionPtr | getRuntimeOptionDef (const std::string &space, const std::string &name) |
| Returns runtime (non-standard) option definition by space and option name. More... | |
| static OptionDefinitionPtr | getRuntimeOptionDef (const std::string &space, const uint16_t code) |
| Returns runtime (non-standard) option definition by space and option code. More... | |
| static OptionDefContainerPtr | getRuntimeOptionDefs (const std::string &space) |
| Returns runtime (non-standard) option definitions for specified option space name. More... | |
| static const OptionDefContainerPtr & | getVendorOption4Defs (const uint32_t vendor_id) |
| Returns v4 option definitions for a given vendor. More... | |
| static const OptionDefContainerPtr & | getVendorOption6Defs (const uint32_t vendor_id) |
| Returns v6 option definitions for a given vendor. More... | |
| static OptionDefinitionPtr | getVendorOptionDef (const Option::Universe u, const uint32_t vendor_id, const std::string &name) |
| Returns vendor option definition for a given vendor-id and option name. More... | |
| 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. More... | |
| static isc::dhcp::OptionPtr | optionFactory (isc::dhcp::Option::Universe u, uint16_t type, const OptionBuffer &buf) |
| Factory function to create instance of option. More... | |
| static void | OptionFactoryRegister (Option::Universe u, uint16_t type, Option::Factory *factory) |
| Registers factory method that produces options of specific option types. More... | |
| static uint32_t | optionSpaceToVendorId (const std::string &option_space) |
| Converts option space name to vendor id. More... | |
| static void | packOptions4 (isc::util::OutputBuffer &buf, const isc::dhcp::OptionCollection &options) |
| Stores DHCPv4 options in a buffer. More... | |
| static void | packOptions6 (isc::util::OutputBuffer &buf, const isc::dhcp::OptionCollection &options) |
| Stores DHCPv6 options in a buffer. More... | |
| static void | revertRuntimeOptionDefs () |
| Reverts uncommitted changes to runtime option definitions. More... | |
| static void | setRuntimeOptionDefs (const OptionDefSpaceContainer &defs) |
| Copies option definitions created at runtime. More... | |
| static bool | shouldDeferOptionUnpack (const std::string &space, const uint16_t code) |
| Checks if an option unpacking has to be deferred. More... | |
| static size_t | unpackOptions4 (const OptionBuffer &buf, const std::string &option_space, isc::dhcp::OptionCollection &options, std::list< uint16_t > &deferred) |
| Parses provided buffer as DHCPv4 options and creates Option objects. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
Definition at line 24 of file libdhcp++.h.
| typedef std::map<unsigned short, Option::Factory*> isc::dhcp::LibDHCP::FactoryMap |
Map of factory functions.
Definition at line 29 of file libdhcp++.h.
|
static |
Removes runtime option definitions.
Definition at line 250 of file libdhcp++.cc.
Referenced by isc::dhcp::bench::GenericHostDataSourceBenchmark::GenericHostDataSourceBenchmark(), and isc::dhcp::bench::GenericHostDataSourceBenchmark::~GenericHostDataSourceBenchmark().
|
static |
Commits runtime option definitions.
Definition at line 260 of file libdhcp++.cc.
|
static |
Returns last resort option definition by space and option name.
Definition at line 277 of file libdhcp++.cc.
|
static |
Returns last resort option definition by space and option code.
Definition at line 265 of file libdhcp++.cc.
Referenced by isc::dhcp::Dhcpv4Srv::deferredUnpack().
|
static |
Returns last resort option definitions for specified option space name.
| space | Option space name. |
Definition at line 289 of file libdhcp++.cc.
References DHCP4_OPTION_SPACE, and null_option_def_container_().
Here is the call graph for this function:
|
static |
Return the definition of option having a specified name.
| space | option space. |
| name | Option name. |
Definition at line 155 of file libdhcp++.cc.
|
static |
Return the first option definition matching a particular option code.
| space | option space. |
| code | option code. |
Definition at line 144 of file libdhcp++.cc.
Referenced by isc::dhcp::Dhcpv4Srv::deferredUnpack(), and isc::dhcp::CqlHostExchange::retrieveOption().
|
static |
Returns collection of option definitions.
This method returns a collection of option definitions for a specified option space.
| space | Option space. |
Definition at line 81 of file libdhcp++.cc.
References DHCP4_OPTION_SPACE, DHCP6_OPTION_SPACE, and null_option_def_container_().
Here is the call graph for this function:
|
static |
Returns runtime (non-standard) option definition by space and option name.
Definition at line 217 of file libdhcp++.cc.
|
static |
Returns runtime (non-standard) option definition by space and option code.
Definition at line 205 of file libdhcp++.cc.
Referenced by isc::dhcp::Dhcpv4Srv::deferredUnpack(), and isc::dhcp::CqlHostExchange::retrieveOption().
|
static |
Returns runtime (non-standard) option definitions for specified option space name.
| space | Option space name. |
Definition at line 229 of file libdhcp++.cc.
|
static |
Returns v4 option definitions for a given vendor.
| vendor_id | enterprise-id of a given vendor |
Definition at line 107 of file libdhcp++.cc.
References null_option_def_container_(), and VENDOR_ID_CABLE_LABS.
Here is the call graph for this function:
|
static |
Returns v6 option definitions for a given vendor.
| vendor_id | enterprise-id of a given vendor |
Definition at line 123 of file libdhcp++.cc.
References VENDOR_ID_CABLE_LABS.
|
static |
Returns vendor option definition for a given vendor-id and option name.
| u | Universe (V4 or V6) |
| vendor_id | Enterprise-id for a given vendor |
| name | Option name. |
Definition at line 166 of file libdhcp++.cc.
|
static |
Returns vendor option definition for a given vendor-id and code.
| u | universe (V4 or V6) |
| vendor_id | enterprise-id for a given vendor |
| code | option code |
Definition at line 184 of file libdhcp++.cc.
Referenced by isc::dhcp::CqlHostExchange::retrieveOption().
|
static |
Factory function to create instance of option.
Factory method creates instance of specified option. The option to be created has to have corresponding factory function registered with LibDHCP::OptionFactoryRegister.
| u | universe of the option (V4 or V6) |
| type | option-type |
| buf | option-buffer |
| isc::InvalidOperation | if there is no factory function registered for the specified option type. |
Definition at line 304 of file libdhcp++.cc.
References isc_throw.
|
static |
Registers factory method that produces options of specific option types.
| isc::BadValue | if provided the type is already registered, has too large a value or an invalid universe is specified. |
| u | universe of the option (V4 or V6) |
| type | option-type |
| factory | function pointer |
Definition at line 830 of file libdhcp++.cc.
References isc_throw.
|
static |
Converts option space name to vendor id.
If the option space name is specified in the following format: "vendor-X" where X is an uint32_t number, it is assumed to be a vendor space and the uint32_t number is returned by this function. If the option space name is invalid this method will return 0, which is not a valid vendor-id, to signal an error.
| option_space | Option space name. |
Definition at line 916 of file libdhcp++.cc.
Referenced by isc::dhcp::CqlHostExchange::retrieveOption().
|
static |
Stores DHCPv4 options in a buffer.
Stores all options defined in options containers in a on-wire format in output buffer specified by buf.
May throw different exceptions if option assembly fails. There may be different reasons (option too large, option malformed, too many options etc.)
This is v4 specific version, which stores Relay Agent Information option and END options last.
| buf | output buffer (assembled options will be stored here) |
| options | collection of options to store to |
Definition at line 789 of file libdhcp++.cc.
References isc::dhcp::DHO_DHCP_AGENT_OPTIONS, and isc::dhcp::DHO_END.
Referenced by isc::dhcp::Pkt4::pack(), and isc::dhcp::Option::packOptions().
|
static |
Stores DHCPv6 options in a buffer.
Stores all options defined in options containers in a on-wire format in output buffer specified by buf.
May throw different exceptions if option assembly fails. There may be different reasons (option too large, option malformed, too many options etc.)
Currently there's no special logic in it. Options are stored in the order of their option codes.
| buf | output buffer (assembled options will be stored here) |
| options | collection of options to store to |
Definition at line 822 of file libdhcp++.cc.
Referenced by isc::dhcp::Option::packOptions(), and isc::dhcp::Pkt6::packUDP().
|
static |
Reverts uncommitted changes to runtime option definitions.
Definition at line 255 of file libdhcp++.cc.
|
static |
Copies option definitions created at runtime.
Copied option definitions will be used as "runtime" option definitions. A typical use case is to set option definitions specified by the user in the server configuration. These option definitions should be removed or replaced with new option definitions upon reconfiguration.
| defs | Const reference to a container holding option definitions grouped by option spaces. |
Definition at line 234 of file libdhcp++.cc.
References isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::addItem(), isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::getItems(), and isc::dhcp::OptionSpaceContainer< ContainerType, ItemType, Selector >::getOptionSpaceNames().
Referenced by isc::dhcp::bench::GenericHostDataSourceBenchmark::addTestOptions().
Here is the call graph for this function:
|
static |
Checks if an option unpacking has to be deferred.
DHCPv4 option 43 and 224-254 unpacking is done after classification.
Definition at line 297 of file libdhcp++.cc.
References DHCP4_OPTION_SPACE, and isc::dhcp::DHO_VENDOR_ENCAPSULATED_OPTIONS.
|
static |
Parses provided buffer as DHCPv4 options and creates Option objects.
Parses provided buffer and stores created Option objects in options container.
| buf | Buffer to be parsed. |
| option_space | A name of the option space which holds definitions to be used to parse options in the packets. |
| options | Reference to option container. Options will be put here. |
| deferred | Reference to an option code list. Options which processing is deferred will be put here. |
The unpackOptions6 note applies too.
Definition at line 468 of file libdhcp++.cc.
References DHCP4_OPTION_SPACE, isc::dhcp::DHO_END, isc::dhcp::DHO_PAD, and isc_throw.
Referenced by isc::dhcp::Pkt4::unpack(), and isc::dhcp::Option::unpackOptions().
|
static |
Parses provided buffer as DHCPv6 options and creates Option objects.
Parses provided buffer and stores created Option objects in options container. The last two parameters are optional and are used in relay parsing. If they are specified, relay-msg option is not created, but rather those two parameters are specified to point out where the relay-msg option resides and what is its length. This is a performance optimization that avoids unnecessary copying of potentially large relay-msg option. It is not used for anything, except in the next iteration its content will be treated as buffer to be parsed.
| buf | Buffer to be parsed. |
| option_space | A name of the option space which holds definitions to be used to parse options in the packets. |
| options | Reference to option container. Options will be put here. |
| relay_msg_offset | reference to a size_t structure. If specified, offset to beginning of relay_msg option will be stored in it. |
| relay_msg_len | reference to a size_t structure. If specified, length of the relay_msg option will be stored in it. |
Definition at line 328 of file libdhcp++.cc.
References D6O_RELAY_MSG, D6O_VENDOR_OPTS, isc_throw, and isc::util::readUint16().
Referenced by isc::dhcp::Pkt6::unpackMsg(), isc::dhcp::Option::unpackOptions(), and isc::dhcp::Pkt6::unpackRelayMsg().
Here is the call graph for this function:
|
static |
Parses provided buffer as DHCPv4 vendor options and creates Option objects.
Parses provided buffer and stores created Option objects in options container.
| vendor_id | enterprise-id of the vendor |
| buf | Buffer to be parsed. |
| options | Reference to option container. Suboptions will be put here. |
The unpackVendorOptions6 note applies
Definition at line 684 of file libdhcp++.cc.
References isc_throw.
Referenced by isc::dhcp::OptionVendor::unpack().
|
static |
Parses provided buffer as DHCPv6 vendor options and creates Option objects.
Parses provided buffer and stores created Option objects in options container.
| vendor_id | enterprise-id of the vendor |
| buf | Buffer to be parsed. |
| options | Reference to option container. Suboptions will be put here. |
Definition at line 589 of file libdhcp++.cc.
References isc_throw, and isc::util::readUint16().
Referenced by isc::dhcp::OptionVendor::unpack().
Here is the call graph for this function: