]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[fdxhook] Added EXAMPLES file to explain how examples are organized
authorFrancis Dupont <fdupont@isc.org>
Tue, 21 Jun 2016 15:19:21 +0000 (17:19 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 21 Jun 2016 15:19:21 +0000 (17:19 +0200)
src/hooks/external/EXAMPLES [new file with mode: 0644]
src/hooks/external/NOTES

diff --git a/src/hooks/external/EXAMPLES b/src/hooks/external/EXAMPLES
new file mode 100644 (file)
index 0000000..e51d578
--- /dev/null
@@ -0,0 +1,52 @@
+The 3 (python, ocaml and lua) examples are organized the same way:
+
+ - a dynamic shared object (hook library in Kea terms) with:
+  * C++ -> embedded language initialization using parameters
+   for the program name (python and ocaml) and the script
+   (python and lua)
+
+  * glue for the pkt4_receive hook
+
+  * method/functions to deal with a DHCP option
+
+  * method/functions to deal with a DHCPv4 packet with toText
+   (tp_str in python and __tostring in lua)
+
+ - a script written in the external language with a pkt4 -> int
+  pkt4_receive function which prints its argument using toText.
+  Note in ocaml the sompiled script (in bytecode or native code)
+  is embedded into the dynamic shared object.
+
+ - a tests tool which loads a config with a hook-libraires entry,
+  build a DHCPv4 packet and call the pkt4_receive callout.
+
+So in running order you have:
+
+kea server (simulated by tests)
+|
+V
+the DSO is loaded and dynamically linked
+|
+V
+the DSO "load" entry point is called
+|
+V
+embedded language interpreter is initialized
+(option and pkt4 modules are loaded)
+|
+V
+the script is loaded (pkt4_receive function is defined)
+|
+V
+control comes back to the kea server
+|
+V
+C++ pkt4_receive callout is called
+|
+V
+embedded language pkt4_receive function is called
+(query4 argument is printed)
+|
+V
+0 (next step continue) is returned
+(here the tests tool exits)
index 9020d1705b97cce5a6eb23622f9acf4328c0304c..924496d8755142dbdcecc458d623067c1f2cec03 100644 (file)
@@ -1,5 +1,7 @@
 Kea hooks in external (i.e., not C++) languages.
 
+(written before the implementation work so at the beginning of the design)
+
 Asked for customers: hooks written in python (done), lua, ocaml (done), ...
 
 Kea hook summary: