16 for (
auto it = expr.cbegin(); it != expr.cend(); ) {
17 unsigned label = (*it++)->evaluate(pkt, values);
23 if (it == expr.cend()) {
26 if ((*it++)->getLabel() == label) {
37 if (values.size() != 1) {
39 "1 value at the end of evaluation, got " << values.size());
48 if (values.size() != 1) {
50 "1 value at the end of evaluation, got " << values.size());
52 return (values.top());
EvalBadLabel is thrown when a label can't be found.
EvalBadStack is thrown when more or less parameters are on the stack than expected.
Base class for classes representing DHCP messages.
static bool toBool(std::string value)
Coverts a (string) value to a boolean.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::string evaluateString(const Expression &expr, Pkt &pkt)
Evaluate a RPN expression for a v4 or v6 packet and return a string value.
void evaluateRaw(const Expression &expr, Pkt &pkt, ValueStack &values)
Evaluate a RPN expression for a v4 or v6 packet.
bool evaluateBool(const Expression &expr, Pkt &pkt)
Evaluate a RPN expression for a v4 or v6 packet and return a true or false decision.
std::vector< TokenPtr > Expression
This is a structure that holds an expression converted to RPN.
std::stack< std::string > ValueStack
Evaluated values are stored as a stack of strings.
Defines the logger used by the top-level component of kea-lfc.