Kea 2.5.8
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 { IFACE , SRC , DST , LEN }
 enum value that determines the field. More...
 

Public Member Functions

 TokenPkt (const MetadataType type)
 Constructor (does nothing)
 
void 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 void evaluate (Pkt &pkt, ValueStack &values)=0
 This is a generic method for evaluating a packet.
 

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

Constructor & Destructor Documentation

◆ TokenPkt()

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

Constructor (does nothing)

Definition at line 552 of file token.h.

Member Function Documentation

◆ evaluate()

void 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)

Implements isc::dhcp::Token.

Definition at line 465 of file token.cc.

References DST, isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_PKT, isc::dhcp::eval_logger, isc::eval::EvalContext::fromUint32(), isc::dhcp::Pkt::getIface(), isc::dhcp::Pkt::getLocalAddr(), isc::dhcp::Pkt::getRemoteAddr(), IFACE, isc_throw, LEN, LOG_DEBUG, SRC, and isc::asiolink::IOAddress::toBytes().

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


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