23 #define LY_ENABLED_CACHE 28 #define LY_ENABLED_LATEST_REVISIONS 33 #define LY_ENABLED_LYD_PRIV 38 #define _PACKED __attribute__((__packed__)) 49 #define LY_VERSION_MAJOR 1 50 #define LY_VERSION_MINOR 4 51 #define LY_VERSION_MICRO 1 52 #define LY_VERSION "1.4.1" 1128 #define LY_CTX_ALLIMPLEMENTED 0x01 1129 #define LY_CTX_TRUSTED 0x02 1132 #define LY_CTX_NOYANGLIBRARY 0x04 1138 #define LY_CTX_DISABLE_SEARCHDIRS 0x08 1142 #define LY_CTX_DISABLE_SEARCHDIR_CWD 0x10 1145 #define LY_CTX_PREFER_SEARCHDIRS 0x20 1169 struct ly_ctx *ly_ctx_new(const char *search_dir, int options); 1469 typedef const char *(*ly_module_imp_clb)(
const char *mod_name,
const char *mod_rev,
const char *submod_name,
const char *sub_rev,
1470 void *user_data,
LYS_INFORMAT *format, void (**free_module_data)(
void *model_data,
void *user_data));
1504 typedef const struct lys_module *(*ly_module_data_clb)(
struct ly_ctx *ctx,
const char *name,
const char *ns,
1505 int options,
void *user_data);
1508 #define LY_MODCLB_NOT_IMPLEMENTED 0x01 1529 #ifdef LY_ENABLED_LYD_PRIV 1564 const char *submodule,
const char *sub_revision);
1622 void (*private_destructor)(
const struct lys_node *node,
void *priv));
1718 #define LY_SET_OPT_USEASLIST 0x01 1821 #define LYP_WITHSIBLINGS 0x01 1822 #define LYP_FORMAT 0x02 1823 #define LYP_KEEPEMPTYCONT 0x04 1824 #define LYP_WD_MASK 0xF0 1825 #define LYP_WD_EXPLICIT 0x00 1827 #define LYP_WD_TRIM 0x10 1828 #define LYP_WD_ALL 0x20 1829 #define LYP_WD_ALL_TAG 0x40 1834 #define LYP_WD_IMPL_TAG 0x80 1838 #define LYP_NETCONF 0x100 1883 #define LY_LOLOG 0x01 1885 #define LY_LOSTORE 0x02 1887 #define LY_LOSTORE_LAST 0x06 1900 int ly_log_options(int opts); 1913 #define LY_LDGDICT 0x01 1914 #define LY_LDGYANG 0x02 1915 #define LY_LDGYIN 0x04 1916 #define LY_LDGXPATH 0x08 1917 #define LY_LDGDIFF 0x10 1918 #define LY_LDGAPI 0x20 1919 #define LY_LDGHASH 0x40 1929 void ly_verb_dbg(int dbg_groups); 2082 #define ly_errno (*ly_errno_glob_address())
Common structure representing single YANG data statement describing.
unsigned int ly_ctx_internal_modules_count(struct ly_ctx *ctx)
Number of internal modules, which are in the context and cannot be removed nor disabled.
int ly_set_merge(struct ly_set *trg, struct ly_set *src, int options)
Add all objects from src to trg.
void ly_ctx_unset_trusted(struct ly_ctx *ctx)
Reverse function to ly_ctx_set_trusted().
const char *const * ly_ctx_get_searchdirs(const struct ly_ctx *ctx)
Get the NULL-terminated list of the search paths in libyang context.
Submodule schema node structure that can be included into a YANG module.
const struct lys_node * ly_ctx_get_node(const struct ly_ctx *ctx, const struct lys_node *start, const char *data_path, int output)
Get schema node according to the given data path (JSON format, see XPath Addressing).
LY_VECODE
libyang's codes of validation error. Whenever ly_errno is set to LY_EVALID, the ly_vecode is also set...
LY_ERR
libyang's error codes available via ly_errno extern variable.
int ly_ctx_remove_module(const struct lys_module *module, void(*private_destructor)(const struct lys_node *node, void *priv))
Remove the specified module from its context.
void ly_ctx_set_module_data_clb(struct ly_ctx *ctx, ly_module_data_clb clb, void *user_data)
Set the missing data module callback. It will be called when some data is parsed or searched for and ...
int ly_set_rm_index(struct ly_set *set, unsigned int index)
Remove a lyd_node or lys_node object from the set index.
void ly_set_free(struct ly_set *set)
Free the ly_set data. Frees only the set structure content, not the referred data.
libyang representation of data model trees.
LY_LOG_LEVEL ly_verb(LY_LOG_LEVEL level)
Set logger verbosity level.
int ly_ctx_set_searchdir(struct ly_ctx *ctx, const char *search_dir)
Add the search path into libyang context.
struct ly_ctx * ly_ctx_new_ylmem(const char *search_dir, const char *data, LYD_FORMAT format, int options)
Create libyang context according to the content of the given yang-library data.
const char * ly_errpath(const struct ly_ctx *ctx)
Get the last (thread, context-specific) path of the element where was an error.
const struct lys_module * ly_ctx_get_module_iter(const struct ly_ctx *ctx, uint32_t *idx)
Iterate over all (enabled) modules in a context.
void(*)(LY_LOG_LEVEL, const char *, const char *) ly_get_log_clb(void)
Get logger callback.
struct ly_err_item * prev
const struct lys_module * ly_ctx_get_disabled_module_iter(const struct ly_ctx *ctx, uint32_t *idx)
Iterate over the disabled modules in a context.
void ly_ctx_unset_prefer_searchdirs(struct ly_ctx *ctx)
Reverse function to ly_ctx_set_prefer_searchdirs().
struct ly_set * ly_ctx_find_path(struct ly_ctx *ctx, const char *path)
Get schema node according to the given schema path (see XPath Addressing).
const struct lys_module * ly_ctx_get_module_by_ns(const struct ly_ctx *ctx, const char *ns, const char *revision, int implemented)
Get pointer to the schema tree of the module of the specified namespace.
libyang representation of data trees.
const struct lys_module *(* ly_module_data_clb)(struct ly_ctx *ctx, const char *name, const char *ns, int options, void *user_data)
Callback for retrieving missing modules in the context, for which some data was found.
const struct lys_module * ly_ctx_get_module(const struct ly_ctx *ctx, const char *name, const char *revision, int implemented)
Get pointer to the schema tree of the module of the specified name.
int ly_ctx_get_options(struct ly_ctx *ctx)
Get the currently set context's options.
LYD_FORMAT
Data input/output formats supported by libyang parser and printer functions.
struct ly_set * ly_set_dup(const struct ly_set *set)
Duplicate the existing set.
Structure to hold a set of (not necessary somehow connected) lyd_node or lys_node objects....
const struct lys_submodule * ly_ctx_get_submodule(const struct ly_ctx *ctx, const char *module, const char *revision, const char *submodule, const char *sub_revision)
Get submodule of a main module.
int ly_set_rm(struct ly_set *set, void *node)
Remove a lyd_node or lys_node object from the set.
Libyang full error structure.
void ly_ctx_unset_allimplemented(struct ly_ctx *ctx)
Reverse function to ly_ctx_set_allimplemented().
struct ly_err_item * ly_err_first(const struct ly_ctx *ctx)
Get the first (thread, context-specific) generated error structure.
Public API of libyang XML parser.
void ly_ctx_unset_disable_searchdir_cwd(struct ly_ctx *ctx)
Reverse function to ly_ctx_set_disable_searchdir_cwd().
const char * ly_errapptag(const struct ly_ctx *ctx)
Get the last (thread, context-specific) error-app-tag if there was a specific one defined in the modu...
Structure describing an element in an XML tree.
void ly_err_print(struct ly_err_item *eitem)
Print the error structure as if just generated.
LYS_INFORMAT
Schema input formats accepted by libyang parser functions.
void ly_ctx_set_module_imp_clb(struct ly_ctx *ctx, ly_module_imp_clb clb, void *user_data)
Set missing include or import module callback. It is meant to be used when the models are not locally...
void ly_ctx_set_disable_searchdir_cwd(struct ly_ctx *ctx)
Make context to stop implicitly searching for schemas (imported, included or requested via ly_ctx_loa...
int ly_set_clean(struct ly_set *set)
Remove all objects from the set, but keep the set container for further use.
void ly_set_log_clb(void(*clb)(LY_LOG_LEVEL level, const char *msg, const char *path), int path)
Set logger callback.
void ly_ctx_destroy(struct ly_ctx *ctx, void(*private_destructor)(const struct lys_node *node, void *priv))
Free all internal structures of the specified context.
struct ly_err_item * next
Main schema node structure representing YANG module.
void ly_ctx_set_trusted(struct ly_ctx *ctx)
Change the schema parser behavior when parsing new schemas forcing it to skip some of the schema vali...
int ly_set_contains(const struct ly_set *set, void *node)
Get know if the set contains the specified object.
void ly_ctx_set_priv_dup_clb(struct ly_ctx *ctx, void *(*priv_dup_clb)(const void *priv))
LY_LOG_LEVEL
Verbosity levels of the libyang logger.
struct ly_ctx * ly_ctx_new_ylpath(const char *search_dir, const char *path, LYD_FORMAT format, int options)
Create libyang context according to the content of the given yang-library data.
ly_module_imp_clb ly_ctx_get_module_imp_clb(const struct ly_ctx *ctx, void **user_data)
Get the custom callback for missing import/include module retrieval.
void ly_ctx_unset_searchdirs(struct ly_ctx *ctx, int index)
Clean the search path(s) from the libyang context.
char * ly_path_xml2json(struct ly_ctx *ctx, const char *xml_path, struct lyxml_elem *xml)
Transform a data path in XML format (node prefixes are XML namespace prefixes of module namespaces) t...
void ly_err_clean(struct ly_ctx *ctx, struct ly_err_item *eitem)
Free error structures from a context.
const char *(* ly_module_imp_clb)(const char *mod_name, const char *mod_rev, const char *submod_name, const char *sub_rev, void *user_data, LYS_INFORMAT *format, void(**free_module_data)(void *model_data, void *user_data))
Callback for retrieving missing included or imported models in a custom way.
const struct lys_module * ly_ctx_get_module_older(const struct ly_ctx *ctx, const struct lys_module *module)
Get pointer to the older schema tree to the specified one in the provided context.
Generic structure for a data node, directly applicable to the data nodes defined as LYS_CONTAINER,...
int ly_set_add(struct ly_set *set, void *node, int options)
Add a lyd_node or lys_node object into the set.
ly_module_data_clb ly_ctx_get_module_data_clb(const struct ly_ctx *ctx, void **user_data)
Get the missing data module calback.
LY_VECODE ly_vecode(const struct ly_ctx *ctx)
Get the last (thread, context-specific) validation error code.
struct ly_set * ly_set_new(void)
Create and initiate new ly_set structure.
const struct lys_module * ly_ctx_load_module(struct ly_ctx *ctx, const char *name, const char *revision)
Try to find the model in the searchpath of ctx and load it into it. If custom missing module callback...
const char * ly_errmsg(const struct ly_ctx *ctx)
Get the last (thread, context-specific) error message. If the corresponding module defined a specific...
char * ly_path_data2schema(struct ly_ctx *ctx, const char *data_path)
Transform a data path into schema path (see XPath Addressing).
void ly_ctx_set_allimplemented(struct ly_ctx *ctx)
Make context to set all the imported modules to be implemented. By default, if the imported module is...
const struct lys_submodule * ly_ctx_get_submodule2(const struct lys_module *main_module, const char *submodule)
Get submodule of a main module.
void ly_ctx_set_disable_searchdirs(struct ly_ctx *ctx)
Make context to stop searching for schemas (imported, included or requested via ly_ctx_load_module())...
void ly_ctx_set_prefer_searchdirs(struct ly_ctx *ctx)
Prefer context's searchdirs before the user callback (ly_module_imp_clb) provided via ly_ctx_set_modu...
set array of ly_set It is kept in union to keep ly_set generic for data as well as schema trees
void ly_ctx_clean(struct ly_ctx *ctx, void(*private_destructor)(const struct lys_node *node, void *priv))
Remove all the modules from the context except the internal modules. Also the addition data in dictio...
uint16_t ly_ctx_get_module_set_id(const struct ly_ctx *ctx)
Get current ID of the modules set. The value is available also as module-set-id in ly_ctx_info() resu...
struct lyd_node * ly_ctx_info(struct ly_ctx *ctx)
Get data of an internal ietf-yang-library module.
void ly_ctx_unset_disable_searchdirs(struct ly_ctx *ctx)
Reverse function to ly_ctx_set_disable_searchdirs().