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
9a0d4c56
Commit
9a0d4c56
authored
Nov 13, 2016
by
Tomek Mrugalski
🛰
Browse files
[5014] hooks-libraries, expired-leases-processing, server-id are now parsed
parent
882e4eaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp6/dhcp6_lexer.ll
View file @
9a0d4c56
...
...
@@ -167,6 +167,17 @@ JSONString \"{JSONStringCharacter}*\"
\
"hostname\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_HOSTNAME
(
loc
)
; }
\
"space\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_SPACE
(
loc
)
; }
\
"hooks-libraries\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_HOOKS_LIBRARIES
(
loc
)
; }
\
"library\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_LIBRARY
(
loc
)
; }
\
"server-id\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_SERVER_ID
(
loc
)
; }
\
"identifier\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_IDENTIFIER
(
loc
)
; }
\
"htype\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_HTYPE
(
loc
)
; }
\
"time\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_TIME
(
loc
)
; }
\
"expired-leases-processing\"
{
return
isc:
:
dhcp:
:
Dhcp6Parser:
:make_EXPIRED_LEASES_PROCESSING
(
loc
)
; }
{
JSONString
}
{
//
A
string
has
been
matched
.
It
contains
the
actual
string
and
single
quotes
.
//
We
need
to
get
those
quotes
out
of
the
way
and
just
use
its
content
,
e
.
g
.
...
...
src/bin/dhcp6/dhcp6_parser.yy
View file @
9a0d4c56
...
...
@@ -96,6 +96,16 @@ using namespace std;
HW_ADDRESS "hw-address"
HOSTNAME "hostname"
HOOKS_LIBRARIES "hooks-libraries"
LIBRARY "library"
EXPIRED_LEASES_PROCESSING "expired-leases-processing"
SERVER_ID "server-id"
IDENTIFIER "identifier"
HTYPE "htype"
TIME "time"
LOGGING "Logging"
LOGGERS "loggers"
OUTPUT_OPTIONS "output_options"
...
...
@@ -231,6 +241,9 @@ global_param
| host_reservation_identifiers
| client_classes
| option_data_list
| hooks_libraries
| expired_leases_processing
| server_id
;
preferred_lifetime: PREFERRED_LIFETIME COLON INTEGER {
...
...
@@ -364,6 +377,53 @@ relay_supplied_options: RELAY_SUPPLIED_OPTIONS {
ctx.stack_.pop_back();
};
hooks_libraries: HOOKS_LIBRARIES COLON {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("hooks-libraries", l);
ctx.stack_.push_back(l);
} LSQUARE_BRACKET hooks_libraries_list RSQUARE_BRACKET {
ctx.stack_.pop_back();
};
hooks_libraries_list: { }
| hooks_library
| hooks_libraries_list COMMA hooks_library;
hooks_library: LCURLY_BRACKET {
ElementPtr m(new MapElement());
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} hooks_params RCURLY_BRACKET {
ctx.stack_.pop_back();
};
hooks_params: hooks_param
| hooks_params hooks_param;
hooks_param: LIBRARY COLON STRING {
ElementPtr lib(new StringElement($3)); ctx.stack_.back()->set("library", lib);
};
// --- expired-leases-processing ------------------------
expired_leases_processing: EXPIRED_LEASES_PROCESSING COLON LCURLY_BRACKET {
ElementPtr m(new MapElement());
ctx.stack_.back()->set("expired-leases-processing", m);
ctx.stack_.push_back(m);
} expired_leases_params RCURLY_BRACKET {
ctx.stack_.pop_back();
};
expired_leases_params: expired_leases_param
| expired_leases_params COMMA expired_leases_param;
// This is a bit of a simplification. But it can also serve as an example.
// Instead of explicitly listing all allowed expired leases parameters, we
// simply say that all of them as integers.
expired_leases_param: STRING COLON INTEGER {
ElementPtr value(new IntElement($3)); ctx.stack_.back()->set($1, value);
}
// --- subnet6 ------------------------------------------
// This defines subnet6 as a list of maps.
// "subnet6": [ ... ]
subnet6_list: SUBNET6 COLON LSQUARE_BRACKET {
...
...
@@ -680,6 +740,43 @@ client_class_test: TEST COLON STRING {
// --- end of client classes ---------------------------------
// --- server-id ---------------------------------------------
server_id: SERVER_ID COLON LCURLY_BRACKET {
ElementPtr m(new MapElement());
ctx.stack_.back()->set("server-id", m);
ctx.stack_.push_back(m);
} server_id_params RCURLY_BRACKET {
ctx.stack_.pop_back();
};
server_id_params: server_id_param
| server_id_params COMMA server_id_param;
server_id_param: type
| identifier
| time
| htype;
htype: HTYPE COLON INTEGER {
ElementPtr htype(new IntElement($3));
ctx.stack_.back()->set("htype", htype);
};
identifier: IDENTIFIER COLON STRING {
ElementPtr id(new StringElement($3));
ctx.stack_.back()->set("identifier", id);
};
time: TIME COLON INTEGER {
ElementPtr time(new IntElement($3));
ctx.stack_.back()->set("time", time);
};
// --- end of server-id --------------------------------------
// --- logging entry -----------------------------------------
// This defines the top level "Logging" object. It parses
...
...
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