Kea
1.9.9-git
|
Token that represents sub-options in DHCPv4 and DHCPv6. More...
#include <token.h>
Public Member Functions | |
TokenSubOption (const uint16_t option_code, const uint16_t sub_option_code, const RepresentationType &rep_type) | |
Constructor that takes an option and sub-option codes as parameter. More... | |
virtual void | evaluate (Pkt &pkt, ValueStack &values) |
This is a method for evaluating a packet. More... | |
uint16_t | getSubCode () const |
Returns sub-option-code. 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... | |
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 | getSubOption (const OptionPtr &parent) |
Attempts to retrieve a sub-option. More... | |
Protected Member Functions inherited from isc::dhcp::TokenOption | |
virtual OptionPtr | getOption (Pkt &pkt) |
Attempts to retrieve an option. More... | |
virtual std::string | pushFailure (ValueStack &values) |
Auxiliary method that puts string representing a failure. More... | |
Protected Attributes | |
uint16_t | sub_option_code_ |
Code of the sub-option to be extracted. 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... | |
Token that represents sub-options in DHCPv4 and DHCPv6.
It covers any options which encapsulate sub-options, for instance dhcp-agent-options (82, DHCPv4) or rsoo (66, DHCPv6). This class is derived from TokenOption and leverages its ability to operate on sub-options. It also adds additional capabilities.
It can represent the following expressions: option[149].exists - check if option 149 exists option[149].option[1].exists - check if suboption 1 exists in the option 149 option[149].option[1].hex - return content of suboption 1 for option 149
|
inline |
Constructor that takes an option and sub-option codes as parameter.
TokenOption::RepresentationTypeNote:
There is no constructor that takes names.option_code | code of the parent option. |
sub_option_code | code of the sub-option to be represented. |
rep_type | Token representation type. |
|
virtual |
This is a method for evaluating a packet.
This token represents a value of the sub-option, so this method attempts to extract the parent option from the packet and when it succeeds to extract the sub-option from the option and its value on the stack. If the parent option or the sub-option is not there, an empty string ("") is put on the stack.
pkt | specified parent option will be extracted from this packet |
values | value of the sub-option will be pushed here (or "") |
Reimplemented from isc::dhcp::TokenOption.
Definition at line 1190 of file token.cc.
References isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_SUB_OPTION, isc::dhcp::EVAL_DEBUG_SUB_OPTION_NO_OPTION, isc::dhcp::eval_logger, isc::dhcp::TokenOption::EXISTS, isc::dhcp::TokenOption::getOption(), getSubOption(), isc::dhcp::TokenOption::HEXADECIMAL, LOG_DEBUG, isc::dhcp::TokenOption::option_code_, isc::dhcp::TokenOption::representation_type_, sub_option_code_, isc::dhcp::TokenOption::TEXTUAL, and isc::util::encode::toHex().
|
inline |
Returns sub-option-code.
This method is used in testing to determine if the parser had instantiated TokenSubOption with correct parameters.
Definition at line 1234 of file token.h.
References sub_option_code_.
Attempts to retrieve a sub-option.
parent | the sub-option will be retrieved from here |
Definition at line 1182 of file token.cc.
References sub_option_code_.
Referenced by evaluate().
|
protected |
Code of the sub-option to be extracted.
Definition at line 1245 of file token.h.
Referenced by evaluate(), getSubCode(), and getSubOption().