]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5425] Extended syntax
authorFrancis Dupont <fdupont@isc.org>
Sun, 19 Nov 2017 10:25:09 +0000 (11:25 +0100)
committerFrancis Dupont <fdupont@isc.org>
Sun, 19 Nov 2017 10:25:09 +0000 (11:25 +0100)
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_parser.yy
src/bin/dhcp4/parser_context.cc
src/bin/dhcp4/parser_context.h
src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_parser.yy
src/bin/dhcp6/parser_context.cc
src/bin/dhcp6/parser_context.h

index ba8f1f1944b207adbea3e68327b6dd5fdb48ece1..1623ca910c16e8da328d3cab30b04c3553f37a27 100644 (file)
@@ -586,6 +586,31 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
+\"known-clients\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::POOLS:
+        return isc::dhcp::Dhcp4Parser::make_KNOWN_CLIENTS(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("known-clients", driver.loc_);
+}
+
+\"only\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::KNOWN_CLIENTS:
+        return isc::dhcp::Dhcp4Parser::make_ONLY(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("only", driver.loc_);
+}
+
+\"never\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::KNOWN_CLIENTS:
+    case isc::dhcp::Parser4Context::REPLACE_CLIENT_NAME:
+        return isc::dhcp::Dhcp4Parser::make_NEVER(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("never", driver.loc_);
+}
+
 \"subnet\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::SUBNET4:
index f72a5524c449ff29984eb4be0403d64f249f4c05..dc5fcbf4eb67ca96f6d0f1bd1189a35ee8af858f 100644 (file)
@@ -109,6 +109,9 @@ using namespace std;
   POOLS "pools"
   POOL "pool"
   USER_CONTEXT "user-context"
+  KNOWN_CLIENTS "known-clients"
+  ONLY "only"
+  NEVER "never"
 
   SUBNET "subnet"
   INTERFACE "interface"
@@ -173,7 +176,6 @@ using namespace std;
   TCP "tcp"
   JSON "JSON"
   WHEN_PRESENT "when-present"
-  NEVER "never"
   ALWAYS "always"
   WHEN_NOT_PRESENT "when-not-present"
 
@@ -1331,6 +1333,7 @@ pool_param: pool_entry
           | option_data_list
           | client_class
           | user_context
+          | known_clients
           | unknown_map_entry
           ;
 
@@ -1349,6 +1352,18 @@ user_context: USER_CONTEXT {
     ctx.leave();
 };
 
+known_clients: KNOWN_CLIENTS {
+    ctx.enter(ctx.KNOWN_CLIENTS);
+} COLON known_clients_value {
+    ctx.stack_.back()->set("known-clients", $4);
+    ctx.leave();
+}
+
+known_clients_value:
+    ONLY { $$ = ElementPtr(new StringElement("only", ctx.loc2pos(@1))); }
+  | NEVER { $$ = ElementPtr(new StringElement("never", ctx.loc2pos(@1))); }
+;
+
 // --- end of pools definition -------------------------------
 
 // --- reservations ------------------------------------------
index 17c268a9298fa1ead521bb81fe17543d652e3abd..bbafcc2f2e86ebbadb154f277c4aaabd15e016ee 100644 (file)
@@ -174,6 +174,8 @@ Parser4Context::contextName()
         return ("control-socket");
     case POOLS:
         return ("pools");
+    case KNOWN_CLIENTS:
+        return ("known-clients");
     case RESERVATIONS:
         return ("reservations");
     case RELAY:
index ee998e05f8fbca7a23e45b82f33af6a29ed08f55..83e1f0a13a34aeb8d3d028f397b572d12fcb6fd8 100644 (file)
@@ -264,6 +264,9 @@ public:
         /// Used while parsing Dhcp4/subnet4/pools structures.
         POOLS,
 
+        /// Used while parsing Dhcp4/subnet4/pools/known_client structures.
+        KNOWN_CLIENTS,
+
         /// Used while parsing Dhcp4/reservations structures.
         RESERVATIONS,
 
