]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5035] Did flex/bison side
authorFrancis Dupont <fdupont@isc.org>
Sat, 7 Jan 2017 05:29:27 +0000 (06:29 +0100)
committerFrancis Dupont <fdupont@isc.org>
Sat, 7 Jan 2017 05:29:27 +0000 (06:29 +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 0063c5ddb52ad9fee036f79e5a9f56dd4eaa1892..4ea88bfbdc099c7533a266e1751d36d1ca6ee83c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
 
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -770,6 +770,60 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
+\"reclaim-timer-wait-time\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp4Parser::make_RECLAIM_TIMER_WAIT_TIME(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("reclaim-timer-wait-time", driver.loc_);
+    }
+}
+
+\"flush-reclaimed-timer-wait-time\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp4Parser::make_FLUSH_RECLAIMED_TIMER_WAIT_TIME(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("flush-reclaimed-timer-wait-time", driver.loc_);
+    }
+}
+
+\"hold-reclaimed-time\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp4Parser::make_HOLD_RECLAIMED_TIME(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("hold-reclaimed-time", driver.loc_);
+    }
+}
+
+\"max-reclaim-leases\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp4Parser::make_MAX_RECLAIM_LEASES(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("max-reclaim-leases", driver.loc_);
+    }
+}
+
+\"max-reclaim-time\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp4Parser::make_MAX_RECLAIM_TIME(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("max-reclaim-time", driver.loc_);
+    }
+}
+
+\"unwarned-reclaim-cycles\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser4Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp4Parser::make_UNWARNED_RECLAIM_CYCLES(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp4Parser::make_STRING("unwarned-reclaim-cycles", driver.loc_);
+    }
+}
+
 \"dhcp4o6-port\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::DHCP4:
index 579adb158f937aece1fdd422967fdeb3077a0bec..f0a0128b022724f8bcfdaac59b71478df78015e0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
 
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -120,6 +120,12 @@ using namespace std;
   PARAMETERS "parameters"
 
   EXPIRED_LEASES_PROCESSING "expired-leases-processing"
+  RECLAIM_TIMER_WAIT_TIME "reclaim-timer-wait-time"
+  FLUSH_RECLAIMED_TIMER_WAIT_TIME "flush-reclaimed-timer-wait-time"
+  HOLD_RECLAIMED_TIME "hold-reclaimed-time"
+  MAX_RECLAIM_LEASES "max-reclaim-leases"
+  MAX_RECLAIM_TIME "max-reclaim-time"
+  UNWARNED_RECLAIM_CYCLES "unwarned-reclaim-cycles"
 
   SERVER_ID "server-id"
   IDENTIFIER "identifier"
@@ -644,7 +650,7 @@ expired_leases_processing: EXPIRED_LEASES_PROCESSING {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));
     ctx.stack_.back()->set("expired-leases-processing", m);
     ctx.stack_.push_back(m);
-    ctx.enter(ctx.NO_KEYWORD);
+    ctx.enter(ctx.EXPIRED_LEASES_PROCESSING);
 } COLON LCURLY_BRACKET expired_leases_params RCURLY_BRACKET {
     ctx.stack_.pop_back();
     ctx.leave();
@@ -654,12 +660,42 @@ 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 {
+expired_leases_param: reclaim_timer_wait_time
+                    | flush_reclaimed_timer_wait_time
+                    | hold_reclaimed_time
+                    | max_reclaim_leases
+                    | max_reclaim_time
+                    | unwarned_reclaim_cycles
+                    ;
+
+reclaim_timer_wait_time: RECLAIM_TIMER_WAIT_TIME COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("reclaim-timer-wait-time", value);
+};
+
+flush_reclaimed_timer_wait_time: FLUSH_RECLAIMED_TIMER_WAIT_TIME COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("flush-reclaimed-timer-wait-time", value);
+};
+
+hold_reclaimed_time: HOLD_RECLAIMED_TIME COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("hold-reclaimed-time", value);
+};
+
+max_reclaim_leases: MAX_RECLAIM_LEASES COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("max-reclaim-leases", value);
+};
+
+max_reclaim_time: MAX_RECLAIM_TIME COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("max-reclaim-time", value);
+};
+
+unwarned_reclaim_cycles: UNWARNED_RECLAIM_CYCLES COLON INTEGER {
     ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set($1, value);
+    ctx.stack_.back()->set("unwarned-reclaim-cycles", value);
 };
 
 // --- subnet4 ------------------------------------------
index ef168e4fbc901ece58fd90874c3b5e093c805c45..58fdf6e554b565eb3446e7236f6a9fd118b9513a 100644 (file)
@@ -143,6 +143,8 @@ Parser4Context::contextName()
         return ("option-data");
     case CLIENT_CLASSES:
         return ("client-classes");
+    case EXPIRED_LEASES_PROCESSING:
+        return ("expired-leases-processing");
     case SERVER_ID:
         return ("server-id");
     case CONTROL_SOCKET:
index 5f37dda521d0f835f0eb0185dcf557b7b426c23f..8480ce80d476cb39aedbfb5e65ee8b91490968c7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -219,6 +219,9 @@ public:
         /// Used while parsing Dhcp4/client-classes structures.
         CLIENT_CLASSES,
 
