Kea  2.1.7-git
isc::dhcp::TokenRelay6Option Class Reference

Token that represents a value of an option within a DHCPv6 relay encapsulation. More...

#include <token.h>

+ Inheritance diagram for isc::dhcp::TokenRelay6Option:

Public Member Functions

 TokenRelay6Option (const int8_t nest_level, const uint16_t option_code, const RepresentationType &rep_type)
 Constructor that takes a nesting level and an option code as parameters. More...
 
int8_t getNest () const
 Returns nest-level. More...
 
- Public Member Functions inherited from isc::dhcp::TokenOption
 TokenOption (const uint16_t option_code, const RepresentationType &rep_type)
 Constructor that takes an option code as a parameter. More...
 
void evaluate (Pkt &pkt, ValueStack &values)
 Evaluates the values of the option. More...
 
uint16_t getCode () const
 Returns option-code. More...
 
RepresentationType getRepresentation () const
 Returns representation-type. More...
 
- Public Member Functions inherited from isc::dhcp::Token
virtual ~Token ()
 Virtual destructor. More...
 

Protected Member Functions

virtual OptionPtr getOption (Pkt &pkt)
 Attempts to obtain specified option from the specified relay block. More...
 
- Protected Member Functions inherited from isc::dhcp::TokenOption
virtual std::string pushFailure (ValueStack &values)
 Auxiliary method that puts string representing a failure. More...
 

Protected Attributes

int8_t nest_level_
 nesting level of the relay block to use More...
 
- Protected Attributes inherited from isc::dhcp::TokenOption
uint16_t option_code_
 Code of the option to be extracted. More...
 
RepresentationType representation_type_
 Representation type. More...
 

Additional Inherited Members

- Public Types inherited from isc::dhcp::TokenOption
enum  RepresentationType { TEXTUAL, HEXADECIMAL, EXISTS }
 Token representation type. More...
 
- Static Public Member Functions inherited from isc::dhcp::Token
static bool toBool (std::string value)
 Coverts a (string) value to a boolean. More...
 

Detailed Description

Token that represents a value of an option within a DHCPv6 relay encapsulation.

This represents a reference to a given option similar to TokenOption but from within the information from a relay. In the expression relay6[nest-level].option[option-code], nest-level indicates which of the relays to examine and option-code which option to extract.

During the evaluation it tries to extract the value of the specified option from the requested relay block. If the relay block doesn't exist or the option is not found an empty string ("") is returned (or "false" when the representation is EXISTS).

The nesting level can go from 0 (closest to the server) to 31, or from -1 (closest to the client) to -32

Definition at line 467 of file token.h.

Constructor & Destructor Documentation

◆ TokenRelay6Option()

isc::dhcp::TokenRelay6Option::TokenRelay6Option ( const int8_t  nest_level,
const uint16_t  option_code,
const RepresentationType rep_type 
)
inline

Constructor that takes a nesting level and an option code as parameters.

Parameters
nest_levelthe nesting for which relay to examine.
option_codecode of the option.
rep_typeToken representation type.

Definition at line 475 of file token.h.

Member Function Documentation

◆ getNest()

int8_t isc::dhcp::TokenRelay6Option::getNest ( ) const
inline

Returns nest-level.

This method is used in testing to determine if the parser has instantiated TokenRelay6Option with correct parameters.

Returns
nest-level of the relay block this token expects to use for extraction.

Definition at line 486 of file token.h.

◆ getOption()

OptionPtr TokenRelay6Option::getOption ( Pkt pkt)
protectedvirtual

Attempts to obtain specified option from the specified relay block.

Parameters
pktDHCPv6 packet that hopefully contains the proper relay block
Returns
option instance if available

Reimplemented from isc::dhcp::TokenOption.

Definition at line 396 of file token.cc.

References isc::dhcp::Pkt6::getRelayOption(), isc_throw, isc::dhcp::TokenOption::option_code_, and isc::dhcp::Pkt6::relay_info_.

+ Here is the call graph for this function:

Member Data Documentation

◆ nest_level_

int8_t isc::dhcp::TokenRelay6Option::nest_level_
protected

nesting level of the relay block to use

Definition at line 496 of file token.h.


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