Browse Source

[5036] Support for parameters in hooks-libraries added.

Tomek Mrugalski 8 years ago
parent
commit
c19f1840cc
3 changed files with 27 additions and 2 deletions
  1. 5 1
      doc/examples/kea6/hooks.json
  2. 10 0
      src/bin/dhcp6/dhcp6_lexer.ll
  3. 12 1
      src/bin/dhcp6/dhcp6_parser.yy

+ 5 - 1
doc/examples/kea6/hooks.json

@@ -41,7 +41,11 @@
         "library": "/opt/lib/security.so"
      },
      {
-        "library": "/opt/lib/charging.so"
+        "library": "/opt/lib/charging.so",
+        "parameters": {
+             "path": "/var/kea/var",
+             "base-name": "kea-forensic6"
+        }
      }
   ]
 }

+ 10 - 0
src/bin/dhcp6/dhcp6_lexer.ll

@@ -744,6 +744,16 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
+
+\"parameters\" {
+    switch(driver.ctx_) {
+    case isc::dhcp::Parser6Context::HOOKS_LIBRARIES:
+        return isc::dhcp::Dhcp6Parser::make_PARAMETERS(driver.loc_);
+    default:
+        return isc::dhcp::Dhcp6Parser::make_STRING("parameters", driver.loc_);
+    }
+}
+
 \"library\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser6Context::HOOKS_LIBRARIES:

+ 12 - 1
src/bin/dhcp6/dhcp6_parser.yy

@@ -114,6 +114,7 @@ using namespace std;
 
   HOOKS_LIBRARIES "hooks-libraries"
   LIBRARY "library"
+  PARAMETERS "parameters"
 
   EXPIRED_LEASES_PROCESSING "expired-leases-processing"
 
@@ -593,7 +594,10 @@ hooks_params: hooks_param
             | hooks_params COMMA hooks_param
             ;
 
-hooks_param: LIBRARY {
+hooks_param: library
+           | parameters;
+
+library: LIBRARY {
     ctx.enter(ctx.NO_KEYWORD);
 } COLON STRING {
     ElementPtr lib(new StringElement($4, ctx.loc2pos(@4)));
@@ -601,6 +605,13 @@ hooks_param: LIBRARY {
     ctx.leave(); 
 };
 
+parameters: PARAMETERS {
+    ctx.enter(ctx.NO_KEYWORD);
+} COLON value {
+    ctx.stack_.back()->set("parameters", $4);
+    ctx.leave();
+}
+
 // --- expired-leases-processing ------------------------
 expired_leases_processing: EXPIRED_LEASES_PROCESSING {
     ElementPtr m(new MapElement(ctx.loc2pos(@1)));