+        /// Used while parsing Dhcp4/expired-leases-processing.
+        EXPIRED_LEASES_PROCESSING,
+
         /// Used while parsing Dhcp4/server-id structures.
         SERVER_ID,
 
index 47235057dadd3667bc18fb3001a0d7c502585ba7..667182e599fb09927237981a65bb32631341b367 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
 
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -844,6 +844,60 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
+\"reclaim-timer-wait-time\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp6Parser::make_RECLAIM_TIMER_WAIT_TIME(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("reclaim-timer-wait-time", driver.loc_);
+    }
+}
+
+\"flush-reclaimed-timer-wait-time\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp6Parser::make_FLUSH_RECLAIMED_TIMER_WAIT_TIME(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("flush-reclaimed-timer-wait-time", driver.loc_);
+    }
+}
+
+\"hold-reclaimed-time\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp6Parser::make_HOLD_RECLAIMED_TIME(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("hold-reclaimed-time", driver.loc_);
+    }
+}
+
+\"max-reclaim-leases\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp6Parser::make_MAX_RECLAIM_LEASES(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("max-reclaim-leases", driver.loc_);
+    }
+}
+
+\"max-reclaim-time\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp6Parser::make_MAX_RECLAIM_TIME(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("max-reclaim-time", driver.loc_);
+    }
+}
+
+\"unwarned-reclaim-cycles\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::EXPIRED_LEASES_PROCESSING:
+        return isc::dhcp::Dhcp6Parser::make_UNWARNED_RECLAIM_CYCLES(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("unwarned-reclaim-cycles", driver.loc_);
+    }
+}
+
 \"dhcp4o6-port\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::DHCP6:
index d3a460ace7b8768dfe0da38856980be273b76802..ab975a7b68b1ce8ff7e99f2590e4f2eeb88d0efc 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
 
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -119,6 +119,12 @@ using namespace std;
   PARAMETERS "parameters"
 
   EXPIRED_LEASES_PROCESSING "expired-leases-processing"
+  RECLAIM_TIMER_WAIT_TIME "reclaim-timer-wait-time"
+  FLUSH_RECLAIMED_TIMER_WAIT_TIME "flush-reclaimed-timer-wait-time"
+  HOLD_RECLAIMED_TIME "hold-reclaimed-time"
+  MAX_RECLAIM_LEASES "max-reclaim-leases"
+  MAX_RECLAIM_TIME "max-reclaim-time"
+  UNWARNED_RECLAIM_CYCLES "unwarned-reclaim-cycles"
 
   SERVER_ID "server-id"
   IDENTIFIER "identifier"
@@ -644,7 +650,7 @@ expired_leases_processing: EXPIRED_LEASES_PROCESSING {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));
     ctx.stack_.back()->set("expired-leases-processing", m);
     ctx.stack_.push_back(m);
-    ctx.enter(ctx.NO_KEYWORD);
+    ctx.enter(ctx.EXPIRED_LEASES_PROCESSING);
 } COLON LCURLY_BRACKET expired_leases_params RCURLY_BRACKET {
     ctx.stack_.pop_back();
     ctx.leave();
@@ -654,12 +660,42 @@ 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 {
+expired_leases_param: reclaim_timer_wait_time
+                    | flush_reclaimed_timer_wait_time
+                    | hold_reclaimed_time
+                    | max_reclaim_leases
+                    | max_reclaim_time
+                    | unwarned_reclaim_cycles
+                    ;
+
+reclaim_timer_wait_time: RECLAIM_TIMER_WAIT_TIME COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("reclaim-timer-wait-time", value);
+};
+
+flush_reclaimed_timer_wait_time: FLUSH_RECLAIMED_TIMER_WAIT_TIME COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("flush-reclaimed-timer-wait-time", value);
+};
+
+hold_reclaimed_time: HOLD_RECLAIMED_TIME COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("hold-reclaimed-time", value);
+};
+
+max_reclaim_leases: MAX_RECLAIM_LEASES COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("max-reclaim-leases", value);
+};
+
+max_reclaim_time: MAX_RECLAIM_TIME COLON INTEGER {
+    ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
+    ctx.stack_.back()->set("max-reclaim-time", value);
+};
+
+unwarned_reclaim_cycles: UNWARNED_RECLAIM_CYCLES COLON INTEGER {
     ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set($1, value);
+    ctx.stack_.back()->set("unwarned-reclaim-cycles", value);
 };
 
 // --- subnet6 ------------------------------------------
index b0d4e54f77ec181744af883f191cd82dc928077c..68b9c34faf910e8e11914a13164313833e822dc4 100644 (file)
@@ -145,6 +145,8 @@ Parser6Context::contextName()
         return ("option-data");
     case CLIENT_CLASSES:
         return ("client-classes");
+    case EXPIRED_LEASES_PROCESSING:
+        return ("expired-leases-processing");
     case SERVER_ID:
         return ("server-id");
     case CONTROL_SOCKET:
index 077bb6e63913b159bfaa14ef152a8479b2f6fc88..1a394d3c442ec2451c9bddd2fd6ac25d94ca039c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -225,6 +225,9 @@ public:
         /// Used while parsing Dhcp6/client-classes structures.
         CLIENT_CLASSES,
 
+        /// Used while parsing Dhcp6/expired-leases-processing.
+        EXPIRED_LEASES_PROCESSING,
+
         /// Used while parsing Dhcp6/server-id structures.
         SERVER_ID,