summaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2021-11-28 15:26:42 +0100
committerRazvan Becheriu <razvan@isc.org>2022-01-21 18:15:38 +0100
commit71a6b1261bcfe89f6f3634960514bf2a929d79bf (patch)
treea1e64d9edbdbbfb1af59b30cabe4c61061f12fd8 /src/bin
parent[#2208] removed references of %l from logger pattern (diff)
downloadkea-71a6b1261bcfe89f6f3634960514bf2a929d79bf.tar.xz
kea-71a6b1261bcfe89f6f3634960514bf2a929d79bf.zip
[#2006] Added doc and syntax
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/agent/agent_lexer.ll27
-rw-r--r--src/bin/agent/agent_parser.yy36
-rw-r--r--src/bin/agent/simple_parser.cc5
3 files changed, 64 insertions, 4 deletions
diff --git a/src/bin/agent/agent_lexer.ll b/src/bin/agent/agent_lexer.ll
index 57ec1232f8..775bf31230 100644
--- a/src/bin/agent/agent_lexer.ll
+++ b/src/bin/agent/agent_lexer.ll
@@ -263,6 +263,15 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu]
}
}
+\"directory\" {
+ switch(driver.ctx_) {
+ case ParserContext::AUTHENTICATION:
+ return AgentParser::make_DIRECTORY(driver.loc_);
+ default:
+ return AgentParser::make_STRING("directory", driver.loc_);
+ }
+}
+
\"clients\" {
switch(driver.ctx_) {
case ParserContext::AUTHENTICATION:
@@ -281,6 +290,15 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu]
}
}
+\"user-file\" {
+ switch(driver.ctx_) {
+ case ParserContext::CLIENTS:
+ return AgentParser::make_USER_FILE(driver.loc_);
+ default:
+ return AgentParser::make_STRING("user-file", driver.loc_);
+ }
+}
+
\"password\" {
switch(driver.ctx_) {
case ParserContext::CLIENTS:
@@ -290,6 +308,15 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu]
}
}
+\"password-file\" {
+ switch(driver.ctx_) {
+ case ParserContext::CLIENTS:
+ return AgentParser::make_PASSWORD_FILE(driver.loc_);
+ default:
+ return AgentParser::make_STRING("password-file", driver.loc_);
+ }
+}
+
\"trust-anchor\" {
switch(driver.ctx_) {
case ParserContext::AGENT:
diff --git a/src/bin/agent/agent_parser.yy b/src/bin/agent/agent_parser.yy
index fd4aaf96d7..648bf25ea6 100644
--- a/src/bin/agent/agent_parser.yy
+++ b/src/bin/agent/agent_parser.yy
@@ -59,9 +59,11 @@ using namespace std;
TYPE "type"
BASIC "basic"
REALM "realm"
+ DIRECTORY "directory"
CLIENTS "clients"
USER "user"
- PASSWORD "password"
+ USER_FILE "user-file"
+ PASSWORD_FILE "password-file"
TRUST_ANCHOR "trust-anchor"
CERT_FILE "cert-file"
@@ -589,6 +591,7 @@ auth_params: auth_param
auth_param: auth_type
| realm
+ | directory
| clients
| comment
| user_context
@@ -604,7 +607,7 @@ auth_type: TYPE {
};
auth_type_value: BASIC { $$ = ElementPtr(new StringElement("basic", ctx.loc2pos(@1))); }
- ;
+ ;
realm: REALM {
ctx.unique("realm", ctx.loc2pos(@1));
@@ -615,6 +618,15 @@ realm: REALM {
ctx.leave();
};
+directory: DIRECTORY {
+ ctx.unique("directory", ctx.loc2pos(@1));
+ ctx.enter(ctx.NO_KEYWORDS);
+} COLON STRING {
+ ElementPtr directory(new StringElement($4, ctx.loc2pos(@4)));
+ ctx.stack_.back()->set("directory", directory);
+ ctx.leave();
+};
+
clients: CLIENTS {
ctx.unique("clients", ctx.loc2pos(@1));
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
@@ -653,7 +665,9 @@ clients_params: clients_param
;
clients_param: user
+ | user_file
| password
+ | password_file
| user_context
| comment
| unknown_map_entry
@@ -668,6 +682,15 @@ user: USER {
ctx.leave();
};
+user_file: USER_FILE {
+ ctx.unique("user-file", ctx.loc2pos(@1));
+ ctx.enter(ctx.NO_KEYWORDS);
+} COLON STRING {
+ ElementPtr user(new StringElement($4, ctx.loc2pos(@4)));
+ ctx.stack_.back()->set("user-file", user);
+ ctx.leave();
+};
+
password: PASSWORD {
ctx.unique("password", ctx.loc2pos(@1));
ctx.enter(ctx.NO_KEYWORDS);
@@ -677,6 +700,15 @@ password: PASSWORD {
ctx.leave();
};
+password_file: PASSWORD_FILE {
+ ctx.unique("password-file", ctx.loc2pos(@1));
+ ctx.enter(ctx.NO_KEYWORDS);
+} COLON STRING {
+ ElementPtr password(new StringElement($4, ctx.loc2pos(@4)));
+ ctx.stack_.back()->set("password-file", password);
+ ctx.leave();
+};
+
// --- authentication end here -----------------------------------------------------
// --- Loggers starts here -----------------------------------------------------
diff --git a/src/bin/agent/simple_parser.cc b/src/bin/agent/simple_parser.cc
index 47e302d2a0..a5c025c982 100644
--- a/src/bin/agent/simple_parser.cc
+++ b/src/bin/agent/simple_parser.cc
@@ -47,8 +47,9 @@ const SimpleDefaults AgentSimpleParser::AGENT_DEFAULTS = {
/// @brief This table defines default values for authentication.
const SimpleDefaults AgentSimpleParser::AUTH_DEFAULTS = {
- { "type", Element::string, "basic" },
- { "realm", Element::string, "kea-control-agent" }
+ { "type", Element::string, "basic" },
+ { "realm", Element::string, "kea-control-agent" },
+ { "directory", Element::string, "" }
};
/// @brief This table defines default values for control sockets.