Kea 2.7.5
isc::dhcp::TokenPkt Class Reference

Token that represents meta data of a DHCP packet. More...

#include <token.h>

+ Inheritance diagram for isc::dhcp::TokenPkt:

Public Types

enum  MetadataType : int { IFACE , SRC , DST , LEN }
 enum value that determines the field. More...
 

Public Member Functions

 TokenPkt (const MetadataType type)
 Constructor (does nothing)
 
virtual unsigned evaluate (Pkt &pkt, ValueStack &values)
 Gets a value from the specified packet.
 
MetadataType getType ()
 Returns metadata type.
 
- Public Member Functions inherited from isc::dhcp::Token
virtual ~Token ()
 Virtual destructor.
 
virtual unsigned getLabel () const
 Return the label of this token.
 

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 meta data of a DHCP packet.

For example in the expression pkt.iface == 'eth0' this token represents the pkt.iface expression.

Currently supported meta datas are:

  • iface (incoming/outgoinginterface name)
  • src (source IP address, 4 or 16 octets)
  • dst (destination IP address, 4 or 16 octets)
  • len (length field in the UDP header, padded to 4 octets)

Definition at line 569 of file token.h.

Member Enumeration Documentation

◆ MetadataType

enum value that determines the field.

Enumerator
IFACE 

interface name (string)

SRC 

source (IP address)

DST 

destination (IP address)

LEN 

length (4 octets)

Definition at line 573 of file token.h.

Constructor & Destructor Documentation

◆ TokenPkt()

isc::dhcp::TokenPkt::TokenPkt ( const MetadataType type)
inline

Constructor (does nothing)

Definition at line 581 of file token.h.

Member Function Documentation

◆ evaluate()

unsigned TokenPkt::evaluate ( Pkt & pkt,
ValueStack & values )
virtual

Gets a value from the specified packet.

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

Parameters
pkt- metadata 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 507 of file token.cc.

References DST, isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_PKT, isc::dhcp::eval_logger, isc::eval::EvalContext::fromUint32(), IFACE, isc_throw, LEN, LOG_DEBUG, and SRC.

+ Here is the call graph for this function:

◆ getType()

MetadataType isc::dhcp::TokenPkt::getType ( )
inline

Returns metadata type.

This method is used only in tests.

Returns
type of the metadata.

Definition at line 597 of file token.h.


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