Kea
1.9.9-git
|
#include <option.h>
Public Types | |
typedef OptionPtr | Factory(Option::Universe u, uint16_t type, const OptionBuffer &buf) |
a factory function prototype More... | |
enum | Universe { V4, V6 } |
defines option universe DHCPv4 or DHCPv6 More... | |
Public Member Functions | |
Option (Universe u, uint16_t type) | |
ctor, used for options constructed, usually during transmission More... | |
Option (Universe u, uint16_t type, const OptionBuffer &data) | |
Constructor, used for received options. More... | |
Option (Universe u, uint16_t type, OptionBufferConstIter first, OptionBufferConstIter last) | |
Constructor, used for received options. More... | |
Option (const Option &source) | |
Copy constructor. More... | |
virtual | ~Option () |
just to force that every option has virtual dtor More... | |
void | addOption (OptionPtr opt) |
Adds a sub-option. More... | |
virtual OptionPtr | clone () const |
Copies this option and returns a pointer to the copy. More... | |
bool | delOption (uint16_t type) |
Attempts to delete first suboption of requested type. More... | |
bool | equals (const OptionPtr &other) const |
Checks if options are equal. More... | |
virtual bool | equals (const Option &other) const |
Checks if two options are equal. More... | |
virtual const OptionBuffer & | getData () const |
Returns pointer to actual data. More... | |
std::string | getEncapsulatedSpace () const |
Returns the name of the option space encapsulated by this option. More... | |
virtual uint16_t | getHeaderLen () const |
Returns length of header (2 for v4, 4 for v6) More... | |
OptionPtr | getOption (uint16_t type) const |
Returns shared_ptr to suboption of specific type. More... | |
const OptionCollection & | getOptions () const |
Returns all encapsulated options. More... | |
void | getOptionsCopy (OptionCollection &options_copy) const |
Performs deep copy of suboptions. More... | |
uint16_t | getType () const |
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6) More... | |
uint16_t | getUint16 () const |
Returns content of first word. More... | |
uint32_t | getUint32 () const |
Returns content of first double word. More... | |
uint8_t | getUint8 () const |
Returns content of first byte. More... | |
Universe | getUniverse () const |
returns option universe (V4 or V6) More... | |
virtual uint16_t | len () const |
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header) More... | |
Option & | operator= (const Option &rhs) |
Assignment operator. More... | |
virtual void | pack (isc::util::OutputBuffer &buf) const |
Writes option in wire-format to a buffer. More... | |
template<typename InputIterator > | |
void | setData (InputIterator first, InputIterator last) |
Sets content of this option from buffer. More... | |
void | setEncapsulatedSpace (const std::string &encapsulated_space) |
Sets the name of the option space encapsulated by this option. More... | |
void | setUint16 (uint16_t value) |
Sets content of this option to a single uint16 value. More... | |
void | setUint32 (uint32_t value) |
Sets content of this option to a single uint32 value. More... | |
void | setUint8 (uint8_t value) |
Sets content of this option to a single uint8 value. More... | |
virtual std::vector< uint8_t > | toBinary (const bool include_header=false) const |
Returns binary representation of the option. More... | |
virtual std::string | toHexString (const bool include_header=false) const |
Returns string containing hexadecimal representation of option. More... | |
virtual std::string | toString () const |
Returns string representation of the value. More... | |
virtual std::string | toText (int indent=0) const |
Returns string representation of the option. More... | |
virtual void | unpack (OptionBufferConstIter begin, OptionBufferConstIter end) |
Parses received buffer. More... | |
virtual bool | valid () const |
returns if option is valid (e.g. More... | |
Static Public Member Functions | |
static OptionPtr | create (Universe u, uint16_t type) |
Factory function creating an instance of the Option . More... | |
static OptionPtr | create (Universe u, uint16_t type, const OptionBuffer &data) |
Factory function creating an instance of the Option . More... | |
static OptionPtr | factory (Option::Universe u, uint16_t type, const OptionBuffer &buf) |
Factory function to create instance of option. More... | |
static OptionPtr | factory (Option::Universe u, uint16_t type) |
Factory function to create instance of option. More... | |
Static Public Attributes | |
static bool | lenient_parsing_ |
Governs whether options should be parsed less strictly. More... | |
static const size_t | OPTION4_HDR_LEN = 2 |
length of the usual DHCPv4 option header (there are exceptions) More... | |
static const size_t | OPTION6_HDR_LEN = 4 |
length of any DHCPv6 option header More... | |
Protected Member Functions | |
void | check () const |
A protected method used for option correctness. More... | |
template<typename OptionType > | |
OptionPtr | cloneInternal () const |
Copies this option and returns a pointer to the copy. More... | |
std::string | headerToText (const int indent=0, const std::string &type_name="") const |
Returns option header in the textual format. More... | |
void | packHeader (isc::util::OutputBuffer &buf) const |
Store option's header in a buffer. More... | |
void | packOptions (isc::util::OutputBuffer &buf) const |
Store sub options in a buffer. More... | |
std::string | suboptionsToText (const int indent=0) const |
Returns collection of suboptions in the textual format. More... | |
void | unpackOptions (const OptionBuffer &buf) |
Builds a collection of sub options from the buffer. More... | |
Protected Attributes | |
OptionBuffer | data_ |
contains content of this data More... | |
std::string | encapsulated_space_ |
Name of the option space being encapsulated by this option. More... | |
OptionCollection | options_ |
collection for storing suboptions More... | |
uint16_t | type_ |
option type (0-255 for DHCPv4, 0-65535 for DHCPv6) More... | |
Universe | universe_ |
option universe (V4 or V6) More... | |
typedef OptionPtr isc::dhcp::Option::Factory(Option::Universe u, uint16_t type, const OptionBuffer &buf) |
a factory function prototype
u | option universe (DHCPv4 or DHCPv6) |
type | option type |
buf | pointer to a buffer |
isc::dhcp::Option::Option | ( | Universe | u, |
uint16_t | type | ||
) |
isc::dhcp::Option::Option | ( | Universe | u, |
uint16_t | type, | ||
const OptionBuffer & | data | ||
) |
Constructor, used for received options.
This constructor takes vector<uint8_t>& which is used in cases when content of the option will be copied and stored within option object. V4 Options follow that approach already.
u | specifies universe (V4 or V6) |
type | option type (0-255 for V4 and 0-65535 for V6) |
data | content of the option |
Definition at line 45 of file option.cc.
References check().
isc::dhcp::Option::Option | ( | Universe | u, |
uint16_t | type, | ||
OptionBufferConstIter | first, | ||
OptionBufferConstIter | last | ||
) |
Constructor, used for received options.
This constructor is similar to the previous one, but it does not take the whole vector<uint8_t>, but rather subset of it.
vector<int8_t> myData; Example usage: new Option(V4, 123, myData.begin()+1, myData.end()-1) This will create DHCPv4 option of type 123 that contains data from trimmed (first and last byte removed) myData vector.
u | specifies universe (V4 or V6) |
type | option type (0-255 for V4 and 0-65535 for V6) |
first | iterator to the first element that should be copied |
last | iterator to the next element after the last one to be copied. |
Definition at line 50 of file option.cc.
References check().
isc::dhcp::Option::Option | ( | const Option & | source | ) |
Copy constructor.
This constructor makes a deep copy of the option and all of the suboptions. It calls getOptionsCopy to deep copy suboptions.
source | Option to be copied. |
Definition at line 56 of file option.cc.
References getOptionsCopy(), and options_.
|
virtual |
void isc::dhcp::Option::addOption | ( | OptionPtr | opt | ) |
Adds a sub-option.
Some DHCPv6 options can have suboptions. This method allows adding options within options.
Note: option is passed by value. That is very convenient as it allows downcasting from any derived classes, e.g. shared_ptr<Option6_IA> type can be passed directly, without any casts. That would not be possible with passing by reference. addOption() is expected to be used in many places. Requiring casting is not feasible.
opt | shared pointer to a suboption that is going to be added. |
Definition at line 348 of file option.cc.
References getOption(), isc_throw, options_, universe_, and V4.
Referenced by isc::dhcp::Dhcpv6Srv::releaseIA_NA(), isc::dhcp::Dhcpv6Srv::releaseIA_PD(), and isc::dhcp::Dhcp4o6IpcBase::send().
|
protected |
A protected method used for option correctness.
It is used in constructors. In there are any problems detected (like specifying type > 255 for DHCPv4 option), it will throw BadValue or OutOfRange exceptions.
TODO Larger options can be stored as separate instances of DHCPv4 options. Clients MUST concatenate them. Fortunately, there are no such large options used today.
Definition at line 91 of file option.cc.
References data_, isc_throw, type_, universe_, V4, and V6.
Referenced by Option().
|
virtual |
Copies this option and returns a pointer to the copy.
This function must be overridden in the derived classes to make a copy of the derived type. The simplest way to do it is by calling cloneInternal function with an appropriate template parameter.
Reimplemented in isc::dhcp::Option4ClientFqdn, isc::dhcp::Option6ClientFqdn, isc::dhcp::Option4SlpServiceScope, isc::dhcp::OptionIntArray< T >, isc::dhcp::OptionInt< T >, isc::dhcp::OptionCustom, isc::dhcp::Option4AddrLst, isc::dhcp::Option6IAPrefix, isc::dhcp::OptionVendorClass, isc::dhcp::OptionOpaqueDataTuples, isc::dhcp::OptionString, isc::dhcp::OptionVendor, isc::dhcp::Option6PDExclude, isc::dhcp::Option6IAAddr, isc::dhcp::Option6AddrLst, isc::dhcp::Option6Auth, isc::dhcp::Option6IA, and isc::dhcp::Option6StatusCode.
|
inlineprotected |
Copies this option and returns a pointer to the copy.
The deep copy of the option is performed by calling copy constructor of the option of a given type. Derived classes call this method in the implementations of clone methods to create a copy of the option of their type.
OptionType | Type of the option of which a clone should be created. |
Definition at line 478 of file option.h.
Referenced by isc::dhcp::OptionInt< T >::clone(), and isc::dhcp::OptionIntArray< T >::clone().
Factory function creating an instance of the Option
.
This function should be used to create an instance of the DHCP option within a hooks library in cases when the library may be unloaded before the object is destroyed. This ensures that the ownership of the object by the Kea process is retained.
u | specifies universe (V4 or V6) |
type | option type (0-255 for V4 and 0-65535 for V6) |
Option
instance.
|
static |
Factory function creating an instance of the Option
.
This function should be used to create an instance of the DHCP option within a hooks library in cases when the library may be unloaded before the object is destroyed. This ensures that the ownership of the object by the Kea process is retained.
u | specifies universe (V4 or V6) |
type | option type (0-255 for V4 and 0-65535 for V6) |
data | content of the option |
Option
instance. bool isc::dhcp::Option::delOption | ( | uint16_t | type | ) |
bool isc::dhcp::Option::equals | ( | const OptionPtr & | other | ) | const |
Checks if options are equal.
This method calls a virtual equals
function to compare objects. This method is not meant to be overridden in the derived classes. Instead, the other equals
function must be overridden.
other | Pointer to the option to compare this option to. |
|
virtual |
Checks if two options are equal.
Equality verifies option type and option content. Care should be taken when using this method. Implementation for derived classes should be provided when this method is expected to be used. It is safe in general, as the first check (different types) will detect differences between base Option and derived objects.
other | Instance of the option to compare to. |
Definition at line 396 of file option.cc.
References getData(), and getType().
|
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 specified option type. |
Definition at line 33 of file option.cc.
Referenced by factory().
|
inlinestatic |
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. This method creates empty OptionBuffer object. Use this factory function if it is not needed to pass custom buffer.
u | universe of the option (V4 or V6) |
type | option-type |
isc::InvalidOperation | if there is no factory function registered for specified option type. |
Definition at line 130 of file option.h.
References factory().
|
inlinevirtual |
Returns pointer to actual data.
Definition at line 310 of file option.h.
References data_.
Referenced by equals(), isc::dhcp::OptionString::getValue(), isc::dhcp::OptionCustom::initialize(), isc::dhcp::OptionString::len(), isc::dhcp::OptionCustom::OptionCustom(), and isc::dhcp::OptionString::pack().
|
inline |
Returns the name of the option space encapsulated by this option.
Definition at line 423 of file option.h.
References encapsulated_space_.
Referenced by unpackOptions().
|
virtual |
Returns length of header (2 for v4, 4 for v6)
Definition at line 338 of file option.cc.
References OPTION4_HDR_LEN, OPTION6_HDR_LEN, universe_, V4, and V6.
Referenced by headerToText(), isc::dhcp::Option6StatusCode::len(), isc::dhcp::OptionString::len(), isc::dhcp::Option6PDExclude::len(), isc::dhcp::OptionVendor::len(), isc::dhcp::Option4AddrLst::len(), isc::dhcp::OptionOpaqueDataTuples::len(), isc::dhcp::OptionVendorClass::len(), isc::dhcp::Option4SlpServiceScope::len(), isc::dhcp::Option6ClientFqdn::len(), len(), isc::dhcp::Option4ClientFqdn::len(), isc::dhcp::OptionCustom::len(), isc::dhcp::Option6AddrLst::pack(), isc::dhcp::Option6IAAddr::pack(), isc::dhcp::Option6IAPrefix::pack(), isc::dhcp::Option4AddrLst::pack(), packHeader(), toBinary(), isc::dhcp::OptionOpaqueDataTuples::toText(), isc::dhcp::OptionVendorClass::toText(), isc::dhcp::OptionOpaqueDataTuples::unpack(), and isc::dhcp::OptionVendorClass::unpack().
OptionPtr isc::dhcp::Option::getOption | ( | uint16_t | type | ) | const |
Returns shared_ptr to suboption of specific type.
type | type of requested suboption |
Definition at line 211 of file option.cc.
References options_.
Referenced by addOption(), isc::ha::CommunicationState6::analyzeMessageInternal(), isc::dhcp::Pkt6::getMACFromDocsisCMTS(), isc::dhcp::Pkt6::getMACFromDocsisModem(), and isc::dhcp::CfgSubnets4::initSelector().
|
inline |
Returns all encapsulated options.
Definition at line 338 of file option.h.
References options_.
Referenced by isc::dhcp::Dhcpv6Srv::processConfirm().
void isc::dhcp::Option::getOptionsCopy | ( | OptionCollection & | options_copy | ) | const |
Performs deep copy of suboptions.
This method calls clone method to deep copy each option.
[out] | options_copy | Container where copied options are stored. |
Definition at line 221 of file option.cc.
References isc::data::copy(), and options_.
Referenced by operator=(), and Option().
|
inline |
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
Definition at line 288 of file option.h.
References type_.
Referenced by equals(), isc::perfdhcp::TestControl::processReceivedPacket6(), isc::dhcp::OptionString::setValue(), toBinary(), isc::dhcp::Option6IA::toText(), isc::dhcp::OptionOpaqueDataTuples::toText(), isc::dhcp::OptionVendorClass::toText(), isc::dhcp::OptionString::unpack(), isc::dhcp::OptionInt< T >::unpack(), isc::dhcp::OptionIntArray< T >::unpack(), and unpackOptions().
uint16_t isc::dhcp::Option::getUint16 | ( | ) | const |
Returns content of first word.
isc::OutOfRange | Thrown if the option has a length less than 2. |
Definition at line 367 of file option.cc.
References data_, and isc::util::readUint16().
uint32_t isc::dhcp::Option::getUint32 | ( | ) | const |
Returns content of first double word.
isc::OutOfRange | Thrown if the option has a length less than 4. |
Definition at line 372 of file option.cc.
References data_, and isc::util::readUint32().
uint8_t isc::dhcp::Option::getUint8 | ( | ) | const |
|
inline |
returns option universe (V4 or V6)
Definition at line 232 of file option.h.
References universe_.
Referenced by isc::dhcp::OptionCustom::addArrayDataField(), headerToText(), isc::dhcp::OptionVendorClass::len(), isc::dhcp::OptionInt< T >::len(), isc::dhcp::OptionIntArray< T >::len(), isc::dhcp::OptionVendorClass::pack(), isc::dhcp::OptionCustom::readTuple(), isc::dhcp::OptionVendor::toText(), isc::dhcp::OptionVendorClass::toText(), isc::dhcp::OptionVendorClass::unpack(), and isc::dhcp::OptionCustom::writeTuple().
|
protected |
Returns option header in the textual format.
This protected method should be called by the derived classes in their respective toText
implementations.
indent | Number of spaces to insert before the text. |
type_name | Option type name. If empty, the option name is omitted. |
Definition at line 304 of file option.cc.
References getHeaderLen(), getUniverse(), len(), type_, and V4.
Referenced by isc::dhcp::Option6AddrLst::toText(), isc::dhcp::Option6IA::toText(), isc::dhcp::Option6StatusCode::toText(), isc::dhcp::Option6IAAddr::toText(), isc::dhcp::Option6PDExclude::toText(), isc::dhcp::OptionVendor::toText(), isc::dhcp::Option4AddrLst::toText(), isc::dhcp::Option6IAPrefix::toText(), isc::dhcp::OptionString::toText(), isc::dhcp::Option4SlpServiceScope::toText(), isc::dhcp::OptionInt< T >::toText(), toText(), isc::dhcp::OptionIntArray< T >::toText(), and isc::dhcp::OptionCustom::toText().
|
virtual |
Returns length of the complete option (data length + DHCPv4/DHCPv6 option header)
Reimplemented in isc::dhcp::OptionCustom, isc::dhcp::Option4ClientFqdn, isc::dhcp::Option6ClientFqdn, isc::dhcp::OptionIntArray< T >, isc::dhcp::OptionInt< T >, isc::dhcp::Option4SlpServiceScope, isc::dhcp::OptionVendorClass, isc::dhcp::OptionOpaqueDataTuples, isc::dhcp::Option6IAPrefix, isc::dhcp::Option6IAAddr, isc::dhcp::Option4AddrLst, isc::dhcp::Option6IA, isc::dhcp::OptionVendor, isc::dhcp::Option6AddrLst, isc::dhcp::Option6PDExclude, isc::dhcp::OptionString, and isc::dhcp::Option6StatusCode.
Definition at line 181 of file option.cc.
References data_, getHeaderLen(), and options_.
Referenced by headerToText(), packHeader(), and toBinary().
Assignment operator.
The assignment operator performs a deep copy of the option and its suboptions. It calls getOptionsCopy to deep copy suboptions.
rhs | Option to be assigned. |
Definition at line 74 of file option.cc.
References data_, encapsulated_space_, getOptionsCopy(), options_, type_, and universe_.
Referenced by isc::dhcp::Option6ClientFqdn::operator=(), and isc::dhcp::Option4ClientFqdn::operator=().
|
virtual |
Writes option in wire-format to a buffer.
Writes option in wire-format to buffer, returns pointer to first unused byte after stored option (that is useful for writing options one after another).
buf | pointer to a buffer |
BadValue | Universe of the option is neither V4 nor V6. |
Reimplemented in isc::dhcp::OptionCustom, isc::dhcp::Option4ClientFqdn, isc::dhcp::Option6ClientFqdn, isc::dhcp::Option4SlpServiceScope, isc::dhcp::OptionIntArray< T >, isc::dhcp::OptionInt< T >, isc::dhcp::Option4AddrLst, isc::dhcp::OptionString, isc::dhcp::Option6IAPrefix, isc::dhcp::OptionVendorClass, isc::dhcp::OptionOpaqueDataTuples, isc::dhcp::Option6PDExclude, isc::dhcp::OptionVendor, isc::dhcp::Option6IAAddr, isc::dhcp::Option6AddrLst, isc::dhcp::Option6Auth, isc::dhcp::Option6IA, and isc::dhcp::Option6StatusCode.
Definition at line 114 of file option.cc.
References data_, packHeader(), packOptions(), and isc::util::OutputBuffer::writeData().
Referenced by toBinary().
|
protected |
Store option's header in a buffer.
This method writes option's header into a buffer in the on-wire format. The universe set for the particular option is used to determine whether option code and length are stored as 2-byte (for DHCPv6) or single-byte (for DHCPv4) values. For DHCPv4 options, this method checks if the length does not exceed 255 bytes and throws exception if it does. This method is used by derived classes to pack option's header into a buffer. This method should not be called directly by other classes.
[out] | buf | output buffer. |
TODO Larger options can be stored as separate instances of DHCPv4 options. Clients MUST concatenate them. Fortunately, there are no such large options used today.
Definition at line 126 of file option.cc.
References getHeaderLen(), isc_throw, len(), type_, universe_, V4, isc::util::OutputBuffer::writeUint16(), and isc::util::OutputBuffer::writeUint8().
Referenced by isc::dhcp::Option6StatusCode::pack(), isc::dhcp::OptionVendor::pack(), isc::dhcp::Option6PDExclude::pack(), isc::dhcp::OptionOpaqueDataTuples::pack(), isc::dhcp::OptionVendorClass::pack(), isc::dhcp::OptionString::pack(), isc::dhcp::OptionInt< T >::pack(), isc::dhcp::OptionIntArray< T >::pack(), isc::dhcp::Option4SlpServiceScope::pack(), isc::dhcp::Option6ClientFqdn::pack(), pack(), isc::dhcp::Option4ClientFqdn::pack(), and isc::dhcp::OptionCustom::pack().
|
protected |
Store sub options in a buffer.
This method stores all sub-options defined for a particular option in a on-wire format in output buffer provided. This function is called by pack function in this class or derived classes that override pack.
[out] | buf | output buffer. |
Definition at line 146 of file option.cc.
References isc_throw, options_, isc::dhcp::LibDHCP::packOptions4(), isc::dhcp::LibDHCP::packOptions6(), universe_, V4, and V6.
Referenced by isc::dhcp::Option6IA::pack(), isc::dhcp::Option6IAAddr::pack(), isc::dhcp::OptionVendor::pack(), isc::dhcp::Option6IAPrefix::pack(), isc::dhcp::OptionInt< T >::pack(), pack(), and isc::dhcp::OptionCustom::pack().
|
inline |
Sets content of this option from buffer.
Option will be resized to length of buffer.
first | iterator pointing to beginning of buffer to copy. |
last | iterator pointing to end of buffer to copy. |
InputIterator | type of the iterator representing the limits of the buffer to be assigned to a data_ buffer. |
Definition at line 408 of file option.h.
References data_.
Referenced by isc::dhcp::OptionCustom::initialize(), isc::dhcp::OptionString::setValue(), isc::dhcp::OptionString::unpack(), isc::dhcp::Option6ClientFqdn::unpack(), unpack(), and isc::dhcp::Option4ClientFqdn::unpack().
|
inline |
Sets the name of the option space encapsulated by this option.
encapsulated_space | name of the option space encapsulated by this option. |
Definition at line 416 of file option.h.
References encapsulated_space_.
Referenced by isc::dhcp::Option6IA::Option6IA(), isc::dhcp::Option6IAAddr::Option6IAAddr(), isc::dhcp::Option6IAPrefix::Option6IAPrefix(), isc::dhcp::OptionCustom::OptionCustom(), and isc::dhcp::OptionInt< T >::OptionInt().
void isc::dhcp::Option::setUint16 | ( | uint16_t | value | ) |
Sets content of this option to a single uint16 value.
Option it resized appropriately (to length of 2 octets).
value | value to be set |
Definition at line 382 of file option.cc.
References data_, and isc::util::writeUint16().
void isc::dhcp::Option::setUint32 | ( | uint32_t | value | ) |
Sets content of this option to a single uint32 value.
Option it resized appropriately (to length of 4 octets).
value | value to be set |
Definition at line 387 of file option.cc.
References data_, and isc::util::writeUint32().
void isc::dhcp::Option::setUint8 | ( | uint8_t | value | ) |
|
protected |
Returns collection of suboptions in the textual format.
This protected method should be called by the derived classes in their respective toText
implementations to append the suboptions held by this option. Note that there are some option types which don't have suboptions because they contain variable length fields. For such options this method is not called.
indent | Number of spaces to insert before the text. |
Definition at line 323 of file option.cc.
References options_.
Referenced by isc::dhcp::Option6IA::toText(), isc::dhcp::Option6IAAddr::toText(), isc::dhcp::OptionVendor::toText(), isc::dhcp::Option6IAPrefix::toText(), isc::dhcp::OptionInt< T >::toText(), toText(), and isc::dhcp::OptionCustom::toText().
|
virtual |
Returns binary representation of the option.
include_header | Boolean flag which indicates if the output should also contain header fields. The default is that it shouldn't include header fields. |
Definition at line 269 of file option.cc.
References isc::util::OutputBuffer::getData(), getHeaderLen(), isc::util::OutputBuffer::getLength(), getType(), isc_throw, len(), and pack().
Referenced by toHexString().
|
virtual |
Returns string containing hexadecimal representation of option.
include_header | Boolean flag which indicates if the output should also contain header fields. The default is that it shouldn't include header fields. |
Definition at line 290 of file option.cc.
References isc::util::encode::encodeHex(), and toBinary().
|
virtual |
Returns string representation of the value.
This is terse representation used in cases where client classification refers to a specific option.
Reimplemented in isc::dhcp::OptionString.
Definition at line 263 of file option.cc.
References toText().
|
virtual |
Returns string representation of the option.
indent | number of spaces before printing text |
Reimplemented in isc::dhcp::OptionCustom, isc::dhcp::Option4ClientFqdn, isc::dhcp::OptionIntArray< T >, isc::dhcp::Option6ClientFqdn, isc::dhcp::OptionInt< T >, isc::dhcp::Option4SlpServiceScope, isc::dhcp::OptionVendorClass, isc::dhcp::OptionOpaqueDataTuples, isc::dhcp::OptionString, isc::dhcp::Option6IAPrefix, isc::dhcp::Option4AddrLst, isc::dhcp::OptionVendor, isc::dhcp::Option6PDExclude, isc::dhcp::Option6Auth, isc::dhcp::Option6IAAddr, isc::dhcp::Option6StatusCode, isc::dhcp::Option6IA, and isc::dhcp::Option6AddrLst.
Definition at line 244 of file option.cc.
References data_, headerToText(), and suboptionsToText().
Referenced by toString().
|
virtual |
Parses received buffer.
begin | iterator to first byte of option data |
end | iterator to end of option data (first byte after option end) |
Reimplemented in isc::dhcp::OptionCustom, isc::dhcp::Option4ClientFqdn, isc::dhcp::Option6ClientFqdn, isc::dhcp::OptionIntArray< T >, isc::dhcp::Option4SlpServiceScope, isc::dhcp::OptionInt< T >, isc::dhcp::OptionString, isc::dhcp::Option6IAPrefix, isc::dhcp::OptionVendorClass, isc::dhcp::OptionOpaqueDataTuples, isc::dhcp::OptionVendor, isc::dhcp::Option6PDExclude, isc::dhcp::Option6Auth, isc::dhcp::Option6IAAddr, isc::dhcp::Option6AddrLst, isc::dhcp::Option6IA, and isc::dhcp::Option6StatusCode.
Definition at line 159 of file option.cc.
References setData().
|
protected |
Builds a collection of sub options from the buffer.
This method parses the provided buffer and builds a collection of objects representing sub options. This function may throw different exceptions when option assembly fails.
buf | buffer to be parsed. |
Definition at line 165 of file option.cc.
References isc::dhcp::DHO_VENDOR_ENCAPSULATED_OPTIONS, getEncapsulatedSpace(), getType(), isc_throw, options_, universe_, isc::dhcp::LibDHCP::unpackOptions4(), isc::dhcp::LibDHCP::unpackOptions6(), V4, and V6.
Referenced by isc::dhcp::Option6IA::unpack(), isc::dhcp::Option6IAAddr::unpack(), isc::dhcp::Option6IAPrefix::unpack(), and isc::dhcp::OptionInt< T >::unpack().
|
virtual |
returns if option is valid (e.g.
option may be truncated)
Reimplemented in isc::perfdhcp::LocalizedOption.
Definition at line 202 of file option.cc.
References universe_, V4, and V6.
Referenced by isc::dhcp::Option6IAAddr::setValid().
|
protected |
contains content of this data
Definition at line 572 of file option.h.
Referenced by check(), getData(), getUint16(), getUint32(), getUint8(), len(), isc::perfdhcp::LocalizedOption::LocalizedOption(), operator=(), pack(), setData(), setUint16(), setUint32(), setUint8(), and toText().
|
protected |
Name of the option space being encapsulated by this option.
Definition at line 578 of file option.h.
Referenced by getEncapsulatedSpace(), operator=(), and setEncapsulatedSpace().
|
static |
Governs whether options should be parsed less strictly.
Populated on configuration commit.
When enabled:
Definition at line 464 of file option.h.
Referenced by isc::dhcp::SrvConfig::configureLowerLevelLibraries(), and isc::dhcp::OpaqueDataTuple::unpack().
|
static |
length of the usual DHCPv4 option header (there are exceptions)
Definition at line 76 of file option.h.
Referenced by getHeaderLen(), isc::dhcp::OptionInt< T >::len(), and isc::dhcp::OptionIntArray< T >::len().
|
static |
length of any DHCPv6 option header
Definition at line 79 of file option.h.
Referenced by getHeaderLen(), isc::dhcp::Pkt6::getRelayOverhead(), isc::dhcp::Option6AddrLst::len(), isc::dhcp::Option6IA::len(), isc::dhcp::Option6IAAddr::len(), isc::dhcp::Option6IAPrefix::len(), isc::dhcp::OptionInt< T >::len(), isc::dhcp::OptionIntArray< T >::len(), and isc::dhcp::Option6IA::pack().
|
protected |
collection for storing suboptions
Definition at line 575 of file option.h.
Referenced by addOption(), delOption(), getOption(), getOptions(), getOptionsCopy(), isc::dhcp::OptionVendor::len(), isc::dhcp::Option6IA::len(), isc::dhcp::Option6IAAddr::len(), isc::dhcp::Option6IAPrefix::len(), isc::dhcp::OptionInt< T >::len(), isc::dhcp::OptionIntArray< T >::len(), len(), isc::dhcp::OptionCustom::len(), operator=(), Option(), packOptions(), suboptionsToText(), isc::dhcp::OptionVendor::unpack(), and unpackOptions().
|
protected |
option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
Definition at line 569 of file option.h.
Referenced by check(), getType(), getUint8(), headerToText(), isc::perfdhcp::LocalizedOption::LocalizedOption(), operator=(), isc::dhcp::Option4AddrLst::Option4AddrLst(), isc::dhcp::Option6IA::pack(), isc::dhcp::Option6Auth::pack(), isc::dhcp::Option6AddrLst::pack(), isc::dhcp::Option6IAAddr::pack(), isc::dhcp::Option6IAPrefix::pack(), isc::dhcp::Option4AddrLst::pack(), isc::dhcp::Option6Auth::packHashInput(), packHeader(), isc::dhcp::Option6ClientFqdn::toText(), isc::dhcp::Option4ClientFqdn::toText(), isc::dhcp::Option6IA::unpack(), isc::dhcp::Option6AddrLst::unpack(), isc::dhcp::Option6IAAddr::unpack(), isc::dhcp::Option6Auth::unpack(), and isc::dhcp::Option6IAPrefix::unpack().
|
protected |
option universe (V4 or V6)
Definition at line 566 of file option.h.
Referenced by addOption(), check(), getHeaderLen(), getUniverse(), isc::dhcp::OptionVendor::len(), isc::perfdhcp::LocalizedOption::LocalizedOption(), operator=(), isc::dhcp::OptionVendor::pack(), packHeader(), packOptions(), isc::dhcp::OptionVendor::unpack(), unpackOptions(), and valid().