Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
235
Issues
235
List
Board
Labels
Milestones
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
8c2df1aa
Commit
8c2df1aa
authored
Dec 27, 2018
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[30-implement-control-socket-for-ddns-2] Updated syntax
parent
23200e6a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
4 deletions
+92
-4
d2_config.h
src/bin/d2/d2_config.h
+5
-0
d2_lexer.ll
src/bin/d2/d2_lexer.ll
+29
-0
d2_parser.yy
src/bin/d2/d2_parser.yy
+45
-0
parser_context.cc
src/bin/d2/parser_context.cc
+2
-0
parser_context.h
src/bin/d2/parser_context.h
+4
-1
parser_unittest.cc
src/bin/d2/tests/parser_unittest.cc
+3
-3
get_config.json
src/bin/d2/tests/testdata/get_config.json
+4
-0
No files found.
src/bin/d2/d2_config.h
View file @
8c2df1aa
...
@@ -77,6 +77,11 @@ namespace d2 {
...
@@ -77,6 +77,11 @@ namespace d2 {
/// "interface" : "eth1" ,
/// "interface" : "eth1" ,
/// "ip-address" : "192.168.1.33" ,
/// "ip-address" : "192.168.1.33" ,
/// "port" : 88 ,
/// "port" : 88 ,
/// "control-socket":
/// {
/// "socket-type": "unix" ,
/// "socket-name": "/tmp/d2-ctrl-socket"
//// },
/// "tsig-keys":
/// "tsig-keys":
//// [
//// [
/// {
/// {
...
...
src/bin/d2/d2_lexer.ll
View file @
8c2df1aa
...
@@ -269,6 +269,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
...
@@ -269,6 +269,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
case isc::d2::D2ParserContext::DNS_SERVERS:
case isc::d2::D2ParserContext::DNS_SERVERS:
case isc::d2::D2ParserContext::TSIG_KEY:
case isc::d2::D2ParserContext::TSIG_KEY:
case isc::d2::D2ParserContext::TSIG_KEYS:
case isc::d2::D2ParserContext::TSIG_KEYS:
case isc::d2::D2ParserContext::CONTROL_SOCKET:
case isc::d2::D2ParserContext::LOGGERS:
case isc::d2::D2ParserContext::LOGGERS:
return isc::d2::D2Parser::make_USER_CONTEXT(driver.loc_);
return isc::d2::D2Parser::make_USER_CONTEXT(driver.loc_);
default:
default:
...
@@ -285,6 +286,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
...
@@ -285,6 +286,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
case isc::d2::D2ParserContext::DNS_SERVERS:
case isc::d2::D2ParserContext::DNS_SERVERS:
case isc::d2::D2ParserContext::TSIG_KEY:
case isc::d2::D2ParserContext::TSIG_KEY:
case isc::d2::D2ParserContext::TSIG_KEYS:
case isc::d2::D2ParserContext::TSIG_KEYS:
case isc::d2::D2ParserContext::CONTROL_SOCKET:
case isc::d2::D2ParserContext::LOGGERS:
case isc::d2::D2ParserContext::LOGGERS:
return isc::d2::D2Parser::make_COMMENT(driver.loc_);
return isc::d2::D2Parser::make_COMMENT(driver.loc_);
default:
default:
...
@@ -390,6 +392,33 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
...
@@ -390,6 +392,33 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
}
}
\"
c
ontrol-so
c
ket\
" {
switch(driver.ctx_) {
case isc::d2::D2ParserContext::DHCPDDNS:
return isc::d2::D2Parser::make_CONTROL_SOCKET(driver.loc_);
default:
return isc::d2::D2Parser::make_STRING("
c
ontrol-so
c
ket
", driver.loc_);
}
}
\"
so
c
ket-
type
\
" {
switch(driver.ctx_) {
case isc::d2::D2ParserContext::CONTROL_SOCKET:
return isc::d2::D2Parser::make_SOCKET_TYPE(driver.loc_);
default:
return isc::d2::D2Parser::make_STRING("
so
c
ket-
type
", driver.loc_);
}
}
\"
so
c
ket-name\
" {
switch(driver.ctx_) {
case isc::d2::D2ParserContext::CONTROL_SOCKET:
return isc::d2::D2Parser::make_SOCKET_NAME(driver.loc_);
default:
return isc::d2::D2Parser::make_STRING("
so
c
ket-name
", driver.loc_);
}
}
\"
Logging\
" {
\"
Logging\
" {
switch(driver.ctx_) {
switch(driver.ctx_) {
...
...
src/bin/d2/d2_parser.yy
View file @
8c2df1aa
...
@@ -75,6 +75,10 @@ using namespace std;
...
@@ -75,6 +75,10 @@ using namespace std;
DIGEST_BITS "digest-bits"
DIGEST_BITS "digest-bits"
SECRET "secret"
SECRET "secret"
CONTROL_SOCKET "control-socket"
SOCKET_TYPE "socket-type"
SOCKET_NAME "socket-name"
LOGGING "Logging"
LOGGING "Logging"
LOGGERS "loggers"
LOGGERS "loggers"
NAME "name"
NAME "name"
...
@@ -270,6 +274,7 @@ dhcpddns_param: ip_address
...
@@ -270,6 +274,7 @@ dhcpddns_param: ip_address
| forward_ddns
| forward_ddns
| reverse_ddns
| reverse_ddns
| tsig_keys
| tsig_keys
| control_socket
| user_context
| user_context
| comment
| comment
| unknown_map_entry
| unknown_map_entry
...
@@ -665,6 +670,46 @@ tsig_key_secret: SECRET {
...
@@ -665,6 +670,46 @@ tsig_key_secret: SECRET {
// --- end of tsig-keys ---------------------------------
// --- end of tsig-keys ---------------------------------
// --- control socket ----------------------------------------
control_socket: CONTROL_SOCKET {
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("control-socket", m);
ctx.stack_.push_back(m);
ctx.enter(ctx.CONTROL_SOCKET);
} COLON LCURLY_BRACKET control_socket_params RCURLY_BRACKET {
ctx.stack_.pop_back();
ctx.leave();
};
control_socket_params: control_socket_param
| control_socket_params COMMA control_socket_param
;
control_socket_param: control_socket_type
| control_socket_name
| user_context
| comment
| unknown_map_entry
;
control_socket_type: SOCKET_TYPE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr stype(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("socket-type", stype);
ctx.leave();
};
control_socket_name: SOCKET_NAME {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr name(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("socket-name", name);
ctx.leave();
};
// ----------------------------------------------------------------
dhcp6_json_object: DHCP6 {
dhcp6_json_object: DHCP6 {
ctx.enter(ctx.NO_KEYWORD);
ctx.enter(ctx.NO_KEYWORD);
...
...
src/bin/d2/parser_context.cc
View file @
8c2df1aa
...
@@ -142,6 +142,8 @@ D2ParserContext::contextName()
...
@@ -142,6 +142,8 @@ D2ParserContext::contextName()
return
(
"dns-server"
);
return
(
"dns-server"
);
case
DNS_SERVERS
:
case
DNS_SERVERS
:
return
(
"dns-servers"
);
return
(
"dns-servers"
);
case
CONTROL_SOCKET
:
return
(
"control-socket"
);
case
LOGGING
:
case
LOGGING
:
return
(
"Logging"
);
return
(
"Logging"
);
case
LOGGERS
:
case
LOGGERS
:
...
...
src/bin/d2/parser_context.h
View file @
8c2df1aa
// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2017
-2018
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
...
@@ -204,6 +204,9 @@ public:
...
@@ -204,6 +204,9 @@ public:
///< Used while parsing content of list of dns-servers
///< Used while parsing content of list of dns-servers
DNS_SERVERS
,
DNS_SERVERS
,
///< Used while parsing content of a control-socket
CONTROL_SOCKET
,
///< Used while parsing content of Logging
///< Used while parsing content of Logging
LOGGING
,
LOGGING
,
...
...
src/bin/d2/tests/parser_unittest.cc
View file @
8c2df1aa
...
@@ -128,9 +128,9 @@ TEST(ParserTest, keywordDhcpDdns) {
...
@@ -128,9 +128,9 @@ TEST(ParserTest, keywordDhcpDdns) {
"
\"
ip-address
\"
:
\"
192.168.77.1
\"
,
\n
"
"
\"
ip-address
\"
:
\"
192.168.77.1
\"
,
\n
"
"
\"
port
\"
: 777 ,
\n
"
"
\"
port
\"
: 777 ,
\n
"
"
\"
ncr-protocol
\"
:
\"
UDP
\"
,
\n
"
"
\"
ncr-protocol
\"
:
\"
UDP
\"
,
\n
"
"
\"
tsig-keys
\"
: [],
\n
"
"
\"
tsig-keys
\"
: [],
\n
"
"
\"
forward-ddns
\"
: {},
\n
"
"
\"
forward-ddns
\"
: {},
\n
"
"
\"
reverse-ddns
\"
: {}
\n
"
"
\"
reverse-ddns
\"
: {}
\n
"
"}
\n
"
"}
\n
"
"}
\n
"
;
"}
\n
"
;
testParser
(
txt
,
D2ParserContext
::
PARSER_DHCPDDNS
);
testParser
(
txt
,
D2ParserContext
::
PARSER_DHCPDDNS
);
...
...
src/bin/d2/tests/testdata/get_config.json
View file @
8c2df1aa
{
{
"DhcpDdns"
:
{
"DhcpDdns"
:
{
"control-socket"
:
{
"socket-name"
:
"/tmp/d2-ctrl-socket"
,
"socket-type"
:
"unix"
},
"dns-server-timeout"
:
1000
,
"dns-server-timeout"
:
1000
,
"forward-ddns"
:
{
"forward-ddns"
:
{
"ddns-domains"
:
[
"ddns-domains"
:
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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