]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3543] Checkpoint: extended syntax
authorFrancis Dupont <fdupont@isc.org>
Mon, 25 Jun 2018 15:29:33 +0000 (17:29 +0200)
committerFrancis Dupont <fdupont@isc.org>
Thu, 27 Dec 2018 19:53:59 +0000 (20:53 +0100)
src/bin/d2/d2_lexer.ll
src/bin/d2/d2_parser.yy
src/bin/d2/parser_context.cc
src/bin/d2/parser_context.h

index bc26b334bd61a89c3d5b031e7b123f11d070c499..a89a581407ab930a480f84e8011b96017e0ce65e 100644 (file)
@@ -390,6 +390,30 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
+\"control-socket\" {
+    switch(driver.ctx_) {
+    case isc::d2::D2ParserContext::DHCPDDNS:
+        return isc::d2::D2Parser::make_CONTROL_SOCKET(driver.loc_);
+    default:
+        return isc::d2::D2Parser::make_STRING("control-socket", driver.loc_);
+}
+
+\"socket-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("socket-type", driver.loc_);
+}
+
+\"socket-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("socket-name", driver.loc_);
+}
+
 
 \"Logging\" {
     switch(driver.ctx_) {
index 5dfc152cb79a7bc6fd1f423a34f9d736e4f0126c..f3c770d7bd35d954cf13cec6e60fd1f2c7fc5178 100644 (file)
@@ -75,6 +75,10 @@ using namespace std;
   DIGEST_BITS "digest-bits"
   SECRET "secret"
 
+  CONTROL_SOCKET "control-socket"
+  SOCKET_TYPE "socket-type"
+  SOCKET_NAME "socket-name"
+
   LOGGING "Logging"
   LOGGERS "loggers"
   NAME "name"
@@ -270,6 +274,7 @@ dhcpddns_param: ip_address
               | forward_ddns
               | reverse_ddns
               | tsig_keys
+              | control_socket
               | user_context
               | comment
               | unknown_map_entry
@@ -665,6 +670,46 @@ tsig_key_secret: SECRET {
 
 // --- 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 {
     ctx.enter(ctx.NO_KEYWORD);
index a88043a325bd575865fea8e90b568ded464f2f76..16caa286e47fc3ab250deb3ffc2b32b8688ea3f0 100644 (file)
@@ -142,6 +142,8 @@ D2ParserContext::contextName()
         return("dns-server");
     case DNS_SERVERS:
         return("dns-servers");
+    case CONTROL_SOCKET:
+        return("control-socket");
     case LOGGING:
         return ("Logging");
     case LOGGERS:
index cbb495c23b25fbc691225ecd6b97df004128af87..e1fc414e623a3850e140efc0df62e5de3c522cd2 100644 (file)
@@ -1,4 +1,4 @@
-// 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
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -204,6 +204,9 @@ public:
         ///< Used while parsing content of list of dns-servers
         DNS_SERVERS,
 
+        ///< Used while parsing content of a control-socket
+        CONTROL_SOCKET,
+
         ///< Used while parsing content of Logging
         LOGGING,