aboutsummaryrefslogtreecommitdiff
path: root/python/DEV_GUIDE.md
diff options
context:
space:
mode:
authoraouinizied <aouinizied@gmail.com>2022-03-22 14:56:44 +0100
committeraouinizied <aouinizied@gmail.com>2022-03-22 14:56:44 +0100
commit1207ea118ac2cc1c045d94d572e69dcb2eae0ffb (patch)
tree9e84dac985cc99d850343caa6f0e7e4a3974b284 /python/DEV_GUIDE.md
parentc47d710d8e5281fff2f1f90ff5462c16ac91d50c (diff)
Add HOWTO Python.
Diffstat (limited to 'python/DEV_GUIDE.md')
-rw-r--r--python/DEV_GUIDE.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/python/DEV_GUIDE.md b/python/DEV_GUIDE.md
new file mode 100644
index 000000000..4003ca08e
--- /dev/null
+++ b/python/DEV_GUIDE.md
@@ -0,0 +1,29 @@
+# Python Bindings Development Guide
+
+The aim of this document is to guide when extending these bindings with additional nDPI API.
+In the following we suppose that we want to add the following API to ndpi python package.
+
+``` c
+int ndpi_des_init(struct ndpi_des_struct *des, double alpha, double beta, float significance);
+```
+
+## Add it to NDPI_APIS Python definition
+
+
+[**NDPI_APIS**][py_ndpi_api] must be updated with the this new API your want to add.
+
+
+## That's it!
+
+Now this API can be called and used on python side
+
+``` python
+from ndpi import, lib, ffi
+
+des = ffi.new("struct ndpi_des_struct *")
+alpha = 0.9
+beta = 0.5
+lib.ndpi_des_init(des, alpha, beta, 0.05)
+```
+
+[py_ndpi_api]: https://github.com/ntop/nDPI/blob/c47d710d8e5281fff2f1f90ff5462c16ac91d50c/python/ndpi/ndpi_build.py#L49 \ No newline at end of file