Kea: isc::dhcp::TokenRelay6Option Class Reference

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

## 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.
int8_t | getNest () const
| Returns nest-level.
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.
virtual unsigned | evaluate (Pkt &pkt, ValueStack &values)
| Evaluates the values of the option.
uint16_t | getCode () const
| Returns option-code.
RepresentationType | getRepresentation () const
| Returns representation-type.
Public Member Functions inherited from isc::dhcp::Token
virtual | ~Token ()
| Virtual destructor.
virtual unsigned | getLabel () const
| Return the label of this token.

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

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

## 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.

## 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 527 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_level | the nesting for which relay to examine.
  option_code | code of the option.
  rep_type | Token representation type.

Definition at line 535 of file token.h.

References isc::dhcp::TokenOption::TokenOption(), and nest_level_.

Here is the call graph for this function:

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

References nest_level_.

## ◆ getOption()

OptionPtr TokenRelay6Option::getOption | ( | Pkt & | pkt | ) |
| protectedvirtual

Attempts to obtain specified option from the specified relay block.

Parameters

  pkt | DHCPv6 packet that hopefully contains the proper relay block

Returns
  option instance if available

Reimplemented from isc::dhcp::TokenOption.

Definition at line 471 of file token.cc.

References isc::dhcp::Pkt6::getRelayOption(), isc_throw, nest_level_, 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 556 of file token.h.

Referenced by TokenRelay6Option(), getNest(), and getOption().

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

- token.h
- token.cc