Commit f426d331 authored by Francis Dupont's avatar Francis Dupont

[5035] Did flex/bison side

parent b55841b6
/* 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 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 License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -770,6 +770,60 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence} ...@@ -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\" { \"dhcp4o6-port\" {
switch(driver.ctx_) { switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP4: case isc::dhcp::Parser4Context::DHCP4:
......
/* 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 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 License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -120,6 +120,12 @@ using namespace std; ...@@ -120,6 +120,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"
...@@ -644,7 +650,7 @@ expired_leases_processing: EXPIRED_LEASES_PROCESSING { ...@@ -644,7 +650,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();
...@@ -654,12 +660,42 @@ expired_leases_params: expired_leases_param ...@@ -654,12 +660,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 ------------------------------------------
......
...@@ -143,6 +143,8 @@ Parser4Context::contextName() ...@@ -143,6 +143,8 @@ Parser4Context::contextName()
return ("option-data"); return ("option-data");
case CLIENT_CLASSES: case CLIENT_CLASSES:
return ("client-classes"); return ("client-classes");
case EXPIRED_LEASES_PROCESSING:
return ("expired-leases-processing");
case SERVER_ID: case SERVER_ID:
return ("server-id"); return ("server-id");
case CONTROL_SOCKET: case CONTROL_SOCKET:
......
// 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 // 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 // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -219,6 +219,9 @@ public: ...@@ -219,6 +219,9 @@ public:
/// Used while parsing Dhcp4/client-classes structures. /// Used while parsing Dhcp4/client-classes structures.
CLIENT_CLASSES, CLIENT_CLASSES,
/// Used while parsing Dhcp4/expired-leases-processing.
EXPIRED_LEASES_PROCESSING,
/// Used while parsing Dhcp4/server-id structures. /// Used while parsing Dhcp4/server-id structures.
SERVER_ID, SERVER_ID,
......
/* 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 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 License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -844,6 +844,60 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence} ...@@ -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\" { \"dhcp4o6-port\" {
switch(driver.ctx_) { switch(driver.ctx_) {
case isc::dhcp::Parser6Context::DHCP6: case isc::dhcp::Parser6Context::DHCP6:
......
/* 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 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 License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -119,6 +119,12 @@ using namespace std; ...@@ -119,6 +119,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"
...@@ -644,7 +650,7 @@ expired_leases_processing: EXPIRED_LEASES_PROCESSING { ...@@ -644,7 +650,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();
...@@ -654,12 +660,42 @@ expired_leases_params: expired_leases_param ...@@ -654,12 +660,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);
}; };
// --- subnet6 ------------------------------------------ // --- subnet6 ------------------------------------------
......
...@@ -145,6 +145,8 @@ Parser6Context::contextName() ...@@ -145,6 +145,8 @@ Parser6Context::contextName()
return ("option-data"); return ("option-data");
case CLIENT_CLASSES: case CLIENT_CLASSES:
return ("client-classes"); return ("client-classes");
case EXPIRED_LEASES_PROCESSING:
return ("expired-leases-processing");
case SERVER_ID: case SERVER_ID:
return ("server-id"); return ("server-id");
case CONTROL_SOCKET: case CONTROL_SOCKET:
......
// 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 // 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 // License, v. 2.0. If a copy of the MPL was not distributed with this
...@@ -225,6 +225,9 @@ public: ...@@ -225,6 +225,9 @@ public:
/// Used while parsing Dhcp6/client-classes structures. /// Used while parsing Dhcp6/client-classes structures.
CLIENT_CLASSES, CLIENT_CLASSES,
/// Used while parsing Dhcp6/expired-leases-processing.
EXPIRED_LEASES_PROCESSING,
/// Used while parsing Dhcp6/server-id structures. /// Used while parsing Dhcp6/server-id structures.
SERVER_ID, SERVER_ID,
......
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