Kea: token.h Source File

| Kea 1.5.0

token.h
Go to the documentation of this file.
1 // Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7 #ifndef TOKEN_H
8 #define TOKEN_H
9
10 #include <exceptions/exceptions.h>
11 #include <dhcp/pkt.h>
12 #include <stack>
13
14 namespace isc {
15 namespace dhcp {
16
17 class Token;
18
20 typedef boost::shared_ptr<Token> TokenPtr;
21
28 typedef std::vector<TokenPtr> Expression;
29
30 typedef boost::shared_ptr<Expression> ExpressionPtr;
31
33 typedef std::stack<std::string> ValueStack;
34
37 class EvalBadStack : public Exception {
38 public:
39 EvalBadStack(const char* file, size_t line, const char* what) :
40 isc::Exception(file, line, what) { };
41 };
42
45 class EvalTypeError : public Exception {
46 public:
47 EvalTypeError(const char* file, size_t line, const char* what) :
48 isc::Exception(file, line, what) { };
49 };
50
51
63 class Token {
64 public:
65
78 virtual void evaluate(Pkt& pkt, ValueStack& values) = 0;
79
81 virtual ~Token() {}
82
90 static inline bool toBool(std::string value) {
91 if (value == "true") {
92 return (true);
93 } else if (value == "false") {
94 return (false);
95 } else {
96 isc_throw(EvalTypeError, "Incorrect boolean. Expected exactly "
97 "\"false\" or \"true\", got \"" << value << "\"");
98 }
99 }
100 };
101
109
114 class TokenString : public Token {
115 public:
119 TokenString(const std::string& str)
120 :value_(str){
121 }
122
127 void evaluate(Pkt& pkt, ValueStack& values);
128
129 protected:
130 std::string value_;
131 };
132
137 class TokenHexString : public Token {
138 public:
144 TokenHexString(const std::string& str);
145
152 void evaluate(Pkt& pkt, ValueStack& values);
153
154 protected:
155 std::string value_;
156 };
157
164 class TokenInteger : public TokenString {
165 public:
172 TokenInteger(const uint32_t value);
173
179 uint32_t getInteger() const {
180 return (int_value_);
181 }
182
183 protected:
184 uint32_t int_value_;
185 };
186
191 class TokenIpAddress : public Token {
192 public:
196 TokenIpAddress(const std::string& addr);
197
203 void evaluate(Pkt& pkt, ValueStack& values);
204
205 protected:
207 std::string value_;
208 };
209
219 class TokenOption : public Token {
220 public:
221
229 enum RepresentationType {
230 TEXTUAL,
231 HEXADECIMAL,
232 EXISTS
233 };
234
243 TokenOption(const uint16_t option_code, const RepresentationType& rep_type)
244 : option_code_(option_code), representation_type_(rep_type) {}
245
254 void evaluate(Pkt& pkt, ValueStack& values);
255
262 uint16_t getCode() const {
263 return (option_code_);
264 }
265
272 RepresentationType getRepresentation() const {
273 return (representation_type_);
274 }
275
276 protected:
286 virtual OptionPtr getOption(Pkt& pkt);
287
294 virtual std::string pushFailure(ValueStack& values);
295
296 uint16_t option_code_;
297 RepresentationType representation_type_;
298 };
299
311 class TokenRelay4Option : public TokenOption {
312 public:
313
318 TokenRelay4Option(const uint16_t option_code,
319 const RepresentationType& rep_type);
320
321 protected:
325 virtual OptionPtr getOption(Pkt& pkt);
326 };
327
343 class TokenRelay6Option : public TokenOption {
344 public:
351 TokenRelay6Option(const int8_t nest_level, const uint16_t option_code,
352 const RepresentationType& rep_type)
353 :TokenOption(option_code, rep_type), nest_level_(nest_level) {}
354
362 int8_t getNest() const {
363 return (nest_level_);
364 }
365
366 protected:
370 virtual OptionPtr getOption(Pkt& pkt);
371
372 int8_t nest_level_;
373 };
374
385 class TokenPkt : public Token {
386 public:
387
389 enum MetadataType {
390 IFACE,
391 SRC,
392 DST,
393 LEN
394 };
395
397 TokenPkt(const MetadataType type)
398 : type_(type) {}
399
407 void evaluate(Pkt& pkt, ValueStack& values);
408
413 MetadataType getType() {
414 return (type_);
415 }
416
417 private:
419 MetadataType type_;
420 };
421
435 class TokenPkt4 : public Token {
436 public:
437
439 enum FieldType {
440 CHADDR,
441 GIADDR,
442 CIADDR,
443 YIADDR,
444 SIADDR,
445 HLEN,
446 HTYPE,
447 MSGTYPE,
448 TRANSID,
449 };
450
452 TokenPkt4(const FieldType type)
453 : type_(type) {}
454
464 void evaluate(Pkt& pkt, ValueStack& values);
465
470 FieldType getType() {
471 return (type_);
472 }
473
474 private:
476 FieldType type_;
477 };
478
489 class TokenPkt6 : public Token {
490 public:
492 enum FieldType {
493 MSGTYPE,
494 TRANSID
495 };
496
498 TokenPkt6(const FieldType type)
499 : type_(type) {}
500
510 void evaluate(Pkt& pkt, ValueStack& values);
511
516 FieldType getType() {
517 return(type_);
518 }
519
520 private:
522 FieldType type_;
523 };
524
540 class TokenRelay6Field : public Token {
541 public:
542
544 enum FieldType {
545 PEERADDR,
546 LINKADDR
547 };
548
554 TokenRelay6Field(const int8_t nest_level, const FieldType type)
555 : nest_level_(nest_level), type_(type) {}
556
564 void evaluate(Pkt& pkt, ValueStack& values);
565
573 int8_t getNest() const {
574 return (nest_level_);
575 }
576
583 FieldType getType() {
584 return (type_);
585 }
586
587 protected:
589 int8_t nest_level_;
590 FieldType type_;
591 };
592
597 class TokenEqual : public Token {
598 public:
600 TokenEqual() {}
601
614 void evaluate(Pkt& pkt, ValueStack& values);
615 };
616
622 class TokenSubstring : public Token {
623 public:
625 TokenSubstring() {}
626
671 void evaluate(Pkt& pkt, ValueStack& values);
672 };
673
678 class TokenConcat : public Token {
679 public:
681 TokenConcat() {}
682
694 void evaluate(Pkt& pkt, ValueStack& values);
695 };
696
706 class TokenIfElse : public Token {
707 public:
709 TokenIfElse() { }
710
725 void evaluate(Pkt& pkt, ValueStack& values);
726 };
727
736 class TokenToHexString : public Token {
737 public:
739 TokenToHexString() { }
740
764 void evaluate(Pkt& pkt, ValueStack& values);
765 };
766
771 class TokenNot : public Token {
772 public:
774 TokenNot() {}
775
789 void evaluate(Pkt& pkt, ValueStack& values);
790 };
791
795 class TokenAnd : public Token {
796 public:
798 TokenAnd() {}
799
814 void evaluate(Pkt& pkt, ValueStack& values);
815 };
816
820 class TokenOr : public Token {
821 public:
823 TokenOr() {}
824
839 void evaluate(Pkt& pkt, ValueStack& values);
840 };
841
845 class TokenMember : public Token {
846 public:
850 TokenMember(const std::string& client_class)
851 :client_class_(client_class){
852 }
853
859 void evaluate(Pkt& pkt, ValueStack& values);
860
867 const ClientClass& getClientClass() const {
868 return (client_class_);
869 }
870
871 protected:
873 ClientClass client_class_;
874 };
875
890 class TokenVendor : public TokenOption {
891 public:
892
894 enum FieldType {
895 SUBOPTION,
896 ENTERPRISE_ID,
897 EXISTS,
898 DATA
899 };
900
906 TokenVendor(Option::Universe u, uint32_t vendor_id, FieldType field);
907
908
920 TokenVendor(Option::Universe u, uint32_t vendor_id, RepresentationType repr,
921 uint16_t option_code = 0);
922
928 uint32_t getVendorId() const;
929
935 FieldType getField() const;
936
959 virtual void evaluate(Pkt& pkt, ValueStack& values);
960
961 protected:
970 virtual OptionPtr getOption(Pkt& pkt);
971
976 Option::Universe universe_;
977
982 uint32_t vendor_id_;
983
985 FieldType field_;
986 };
987
1005 class TokenVendorClass : public TokenVendor {
1006 public:
1007
1013 TokenVendorClass(Option::Universe u, uint32_t vendor_id, RepresentationType repr);
1014
1021 TokenVendorClass(Option::Universe u, uint32_t vendor_id, FieldType field,
1022 uint16_t index = 0);
1023
1028 uint16_t getDataIndex() const;
1029
1030 protected:
1031
1055 void evaluate(Pkt& pkt, ValueStack& values);
1056
1058 uint16_t index_;
1059 };
1060
1061 }; // end of isc::dhcp namespace
1062 }; // end of isc namespace
1063
1064 #endif
isc::dhcp::TokenVendorClass
Token that represents vendor class options in DHCPv4 and DHCPv6.
Definition: token.h:1005
isc::dhcp::TokenPkt::MetadataType
MetadataType
enum value that determines the field.
Definition: token.h:389
isc::dhcp::TokenToHexString
Token that converts to hexadecimal string.
Definition: token.h:736
isc::dhcp::TokenVendor::getField
FieldType getField() const
Returns field.
Definition: token.cc:780
isc::dhcp::TokenVendor::SUBOPTION
@ SUBOPTION
If this token fetches a suboption, not a field.
Definition: token.h:895
isc::dhcp::TokenVendor::getOption
virtual OptionPtr getOption(Pkt &pkt)
Attempts to get a suboption.
Definition: token.cc:853
isc::dhcp::TokenIfElse::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Alternative.
Definition: token.cc:599
isc::dhcp::TokenSubstring::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Extract a substring from a string.
Definition: token.cc:480
isc::dhcp::ExpressionPtr
boost::shared_ptr< Expression > ExpressionPtr
Definition: token.h:30
isc::dhcp::TokenIpAddress
Token representing an IP address as a constant string.
Definition: token.h:191
isc::dhcp::TokenMember::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (check if client_class_ was added to packet client classes)
Definition: token.cc:747
isc::dhcp::TokenString::TokenString
TokenString(const std::string &str)
Value is set during token construction.
Definition: token.h:119
isc::dhcp::Expression
std::vector< TokenPtr > Expression
This is a structure that holds an expression converted to RPN.
Definition: token.h:28
isc::dhcp::TokenConcat::TokenConcat
TokenConcat()
Constructor (does nothing)
Definition: token.h:681
isc::dhcp::TokenNot::TokenNot
TokenNot()
Constructor (does nothing)
Definition: token.h:774
isc::dhcp::TokenOr
Token that represents logical or operator.
Definition: token.h:820
isc::dhcp::TokenMember
Token that represents client class membership.
Definition: token.h:845
isc::dhcp::TokenOption::EXISTS
@ EXISTS
Definition: token.h:232
isc::dhcp::TokenPkt4::SIADDR
@ SIADDR
siaddr (IPv4 address)
Definition: token.h:444
isc::dhcp::TokenRelay6Field::type_
FieldType type_
field to get
Definition: token.h:590
isc::dhcp::TokenOption::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Evaluates the values of the option.
Definition: token.cc:112
isc::dhcp::Token
Base class for all tokens.
Definition: token.h:63
isc::dhcp::TokenPkt6::TRANSID
@ TRANSID
transaction id (integer but manipulated as a string)
Definition: token.h:494
isc::dhcp::TokenIfElse::TokenIfElse
TokenIfElse()
Constructor (does nothing)
Definition: token.h:709
isc::dhcp::TokenPkt
Token that represents meta data of a DHCP packet.
Definition: token.h:385
isc::dhcp::TokenPkt::SRC
@ SRC
source (IP address)
Definition: token.h:391
isc::dhcp::TokenOption::getOption
virtual OptionPtr getOption(Pkt &pkt)
Attempts to retrieve an option.
Definition: token.cc:107
isc::dhcp::TokenVendorClass::TokenVendorClass
TokenVendorClass(Option::Universe u, uint32_t vendor_id, RepresentationType repr)
This constructor is used to access fields.
Definition: token.cc:875
isc::dhcp::TokenPkt6::FieldType
FieldType
enum value that determines the field.
Definition: token.h:492
isc::dhcp::TokenString::value_
std::string value_
Constant value.
Definition: token.h:130
isc::dhcp::TokenOption::getCode
uint16_t getCode() const
Returns option-code.
Definition: token.h:262
isc::dhcp::TokenVendor::evaluate
virtual void evaluate(Pkt &pkt, ValueStack &values)
This is a method for evaluating a packet.
Definition: token.cc:784
isc::dhcp::TokenRelay6Field::FieldType
FieldType
enum value that determines the field.
Definition: token.h:544
isc::dhcp::TokenPkt4::CIADDR
@ CIADDR
ciaddr (IPv4 address)
Definition: token.h:442
isc::dhcp::TokenIfElse
Token that represents an alternative.
Definition: token.h:706
isc::dhcp::TokenNot::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Logical negation.
Definition: token.cc:668
isc::dhcp::TokenRelay6Field::PEERADDR
@ PEERADDR
Peer address field (IPv6 address)
Definition: token.h:545
isc::dhcp::TokenPkt4::GIADDR
@ GIADDR
giaddr (IPv4 address)
Definition: token.h:441
isc::dhcp::TokenPtr
boost::shared_ptr< Token > TokenPtr
Pointer to a single Token.
Definition: token.h:17
isc::dhcp::TokenOr::TokenOr
TokenOr()
Constructor (does nothing)
Definition: token.h:823
isc::dhcp::TokenOption
Token that represents a value of an option.
Definition: token.h:219
isc::dhcp::TokenPkt4::CHADDR
@ CHADDR
chaddr field (up to 16 bytes link-layer address)
Definition: token.h:440
isc::dhcp::TokenEqual::TokenEqual
TokenEqual()
Constructor (does nothing)
Definition: token.h:600
isc::dhcp::TokenHexString::TokenHexString
TokenHexString(const std::string &str)
Value is set during token construction.
Definition: token.cc:43
isc::dhcp::TokenToHexString::TokenToHexString
TokenToHexString()
Constructor (does nothing)
Definition: token.h:739
isc::dhcp::TokenRelay6Field::LINKADDR
@ LINKADDR
Link address field (IPv6 address)
Definition: token.h:546
isc::dhcp::TokenNot
Token that represents logical negation operator.
Definition: token.h:771
isc::dhcp::TokenPkt::IFACE
@ IFACE
interface name (string)
Definition: token.h:390
isc::dhcp::TokenRelay6Field::TokenRelay6Field
TokenRelay6Field(const int8_t nest_level, const FieldType type)
Constructor that takes a nesting level and field type as parameters.
Definition: token.h:554
isc::dhcp::TokenVendorClass::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
This is a method for evaluating a packet.
Definition: token.cc:891
isc::dhcp::TokenIpAddress::TokenIpAddress
TokenIpAddress(const std::string &addr)
Value is set during token construction.
Definition: token.cc:81
isc::dhcp::TokenVendor::TokenVendor
TokenVendor(Option::Universe u, uint32_t vendor_id, FieldType field)
Constructor used for accessing a field.
Definition: token.cc:767
isc::dhcp::TokenRelay6Field
Token that represents a value of a field within a DHCPv6 relay encapsulation.
Definition: token.h:540
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition: exceptions/exceptions.h:23
isc::dhcp::TokenRelay4Option::getOption
virtual OptionPtr getOption(Pkt &pkt)
Attempts to obtain specified sub-option of option 82 from the packet.
Definition: token.cc:164
isc::dhcp::TokenVendor::ENTERPRISE_ID
@ ENTERPRISE_ID
enterprise-id field (vendor-info, vendor-class)
Definition: token.h:896
isc::dhcp::TokenPkt::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Gets a value from the specified packet.
Definition: token.cc:213
isc::dhcp::TokenConcat
Token that represents concat operator (concatenates two other tokens)
Definition: token.h:678
isc::dhcp::TokenPkt6
Token that represents fields of DHCPv6 packet.
Definition: token.h:489
isc::dhcp::TokenIpAddress::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the constant string on the stack after decoding)
Definition: token.cc:97
isc
Defines the logger used by the top-level component of kea-dhcp-ddns.
Definition: agent_parser.cc:144
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition: exceptions/exceptions.cc:32
isc::dhcp::TokenSubstring
Token that represents the substring operator (returns a portion of the supplied string)
Definition: token.h:622
isc::dhcp::TokenRelay4Option
Represents a sub-option inserted by the DHCPv4 relay.
Definition: token.h:311
isc_throw
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Definition: exceptions/exceptions.h:192
isc::dhcp::TokenVendor::getVendorId
uint32_t getVendorId() const
Returns enterprise-id.
Definition: token.cc:776
isc::dhcp::TokenRelay4Option::TokenRelay4Option
TokenRelay4Option(const uint16_t option_code, const RepresentationType &rep_type)
Constructor for extracting sub-option from RAI (option 82)
Definition: token.cc:159
isc::dhcp::TokenOption::TokenOption
TokenOption(const uint16_t option_code, const RepresentationType &rep_type)
Constructor that takes an option code as a parameter.
Definition: token.h:243
isc::dhcp::TokenVendor::FieldType
FieldType
Specifies a field of the vendor option.
Definition: token.h:894
isc::dhcp::EvalTypeError::EvalTypeError
EvalTypeError(const char *file, size_t line, const char *what)
Definition: token.h:47
isc::dhcp::TokenPkt::getType
MetadataType getType()
Returns metadata type.
Definition: token.h:413
isc::dhcp::TokenMember::client_class_
ClientClass client_class_
The client class name.
Definition: token.h:873
isc::dhcp::TokenOption::option_code_
uint16_t option_code_
Code of the option to be extracted.
Definition: token.h:296
isc::dhcp::TokenAnd
Token that represents logical and operator.
Definition: token.h:795
isc::dhcp::TokenInteger::getInteger
uint32_t getInteger() const
Returns integer value.
Definition: token.h:179
isc::dhcp::TokenPkt4::getType
FieldType getType()
Returns field type.
Definition: token.h:470
isc::dhcp::Pkt
Base class for classes representing DHCP messages.
Definition: pkt.h:90
isc::dhcp::EvalTypeError
EvalTypeError is thrown when a value on the stack has a content with an unexpected type.
Definition: token.h:45
isc::dhcp::Token::~Token
virtual ~Token()
Virtual destructor.
Definition: token.h:81
pkt.h
isc::dhcp::TokenString::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the constant string on the stack)
Definition: token.cc:34
isc::dhcp::TokenMember::getClientClass
const ClientClass & getClientClass() const
Returns client class name.
Definition: token.h:867
isc::dhcp::TokenToHexString::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Convert a binary value to its hexadecimal string representation.
Definition: token.cc:635
isc::dhcp::TokenInteger::TokenInteger
TokenInteger(const uint32_t value)
Integer value set during construction.
Definition: token.cc:984
isc::dhcp::EvalBadStack::EvalBadStack
EvalBadStack(const char *file, size_t line, const char *what)
Definition: token.h:39
isc::dhcp::TokenPkt4::HTYPE
@ HTYPE
htype (hardware address type)
Definition: token.h:446
isc::dhcp::Token::toBool
static bool toBool(std::string value)
Coverts a (string) value to a boolean.
Definition: token.h:90
isc::dhcp::TokenInteger
Token representing an unsigned 32 bit integer.
Definition: token.h:164
isc::dhcp::EvalBadStack
EvalBadStack is thrown when more or less parameters are on the stack than expected.
Definition: token.h:37
isc::dhcp::ValueStack
std::stack< std::string > ValueStack
Evaluated values are stored as a stack of strings.
Definition: token.h:33
isc::dhcp::TokenPkt4::FieldType
FieldType
enum value that determines the field.
Definition: token.h:439
isc::dhcp::TokenEqual::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Compare two values.
Definition: token.cc:455
isc::dhcp::TokenOption::TEXTUAL
@ TEXTUAL
Definition: token.h:230
isc::dhcp::TokenSubstring::TokenSubstring
TokenSubstring()
Constructor (does nothing)
Definition: token.h:625
isc::dhcp::TokenPkt6::TokenPkt6
TokenPkt6(const FieldType type)
Constructor (does nothing)
Definition: token.h:498
isc::dhcp::TokenRelay6Option::getNest
int8_t getNest() const
Returns nest-level.
Definition: token.h:362
isc::dhcp::TokenRelay6Option::nest_level_
int8_t nest_level_
nesting level of the relay block to use
Definition: token.h:372
isc::dhcp::TokenOption::representation_type_
RepresentationType representation_type_
Representation type.
Definition: token.h:297
isc::dhcp::TokenRelay6Field::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Extracts the specified field from the requested relay.
Definition: token.cc:392
isc::dhcp::TokenVendor::field_
FieldType field_
Specifies which field should be accessed.
Definition: token.h:985
isc::dhcp::TokenPkt4::TRANSID
@ TRANSID
transaction-id (xid)
Definition: token.h:448
isc::dhcp::TokenPkt6::getType
FieldType getType()
Returns field type.
Definition: token.h:516
isc::dhcp::TokenVendor::EXISTS
@ EXISTS
vendor[123].exists
Definition: token.h:897
isc::dhcp::TokenRelay6Field::getNest
int8_t getNest() const
Returns nest-level.
Definition: token.h:573
isc::dhcp::TokenPkt4::HLEN
@ HLEN
hlen (hardware address length)
Definition: token.h:445
isc::dhcp::Token::evaluate
virtual void evaluate(Pkt &pkt, ValueStack &values)=0
This is a generic method for evaluating a packet.
isc::dhcp::TokenPkt4::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Gets a value from the specified packet.
Definition: token.cc:265
isc::dhcp::TokenVendor::vendor_id_
uint32_t vendor_id_
Enterprise-id value.
Definition: token.h:982
isc::dhcp::TokenOption::pushFailure
virtual std::string pushFailure(ValueStack &values)
Auxiliary method that puts string representing a failure.
Definition: token.cc:150
isc::dhcp::TokenHexString
Token representing a constant string in hexadecimal format.
Definition: token.h:137
isc::dhcp::ClientClass
std::string ClientClass
Defines a single class name.
Definition: classify.h:37
isc::dhcp::TokenPkt::DST
@ DST
destination (IP address)
Definition: token.h:392
isc::dhcp::TokenMember::TokenMember
TokenMember(const std::string &client_class)
Constructor.
Definition: token.h:850
isc::dhcp::TokenOr::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Logical or.
Definition: token.cc:719
isc::dhcp::TokenPkt4::TokenPkt4
TokenPkt4(const FieldType type)
Constructor (does nothing)
Definition: token.h:452
isc::dhcp::TokenIpAddress::value_
std::string value_
< Constant value (empty string if the IP address cannot be converted)
Definition: token.h:207
isc::dhcp::OptionPtr
boost::shared_ptr< Option > OptionPtr
Definition: option.h:37
isc::dhcp::TokenVendor::universe_
Option::Universe universe_
Universe (V4 or V6)
Definition: token.h:976
exceptions.h
isc::dhcp::TokenPkt4::MSGTYPE
@ MSGTYPE
message type (not really a field, content of option 53)
Definition: token.h:447
isc::dhcp::TokenVendorClass::getDataIndex
uint16_t getDataIndex() const
Returns data index.
Definition: token.cc:887
isc::dhcp::TokenVendor::DATA
@ DATA
data chunk, used in derived vendor-class only
Definition: token.h:898
isc::dhcp::TokenVendorClass::index_
uint16_t index_
Data chunk index.
Definition: token.h:1058
isc::dhcp::TokenPkt4
Token that represents fields of a DHCPv4 packet.
Definition: token.h:435
isc::dhcp::TokenRelay6Field::nest_level_
int8_t nest_level_
Specifies field of the DHCPv6 relay option to get.
Definition: token.h:589
isc::dhcp::TokenOption::HEXADECIMAL
@ HEXADECIMAL
Definition: token.h:231
isc::dhcp::Option::Universe
Universe
defines option universe DHCPv4 or DHCPv6
Definition: option.h:67
isc::dhcp::TokenString
The order where Token subtypes are declared should be:
Definition: token.h:114
isc::dhcp::TokenHexString::value_
std::string value_
Constant value.
Definition: token.h:155
isc::dhcp::TokenRelay6Option
Token that represents a value of an option within a DHCPv6 relay encapsulation.
Definition: token.h:343
isc::dhcp::TokenAnd::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Logical and.
Definition: token.cc:691
isc::dhcp::TokenPkt::LEN
@ LEN
length (4 octets)
Definition: token.h:393
isc::dhcp::TokenRelay6Option::getOption
virtual OptionPtr getOption(Pkt &pkt)
Attempts to obtain specified option from the specified relay block.
Definition: token.cc:176
isc::dhcp::TokenEqual
Token that represents equality operator (compares two other tokens)
Definition: token.h:597
isc::dhcp::TokenConcat::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Concatenate two values.
Definition: token.cc:576
isc::dhcp::TokenPkt::TokenPkt
TokenPkt(const MetadataType type)
Constructor (does nothing)
Definition: token.h:397
isc::dhcp::TokenOption::getRepresentation
RepresentationType getRepresentation() const
Returns representation-type.
Definition: token.h:272
isc::dhcp::TokenHexString::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Token evaluation (puts value of the constant string on the stack after decoding or an empty string if...
Definition: token.cc:72
isc::dhcp::TokenOption::RepresentationType
RepresentationType
Token representation type.
Definition: token.h:229
isc::dhcp::TokenInteger::int_value_
uint32_t int_value_
value as integer (stored for testing only)
Definition: token.h:184
isc::dhcp::TokenAnd::TokenAnd
TokenAnd()
Constructor (does nothing)
Definition: token.h:798
isc::dhcp::TokenVendor
Token that represents vendor options in DHCPv4 and DHCPv6.
Definition: token.h:890
isc::dhcp::TokenPkt4::YIADDR
@ YIADDR
yiaddr (IPv4 address)
Definition: token.h:443
isc::dhcp::TokenRelay6Option::TokenRelay6Option
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.
Definition: token.h:351
isc::dhcp::TokenPkt6::MSGTYPE
@ MSGTYPE
msg type
Definition: token.h:493
isc::dhcp::TokenPkt6::evaluate
void evaluate(Pkt &pkt, ValueStack &values)
Gets a value of the specified packet.
Definition: token.cc:351
isc::dhcp::TokenRelay6Field::getType
FieldType getType()
Returns field type.
Definition: token.h:583