Kea 2.7.1
isc::dhcp::OptionCustom Class Reference

Option with defined data fields represented as buffers that can be accessed using data field index. More...

#include <option_custom.h>

+ Inheritance diagram for isc::dhcp::OptionCustom:

Public Member Functions

 OptionCustom (const OptionDefinition &def, Universe u)
 Constructor, used for options to be sent.
 
 OptionCustom (const OptionDefinition &def, Universe u, const OptionBuffer &data)
 Constructor, used for options to be sent.
 
 OptionCustom (const OptionDefinition &def, Universe u, OptionBufferConstIter first, OptionBufferConstIter last)
 Constructor, used for received options.
 
void addArrayDataField (const asiolink::IOAddress &address)
 Create new buffer and set its value as an IP address.
 
void addArrayDataField (const bool value)
 Create new buffer and store boolean value in it.
 
void addArrayDataField (const OpaqueDataTuple &value)
 Create new buffer and store tuple value in it.
 
void addArrayDataField (const PrefixLen &prefix_len, const asiolink::IOAddress &prefix)
 Create new buffer and store variable length prefix in it.
 
void addArrayDataField (const PSIDLen &psid_len, const PSID &psid)
 Create new buffer and store PSID length / value in it.
 
void addArrayDataField (const std::string &value)
 Create new buffer and store tuple value in it.
 
template<typename T >
void addArrayDataField (const T value)
 Create new buffer and store integer value in it.
 
virtual OptionPtr clone () const
 Copies this option and returns a pointer to the copy.
 
uint32_t getDataFieldsNum () const
 Return a number of the data fields.
 
void initialize (const OptionBufferConstIter first, const OptionBufferConstIter last)
 Sets content of this option from buffer.
 
virtual uint16_t len () const
 Returns length of the complete option (data length + DHCPv4/DHCPv6 option header)
 
virtual void pack (isc::util::OutputBuffer &buf, bool check=true) const
 Writes DHCP option in a wire format to a buffer.
 
asiolink::IOAddress readAddress (const uint32_t index=0) const
 Read a buffer as IP address.
 
const OptionBufferreadBinary (const uint32_t index=0) const
 Read a buffer as binary data.
 
bool readBoolean (const uint32_t index=0) const
 Read a buffer as boolean value.
 
std::string readFqdn (const uint32_t index=0) const
 Read a buffer as FQDN.
 
template<typename T >
readInteger (const uint32_t index=0) const
 Read a buffer as integer value.
 
PrefixTuple readPrefix (const uint32_t index=0) const
 Read a buffer as variable length prefix.
 
PSIDTuple readPsid (const uint32_t index=0) const
 Read a buffer as a PSID length / value tuple.
 
std::string readString (const uint32_t index=0) const
 Read a buffer as string value.
 
std::string readTuple (const uint32_t index=0) const
 Read a buffer as length and string tuple.
 
void readTuple (OpaqueDataTuple &tuple, const uint32_t index=0) const
 Read a buffer into a length and string tuple.
 
virtual std::string toText (int indent=0) const
 Returns string representation of the option.
 
virtual void unpack (OptionBufferConstIter begin, OptionBufferConstIter end)
 Parses received buffer.
 
void writeAddress (const asiolink::IOAddress &address, const uint32_t index=0)
 Write an IP address into a buffer.
 
void writeBinary (const OptionBuffer &buf, const uint32_t index=0)
 Write binary data into a buffer.
 
void writeBoolean (const bool value, const uint32_t index=0)
 Write a boolean value into a buffer.
 
void writeFqdn (const std::string &fqdn, const uint32_t index=0)
 Write an FQDN into a buffer.
 
template<typename T >
void writeInteger (const T value, const uint32_t index=0)
 Write an integer value into a buffer.
 
void writePrefix (const PrefixLen &prefix_len, const asiolink::IOAddress &prefix, const uint32_t index=0)
 Write prefix length and value into a buffer.
 
