2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 05:27:55 +00:00

[5241] Added syntax, doc, parser, etc, but not the function

This commit is contained in:
Francis Dupont 2017-07-07 15:44:32 +02:00
parent 16fe95cf28
commit ac7850b430
24 changed files with 4545 additions and 4292 deletions

View File

@ -125,6 +125,14 @@
{
"name": "default-ip-ttl",
"data": "0xf0"
},
// At a few exceptions options are added to response only when
// the client requests them. The persistent flag should be used
// to enforce a particular option.
{
"name": "vendor-class-identifier",
"data": "isc",
"persistent": true
}
],

View File

@ -111,6 +111,15 @@
{
"name": "bootfile-param",
"data": "root=/dev/sda2, quiet, splash"
},
// At a few exceptions options are added to response only when
// the client requests them. The persistent flag should be used
// to enforce a particular option.
{
"name": "pana-agent",
"data": "2001:db8:2::123",
"persistent": true
}
],
"pools": [

View File

@ -990,8 +990,23 @@ temporarily override a list of interface names and listen on all interfaces.
},
...
]
} </screen>
}
</screen>
Defined options are added to response when the client requests them
at a few exceptions which are always added. To enforce the addition
of a particular option set the persistent flag to true as in:
<screen>
"Dhcp4": {
"option-data": [
{
<userinput>"name": "domain-name-servers",
"data": "192.0.2.1, 192.0.2.2",
"persistent": true</userinput>
},
...
]
}
</screen>
</para>
<para>
The <command>name</command> parameter specifies the option name. For a

View File

@ -1010,7 +1010,7 @@ temporarily override a list of interface names and listen on all interfaces.
be skipped, unless you want to specify the option value as
hexstring. Therefore the above example can be simplified to:
<screen>
"Dhcp4": {
"Dhcp6": {
"option-data": [
{
<userinput>"name": "dns-servers",
@ -1018,11 +1018,25 @@ temporarily override a list of interface names and listen on all interfaces.
},
...
]
} </screen>
}
</screen>
Defined options are added to response when the client requests them
at a few exceptions which are always added. To enforce the addition
of a particular option set the persistent flag to true as in:
<screen>
"Dhcp6": {
"option-data": [
{
<userinput>"name": "dns-servers",
"data": "2001:db8::cafe, 2001:db8::babe",
"persistent": true</userinput>
},
...
]
}
</screen>
</para>
<para>
It is possible to override options on a per-subnet basis. If
clients connected to most of your subnets are expected to get the

File diff suppressed because it is too large Load Diff

View File

