Kea  1.9.9-git
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) More...
 
void evaluate (Pkt &pkt, ValueStack &values)
 Gets a value from the specified packet. More...
 
MetadataType getType ()
 Returns metadata type. More...
 
- Public Member Functions inherited from isc::dhcp::Token
virtual ~Token ()
 Virtual destructor. More...
 

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

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

Member Enumeration Documentation

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

Constructor & Destructor Documentation

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

Constructor (does nothing)

Definition at line 521 of file token.h.

Member Function Documentation

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 428 of file token.cc.

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

+ Here is the call graph for this function:

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

Returns metadata type.

This method is used only in tests.

Returns
type of the metadata.

Definition at line 537 of file token.h.


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