void writePsid (const PSIDLen &psid_len, const PSID &psid, const uint32_t index=0)
 Write PSID length / value into a buffer.
 
void writeString (const std::string &text, const uint32_t index=0)
 Write a string value into a buffer.
 
void writeTuple (const OpaqueDataTuple &value, const uint32_t index=0)
 Write a length and string tuple into a buffer.
 
void writeTuple (const std::string &value, const uint32_t index=0)
 Write a length and string tuple into a buffer.
 
- Public Member Functions inherited from isc::dhcp::Option
 Option (const Option &source)
 Copy constructor.
 
 Option (Universe u, uint16_t type)
 ctor, used for options constructed, usually during transmission
 
 Option (Universe u, uint16_t type, const OptionBuffer &data)
 Constructor, used for received options.
 
 Option (Universe u, uint16_t type, OptionBufferConstIter first, OptionBufferConstIter last)
 Constructor, used for received options.
 
virtual ~Option ()
 just to force that every option has virtual dtor
 
void addOption (OptionPtr opt)
 Adds a sub-option.
 
bool delOption (uint16_t type)
 Attempts to delete first suboption of requested type.
 
virtual bool equals (const Option &other) const
 Checks if two options are equal.
 
bool equals (const OptionPtr &other) const
 Checks if options are equal.
 
virtual const OptionBuffergetData () const
 Returns pointer to actual data.
 
std::string getEncapsulatedSpace () const
 Returns the name of the option space encapsulated by this option.
 
virtual uint16_t getHeaderLen () const
 Returns length of header (2 for v4, 4 for v6)
 
OptionCollectiongetMutableOptions ()
 Returns all encapsulated options.
 
OptionPtr getOption (uint16_t type) const
 Returns shared_ptr to suboption of specific type.
 
const OptionCollectiongetOptions () const
 Returns all encapsulated options.
 
void getOptionsCopy (OptionCollection &options_copy) const
 Performs deep copy of suboptions.
 
uint16_t getType () const
 Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
 
uint16_t getUint16 () const
 Returns content of first word.
 
uint32_t getUint32 () const
 Returns content of first double word.
 
uint8_t getUint8 () const
 Returns content of first byte.
 
Universe getUniverse () const
 returns option universe (V4 or V6)
 
Optionoperator= (const Option &rhs)
 Assignment operator.
 
template<typename InputIterator >
void setData (InputIterator first, InputIterator last)
 Sets content of this option from buffer.
 
void setEncapsulatedSpace (const std::string &encapsulated_space)
 Sets the name of the option space encapsulated by this option.
 
void setUint16 (uint16_t value)
 Sets content of this option to a single uint16 value.
 
void setUint32 (uint32_t value)
 Sets content of this option to a single uint32 value.
 
void setUint8 (uint8_t value)
 Sets content of this option to a single uint8 value.
 
virtual std::vector< uint8_t > toBinary (const bool include_header=false) const
 Returns binary representation of the option.
 
virtual std::string toHexString (const bool include_header=false) const
 Returns string containing hexadecimal representation of option.
 
virtual std::string toString () const
 Returns string representation of the value.
 
