summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-02-25 15:48:52 -0600
committerJohn Estabrook <jestabro@vyos.io>2022-04-20 18:09:33 -0500
commitc8f8449c7c697523ef0214a57ac97fcb959f7c1c (patch)
tree1d87d9a56a2d70cc033585023bd6cae5f1cb6be3
parentb785b6302a199b7e03609b95279d2bf428b8338d (diff)
downloadlibvyosconfig-c8f8449c7c697523ef0214a57ac97fcb959f7c1c.tar.gz
libvyosconfig-c8f8449c7c697523ef0214a57ac97fcb959f7c1c.zip
T4235: binding for get_subtree
(cherry picked from commit eda420ac7213bdc62f0ee1fa7ee8674418d350ac)
-rw-r--r--lib/bindings.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/bindings.ml b/lib/bindings.ml
index 484a5d7..155162c 100644
--- a/lib/bindings.ml
+++ b/lib/bindings.ml
@@ -116,6 +116,12 @@ let is_tag c_ptr path =
let path = split_on_whitespace path in
if (CT.is_tag ct path) then 1 else 0
+let get_subtree c_ptr path with_node =
+ let ct = Root.get c_ptr in
+ let path = split_on_whitespace path in
+ let subt = CT.get_subtree ~with_node:with_node ct path in
+ Ctypes.Root.create subt
+
let exists c_ptr path =
let ct = Root.get c_ptr in
let path = split_on_whitespace path in
@@ -194,6 +200,7 @@ struct
let () = I.internal "copy_node" ((ptr void) @-> string @-> string @-> returning int) copy_node
let () = I.internal "set_tag" ((ptr void) @-> string @-> returning int) set_tag
let () = I.internal "is_tag" ((ptr void) @-> string @-> returning int) is_tag
+ let () = I.internal "get_subtree" ((ptr void) @-> string @-> bool @-> returning (ptr void)) get_subtree
let () = I.internal "exists" ((ptr void) @-> string @-> returning int) exists
let () = I.internal "list_nodes" ((ptr void) @-> string @-> returning string) list_nodes
let () = I.internal "return_value" ((ptr void) @-> string @-> returning string) return_value