Kea 2.7.6
|
#include <token.h>
Public Member Functions | |
TokenSplit () | |
Constructor (does nothing) | |
virtual unsigned | evaluate (Pkt &pkt, ValueStack &values) |
Extract a field from a delimited string. | |
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. | |
|
inline |
|
virtual |
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:
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:
EvalBadStack | if there are less than 3 values on stack |
EvalTypeError | if field is not a number |
pkt | (unused) |
values | - stack of values (3 arguments will be popped, 1 result will be pushed) |
Implements isc::dhcp::Token.
Definition at line 876 of file token.cc.
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::dhcp::Pkt::getLabel(), isc_throw, and LOG_DEBUG.