Commit 9a0d4c56 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[5014] hooks-libraries, expired-leases-processing, server-id are now parsed

parent 882e4eaa
......@@ -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.
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment