Kea  2.1.7-git
isc::dhcp::TokenPkt4 Class Reference

Token that represents fields of a DHCPv4 packet. More...

#include <token.h>

+ Inheritance diagram for isc::dhcp::TokenPkt4:

Public Types

enum  FieldType {
  CHADDR, GIADDR, CIADDR, YIADDR,
  SIADDR, HLEN, HTYPE, MSGTYPE,
  TRANSID
}
 enum value that determines the field. More...
 

Public Member Functions

 TokenPkt4 (const FieldType type)
 Constructor (does nothing) More...
 
void evaluate (Pkt &pkt, ValueStack &values)
 Gets a value from the specified packet. More...
 
FieldType getType ()
 Returns field 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 fields of a DHCPv4 packet.

For example in the expression pkt4.chaddr == 0x0102030405 this token represents the pkt4.chaddr expression.

Currently supported fields are:

  • chaddr (client hardware address, hlen [0..16] octets)
  • giaddr (relay agent IP address, 4 octets)
  • ciaddr (client IP address, 4 octets)
  • yiaddr ('your' (client) IP address, 4 octets)
  • siaddr (next server IP address, 4 octets)
  • hlen (hardware address length, padded to 4 octets)
  • htype (hardware address type, padded to 4 octets)

Definition at line 559 of file token.h.

Member Enumeration Documentation

◆ FieldType

enum value that determines the field.

Enumerator
CHADDR 

chaddr field (up to 16 bytes link-layer address)

GIADDR 

giaddr (IPv4 address)

CIADDR 

ciaddr (IPv4 address)

YIADDR 

yiaddr (IPv4 address)

SIADDR 

siaddr (IPv4 address)

HLEN 

hlen (hardware address length)

HTYPE 

htype (hardware address type)

MSGTYPE 

message type (not really a field, content of option 53)

TRANSID 

transaction-id (xid)

Definition at line 563 of file token.h.

Constructor & Destructor Documentation

◆ TokenPkt4()

isc::dhcp::TokenPkt4::TokenPkt4 ( const FieldType  type)
inline

Constructor (does nothing)

Definition at line 576 of file token.h.

Member Function Documentation

◆ evaluate()

void TokenPkt4::evaluate ( Pkt pkt,
ValueStack values 
)
virtual

Gets a value from the specified packet.

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

Exceptions
EvalTypeErrorwhen called for DHCPv6 packet
Parameters
pkt- fields will be extracted from here
values- stack of values (1 result will be pushed)

Implements isc::dhcp::Token.

Definition at line 483 of file token.cc.

References isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_PKT4, isc::dhcp::eval_logger, isc::dhcp::Pkt4::getCiaddr(), isc::dhcp::Pkt4::getGiaddr(), isc::dhcp::Pkt4::getHlen(), isc::dhcp::Pkt4::getHtype(), isc::dhcp::Pkt4::getHWAddr(), isc::dhcp::Pkt4::getSiaddr(), isc::dhcp::Pkt::getTransid(), isc::dhcp::Pkt4::getType(), isc::dhcp::Pkt4::getYiaddr(), isc_throw, LOG_DEBUG, isc::asiolink::IOAddress::toBytes(), and isc::util::encode::toHex().

+ Here is the call graph for this function:

◆ getType()

FieldType isc::dhcp::TokenPkt4::getType ( )
inline

Returns field type.

This method is used only in tests.

Returns
type of the field.

Definition at line 594 of file token.h.


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