Kea 2.7.6
|
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::TokenAnd, isc::dhcp::TokenBranch, isc::dhcp::TokenConcat, isc::dhcp::TokenEqual, isc::dhcp::TokenHexString, isc::dhcp::TokenIfElse, isc::dhcp::TokenInt16ToText, isc::dhcp::TokenInt32ToText, isc::dhcp::TokenInt8ToText, isc::dhcp::TokenIpAddress, isc::dhcp::TokenIpAddressToText, isc::dhcp::TokenLabel, isc::dhcp::TokenLowerCase, isc::dhcp::TokenMatch, isc::dhcp::TokenMember, isc::dhcp::TokenNot, isc::dhcp::TokenOption, isc::dhcp::TokenOr, isc::dhcp::TokenPkt4, isc::dhcp::TokenPkt6, isc::dhcp::TokenPkt, isc::dhcp::TokenPopAndBranchFalse, isc::dhcp::TokenPopOrBranchFalse, isc::dhcp::TokenPopOrBranchTrue, isc::dhcp::TokenRelay6Field, isc::dhcp::TokenSplit, isc::dhcp::TokenString, isc::dhcp::TokenSubOption, isc::dhcp::TokenSubstring, isc::dhcp::TokenToHexString, isc::dhcp::TokenUInt16ToText, isc::dhcp::TokenUInt32ToText, isc::dhcp::TokenUInt8ToText, isc::dhcp::TokenUpperCase, isc::dhcp::TokenVendor, and isc::dhcp::TokenVendorClass.
|
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::TokenAnd::evaluate(), isc::dhcp::TokenIfElse::evaluate(), isc::dhcp::TokenNot::evaluate(), isc::dhcp::TokenOr::evaluate(), isc::dhcp::TokenPopAndBranchFalse::evaluate(), isc::dhcp::TokenPopOrBranchFalse::evaluate(), isc::dhcp::TokenPopOrBranchTrue::evaluate(), and isc::dhcp::evaluateBool().