index a31486b3fb2897779d959ba51f802d2b70c6851a..d29bdb376dac644172edea3b5826dd1970042fa6 100644 (file)
@@ -361,6 +361,15 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     return isc::dhcp::Dhcp6Parser::make_STRING(tmp, driver.loc_);
 }
 
+\"never\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::KNOWN_CLIENTS:
+    case isc::dhcp::Parser6Context::REPLACE_CLIENT_NAME:
+        return isc::dhcp::Dhcp6Parser::make_NEVER(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("never", driver.loc_);
+}
+
 (?i:\"never\") {
     /* dhcp-ddns value keywords are case insensitive */
     if (driver.ctx_ == isc::dhcp::Parser6Context::REPLACE_CLIENT_NAME) {
@@ -817,6 +826,22 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
+\"known-clients\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::POOLS:
+        return isc::dhcp::Dhcp6Parser::make_KNOWN_CLIENTS(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("known-clients", driver.loc_);
+}
+
+\"only\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::KNOWN_CLIENTS:
+        return isc::dhcp::Dhcp6Parser::make_ONLY(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("only", driver.loc_);
+}
+
 \"subnet\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::SUBNET6:
index 7ad030d55e3eb64cfdf9828f069c250378df32b1..eaff6f36cf88900833b28e4ef7dfe9c381a94968 100644 (file)
@@ -99,6 +99,9 @@ using namespace std;
   EXCLUDED_PREFIX_LEN "excluded-prefix-len"
   DELEGATED_LEN "delegated-len"
   USER_CONTEXT "user-context"
+  KNOWN_CLIENTS "known-clients"
+  ONLY "only"
+  NEVER "never"
 
   SUBNET "subnet"
   INTERFACE "interface"
@@ -176,7 +179,6 @@ using namespace std;
   TCP "TCP"
   JSON "JSON"
   WHEN_PRESENT "when-present"
-  NEVER "never"
   ALWAYS "always"
   WHEN_NOT_PRESENT "when-not-present"
 
@@ -1294,6 +1296,7 @@ pool_param: pool_entry
           | option_data_list
           | client_class
           | user_context
+          | known_clients
           | unknown_map_entry
           ;
 
@@ -1312,6 +1315,18 @@ user_context: USER_CONTEXT {
     ctx.leave();
 };
 
+known_clients: KNOWN_CLIENTS {
+    ctx.enter(ctx.KNOWN_CLIENTS);
+} COLON known_clients_value {
+    ctx.stack_.back()->set("known-clients", $4);
+    ctx.leave();
+}
+
+known_clients_value:
+    ONLY { $$ = ElementPtr(new StringElement("only", ctx.loc2pos(@1))); }
+  | NEVER { $$ = ElementPtr(new StringElement("never", ctx.loc2pos(@1))); }
+;
+
 // --- end of pools definition -------------------------------
 
 // --- pd-pools ----------------------------------------------
@@ -1371,6 +1386,7 @@ pd_pool_param: pd_prefix
              | excluded_prefix
              | excluded_prefix_len
              | user_context
+             | known_clients
              | unknown_map_entry
              ;
 
index abef30928eef862569dbec3a0dfaf595d15d7ff2..1ff28141ea1e5144f809a374d6c770619e4921d2 100644 (file)
@@ -176,6 +176,8 @@ Parser6Context::contextName()
         return ("pools");
     case PD_POOLS:
         return ("pd-pools");
+    case KNOWN_CLIENTS:
+        return ("known-clients");
     case RESERVATIONS:
         return ("reservations");
     case RELAY:
index 63f4b882c4b29bcfbf8e54e7bfba469d26c376b5..568cd995b5b75911d80905c378b3049f75959f9f 100644 (file)
@@ -270,6 +270,9 @@ public:
         /// Used while parsing Dhcp6/subnet6/pd-pools structures.
         PD_POOLS,
 
+        /// Used while parsing Dhcp4/subnet6/pools/known_client structures.
+        KNOWN_CLIENTS,
+
         /// Used while parsing Dhcp6/reservations structures.
         RESERVATIONS,