Commit 7be6514d authored by Francis Dupont's avatar Francis Dupont
Browse files

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

parents 4c3d035d 3f07550f
This diff is collapsed.
...@@ -788,6 +788,60 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence} ...@@ -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\" { \"dhcp4o6-port\" {
switch(driver.ctx_) { switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP4: case isc::dhcp::Parser4Context::DHCP4:
......
This diff is collapsed.
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#ifndef YY_PARSER4_DHCP4_PARSER_H_INCLUDED #ifndef YY_PARSER4_DHCP4_PARSER_H_INCLUDED
# define YY_PARSER4_DHCP4_PARSER_H_INCLUDED # define YY_PARSER4_DHCP4_PARSER_H_INCLUDED
// // "%code requires" blocks. // // "%code requires" blocks.
#line 17 "dhcp4_parser.yy" // lalr1.cc:377 #line 17 "dhcp4_parser.yy" // lalr1.cc:392
#include <string> #include <string>
#include <cc/data.h> #include <cc/data.h>
...@@ -52,7 +52,7 @@ using namespace isc::dhcp; ...@@ -52,7 +52,7 @@ using namespace isc::dhcp;
using namespace isc::data; using namespace isc::data;
using namespace std; using namespace std;
#line 56 "dhcp4_parser.h" // lalr1.cc:377 #line 56 "dhcp4_parser.h" // lalr1.cc:392
# include <cassert> # include <cassert>
# include <cstdlib> // std::abort # include <cstdlib> // std::abort
...@@ -135,9 +135,9 @@ using namespace std; ...@@ -135,9 +135,9 @@ using namespace std;
# endif /* ! defined YYDEBUG */ # endif /* ! defined YYDEBUG */
#endif /* ! defined PARSER4_DEBUG */ #endif /* ! defined PARSER4_DEBUG */
#line 14 "dhcp4_parser.yy" // lalr1.cc:377 #line 14 "dhcp4_parser.yy" // lalr1.cc:392
namespace isc { namespace dhcp { 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 { ...@@ -411,38 +411,44 @@ namespace isc { namespace dhcp {
TOKEN_LIBRARY = 324, TOKEN_LIBRARY = 324,
TOKEN_PARAMETERS = 325, TOKEN_PARAMETERS = 325,
TOKEN_EXPIRED_LEASES_PROCESSING = 326, TOKEN_EXPIRED_LEASES_PROCESSING = 326,
TOKEN_SERVER_ID = 327, TOKEN_RECLAIM_TIMER_WAIT_TIME = 327,
TOKEN_IDENTIFIER = 328, TOKEN_FLUSH_RECLAIMED_TIMER_WAIT_TIME = 328,
TOKEN_HTYPE = 329, TOKEN_HOLD_RECLAIMED_TIME = 329,
TOKEN_TIME = 330, TOKEN_MAX_RECLAIM_LEASES = 330,
TOKEN_ENTERPRISE_ID = 331, TOKEN_MAX_RECLAIM_TIME = 331,
TOKEN_DHCP4O6_PORT = 332, TOKEN_UNWARNED_RECLAIM_CYCLES = 332,
TOKEN_CONTROL_SOCKET = 333, TOKEN_SERVER_ID = 333,
TOKEN_SOCKET_TYPE = 334, TOKEN_IDENTIFIER = 334,
TOKEN_SOCKET_NAME = 335, TOKEN_HTYPE = 335,
TOKEN_DHCP_DDNS = 336, TOKEN_TIME = 336,
TOKEN_LOGGING = 337, TOKEN_ENTERPRISE_ID = 337,
TOKEN_LOGGERS = 338, TOKEN_DHCP4O6_PORT = 338,
TOKEN_OUTPUT_OPTIONS = 339, TOKEN_CONTROL_SOCKET = 339,
TOKEN_OUTPUT = 340, TOKEN_SOCKET_TYPE = 340,
TOKEN_DEBUGLEVEL = 341, TOKEN_SOCKET_NAME = 341,
TOKEN_SEVERITY = 342, TOKEN_DHCP_DDNS = 342,
TOKEN_DHCP6 = 343, TOKEN_LOGGING = 343,
TOKEN_DHCPDDNS = 344, TOKEN_LOGGERS = 344,
TOKEN_TOPLEVEL_JSON = 345, TOKEN_OUTPUT_OPTIONS = 345,
TOKEN_TOPLEVEL_DHCP4 = 346, TOKEN_OUTPUT = 346,
TOKEN_SUB_DHCP4 = 347, TOKEN_DEBUGLEVEL = 347,
TOKEN_SUB_INTERFACES4 = 348, TOKEN_SEVERITY = 348,
TOKEN_SUB_SUBNET4 = 349, TOKEN_DHCP6 = 349,
TOKEN_SUB_POOL4 = 350, TOKEN_DHCPDDNS = 350,
TOKEN_SUB_RESERVATION = 351, TOKEN_TOPLEVEL_JSON = 351,
TOKEN_SUB_OPTION_DEF = 352, TOKEN_TOPLEVEL_DHCP4 = 352,
TOKEN_SUB_OPTION_DATA = 353, TOKEN_SUB_DHCP4 = 353,
TOKEN_SUB_HOOKS_LIBRARY = 354, TOKEN_SUB_INTERFACES4 = 354,
TOKEN_STRING = 355, TOKEN_SUB_SUBNET4 = 355,
TOKEN_INTEGER = 356, TOKEN_SUB_POOL4 = 356,
TOKEN_FLOAT = 357, TOKEN_SUB_RESERVATION = 357,
TOKEN_BOOLEAN = 358 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
}; };
}; };
...@@ -837,6 +843,30 @@ namespace isc { namespace dhcp { ...@@ -837,6 +843,30 @@ namespace isc { namespace dhcp {
symbol_type symbol_type
make_EXPIRED_LEASES_PROCESSING (const location_type& l); make_EXPIRED_LEASES_PROCESSING (const location_type& l);
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 static inline
symbol_type symbol_type
make_SERVER_ID (const location_type& l); make_SERVER_ID (const location_type& l);
...@@ -1170,12 +1200,12 @@ namespace isc { namespace dhcp { ...@@ -1170,12 +1200,12 @@ namespace isc { namespace dhcp {
enum enum
{ {
yyeof_ = 0, yyeof_ = 0,
yylast_ = 626, ///< Last index in yytable_. yylast_ = 647, ///< Last index in yytable_.
yynnts_ = 268, ///< Number of nonterminal symbols. yynnts_ = 274, ///< Number of nonterminal symbols.
yyfinal_ = 22, ///< Termination state number. yyfinal_ = 22, ///< Termination state number.
yyterror_ = 1, yyterror_ = 1,
yyerrcode_ = 256, yyerrcode_ = 256,
yyntokens_ = 104 ///< Number of tokens. yyntokens_ = 110 ///< Number of tokens.
}; };
...@@ -1227,9 +1257,10 @@ namespace isc { namespace dhcp { ...@@ -1227,9 +1257,10 @@ namespace isc { namespace dhcp {
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 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; const token_number_type undef_token_ = 2;
if (static_cast<int>(t) <= yyeof_) if (static_cast<int>(t) <= yyeof_)
...@@ -1262,24 +1293,24 @@ namespace isc { namespace dhcp { ...@@ -1262,24 +1293,24 @@ namespace isc { namespace dhcp {
{ {
switch (other.type_get ()) switch (other.type_get ())
{ {
case 116: // value case 122: // value
case 155: // socket_type case 161: // socket_type
value.copy< ElementPtr > (other.value); value.copy< ElementPtr > (other.value);
break; break;
case 103: // "boolean" case 109: // "boolean"
value.copy< bool > (other.value); value.copy< bool > (other.value);
break; break;
case 102: // "floating point" case 108: // "floating point"
value.copy< double > (other.value); value.copy< double > (other.value);
break; break;
case 101: // "integer" case 107: // "integer"
value.copy< int64_t > (other.value); value.copy< int64_t > (other.value);
break; break;
case 100: // "constant string" case 106: // "constant string"
value.copy< std::string > (other.value); value.copy< std::string > (other.value);
break; break;
...@@ -1300,24 +1331,24 @@ namespace isc { namespace dhcp { ...@@ -1300,24 +1331,24 @@ namespace isc { namespace dhcp {
(void) v; (void) v;
switch (this->type_get ()) switch (this->type_get ())
{ {
case 116: // value case 122: // value
case 155: // socket_type case 161: // socket_type
value.copy< ElementPtr > (v); value.copy< ElementPtr > (v);
break; break;
case 103: // "boolean" case 109: // "boolean"
value.copy< bool > (v); value.copy< bool > (v);
break; break;
case 102: // "floating point" case 108: // "floating point"
value.copy< double > (v); value.copy< double > (v);
break; break;
case 101: // "integer" case 107: // "integer"
value.copy< int64_t > (v); value.copy< int64_t > (v);
break; break;
case 100: // "constant string" case 106: // "constant string"
value.copy< std::string > (v); value.copy< std::string > (v);
break; break;
...@@ -1397,24 +1428,24 @@ namespace isc { namespace dhcp { ...@@ -1397,24 +1428,24 @@ namespace isc { namespace dhcp {
// Type destructor. // Type destructor.
switch (yytype) switch (yytype)
{ {
case 116: // value case 122: // value
case 155: // socket_type case 161: // socket_type
value.template destroy< ElementPtr > (); value.template destroy< ElementPtr > ();
break; break;
case 103: // "boolean" case 109: // "boolean"
value.template destroy< bool > (); value.template destroy< bool > ();
break; break;
case 102: // "floating point" case 108: // "floating point"
value.template destroy< double > (); value.template destroy< double > ();
break; break;
case 101: // "integer" case 107: // "integer"
value.template destroy< int64_t > (); value.template destroy< int64_t > ();
break; break;
case 100: // "constant string" case 106: // "constant string"
value.template destroy< std::string > (); value.template destroy< std::string > ();
break; break;
...@@ -1441,24 +1472,24 @@ namespace isc { namespace dhcp { ...@@ -1441,24 +1472,24 @@ namespace isc { namespace dhcp {
super_type::move(s); super_type::move(s);
switch (this->type_get ()) switch (this->type_get ())
{ {
case 116: // value case 122: // value
case 155: // socket_type case 161: // socket_type
value.move< ElementPtr > (s.value); value.move< ElementPtr > (s.value);
break; break;
case 103: // "boolean" case 109: // "boolean"
value.move< bool > (s.value); value.move< bool > (s.value);
break; break;
case 102: // "floating point" case 108: // "floating point"
value.move< double > (s.value); value.move< double > (s.value);
break; break;
case 101: // "integer" case 107: // "integer"
value.move< int64_t > (s.value); value.move< int64_t > (s.value);
break; break;
case 100: // "constant string" case 106: // "constant string"
value.move< std::string > (s.value); value.move< std::string > (s.value);
break; break;
...@@ -1527,7 +1558,7 @@ namespace isc { namespace dhcp { ...@@ -1527,7 +1558,7 @@ namespace isc { namespace dhcp {
325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 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]); return static_cast<token_type> (yytoken_number_[type]);
} }
...@@ -1952,6 +1983,42 @@ namespace isc { namespace dhcp { ...@@ -1952,6 +1983,42 @@ namespace isc { namespace dhcp {
return symbol_type (token::TOKEN_EXPIRED_LEASES_PROCESSING, l); return symbol_type (token::TOKEN_EXPIRED_LEASES_PROCESSING, l);
} }
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::symbol_type
Dhcp4Parser::make_SERVER_ID (const location_type& l) Dhcp4Parser::make_SERVER_ID (const location_type& l)
{ {
...@@ -2145,9 +2212,9 @@ namespace isc { namespace dhcp { ...@@ -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 } } // isc::dhcp
#line 2151 "dhcp4_parser.h" // lalr1.cc:377 #line 2218 "dhcp4_parser.h" // lalr1.cc:392
......
...@@ -122,6 +122,12 @@ using namespace std; ...@@ -122,6 +122,12 @@ using namespace std;
PARAMETERS "parameters" PARAMETERS "parameters"
EXPIRED_LEASES_PROCESSING "expired-leases-processing" 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" SERVER_ID "server-id"
IDENTIFIER "identifier" IDENTIFIER "identifier"
...@@ -650,7 +656,7 @@ expired_leases_processing: EXPIRED_LEASES_PROCESSING { ...@@ -650,7 +656,7 @@ expired_leases_processing: EXPIRED_LEASES_PROCESSING {
ElementPtr m(new MapElement(ctx.loc2pos(@1))); ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("expired-leases-processing", m); ctx.stack_.back()->set("expired-leases-processing", m);
ctx.stack_.push_back(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 { } COLON LCURLY_BRACKET expired_leases_params RCURLY_BRACKET {
ctx.stack_.pop_back(); ctx.stack_.pop_back();
ctx.leave(); ctx.leave();
...@@ -660,12 +666,42 @@ expired_leases_params: expired_leases_param ...@@ -660,12 +666,42 @@ expired_leases_params: expired_leases_param
| expired_leases_params COMMA 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. expired_leases_param: reclaim_timer_wait_time
// Instead of explicitly listing all allowed expired leases parameters, we | flush_reclaimed_timer_wait_time
// simply say that all of them as integers. | hold_reclaimed_time
expired_leases_param: STRING COLON INTEGER { | 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))); ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set($1, value); ctx.stack_.back()->set("unwarned-reclaim-cycles", value);
}; };
// --- subnet4 ------------------------------------------ // --- subnet4 ------------------------------------------
......
...@@ -438,8 +438,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id, ...@@ -438,8 +438,7 @@ DhcpConfigParser* createGlobalDhcp4ConfigParser(const std::string& config_id,
} else if (config_id.compare("match-client-id") == 0) { } else if (config_id.compare("match-client-id") == 0) {
parser = new BooleanParser(config_id, globalContext()->boolean_values_); parser = new BooleanParser(config_id, globalContext()->boolean_values_);
// control-socket has been converted to SimpleParser already. // control-socket has been converted to SimpleParser already.
} else if (config_id.compare("expired-leases-processing") == 0) { // expired-leases-processing has been converted to SimpleParser already.
parser = new ExpirationConfigParser();
} else if (config_id.compare("client-classes") == 0) { } else if (config_id.compare("client-classes") == 0) {
parser = new ClientClassDefListParser(config_id, globalContext()); parser = new ClientClassDefListParser(config_id, globalContext());
// host-reservation-identifiers have been converted to SimpleParser already. // host-reservation-identifiers have been converted to SimpleParser already.
...@@ -656,6 +655,12 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) { ...@@ -656,6 +655,12 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set) {