Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian Schrader
Kea
Commits
03fc86a6
Commit
03fc86a6
authored
Jan 27, 2017
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5121] Updated parser for HRmode
parent
58a9eca1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
106 additions
and
8 deletions
+106
-8
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_lexer.ll
+36
-0
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/dhcp4_parser.yy
+12
-4
src/bin/dhcp4/parser_context.cc
src/bin/dhcp4/parser_context.cc
+2
-0
src/bin/dhcp4/parser_context.h
src/bin/dhcp4/parser_context.h
+3
-0
src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_lexer.ll
+36
-0
src/bin/dhcp6/dhcp6_parser.yy
src/bin/dhcp6/dhcp6_parser.yy
+12
-4
src/bin/dhcp6/parser_context.cc
src/bin/dhcp6/parser_context.cc
+2
-0
src/bin/dhcp6/parser_context.h
src/bin/dhcp6/parser_context.h
+3
-0
No files found.
src/bin/dhcp4/dhcp4_lexer.ll
View file @
03fc86a6
...
...
@@ -536,6 +536,42 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"
disabled\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::RESERVATION_MODE:
return isc::dhcp::Dhcp4Parser::make_DISABLED(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
disabled
", driver.loc_);
}
}
\"
off\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::RESERVATION_MODE:
return isc::dhcp::Dhcp4Parser::make_DISABLED(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
off
", driver.loc_);
}
}
\"
out-of-pool\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::RESERVATION_MODE:
return isc::dhcp::Dhcp4Parser::make_OUT_OF_POOL(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
out-of-pool
", driver.loc_);
}
}
\"
all\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::RESERVATION_MODE:
return isc::dhcp::Dhcp4Parser::make_ALL(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
all
", driver.loc_);
}
}
\"
code\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::OPTION_DEF:
...
...
src/bin/dhcp4/dhcp4_parser.yy
View file @
03fc86a6
...
...
@@ -106,6 +106,9 @@ using namespace std;
ID "id"
RAPID_COMMIT "rapid-commit"
RESERVATION_MODE "reservation-mode"
DISABLED "disabled"
OUT_OF_POOL "out-of-pool"
ALL "all"
HOST_RESERVATION_IDENTIFIERS "host-reservation-identifiers"
...
...
@@ -198,6 +201,7 @@ using namespace std;
%type <ElementPtr> map_value
%type <ElementPtr> socket_type
%type <ElementPtr> db_type
%type <ElementPtr> hr_mode
%type <ElementPtr> ncr_protocol_value
%type <ElementPtr> replace_client_name_value
...
...
@@ -881,13 +885,17 @@ client_class: CLIENT_CLASS {
};
reservation_mode: RESERVATION_MODE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr rm(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("reservation-mode", rm);
ctx.enter(ctx.RESERVATION_MODE);
} COLON hr_mode {
ctx.stack_.back()->set("reservation-mode", $4);
ctx.leave();
};
hr_mode: DISABLED { $$ = ElementPtr(new StringElement("disabled", ctx.loc2pos(@1))); }
| OUT_OF_POOL { $$ = ElementPtr(new StringElement("out-of-pool", ctx.loc2pos(@1))); }
| ALL { $$ = ElementPtr(new StringElement("all", ctx.loc2pos(@1))); }
;
id: ID COLON INTEGER {
ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("id", id);
...
...
src/bin/dhcp4/parser_context.cc
View file @
03fc86a6
...
...
@@ -141,6 +141,8 @@ Parser4Context::contextName()
return
(
"hooks-librairies"
);
case
SUBNET4
:
return
(
"subnet4"
);
case
RESERVATION_MODE
:
return
(
"reservation-mode"
);
case
OPTION_DEF
:
return
(
"option-def"
);
case
OPTION_DATA
:
...
...
src/bin/dhcp4/parser_context.h
View file @
03fc86a6
...
...
@@ -216,6 +216,9 @@ public:
/// Used while parsing Dhcp4/Subnet4 structures.
SUBNET4
,
/// Used while parsing Dhcp4/Subnet4/reservation-mode.
RESERVATION_MODE
,
/// Used while parsing Dhcp4/option-def structures.
OPTION_DEF
,
...
...
src/bin/dhcp6/dhcp6_lexer.ll
View file @
03fc86a6
...
...
@@ -803,6 +803,42 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"
disabled\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::RESERVATION_MODE:
return isc::dhcp::Dhcp6Parser::make_DISABLED(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("
disabled
", driver.loc_);
}
}
\"
off\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::RESERVATION_MODE:
return isc::dhcp::Dhcp6Parser::make_DISABLED(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("
off
", driver.loc_);
}
}
\"
out-of-pool\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::RESERVATION_MODE:
return isc::dhcp::Dhcp6Parser::make_OUT_OF_POOL(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("
out-of-pool
", driver.loc_);
}
}
\"
all\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::RESERVATION_MODE:
return isc::dhcp::Dhcp6Parser::make_ALL(driver.loc_);
default:
return isc::dhcp::Dhcp6Parser::make_STRING("
all
", driver.loc_);
}
}
\"
code\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::OPTION_DEF:
...
...
src/bin/dhcp6/dhcp6_parser.yy
View file @
03fc86a6
...
...
@@ -101,6 +101,9 @@ using namespace std;
ID "id"
RAPID_COMMIT "rapid-commit"
RESERVATION_MODE "reservation-mode"
DISABLED "disabled"
OUT_OF_POOL "out-of-pool"
ALL "all"
MAC_SOURCES "mac-sources"
RELAY_SUPPLIED_OPTIONS "relay-supplied-options"
...
...
@@ -205,6 +208,7 @@ using namespace std;
%type <ElementPtr> value
%type <ElementPtr> map_value
%type <ElementPtr> db_type
%type <ElementPtr> hr_mode
%type <ElementPtr> duid_type
%type <ElementPtr> ncr_protocol_value
%type <ElementPtr> replace_client_name_value
...
...
@@ -862,13 +866,17 @@ client_class: CLIENT_CLASS {
};
reservation_mode: RESERVATION_MODE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr rm(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("reservation-mode", rm);
ctx.enter(ctx.RESERVATION_MODE);
} COLON hr_mode {
ctx.stack_.back()->set("reservation-mode", $4);
ctx.leave();
};
hr_mode: DISABLED { $$ = ElementPtr(new StringElement("disabled", ctx.loc2pos(@1))); }
| OUT_OF_POOL { $$ = ElementPtr(new StringElement("out-of-pool", ctx.loc2pos(@1))); }
| ALL { $$ = ElementPtr(new StringElement("all", ctx.loc2pos(@1))); }
;
id: ID COLON INTEGER {
ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("id", id);
...
...
src/bin/dhcp6/parser_context.cc
View file @
03fc86a6
...
...
@@ -141,6 +141,8 @@ Parser6Context::contextName()
return
(
"hooks-librairies"
);
case
SUBNET6
:
return
(
"subnet6"
);
case
RESERVATION_MODE
:
return
(
"reservation-mode"
);
case
OPTION_DEF
:
return
(
"option-def"
);
case
OPTION_DATA
:
...
...
src/bin/dhcp6/parser_context.h
View file @
03fc86a6
...
...
@@ -219,6 +219,9 @@ public:
/// Used while parsing Dhcp6/Subnet6 structures.
SUBNET6
,
/// Used while parsing Dhcp6/Subnet6/reservation-mode.
RESERVATION_MODE
,
/// Used while parsing Dhcp6/option-def structures.
OPTION_DEF
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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