20 typedef boost::shared_ptr<Token>
TokenPtr;
90 static inline bool toBool(std::string value) {
91 if (value ==
"true") {
93 }
else if (value ==
"false") {
97 "\"false\" or \"true\", got \"" << value <<
"\"");
921 uint16_t option_code = 0);
1022 uint16_t index = 0);
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.
virtual OptionPtr getOption(Pkt &pkt)
Attempts to get a suboption.
Token that represents fields of DHCPv6 packet.
void evaluate(Pkt &pkt, ValueStack &values)
Alternative.
TokenMember(const std::string &client_class)
Constructor.
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:
uint16_t getDataIndex() const
Returns data index.
void evaluate(Pkt &pkt, ValueStack &values)
Gets a value from the specified packet.
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.
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
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.
Token that represents an alternative.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
FieldType getField() const
Returns field.
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.
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.
void evaluate(Pkt &pkt, ValueStack &values)
This is a method for evaluating a packet.
uint16_t getCode() const
Returns option-code.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
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.
TokenOption(const uint16_t option_code, const RepresentationType &rep_type)
Constructor that takes an option code as a parameter.
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.
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)
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.
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.
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...
uint32_t getInteger() const
Returns integer value.
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)
virtual void evaluate(Pkt &pkt, ValueStack &values)=0
This is a generic method for evaluating a packet.
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.
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.
void evaluate(Pkt &pkt, ValueStack &values)
Convert a binary value to its hexadecimal string representation.
FieldType
enum value that determines the field.
FieldType getType()
Returns field type.
uint32_t getVendorId() const
Returns enterprise-id.
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.
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.
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)
int8_t getNest() const
Returns nest-level.
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 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.