summaryrefslogtreecommitdiff
path: root/lib/yang.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yang.h')
-rw-r--r--lib/yang.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/yang.h b/lib/yang.h
index 126521707b..85ef0d758c 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -107,6 +107,9 @@ enum yang_iter_flags {
/* Callback used by the yang_snodes_iterate_*() family of functions. */
typedef int (*yang_iterate_cb)(const struct lys_node *snode, void *arg);
+/* Callback used by the yang_dnode_iterate() function. */
+typedef int (*yang_dnode_iter_cb)(const struct lyd_node *dnode, void *arg);
+
/* Return values of the 'yang_iterate_cb' callback. */
#define YANG_ITER_CONTINUE 0
#define YANG_ITER_STOP -1
@@ -358,6 +361,25 @@ extern bool yang_dnode_exists(const struct lyd_node *dnode,
const char *xpath_fmt, ...);
/*
+ * Iterate over all libyang data nodes that satisfy an XPath query.
+ *
+ * cb
+ * Function to call with each data node.
+ *
+ * arg
+ * Arbitrary argument passed as the second parameter in each call to 'cb'.
+ *
+ * dnode
+ * Base libyang data node to operate on.
+ *
+ * xpath_fmt
+ * XPath expression (absolute or relative).
+ */
+void yang_dnode_iterate(yang_dnode_iter_cb cb, void *arg,
+ const struct lyd_node *dnode, const char *xpath_fmt,
+ ...);
+
+/*
* Check if the libyang data node contains a default value. Non-presence
* containers are assumed to always contain a default value.
*
@@ -497,6 +519,24 @@ extern struct ly_ctx *yang_ctx_new_setup(bool embedded_modules);
extern void yang_debugging_set(bool enable);
/*
+ * Print libyang error messages into the provided buffer.
+ *
+ * ly_ctx
+ * libyang context to operate on.
+ *
+ * buf
+ * Buffer to store the libyang error messages.
+ *
+ * buf_len
+ * Size of buf.
+ *
+ * Returns:
+ * The provided buffer.
+ */
+extern const char *yang_print_errors(struct ly_ctx *ly_ctx, char *buf,
+ size_t buf_len);
+
+/*
* Initialize the YANG subsystem. Should be called only once during the
* daemon initialization process.
*