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

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

#include <token.h>

+ Inheritance diagram for isc::dhcp::TokenRelay6Field:

Public Types

enum  FieldType { PEERADDR, LINKADDR }
 enum value that determines the field. More...
 

Public Member Functions

 TokenRelay6Field (const int8_t nest_level, const FieldType type)
 Constructor that takes a nesting level and field type as parameters. More...
 
void evaluate (Pkt &pkt, ValueStack &values)
 Extracts the specified field from the requested relay. More...
 
int8_t getNest () const
 Returns nest-level. More...
 
FieldType getType ()
 Returns field type. More...
 
- Public Member Functions inherited from isc::dhcp::Token
virtual ~Token ()
 Virtual destructor. More...
 

Protected Attributes

int8_t nest_level_
 Specifies field of the DHCPv6 relay option to get. More...
 
FieldType type_
 field to get More...
 

Additional Inherited Members

- 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 a field within a DHCPv6 relay encapsulation.

This represents a reference to a field with a given DHCPv6 relay encapsulation. In the expression relay6[nest-level].field-name, nest-level indicates which of the relays to examine and field-name which of the fields to extract.

During the evaluation it tries to extract the value of the specified field from the requested relay block. If the relay block doesn't exist an empty string ("") is returned. If the relay block does exist the field is always returned as a 16 byte IPv6 address. As the relay may not have set the field it may be 0s.

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 664 of file token.h.

Member Enumeration Documentation

◆ FieldType

enum value that determines the field.

Enumerator
PEERADDR 

Peer address field (IPv6 address)

LINKADDR 

Link address field (IPv6 address)

Definition at line 668 of file token.h.

Constructor & Destructor Documentation

◆ TokenRelay6Field()

isc::dhcp::TokenRelay6Field::TokenRelay6Field ( const int8_t  nest_level,
const FieldType  type 
)
inline

Constructor that takes a nesting level and field type as parameters.

Parameters
nest_levelthe nesting level for which relay to examine.
typewhich field to extract.

Definition at line 678 of file token.h.

Member Function Documentation

◆ evaluate()

void TokenRelay6Field::evaluate ( Pkt pkt,
ValueStack values 
)
virtual

Extracts the specified field from the requested relay.

Evaluation uses fields available in the packet. It does not require any values to be present on the stack.

Parameters
pktfields will be extracted from here
values- stack of values (1 result will be pushed)

Implements isc::dhcp::Token.

Definition at line 602 of file token.cc.

References isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_RELAY6, isc::dhcp::EVAL_DEBUG_RELAY6_RANGE, isc::dhcp::eval_logger, isc::dhcp::Pkt6::getRelay6LinkAddress(), isc::dhcp::Pkt6::getRelay6PeerAddress(), isc_throw, LOG_DEBUG, isc::dhcp::Pkt6::relay_info_, isc::asiolink::IOAddress::toBytes(), and isc::util::encode::toHex().

+ Here is the call graph for this function:

◆ getNest()

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

Returns nest-level.

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

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

Definition at line 697 of file token.h.

◆ getType()

FieldType isc::dhcp::TokenRelay6Field::getType ( )
inline

Returns field type.

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

Returns
type of the field.

Definition at line 707 of file token.h.

Member Data Documentation

◆ nest_level_

int8_t isc::dhcp::TokenRelay6Field::nest_level_
protected

Specifies field of the DHCPv6 relay option to get.

nesting level of the relay block to use

Definition at line 713 of file token.h.

◆ type_

FieldType isc::dhcp::TokenRelay6Field::type_
protected

field to get

Definition at line 714 of file token.h.


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