virtual bool valid () const
 returns if option is valid (e.g.
 

Additional Inherited Members

- Public Types inherited from isc::dhcp::Option
typedef OptionPtr Factory(Option::Universe u, uint16_t type, const OptionBuffer &buf)
 a factory function prototype
 
enum  Universe { V4 , V6 }
 defines option universe DHCPv4 or DHCPv6 More...
 
- Static Public Member Functions inherited from isc::dhcp::Option
static OptionPtr create (Universe u, uint16_t type)
 Factory function creating an instance of the Option.
 
static OptionPtr create (Universe u, uint16_t type, const OptionBuffer &data)
 Factory function creating an instance of the Option.
 
static OptionPtr factory (Option::Universe u, uint16_t type)
 Factory function to create instance of option.
 
static OptionPtr factory (Option::Universe u, uint16_t type, const OptionBuffer &buf)
 Factory function to create instance of option.
 
- Static Public Attributes inherited from isc::dhcp::Option
static bool lenient_parsing_
 Governs whether options should be parsed less strictly.
 
static const size_t OPTION4_HDR_LEN = 2
 length of the usual DHCPv4 option header (there are exceptions)
 
static const size_t OPTION6_HDR_LEN = 4
 length of any DHCPv6 option header
 
- Protected Member Functions inherited from isc::dhcp::Option
void check () const
 A protected method used for option correctness.
 
template<typename OptionType >
OptionPtr cloneInternal () const
 Copies this option and returns a pointer to the copy.
 
std::string headerToText (const int indent=0, const std::string &type_name="") const
 Returns option header in the textual format.
 
void packHeader (isc::util::OutputBuffer &buf, bool check=true) const
 Store option's header in a buffer.
 
void packOptions (isc::util::OutputBuffer &buf, bool check=true) const
 Store sub options in a buffer.
 
std::string suboptionsToText (const int indent=0) const
 Returns collection of suboptions in the textual format.
 
void unpackOptions (const OptionBuffer &buf)
 Builds a collection of sub options from the buffer.
 
- Protected Attributes inherited from isc::dhcp::Option
OptionBuffer data_
 contains content of this data
 
std::string encapsulated_space_
 Name of the option space being encapsulated by this option.
 
OptionCollection options_
 collection for storing suboptions
 
uint16_t type_
 option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
 
Universe universe_
 option universe (V4 or V6)
 

Detailed Description

Option with defined data fields represented as buffers that can be accessed using data field index.

This class represents an option which has defined structure: data fields of specific types and order. Those fields can be accessed using indexes, where index 0 represents first data field within an option. The last field can be accessed using index equal to 'number of fields' - 1. Internally, the option data is stored as a collection of OptionBuffer objects, each representing data for a particular data field. This data can be converted to the actual data type using methods implemented within this class. This class is used to represent those options that can't be represented by any other specialized class (this excludes the Option class which is generic and can be used to represent any option).

Definition at line 31 of file option_custom.h.

Constructor & Destructor Documentation

◆ OptionCustom() [1/3]

isc::dhcp::OptionCustom::OptionCustom ( const OptionDefinition & def,
Universe u )

Constructor, used for options to be sent.

This constructor creates an instance of an option with default data set for all data fields. The option buffers are allocated according to data size being stored in particular data fields. For variable size data empty buffers are created.

Parameters
defoption definition.
uspecifies universe (V4 or V6)

Definition at line 21 of file option_custom.cc.

References isc::dhcp::Option::setEncapsulatedSpace().

+ Here is the call graph for this function:

◆ OptionCustom() [2/3]

isc::dhcp::OptionCustom::OptionCustom ( const OptionDefinition & def,
Universe u,
const OptionBuffer & data )

Constructor, used for options to be sent.

This constructor creates an instance of an option from the whole supplied buffer. This constructor is mainly used to create an instances of options to be stored in outgoing DHCP packets. The buffer used to create the instance of an option can be created from the option data specified in server's configuration.

Parameters
defoption definition.
uspecifies universe (V4 or V6).
datacontent of the option.
Exceptions
OutOfRangeif option buffer is truncated.
Todo
list all exceptions thrown by ctor.

Definition at line 29 of file option_custom.cc.

References isc::dhcp::Option::getData(), and isc::dhcp::Option::setEncapsulatedSpace().

+ Here is the call graph for this function:

◆ OptionCustom() [3/3]

isc::dhcp::OptionCustom::OptionCustom ( const OptionDefinition & def,
Universe u,
OptionBufferConstIter first,
OptionBufferConstIter last )

Constructor, used for received options.

This constructor creates an instance an option from the portion of the buffer specified by iterators. This is mainly useful when parsing received packets. Such packets are represented by a single buffer holding option data and all sub options. Methods that are parsing a packet, supply relevant portions of the packet buffer to this constructor to create option instances out of it.

Parameters
defoption definition.
uspecifies universe (V4 or V6).
firstiterator to the first element that should be copied.
lastiterator to the next element after the last one to be copied.
Exceptions
OutOfRangeif option buffer is truncated.
Todo
list all exceptions thrown by ctor.

Definition at line 38 of file option_custom.cc.

References isc::dhcp::Option::getData(), and isc::dhcp::Option::setEncapsulatedSpace().

+ Here is the call graph for this function:

Member Function Documentation

◆ addArrayDataField() [1/7]

void isc::dhcp::OptionCustom::addArrayDataField ( const asiolink::IOAddress & address)

Create new buffer and set its value as an IP address.

Parameters
addressIPv4 or IPv6 address to be written to a buffer being created.

Definition at line 54 of file option_custom.cc.

References isc::dhcp::OptionDefinition::getType(), isc_throw, isc::dhcp::OPT_IPV4_ADDRESS_TYPE, isc::dhcp::OPT_IPV6_ADDRESS_TYPE, and isc::dhcp::OptionDataTypeUtil::writeAddress().

+ Here is the call graph for this function:

◆ addArrayDataField() [2/7]

void isc::dhcp::OptionCustom::addArrayDataField ( const bool value)

Create new buffer and store boolean value in it.

Parameters
valuevalue to be stored in the created buffer.

Definition at line 90 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::writeBool().

+ Here is the call graph for this function:

◆ addArrayDataField() [3/7]

void isc::dhcp::OptionCustom::addArrayDataField ( const OpaqueDataTuple & value)

Create new buffer and store tuple value in it.

Parameters
valuevalue to be stored as a tuple in the created buffer.

Definition at line 81 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::writeTuple().

+ Here is the call graph for this function:

◆ addArrayDataField() [4/7]

void isc::dhcp::OptionCustom::addArrayDataField ( const PrefixLen & prefix_len,
const asiolink::IOAddress & prefix )

Create new buffer and store variable length prefix in it.

Parameters
prefix_lenPrefix length.
prefixPrefix.

Definition at line 99 of file option_custom.cc.

References isc::dhcp::OptionDefinition::getType(), isc_throw, isc::dhcp::OPT_IPV6_PREFIX_TYPE, and isc::dhcp::OptionDataTypeUtil::writePrefix().

+ Here is the call graph for this function:

◆ addArrayDataField() [5/7]

void isc::dhcp::OptionCustom::addArrayDataField ( const PSIDLen & psid_len,
const PSID & psid )

Create new buffer and store PSID length / value in it.

Parameters
psid_lenPSID length.
psidPSID.

Definition at line 114 of file option_custom.cc.

References isc::dhcp::OptionDefinition::getType(), isc_throw, isc::dhcp::OPT_PSID_TYPE, and isc::dhcp::OptionDataTypeUtil::writePsid().

+ Here is the call graph for this function:

◆ addArrayDataField() [6/7]

void isc::dhcp::OptionCustom::addArrayDataField ( const std::string & value)

Create new buffer and store tuple value in it.

Parameters
valuevalue to be stored as a tuple in the created buffer.

Definition at line 71 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::getTupleLenFieldType(), isc::dhcp::Option::getUniverse(), and isc::dhcp::OptionDataTypeUtil::writeTuple().

+ Here is the call graph for this function:

◆ addArrayDataField() [7/7]

template<typename T >
void isc::dhcp::OptionCustom::addArrayDataField ( const T value)
inline

Create new buffer and store integer value in it.

Parameters
valuevalue to be stored in the created buffer.
Template Parameters
Tinteger type of the value being stored.

Definition at line 102 of file option_custom.h.

References isc::dhcp::OptionDefinition::getRecordFields(), isc::dhcp::OptionDefinition::getType(), isc_throw, and isc::dhcp::OPT_RECORD_TYPE.

+ Here is the call graph for this function:

◆ clone()

OptionPtr isc::dhcp::OptionCustom::clone ( ) const
virtual

Copies this option and returns a pointer to the copy.

Reimplemented from isc::dhcp::Option.

Definition at line 49 of file option_custom.cc.

◆ getDataFieldsNum()

uint32_t isc::dhcp::OptionCustom::getDataFieldsNum ( ) const
inline

Return a number of the data fields.

Returns
number of data fields held by the option.

Definition at line 146 of file option_custom.h.

Referenced by toText().

◆ initialize()

void isc::dhcp::OptionCustom::initialize ( const OptionBufferConstIter first,
const OptionBufferConstIter last )

Sets content of this option from buffer.

Option will be resized to length of buffer.

Parameters
firstiterator pointing to beginning of buffer to copy.
lastiterator pointing to end of buffer to copy.

Definition at line 688 of file option_custom.cc.

References isc::dhcp::Option::getData().

Referenced by unpack().

+ Here is the call graph for this function:

◆ len()

uint16_t isc::dhcp::OptionCustom::len ( ) const
virtual

Returns length of the complete option (data length + DHCPv4/DHCPv6 option header)

Returns
length of the option

Reimplemented from isc::dhcp::Option.

Definition at line 671 of file option_custom.cc.

References isc::dhcp::Option::getHeaderLen(), and isc::dhcp::Option::options_.

+ Here is the call graph for this function:

◆ pack()

void isc::dhcp::OptionCustom::pack ( isc::util::OutputBuffer & buf,
bool check = true ) const
virtual

Writes DHCP option in a wire format to a buffer.

Parameters
bufoutput buffer (option will be stored there).
checkif set to false, allows options larger than 255 for v4

Reimplemented from isc::dhcp::Option.

Definition at line 467 of file option_custom.cc.

References isc::dhcp::Option::check(), isc::dhcp::Option::packHeader(), and isc::dhcp::Option::packOptions().

+ Here is the call graph for this function:

◆ readAddress()

IOAddress isc::dhcp::OptionCustom::readAddress ( const uint32_t index = 0) const

Read a buffer as IP address.

Parameters
indexbuffer index.
Returns
IP address read from a buffer.
Exceptions
isc::OutOfRangeif index is out of range.

Definition at line 488 of file option_custom.cc.

References isc_throw, and isc::dhcp::OptionDataTypeUtil::readAddress().

+ Here is the call graph for this function:

◆ readBinary()

const OptionBuffer & isc::dhcp::OptionCustom::readBinary ( const uint32_t index = 0) const

Read a buffer as binary data.

Parameters
indexbuffer index.
Exceptions
isc::OutOfRangeif index is out of range.
Returns
read buffer holding binary data.

Definition at line 524 of file option_custom.cc.

◆ readBoolean()

bool isc::dhcp::OptionCustom::readBoolean ( const uint32_t index = 0) const

Read a buffer as boolean value.

Parameters
indexbuffer index.
Exceptions
isc::OutOfRangeif index is out of range.
Returns
read boolean value.

Definition at line 568 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::readBool().

+ Here is the call graph for this function:

◆ readFqdn()

std::string isc::dhcp::OptionCustom::readFqdn ( const uint32_t index = 0) const

Read a buffer as FQDN.

Parameters
indexbuffer index.
Exceptions
isc::OutOfRangeif buffer index is out of range.
isc::dhcp::BadDataTypeCastif a buffer being read does not hold a valid FQDN.
Returns
string representation if FQDN.

Definition at line 582 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::readFqdn().

+ Here is the call graph for this function:

◆ readInteger()

template<typename T >
T isc::dhcp::OptionCustom::readInteger ( const uint32_t index = 0) const
inline

Read a buffer as integer value.

Parameters
indexbuffer index.
Template Parameters
integertype of a value being returned.
Exceptions
isc::OutOfRangeif index is out of range.
isc::dhcp::InvalidDataTypeif T is invalid.
Returns
read integer value.

Definition at line 251 of file option_custom.h.

References isc_throw_assert.

Referenced by checkIAStatus().

◆ readPrefix()

PrefixTuple isc::dhcp::OptionCustom::readPrefix ( const uint32_t index = 0) const

Read a buffer as variable length prefix.

Parameters
indexbuffer index.
Returns
Prefix length / value tuple.
Exceptions
isc::OutOfRangeof index is out of range.

Definition at line 605 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::readPrefix().

+ Here is the call graph for this function:

◆ readPsid()

PSIDTuple isc::dhcp::OptionCustom::readPsid ( const uint32_t index = 0) const

Read a buffer as a PSID length / value tuple.

Parameters
indexbuffer index.
Returns
PSID length / value tuple.
Exceptions
isc::OutOfRangeof index is out of range.

Definition at line 625 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::readPsid().

+ Here is the call graph for this function:

◆ readString()

std::string isc::dhcp::OptionCustom::readString ( const uint32_t index = 0) const

Read a buffer as string value.

Parameters
indexbuffer index.
Returns
string value read from buffer.
Exceptions
isc::OutOfRangeif index is out of range.

Definition at line 644 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::readString().

+ Here is the call graph for this function:

◆ readTuple() [1/2]

std::string isc::dhcp::OptionCustom::readTuple ( const uint32_t index = 0) const

Read a buffer as length and string tuple.

Parameters
indexbuffer index.
Exceptions
isc::OutOfRangeif index is out of range.
Returns
string read from a buffer.

Definition at line 537 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::getTupleLenFieldType(), isc::dhcp::Option::getUniverse(), and isc::dhcp::OptionDataTypeUtil::readTuple().

+ Here is the call graph for this function:

◆ readTuple() [2/2]

void isc::dhcp::OptionCustom::readTuple ( OpaqueDataTuple & tuple,
const uint32_t index = 0 ) const

Read a buffer into a length and string tuple.

Parameters
tupletuple to fill.
indexbuffer index.
Exceptions
isc::OutOfRangeif index is out of range.

Definition at line 544 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::readTuple().

+ Here is the call graph for this function:

◆ toText()

std::string isc::dhcp::OptionCustom::toText ( int indent = 0) const
virtual

Returns string representation of the option.

Parameters
indentnumber of spaces before printed text.
Returns
string with text representation.

Reimplemented from isc::dhcp::Option.

Definition at line 697 of file option_custom.cc.

References isc::dhcp::OptionDefinition::getArrayType(), getDataFieldsNum(), isc::dhcp::OptionDefinition::getRecordFields(), isc::dhcp::OptionDefinition::getType(), isc::dhcp::Option::headerToText(), isc::dhcp::OPT_RECORD_TYPE, and isc::dhcp::Option::suboptionsToText().

+ Here is the call graph for this function:

◆ unpack()

void isc::dhcp::OptionCustom::unpack ( OptionBufferConstIter begin,
OptionBufferConstIter end )
virtual

Parses received buffer.

Parameters
beginiterator to first byte of option data
enditerator to end of option data (first byte after option end)

Reimplemented from isc::dhcp::Option.

Definition at line 665 of file option_custom.cc.

References initialize().

+ Here is the call graph for this function:

◆ writeAddress()

void isc::dhcp::OptionCustom::writeAddress ( const asiolink::IOAddress & address,
const uint32_t index = 0 )

Write an IP address into a buffer.

Parameters
addressIP address being written.
indexbuffer index.
Exceptions
isc::OutOfRangeif index is out of range.
isc::dhcp::BadDataTypeCastif IP address is invalid.

Definition at line 506 of file option_custom.cc.

References isc_throw, and isc::dhcp::OptionDataTypeUtil::writeAddress().

+ Here is the call graph for this function:

◆ writeBinary()

void isc::dhcp::OptionCustom::writeBinary ( const OptionBuffer & buf,
const uint32_t index = 0 )

Write binary data into a buffer.

Parameters
bufbuffer holding binary data to be written.
indexbuffer index.

Definition at line 530 of file option_custom.cc.

◆ writeBoolean()

void isc::dhcp::OptionCustom::writeBoolean ( const bool value,
const uint32_t index = 0 )

Write a boolean value into a buffer.

Parameters
valueboolean value to be written.
indexbuffer index.
Exceptions
isc::OutOfRangeif index is out of range.

Definition at line 574 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::writeBool().

+ Here is the call graph for this function:

◆ writeFqdn()

void isc::dhcp::OptionCustom::writeFqdn ( const std::string & fqdn,
const uint32_t index = 0 )

Write an FQDN into a buffer.

Parameters
fqdntext representation of FQDN.
indexbuffer index.
Exceptions
isc::OutOfRangeif index is out of range.

Definition at line 588 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::writeFqdn().

+ Here is the call graph for this function:

◆ writeInteger()

template<typename T >
void isc::dhcp::OptionCustom::writeInteger ( const T value,
const uint32_t index = 0 )
inline

Write an integer value into a buffer.

Parameters
valueinteger value to be written.
indexbuffer index.
Template Parameters
Tinteger type of a value being written.
Exceptions
isc::OutOfRangeif index is out of range.
isc::dhcp::InvalidDataTypeif T is invalid.

Definition at line 273 of file option_custom.h.

◆ writePrefix()

void isc::dhcp::OptionCustom::writePrefix ( const PrefixLen & prefix_len,
const asiolink::IOAddress & prefix,
const uint32_t index = 0 )

Write prefix length and value into a buffer.

Parameters
prefix_lenPrefix length.
prefixPrefix value.
indexBuffer index.
Exceptions
isc::OutOfRangeif index is out of range.

Definition at line 611 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::writePrefix().

+ Here is the call graph for this function:

◆ writePsid()

void isc::dhcp::OptionCustom::writePsid ( const PSIDLen & psid_len,
const PSID & psid,
const uint32_t index = 0 )

Write PSID length / value into a buffer.

Parameters
psid_lenPSID length value.
psidPSID value in the range of 0 .. 2^(PSID length).
indexbuffer index.
Exceptions
isc::dhcp::BadDataTypeCastif PSID length or value is invalid.
isc::OutOfRangeif index is out of range.

Definition at line 631 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::writePsid().

+ Here is the call graph for this function:

◆ writeString()

void isc::dhcp::OptionCustom::writeString ( const std::string & text,
const uint32_t index = 0 )

Write a string value into a buffer.

Parameters
textthe string value to be written.
indexbuffer index.

Definition at line 650 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::writeString().

+ Here is the call graph for this function:

◆ writeTuple() [1/2]

void isc::dhcp::OptionCustom::writeTuple ( const OpaqueDataTuple & value,
const uint32_t index = 0 )

Write a length and string tuple into a buffer.

Parameters
valuevalue to be written.
indexbuffer index.

Definition at line 560 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::writeTuple().

+ Here is the call graph for this function:

◆ writeTuple() [2/2]

void isc::dhcp::OptionCustom::writeTuple ( const std::string & value,
const uint32_t index = 0 )

Write a length and string tuple into a buffer.

Parameters
valuevalue to be written.
indexbuffer index.

Definition at line 551 of file option_custom.cc.

References isc::dhcp::OptionDataTypeUtil::getTupleLenFieldType(), isc::dhcp::Option::getUniverse(), and isc::dhcp::OptionDataTypeUtil::writeTuple().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: