summaryrefslogtreecommitdiff
path: root/lib/yang.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-11-24 21:56:48 -0200
committerRenato Westphal <renato@opensourcerouting.org>2018-11-26 15:52:12 -0200
commit3f662078965405c6363dcecc2cc43c658c108229 (patch)
tree427c43caa58530c2f2e09a88000ec8a7a4d6912c /lib/yang.h
parenta7d055e4ff4d476814c8b2ee56691ed5e853b6bd (diff)
lib: introduce function to retrieve the schema name of a data node
In some cases it might be desirable to obtain the schema name of a libyang data node. Introduce the yang_dnode_get_schema_name() function for this purpose. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/yang.h')
-rw-r--r--lib/yang.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/yang.h b/lib/yang.h
index b0348e320b..eac9796df9 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -285,6 +285,22 @@ extern void yang_dnode_get_path(const struct lyd_node *dnode, char *xpath,
size_t xpath_len);
/*
+ * Return the schema name of the given libyang data node.
+ *
+ * dnode
+ * libyang data node.
+ *
+ * xpath_fmt
+ * Optional XPath expression (absolute or relative) to specify a different
+ * data node to operate on in the same data tree.
+ *
+ * Returns:
+ * Schema name of the libyang data node.
+ */
+extern const char *yang_dnode_get_schema_name(const struct lyd_node *dnode,
+ const char *xpath_fmt, ...);
+
+/*
* Find a libyang data node by its YANG data path.
*
* dnode