Parcourir la source

[master] Finished merge of trac5035 (migrate lease expiration config)

Francis Dupont il y a 8 ans
Parent
commit
7be6514d9b

Fichier diff supprimé car celui-ci est trop grand
+ 766 - 656
src/bin/dhcp4/dhcp4_lexer.cc


+ 54 - 0
src/bin/dhcp4/dhcp4_lexer.ll

@@ -788,6 +788,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:

Fichier diff supprimé car celui-ci est trop grand
+ 1029 - 963
src/bin/dhcp4/dhcp4_parser.cc


+ 135 - 68
src/bin/dhcp4/dhcp4_parser.h

@@ -40,7 +40,7 @@
 #ifndef YY_PARSER4_DHCP4_PARSER_H_INCLUDED
 # define YY_PARSER4_DHCP4_PARSER_H_INCLUDED
 // //                    "%code requires" blocks.
-#line 17 "dhcp4_parser.yy" // lalr1.cc:377
+#line 17 "dhcp4_parser.yy" // lalr1.cc:392
 
 #include <string>
 #include <cc/data.h>
@@ -52,7 +52,7 @@ using namespace isc::dhcp;
 using namespace isc::data;
 using namespace std;
 
-#line 56 "dhcp4_parser.h" // lalr1.cc:377
+#line 56 "dhcp4_parser.h" // lalr1.cc:392
 
 # include <cassert>
 # include <cstdlib> // std::abort
@@ -135,9 +135,9 @@ using namespace std;
 # endif /* ! defined YYDEBUG */
 #endif  /* ! defined PARSER4_DEBUG */
 