@ -496,6 +496,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"persistent\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::OPTION_DATA:
return isc::dhcp::Dhcp4Parser::make_PERSISTENT(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("persistent", driver.loc_);
}
}
\"pools\" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::SUBNET4:

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
#ifndef YY_PARSER4_DHCP4_PARSER_H_INCLUDED
# define YY_PARSER4_DHCP4_PARSER_H_INCLUDED
// // "%code requires" blocks.
#line 17 "dhcp4_parser.yy" // lalr1.cc:377
#line 17 "dhcp4_parser.yy" // lalr1.cc:392
#include <string>
#include <cc/data.h>
@ -52,7 +52,7 @@ using namespace isc::dhcp;
using namespace isc::data;
using namespace std;
#line 56 "dhcp4_parser.h" // lalr1.cc:377
#line 56 "dhcp4_parser.h" // lalr1.cc:392
# include <cassert>
# include <cstdlib> // std::abort
@ -135,9 +135,9 @@ using namespace std;
# endif /* ! defined YYDEBUG */
#endif /* ! defined PARSER4_DEBUG */
#line 14 "dhcp4_parser.yy" // lalr1.cc:377
#line 14 "dhcp4_parser.yy" // lalr1.cc:392
namespace isc { namespace dhcp {
#line 141 "dhcp4_parser.h" // lalr1.cc:377
#line 141 "dhcp4_parser.h" // lalr1.cc:392
@ -398,95 +398,96 @@ namespace isc { namespace dhcp {
TOKEN_CODE = 306,
TOKEN_SPACE = 307,
TOKEN_CSV_FORMAT = 308,
TOKEN_RECORD_TYPES = 309,
TOKEN_ENCAPSULATE = 310,
TOKEN_ARRAY = 311,
TOKEN_POOLS = 312,
TOKEN_POOL = 313,
TOKEN_USER_CONTEXT = 314,
TOKEN_SUBNET = 315,
TOKEN_INTERFACE = 316,
TOKEN_INTERFACE_ID = 317,
TOKEN_ID = 318,
TOKEN_RAPID_COMMIT = 319,
TOKEN_RESERVATION_MODE = 320,
TOKEN_DISABLED = 321,
TOKEN_OUT_OF_POOL = 322,
TOKEN_ALL = 323,
TOKEN_HOST_RESERVATION_IDENTIFIERS = 324,
TOKEN_CLIENT_CLASSES = 325,
TOKEN_TEST = 326,
TOKEN_CLIENT_CLASS = 327,
TOKEN_RESERVATIONS = 328,
TOKEN_DUID = 329,
TOKEN_HW_ADDRESS = 330,
TOKEN_CIRCUIT_ID = 331,
TOKEN_CLIENT_ID = 332,
TOKEN_HOSTNAME = 333,
TOKEN_FLEX_ID = 334,
TOKEN_RELAY = 335,
TOKEN_IP_ADDRESS = 336,
TOKEN_HOOKS_LIBRARIES = 337,
TOKEN_LIBRARY = 338,
TOKEN_PARAMETERS = 339,
TOKEN_EXPIRED_LEASES_PROCESSING = 340,
TOKEN_RECLAIM_TIMER_WAIT_TIME = 341,
TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 342,
TOKEN_HOLD_RECLAIMED_TIME = 343,
TOKEN_MAX_RECLAIM_LEASES = 344,
TOKEN_MAX_RECLAIM_TIME = 345,
TOKEN_UNWARNED_RECLAIM_CYCLES = 346,
TOKEN_DHCP4O6_PORT = 347,
TOKEN_CONTROL_SOCKET = 348,
TOKEN_SOCKET_TYPE = 349,
TOKEN_SOCKET_NAME = 350,
TOKEN_DHCP_DDNS = 351,
TOKEN_ENABLE_UPDATES = 352,
TOKEN_QUALIFYING_SUFFIX = 353,
TOKEN_SERVER_IP = 354,
TOKEN_SERVER_PORT = 355,
TOKEN_SENDER_IP = 356,
TOKEN_SENDER_PORT = 357,
TOKEN_MAX_QUEUE_SIZE = 358,
TOKEN_NCR_PROTOCOL = 359,
TOKEN_NCR_FORMAT = 360,
TOKEN_ALWAYS_INCLUDE_FQDN = 361,
TOKEN_OVERRIDE_NO_UPDATE = 362,
TOKEN_OVERRIDE_CLIENT_UPDATE = 363,
TOKEN_REPLACE_CLIENT_NAME = 364,
TOKEN_GENERATED_PREFIX = 365,
TOKEN_TCP = 366,
TOKEN_JSON = 367,
TOKEN_WHEN_PRESENT = 368,
TOKEN_NEVER = 369,
TOKEN_ALWAYS = 370,
TOKEN_WHEN_NOT_PRESENT = 371,
TOKEN_LOGGING = 372,
TOKEN_LOGGERS = 373,
TOKEN_OUTPUT_OPTIONS = 374,
TOKEN_OUTPUT = 375,
TOKEN_DEBUGLEVEL = 376,
TOKEN_SEVERITY = 377,
TOKEN_FLUSH = 378,
TOKEN_MAXSIZE = 379,
TOKEN_MAXVER = 380,
TOKEN_DHCP6 = 381,
TOKEN_DHCPDDNS = 382,
TOKEN_TOPLEVEL_JSON = 383,
TOKEN_TOPLEVEL_DHCP4 = 384,
TOKEN_SUB_DHCP4 = 385,
TOKEN_SUB_INTERFACES4 = 386,
TOKEN_SUB_SUBNET4 = 387,
TOKEN_SUB_POOL4 = 388,
TOKEN_SUB_RESERVATION = 389,
TOKEN_SUB_OPTION_DEF = 390,
TOKEN_SUB_OPTION_DATA = 391,
TOKEN_SUB_HOOKS_LIBRARY = 392,
TOKEN_SUB_DHCP_DDNS = 393,
TOKEN_STRING = 394,
TOKEN_INTEGER = 395,
TOKEN_FLOAT = 396,
TOKEN_BOOLEAN = 397
TOKEN_PERSISTENT = 309,
TOKEN_RECORD_TYPES = 310,
TOKEN_ENCAPSULATE = 311,
TOKEN_ARRAY = 312,
TOKEN_POOLS = 313,
TOKEN_POOL = 314,
TOKEN_USER_CONTEXT = 315,
TOKEN_SUBNET = 316,
TOKEN_INTERFACE = 317,
TOKEN_INTERFACE_ID = 318,
TOKEN_ID = 319,
TOKEN_RAPID_COMMIT = 320,
TOKEN_RESERVATION_MODE = 321,
TOKEN_DISABLED = 322,
TOKEN_OUT_OF_POOL = 323,
TOKEN_ALL = 324,
TOKEN_HOST_RESERVATION_IDENTIFIERS = 325,
TOKEN_CLIENT_CLASSES = 326,
TOKEN_TEST = 327,
TOKEN_CLIENT_CLASS = 328,
TOKEN_RESERVATIONS = 329,
TOKEN_DUID = 330,
TOKEN_HW_ADDRESS = 331,
TOKEN_CIRCUIT_ID = 332,
TOKEN_CLIENT_ID = 333,
TOKEN_HOSTNAME = 334,
TOKEN_FLEX_ID = 335,
TOKEN_RELAY = 336,
TOKEN_IP_ADDRESS = 337,
TOKEN_HOOKS_LIBRARIES = 338,
TOKEN_LIBRARY = 339,
TOKEN_PARAMETERS = 340,
TOKEN_EXPIRED_LEASES_PROCESSING = 341,
TOKEN_RECLAIM_TIMER_WAIT_TIME = 342,
TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 343,
TOKEN_HOLD_RECLAIMED_TIME = 344,
TOKEN_MAX_RECLAIM_LEASES = 345,
TOKEN_MAX_RECLAIM_TIME = 346,
TOKEN_UNWARNED_RECLAIM_CYCLES = 347,
TOKEN_DHCP4O6_PORT = 348,
TOKEN_CONTROL_SOCKET = 349,
TOKEN_SOCKET_TYPE = 350,
TOKEN_SOCKET_NAME = 351,
TOKEN_DHCP_DDNS = 352,
TOKEN_ENABLE_UPDATES = 353,
TOKEN_QUALIFYING_SUFFIX = 354,
TOKEN_SERVER_IP = 355,
TOKEN_SERVER_PORT = 356,
TOKEN_SENDER_IP = 357,
TOKEN_SENDER_PORT = 358,
TOKEN_MAX_QUEUE_SIZE = 359,
TOKEN_NCR_PROTOCOL = 360,
TOKEN_NCR_FORMAT = 361,
TOKEN_ALWAYS_INCLUDE_FQDN = 362,
TOKEN_OVERRIDE_NO_UPDATE = 363,
TOKEN_OVERRIDE_CLIENT_UPDATE = 364,
TOKEN_REPLACE_CLIENT_NAME = 365,
TOKEN_GENERATED_PREFIX = 366,
TOKEN_TCP = 367,
TOKEN_JSON = 368,
TOKEN_WHEN_PRESENT = 369,
TOKEN_NEVER = 370,
TOKEN_ALWAYS = 371,
TOKEN_WHEN_NOT_PRESENT = 372,
TOKEN_LOGGING = 373,
TOKEN_LOGGERS = 374,
TOKEN_OUTPUT_OPTIONS = 375,
TOKEN_OUTPUT = 376,
TOKEN_DEBUGLEVEL = 377,
TOKEN_SEVERITY = 378,
TOKEN_FLUSH = 379,
TOKEN_MAXSIZE = 380,
TOKEN_MAXVER = 381,
TOKEN_DHCP6 = 382,
TOKEN_DHCPDDNS = 383,
TOKEN_TOPLEVEL_JSON = 384,
TOKEN_TOPLEVEL_DHCP4 = 385,
TOKEN_SUB_DHCP4 = 386,
TOKEN_SUB_INTERFACES4 = 387,
TOKEN_SUB_SUBNET4 = 388,
TOKEN_SUB_POOL4 = 389,
TOKEN_SUB_RESERVATION = 390,
TOKEN_SUB_OPTION_DEF = 391,
TOKEN_SUB_OPTION_DATA = 392,
TOKEN_SUB_HOOKS_LIBRARY = 393,
TOKEN_SUB_DHCP_DDNS = 394,
TOKEN_STRING = 395,
TOKEN_INTEGER = 396,
TOKEN_FLOAT = 397,
TOKEN_BOOLEAN = 398
};
};
@ -809,6 +810,10 @@ namespace isc { namespace dhcp {
symbol_type
make_CSV_FORMAT (const location_type& l);
static inline
symbol_type
make_PERSISTENT (const location_type& l);
static inline
symbol_type
make_RECORD_TYPES (const location_type& l);
@ -1370,12 +1375,12 @@ namespace isc { namespace dhcp {
enum
{
yyeof_ = 0,
yylast_ = 743, ///< Last index in yytable_.
yynnts_ = 315, ///< Number of nonterminal symbols.
yylast_ = 751, ///< Last index in yytable_.
yynnts_ = 316, ///< Number of nonterminal symbols.
yyfinal_ = 24, ///< Termination state number.
yyterror_ = 1,
yyerrcode_ = 256,
yyntokens_ = 143 ///< Number of tokens.
yyntokens_ = 144 ///< Number of tokens.
};
@ -1431,9 +1436,9 @@ namespace isc { namespace dhcp {
105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, 136, 137, 138, 139, 140, 141, 142
135, 136, 137, 138, 139, 140, 141, 142, 143
};
const unsigned int user_token_number_max_ = 397;
const unsigned int user_token_number_max_ = 398;
const token_number_type undef_token_ = 2;
if (static_cast<int>(t) <= yyeof_)
@ -1466,29 +1471,29 @@ namespace isc { namespace dhcp {
{
switch (other.type_get ())
{
case 156: // value
case 160: // map_value
case 198: // socket_type
case 208: // db_type
case 285: // hr_mode
case 417: // ncr_protocol_value
case 425: // replace_client_name_value
case 157: // value
case 161: // map_value
case 199: // socket_type
case 209: // db_type
case 286: // hr_mode
case 419: // ncr_protocol_value
case 427: // replace_client_name_value
value.copy< ElementPtr > (other.value);
break;
case 142: // "boolean"
case 143: // "boolean"
value.copy< bool > (other.value);
break;
case 141: // "floating point"
case 142: // "floating point"
value.copy< double > (other.value);
break;
case 140: // "integer"
case 141: // "integer"
value.copy< int64_t > (other.value);
break;
case 139: // "constant string"
case 140: // "constant string"
value.copy< std::string > (other.value);
break;
@ -1509,29 +1514,29 @@ namespace isc { namespace dhcp {
(void) v;
switch (this->type_get ())
{
case 156: // value
case 160: // map_value
case 198: // socket_type
case 208: // db_type
case 285: // hr_mode
case 417: // ncr_protocol_value
case 425: // replace_client_name_value
case 157: // value
case 161: // map_value
case 199: // socket_type
case 209: // db_type
case 286: // hr_mode
case 419: // ncr_protocol_value
case 427: // replace_client_name_value
value.copy< ElementPtr > (v);
break;
case 142: // "boolean"
case 143: // "boolean"
value.copy< bool > (v);
break;
case 141: // "floating point"
case 142: // "floating point"
value.copy< double > (v);
break;
case 140: // "integer"
case 141: // "integer"
value.copy< int64_t > (v);
break;
case 139: // "constant string"
case 140: // "constant string"
value.copy< std::string > (v);
break;
@ -1611,29 +1616,29 @@ namespace isc { namespace dhcp {
// Type destructor.
switch (yytype)
{
case 156: // value
case 160: // map_value
case 198: // socket_type
case 208: // db_type
case 285: // hr_mode
case 417: // ncr_protocol_value
case 425: // replace_client_name_value
case 157: // value
case 161: // map_value
case 199: // socket_type
case 209: // db_type
case 286: // hr_mode
case 419: // ncr_protocol_value
case 427: // replace_client_name_value
value.template destroy< ElementPtr > ();
break;
case 142: // "boolean"
case 143: // "boolean"
value.template destroy< bool > ();
break;
case 141: // "floating point"
case 142: // "floating point"
value.template destroy< double > ();
break;
case 140: // "integer"
case 141: // "integer"
value.template destroy< int64_t > ();
break;
case 139: // "constant string"
case 140: // "constant string"
value.template destroy< std::string > ();
break;
@ -1660,29 +1665,29 @@ namespace isc { namespace dhcp {
super_type::move(s);
switch (this->type_get ())
{
case 156: // value
case 160: // map_value
case 198: // socket_type
case 208: // db_type
case 285: // hr_mode
case 417: // ncr_protocol_value
case 425: // replace_client_name_value
case 157: // value
case 161: // map_value
case 199: // socket_type
case 209: // db_type
case 286: // hr_mode
case 419: // ncr_protocol_value
case 427: // replace_client_name_value
value.move< ElementPtr > (s.value);
break;
case 142: // "boolean"
case 143: // "boolean"
value.move< bool > (s.value);
break;
case 141: // "floating point"
case 142: // "floating point"
value.move< double > (s.value);
break;
case 140: // "integer"
case 141: // "integer"
value.move< int64_t > (s.value);
break;
case 139: // "constant string"
case 140: // "constant string"
value.move< std::string > (s.value);
break;
@ -1755,7 +1760,7 @@ namespace isc { namespace dhcp {
365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
395, 396, 397
395, 396, 397, 398
};
return static_cast<token_type> (yytoken_number_[type]);
}
@ -2072,6 +2077,12 @@ namespace isc { namespace dhcp {
return symbol_type (token::TOKEN_CSV_FORMAT, l);
}
Dhcp4Parser::symbol_type
Dhcp4Parser::make_PERSISTENT (const location_type& l)
{
return symbol_type (token::TOKEN_PERSISTENT, l);
}
Dhcp4Parser::symbol_type
Dhcp4Parser::make_RECORD_TYPES (const location_type& l)
{
@ -2607,9 +2618,9 @@ namespace isc { namespace dhcp {
}
#line 14 "dhcp4_parser.yy" // lalr1.cc:377
#line 14 "dhcp4_parser.yy" // lalr1.cc:392
} } // isc::dhcp
#line 2613 "dhcp4_parser.h" // lalr1.cc:377
#line 2624 "dhcp4_parser.h" // lalr1.cc:392

View File

@ -96,6 +96,7 @@ using namespace std;
CODE "code"
SPACE "space"
CSV_FORMAT "csv-format"
PERSISTENT "persistent"
RECORD_TYPES "record-types"
ENCAPSULATE "encapsulate"
ARRAY "array"
@ -1131,6 +1132,7 @@ option_data_param: option_data_name
| option_data_code
| option_data_space
| option_data_csv_format
| option_data_persistent
| unknown_map_entry
;
@ -1153,6 +1155,11 @@ option_data_csv_format: CSV_FORMAT COLON BOOLEAN {
ctx.stack_.back()->set("csv-format", space);
};
option_data_persistent: PERSISTENT COLON BOOLEAN {
ElementPtr persist(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("persistent", persist);
};
// ---- pools ------------------------------------
// This defines the "pools": [ ... ] entry that may appear in subnet4.

View File

@ -45,7 +45,8 @@ const SimpleDefaults SimpleParser4::OPTION4_DEF_DEFAULTS = {
/// for those option-data declarations.
const SimpleDefaults SimpleParser4::OPTION4_DEFAULTS = {
{ "space", Element::string, "dhcp4"},
{ "csv-format", Element::boolean, "true"}
{ "csv-format", Element::boolean, "true"},
{ "persistent", Element::boolean, "false"}
};
/// @brief This table defines default global values for DHCPv4

View File

@ -3264,6 +3264,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"dhcp-message\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -3271,6 +3272,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"01\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -3358,6 +3360,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"dhcp-message\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -3365,6 +3368,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"01\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -3430,6 +3434,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"dhcp-message\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -3437,6 +3442,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"1234\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" }\n"
" ],\n"
@ -3523,6 +3529,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"1234\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" },\n"
" {\n"
@ -3530,6 +3537,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.168.2.1\",\n"
" \"name\": \"foo2\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" }\n"
" ],\n"
@ -3599,6 +3607,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"11\",\n"
" \"name\": \"base-option\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -3606,6 +3615,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"1234\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" },\n"
" {\n"
@ -3613,6 +3623,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.168.2.1\",\n"
" \"name\": \"foo2\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" }\n"
" ],\n"
@ -3717,6 +3728,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"AB\",\n"
" \"name\": \"dhcp-message\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -3736,6 +3748,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"dhcp-message\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -3743,6 +3756,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"01\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -3819,6 +3833,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"0102030405060708090A\",\n"
" \"name\": \"dhcp-message\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -3852,6 +3867,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"FF\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -3931,6 +3947,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"dhcp-message\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -3938,6 +3955,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"01\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -4014,6 +4032,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"dhcp-message\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -4026,6 +4045,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"01\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -4088,6 +4108,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"1234\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-encapsulated-options-space\"\n"
" },\n"
" {\n"
@ -4095,6 +4116,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.168.2.1\",\n"
" \"name\": \"foo2\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-encapsulated-options-space\"\n"
" }\n"
" ],\n"
@ -4164,6 +4186,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"0104000004D20204C0A80201\",\n"
" \"name\": \"vendor-encapsulated-options\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -4171,6 +4194,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"1234\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-encapsulated-options-space\"\n"
" },\n"
" {\n"
@ -4178,6 +4202,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.168.2.1\",\n"
" \"name\": \"foo2\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-encapsulated-options-space\"\n"
" }\n"
" ],\n"
@ -4272,12 +4297,14 @@ const char* UNPARSED_CONFIGS[] = {
" \"code\": 100,\n"
" \"csv-format\": false,\n"
" \"data\": \"1234\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-1234\"\n"
" },\n"
" {\n"
" \"code\": 100,\n"
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-4491\"\n"
" }\n"
" ],\n"
@ -4354,6 +4381,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"this is a string vendor-opt\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-4491\"\n"
" }\n"
" ],\n"
@ -4717,6 +4745,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.0.3.95\",\n"
" \"name\": \"name-servers\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -4724,6 +4753,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"11\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -4742,6 +4772,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.0.3.15\",\n"
" \"name\": \"name-servers\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -4749,6 +4780,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"32\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -4813,6 +4845,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.0.4.11\",\n"
" \"name\": \"name-servers\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" },\n"
" {\n"
@ -4820,6 +4853,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"95\",\n"
" \"name\": \"default-ip-ttl\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp4\"\n"
" }\n"
" ],\n"
@ -4917,6 +4951,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"123\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" }\n"
" ],\n"

File diff suppressed because it is too large Load Diff

View File

@ -699,6 +699,15 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"persistent\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::OPTION_DATA:
return isc::dhcp::Dhcp6Parser::make_PERSISTENT(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("persistent", driver.loc_);
}
}
\"pools\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::SUBNET6:

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
#ifndef YY_PARSER6_DHCP6_PARSER_H_INCLUDED
# define YY_PARSER6_DHCP6_PARSER_H_INCLUDED
// // "%code requires" blocks.
#line 17 "dhcp6_parser.yy" // lalr1.cc:377
#line 17 "dhcp6_parser.yy" // lalr1.cc:392
#include <string>
#include <cc/data.h>
@ -52,7 +52,7 @@ using namespace isc::dhcp;
using namespace isc::data;
using namespace std;
#line 56 "dhcp6_parser.h" // lalr1.cc:377
#line 56 "dhcp6_parser.h" // lalr1.cc:392
# include <cassert>
# include <cstdlib> // std::abort
@ -135,9 +135,9 @@ using namespace std;
# endif /* ! defined YYDEBUG */
#endif /* ! defined PARSER6_DEBUG */
#line 14 "dhcp6_parser.yy" // lalr1.cc:377
#line 14 "dhcp6_parser.yy" // lalr1.cc:392
namespace isc { namespace dhcp {
#line 141 "dhcp6_parser.h" // lalr1.cc:377
#line 141 "dhcp6_parser.h" // lalr1.cc:392
@ -388,113 +388,114 @@ namespace isc { namespace dhcp {
TOKEN_CODE = 296,
TOKEN_SPACE = 297,
TOKEN_CSV_FORMAT = 298,
TOKEN_RECORD_TYPES = 299,
TOKEN_ENCAPSULATE = 300,
TOKEN_ARRAY = 301,
TOKEN_POOLS = 302,
TOKEN_POOL = 303,
TOKEN_PD_POOLS = 304,
TOKEN_PREFIX = 305,
TOKEN_PREFIX_LEN = 306,
TOKEN_EXCLUDED_PREFIX = 307,
TOKEN_EXCLUDED_PREFIX_LEN = 308,
TOKEN_DELEGATED_LEN = 309,
TOKEN_USER_CONTEXT = 310,
TOKEN_SUBNET = 311,
TOKEN_INTERFACE = 312,
TOKEN_INTERFACE_ID = 313,
TOKEN_ID = 314,
TOKEN_RAPID_COMMIT = 315,
TOKEN_RESERVATION_MODE = 316,
TOKEN_DISABLED = 317,
TOKEN_OUT_OF_POOL = 318,
TOKEN_ALL = 319,
TOKEN_MAC_SOURCES = 320,
TOKEN_RELAY_SUPPLIED_OPTIONS = 321,
TOKEN_HOST_RESERVATION_IDENTIFIERS = 322,
TOKEN_CLIENT_CLASSES = 323,
TOKEN_TEST = 324,
TOKEN_CLIENT_CLASS = 325,
TOKEN_RESERVATIONS = 326,
TOKEN_IP_ADDRESSES = 327,
TOKEN_PREFIXES = 328,
TOKEN_DUID = 329,
TOKEN_HW_ADDRESS = 330,
TOKEN_HOSTNAME = 331,
TOKEN_FLEX_ID = 332,
TOKEN_RELAY = 333,
TOKEN_IP_ADDRESS = 334,
TOKEN_HOOKS_LIBRARIES = 335,
TOKEN_LIBRARY = 336,
TOKEN_PARAMETERS = 337,
TOKEN_EXPIRED_LEASES_PROCESSING = 338,
TOKEN_RECLAIM_TIMER_WAIT_TIME = 339,
TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 340,
TOKEN_HOLD_RECLAIMED_TIME = 341,
TOKEN_MAX_RECLAIM_LEASES = 342,
TOKEN_MAX_RECLAIM_TIME = 343,
TOKEN_UNWARNED_RECLAIM_CYCLES = 344,
TOKEN_SERVER_ID = 345,
TOKEN_LLT = 346,
TOKEN_EN = 347,
TOKEN_LL = 348,
TOKEN_IDENTIFIER = 349,
TOKEN_HTYPE = 350,
TOKEN_TIME = 351,
TOKEN_ENTERPRISE_ID = 352,
TOKEN_DHCP4O6_PORT = 353,
TOKEN_CONTROL_SOCKET = 354,
TOKEN_SOCKET_TYPE = 355,
TOKEN_SOCKET_NAME = 356,
TOKEN_DHCP_DDNS = 357,
TOKEN_ENABLE_UPDATES = 358,
TOKEN_QUALIFYING_SUFFIX = 359,
TOKEN_SERVER_IP = 360,
TOKEN_SERVER_PORT = 361,
TOKEN_SENDER_IP = 362,
TOKEN_SENDER_PORT = 363,
TOKEN_MAX_QUEUE_SIZE = 364,
TOKEN_NCR_PROTOCOL = 365,
TOKEN_NCR_FORMAT = 366,
TOKEN_ALWAYS_INCLUDE_FQDN = 367,
TOKEN_OVERRIDE_NO_UPDATE = 368,
TOKEN_OVERRIDE_CLIENT_UPDATE = 369,
TOKEN_REPLACE_CLIENT_NAME = 370,
TOKEN_GENERATED_PREFIX = 371,
TOKEN_UDP = 372,
TOKEN_TCP = 373,
TOKEN_JSON = 374,
TOKEN_WHEN_PRESENT = 375,
TOKEN_NEVER = 376,
TOKEN_ALWAYS = 377,
TOKEN_WHEN_NOT_PRESENT = 378,
TOKEN_LOGGING = 379,
TOKEN_LOGGERS = 380,
TOKEN_OUTPUT_OPTIONS = 381,
TOKEN_OUTPUT = 382,
TOKEN_DEBUGLEVEL = 383,
TOKEN_SEVERITY = 384,
TOKEN_FLUSH = 385,
TOKEN_MAXSIZE = 386,
TOKEN_MAXVER = 387,
TOKEN_DHCP4 = 388,
TOKEN_DHCPDDNS = 389,
TOKEN_TOPLEVEL_JSON = 390,
TOKEN_TOPLEVEL_DHCP6 = 391,
TOKEN_SUB_DHCP6 = 392,
TOKEN_SUB_INTERFACES6 = 393,
TOKEN_SUB_SUBNET6 = 394,
TOKEN_SUB_POOL6 = 395,
TOKEN_SUB_PD_POOL = 396,
TOKEN_SUB_RESERVATION = 397,
TOKEN_SUB_OPTION_DEF = 398,
TOKEN_SUB_OPTION_DATA = 399,
TOKEN_SUB_HOOKS_LIBRARY = 400,
TOKEN_SUB_DHCP_DDNS = 401,
TOKEN_STRING = 402,
TOKEN_INTEGER = 403,
TOKEN_FLOAT = 404,
TOKEN_BOOLEAN = 405
TOKEN_PERSISTENT = 299,
TOKEN_RECORD_TYPES = 300,
TOKEN_ENCAPSULATE = 301,
TOKEN_ARRAY = 302,
TOKEN_POOLS = 303,
TOKEN_POOL = 304,
TOKEN_PD_POOLS = 305,
TOKEN_PREFIX = 306,
TOKEN_PREFIX_LEN = 307,
TOKEN_EXCLUDED_PREFIX = 308,
TOKEN_EXCLUDED_PREFIX_LEN = 309,
TOKEN_DELEGATED_LEN = 310,
TOKEN_USER_CONTEXT = 311,
TOKEN_SUBNET = 312,
TOKEN_INTERFACE = 313,
TOKEN_INTERFACE_ID = 314,
TOKEN_ID = 315,
TOKEN_RAPID_COMMIT = 316,
TOKEN_RESERVATION_MODE = 317,
TOKEN_DISABLED = 318,
TOKEN_OUT_OF_POOL = 319,
TOKEN_ALL = 320,
TOKEN_MAC_SOURCES = 321,
TOKEN_RELAY_SUPPLIED_OPTIONS = 322,
TOKEN_HOST_RESERVATION_IDENTIFIERS = 323,
TOKEN_CLIENT_CLASSES = 324,
TOKEN_TEST = 325,
TOKEN_CLIENT_CLASS = 326,
TOKEN_RESERVATIONS = 327,
TOKEN_IP_ADDRESSES = 328,
TOKEN_PREFIXES = 329,
TOKEN_DUID = 330,
TOKEN_HW_ADDRESS = 331,
TOKEN_HOSTNAME = 332,
TOKEN_FLEX_ID = 333,
TOKEN_RELAY = 334,
TOKEN_IP_ADDRESS = 335,
TOKEN_HOOKS_LIBRARIES = 336,
TOKEN_LIBRARY = 337,
TOKEN_PARAMETERS = 338,
TOKEN_EXPIRED_LEASES_PROCESSING = 339,
TOKEN_RECLAIM_TIMER_WAIT_TIME = 340,
TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 341,
TOKEN_HOLD_RECLAIMED_TIME = 342,
TOKEN_MAX_RECLAIM_LEASES = 343,
TOKEN_MAX_RECLAIM_TIME = 344,
TOKEN_UNWARNED_RECLAIM_CYCLES = 345,
TOKEN_SERVER_ID = 346,
TOKEN_LLT = 347,
TOKEN_EN = 348,
TOKEN_LL = 349,
TOKEN_IDENTIFIER = 350,
TOKEN_HTYPE = 351,
TOKEN_TIME = 352,
TOKEN_ENTERPRISE_ID = 353,
TOKEN_DHCP4O6_PORT = 354,
TOKEN_CONTROL_SOCKET = 355,
TOKEN_SOCKET_TYPE = 356,
TOKEN_SOCKET_NAME = 357,
TOKEN_DHCP_DDNS = 358,
TOKEN_ENABLE_UPDATES = 359,
TOKEN_QUALIFYING_SUFFIX = 360,
TOKEN_SERVER_IP = 361,
TOKEN_SERVER_PORT = 362,
TOKEN_SENDER_IP = 363,
TOKEN_SENDER_PORT = 364,
TOKEN_MAX_QUEUE_SIZE = 365,
TOKEN_NCR_PROTOCOL = 366,
TOKEN_NCR_FORMAT = 367,
TOKEN_ALWAYS_INCLUDE_FQDN = 368,
TOKEN_OVERRIDE_NO_UPDATE = 369,
TOKEN_OVERRIDE_CLIENT_UPDATE = 370,
TOKEN_REPLACE_CLIENT_NAME = 371,
TOKEN_GENERATED_PREFIX = 372,
TOKEN_UDP = 373,
TOKEN_TCP = 374,
TOKEN_JSON = 375,
TOKEN_WHEN_PRESENT = 376,
TOKEN_NEVER = 377,
TOKEN_ALWAYS = 378,
TOKEN_WHEN_NOT_PRESENT = 379,
TOKEN_LOGGING = 380,
TOKEN_LOGGERS = 381,
TOKEN_OUTPUT_OPTIONS = 382,
TOKEN_OUTPUT = 383,
TOKEN_DEBUGLEVEL = 384,
TOKEN_SEVERITY = 385,
TOKEN_FLUSH = 386,
TOKEN_MAXSIZE = 387,
TOKEN_MAXVER = 388,
TOKEN_DHCP4 = 389,
TOKEN_DHCPDDNS = 390,
TOKEN_TOPLEVEL_JSON = 391,
TOKEN_TOPLEVEL_DHCP6 = 392,
TOKEN_SUB_DHCP6 = 393,
TOKEN_SUB_INTERFACES6 = 394,
TOKEN_SUB_SUBNET6 = 395,
TOKEN_SUB_POOL6 = 396,
TOKEN_SUB_PD_POOL = 397,
TOKEN_SUB_RESERVATION = 398,
TOKEN_SUB_OPTION_DEF = 399,
TOKEN_SUB_OPTION_DATA = 400,
TOKEN_SUB_HOOKS_LIBRARY = 401,
TOKEN_SUB_DHCP_DDNS = 402,
TOKEN_STRING = 403,
TOKEN_INTEGER = 404,
TOKEN_FLOAT = 405,
TOKEN_BOOLEAN = 406
};
};
@ -777,6 +778,10 @@ namespace isc { namespace dhcp {
symbol_type
make_CSV_FORMAT (const location_type& l);
static inline
symbol_type
make_PERSISTENT (const location_type& l);
static inline
symbol_type
make_RECORD_TYPES (const location_type& l);
@ -1410,12 +1415,12 @@ namespace isc { namespace dhcp {
enum
{
yyeof_ = 0,
yylast_ = 795, ///< Last index in yytable_.
yynnts_ = 332, ///< Number of nonterminal symbols.
yylast_ = 799, ///< Last index in yytable_.
yynnts_ = 333, ///< Number of nonterminal symbols.
yyfinal_ = 26, ///< Termination state number.
yyterror_ = 1,
yyerrcode_ = 256,
yyntokens_ = 151 ///< Number of tokens.
yyntokens_ = 152 ///< Number of tokens.
};
@ -1472,9 +1477,9 @@ namespace isc { namespace dhcp {
115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
145, 146, 147, 148, 149, 150
145, 146, 147, 148, 149, 150, 151
};
const unsigned int user_token_number_max_ = 405;
const unsigned int user_token_number_max_ = 406;
const token_number_type undef_token_ = 2;
if (static_cast<int>(t) <= yyeof_)
@ -1507,29 +1512,29 @@ namespace isc { namespace dhcp {
{
switch (other.type_get ())
{
case 165: // value
case 169: // map_value
case 213: // db_type
case 289: // hr_mode
case 409: // duid_type
case 442: // ncr_protocol_value
case 450: // replace_client_name_value
case 166: // value
case 170: // map_value
case 214: // db_type
case 290: // hr_mode
case 411: // duid_type
case 444: // ncr_protocol_value
case 452: // replace_client_name_value
value.copy< ElementPtr > (other.value);
break;
case 150: // "boolean"
case 151: // "boolean"
value.copy< bool > (other.value);
break;
case 149: // "floating point"
case 150: // "floating point"
value.copy< double > (other.value);
break;
case 148: // "integer"
case 149: // "integer"
value.copy< int64_t > (other.value);
break;
case 147: // "constant string"
case 148: // "constant string"
value.copy< std::string > (other.value);
break;
@ -1550,29 +1555,29 @@ namespace isc { namespace dhcp {
(void) v;
switch (this->type_get ())
{
case 165: // value
case 169: // map_value
case 213: // db_type
case 289: // hr_mode
case 409: // duid_type
case 442: // ncr_protocol_value
case 450: // replace_client_name_value
case 166: // value
case 170: // map_value
case 214: // db_type
case 290: // hr_mode
case 411: // duid_type
case 444: // ncr_protocol_value
case 452: // replace_client_name_value
value.copy< ElementPtr > (v);
break;
case 150: // "boolean"
case 151: // "boolean"
value.copy< bool > (v);
break;
case 149: // "floating point"
case 150: // "floating point"
value.copy< double > (v);
break;
case 148: // "integer"
case 149: // "integer"
value.copy< int64_t > (v);
break;
case 147: // "constant string"
case 148: // "constant string"
value.copy< std::string > (v);
break;
@ -1652,29 +1657,29 @@ namespace isc { namespace dhcp {
// Type destructor.
switch (yytype)
{
case 165: // value
case 169: // map_value
case 213: // db_type
case 289: // hr_mode
case 409: // duid_type
case 442: // ncr_protocol_value
case 450: // replace_client_name_value
case 166: // value
case 170: // map_value
case 214: // db_type
case 290: // hr_mode
case 411: // duid_type
case 444: // ncr_protocol_value
case 452: // replace_client_name_value
value.template destroy< ElementPtr > ();
break;
case 150: // "boolean"
case 151: // "boolean"
value.template destroy< bool > ();
break;
case 149: // "floating point"
case 150: // "floating point"
value.template destroy< double > ();
break;
case 148: // "integer"
case 149: // "integer"
value.template destroy< int64_t > ();
break;
case 147: // "constant string"
case 148: // "constant string"
value.template destroy< std::string > ();
break;
@ -1701,29 +1706,29 @@ namespace isc { namespace dhcp {
super_type::move(s);
switch (this->type_get ())
{
case 165: // value
case 169: // map_value
case 213: // db_type
case 289: // hr_mode
case 409: // duid_type
case 442: // ncr_protocol_value
case 450: // replace_client_name_value
case 166: // value
case 170: // map_value
case 214: // db_type
case 290: // hr_mode
case 411: // duid_type
case 444: // ncr_protocol_value
case 452: // replace_client_name_value
value.move< ElementPtr > (s.value);
break;
case 150: // "boolean"
case 151: // "boolean"
value.move< bool > (s.value);
break;
case 149: // "floating point"
case 150: // "floating point"
value.move< double > (s.value);
break;
case 148: // "integer"
case 149: // "integer"
value.move< int64_t > (s.value);
break;
case 147: // "constant string"
case 148: // "constant string"
value.move< std::string > (s.value);
break;
@ -1797,7 +1802,7 @@ namespace isc { namespace dhcp {
375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
395, 396, 397, 398, 399, 400, 401, 402, 403, 404,
405
405, 406
};
return static_cast<token_type> (yytoken_number_[type]);
}
@ -2054,6 +2059,12 @@ namespace isc { namespace dhcp {
return symbol_type (token::TOKEN_CSV_FORMAT, l);
}
Dhcp6Parser::symbol_type
Dhcp6Parser::make_PERSISTENT (const location_type& l)
{
return symbol_type (token::TOKEN_PERSISTENT, l);
}
Dhcp6Parser::symbol_type
Dhcp6Parser::make_RECORD_TYPES (const location_type& l)
{
@ -2697,9 +2708,9 @@ namespace isc { namespace dhcp {
}
#line 14 "dhcp6_parser.yy" // lalr1.cc:377
#line 14 "dhcp6_parser.yy" // lalr1.cc:392
} } // isc::dhcp
#line 2703 "dhcp6_parser.h" // lalr1.cc:377
#line 2714 "dhcp6_parser.h" // lalr1.cc:392

View File

@ -85,6 +85,7 @@ using namespace std;
CODE "code"
SPACE "space"
CSV_FORMAT "csv-format"
PERSISTENT "persistent"
RECORD_TYPES "record-types"
ENCAPSULATE "encapsulate"
ARRAY "array"
@ -1119,6 +1120,7 @@ option_data_param: option_data_name
| option_data_code
| option_data_space
| option_data_csv_format
| option_data_persistent
| unknown_map_entry
;
@ -1141,6 +1143,11 @@ option_data_csv_format: CSV_FORMAT COLON BOOLEAN {
ctx.stack_.back()->set("csv-format", space);
};
option_data_persistent: PERSISTENT COLON BOOLEAN {
ElementPtr persist(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("persistent", persist);
};
// ---- pools ------------------------------------
// This defines the "pools": [ ... ] entry that may appear in subnet6.

View File

@ -45,7 +45,8 @@ const SimpleDefaults SimpleParser6::OPTION6_DEF_DEFAULTS = {
/// for those option-data declarations.
const SimpleDefaults SimpleParser6::OPTION6_DEFAULTS = {
{ "space", Element::string, "dhcp6"},
{ "csv-format", Element::boolean, "true"}
{ "csv-format", Element::boolean, "true"},
{ "persistent", Element::boolean, "false"}
};
/// @brief This table defines default global values for DHCPv6

View File

@ -3146,6 +3146,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"subscriber-id\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" },\n"
" {\n"
@ -3153,6 +3154,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"01\",\n"
" \"name\": \"preference\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -3253,6 +3255,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"subscriber-id\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" },\n"
" {\n"
@ -3260,6 +3263,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"01\",\n"
" \"name\": \"preference\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -3328,6 +3332,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"name\": \"subscriber-id\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" },\n"
" {\n"
@ -3335,6 +3340,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"1234\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" }\n"
" ],\n"
@ -3429,6 +3435,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"1234\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" },\n"
" {\n"
@ -3436,6 +3443,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.168.2.1\",\n"
" \"name\": \"foo2\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" }\n"
" ],\n"
@ -3514,6 +3522,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"11\",\n"
" \"name\": \"base-option\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" },\n"
" {\n"
@ -3521,6 +3530,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"1234\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" },\n"
" {\n"
@ -3528,6 +3538,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"192.168.2.1\",\n"
" \"name\": \"foo2\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" }\n"
" ],\n"
@ -3656,6 +3667,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"0102030405060708090A\",\n"
" \"name\": \"subscriber-id\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -3688,6 +3700,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"FFFEFDFCFB\",\n"
" \"name\": \"user-class\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -3778,6 +3791,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"112233445566\",\n"
" \"name\": \"subscriber-id\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -3794,6 +3808,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"AABBCCDDEE\",\n"
" \"name\": \"user-class\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -3809,6 +3824,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"0102030405060708090A\",\n"
" \"name\": \"subscriber-id\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -3821,6 +3837,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": false,\n"
" \"data\": \"FFFEFDFCFB\",\n"
" \"name\": \"user-class\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -3884,12 +3901,14 @@ const char* UNPARSED_CONFIGS[] = {
" \"code\": 100,\n"
" \"csv-format\": false,\n"
" \"data\": \"1234\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-1234\"\n"
" },\n"
" {\n"
" \"code\": 100,\n"
" \"csv-format\": false,\n"
" \"data\": \"ABCDEF0105\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-4491\"\n"
" }\n"
" ],\n"
@ -3974,6 +3993,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"this is a string vendor-opt\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"vendor-4491\"\n"
" }\n"
" ],\n"
@ -4530,6 +4550,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"2001:db8:2::abbc\",\n"
" \"name\": \"dns-servers\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" },\n"
" {\n"
@ -4537,6 +4558,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"25\",\n"
" \"name\": \"preference\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -4553,6 +4575,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"2001:db8:2::1111\",\n"
" \"name\": \"dns-servers\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" },\n"
" {\n"
@ -4560,6 +4583,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"11\",\n"
" \"name\": \"preference\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -4604,6 +4628,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"2001:db8:3::3333\",\n"
" \"name\": \"dns-servers\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" },\n"
" {\n"
@ -4611,6 +4636,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"33\",\n"
" \"name\": \"preference\",\n"
" \"persistent\": false,\n"
" \"space\": \"dhcp6\"\n"
" }\n"
" ],\n"
@ -4709,6 +4735,7 @@ const char* UNPARSED_CONFIGS[] = {
" \"csv-format\": true,\n"
" \"data\": \"11\",\n"
" \"name\": \"foo\",\n"
" \"persistent\": false,\n"
" \"space\": \"isc\"\n"
" }\n"
" ],\n"

View File

@ -224,6 +224,8 @@ CfgOption::toElement() const {
std::string repr = util::encode::encodeHex(bin);
map->set("data", Element::create(repr));
}
// Set the persistency flag
map->set("persistent", Element::create(opt->persistent_));
// Push on the list
result->add(map);
}
@ -265,6 +267,8 @@ CfgOption::toElement() const {
std::string repr = util::encode::encodeHex(bin);
map->set("data", Element::create(repr));
}
// Set the persistency flag
map->set("persistent", Element::create(opt->persistent_));
// Push on the list
result->add(map);
}

View File

@ -303,6 +303,19 @@ OptionDataParser::extractSpace(ConstElementPtr parent) const {
return (space);
}
OptionalValue<bool>
OptionDataParser::extractPersistent(ConstElementPtr parent) const {
bool persist = false;
try {
persist = getBoolean(parent, "persistent");
} catch (...) {
return (OptionalValue<bool>(persist));
}
return (OptionalValue<bool>(persist, OptionalValueState(true)));
}
template<typename SearchKey>
OptionDefinitionPtr
OptionDataParser::findOptionDefinition(const std::string& option_space,
@ -337,6 +350,7 @@ OptionDataParser::createOption(ConstElementPtr option_data) {
OptionalValue<uint32_t> code_param = extractCode(option_data);
OptionalValue<std::string> name_param = extractName(option_data);
OptionalValue<bool> csv_format_param = extractCSVFormat(option_data);
OptionalValue<bool> persist_param = extractPersistent(option_data);
std::string data_param = extractData(option_data);
std::string space_param = extractSpace(option_data);
@ -426,7 +440,7 @@ OptionDataParser::createOption(ConstElementPtr option_data) {
binary));
desc.option_ = option;
desc.persistent_ = false;
desc.persistent_ = persist_param.isSpecified() && persist_param;
} else {
// Option name is specified it should match the name in the definition.
@ -447,7 +461,7 @@ OptionDataParser::createOption(ConstElementPtr option_data) {
def->optionFactory(universe, def->getCode(), data_tokens) :
def->optionFactory(universe, def->getCode(), binary);
desc.option_ = option;
desc.persistent_ = false;
desc.persistent_ = persist_param.isSpecified() && persist_param;
if (use_csv) {
desc.formatted_value_ = data_param;
}

View File

@ -462,6 +462,11 @@ private:
/// @return Option space name.
std::string extractSpace(data::ConstElementPtr parent) const;
/// @brief Retrieves persistent parameter as an optional value.
///
/// @return Value of the persistent parameter, possibly unspecified.
util::OptionalValue<bool> extractPersistent(data::ConstElementPtr parent) const;
/// @brief Address family: @c AF_INET or @c AF_INET6.
uint16_t address_family_;
};

View File

@ -612,7 +612,7 @@ TEST_F(CfgOptionTest, unparse) {
OptionPtr opt3(new Option(Option::V6, D6O_STATUS_CODE, OptionBuffer(2, 0)));
cfg.add(opt3, false, DHCP6_OPTION_SPACE);
OptionPtr opt4(new Option(Option::V6, 100, OptionBuffer(4, 0x21)));
cfg.add(opt4, false, "vendor-1234");
cfg.add(opt4, true, "vendor-1234");
// Unparse
std::string expected = "[\n"
@ -620,23 +620,27 @@ TEST_F(CfgOptionTest, unparse) {
" \"code\": 100,\n"
" \"space\": \"dns\",\n"
" \"csv-format\": false,\n"
" \"data\": \"12121212\"\n"
" \"data\": \"12121212\",\n"
" \"persistent\": false\n"
"},{\n"
" \"code\": 101,\n"
" \"space\": \"dns\",\n"
" \"csv-format\": true,\n"
" \"data\": \"12, 12, 12, 12\"\n"
" \"data\": \"12, 12, 12, 12\",\n"
" \"persistent\": false\n"
"},{\n"
" \"code\": 13,\n"
" \"name\": \"status-code\",\n"
" \"space\": \"dhcp6\",\n"
" \"csv-format\": false,\n"
" \"data\": \"0000\"\n"
" \"data\": \"0000\",\n"
" \"persistent\": false\n"
"},{\n"
" \"code\": 100,\n"
" \"space\": \"vendor-1234\",\n"
" \"csv-format\": false,\n"
" \"data\": \"21212121\"\n"
" \"data\": \"21212121\",\n"
" \"persistent\": true\n"
"}]\n";
isc::test::runToElementTest<CfgOption>(expected, cfg);
}

View File

@ -621,13 +621,15 @@ const SimpleDefaults ParseConfigTest::OPTION4_DEF_DEFAULTS = {
/// This table defines default values for options in DHCPv6
const SimpleDefaults ParseConfigTest::OPTION6_DEFAULTS = {
{ "space", Element::string, "dhcp6"},
{ "csv-format", Element::boolean, "true"}
{ "csv-format", Element::boolean, "true"},
{ "persistent", Element::boolean,"false"}
};
/// This table defines default values for options in DHCPv4
const SimpleDefaults ParseConfigTest::OPTION4_DEFAULTS = {
{ "space", Element::string, "dhcp4"},
{ "csv-format", Element::boolean, "true"}
{ "csv-format", Element::boolean, "true"},
{ "persistent", Element::boolean, "false"}
};
/// This table defines default values for both DHCPv4 and DHCPv6
@ -861,7 +863,8 @@ TEST_F(ParseConfigTest, basicOptionDataTest) {
" \"space\": \"isc\","
" \"code\": 100,"
" \"data\": \"192.0.2.0\","
" \"csv-format\": true"
" \"csv-format\": true,"
" \"persistent\": false"
" } ]"
"}";

View File

@ -984,7 +984,8 @@ TEST_F(HostReservationParserTest, options4) {
"\"code\": 7,"
"\"csv-format\": true,"
"\"space\": \"dhcp4\","
"\"data\": \"172.16.15.23\""
"\"data\": \"172.16.15.23\","
"\"persistent\": false"
"},"
"{"
"\"name\": \"default-ip-ttl\","
@ -1034,11 +1035,13 @@ TEST_F(HostReservationParserTest, options4) {
option->set("code", Element::create(DHO_NAME_SERVERS));
option->set("space", Element::create(std::string(DHCP4_OPTION_SPACE)));
option->set("csv-format", Element::create(true));
option->set("persistent", Element::create(false));
option = config_element->get("option-data")->getNonConst(1);
option = config_element->get("option-data")->getNonConst(2);
option->set("code", Element::create(DHO_DEFAULT_IP_TTL));
option->set("space", Element::create(std::string(DHCP4_OPTION_SPACE)));
option->set("csv-format", Element::create(true));
option->set("persistent", Element::create(false));
ElementPtr expected = Element::createList();
expected->add(config_element);
@ -1071,7 +1074,8 @@ TEST_F(HostReservationParserTest, options6) {
"\"code\": 27,"
"\"csv-format\": true,"
"\"space\": \"dhcp6\","
"\"data\": \"2001:db8:1::1204\""
"\"data\": \"2001:db8:1::1204\","
"\"persistent\": true"
"},"
"{"
"\"name\": \"preference\","
@ -1122,11 +1126,13 @@ TEST_F(HostReservationParserTest, options6) {
option->set("code", Element::create(D6O_NAME_SERVERS));
option->set("space", Element::create(std::string(DHCP6_OPTION_SPACE)));
option->set("csv-format", Element::create(true));
option->set("persistent", Element::create(false));
option = config_element->get("option-data")->getNonConst(1);
option = config_element->get("option-data")->getNonConst(2);
option->set("code", Element::create(D6O_PREFERENCE));
option->set("space", Element::create(std::string(DHCP6_OPTION_SPACE)));
option->set("csv-format", Element::create(true));
option->set("persistent", Element::create(false));
config = prettyPrint(config_element);
boost::algorithm::to_lower(config);