Kea 2.5.8
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.
 
void evaluate (Pkt &pkt, ValueStack &values)
 Extracts the specified field from the requested relay.
 
int8_t getNest () const
 Returns nest-level.
 
FieldType getType ()
 Returns field type.
 
- Public Member Functions inherited from isc::dhcp::Token
virtual ~Token ()
 Virtual destructor.
 
virtual void evaluate (Pkt &pkt, ValueStack &values)=0
 This is a generic method for evaluating a packet.
 

Protected Attributes

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

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.
 

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 694 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 698 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 708 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 632 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, LINKADDR, LOG_DEBUG, nest_level_, PEERADDR, isc::dhcp::Pkt6::relay_info_, isc::asiolink::IOAddress::toBytes(), and type_.

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

References nest_level_.

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

References type_.

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

Referenced by evaluate(), and getNest().

◆ type_

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

field to get

Definition at line 744 of file token.h.

Referenced by evaluate(), and getType().


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