Kea 2.7.5
|
Base class for all tokens. More...
#include <token.h>
Public Member Functions | |
virtual | ~Token () |
Virtual destructor. | |
virtual unsigned | evaluate (Pkt &pkt, ValueStack &values)=0 |
This is a generic method for evaluating a packet. | |
virtual unsigned | getLabel () const |
Return the label of this token. | |
Static Public Member Functions | |
static bool | toBool (std::string value) |
Coverts a (string) value to a boolean. | |
Base class for all tokens.
It provides an interface for all tokens and storage for string representation (all tokens evaluate to string).
This class represents a single token. Examples of a token are:
|
inlinevirtual |
|
pure virtual |
This is a generic method for evaluating a packet.
We need to pass the packet being evaluated and possibly previously evaluated values. Specific implementations may ignore the packet altogether and just put their own value on the stack (constant tokens), look at the packet and put some data extracted from it on the stack (option tokens), or pop arguments from the stack and put back the result (operators).
The parameters passed will be:
pkt | - packet being classified |
values | - stack of values with previously evaluated tokens |
Implemented in isc::dhcp::TokenString, isc::dhcp::TokenHexString, isc::dhcp::TokenLowerCase, isc::dhcp::TokenUpperCase, isc::dhcp::TokenIpAddress, isc::dhcp::TokenIpAddressToText, isc::dhcp::TokenInt8ToText, isc::dhcp::TokenInt16ToText, isc::dhcp::TokenInt32ToText, isc::dhcp::TokenUInt8ToText, isc::dhcp::TokenUInt16ToText, isc::dhcp::TokenUInt32ToText, isc::dhcp::TokenOption, isc::dhcp::TokenPkt, isc::dhcp::TokenPkt4, isc::dhcp::TokenPkt6, isc::dhcp::TokenRelay6Field, isc::dhcp::TokenEqual, isc::dhcp::TokenSubstring, isc::dhcp::TokenSplit, isc::dhcp::TokenConcat, isc::dhcp::TokenIfElse, isc::dhcp::TokenToHexString, isc::dhcp::TokenNot, isc::dhcp::TokenAnd, isc::dhcp::TokenOr, isc::dhcp::TokenMember, isc::dhcp::TokenVendor, isc::dhcp::TokenVendorClass, isc::dhcp::TokenSubOption, isc::dhcp::TokenMatch, isc::dhcp::TokenLabel, isc::dhcp::TokenBranch, isc::dhcp::TokenPopOrBranchTrue, isc::dhcp::TokenPopOrBranchFalse, and isc::dhcp::TokenPopAndBranchFalse.
|
inlinevirtual |
Return the label of this token.
Reimplemented in isc::dhcp::TokenLabel.
|
inlinestatic |
Coverts a (string) value to a boolean.
Only "true" and "false" are expected.
value | the (string) value |
EvalTypeError | when the value is not either "true" or "false". |
Definition at line 105 of file token.h.
References isc_throw.
Referenced by isc::dhcp::TokenIfElse::evaluate(), isc::dhcp::TokenNot::evaluate(), isc::dhcp::TokenAnd::evaluate(), isc::dhcp::TokenOr::evaluate(), isc::dhcp::TokenPopOrBranchTrue::evaluate(), isc::dhcp::TokenPopOrBranchFalse::evaluate(), isc::dhcp::TokenPopAndBranchFalse::evaluate(), and isc::dhcp::evaluateBool().