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 <<
"\"");
418 virtual std::string
pushFailure(ValueStack& values);
1046 uint16_t option_code = 0);
1084 virtual void evaluate(
Pkt& pkt, ValueStack& values);
1147 uint16_t index = 0);
1211 const uint16_t sub_option_code,
1226 virtual void evaluate(
Pkt& pkt, ValueStack& values);
data chunk, used in derived vendor-class only
TokenConcat()
Constructor (does nothing)
void evaluate(Pkt &pkt, ValueStack &values)
Logical negation.
uint32_t vendor_id_
Enterprise-id value.
Token representing a 16 bit unsigned integer as a string.
virtual OptionPtr getOption(Pkt &pkt)
Attempts to get a suboption.
Token that represents fields of DHCPv6 packet.
const ClientClass & getClientClass() const
Returns client class name.
void evaluate(Pkt &pkt, ValueStack &values)
Alternative.
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.
The order where Token subtypes are declared should be:
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the string on the stack after decoding)
Token representing a 32 bit integer as a string.
void evaluate(Pkt &pkt, ValueStack &values)
Gets a value from the specified packet.
MetadataType getType()
Returns metadata type.
virtual OptionPtr getSubOption(const OptionPtr &parent)
Attempts to retrieve a sub-option.
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.
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the string on the stack after decoding)
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.
RepresentationType getRepresentation() const
Returns representation-type.
void evaluate(Pkt &pkt, ValueStack &values)
Gets a value of the specified packet.
Base class for classes representing DHCP messages.
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (check if client_class_ was added to packet client classes)
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.
Link address field (IPv6 address)
void evaluate(Pkt &pkt, ValueStack &values)
Extracts the specified field from the requested relay.
TokenInt16ToText()
Constructor (does nothing)
Token representing an 8 bit unsigned integer as a string.
Token that represents an alternative.
TokenPkt(const MetadataType type)
Constructor (does nothing)
TokenRelay4Option(const uint16_t option_code, const RepresentationType &rep_type)
Constructor for extracting sub-option from RAI (option 82)
Token representing a constant string in hexadecimal format.
TokenPkt4(const FieldType type)
Constructor (does nothing)
virtual OptionPtr getOption(Pkt &pkt)
Attempts to obtain specified option from the specified relay block.
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.
virtual OptionPtr getOption(Pkt &pkt)
Attempts to retrieve an option.
Token that represents sub-options in DHCPv4 and DHCPv6.
void evaluate(Pkt &pkt, ValueStack &values)
This is a method for evaluating a packet.
#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)
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the string on the stack after decoding)
TokenOption(const uint16_t option_code, const RepresentationType &rep_type)
Constructor that takes an option code as a parameter.
uint32_t getInteger() const
Returns integer value.
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)
TokenInteger(const uint32_t value)
Integer value set during construction.
std::stack< std::string > ValueStack
Evaluated values are stored as a stack of strings.
std::string value_
Constant value.
uint16_t getCode() const
Returns option-code.
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the string on the stack after decoding)
static bool toBool(std::string value)
Coverts a (string) value to a boolean.
virtual void evaluate(Pkt &pkt, ValueStack &values)
This is a method for evaluating a packet.
EvalBadStack(const char *file, size_t line, const char *what)
void evaluate(Pkt &pkt, ValueStack &values)
Extract a substring from a string.
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 OptionPtr getOption(Pkt &pkt)
Attempts to obtain specified sub-option of option 82 from the packet.
virtual ~Token()
Virtual destructor.
TokenNot()
Constructor (does nothing)
TokenSubstring()
Constructor (does nothing)
virtual std::string pushFailure(ValueStack &values)
Auxiliary method that puts string representing a failure.
message type (not really a field, content of option 53)
void evaluate(Pkt &pkt, ValueStack &values)
Logical and.
FieldType getField() const
Returns field.
Token that represents vendor class options in DHCPv4 and DHCPv6.
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the constant string on the stack after decoding or an empty string if...
TokenInt32ToText()
Constructor (does nothing)
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the string on the stack after decoding)
Token that represents fields of a DHCPv4 packet.
void evaluate(Pkt &pkt, ValueStack &values)
Concatenate two values.
void evaluate(Pkt &pkt, ValueStack &values)
Gets a value from the specified 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-dhcp-ddns.
std::vector< TokenPtr > Expression
This is a structure that holds an expression converted to RPN.
TokenVendor(Option::Universe u, uint32_t vendor_id, FieldType field)
Constructor used for accessing a field.
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the constant string on the stack after decoding)
uint16_t getDataIndex() const
Returns data index.
virtual void evaluate(Pkt &pkt, ValueStack &values)=0
This is a generic method for evaluating a packet.
int8_t getNest() const
Returns nest-level.
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)
void evaluate(Pkt &pkt, ValueStack &values)
Compare two values.
int8_t getNest() const
Returns nest-level.
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)
RepresentationType representation_type_
Representation type.
void evaluate(Pkt &pkt, ValueStack &values)
Convert a binary value to its hexadecimal string representation.
uint32_t getVendorId() const
Returns enterprise-id.
Token representing a 32 bit unsigned integer as a string.
FieldType
enum value that determines the field.
FieldType getType()
Returns field type.
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the string on the stack after decoding)
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the string on the stack after decoding)
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the constant string on the stack)
EvalTypeError is thrown when a value on the stack has a content with an unexpected type...
uint16_t index_
Data chunk index.
uint16_t getSubCode() const
Returns sub-option-code.
void evaluate(Pkt &pkt, ValueStack &values)
Logical or.
TokenIpAddress(const std::string &addr)
Value is set during token construction.
FieldType getType()
Returns field type.
std::string ClientClass
Defines a single class name.
virtual void evaluate(Pkt &pkt, ValueStack &values)
This is a method for evaluating a packet.
TokenHexString(const std::string &str)
Value is set during token construction.
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.
void evaluate(Pkt &pkt, ValueStack &values)
Evaluates the values of the option.
hlen (hardware address length)
boost::shared_ptr< Expression > ExpressionPtr
TokenVendorClass(Option::Universe u, uint32_t vendor_id, RepresentationType repr)
This constructor is used to access fields.
transaction id (integer but manipulated as a string)
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.