Kea 2.7.5
|
Token that converts to hexadecimal string. More...
#include <token.h>
Public Member Functions | |
TokenToHexString () | |
Constructor (does nothing) | |
virtual unsigned | evaluate (Pkt &pkt, ValueStack &values) |
Convert a binary value to its hexadecimal string representation. | |
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. | |
Token that converts to hexadecimal string.
For example in the sub-expression "hexstring(pkt4.mac, ':')" the binary MAC address is converted to its usual hexadecimal representation as a list of (6) pairs of hexadecimal digits separated by colons (':'). Please note the token is named TokenToHexString when the syntax use the hexstring name without a leading "to".
|
inline |
|
virtual |
Convert a binary value to its hexadecimal string representation.
Evaluation does not use packet information. It requires at least two values to be present on the stack. It will consume the top two values on the stack as parameters and push the resulting hexadecimal string onto the stack. From the top it expects the values on the stack as:
binary is the binary value (note it can be any value, i.e. it is not checked to really be not printable). separator is literal for instance '-' or ':'. The empty separator means no separator.
The following example use a binary MAC address 06:ce:8f:55:b3:33:
EvalBadStack | if there are less than 2 values on stack |
pkt | (unused) |
values | - stack of values (2 arguments will be popped, 1 result will be pushed) |
Implements isc::dhcp::Token.
Definition at line 1028 of file token.cc.
References isc::dhcp::EVAL_DBG_STACK, isc::dhcp::EVAL_DEBUG_TOHEXSTRING, isc::dhcp::eval_logger, isc_throw, and LOG_DEBUG.