diff options
| author | Christian Hopps <chopps@labn.net> | 2023-07-09 05:51:20 -0400 |
|---|---|---|
| committer | Christian Hopps <chopps@labn.net> | 2023-12-26 08:34:56 -0500 |
| commit | 80cac370d065d4275da9a8e8d776735bebd4483e (patch) | |
| tree | abc4e8bc845536532bb7cdb10e991c40c0da60ef /lib/yang.h | |
| parent | 8790457c463476a4ecec0edff07482f707b84fc2 (diff) | |
lib: yang: add tree "printing" utility functions
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/yang.h')
| -rw-r--r-- | lib/yang.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/yang.h b/lib/yang.h index 37369c09bf..9ddc76a16a 100644 --- a/lib/yang.h +++ b/lib/yang.h @@ -600,6 +600,39 @@ extern struct ly_ctx *yang_ctx_new_setup(bool embedded_modules, */ extern void yang_debugging_set(bool enable); + +/* + * "Print" the yang tree in `root` into dynamic sized array. + * + * Args: + * root: root of the subtree to "print" along with siblings. + * format: LYD_FORMAT of output (see lyd_print_mem) + * options: printing options (see lyd_print_mem) + * + * Return: + * A darr dynamic array with the "printed" output or NULL on failure. + */ +extern uint8_t *yang_print_tree(const struct lyd_node *root, LYD_FORMAT format, + uint32_t options); + +/* + * "Print" the yang tree in `root` into an existing dynamic sized array. + * + * This function does not initialize or free the dynamic array, the array can + * already existing data, the tree will be appended to this data. + * + * Args: + * darr: existing `uint8_t *`, dynamic array. + * root: root of the subtree to "print" along with siblings. + * format: LYD_FORMAT of output (see lyd_print_mem) + * options: printing options (see lyd_print_mem) + * + * Return: + * LY_ERR from underlying calls. + */ +extern LY_ERR yang_print_tree_append(uint8_t **darr, const struct lyd_node *root, + LYD_FORMAT format, uint32_t options); + /* * Print libyang error messages into the provided buffer. * |
