2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

[67-expressions-hexa-strings-rebase] Rebased on last master before merge

This commit is contained in:
Francis Dupont
2018-09-19 15:47:33 +02:00
23 changed files with 2012 additions and 1640 deletions

View File

@@ -718,6 +718,7 @@
<row><entry>Concat</entry><entry>concat('foo','bar')</entry><entry>Return the
concatenation of the strings</entry></row>
<row><entry>Ifelse</entry><entry>ifelse('foo' == 'bar','us','them')</entry><entry>Return the branch value according to the condition</entry></row>
<row><entry>Hexstring</entry><entry>hexstring('foo', '-')</entry><entry>Converts the value to a hexadecimal string, e.g. 0a:1b:2c:3e</entry></row>
</tbody>
</tgroup>
</table>
@@ -772,6 +773,16 @@ concatenation of the strings</entry></row>
ifelse(option[230].exists, option[230].hex, 'none')
</screen>
</section>
<section>
<title>Hexstring</title>
The hexstring function "hexstring(binary, separator)" returns
the binary value as its hexadecimal string representation:
pairs of hexadecimal digits separated by the separator, e.g
':', '-', '' (empty separator).
<screen>
hexstring(pkt4.mac, ':')
</screen>
</section>
</section>
<note>

View File

@@ -569,7 +569,7 @@ Please make sure that your compilation has the following:
// the incoming packet or even its metadata (e.g. the interface
// it was received over from)
"name": "Configuration-Token",
"expr": "pkt.iface"
"expr": "hexstring(pkt4.mac,':')"
}
] // End of attributes
} // End of access

View File

