20 typedef boost::shared_ptr<Token>
TokenPtr;
78 virtual void evaluate(
Pkt& pkt, ValueStack& values) = 0;
90 static inline bool toBool(std::string value) {
91 if (value ==
"true") {
93 }
else if (value ==
"false") {
97 "\"false\" or \"true\", got \"" << value <<
"\"");
127 void evaluate(
Pkt& pkt, ValueStack& values);
152 void evaluate(
Pkt& pkt, ValueStack& values);
203 void evaluate(
Pkt& pkt, ValueStack& values);
224 void evaluate(
Pkt& pkt, ValueStack& values);
242 void evaluate(
Pkt& pkt, ValueStack& values);
260 void evaluate(
Pkt& pkt, ValueStack& values);
278 void evaluate(
Pkt& pkt, ValueStack& values);
296 void evaluate(
Pkt& pkt, ValueStack& values);
314 void evaluate(
Pkt& pkt, ValueStack& values);
332 void evaluate(
Pkt& pkt, ValueStack& values);
368 : option_code_(option_code), representation_type_(rep_type) {}
378 void evaluate(
Pkt& pkt, ValueStack& values);
387 return (option_code_);
397 return (representation_type_);
418 virtual std::string pushFailure(ValueStack& values);
477 :
TokenOption(option_code, rep_type), nest_level_(nest_level) {}
487 return (nest_level_);
531 void evaluate(
Pkt& pkt, ValueStack& values);
588 void evaluate(
Pkt& pkt, ValueStack& values);
634 void evaluate(
Pkt& pkt, ValueStack& values);
679 : nest_level_(nest_level), type_(type) {}
688 void evaluate(
Pkt& pkt, ValueStack& values);
698 return (nest_level_);
738 void evaluate(
Pkt& pkt, ValueStack& values);
795 void evaluate(
Pkt& pkt, ValueStack& values);
839 void evaluate(
Pkt& pkt, ValueStack& values);
863 void evaluate(
Pkt& pkt, ValueStack& values);
894 void evaluate(
Pkt& pkt, ValueStack& values);
933 void evaluate(
Pkt& pkt, ValueStack& values);
958 void evaluate(
Pkt& pkt, ValueStack& values);
983 void evaluate(
Pkt& pkt, ValueStack& values);
1008 void evaluate(
Pkt& pkt, ValueStack& values);
1020 :client_class_(client_class){
1028 void evaluate(
Pkt& pkt, ValueStack& values);
1037 return (client_class_);
1090 uint16_t option_code = 0);
1097 uint32_t getVendorId()
const;
1128 virtual void evaluate(
Pkt& pkt, ValueStack& values);
1191 uint16_t index = 0);
1197 uint16_t getDataIndex()
const;
1224 void evaluate(
Pkt& pkt, ValueStack& values);
1260 const uint16_t sub_option_code,
1262 :
TokenOption(option_code, rep_type), sub_option_code_(sub_option_code) {}
1275 virtual void evaluate(
Pkt& pkt, ValueStack& values);
1284 return (sub_option_code_);
TokenConcat()
Constructor (does nothing)
uint32_t vendor_id_
Enterprise-id value.
Token representing a 16 bit unsigned integer as a string.
Token that represents fields of DHCPv6 packet.
TokenMember(const std::string &client_class)
Constructor.
uint16_t sub_option_code_
Code of the sub-option to be extracted.
TokenRelay6Option(const int8_t nest_level, const uint16_t option_code, const RepresentationType &rep_type)
Constructor that takes a nesting level and an option code as parameters.
int8_t getNest() const
Returns nest-level.
The order where Token subtypes are declared should be:
Token representing a 32 bit integer as a string.
MetadataType getType()
Returns metadata type.
Token that represents meta data of a DHCP packet.
std::string value_
< Constant value (empty string if the IP address cannot be converted)
TokenEqual()
Constructor (does nothing)
Token that represents concat operator (concatenates two other tokens)
std::string value_
Constant value.
uint16_t option_code_
Code of the option to be extracted.
If this token fetches a suboption, not a field.
FieldType type_
field to get
FieldType
enum value that determines the field.
Base class for classes representing DHCP messages.
boost::shared_ptr< Option > OptionPtr
TokenIpAddressToText()
Constructor (does nothing)
Token that converts to hexadecimal string.
Universe
defines option universe DHCPv4 or DHCPv6
FieldType
Specifies a field of the vendor option.
FieldType
enum value that determines the field.
Token that represents logical negation operator.
FieldType getType()
Returns field type.
ClientClass client_class_
The client class name.
TokenInt16ToText()
Constructor (does nothing)
Token representing an 8 bit unsigned integer as a string.
Token that represents an alternative.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
TokenPkt(const MetadataType type)
Constructor (does nothing)
Token representing a constant string in hexadecimal format.
TokenPkt4(const FieldType type)
Constructor (does nothing)
MetadataType
enum value that determines the field.
TokenSubOption(const uint16_t option_code, const uint16_t sub_option_code, const RepresentationType &rep_type)
Constructor that takes an option and sub-option codes as parameter.
Token that represents logical or operator.
Token that represents a value of a field within a DHCPv6 relay encapsulation.
Token that represents sub-options in DHCPv4 and DHCPv6.
uint16_t getCode() const
Returns option-code.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
TokenUInt16ToText()
Constructor (does nothing)
Base class for all tokens.
boost::shared_ptr< Token > TokenPtr
Pointer to a single Token.
Option::Universe universe_
Universe (V4 or V6)
Token that represents logical and operator.
TokenUInt8ToText()
Constructor (does nothing)
TokenOption(const uint16_t option_code, const RepresentationType &rep_type)
Constructor that takes an option code as a parameter.
TokenUInt32ToText()
Constructor (does nothing)
uint32_t int_value_
value as integer (stored for testing only)
enterprise-id field (vendor-info, vendor-class)
TokenOr()
Constructor (does nothing)
std::stack< std::string > ValueStack
Evaluated values are stored as a stack of strings.
std::string value_
Constant value.
static bool toBool(std::string value)
Coverts a (string) value to a boolean.
RepresentationType getRepresentation() const
Returns representation-type.
EvalBadStack(const char *file, size_t line, const char *what)
chaddr field (up to 16 bytes link-layer address)
Represents a sub-option inserted by the DHCPv4 relay.
Token that represents a value of an option.
Token representing an IP address as a constant string.
Token representing an IP address as a string.
htype (hardware address type)
virtual ~Token()
Virtual destructor.
uint16_t getSubCode() const
Returns sub-option-code.
TokenNot()
Constructor (does nothing)
TokenSubstring()
Constructor (does nothing)
message type (not really a field, content of option 53)
TokenSplit()
Constructor (does nothing)
Token that represents vendor class options in DHCPv4 and DHCPv6.
TokenInt32ToText()
Constructor (does nothing)
uint32_t getInteger() const
Returns integer value.
Token that represents fields of a DHCPv4 packet.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-lfc.
std::vector< TokenPtr > Expression
This is a structure that holds an expression converted to RPN.
TokenInt8ToText()
Constructor (does nothing)
TokenIfElse()
Constructor (does nothing)
EvalTypeError(const char *file, size_t line, const char *what)
Token that represents equality operator (compares two other tokens)
RepresentationType
Token representation type.
TokenAnd()
Constructor (does nothing)
EvalBadStack is thrown when more or less parameters are on the stack than expected.
TokenToHexString()
Constructor (does nothing)
TokenPkt6(const FieldType type)
Constructor (does nothing)
TokenString(const std::string &str)
Value is set during token construction.
Token that represents the substring operator (returns a portion of the supplied string) ...
Peer address field (IPv6 address)
const ClientClass & getClientClass() const
Returns client class name.
RepresentationType representation_type_
Representation type.
Token representing a 32 bit unsigned integer as a string.
FieldType
enum value that determines the field.
FieldType getType()
Returns field type.
EvalTypeError is thrown when a value on the stack has a content with an unexpected type...
uint16_t index_
Data chunk index.
FieldType getType()
Returns field type.
std::string ClientClass
Defines a single class name.
int8_t nest_level_
nesting level of the relay block to use
TokenRelay6Field(const int8_t nest_level, const FieldType type)
Constructor that takes a nesting level and field type as parameters.
Token representing a 16 bit integer as a string.
int8_t nest_level_
Specifies field of the DHCPv6 relay option to get.
hlen (hardware address length)
int8_t getNest() const
Returns nest-level.
boost::shared_ptr< Expression > ExpressionPtr
Token representing an 8 bit integer as a string.
Token that represents a value of an option within a DHCPv6 relay encapsulation.
Token that represents client class membership.
Token that represents vendor options in DHCPv4 and DHCPv6.
Token representing an unsigned 32 bit integer.
FieldType field_
Specifies which field should be accessed.