-#line 14 "dhcp4_parser.yy" // lalr1.cc:377
+#line 14 "dhcp4_parser.yy" // lalr1.cc:392
 namespace isc { namespace dhcp {
-#line 141 "dhcp4_parser.h" // lalr1.cc:377
+#line 141 "dhcp4_parser.h" // lalr1.cc:392
 
 
 
@@ -411,38 +411,44 @@ namespace isc { namespace dhcp {
         TOKEN_LIBRARY = 324,
         TOKEN_PARAMETERS = 325,
         TOKEN_EXPIRED_LEASES_PROCESSING = 326,
-        TOKEN_SERVER_ID = 327,
-        TOKEN_IDENTIFIER = 328,
-        TOKEN_HTYPE = 329,
-        TOKEN_TIME = 330,
-        TOKEN_ENTERPRISE_ID = 331,
-        TOKEN_DHCP4O6_PORT = 332,
-        TOKEN_CONTROL_SOCKET = 333,
-        TOKEN_SOCKET_TYPE = 334,
-        TOKEN_SOCKET_NAME = 335,
-        TOKEN_DHCP_DDNS = 336,
-        TOKEN_LOGGING = 337,
-        TOKEN_LOGGERS = 338,
-        TOKEN_OUTPUT_OPTIONS = 339,
-        TOKEN_OUTPUT = 340,
-        TOKEN_DEBUGLEVEL = 341,
-        TOKEN_SEVERITY = 342,
-        TOKEN_DHCP6 = 343,
-        TOKEN_DHCPDDNS = 344,
-        TOKEN_TOPLEVEL_JSON = 345,
-        TOKEN_TOPLEVEL_DHCP4 = 346,
-        TOKEN_SUB_DHCP4 = 347,
-        TOKEN_SUB_INTERFACES4 = 348,
-        TOKEN_SUB_SUBNET4 = 349,
-        TOKEN_SUB_POOL4 = 350,
-        TOKEN_SUB_RESERVATION = 351,
-        TOKEN_SUB_OPTION_DEF = 352,
-        TOKEN_SUB_OPTION_DATA = 353,
-        TOKEN_SUB_HOOKS_LIBRARY = 354,
-        TOKEN_STRING = 355,
-        TOKEN_INTEGER = 356,
-        TOKEN_FLOAT = 357,
-        TOKEN_BOOLEAN = 358
+        TOKEN_RECLAIM_TIMER_WAIT_TIME = 327,
+        TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 328,
+        TOKEN_HOLD_RECLAIMED_TIME = 329,
+        TOKEN_MAX_RECLAIM_LEASES = 330,
+        TOKEN_MAX_RECLAIM_TIME = 331,
+        TOKEN_UNWARNED_RECLAIM_CYCLES = 332,
+        TOKEN_SERVER_ID = 333,
+        TOKEN_IDENTIFIER = 334,
+        TOKEN_HTYPE = 335,
+        TOKEN_TIME = 336,
+        TOKEN_ENTERPRISE_ID = 337,
+        TOKEN_DHCP4O6_PORT = 338,
+        TOKEN_CONTROL_SOCKET = 339,
+        TOKEN_SOCKET_TYPE = 340,
+        TOKEN_SOCKET_NAME = 341,
+        TOKEN_DHCP_DDNS = 342,
+        TOKEN_LOGGING = 343,
+        TOKEN_LOGGERS = 344,
+        TOKEN_OUTPUT_OPTIONS = 345,
+        TOKEN_OUTPUT = 346,
+        TOKEN_DEBUGLEVEL = 347,
+        TOKEN_SEVERITY = 348,
+        TOKEN_DHCP6 = 349,
+        TOKEN_DHCPDDNS = 350,
+        TOKEN_TOPLEVEL_JSON = 351,
+        TOKEN_TOPLEVEL_DHCP4 = 352,
+        TOKEN_SUB_DHCP4 = 353,
+        TOKEN_SUB_INTERFACES4 = 354,
+        TOKEN_SUB_SUBNET4 = 355,
+        TOKEN_SUB_POOL4 = 356,
+        TOKEN_SUB_RESERVATION = 357,
+        TOKEN_SUB_OPTION_DEF = 358,
+        TOKEN_SUB_OPTION_DATA = 359,
+        TOKEN_SUB_HOOKS_LIBRARY = 360,
+        TOKEN_STRING = 361,
+        TOKEN_INTEGER = 362,
+        TOKEN_FLOAT = 363,
+        TOKEN_BOOLEAN = 364
       };
     };
 
@@ -839,6 +845,30 @@ namespace isc { namespace dhcp {
 
     static inline
     symbol_type
+    make_RECLAIM_TIMER_WAIT_TIME (const location_type& l);
+
+    static inline
+    symbol_type
+    make_FLUSH_RECLAIMED_TIMER_WAIT_TIME (const location_type& l);
+
+    static inline
+    symbol_type
+    make_HOLD_RECLAIMED_TIME (const location_type& l);
+
+    static inline
+    symbol_type
+    make_MAX_RECLAIM_LEASES (const location_type& l);
+
+    static inline
+    symbol_type
+    make_MAX_RECLAIM_TIME (const location_type& l);
+
+    static inline
+    symbol_type
+    make_UNWARNED_RECLAIM_CYCLES (const location_type& l);
+
+    static inline
+    symbol_type
     make_SERVER_ID (const location_type& l);
 
     static inline
@@ -1170,12 +1200,12 @@ namespace isc { namespace dhcp {
     enum
     {
       yyeof_ = 0,
-      yylast_ = 626,     ///< Last index in yytable_.
-      yynnts_ = 268,  ///< Number of nonterminal symbols.
+      yylast_ = 647,     ///< Last index in yytable_.
+      yynnts_ = 274,  ///< Number of nonterminal symbols.
       yyfinal_ = 22, ///< Termination state number.
       yyterror_ = 1,
       yyerrcode_ = 256,
-      yyntokens_ = 104  ///< Number of tokens.
+      yyntokens_ = 110  ///< Number of tokens.
     };
 
 
@@ -1227,9 +1257,10 @@ namespace isc { namespace dhcp {
       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
-      95,    96,    97,    98,    99,   100,   101,   102,   103
+      95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
+     105,   106,   107,   108,   109
     };
-    const unsigned int user_token_number_max_ = 358;
+    const unsigned int user_token_number_max_ = 364;
     const token_number_type undef_token_ = 2;
 
     if (static_cast<int>(t) <= yyeof_)
@@ -1262,24 +1293,24 @@ namespace isc { namespace dhcp {
   {
       switch (other.type_get ())
     {
-      case 116: // value
-      case 155: // socket_type
+      case 122: // value
+      case 161: // socket_type
         value.copy< ElementPtr > (other.value);
         break;
 
-      case 103: // "boolean"
+      case 109: // "boolean"
         value.copy< bool > (other.value);
         break;
 
-      case 102: // "floating point"
+      case 108: // "floating point"
         value.copy< double > (other.value);
         break;
 
-      case 101: // "integer"
+      case 107: // "integer"
         value.copy< int64_t > (other.value);
         break;
 
-      case 100: // "constant string"
+      case 106: // "constant string"
         value.copy< std::string > (other.value);
         break;
 
@@ -1300,24 +1331,24 @@ namespace isc { namespace dhcp {
     (void) v;
       switch (this->type_get ())
     {
-      case 116: // value
-      case 155: // socket_type
+      case 122: // value
+      case 161: // socket_type
         value.copy< ElementPtr > (v);
         break;
 
-      case 103: // "boolean"
+      case 109: // "boolean"
         value.copy< bool > (v);
         break;
 
-      case 102: // "floating point"
+      case 108: // "floating point"
         value.copy< double > (v);
         break;
 
-      case 101: // "integer"
+      case 107: // "integer"
         value.copy< int64_t > (v);
         break;
 
-      case 100: // "constant string"
+      case 106: // "constant string"
         value.copy< std::string > (v);
         break;
 
@@ -1397,24 +1428,24 @@ namespace isc { namespace dhcp {
     // Type destructor.
     switch (yytype)
     {
-      case 116: // value
-      case 155: // socket_type
+      case 122: // value
+      case 161: // socket_type
         value.template destroy< ElementPtr > ();
         break;
 
-      case 103: // "boolean"
+      case 109: // "boolean"
         value.template destroy< bool > ();
         break;
 
-      case 102: // "floating point"
+      case 108: // "floating point"
         value.template destroy< double > ();
         break;
 
-      case 101: // "integer"
+      case 107: // "integer"
         value.template destroy< int64_t > ();
         break;
 
-      case 100: // "constant string"
+      case 106: // "constant string"
         value.template destroy< std::string > ();
         break;
 
@@ -1441,24 +1472,24 @@ namespace isc { namespace dhcp {
     super_type::move(s);
       switch (this->type_get ())
     {
-      case 116: // value
-      case 155: // socket_type
+      case 122: // value
+      case 161: // socket_type
         value.move< ElementPtr > (s.value);
         break;
 
-      case 103: // "boolean"
+      case 109: // "boolean"
         value.move< bool > (s.value);
         break;
 
-      case 102: // "floating point"
+      case 108: // "floating point"
         value.move< double > (s.value);
         break;
 
-      case 101: // "integer"
+      case 107: // "integer"
         value.move< int64_t > (s.value);
         break;
 
-      case 100: // "constant string"
+      case 106: // "constant string"
         value.move< std::string > (s.value);
         break;
 
@@ -1527,7 +1558,7 @@ namespace isc { namespace dhcp {
      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
-     355,   356,   357,   358
+     355,   356,   357,   358,   359,   360,   361,   362,   363,   364
     };
     return static_cast<token_type> (yytoken_number_[type]);
   }
@@ -1953,6 +1984,42 @@ namespace isc { namespace dhcp {
   }
 
   Dhcp4Parser::symbol_type
+  Dhcp4Parser::make_RECLAIM_TIMER_WAIT_TIME (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_RECLAIM_TIMER_WAIT_TIME, l);
+  }
+
+  Dhcp4Parser::symbol_type
+  Dhcp4Parser::make_FLUSH_RECLAIMED_TIMER_WAIT_TIME (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME, l);
+  }
+
+  Dhcp4Parser::symbol_type
+  Dhcp4Parser::make_HOLD_RECLAIMED_TIME (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_HOLD_RECLAIMED_TIME, l);
+  }
+
+  Dhcp4Parser::symbol_type
+  Dhcp4Parser::make_MAX_RECLAIM_LEASES (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_MAX_RECLAIM_LEASES, l);
+  }
+
+  Dhcp4Parser::symbol_type
+  Dhcp4Parser::make_MAX_RECLAIM_TIME (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_MAX_RECLAIM_TIME, l);
+  }
+
+  Dhcp4Parser::symbol_type
+  Dhcp4Parser::make_UNWARNED_RECLAIM_CYCLES (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_UNWARNED_RECLAIM_CYCLES, l);
+  }
+
+  Dhcp4Parser::symbol_type
   Dhcp4Parser::make_SERVER_ID (const location_type& l)
   {
     return symbol_type (token::TOKEN_SERVER_ID, l);
@@ -2145,9 +2212,9 @@ namespace isc { namespace dhcp {
   }
 
 
-#line 14 "dhcp4_parser.yy" // lalr1.cc:377
+#line 14 "dhcp4_parser.yy" // lalr1.cc:392
 } } // isc::dhcp
-#line 2151 "dhcp4_parser.h" // lalr1.cc:377
+#line 2218 "dhcp4_parser.h" // lalr1.cc:392
 
 
 

+ 42 - 6
src/bin/dhcp4/dhcp4_parser.yy

@@ -122,6 +122,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"
@@ -650,7 +656,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();
@@ -660,12 +666,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 ------------------------------------------

+ 7 - 2
src/bin/dhcp4/json_config_parser.cc

@@ -438,8 +438,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
     } else if (config_id.compare("match-client-id") == 0) {
         parser = new BooleanParser(config_id, globalContext()->boolean_values_);
     // control-socket has been converted to SimpleParser already.
-    } else if (config_id.compare("expired-leases-processing") == 0) {
-        parser = new ExpirationConfigParser();
+    // expired-leases-processing has been converted to SimpleParser already.
     } else if (config_id.compare("client-classes") == 0) {
         parser = new ClientClassDefListParser(config_id, globalContext());
     // host-reservation-identifiers have been converted to SimpleParser already.
@@ -656,6 +655,12 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {
                 continue;
             }
 
+            if (config_pair.first == "expired-leases-processing") {
+                ExpirationConfigParser parser;
+                parser.parse(config_pair.second);
+                continue;
+            }
+
             // Legacy DhcpConfigParser stuff below
             ParserPtr parser(createGlobalDhcp4ConfigParser(config_pair.first,
                                                            config_pair.second));

+ 4 - 5
src/bin/dhcp4/location.hh

@@ -1,4 +1,3 @@
-// Generated 201701062338
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Locations for Bison parsers in C++
@@ -41,9 +40,9 @@
 
 # include "position.hh"
 
-#line 14 "dhcp4_parser.yy" // location.cc:296
+#line 14 "dhcp4_parser.yy" // location.cc:337
 namespace isc { namespace dhcp {
-#line 46 "location.hh" // location.cc:296
+#line 46 "location.hh" // location.cc:337
   /// Abstract a location.
   class location
   {
@@ -187,7 +186,7 @@ namespace isc { namespace dhcp {
     return ostr;
   }
 
-#line 14 "dhcp4_parser.yy" // location.cc:296
+#line 14 "dhcp4_parser.yy" // location.cc:337
 } } // isc::dhcp
-#line 192 "location.hh" // location.cc:296
+#line 192 "location.hh" // location.cc:337
 #endif // !YY_PARSER4_LOCATION_HH_INCLUDED

+ 2 - 0
src/bin/dhcp4/parser_context.cc

@@ -145,6 +145,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:

+ 3 - 0
src/bin/dhcp4/parser_context.h

@@ -222,6 +222,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,
 

+ 4 - 5
src/bin/dhcp4/position.hh

@@ -1,4 +1,3 @@
-// Generated 201701062338
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Positions for Bison parsers in C++
@@ -51,9 +50,9 @@
 #  endif
 # endif
 
-#line 14 "dhcp4_parser.yy" // location.cc:296
+#line 14 "dhcp4_parser.yy" // location.cc:337
 namespace isc { namespace dhcp {
-#line 56 "position.hh" // location.cc:296
+#line 56 "position.hh" // location.cc:337
   /// Abstract a position.
   class position
   {
@@ -175,7 +174,7 @@ namespace isc { namespace dhcp {
     return ostr << pos.line << '.' << pos.column;
   }
 
-#line 14 "dhcp4_parser.yy" // location.cc:296
+#line 14 "dhcp4_parser.yy" // location.cc:337
 } } // isc::dhcp
-#line 180 "position.hh" // location.cc:296
+#line 180 "position.hh" // location.cc:337
 #endif // !YY_PARSER4_POSITION_HH_INCLUDED

+ 4 - 5
src/bin/dhcp4/stack.hh

@@ -1,4 +1,3 @@
-// Generated 201701062338
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Stack handling for Bison parsers in C++
@@ -41,9 +40,9 @@
 
 # include <vector>
 
-#line 14 "dhcp4_parser.yy" // stack.hh:132
+#line 14 "dhcp4_parser.yy" // stack.hh:151
 namespace isc { namespace dhcp {
-#line 46 "stack.hh" // stack.hh:132
+#line 46 "stack.hh" // stack.hh:151
   template <class T, class S = std::vector<T> >
   class stack
   {
@@ -151,8 +150,8 @@ namespace isc { namespace dhcp {
     unsigned int range_;
   };
 
-#line 14 "dhcp4_parser.yy" // stack.hh:132
+#line 14 "dhcp4_parser.yy" // stack.hh:151
 } } // isc::dhcp
-#line 156 "stack.hh" // stack.hh:132
+#line 156 "stack.hh" // stack.hh:151
 
 #endif // !YY_PARSER4_STACK_HH_INCLUDED

Fichier diff supprimé car celui-ci est trop grand
+ 1844 - 1539
src/bin/dhcp6/dhcp6_lexer.cc


+ 54 - 0
src/bin/dhcp6/dhcp6_lexer.ll

@@ -871,6 +871,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:

Fichier diff supprimé car celui-ci est trop grand
+ 1081 - 1016
src/bin/dhcp6/dhcp6_parser.cc


+ 139 - 72
src/bin/dhcp6/dhcp6_parser.h

@@ -40,7 +40,7 @@
 #ifndef YY_PARSER6_DHCP6_PARSER_H_INCLUDED
 # define YY_PARSER6_DHCP6_PARSER_H_INCLUDED
 // //                    "%code requires" blocks.
-#line 17 "dhcp6_parser.yy" // lalr1.cc:377
+#line 17 "dhcp6_parser.yy" // lalr1.cc:392
 
 #include <string>
 #include <cc/data.h>
@@ -52,7 +52,7 @@ using namespace isc::dhcp;
 using namespace isc::data;
 using namespace std;
 
-#line 56 "dhcp6_parser.h" // lalr1.cc:377
+#line 56 "dhcp6_parser.h" // lalr1.cc:392
 
 # include <cassert>
 # include <cstdlib> // std::abort
@@ -135,9 +135,9 @@ using namespace std;
 # endif /* ! defined YYDEBUG */
 #endif  /* ! defined PARSER6_DEBUG */
 
-#line 14 "dhcp6_parser.yy" // lalr1.cc:377
+#line 14 "dhcp6_parser.yy" // lalr1.cc:392
 namespace isc { namespace dhcp {
-#line 141 "dhcp6_parser.h" // lalr1.cc:377
+#line 141 "dhcp6_parser.h" // lalr1.cc:392
 
 
 
@@ -409,42 +409,48 @@ namespace isc { namespace dhcp {
         TOKEN_LIBRARY = 322,
         TOKEN_PARAMETERS = 323,
         TOKEN_EXPIRED_LEASES_PROCESSING = 324,
-        TOKEN_SERVER_ID = 325,
-        TOKEN_LLT = 326,
-        TOKEN_EN = 327,
-        TOKEN_LL = 328,
-        TOKEN_IDENTIFIER = 329,
-        TOKEN_HTYPE = 330,
-        TOKEN_TIME = 331,
-        TOKEN_ENTERPRISE_ID = 332,
-        TOKEN_DHCP4O6_PORT = 333,
-        TOKEN_CONTROL_SOCKET = 334,
-        TOKEN_SOCKET_TYPE = 335,
-        TOKEN_SOCKET_NAME = 336,
-        TOKEN_DHCP_DDNS = 337,
-        TOKEN_LOGGING = 338,
-        TOKEN_LOGGERS = 339,
-        TOKEN_OUTPUT_OPTIONS = 340,
-        TOKEN_OUTPUT = 341,
-        TOKEN_DEBUGLEVEL = 342,
-        TOKEN_SEVERITY = 343,
-        TOKEN_DHCP4 = 344,
-        TOKEN_DHCPDDNS = 345,
-        TOKEN_TOPLEVEL_JSON = 346,
-        TOKEN_TOPLEVEL_DHCP6 = 347,
-        TOKEN_SUB_DHCP6 = 348,
-        TOKEN_SUB_INTERFACES6 = 349,
-        TOKEN_SUB_SUBNET6 = 350,
-        TOKEN_SUB_POOL6 = 351,
-        TOKEN_SUB_PD_POOL = 352,
-        TOKEN_SUB_RESERVATION = 353,
-        TOKEN_SUB_OPTION_DEF = 354,
-        TOKEN_SUB_OPTION_DATA = 355,
-        TOKEN_SUB_HOOKS_LIBRARY = 356,
-        TOKEN_STRING = 357,
-        TOKEN_INTEGER = 358,
-        TOKEN_FLOAT = 359,
-        TOKEN_BOOLEAN = 360
+        TOKEN_RECLAIM_TIMER_WAIT_TIME = 325,
+        TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 326,
+        TOKEN_HOLD_RECLAIMED_TIME = 327,
+        TOKEN_MAX_RECLAIM_LEASES = 328,
+        TOKEN_MAX_RECLAIM_TIME = 329,
+        TOKEN_UNWARNED_RECLAIM_CYCLES = 330,
+        TOKEN_SERVER_ID = 331,
+        TOKEN_LLT = 332,
+        TOKEN_EN = 333,
+        TOKEN_LL = 334,
+        TOKEN_IDENTIFIER = 335,
+        TOKEN_HTYPE = 336,
+        TOKEN_TIME = 337,
+        TOKEN_ENTERPRISE_ID = 338,
+        TOKEN_DHCP4O6_PORT = 339,
+        TOKEN_CONTROL_SOCKET = 340,
+        TOKEN_SOCKET_TYPE = 341,
+        TOKEN_SOCKET_NAME = 342,
+        TOKEN_DHCP_DDNS = 343,
+        TOKEN_LOGGING = 344,
+        TOKEN_LOGGERS = 345,
+        TOKEN_OUTPUT_OPTIONS = 346,
+        TOKEN_OUTPUT = 347,
+        TOKEN_DEBUGLEVEL = 348,
+        TOKEN_SEVERITY = 349,
+        TOKEN_DHCP4 = 350,
+        TOKEN_DHCPDDNS = 351,
+        TOKEN_TOPLEVEL_JSON = 352,
+        TOKEN_TOPLEVEL_DHCP6 = 353,
+        TOKEN_SUB_DHCP6 = 354,
+        TOKEN_SUB_INTERFACES6 = 355,
+        TOKEN_SUB_SUBNET6 = 356,
+        TOKEN_SUB_POOL6 = 357,
+        TOKEN_SUB_PD_POOL = 358,
+        TOKEN_SUB_RESERVATION = 359,
+        TOKEN_SUB_OPTION_DEF = 360,
+        TOKEN_SUB_OPTION_DATA = 361,
+        TOKEN_SUB_HOOKS_LIBRARY = 362,
+        TOKEN_STRING = 363,
+        TOKEN_INTEGER = 364,
+        TOKEN_FLOAT = 365,
+        TOKEN_BOOLEAN = 366
       };
     };
 
@@ -833,6 +839,30 @@ namespace isc { namespace dhcp {
 
     static inline
     symbol_type
+    make_RECLAIM_TIMER_WAIT_TIME (const location_type& l);
+
+    static inline
+    symbol_type
+    make_FLUSH_RECLAIMED_TIMER_WAIT_TIME (const location_type& l);
+
+    static inline
+    symbol_type
+    make_HOLD_RECLAIMED_TIME (const location_type& l);
+
+    static inline
+    symbol_type
+    make_MAX_RECLAIM_LEASES (const location_type& l);
+
+    static inline
+    symbol_type
+    make_MAX_RECLAIM_TIME (const location_type& l);
+
+    static inline
+    symbol_type
+    make_UNWARNED_RECLAIM_CYCLES (const location_type& l);
+
+    static inline
+    symbol_type
     make_SERVER_ID (const location_type& l);
 
     static inline
@@ -1180,12 +1210,12 @@ namespace isc { namespace dhcp {
     enum
     {
       yyeof_ = 0,
-      yylast_ = 640,     ///< Last index in yytable_.
-      yynnts_ = 275,  ///< Number of nonterminal symbols.
+      yylast_ = 661,     ///< Last index in yytable_.
+      yynnts_ = 281,  ///< Number of nonterminal symbols.
       yyfinal_ = 24, ///< Termination state number.
       yyterror_ = 1,
       yyerrcode_ = 256,
-      yyntokens_ = 106  ///< Number of tokens.
+      yyntokens_ = 112  ///< Number of tokens.
     };
 
 
@@ -1238,9 +1268,9 @@ namespace isc { namespace dhcp {
       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
-     105
+     105,   106,   107,   108,   109,   110,   111
     };
-    const unsigned int user_token_number_max_ = 360;
+    const unsigned int user_token_number_max_ = 366;
     const token_number_type undef_token_ = 2;
 
     if (static_cast<int>(t) <= yyeof_)
@@ -1273,24 +1303,24 @@ namespace isc { namespace dhcp {
   {
       switch (other.type_get ())
     {
-      case 119: // value
-      case 338: // duid_type
+      case 125: // value
+      case 350: // duid_type
         value.copy< ElementPtr > (other.value);
         break;
 
-      case 105: // "boolean"
+      case 111: // "boolean"
         value.copy< bool > (other.value);
         break;
 
-      case 104: // "floating point"
+      case 110: // "floating point"
         value.copy< double > (other.value);
         break;
 
-      case 103: // "integer"
+      case 109: // "integer"
         value.copy< int64_t > (other.value);
         break;
 
-      case 102: // "constant string"
+      case 108: // "constant string"
         value.copy< std::string > (other.value);
         break;
 
@@ -1311,24 +1341,24 @@ namespace isc { namespace dhcp {
     (void) v;
       switch (this->type_get ())
     {
-      case 119: // value
-      case 338: // duid_type
+      case 125: // value
+      case 350: // duid_type
         value.copy< ElementPtr > (v);
         break;
 
-      case 105: // "boolean"
+      case 111: // "boolean"
         value.copy< bool > (v);
         break;
 
-      case 104: // "floating point"
+      case 110: // "floating point"
         value.copy< double > (v);
         break;
 
-      case 103: // "integer"
+      case 109: // "integer"
         value.copy< int64_t > (v);
         break;
 
-      case 102: // "constant string"
+      case 108: // "constant string"
         value.copy< std::string > (v);
         break;
 
@@ -1408,24 +1438,24 @@ namespace isc { namespace dhcp {
     // Type destructor.
     switch (yytype)
     {
-      case 119: // value
-      case 338: // duid_type
+      case 125: // value
+      case 350: // duid_type
         value.template destroy< ElementPtr > ();
         break;
 
-      case 105: // "boolean"
+      case 111: // "boolean"
         value.template destroy< bool > ();
         break;
 
-      case 104: // "floating point"
+      case 110: // "floating point"
         value.template destroy< double > ();
         break;
 
-      case 103: // "integer"
+      case 109: // "integer"
         value.template destroy< int64_t > ();
         break;
 
-      case 102: // "constant string"
+      case 108: // "constant string"
         value.template destroy< std::string > ();
         break;
 
@@ -1452,24 +1482,24 @@ namespace isc { namespace dhcp {
     super_type::move(s);
       switch (this->type_get ())
     {
-      case 119: // value
-      case 338: // duid_type
+      case 125: // value
+      case 350: // duid_type
         value.move< ElementPtr > (s.value);
         break;
 
-      case 105: // "boolean"
+      case 111: // "boolean"
         value.move< bool > (s.value);
         break;
 
-      case 104: // "floating point"
+      case 110: // "floating point"
         value.move< double > (s.value);
         break;
 
-      case 103: // "integer"
+      case 109: // "integer"
         value.move< int64_t > (s.value);
         break;
 
-      case 102: // "constant string"
+      case 108: // "constant string"
         value.move< std::string > (s.value);
         break;
 
@@ -1538,7 +1568,8 @@ namespace isc { namespace dhcp {
      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
-     355,   356,   357,   358,   359,   360
+     355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
+     365,   366
     };
     return static_cast<token_type> (yytoken_number_[type]);
   }
@@ -1952,6 +1983,42 @@ namespace isc { namespace dhcp {
   }
 
   Dhcp6Parser::symbol_type
+  Dhcp6Parser::make_RECLAIM_TIMER_WAIT_TIME (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_RECLAIM_TIMER_WAIT_TIME, l);
+  }
+
+  Dhcp6Parser::symbol_type
+  Dhcp6Parser::make_FLUSH_RECLAIMED_TIMER_WAIT_TIME (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME, l);
+  }
+
+  Dhcp6Parser::symbol_type
+  Dhcp6Parser::make_HOLD_RECLAIMED_TIME (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_HOLD_RECLAIMED_TIME, l);
+  }
+
+  Dhcp6Parser::symbol_type
+  Dhcp6Parser::make_MAX_RECLAIM_LEASES (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_MAX_RECLAIM_LEASES, l);
+  }
+
+  Dhcp6Parser::symbol_type
+  Dhcp6Parser::make_MAX_RECLAIM_TIME (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_MAX_RECLAIM_TIME, l);
+  }
+
+  Dhcp6Parser::symbol_type
+  Dhcp6Parser::make_UNWARNED_RECLAIM_CYCLES (const location_type& l)
+  {
+    return symbol_type (token::TOKEN_UNWARNED_RECLAIM_CYCLES, l);
+  }
+
+  Dhcp6Parser::symbol_type
   Dhcp6Parser::make_SERVER_ID (const location_type& l)
   {
     return symbol_type (token::TOKEN_SERVER_ID, l);
@@ -2168,9 +2235,9 @@ namespace isc { namespace dhcp {
   }
 
 
-#line 14 "dhcp6_parser.yy" // lalr1.cc:377
+#line 14 "dhcp6_parser.yy" // lalr1.cc:392
 } } // isc::dhcp
-#line 2174 "dhcp6_parser.h" // lalr1.cc:377
+#line 2241 "dhcp6_parser.h" // lalr1.cc:392
 
 
 

+ 42 - 6
src/bin/dhcp6/dhcp6_parser.yy

@@ -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"
   LLT "LLT"
@@ -648,7 +654,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();
@@ -658,12 +664,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 ------------------------------------------

+ 7 - 2
src/bin/dhcp6/json_config_parser.cc

@@ -717,8 +717,7 @@ DhcpConfigParser* createGlobal6DhcpConfigParser(const std::string& config_id,
     } else if (config_id.compare("relay-supplied-options") == 0) {
         parser = new RSOOListConfigParser(config_id);
     // control-socket has been converted to SimpleParser.
-    } else if (config_id.compare("expired-leases-processing") == 0) {
-        parser = new ExpirationConfigParser();
+    // expired-leases-processing has been converted to SimpleParser.
     } else if (config_id.compare("client-classes") == 0) {
         parser = new ClientClassDefListParser(config_id, globalContext());
     // host-reservation-identifiers have been converted to SimpleParser already.
@@ -939,6 +938,12 @@ configureDhcp6Server(Dhcpv6Srv&, isc::data::ConstElementPtr config_set) {
                 continue;
             }
 
+            if (config_pair.first == "expired-leases-processing") {
+                ExpirationConfigParser parser;
+                parser.parse(config_pair.second);
+                continue;
+            }
+
             ParserPtr parser(createGlobal6DhcpConfigParser(config_pair.first,
                                                            config_pair.second));
             LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, DHCP6_PARSER_CREATED)

+ 4 - 5
src/bin/dhcp6/location.hh

@@ -1,4 +1,3 @@
-// Generated 201701070039
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Locations for Bison parsers in C++
@@ -41,9 +40,9 @@
 
 # include "position.hh"
 
-#line 14 "dhcp6_parser.yy" // location.cc:296
+#line 14 "dhcp6_parser.yy" // location.cc:337
 namespace isc { namespace dhcp {
-#line 46 "location.hh" // location.cc:296
+#line 46 "location.hh" // location.cc:337
   /// Abstract a location.
   class location
   {
@@ -187,7 +186,7 @@ namespace isc { namespace dhcp {
     return ostr;
   }
 
-#line 14 "dhcp6_parser.yy" // location.cc:296
+#line 14 "dhcp6_parser.yy" // location.cc:337
 } } // isc::dhcp
-#line 192 "location.hh" // location.cc:296
+#line 192 "location.hh" // location.cc:337
 #endif // !YY_PARSER6_LOCATION_HH_INCLUDED

+ 2 - 0
src/bin/dhcp6/parser_context.cc

@@ -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 DUID_TYPE:

+ 3 - 0
src/bin/dhcp6/parser_context.h

@@ -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,
 

+ 4 - 5
src/bin/dhcp6/position.hh

@@ -1,4 +1,3 @@
-// Generated 201701070039
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Positions for Bison parsers in C++
@@ -51,9 +50,9 @@
 #  endif
 # endif
 
-#line 14 "dhcp6_parser.yy" // location.cc:296
+#line 14 "dhcp6_parser.yy" // location.cc:337
 namespace isc { namespace dhcp {
-#line 56 "position.hh" // location.cc:296
+#line 56 "position.hh" // location.cc:337
   /// Abstract a position.
   class position
   {
@@ -175,7 +174,7 @@ namespace isc { namespace dhcp {
     return ostr << pos.line << '.' << pos.column;
   }
 
-#line 14 "dhcp6_parser.yy" // location.cc:296
+#line 14 "dhcp6_parser.yy" // location.cc:337
 } } // isc::dhcp
-#line 180 "position.hh" // location.cc:296
+#line 180 "position.hh" // location.cc:337
 #endif // !YY_PARSER6_POSITION_HH_INCLUDED

+ 4 - 5
src/bin/dhcp6/stack.hh

@@ -1,4 +1,3 @@
-// Generated 201701070039
 // A Bison parser, made by GNU Bison 3.0.4.
 
 // Stack handling for Bison parsers in C++
@@ -41,9 +40,9 @@
 
 # include <vector>
 
-#line 14 "dhcp6_parser.yy" // stack.hh:132
+#line 14 "dhcp6_parser.yy" // stack.hh:151
 namespace isc { namespace dhcp {
-#line 46 "stack.hh" // stack.hh:132
+#line 46 "stack.hh" // stack.hh:151
   template <class T, class S = std::vector<T> >
   class stack
   {
@@ -151,8 +150,8 @@ namespace isc { namespace dhcp {
     unsigned int range_;
   };
 
-#line 14 "dhcp6_parser.yy" // stack.hh:132
+#line 14 "dhcp6_parser.yy" // stack.hh:151
 } } // isc::dhcp
-#line 156 "stack.hh" // stack.hh:132
+#line 156 "stack.hh" // stack.hh:151
 
 #endif // !YY_PARSER6_STACK_HH_INCLUDED

+ 3 - 11
src/lib/dhcpsrv/parsers/expiration_config_parser.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2015 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
@@ -8,6 +8,7 @@
 #include <dhcpsrv/cfg_expiration.h>
 #include <dhcpsrv/cfgmgr.h>
 #include <dhcpsrv/parsers/expiration_config_parser.h>
+#include <dhcpsrv/parsers/dhcp_parsers.h>
 #include <boost/foreach.hpp>
 
 using namespace isc::data;
@@ -15,12 +16,8 @@ using namespace isc::data;
 namespace isc {
 namespace dhcp {
 
-ExpirationConfigParser::ExpirationConfigParser()
-    : DhcpConfigParser() {
-}
-
 void
-ExpirationConfigParser::build(ConstElementPtr expiration_config) {
+ExpirationConfigParser::parse(ConstElementPtr expiration_config) {
     CfgExpirationPtr cfg = CfgMgr::instance().getStagingCfg()->getCfgExpiration();
 
     BOOST_FOREACH(ConfigPair config_element, expiration_config->mapValue()) {
@@ -63,10 +60,5 @@ ExpirationConfigParser::build(ConstElementPtr expiration_config) {
     }
 }
 
-void
-ExpirationConfigParser::commit() {
-    // Nothing to do.
-}
-
 } // end of namespace isc::dhcp
 } // end of namespace isc

+ 9 - 11
src/lib/dhcpsrv/parsers/expiration_config_parser.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2015 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
@@ -7,7 +7,8 @@
 #ifndef EXPIRATION_CONFIG_PARSER_H
 #define EXPIRATION_CONFIG_PARSER_H
 
-#include <dhcpsrv/parsers/dhcp_config_parser.h>
+#include <cc/data.h>
+#include <cc/simple_parser.h>
 
 namespace isc {
 namespace dhcp {
@@ -32,26 +33,23 @@ namespace dhcp {
 /// those that aren't specified.
 ///
 /// The parser checks if the values of the specified parameters are within
-/// the allowed ranges and throws exception if they are. Each parameter
+/// the allowed ranges and throws exception if they aren't. Each parameter
 /// has a corresponding maximum value defined in the @c CfgExpiration class.
 /// None of them may be negative.
-class ExpirationConfigParser : public DhcpConfigParser {
+class ExpirationConfigParser : public isc::data::SimpleParser {
 public:
 
-    /// @brief Constructor
-    ExpirationConfigParser();
+    /// @brief Destructor.
+    virtual ~ExpirationConfigParser() { }
 
     /// @brief Parses parameters in the JSON map, pertaining to the processing
     /// of the expired leases.
     ///
-    /// @param value pointer to the content of parsed values
+    /// @param expiration_config pointer to the content of parsed values
     ///
     /// @throw DhcpConfigError if unknown parameter specified or the
     /// parameter contains invalid value..
-    virtual void build(isc::data::ConstElementPtr value);
-
-    /// @brief Does nothing.
-    virtual void commit();
+    void parse(isc::data::ConstElementPtr expiration_config);
 
 };
 

+ 4 - 3
src/lib/dhcpsrv/tests/expiration_config_parser_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2015 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
@@ -10,6 +10,7 @@
 #include <dhcpsrv/cfgmgr.h>
 #include <dhcpsrv/cfg_expiration.h>
 #include <dhcpsrv/parsers/expiration_config_parser.h>
+#include <dhcpsrv/parsers/dhcp_parsers.h>
 #include <gtest/gtest.h>
 #include <sstream>
 #include <stdint.h>
@@ -105,7 +106,7 @@ ExpirationConfigParserTest::renderConfig() const {
 
     // Parse the configuration. This may emit exceptions.
     ExpirationConfigParser parser;
-    parser.build(config_element);
+    parser.parse(config_element);
 
     // No exception so return configuration.
     return (CfgMgr::instance().getStagingCfg()->getCfgExpiration());
@@ -254,7 +255,7 @@ TEST_F(ExpirationConfigParserTest, notNumberValue) {
 
     // Parse the configuration. It should throw exception.
     ExpirationConfigParser parser;
-    EXPECT_THROW(parser.build(config_element), DhcpConfigError);
+    EXPECT_THROW(parser.parse(config_element), DhcpConfigError);
 }
 
 } // end of anonymous namespace