Kea: isc::dhcp::TokenRelay6Field Class Reference

| Kea 3.2.0-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:
[legend]

## Public Types
enum | FieldType : uint16_t { 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.
virtual unsigned | 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 unsigned | getLabel () const
| Return the label of this token.

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

## Member Enumeration Documentation

## ◆ FieldType

enum isc::dhcp::TokenRelay6Field::FieldType : uint16_t

enum value that determines the field.

Enumerator
PEERADDR | Peer address field (IPv6 address).
LINKADDR | Link address field (IPv6 address).

Definition at line 730 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_level | the nesting level for which relay to examine.
  type | which field to extract.

Definition at line 740 of file token.h.

References nest_level_, and type_.

## Member Function Documentation

## ◆ evaluate()

unsigned 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

  pkt | fields will be extracted from here
  values | - stack of values (1 result will be pushed)

Returns
  0 which means evaluate next token if any.

Implements isc::dhcp::Token.

Definition at line 683 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::Pkt::getLabel(), 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(), toHex(), 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 760 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 770 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 776 of file token.h.

Referenced by TokenRelay6Field(), evaluate(), and getNest().

## ◆ type_

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

field to get

Definition at line 777 of file token.h.

Referenced by TokenRelay6Field(), evaluate(), and getType().

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

- token.h
- token.cc