Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
f426d331
Commit
f426d331
authored
Jan 07, 2017
by
Francis Dupont
Browse files
[5035] Did flex/bison side
parent
b55841b6
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/bin/dhcp4/dhcp4_lexer.ll
View file @
f426d331
/
*
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:
...
...
src/bin/dhcp4/dhcp4_parser.yy
View file @
f426d331
/* 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 ------------------------------------------
...
...
src/bin/dhcp4/parser_context.cc
View file @
f426d331
...
...
@@ -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
:
...
...
src/bin/dhcp4/parser_context.h
View file @
f426d331
// Copyright (C) 2015-201
6
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-201
7
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
,
...
...
src/bin/dhcp6/dhcp6_lexer.ll
View file @
f426d331
/
*
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:
...
...
src/bin/dhcp6/dhcp6_parser.yy
View file @
f426d331
/* 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 ------------------------------------------
...
...
src/bin/dhcp6/parser_context.cc
View file @
f426d331
...
...
@@ -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
:
...
...
src/bin/dhcp6/parser_context.h
View file @
f426d331
// Copyright (C) 2015-201
6
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2015-201
7
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
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment