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

#include <token.h>

+ Inheritance diagram for isc::dhcp::TokenSplit:

Public Member Functions

 TokenSplit ()
 Constructor (does nothing) More...
void evaluate (Pkt &pkt, ValueStack &values)
 Extract a field from a delimited string. 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

Definition at line 798 of file token.h.

Constructor & Destructor Documentation

◆ TokenSplit()

isc::dhcp::TokenSplit::TokenSplit ( )

Constructor (does nothing)

Definition at line 801 of file token.h.

Member Function Documentation

◆ evaluate()

void TokenSplit::evaluate ( Pkt pkt,
ValueStack values 

Extract a field from a delimited string.

Evaluation does not use packet information. It requires at least three values to be present on the stack. It will consume the top three values on the stack as parameters and push the resulting substring onto the stack. From the top it expects the values on the stack as:

  • field
  • delims
  • str

str is the string to split. If it is empty, an empty string is pushed onto the value stack. delims is string of character delimiters by which to split str. If it is empty the entire value of str will be pushed on onto the value stack. field is the field number (starting at 1) of the desired field. If it is out of range an empty string is pushed on the value stack.

The following examples all use the base string "one.two..four" and shows the value returned for a given field:

field => value
- 0 => ""
- 1 => "one"
- 2 => "two"
- 3 => ""
- 4 => "four"
- 5 => ""
EvalBadStackif there are less than 3 values on stack
EvalTypeErrorif field is not a number
values- stack of values (3 arguments will be popped, 1 result will be pushed)

Implements isc::dhcp::Token.

Definition at line 783 of file

References isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_SPLIT, isc::dhcp::EVAL_DEBUG_SPLIT_DELIM_EMPTY, isc::dhcp::EVAL_DEBUG_SPLIT_EMPTY, isc::dhcp::EVAL_DEBUG_SPLIT_FIELD_OUT_OF_RANGE, isc::dhcp::eval_logger, isc_throw, LOG_DEBUG, and isc::util::encode::toHex().

+ Here is the call graph for this function:

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