@@ -1215,7 +1215,9 @@ $
can be represented as 626174. Alternatively, it can be expressed
as quoted value (using double and single quotes), e.g. "'bar'".
The former is more convenient for printable characters, while hex
string values are more convenient for non-printable characters.
string values are more convenient for non-printable characters
and does not require the use of the <command>hexstring</command>
operator.
</para>
<screen>
"Dhcp6": {

View File

@@ -160,7 +160,9 @@ instantiated with the appropriate value and put onto the expression vector.
- isc::dhcp::TokenSubstring -- represents the substring(text, start, length) operator.
- isc::dhcp::TokenConcat -- represents the concat operator which
concatenate two other tokens.
- isc::dhcp::TokenIfElse == represents the ifelse(cond, iftrue, ifelse) operator.
- isc::dhcp::TokenIfElse -- represents the ifelse(cond, iftrue, ifelse) operator.
- isc::dhcp::TokenToHexString -- represents the hexstring operator which
converts a binary value to its hexadecimal string representation.
- isc::dhcp::TokenNot -- the logical not operator.
- isc::dhcp::TokenAnd -- the logical and (strict) operator.
- isc::dhcp::TokenOr -- the logical or (strict) operator (strict means

View File

@@ -144,6 +144,15 @@ string and an empty result will be pushed onto the stack. The start,
length and string are still popped from the stack and the result is
still pushed. The strings are displayed in hex.
# For use with TokenToHexString
% EVAL_DEBUG_TOHEXSTRING Popping binary value %1 and separator %2, pushing result %3
This debug message indicates that two values are being popped from
the value stack and a result is being pushed onto the value stack.
The values being popped are the binary value to convert and the separator.
The binary value is converted to its hexadecimal string representation
and pushed onto the stack. The binary value is displayed in hex.
% EVAL_DEBUG_VENDOR_CLASS_DATA Data %1 (out of %2 received) in vendor class found, pushing result '%3'
This debug message indicates that vendor class option was found and passed
enterprise-id checks and has sufficient number of data chunks. The total number

View File

@@ -710,8 +710,8 @@ static void yynoreturn yy_fatal_error ( const char* msg );
/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
(yy_c_buf_p) = yy_cp;
/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
#define YY_NUM_RULES 53
#define YY_END_OF_BUFFER 54
#define YY_NUM_RULES 54
#define YY_END_OF_BUFFER 55
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -719,42 +719,44 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static const flex_int16_t yy_acclist[291] =
static const flex_int16_t yy_acclist[298] =
{ 0,
54, 52, 53, 1, 52, 53, 2, 53, 52, 53,
46, 52, 53, 47, 52, 53, 51, 52, 53, 50,
52, 53, 52, 53, 45, 52, 53, 5, 52, 53,
5, 52, 53, 52, 53, 52, 53, 52, 53,16390,
52, 53,16390, 48, 52, 53, 49, 52, 53, 52,
53,16390, 52, 53,16390, 52, 53,16390, 52, 53,
16390, 52, 53,16390, 52, 53,16390, 52, 53,16390,
52, 53,16390, 52, 53,16390, 52, 53,16390, 52,
53,16390, 52, 53,16390, 52, 53,16390, 52, 53,
16390, 52, 53,16390, 52, 53,16390, 52, 53,16390,
55, 53, 54, 1, 53, 54, 2, 54, 53, 54,
47, 53, 54, 48, 53, 54, 52, 53, 54, 51,
53, 54, 53, 54, 46, 53, 54, 5, 53, 54,
5, 53, 54, 53, 54, 53, 54, 53, 54,16390,
53, 54,16390, 49, 53, 54, 50, 53, 54, 53,
54,16390, 53, 54,16390, 53, 54,16390, 53, 54,
16390, 53, 54,16390, 53, 54,16390, 53, 54,16390,
53, 54,16390, 53, 54,16390, 53, 54,16390, 53,
54,16390, 53, 54,16390, 53, 54,16390, 53, 54,
16390, 53, 54,16390, 53, 54,16390, 53, 54,16390,
1, 2, 3, 5, 5, 7, 8,16390,16390, 8198,
16390,16390,16390,16390,16390,16390,16390,16390,16390,16390,
16390,16390,16390,16390,16390,16390,16390,16390,16390,16390,
43,16390,16390,16390,16390,16390,16390,16390,16390,16390,
16390,16390, 4, 7, 38,16390, 42,16390,16390,16390,
44,16390,16390,16390,16390,16390,16390,16390,16390,16390,
16390,16390, 4, 7, 38,16390, 43,16390,16390,16390,
16390, 20,16390,16390,16390,16390, 15,16390,16390,16390,
16390,16390, 21,16390,16390, 23,16390,16390,16390, 41,
16390,16390, 21,16390,16390, 23,16390,16390,16390, 42,
16390,16390,16390, 17,16390,16390,16390, 19,16390,16390,
16390,16390,16390,16390,16390,16390, 35,16390,16390,16390,
16390, 24,16390,16390,16390,16390,16390,16390,16390,16390,
16390,16390, 24,16390,16390,16390,16390,16390,16390,16390,
16390,16390, 22,16390, 30,16390,16390,16390,16390, 14,
16390,16390,16390,16390,16390,16390,16390,16390,16390,16390,
25,16390, 18,16390,16390,16390,16390,16390,16390,16390,
16390,16390,16390,16390,16390,16390, 26,16390, 39,16390,
16390, 16,16390, 27,16390,16390, 40,16390,16390, 45,
16390,16390, 9,16390,16390, 10,16390, 11,16390, 29,
16390,16390,16390, 33,16390, 28,16390, 7,16390,16390,
16390, 31,16390,16390,16390, 32,16390,16390,16390, 13,
16390, 12,16390,16390,16390,16390, 41,16390, 37,16390,
16390, 36,16390,16390,16390, 34,16390
16390, 22,16390, 30,16390,16390,16390,16390, 14,16390,
16390,16390,16390,16390,16390,16390,16390,16390, 25,16390,
18,16390,16390,16390,16390,16390,16390,16390,16390,16390,
16390,16390,16390,16390, 26,16390, 39,16390,16390, 16,
16390, 27,16390, 40,16390,16390, 44,16390,16390, 9,
16390,16390, 10,16390, 11,16390, 29,16390,16390,16390,
33,16390, 28,16390, 7,16390,16390, 31,16390,16390,
16390, 32,16390,16390, 13,16390, 12,16390,16390,16390,
16390, 37,16390,16390, 36,16390,16390,16390, 34,16390
} ;
static const flex_int16_t yy_accept[208] =
static const flex_int16_t yy_accept[214] =
{ 0,
1, 1, 1, 2, 4, 7, 9, 11, 14, 17,
20, 23, 25, 28, 31, 34, 36, 38, 41, 44,
@@ -769,16 +771,17 @@ static const flex_int16_t yy_accept[208] =
159, 160, 161, 162, 163, 165, 166, 168, 169, 170,
172, 173, 174, 176, 177, 178, 180, 181, 182, 183,
184, 185, 185, 186, 187, 189, 190, 191, 192, 194,
195, 196, 197, 198, 199, 200, 201, 202, 204, 206,
207, 208, 209, 211, 212, 213, 214, 214, 215, 216,
217, 218, 219, 221, 223, 224, 225, 226, 227, 228,
229, 230, 231, 232, 233, 234, 235, 235, 237, 239,
240, 242, 244, 246, 247, 249, 250, 252, 253, 255,
257, 259, 260, 261, 263, 265, 266, 267, 268, 270,
271, 272, 274, 274, 275, 277, 279, 280, 281, 282,
184, 185, 185, 186, 187, 189, 190, 191, 192, 193,
195, 196, 197, 198, 199, 200, 201, 202, 203, 205,
207, 208, 209, 210, 212, 213, 214, 215, 215, 216,
217, 218, 219, 220, 221, 223, 225, 226, 227, 228,
229, 230, 231, 232, 233, 234, 235, 236, 237, 237,
239, 241, 242, 244, 246, 247, 249, 250, 252, 253,
255, 256, 258, 260, 262, 263, 264, 266, 268, 269,
270, 271, 272, 274, 275, 276, 278, 278, 279, 280,
284, 285, 287, 288, 289, 291, 291
282, 284, 285, 286, 287, 289, 291, 292, 294, 295,
296, 298, 298
} ;
static const YY_CHAR yy_ec[256] =
@@ -822,107 +825,107 @@ static const YY_CHAR yy_meta[45] =
1, 1, 1, 1
} ;
static const flex_int16_t yy_base[212] =
static const flex_int16_t yy_base[218] =
{ 0,
0, 0, 319, 320, 316, 314, 312, 320, 320, 320,
320, 34, 320, 39, 36, 300, 298, 81, 115, 320,
320, 24, 37, 37, 26, 282, 45, 284, 43, 48,
275, 43, 59, 283, 106, 50, 282, 277, 305, 303,
301, 320, 122, 137, 112, 289, 288, 0, 287, 0,
320, 143, 150, 0, 0, 320, 268, 274, 276, 263,
257, 256, 255, 263, 270, 249, 264, 246, 74, 254,
253, 262, 252, 256, 244, 243, 0, 255, 241, 247,
256, 253, 253, 233, 252, 239, 250, 146, 0, 0,
0, 0, 246, 246, 247, 0, 242, 229, 241, 0,
0, 0, 325, 326, 322, 320, 318, 326, 326, 326,
326, 34, 326, 39, 36, 306, 304, 81, 115, 326,
326, 24, 37, 37, 26, 288, 45, 290, 43, 48,
281, 43, 59, 289, 106, 50, 288, 283, 311, 309,
307, 326, 122, 137, 112, 295, 294, 0, 293, 0,
326, 143, 150, 0, 0, 326, 274, 280, 282, 269,
263, 262, 261, 269, 276, 255, 270, 252, 74, 260,
259, 268, 258, 262, 250, 249, 0, 261, 247, 253,
262, 259, 259, 239, 258, 245, 256, 146, 0, 0,
0, 0, 252, 252, 253, 0, 248, 235, 247, 233,
231, 228, 239, 230, 0, 230, 0, 237, 220, 0,
228, 220, 148, 234, 230, 0, 216, 214, 218, 226,
225, 154, 224, 226, 0, 210, 207, 220, 0, 218,
217, 204, 219, 214, 196, 203, 215, 0, 0, 193,
210, 195, 0, 195, 197, 206, 162, 193, 190, 192,
189, 189, 0, 0, 199, 199, 186, 186, 187, 195,
156, 172, 169, 175, 167, 165, 166, 0, 0, 164,
0, 0, 0, 175, 0, 173, 0, 173, 0, 0,
0, 167, 171, 187, 0, 170, 164, 156, 0, 155,
157, 0, 183, 152, 0, 0, 161, 156, 161, 0,
236, 233, 244, 235, 0, 235, 0, 242, 225, 0,
233, 225, 148, 239, 235, 0, 221, 219, 223, 231,
230, 154, 229, 231, 0, 215, 212, 225, 210, 0,
222, 221, 208, 223, 218, 200, 207, 219, 0, 0,
197, 214, 199, 0, 199, 201, 210, 162, 197, 194,
196, 193, 193, 192, 0, 0, 202, 202, 189, 189,
190, 198, 156, 185, 184, 190, 172, 169, 166, 0,
0, 168, 0, 0, 174, 0, 177, 0, 175, 0,
175, 0, 0, 0, 169, 173, 189, 0, 170, 166,
161, 157, 0, 156, 158, 0, 183, 153, 162, 0,
164, 0, 124, 115, 0, 320, 208, 210, 212, 85,
215
0, 161, 156, 161, 0, 0, 164, 0, 124, 115,
0, 326, 208, 210, 212, 85, 215
} ;
static const flex_int16_t yy_def[212] =
static const flex_int16_t yy_def[218] =
{ 0,
206, 1, 206, 206, 206, 206, 207, 206, 206, 206,
206, 206, 206, 206, 14, 208, 206, 206, 18, 206,
206, 18, 18, 18, 18, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 206, 206,
207, 206, 206, 206, 14, 208, 209, 210, 208, 211,
206, 206, 19, 18, 19, 206, 19, 19, 19, 19,
212, 1, 212, 212, 212, 212, 213, 212, 212, 212,
212, 212, 212, 212, 14, 214, 212, 212, 18, 212,
212, 18, 18, 18, 18, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 212, 212,
213, 212, 212, 212, 14, 214, 215, 216, 214, 217,
212, 212, 19, 18, 19, 212, 19, 19, 19, 19,
18, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 206, 210, 211,
19, 19, 19, 19, 19, 19, 19, 212, 216, 217,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 206, 19, 19, 19, 19, 19, 19, 19, 19,
19, 212, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 206, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 212, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 206, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 212, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 206, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 212, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 0, 206, 206, 206, 206,
206
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 0, 212, 212, 212, 212, 212
} ;
static const flex_int16_t yy_nxt[365] =
static const flex_int16_t yy_nxt[371] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 15, 15, 16, 17, 18, 19, 19, 20,
21, 4, 22, 18, 23, 24, 25, 18, 26, 27,
28, 19, 29, 30, 31, 32, 33, 34, 35, 36,
19, 37, 19, 38, 43, 43, 43, 43, 44, 45,
45, 45, 45, 46, 206, 47, 57, 48, 58, 61,
45, 45, 45, 46, 212, 47, 57, 48, 58, 61,
63, 47, 47, 47, 47, 47, 47, 59, 64, 70,
72, 66, 60, 71, 73, 62, 84, 67, 206, 76,
72, 66, 60, 71, 73, 62, 84, 67, 212, 76,
77, 48, 52, 52, 68, 78, 74, 85, 89, 53,
79, 54, 54, 54, 54, 46, 103, 54, 55, 55,
104, 56, 53, 54, 54, 54, 54, 54, 54, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 206,
206, 55, 43, 43, 43, 43, 81, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 212,
212, 55, 43, 43, 43, 43, 81, 55, 55, 55,
55, 55, 55, 82, 52, 52, 83, 88, 88, 88,
88, 206, 206, 205, 206, 122, 88, 88, 88, 88,
138, 139, 204, 56, 147, 147, 147, 147, 179, 180,
206, 167, 147, 147, 147, 147, 186, 186, 186, 186,
186, 186, 186, 186, 206, 206, 203, 202, 201, 200,
199, 197, 196, 195, 194, 193, 192, 191, 190, 189,
88, 212, 212, 211, 212, 122, 88, 88, 88, 88,
139, 140, 210, 56, 148, 148, 148, 148, 182, 183,
212, 169, 148, 148, 148, 148, 189, 189, 189, 189,
189, 189, 189, 189, 212, 212, 209, 208, 207, 206,
205, 204, 202, 201, 200, 199, 198, 197, 196, 195,
188, 187, 185, 206, 184, 183, 182, 198, 41, 181,
194, 193, 192, 212, 191, 190, 188, 203, 41, 187,
41, 41, 41, 49, 49, 47, 47, 90, 90, 90,
178, 177, 176, 175, 174, 173, 172, 171, 170, 169,
168, 166, 165, 164, 163, 162, 161, 160, 159, 158,
157, 156, 155, 154, 153, 152, 151, 150, 149, 148,
146, 145, 144, 143, 142, 141, 140, 137, 136, 135,
134, 133, 132, 131, 130, 129, 128, 127, 126, 125,
124, 123, 121, 120, 119, 118, 117, 116, 115, 114,
113, 112, 111, 110, 109, 108, 107, 106, 105, 102,
101, 100, 99, 98, 97, 96, 95, 94, 93, 92,
186, 185, 184, 181, 180, 179, 178, 177, 176, 175,
174, 173, 172, 171, 170, 168, 167, 166, 165, 164,
163, 162, 161, 160, 159, 158, 157, 156, 155, 154,
153, 152, 151, 150, 149, 147, 146, 145, 144, 143,
142, 141, 138, 137, 136, 135, 134, 133, 132, 131,
130, 129, 128, 127, 126, 125, 124, 123, 121, 120,
119, 118, 117, 116, 115, 114, 113, 112, 111, 110,
109, 108, 107, 106, 105, 102, 101, 100, 99, 98,
91, 50, 46, 50, 42, 40, 39, 87, 86, 80,
75, 69, 65, 51, 50, 42, 40, 39, 206, 3,
206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
206, 206, 206, 206
97, 96, 95, 94, 93, 92, 91, 50, 46, 50,
42, 40, 39, 87, 86, 80, 75, 69, 65, 51,
50, 42, 40, 39, 212, 3, 212, 212, 212, 212,
212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
212, 212, 212, 212, 212, 212, 212, 212, 212, 212
} ;
static const flex_int16_t yy_chk[365] =
static const flex_int16_t yy_chk[371] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -932,7 +935,7 @@ static const flex_int16_t yy_chk[365] =
14, 14, 14, 14, 15, 14, 22, 14, 22, 24,
25, 14, 14, 14, 14, 14, 14, 23, 25, 29,
30, 27, 23, 29, 30, 24, 36, 27, 15, 32,
32, 14, 18, 18, 27, 33, 30, 36, 210, 18,
32, 14, 18, 18, 27, 33, 30, 36, 216, 18,
33, 18, 18, 18, 18, 18, 69, 18, 18, 18,
69, 18, 18, 18, 18, 18, 18, 18, 18, 18,
@@ -940,50 +943,50 @@ static const flex_int16_t yy_chk[365] =
18, 18, 18, 18, 18, 19, 19, 19, 19, 19,
45, 19, 43, 43, 43, 43, 35, 19, 19, 19,
19, 19, 19, 35, 52, 52, 35, 44, 44, 44,
44, 53, 53, 204, 45, 88, 88, 88, 88, 88,
113, 113, 203, 52, 122, 122, 122, 122, 161, 161,
53, 147, 147, 147, 147, 147, 167, 167, 167, 167,
186, 186, 186, 186, 193, 193, 201, 199, 198, 197,
194, 191, 190, 188, 187, 184, 183, 182, 178, 176,
44, 53, 53, 210, 45, 88, 88, 88, 88, 88,
113, 113, 209, 52, 122, 122, 122, 122, 163, 163,
53, 148, 148, 148, 148, 148, 169, 169, 169, 169,
189, 189, 189, 189, 197, 197, 207, 204, 203, 202,
199, 198, 195, 194, 192, 191, 190, 187, 186, 185,
174, 170, 166, 193, 165, 164, 163, 193, 207, 162,
207, 207, 207, 208, 208, 209, 209, 211, 211, 211,
160, 159, 158, 157, 156, 155, 152, 151, 150, 149,
148, 146, 145, 144, 142, 141, 140, 137, 136, 135,
134, 133, 132, 131, 130, 128, 127, 126, 124, 123,
121, 120, 119, 118, 117, 115, 114, 112, 111, 109,
108, 106, 104, 103, 102, 101, 99, 98, 97, 95,
94, 93, 87, 86, 85, 84, 83, 82, 81, 80,
79, 78, 76, 75, 74, 73, 72, 71, 70, 68,
67, 66, 65, 64, 63, 62, 61, 60, 59, 58,
181, 179, 177, 197, 175, 172, 168, 197, 213, 167,
213, 213, 213, 214, 214, 215, 215, 217, 217, 217,
166, 165, 164, 162, 161, 160, 159, 158, 157, 154,
153, 152, 151, 150, 149, 147, 146, 145, 143, 142,
141, 138, 137, 136, 135, 134, 133, 132, 131, 129,
128, 127, 126, 124, 123, 121, 120, 119, 118, 117,
115, 114, 112, 111, 109, 108, 106, 104, 103, 102,
101, 100, 99, 98, 97, 95, 94, 93, 87, 86,
85, 84, 83, 82, 81, 80, 79, 78, 76, 75,
74, 73, 72, 71, 70, 68, 67, 66, 65, 64,
57, 49, 47, 46, 41, 40, 39, 38, 37, 34,
31, 28, 26, 17, 16, 7, 6, 5, 3, 206,
206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
206, 206, 206, 206
63, 62, 61, 60, 59, 58, 57, 49, 47, 46,
41, 40, 39, 38, 37, 34, 31, 28, 26, 17,
16, 7, 6, 5, 3, 212, 212, 212, 212, 212,
212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
212, 212, 212, 212, 212, 212, 212, 212, 212, 212
} ;
/* Table of booleans, true if rule could match eol. */
static const flex_int32_t yy_rule_can_match_eol[54] =
static const flex_int32_t yy_rule_can_match_eol[55] =
{ 0,
0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
extern int yy_flex_debug;
int yy_flex_debug = 1;
static const flex_int16_t yy_rule_linenum[53] =
static const flex_int16_t yy_rule_linenum[54] =
{ 0,
106, 111, 117, 127, 133, 151, 158, 172, 173, 174,
175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
215, 216
215, 216, 217
} ;
static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
@@ -1049,7 +1052,7 @@ namespace {
/* To avoid the call to exit... oops! */
#define YY_FATAL_ERROR(msg) isc::eval::EvalContext::fatal(msg)
#line 1052 "lexer.cc"
#line 1055 "lexer.cc"
/* noyywrap disables automatic rewinding for the next file to parse. Since we
always parse only a single string, there's no need to do any wraps. And
using yywrap requires linking with -lfl, which provides the default yywrap
@@ -1074,8 +1077,8 @@ namespace {
by moving it ahead by yyleng bytes. yyleng specifies the length of the
currently matched token. */
#define YY_USER_ACTION loc.columns(evalleng);
#line 1077 "lexer.cc"
#line 1078 "lexer.cc"
#line 1080 "lexer.cc"
#line 1081 "lexer.cc"
#define INITIAL 0
@@ -1380,7 +1383,7 @@ YY_DECL
#line 1383 "lexer.cc"
#line 1386 "lexer.cc"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -1408,14 +1411,14 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 207 )
if ( yy_current_state >= 213 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
*(yy_state_ptr)++ = yy_current_state;
++yy_cp;
}
while ( yy_current_state != 206 );
while ( yy_current_state != 212 );
yy_find_action:
/* %% [10.0] code to find the action number goes here */
@@ -1478,13 +1481,13 @@ do_action: /* This label is used only to access EOF actions. */
{
if ( yy_act == 0 )
fprintf( stderr, "--scanner backing up\n" );
else if ( yy_act < 53 )
else if ( yy_act < 54 )
fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
(long)yy_rule_linenum[yy_act], yytext );
else if ( yy_act == 53 )
else if ( yy_act == 54 )
fprintf( stderr, "--accepting default rule (\"%s\")\n",
yytext );
else if ( yy_act == 54 )
else if ( yy_act == 55 )
fprintf( stderr, "--(end of buffer or a NUL)\n" );
else
fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
@@ -1750,73 +1753,78 @@ return isc::eval::EvalParser::make_IFELSE(loc);
case 41:
YY_RULE_SETUP
#line 205 "lexer.ll"
return isc::eval::EvalParser::make_NOT(loc);
return isc::eval::EvalParser::make_TOHEXSTRING(loc);
YY_BREAK
case 42:
YY_RULE_SETUP
#line 206 "lexer.ll"
return isc::eval::EvalParser::make_AND(loc);
return isc::eval::EvalParser::make_NOT(loc);
YY_BREAK
case 43:
YY_RULE_SETUP
#line 207 "lexer.ll"
return isc::eval::EvalParser::make_OR(loc);
return isc::eval::EvalParser::make_AND(loc);
YY_BREAK
case 44:
YY_RULE_SETUP
#line 208 "lexer.ll"
return isc::eval::EvalParser::make_MEMBER(loc);
return isc::eval::EvalParser::make_OR(loc);
YY_BREAK
case 45:
YY_RULE_SETUP
#line 209 "lexer.ll"
return isc::eval::EvalParser::make_DOT(loc);
return isc::eval::EvalParser::make_MEMBER(loc);
YY_BREAK
case 46:
YY_RULE_SETUP
#line 210 "lexer.ll"
return isc::eval::EvalParser::make_LPAREN(loc);
return isc::eval::EvalParser::make_DOT(loc);
YY_BREAK
case 47:
YY_RULE_SETUP
#line 211 "lexer.ll"
return isc::eval::EvalParser::make_RPAREN(loc);
return isc::eval::EvalParser::make_LPAREN(loc);
YY_BREAK
case 48:
YY_RULE_SETUP
#line 212 "lexer.ll"
return isc::eval::EvalParser::make_LBRACKET(loc);
return isc::eval::EvalParser::make_RPAREN(loc);
YY_BREAK
case 49:
YY_RULE_SETUP
#line 213 "lexer.ll"
return isc::eval::EvalParser::make_RBRACKET(loc);
return isc::eval::EvalParser::make_LBRACKET(loc);
YY_BREAK
case 50:
YY_RULE_SETUP
#line 214 "lexer.ll"
return isc::eval::EvalParser::make_COMA(loc);
return isc::eval::EvalParser::make_RBRACKET(loc);
YY_BREAK
case 51:
YY_RULE_SETUP
#line 215 "lexer.ll"
return isc::eval::EvalParser::make_ANY(loc);
return isc::eval::EvalParser::make_COMA(loc);
YY_BREAK
case 52:
YY_RULE_SETUP
#line 216 "lexer.ll"
driver.error (loc, "Invalid character: " + std::string(evaltext));
YY_BREAK
case YY_STATE_EOF(INITIAL):
#line 217 "lexer.ll"
return isc::eval::EvalParser::make_END(loc);
return isc::eval::EvalParser::make_ANY(loc);
YY_BREAK
case 53:
YY_RULE_SETUP
#line 217 "lexer.ll"
driver.error (loc, "Invalid character: " + std::string(evaltext));
YY_BREAK
case YY_STATE_EOF(INITIAL):
#line 218 "lexer.ll"
return isc::eval::EvalParser::make_END(loc);
YY_BREAK
case 54:
YY_RULE_SETUP
#line 219 "lexer.ll"
ECHO;
YY_BREAK
#line 1819 "lexer.cc"
#line 1827 "lexer.cc"
case YY_END_OF_BUFFER:
{
@@ -2102,7 +2110,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 207 )
if ( yy_current_state >= 213 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -2130,11 +2138,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 207 )
if ( yy_current_state >= 213 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 206);
yy_is_jam = (yy_current_state == 212);
if ( ! yy_is_jam )
*(yy_state_ptr)++ = yy_current_state;
@@ -2900,7 +2908,7 @@ void yyfree (void * ptr )
/* %ok-for-header */
#line 218 "lexer.ll"
#line 219 "lexer.ll"
using namespace isc::eval;

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
/* Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -201,6 +201,7 @@ addr6 [0-9a-fA-F]*\:[0-9a-fA-F]*\:[0-9a-fA-F:.]*
"all" return isc::eval::EvalParser::make_ALL(loc);
"concat" return isc::eval::EvalParser::make_CONCAT(loc);
"ifelse" return isc::eval::EvalParser::make_IFELSE(loc);
"hexstring" return isc::eval::EvalParser::make_TOHEXSTRING(loc);
"not" return isc::eval::EvalParser::make_NOT(loc);
"and" return isc::eval::EvalParser::make_AND(loc);
"or" return isc::eval::EvalParser::make_OR(loc);

View File

@@ -1,8 +1,9 @@
// A Bison parser, made by GNU Bison 3.0.4.
// Generated 201809161042
// A Bison parser, made by GNU Bison 3.0.5.
// Locations for Bison parsers in C++
// Copyright (C) 2002-2015 Free Software Foundation, Inc.
// Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -40,9 +41,9 @@
# include "position.hh"
#line 14 "parser.yy" // location.cc:296
#line 14 "parser.yy" // location.cc:292
namespace isc { namespace eval {
#line 46 "location.hh" // location.cc:296
#line 46 "location.hh" // location.cc:292
/// Abstract a location.
class location
{
@@ -52,30 +53,27 @@ namespace isc { namespace eval {
location (const position& b, const position& e)
: begin (b)
, end (e)
{
}
{}
/// Construct a 0-width location in \a p.
explicit location (const position& p = position ())
: begin (p)
, end (p)
{
}
{}
/// Construct a 0-width location in \a f, \a l, \a c.
explicit location (std::string* f,
unsigned int l = 1u,
unsigned int c = 1u)
unsigned l = 1u,
unsigned c = 1u)
: begin (f, l, c)
, end (f, l, c)
{
}
{}
/// Initialization.
void initialize (std::string* f = YY_NULLPTR,
unsigned int l = 1u,
unsigned int c = 1u)
unsigned l = 1u,
unsigned c = 1u)
{
begin.initialize (f, l, c);
end = begin;
@@ -173,7 +171,7 @@ namespace isc { namespace eval {
inline std::basic_ostream<YYChar>&
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
{
unsigned int end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
unsigned end_col = 0 < loc.end.column ? loc.end.column - 1 : 0;
ostr << loc.begin;
if (loc.end.filename
&& (!loc.begin.filename
@@ -186,7 +184,7 @@ namespace isc { namespace eval {
return ostr;
}
#line 14 "parser.yy" // location.cc:296
#line 14 "parser.yy" // location.cc:292
} } // isc::eval
#line 192 "location.hh" // location.cc:296
#line 189 "location.hh" // location.cc:292
#endif // !YY_EVAL_LOCATION_HH_INCLUDED

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
// A Bison parser, made by GNU Bison 3.0.4.
// A Bison parser, made by GNU Bison 3.0.5.
// Skeleton interface for Bison LALR(1) parsers in C++
// Copyright (C) 2002-2015 Free Software Foundation, Inc.
// Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@
#ifndef YY_EVAL_PARSER_H_INCLUDED
# define YY_EVAL_PARSER_H_INCLUDED
// // "%code requires" blocks.
#line 17 "parser.yy" // lalr1.cc:377
#line 17 "parser.yy" // lalr1.cc:379
#include <string>
#include <eval/token.h>
@@ -51,7 +51,7 @@
using namespace isc::dhcp;
using namespace isc::eval;
#line 55 "parser.h" // lalr1.cc:377
#line 55 "parser.h" // lalr1.cc:379
# include <cassert>
# include <cstdlib> // std::abort
@@ -134,9 +134,9 @@ using namespace isc::eval;
# endif /* ! defined YYDEBUG */
#endif /* ! defined EVALDEBUG */
#line 14 "parser.yy" // lalr1.cc:377
#line 14 "parser.yy" // lalr1.cc:379
namespace isc { namespace eval {
#line 140 "parser.h" // lalr1.cc:377
#line 140 "parser.h" // lalr1.cc:379
@@ -393,21 +393,22 @@ namespace isc { namespace eval {
TOKEN_COMA = 291,
TOKEN_CONCAT = 292,
TOKEN_IFELSE = 293,
TOKEN_PKT6 = 294,
TOKEN_MSGTYPE = 295,
TOKEN_TRANSID = 296,
TOKEN_VENDOR_CLASS = 297,
TOKEN_VENDOR = 298,
TOKEN_ANY = 299,
TOKEN_DATA = 300,
TOKEN_ENTERPRISE = 301,
TOKEN_TOPLEVEL_BOOL = 302,
TOKEN_TOPLEVEL_STRING = 303,
TOKEN_STRING = 304,
TOKEN_INTEGER = 305,
TOKEN_HEXSTRING = 306,
TOKEN_OPTION_NAME = 307,
TOKEN_IP_ADDRESS = 308
TOKEN_TOHEXSTRING = 294,
TOKEN_PKT6 = 295,
TOKEN_MSGTYPE = 296,
TOKEN_TRANSID = 297,
TOKEN_VENDOR_CLASS = 298,
TOKEN_VENDOR = 299,
TOKEN_ANY = 300,
TOKEN_DATA = 301,
TOKEN_ENTERPRISE = 302,
TOKEN_TOPLEVEL_BOOL = 303,
TOKEN_TOPLEVEL_STRING = 304,
TOKEN_STRING = 305,
TOKEN_INTEGER = 306,
TOKEN_HEXSTRING = 307,
TOKEN_OPTION_NAME = 308,
TOKEN_IP_ADDRESS = 309
};
};
@@ -678,6 +679,10 @@ namespace isc { namespace eval {
symbol_type
make_IFELSE (const location_type& l);
static inline
symbol_type
make_TOHEXSTRING (const location_type& l);
static inline
symbol_type
make_PKT6 (const location_type& l);
@@ -823,7 +828,7 @@ namespace isc { namespace eval {
// number is the opposite. If YYTABLE_NINF, syntax error.
static const unsigned char yytable_[];
static const short int yycheck_[];
static const unsigned char yycheck_[];
// YYSTOS[STATE-NUM] -- The (internal number of the) accessing
// symbol of state STATE-NUM.
@@ -909,6 +914,8 @@ namespace isc { namespace eval {
typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol.
stack_symbol_type ();
/// Copy construct.
stack_symbol_type (const stack_symbol_type& that);
/// Steal the contents from \a sym to build this.
stack_symbol_type (state_type s, symbol_type& sym);
/// Assignment, needed by push_back.
@@ -937,18 +944,18 @@ namespace isc { namespace eval {
void yypush_ (const char* m, state_type s, symbol_type& sym);
/// Pop \a n symbols the three stacks.
void yypop_ (unsigned int n = 1);
void yypop_ (unsigned n = 1);
/// Constants.
enum
{
yyeof_ = 0,
yylast_ = 192, ///< Last index in yytable_.
yylast_ = 197, ///< Last index in yytable_.
yynnts_ = 16, ///< Number of nonterminal symbols.
yyfinal_ = 32, ///< Termination state number.
yyfinal_ = 33, ///< Termination state number.
yyterror_ = 1,
yyerrcode_ = 256,
yyntokens_ = 54 ///< Number of tokens.
yyntokens_ = 55 ///< Number of tokens.
};
@@ -995,14 +1002,14 @@ namespace isc { namespace eval {
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53
45, 46, 47, 48, 49, 50, 51, 52, 53, 54
};
const unsigned int user_token_number_max_ = 308;
const unsigned user_token_number_max_ = 309;
const token_number_type undef_token_ = 2;
if (static_cast<int>(t) <= yyeof_)
if (static_cast<int> (t) <= yyeof_)
return yyeof_;
else if (static_cast<unsigned int> (t) <= user_token_number_max_)
else if (static_cast<unsigned> (t) <= user_token_number_max_)
return translate_table[t];
else
return undef_token_;
@@ -1016,58 +1023,56 @@ namespace isc { namespace eval {
// basic_symbol.
template <typename Base>
inline
EvalParser::basic_symbol<Base>::basic_symbol ()
: value ()
{}
template <typename Base>
inline
EvalParser::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
: Base (other)
, value ()
, location (other.location)
{
switch (other.type_get ())
switch (other.type_get ())
{
case 61: // option_repr_type
case 62: // option_repr_type
value.copy< TokenOption::RepresentationType > (other.value);
break;
case 65: // pkt4_field
case 66: // pkt4_field
value.copy< TokenPkt4::FieldType > (other.value);
break;
case 66: // pkt6_field
case 67: // pkt6_field
value.copy< TokenPkt6::FieldType > (other.value);
break;
case 63: // pkt_metadata
case 64: // pkt_metadata
value.copy< TokenPkt::MetadataType > (other.value);
break;
case 67: // relay6_field
case 68: // relay6_field
value.copy< TokenRelay6Field::FieldType > (other.value);
break;
case 62: // nest_level
case 63: // nest_level
value.copy< int8_t > (other.value);
break;
case 49: // "constant string"
case 50: // "integer"
case 51: // "constant hexstring"
case 52: // "option name"
case 53: // "ip address"
case 50: // "constant string"
case 51: // "integer"
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
value.copy< std::string > (other.value);
break;
case 60: // option_code
case 61: // option_code
value.copy< uint16_t > (other.value);
break;
case 59: // integer_expr
case 64: // enterprise_id
case 60: // integer_expr
case 65: // enterprise_id
value.copy< uint32_t > (other.value);
break;
@@ -1077,55 +1082,53 @@ namespace isc { namespace eval {
}
template <typename Base>
inline
EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
: Base (t)
, value ()
, location (l)
{
(void) v;
switch (this->type_get ())
switch (this->type_get ())
{
case 61: // option_repr_type
case 62: // option_repr_type
value.copy< TokenOption::RepresentationType > (v);
break;
case 65: // pkt4_field
case 66: // pkt4_field
value.copy< TokenPkt4::FieldType > (v);
break;
case 66: // pkt6_field
case 67: // pkt6_field
value.copy< TokenPkt6::FieldType > (v);
break;
case 63: // pkt_metadata
case 64: // pkt_metadata
value.copy< TokenPkt::MetadataType > (v);
break;
case 67: // relay6_field
case 68: // relay6_field
value.copy< TokenRelay6Field::FieldType > (v);
break;
case 62: // nest_level
case 63: // nest_level
value.copy< int8_t > (v);
break;
case 49: // "constant string"
case 50: // "integer"
case 51: // "constant hexstring"
case 52: // "option name"
case 53: // "ip address"
case 50: // "constant string"
case 51: // "integer"
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
value.copy< std::string > (v);
break;
case 60: // option_code
case 61: // option_code
value.copy< uint16_t > (v);
break;
case 59: // integer_expr
case 64: // enterprise_id
case 60: // integer_expr
case 65: // enterprise_id
value.copy< uint32_t > (v);
break;
@@ -1209,14 +1212,12 @@ namespace isc { namespace eval {
template <typename Base>
inline
EvalParser::basic_symbol<Base>::~basic_symbol ()
{
clear ();
}
template <typename Base>
inline
void
EvalParser::basic_symbol<Base>::clear ()
{
@@ -1231,46 +1232,46 @@ namespace isc { namespace eval {
}
// Type destructor.
switch (yytype)
switch (yytype)
{
case 61: // option_repr_type
case 62: // option_repr_type
value.template destroy< TokenOption::RepresentationType > ();
break;
case 65: // pkt4_field
case 66: // pkt4_field
value.template destroy< TokenPkt4::FieldType > ();
break;
case 66: // pkt6_field
case 67: // pkt6_field
value.template destroy< TokenPkt6::FieldType > ();
break;
case 63: // pkt_metadata
case 64: // pkt_metadata
value.template destroy< TokenPkt::MetadataType > ();
break;
case 67: // relay6_field
case 68: // relay6_field
value.template destroy< TokenRelay6Field::FieldType > ();
break;
case 62: // nest_level
case 63: // nest_level
value.template destroy< int8_t > ();
break;
case 49: // "constant string"
case 50: // "integer"
case 51: // "constant hexstring"
case 52: // "option name"
case 53: // "ip address"
case 50: // "constant string"
case 51: // "integer"
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
value.template destroy< std::string > ();
break;
case 60: // option_code
case 61: // option_code
value.template destroy< uint16_t > ();
break;
case 59: // integer_expr
case 64: // enterprise_id
case 60: // integer_expr
case 65: // enterprise_id
value.template destroy< uint32_t > ();
break;
@@ -1282,7 +1283,6 @@ namespace isc { namespace eval {
}
template <typename Base>
inline
bool
EvalParser::basic_symbol<Base>::empty () const
{
@@ -1290,51 +1290,50 @@ namespace isc { namespace eval {
}
template <typename Base>
inline
void
EvalParser::basic_symbol<Base>::move (basic_symbol& s)
{
super_type::move(s);
switch (this->type_get ())
super_type::move (s);
switch (this->type_get ())
{
case 61: // option_repr_type
case 62: // option_repr_type
value.move< TokenOption::RepresentationType > (s.value);
break;
case 65: // pkt4_field
case 66: // pkt4_field
value.move< TokenPkt4::FieldType > (s.value);
break;
case 66: // pkt6_field
case 67: // pkt6_field
value.move< TokenPkt6::FieldType > (s.value);
break;
case 63: // pkt_metadata
case 64: // pkt_metadata
value.move< TokenPkt::MetadataType > (s.value);
break;
case 67: // relay6_field
case 68: // relay6_field
value.move< TokenRelay6Field::FieldType > (s.value);
break;
case 62: // nest_level
case 63: // nest_level
value.move< int8_t > (s.value);
break;
case 49: // "constant string"
case 50: // "integer"
case 51: // "constant hexstring"
case 52: // "option name"
case 53: // "ip address"
case 50: // "constant string"
case 51: // "integer"
case 52: // "constant hexstring"
case 53: // "option name"
case 54: // "ip address"
value.move< std::string > (s.value);
break;
case 60: // option_code
case 61: // option_code
value.move< uint16_t > (s.value);
break;
case 59: // integer_expr
case 64: // enterprise_id
case 60: // integer_expr
case 65: // enterprise_id
value.move< uint32_t > (s.value);
break;
@@ -1398,7 +1397,7 @@ namespace isc { namespace eval {
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308
305, 306, 307, 308, 309
};
return static_cast<token_type> (yytoken_number_[type]);
}
@@ -1625,6 +1624,12 @@ namespace isc { namespace eval {
return symbol_type (token::TOKEN_IFELSE, l);
}
EvalParser::symbol_type
EvalParser::make_TOHEXSTRING (const location_type& l)
{
return symbol_type (token::TOKEN_TOHEXSTRING, l);
}
EvalParser::symbol_type
EvalParser::make_PKT6 (const location_type& l)
{
@@ -1716,9 +1721,9 @@ namespace isc { namespace eval {
}
#line 14 "parser.yy" // lalr1.cc:377
#line 14 "parser.yy" // lalr1.cc:379
} } // isc::eval
#line 1722 "parser.h" // lalr1.cc:377
#line 1727 "parser.h" // lalr1.cc:379

View File

@@ -74,6 +74,7 @@ using namespace isc::eval;
COMA ","
CONCAT "concat"
IFELSE "ifelse"
TOHEXSTRING "hexstring"
PKT6 "pkt6"
MSGTYPE "msgtype"
TRANSID "transid"
@@ -349,6 +350,11 @@ string_expr : STRING
TokenPtr cond(new TokenIfElse());
ctx.expression.push_back(cond);
}
| TOHEXSTRING "(" string_expr "," string_expr ")"
{
TokenPtr tohex(new TokenToHexString());
ctx.expression.push_back(tohex);
}
| VENDOR "." ENTERPRISE
{
// expression: vendor.enterprise

View File

@@ -1,8 +1,9 @@
// A Bison parser, made by GNU Bison 3.0.4.
// Generated 201809161042
// A Bison parser, made by GNU Bison 3.0.5.
// Positions for Bison parsers in C++
// Copyright (C) 2002-2015 Free Software Foundation, Inc.
// Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -50,28 +51,27 @@
# endif
# endif
#line 14 "parser.yy" // location.cc:296
#line 14 "parser.yy" // location.cc:292
namespace isc { namespace eval {
#line 56 "position.hh" // location.cc:296
#line 56 "position.hh" // location.cc:292
/// Abstract a position.
class position
{
public:
/// Construct a position.
explicit position (std::string* f = YY_NULLPTR,
unsigned int l = 1u,
unsigned int c = 1u)
unsigned l = 1u,
unsigned c = 1u)
: filename (f)
, line (l)
, column (c)
{
}
{}
/// Initialization.
void initialize (std::string* fn = YY_NULLPTR,
unsigned int l = 1u,
unsigned int c = 1u)
unsigned l = 1u,
unsigned c = 1u)
{
filename = fn;
line = l;
@@ -100,15 +100,15 @@ namespace isc { namespace eval {
/// File name to which this position refers.
std::string* filename;
/// Current line number.
unsigned int line;
unsigned line;
/// Current column number.
unsigned int column;
unsigned column;
private:
/// Compute max(min, lhs+rhs) (provided min <= lhs).
static unsigned int add_ (unsigned int lhs, int rhs, unsigned int min)
static unsigned add_ (unsigned lhs, int rhs, unsigned min)
{
return (0 < rhs || -static_cast<unsigned int>(rhs) < lhs
return (0 < rhs || -static_cast<unsigned>(rhs) < lhs
? rhs + lhs
: min);
}
@@ -174,7 +174,7 @@ namespace isc { namespace eval {
return ostr << pos.line << '.' << pos.column;
}
#line 14 "parser.yy" // location.cc:296
#line 14 "parser.yy" // location.cc:292
} } // isc::eval
#line 180 "position.hh" // location.cc:296
#line 179 "position.hh" // location.cc:292
#endif // !YY_EVAL_POSITION_HH_INCLUDED

View File

@@ -1,8 +1,9 @@
// A Bison parser, made by GNU Bison 3.0.4.
// Generated 201809161042
// A Bison parser, made by GNU Bison 3.0.5.
// Stack handling for Bison parsers in C++
// Copyright (C) 2002-2015 Free Software Foundation, Inc.
// Copyright (C) 2002-2015, 2018 Free Software Foundation, Inc.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -40,9 +41,10 @@
# include <vector>
#line 14 "parser.yy" // stack.hh:132
#line 14 "parser.yy" // stack.hh:131
namespace isc { namespace eval {
#line 46 "stack.hh" // stack.hh:132
#line 46 "stack.hh" // stack.hh:131
/// A stack with random access from its top.
template <class T, class S = std::vector<T> >
class stack
{
@@ -57,20 +59,24 @@ namespace isc { namespace eval {
seq_.reserve (200);
}
stack (unsigned int n)
stack (unsigned n)
: seq_ (n)
{}
inline
/// Random access.
///
/// Index 0 returns the topmost element.
T&
operator[] (unsigned int i)
operator[] (unsigned i)
{
return seq_[seq_.size () - 1 - i];
}
inline
/// Random access.
///
/// Index 0 returns the topmost element.
const T&
operator[] (unsigned int i) const
operator[] (unsigned i) const
{
return seq_[seq_.size () - 1 - i];
}
@@ -78,7 +84,6 @@ namespace isc { namespace eval {
/// Steal the contents of \a t.
///
/// Close to move-semantics.
inline
void
push (T& t)
{
@@ -86,9 +91,8 @@ namespace isc { namespace eval {
operator[](0).move (t);
}
inline
void
pop (unsigned int n = 1)
pop (unsigned n = 1)
{
for (; n; --n)
seq_.pop_back ();
@@ -100,21 +104,18 @@ namespace isc { namespace eval {
seq_.clear ();
}
inline
typename S::size_type
size () const
{
return seq_.size ();
}
inline
const_iterator
begin () const
{
return seq_.rbegin ();
}
inline
const_iterator
end () const
{
@@ -133,25 +134,24 @@ namespace isc { namespace eval {
class slice
{
public:
slice (const S& stack, unsigned int range)
slice (const S& stack, unsigned range)
: stack_ (stack)
, range_ (range)
{}
inline
const T&
operator [] (unsigned int i) const
operator [] (unsigned i) const
{
return stack_[range_ - i];
}
private:
const S& stack_;
unsigned int range_;
unsigned range_;
};
#line 14 "parser.yy" // stack.hh:132
#line 14 "parser.yy" // stack.hh:131
} } // isc::eval
#line 156 "stack.hh" // stack.hh:132
#line 155 "stack.hh" // stack.hh:131
#endif // !YY_EVAL_STACK_HH_INCLUDED

View File

@@ -462,6 +462,14 @@ public:
EXPECT_TRUE(alt);
}
/// @brief checks if the given token is a hexstring operator
void checkTokenToHexString(const TokenPtr& token) {
ASSERT_TRUE(token);
boost::shared_ptr<TokenToHexString> tohex =
boost::dynamic_pointer_cast<TokenToHexString>(token);
EXPECT_TRUE(tohex);
}
/// @brief checks if the given expression raises the expected message
/// when it is parsed.
void checkError(const string& expr, const string& msg) {
@@ -1056,6 +1064,12 @@ TEST_F(EvalContextTest, pkt4FieldChaddr) {
testPkt4Field("pkt4.mac == 0x000102030405", TokenPkt4::CHADDR, 3);
}
// Tests whether chaddr field in DHCPv4 can be accessed and converted.
TEST_F(EvalContextTest, pkt4FieldChaddrHexa) {
testPkt4Field("hexstring(pkt4.mac, ':') == '00:01:02:03:04:05'",
TokenPkt4::CHADDR, 5);
}
// Tests whether hlen field in DHCPv4 can be accessed.
TEST_F(EvalContextTest, pkt4FieldHlen) {
testPkt4Field("pkt4.hlen == 0x6", TokenPkt4::HLEN, 3);
@@ -1310,6 +1324,25 @@ TEST_F(EvalContextTest, ifElse) {
checkTokenIfElse(tmp4);
}
// Test the parsing of a hexstring expression
TEST_F(EvalContextTest, toHexString) {
EvalContext eval(Option::V4);
EXPECT_NO_THROW(parsed_ =
eval.parseString("hexstring(0x666f,'-') == '66-6f'"));
EXPECT_TRUE(parsed_);
ASSERT_EQ(5, eval.expression.size());
TokenPtr tmp1 = eval.expression.at(0);
TokenPtr tmp2 = eval.expression.at(1);
TokenPtr tmp3 = eval.expression.at(2);
checkTokenHexString(tmp1, "fo");
checkTokenString(tmp2, "-");
checkTokenToHexString(tmp3);
}
//
// Test some scanner error cases
TEST_F(EvalContextTest, scanErrors) {

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -504,6 +504,12 @@ TEST_F(ExpressionsTest, evaluateString) {
"ifelse(option[100].exists,"
"option[100].hex,'none?'))",
"hundred4");
// Check that hexstring works as expecting.
testExpressionString(Option::V4, "hexstring(0x1234,':')", "12:34");
testExpressionString(Option::V4, "hexstring(0x56789a,'-')", "56-78-9a");
testExpressionString(Option::V4, "hexstring(0xbcde,'')", "bcde");
testExpressionString(Option::V4, "hexstring(0xf01234,'..')", "f0..12..34");
}
};

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -1954,6 +1954,35 @@ TEST_F(TokenTest, concat) {
EXPECT_TRUE(checkFile());
}
// This test checks if a token representing a hexstring request
// throws an exception if there aren't enough values on the stack.
// The actual packet is not used.
TEST_F(TokenTest, tohexstring) {
ASSERT_NO_THROW(t_.reset(new TokenToHexString()));
// Hexstring equires two values on the stack, try
// with 0 and 1 both should throw an exception
EXPECT_THROW(t_->evaluate(*pkt4_, values_), EvalBadStack);
values_.push("foo");
EXPECT_THROW(t_->evaluate(*pkt4_, values_), EvalBadStack);
// Two should work
values_.push("-");
EXPECT_NO_THROW(t_->evaluate(*pkt4_, values_));
// Check the result
ASSERT_EQ(1, values_.size());
EXPECT_EQ("66-6f-6f", values_.top());
// Check that the debug output was correct. Add the strings
// to the test vector in the class and then call checkFile
// for comparison
addString("EVAL_DEBUG_TOHEXSTRING Popping binary value 0x666F6F and "
"separator -, pushing result 66-6f-6f");
EXPECT_TRUE(checkFile());
}
// This test checks if a token representing an ifelse is able
// to select the branch following the condition.
TEST_F(TokenTest, ifElse) {

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -21,6 +21,8 @@
#include <dhcp/option_vendor_class.h>
#include <cstring>
#include <string>
#include <iomanip>
#include <sstream>
using namespace isc::dhcp;
using namespace isc::util;
@@ -629,6 +631,39 @@ TokenIfElse::evaluate(Pkt& /*pkt*/, ValueStack& values) {
}
}
void
TokenToHexString::evaluate(Pkt& /*pkt*/, ValueStack& values) {
if (values.size() < 2) {
isc_throw(EvalBadStack, "Incorrect stack order. Expected at least "
"2 values for hexstring, got " << values.size());
}
string separator = values.top();
values.pop();
string binary = values.top();
values.pop();
bool first = true;
stringstream tmp;
tmp << hex;
for (size_t i = 0; i < binary.size(); ++i) {
if (!first) {
tmp << separator;
} else {
first = false;
}
tmp << setw(2) << setfill('0')
<< (static_cast<unsigned>(binary[i]) & 0xff);
}
values.push(tmp.str());
// Log what we popped and pushed
LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_TOHEXSTRING)
.arg(toHex(binary))
.arg(separator)
.arg(tmp.str());
}
void
TokenNot::evaluate(Pkt& /*pkt*/, ValueStack& values) {

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -725,6 +725,45 @@ public:
void evaluate(Pkt& pkt, ValueStack& values);
};
/// @brief Token that converts to hexadecimal string
///
/// For example in the sub-expression "hexstring(pkt4.mac, ':')"
/// the binary MAC address is converted to its usual hexadecimal
/// representation as a list of (6) pairs of hexadecimal digits
/// separated by colons (':').
/// Please note the token is named TokenToHexString when the syntax
/// use the hexstring name without a leading "to".
class TokenToHexString : public Token {
public:
/// @brief Constructor (does nothing)
TokenToHexString() { }
/// @brief Convert a binary value to its hexadecimal string representation
///
/// Evaluation does not use packet information. It requires at least
/// two values to be present on the stack. It will consume the top
/// two values on the stack as parameters and push the resulting
/// hexadecimal string onto the stack.
/// From the top it expects the values on the stack as:
/// - separator
/// - binary
///
/// binary is the binary value (note it can be any value, i.e.
/// it is not checked to really be not printable).
/// separator is litteral for instance '-' or ':'. The empty separator
/// means no separator.
///
/// The following example use a binary MAC address 06:ce:8f:55:b3:33:
/// - <mac>, '-' => "06-ce-8f-55-b3-33"
///
/// @throw EvalBadStack if there are less than 2 values on stack
///
/// @param pkt (unused)
/// @param values - stack of values (2 arguments will be popped, 1 result
/// will be pushed)
void evaluate(Pkt& pkt, ValueStack& values);
};
/// @brief Token that represents logical negation operator
///
/// For example in the expression "not(option[vendor-class].text == 'MSF')"

View File

@@ -25,6 +25,11 @@ module ietf-dhcpv6-client {
description "This model defines a YANG data model that can be
used to configure and manage a DHCPv6 client.";
revision 2018-09-04 {
description "";
reference "I-D: draft-ietf-dhc-dhcpv6-yang";
}
revision 2018-03-04 {
description "Resolved most issues on the DHC official
github";
@@ -41,7 +46,6 @@ module ietf-dhcpv6-client {
YANG model.";
reference "I-D: draft-ietf-dhc-dhcpv6-yang";
}
/*
* Data Nodes
*/

View File

@@ -21,9 +21,14 @@ module ietf-dhcpv6-options {
ian.farrer@telekom.de
sladjana.zechlin@telekom.de
hezihao9512@gmail.com";
description "This model defines a YANG data model that can be
used to configure DHCPv6 options.";
revision 2018-09-04 {
description "";
reference "I-D: draft-ietf-dhc-dhcpv6-yang";
}
revision 2018-03-04 {
description "Resolved most issues on the DHC official
github";
@@ -31,8 +36,8 @@ module ietf-dhcpv6-options {
}
revision 2017-12-22 {
description "Resolve most issues on Ian's github.";
reference "I-D: draft-ietf-dhc-dhcpv6-yang";
description "Resolve most issues on Ian's github.";
reference "I-D: draft-ietf-dhc-dhcpv6-yang";
}
revision 2017-11-24 {
@@ -46,173 +51,174 @@ module ietf-dhcpv6-options {
*/
// features for server options
feature server-unicast-op {
description "Support for Server Unicast option";
}
feature sip-server-domain-name-list-op {
description "Support for SIP Server Domain Name List option";
}
feature sip-server-address-list-op {
description "Support for SIP Server Address List option";
}
feature server-unicast-op {
description "Support for Server Unicast option";
}
feature sip-server-domain-name-list-op {
description "Support for SIP Server Domain Name List option";
}
feature sip-server-address-list-op {
description "Support for SIP Server Address List option";
}
feature dns-servers-op {
description "Support for DNS Servers Option";
}
feature domain-searchlist-op {
description "Support for Domain Search List Option";
}
feature nis-config-op {
description "Support for Network Information Service (NIS)
Servers option";
}
feature nis-plus-config-op {
description "Support for Network Information Service V2 (NIS+)
Servers option";
}
feature nis-domain-name-op {
description "Support for Network Information Service (NIS)
Domain Name option";
}
feature nis-plus-domain-name-op {
description "Support for Network Information Service V2 (NIS+)
Server option";
}
feature sntp-server-op {
description "Support for Simple Network Protocol Configuration
(SNTP) Servers option";
}
feature info-refresh-time-op {
description "Support for Information Refresh Time option";
}
feature client-fqdn-op {
description "Support for Client FQDN option";
}
feature posix-timezone-op {
description "Support for New POIX Timezone option";
}
feature tzdb-timezone-op {
description "Support for New TZDB Timezone option";
}
feature ntp-server-op {
description "Support for Network Time Protocol (NTP)
Server option";
}
feature boot-file-url-op {
description "Support for Boot File URL option";
}
feature boot-file-param-op {
description "Support for Boot File Parameters option";
}
feature aftr-name-op {
description "Support for Address Family Transition
Router (AFTR) option";
}
feature kbr-default-name-op {
description "Support for Kerberos Default Name
Option";
}
feature kbr-kdc-op {
description "Support for Kerberos KDC option";
}
feature sol-max-rt-op {
description "Support for SOL_MAX_RT option";
}
feature inf-max-rt-op {
description "Support for INF_MAX_RT option";
}
feature addr-selection-op {
description "Support for Address Selection opiton";
}
feature pcp-server-op {
description "Support for Port Control Protocol (PCP)
option";
}
feature s46-rule-op {
description "Support for S46 Rule option";
}
feature s46-br-op {
description "Support for S46 Border Relay (BR) option";
}
feature s46-dmr-op {
description "Support for S46 Default Mapping Rule
(DMR) option";
}
feature s46-v4-v6-binding-op {
description "Support for S46 IPv4/IPv6 Address
Bind option";
}
feature domain-searchlist-op {
description "Support for Domain Search List Option";
}
feature nis-config-op {
description "Support for Network Information Service (NIS)
Servers option";
}
feature nis-plus-config-op {
description "Support for Network Information Service V2 (NIS+)
Servers option";
}
feature nis-domain-name-op {
description "Support for Network Information Service (NIS)
Domain Name option";
}
feature nis-plus-domain-name-op {
description "Support for Network Information Service V2 (NIS+)
Server option";
}
feature sntp-server-op {
description "Support for Simple Network Protocol Configuration
(SNTP) Servers option";
}
feature info-refresh-time-op {
description "Support for Information Refresh Time option";
}
feature client-fqdn-op {
description "Support for Client FQDN option";
}
feature posix-timezone-op {
description "Support for New POIX Timezone option";
}
feature tzdb-timezone-op {
description "Support for New TZDB Timezone option";
}
feature ntp-server-op {
description "Support for Network Time Protocol (NTP)
Server option";
}
feature boot-file-url-op {
description "Support for Boot File URL option";
}
feature boot-file-param-op {
description "Support for Boot File Parameters option";
}
feature aftr-name-op {
description "Support for Address Family Transition
Router (AFTR) option";
}
feature kbr-default-name-op {
description "Support for Kerberos Default Name
Option";
}
feature kbr-kdc-op {
description "Support for Kerberos KDC option";
}
feature sol-max-rt-op {
description "Support for SOL_MAX_RT option";
}
feature inf-max-rt-op {
description "Support for INF_MAX_RT option";
}
feature addr-selection-op {
description "Support for Address Selection opiton";
}
feature pcp-server-op {
description "Support for Port Control Protocol (PCP)
option";
}
feature s46-rule-op {
description "Support for S46 Rule option";
}
feature s46-br-op {
description "Support for S46 Border Relay (BR) option";
}
feature s46-dmr-op {
description "Support for S46 Default Mapping Rule
(DMR) option";
}
feature s46-v4-v6-binding-op {
description "Support for S46 IPv4/IPv6 Address
Bind option";
}
// features for relay-supplied options
feature erp-local-domain-name-op {
description "Support for ERP Local Domain Name option";
}
// features for relay-supplied options
feature erp-local-domain-name-op {
description "Support for ERP Local Domain Name option";
}
// features for client options
feature option-request-op {
description "Support for Option Request option";
}
feature rapid-commit-op {
description "Support for Rapid Commit option";
}
feature user-class-op {
description "Support for User Class option";
}
feature vendor-class-op {
description "Support for Vendor Class option";
}
feature client-arch-type-op {
description "Support for Client System Architecture
Type option";
}
feature client-network-interface-identifier-op {
description "Support for Client Network Interface
Identifier option";
}
feature kbr-principal-name-op {
description "Support for Kerberos Principal
Name option";
}
feature kbr-realm-name-op {
description "Support Kerberos Realm Name option";
}
feature client-link-layer-addr-op {
description "Support for Client Link-Layer Address
Option";
}
// features for client options
feature option-request-op {
description "Support for Option Request option";
}
feature rapid-commit-op {
description "Support for Rapid Commit option";
}
feature user-class-op {
description "Support for User Class option";
}
feature vendor-class-op {
description "Support for Vendor Class option";
}
feature client-arch-type-op {
description "Support for Client System Architecture
Type option";
}
feature client-network-interface-identifier-op {
description "Support for Client Network Interface
Identifier option";
}
feature kbr-principal-name-op {
description "Support for Kerberos Principal
Name option";
}
feature kbr-realm-name-op {
description "Support Kerberos Realm Name option";
}
feature client-link-layer-addr-op {
description "Support for Client Link-Layer Address
Option";
}
// features for custom options
feature operator-op-ipv6-address {
description "Support for Option with IPv6 Addresses";
}
feature operator-op-single-flag {
description "Support for Option with Single Flag";
}
feature operator-op-ipv6-prefix {
description "Support for Option with IPv6 Prefix";
}
feature operator-op-int32 {
description "Support for Opion with 32-bit
Integer Value";
}
feature operator-op-int16 {
description "Support for Opion with 16-bit Integer Value";
}
feature operator-op-int8 {
description "Support for Opion with 8-bit Integer Value";
}
feature operator-op-uri {
description "Support for Opion with URI";
}
feature operator-op-textstring {
description "Support for Opion with Text String";
}
feature operator-op-var-data {
description "Support for Opion with Variable-Length Data";
}
feature operator-op-dns-wire {
description "Support for Opion with DNS Wire
Format Domain Name List";
}
// features for custom options
feature operator-op-ipv6-address {
description "Support for Option with IPv6 Addresses";
}
feature operator-op-single-flag {
description "Support for Option with Single Flag";
}
feature operator-op-ipv6-prefix {
description "Support for Option with IPv6 Prefix";
}
feature operator-op-int32 {
description "Support for Opion with 32-bit
Integer Value";
}
feature operator-op-int16 {
description "Support for Opion with 16-bit Integer Value";
}
feature operator-op-int8 {
description "Support for Opion with 8-bit Integer Value";
}
feature operator-op-uri {
description "Support for Opion with URI";
}
feature operator-op-textstring {
description "Support for Opion with Text String";
}
feature operator-op-var-data {
description "Support for Opion with Variable-Length Data";
}
feature operator-op-dns-wire {
description "Support for Opion with DNS Wire
Format Domain Name List";
}
/*
* Groupings
*/
@@ -234,8 +240,8 @@ module ietf-dhcpv6-options {
}
container sip-server-domain-name-list-option {
// if-feature sip-server-domain-name-list-op;
// presence "Enable this option";
if-feature sip-server-domain-name-list-op;
presence "Enable this option";
description "OPTION_SIP_SERVER_D (21) SIP Servers Domain Name List";
reference "RFC3319: Dynamic Host Configuration Protocol
(DHCPv6) Options for Session Initiation Protocol (SIP) Servers";
@@ -247,8 +253,8 @@ module ietf-dhcpv6-options {
}
container sip-server-address-list-option {
// if-feature sip-server-address-list-op;
// presence "Enable this option";
if-feature sip-server-address-list-op;
presence "Enable this option";
description "OPTION_SIP_SERVER_A (22) SIP Servers IPv6 Address List";
reference "RFC3319: Dynamic Host Configuration Protocol (DHCPv6)
Options for Session Initiation Protocol (SIP) Servers";
@@ -269,8 +275,8 @@ module ietf-dhcpv6-options {
}
container dns-servers-option {
// if-feature dns-servers-op;
// presence "Enable this option";
if-feature dns-servers-op;
presence "Enable this option";
description "OPTION_DNS_SERVERS (23) DNS recursive Name Server option";
reference "RFC3646: DNS Configuration options for Dynamic Host Configuration
Protocol for IPv6 (DHCPv6)";
@@ -291,8 +297,8 @@ module ietf-dhcpv6-options {
}
container domain-searchlist-option {
// if-feature domain-searchlist-op;
// presence "Enable this option";
if-feature domain-searchlist-op;
presence "Enable this option";
description "OPTION_DOMAIN_LIST (24) Domain Search List Option";
reference "RFC3646: DNS Configuration options for Dynamic
Host Configuration Protocol for IPv6 (DHCPv6)";
@@ -311,10 +317,9 @@ module ietf-dhcpv6-options {
}
}
}
container nis-config-option {
// if-feature nis-config-op;
// presence "Enable this option";
if-feature nis-config-op;
presence "Enable this option";
description "OPTION_NIS_SERVERS (27) Network Information Service (NIS)
Servers Option.";
reference "RFC3898: Network Information Service (NIS) Configuration
@@ -336,8 +341,8 @@ module ietf-dhcpv6-options {
}
container nis-plus-config-option {
// if-feature nis-plus-config-op;
// presence "Enable this option";
if-feature nis-plus-config-op;
presence "Enable this option";
description "OPTION_NISP_SERVERS (28): Network Information Service V2
(NIS+) Servers Option.";
reference "RFC3989: Network Information Service (NIS) Configuration
@@ -357,6 +362,7 @@ module ietf-dhcpv6-options {
}
}
}
container nis-domain-name-option {
if-feature nis-domain-name-op;
presence "Enable this option";
@@ -391,7 +397,7 @@ module ietf-dhcpv6-options {
container sntp-server-option {
// if-feature sntp-server-op;
if-feature sntp-server-op;
presence "Enable this option";
description "OPTION_SNTP_SERVERS (31) Simple Network Time Protocol
(SNTP) Servers Option";
@@ -414,7 +420,7 @@ module ietf-dhcpv6-options {
}
container info-refresh-time-option {
//if-feature info-refresh-time-op;
if-feature info-refresh-time-op;
presence "Enable this option";
description "OPTION_INFORMATION_REFRESH_TIME (32) Information Refresh
Time option.";
@@ -428,7 +434,7 @@ module ietf-dhcpv6-options {
}
container client-fqdn-option {
//if-feature client-fqdn-op;
if-feature client-fqdn-op;
presence "Enable this option";
description "OPTION_CLIENT_FQDN (39) DHCPv6 Client FQDN Option";
reference "RFC4704: The Dynamic Host Configuration Protocol for IPv6
@@ -451,7 +457,7 @@ module ietf-dhcpv6-options {
}
container posix-timezone-option {
//if-feature posix-timezone-op;
if-feature posix-timezone-op;
presence "Enable this option";
description "OPTION_NEW_POSIX_TIMEZONE (41) Posix Timezone option";
reference "RFC4833: Timezone Options for DHCP";
@@ -463,7 +469,7 @@ module ietf-dhcpv6-options {
}
container tzdb-timezone-option {
//if-feature tzdb-timezone-op;
if-feature tzdb-timezone-op;
presence "Enable this option";
description "OPTION_NEW_TZDB_TIMEZONE (42) Timezone Database option";
reference "RFC4822: Timezone Options for DHCP";
@@ -480,7 +486,7 @@ module ietf-dhcpv6-options {
// Zihao - Re-modelled so it only contains one time source suboption
//if-feature ntp-server-op;
if-feature ntp-server-op;
presence "Enable this option";
description "OPTION_NTP_SERVER (56) NTP Server Option for DHCPv6";
reference "RFC5908: Network Time Protocol (NTP) Server Option for
@@ -494,63 +500,63 @@ module ietf-dhcpv6-options {
description "NTP server id";
}
choice ntp-time-source-suboption {
description "Select a NTP time source suboption.";
case server-address {
leaf-list ntp-serv-addr-suboption {
type inet:ipv6-address;
description "NTP server addr";
}
description "Select a NTP time source suboption.";
case server-address {
leaf-list ntp-serv-addr-suboption {
type inet:ipv6-address;
description "NTP server addr";
}
}
case server-multicast-address {
leaf-list ntp-serv-mul-addr-suboption {
case server-multicast-address {
leaf-list ntp-serv-mul-addr-suboption {
type inet:ipv6-address;
description "NTP server multicast addr";
description "NTP server multicast addr";
}
}
case server-fqdn {
leaf-list ntp-serv-fqdn-suboption {
}
case server-fqdn {
leaf-list ntp-serv-fqdn-suboption {
type string;
description "NTP server fqdn";
}
}
}
}
}
}
container boot-file-url-option {
//if-feature boot-file-url-op;
presence "Enable this option";
description "OPT_BOOTFILE_URL (59) Boot File URL option";
reference "RFC5970: DHCPv6 Options for Network Boot";
list boot-file {
key boot-file-id;
description "boot file info";
leaf boot-file-id {
type uint8;
mandatory true;
description "boot file id";
}
container boot-file-url-option {
if-feature boot-file-url-op;
presence "Enable this option";
description "OPT_BOOTFILE_URL (59) Boot File URL Option";
reference "RFC5970: DHCPv6 Options for Network Boot";
list boot-file {
key boot-file-id;
description "boot file info";
leaf boot-file-id {
type uint8;
mandatory true;
description "boot file id";
}
leaf-list suitable-arch-type {
type uint16;
description "architecture type";
}
leaf-list suitable-net-if {
type uint32;
description "network interface";
type uint32;
description "network interface";
}
leaf boot-file-url {
type string;
mandatory true;
description "url for boot file";
leaf boot-file-url {
type string;
mandatory true;
description "url for boot file";
}
}
}
}
}
container boot-file-param-option {
//if-feature boot-file-param-op;
presence "Enable this option";
description "OPT_BOOTFiLE_PARAM (60) Boot File Parameters Option";
reference "RFC5970: DHCPv6 Options for Network Boot";
container boot-file-param-option {
if-feature boot-file-param-op;
presence "Enable this option";
description "OPT_BOOTFiLE_PARAM (60) Boot File Parameters Option";
reference "RFC5970: DHCPv6 Options for Network Boot";
list boot-file-paras {
key para-id;
description "boot file parameters";
@@ -565,10 +571,10 @@ module ietf-dhcpv6-options {
description "parameter value";
}
}
}
}
container aftr-name-option {
//if-feature aftr-name-op;
if-feature aftr-name-op;
presence "Enable this option";
description "OPTION_AFTR_NAME (64) AFTR-Name DHCPv6 Option";
reference "RFC6334: Dynamic Host Configuration Protocol for IPv6
@@ -581,10 +587,10 @@ module ietf-dhcpv6-options {
}
container kbr-default-name-option {
//if-feature kbr-default-name-op;
presence "Enable this option";
description "OPTION_KRB_DEFAULT_REALM_NAME (77) Kerberos Default Realm Name Option";
reference "RFC6784: Kerberos Options for DHCPv6";
if-feature kbr-default-name-op;
presence "Enable this option";
description "OPTION_KRB_DEFAULT_REALM_NAME (77) Kerberos Default Realm Name Option";
reference "RFC6784: Kerberos Options for DHCPv6";
leaf default-realm-name {
type string;
mandatory true;
@@ -593,10 +599,10 @@ module ietf-dhcpv6-options {
}
container kbr-kdc-option {
//if-feature kbr-kdc-op;
presence "Enable this option";
description "OPTION_KRB_KDC (78) Kerberos KDB Option";
reference "RFC6784: Kerberos Options for DHCPv6";
if-feature kbr-kdc-op;
presence "Enable this option";
description "OPTION_KRB_KDC (78) Kerberos KDB Option";
reference "RFC6784: Kerberos Options for DHCPv6";
list kdc-info {
key kdc-id;
description "kdc info";
@@ -639,7 +645,7 @@ module ietf-dhcpv6-options {
}
container sol-max-rt-option {
//if-feature sol-max-rt-op;
if-feature sol-max-rt-op;
presence "Enable this option";
description "OPTION_SOL_MAX_RT (82) sol max rt option";
reference "RFC7083: Modification to Default Values of
@@ -652,7 +658,7 @@ module ietf-dhcpv6-options {
}
container inf-max-rt-option {
//if-feature inf-max-rt-op;
if-feature inf-max-rt-op;
presence "Enable this option";
description "OPTION_INF_MAX_RT (83) inf max rt option";
reference "RFC7083: Modification to Default Values of
@@ -665,7 +671,7 @@ module ietf-dhcpv6-options {
}
container addr-selection-option {
//if-feature addr-selection-op;
if-feature addr-selection-op;
presence "Enable this option";
description "OPTION_ADDRSEL (84) and OPTION_ADDRSEL_TABLE (85)";
reference "RFC7078: Distributing Address Selection Policy Using
@@ -715,7 +721,7 @@ module ietf-dhcpv6-options {
}
container pcp-server-option {
//if-feature pcp-server-op;
if-feature pcp-server-op;
presence "Enable this option";
description "OPTION_V6_PCP_SERVER (86) pcp server option";
reference "RFC7291: DHCP Options for the Port Control
@@ -737,7 +743,7 @@ module ietf-dhcpv6-options {
}
container s46-rule-option {
//if-feature s46-rule-op;
if-feature s46-rule-op;
presence "Enable this option";
description "OPTION_S46_RULE (89) S46 rule option";
reference "RFC7598: DHCPv6 Options for Configuration of
@@ -787,7 +793,7 @@ module ietf-dhcpv6-options {
}
container s46-br-option {
//if-feature s46-br-op;
if-feature s46-br-op;
presence "Enable this option";
description "OPTION_S46_BR (90) S46 BR Option";
reference "RFC7598: DHCPv6 Options for Configuration of
@@ -809,7 +815,7 @@ module ietf-dhcpv6-options {
}
container s46-dmr-option {
//if-feature s46-dmr-op;
if-feature s46-dmr-op;
presence "Enable this option";
description "OPTION_S46_DMR (91) S46 DMR Option";
reference "RFC7598: DHCPv6 Options for Configuration of
@@ -836,7 +842,7 @@ module ietf-dhcpv6-options {
}
container s46-v4-v6-binding-option {
//if-feature s46-v4-v6-binding-op;
if-feature s46-v4-v6-binding-op;
presence "Enable this option";
description "OPTION_S46_V4V6BIND (92) S46 IPv4/IPv6 Address
Binding option";
@@ -858,7 +864,8 @@ module ietf-dhcpv6-options {
leaf bind-prefix6-len {
type uint8;
mandatory true;
description "bind ipv6 prefix length";
description "bind ipv6 prefix
length";
}
leaf bind-ipv6-prefix {
type inet:ipv6-address;
@@ -878,7 +885,7 @@ module ietf-dhcpv6-options {
description "OPTION_RSOO (66) Relay-Supplied Options option";
reference "RFC6422: Relay-Supplied DHCP Options";
container erp-local-domain-name-option {
//if-feature erp-local-domain-name-op;
if-feature erp-local-domain-name-op;
presence "Enable this option";
description "OPTION_ERP_LOCAL_DOMAIN_NAME (65) DHCPv6 ERP Local
Domain Name Option";
@@ -942,7 +949,7 @@ module ietf-dhcpv6-options {
}
container option-request-option {
//if-feature option-request-op;
if-feature option-request-op;
presence "Enable this option";
description "OPTION_ORO (6) Option Request Option";
reference "RFC3315: Dynamic Host Configuration Protocol for
@@ -965,7 +972,7 @@ module ietf-dhcpv6-options {
}
container user-class-option {
//if-feature user-class-op;
if-feature user-class-op;
presence "Enable this option";
description "OPTION_USER_CLASS (15) User Class Option";
reference "RFC3315: Dynamic Host Configuration Protocol
@@ -990,7 +997,7 @@ module ietf-dhcpv6-options {
}
container vendor-class-option {
//if-feature vendor-class-op;
if-feature vendor-class-op;
presence "Enable this option";
description "OPTION_VENDOR_CLASS (16) Vendor Class Option";
reference "RFC3315: Dynamic Host Configuration Protocol
@@ -1001,8 +1008,8 @@ module ietf-dhcpv6-options {
description "enterprise number";
}
list vendor-class {
key vendor-class-id;
description "vendor class";
key vendor-class-id;
description "vendor class";
leaf vendor-class-id {
type uint8;
mandatory true;
@@ -1022,7 +1029,7 @@ module ietf-dhcpv6-options {
}
container client-fqdn-option {
//if-feature client-fqdn-op;
if-feature client-fqdn-op;
presence "Enable this option";
description "OPTION_CLIENT_FQDN (39) The Dynamic Host
Configuration Protocol for IPv6 (DHCPv6) Client Fully
@@ -1048,7 +1055,7 @@ module ietf-dhcpv6-options {
}
container client-arch-type-option {
//if-feature client-arch-type-op;
if-feature client-arch-type-op;
presence "Enable this option";
description "OPTION_CLIENT_ARCH_TYPE (61) Client System
Architecture Type Option";
@@ -1070,10 +1077,10 @@ module ietf-dhcpv6-options {
}
container client-network-interface-identifier-option {
//if-feature client-network-interface-identifier-op;
if-feature client-network-interface-identifier-op;
presence "Enable this option";
description "OPTION_NII (62) Client Network Interface
Identifier Option";
Identifier Option";
reference "RFC5970: DHCPv6 Options for Network Boot";
leaf type {
type uint8;
@@ -1093,47 +1100,47 @@ module ietf-dhcpv6-options {
}
container kbr-principal-name-option {
//if-feature kbr-principal-name-op;
if-feature kbr-principal-name-op;
presence "Enable this option";
description "OPTION_KRB_PRINCIPAL_NAME (75) Kerberos
Principal Name Option";
reference "RFC6784: Kerberos Options for DHCPv6";
list principle-name {
key principle-name-id;
description "principle name";
leaf principle-name-id {
type uint8;
mandatory true;
description "principle name id";
}
leaf name-type {
type int32;
mandatory true;
description "This field specifies the type of name that follows.";
}
leaf name-string {
type string;
mandatory true;
description "This field encodes a sequence of components that form
a name, each component encoded as a KerberoString";
}
key principle-name-id;
description "principle name";
leaf principle-name-id {
type uint8;
mandatory true;
description "principle name id";
}
leaf name-type {
type int32;
mandatory true;
description "This field specifies the type of name that follows.";
}
leaf name-string {
type string;
mandatory true;
description "This field encodes a sequence of components that form
a name, each component encoded as a KerberoString";
}
}
}
container kbr-realm-name-option {
//if-feature kbr-realm-name-op;
presence "Enable this option";
description "OPTION_KRB_REALM_NAME (76) Kerberos Realm Name Option";
reference "RFC6784: Kerberos Options for DHCPv6";
leaf realm-name {
type string;
mandatory true;
description "realm name";
}
if-feature kbr-realm-name-op;
presence "Enable this option";
description "OPTION_KRB_REALM_NAME (76) Kerberos Realm Name Option";
reference "RFC6784: Kerberos Options for DHCPv6";
leaf realm-name {
type string;
mandatory true;
description "realm name";
}
}
container client-link-layer-addr-option {
//if-feature client-link-layer-addr-op;
if-feature client-link-layer-addr-op;
presence "Enable this option";
description "OPTION_CLIENT_LINKLAYER_ADDR (79) DHCPv6 Client
Link-Layer Address Option";
@@ -1160,7 +1167,7 @@ module ietf-dhcpv6-options {
description "operator customized options";
container operator-option-ipv6-address {
//if-feature operator-op-ipv6-address;
if-feature operator-op-ipv6-address;
presence "Enable this option";
description "operator ipv6 address option";
reference "RFC7227: Guidelines for Creating New DHCPv6 Options";
@@ -1181,7 +1188,7 @@ module ietf-dhcpv6-options {
}
container operator-option-single-flag {
//if-feature operator-op-single-flag;
if-feature operator-op-single-flag;
presence "Enable this option";
description "operator single flag";
reference "RFC7227: Guidelines for Creating New DHCPv6
@@ -1203,7 +1210,7 @@ module ietf-dhcpv6-options {
}
container operator-option-ipv6-prefix {
//if-feature operator-op-ipv6-prefix;
if-feature operator-op-ipv6-prefix;
presence "Enable this option";
description "operator ipv6 prefix option";
reference "RFC7227: Guidelines for Creating New DHCPv6
@@ -1230,7 +1237,7 @@ module ietf-dhcpv6-options {
}
container operator-option-int32 {
//if-feature operator-op-int32;
if-feature operator-op-int32;
presence "Enable this option";
description "operator integer 32 option";
reference "RFC7227: Guidelines for Creating New DHCPv6
@@ -1252,7 +1259,7 @@ module ietf-dhcpv6-options {
}
container operator-option-int16 {
//if-feature operator-op-int16;
if-feature operator-op-int16;
presence "Enable this option";
description "operator integer 16 option";
reference "RFC7227: Guidelines for Creating New DHCPv6
@@ -1274,7 +1281,7 @@ module ietf-dhcpv6-options {
}
container operator-option-int8 {
//if-feature operator-op-int8;
if-feature operator-op-int8;
presence "Enable this option";
description "operator integer 8 option";
reference "RFC7227: Guidelines for Creating New DHCPv6
@@ -1296,7 +1303,7 @@ module ietf-dhcpv6-options {
}
container operator-option-uri {
//if-feature operator-op-uri;
if-feature operator-op-uri;
presence "Enable this option";
description "operator uri option";
reference "RFC7227: Guidelines for Creating New DHCPv6 Options";
@@ -1317,7 +1324,7 @@ module ietf-dhcpv6-options {
}
container operator-option-textstring {
//if-feature operator-op-textstring;
if-feature operator-op-textstring;
presence "Enable this option";
description "operator itext string option";
reference "RFC7227: Guidelines for Creating New DHCPv6 Options";
@@ -1338,7 +1345,7 @@ module ietf-dhcpv6-options {
}
container operator-option-var-data {
//if-feature operator-op-var-data;
if-feature operator-op-var-data;
presence "Enable this option";
description "operator variable length data option";
reference "RFC7227: Guidelines for Creating New DHCPv6 Options";
@@ -1359,7 +1366,7 @@ module ietf-dhcpv6-options {
}
container operator-option-dns-wire {
//if-feature operator-op-dns-wire;
if-feature operator-op-dns-wire;
presence "Enable this option";
description "operator dns wire format domain name list option";
reference "RFC7227: Guidelines for Creating New DHCPv6
@@ -1379,5 +1386,6 @@ module ietf-dhcpv6-options {
}
}
}
}
}

View File

@@ -30,6 +30,11 @@ module ietf-dhcpv6-relay {
"This model defines a YANG data model that can be
used to configure and manage a DHCPv6 relay.";
revision 2018-09-04 {
description "";
reference "I-D: draft-ietf-dhc-dhcpv6-yang";
}
revision 2018-03-04 {
description "Resolved most issues on the DHC official
github";
@@ -127,6 +132,7 @@ module ietf-dhcpv6-relay {
}
uses dhcpv6-types:vendor-infor;
}
container rsoo-option-sets {
description
"DHCPv6 relay agent could provide some information that would

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,11 @@ module ietf-dhcpv6-types {
description "This model defines a YANG data model that can be
used to define some commonly used DHCPv6 types";
revision 2018-09-04 {
description "";
reference "I-D: draft-ietf-dhc-dhcpv6-yang";
}
revision 2018-01-30 {
description "Initial revision";
reference "I-D: draft-ietf-dhc-dhcpv6-yang";