Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
882e4eaa
Commit
882e4eaa
authored
Nov 13, 2016
by
Tomek Mrugalski
🛰
Browse files
Lease-database, hosts-database are now parsed properly
parent
bfc64c5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp6/dhcp6_lexer.ll
View file @
882e4eaa
...
...
@@ -115,7 +115,14 @@ JSONString \"{JSONStringCharacter}*\"
\
"Dhcp6\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_DHCP6
(
loc
)
; }
\
"interfaces-config\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_INTERFACES_CONFIG
(
loc
)
; }
\
"interfaces\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_INTERFACES
(
loc
)
; }
\
"lease-database\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_LEASE_DATABASE
(
loc
)
; }
\
"hosts-database\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_HOSTS_DATABASE
(
loc
)
; }
\
"type\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_TYPE
(
loc
)
; }
\
"user\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_USER
(
loc
)
; }
\
"password\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_PASSWORD
(
loc
)
; }
\
"host\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_HOST
(
loc
)
; }
\
"preferred-lifetime\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_PREFERRED_LIFETIME
(
loc
)
; }
\
"valid-lifetime\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_VALID_LIFETIME
(
loc
)
; }
\
"renew-timer\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_RENEW_TIMER
(
loc
)
; }
...
...
@@ -134,7 +141,8 @@ JSONString \"{JSONStringCharacter}*\"
\
"pool\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_POOL
(
loc
)
; }
\
"subnet\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_SUBNET
(
loc
)
; }
\
"interface\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_INTERFACE
(
loc
)
; }
\
"type\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_TYPE
(
loc
)
; }
\
"id\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_ID
(
loc
)
; }
\
"code\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_CODE
(
loc
)
; }
\
"mac-sources\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_MAC_SOURCES
(
loc
)
; }
\
"relay-supplied-options\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_RELAY_SUPPLIED_OPTIONS
(
loc
)
; }
...
...
src/bin/dhcp6/dhcp6_parser.yy
View file @
882e4eaa
...
...
@@ -51,8 +51,14 @@ using namespace std;
DHCP6 "Dhcp6"
INTERFACES_CONFIG "interfaces-config"
INTERFACES "interfaces"
LEASE_DATABASE "lease-database"
HOSTS_DATABASE "hosts-database"
TYPE "type"
USER "user"
PASSWORD "password"
HOST "host"
PREFERRED_LIFETIME "preferred-lifetime"
VALID_LIFETIME "valid-lifetime"
RENEW_TIMER "renew-timer"
...
...
@@ -73,6 +79,7 @@ using namespace std;
SUBNET "subnet"
INTERFACE "interface"
ID "id"
MAC_SOURCES "mac-sources"
RELAY_SUPPLIED_OPTIONS "relay-supplied-options"
...
...
@@ -218,6 +225,7 @@ global_param
| subnet6_list
| interfaces_config
| lease_database
| hosts_database
| mac_sources
| relay_supplied_options
| host_reservation_identifiers
...
...
@@ -266,20 +274,53 @@ lease_database: LEASE_DATABASE {
ctx.stack_.back()->set("lease-database", i);
ctx.stack_.push_back(i);
}
COLON LCURLY_BRACKET
lease_
database_map_params {
COLON LCURLY_BRACKET database_map_params {
ctx.stack_.pop_back();
} RCURLY_BRACKET;
lease_database_map_params: lease_database_map_param
| lease_database_map_params COMMA lease_database_map_param;
hosts_database: HOSTS_DATABASE {
ElementPtr i(new MapElement());
ctx.stack_.back()->set("hosts-database", i);
ctx.stack_.push_back(i);
}
COLON LCURLY_BRACKET database_map_params {
ctx.stack_.pop_back();
} RCURLY_BRACKET;
lease_database_map_param: lease_database_type;
database_map_params: lease_database_map_param
| database_map_params COMMA lease_database_map_param;
lease_database_type: TYPE COLON STRING {
lease_database_map_param: type
| user
| password
| host
| name;
type: TYPE COLON STRING {
ElementPtr prf(new StringElement($3));
ctx.stack_.back()->set("type", prf);
};
user: USER COLON STRING {
ElementPtr user(new StringElement($3));
ctx.stack_.back()->set("user", user);
};
password: PASSWORD COLON STRING {
ElementPtr pwd(new StringElement($3));
ctx.stack_.back()->set("password", pwd);
};
host: HOST COLON STRING {
ElementPtr h(new StringElement($3));
ctx.stack_.back()->set("host", h);
};
name: NAME COLON STRING {
ElementPtr n(new StringElement($3));
ctx.stack_.back()->set("name", n);
};
mac_sources: MAC_SOURCES {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("mac-sources", l);
...
...
@@ -363,6 +404,7 @@ subnet6_param: option_data_list
| pd_pools_list
| subnet
| interface
| id
| client_class
| reservations
;
...
...
@@ -379,6 +421,10 @@ subnet: CLIENT_CLASS COLON STRING {
ElementPtr cls(new StringElement($3)); ctx.stack_.back()->set("client-class", cls);
};
id: ID COLON INTEGER {
ElementPtr id(new IntElement($3)); ctx.stack_.back()->set("id", id);
};
// ---- option-data --------------------------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment