Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 1 | /** |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 2 | * @file libyang.h |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 3 | * @author Radek Krejci <rkrejci@cesnet.cz> |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 4 | * @brief The main libyang public header. |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 5 | * |
| 6 | * Copyright (c) 2015 CESNET, z.s.p.o. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in |
| 15 | * the documentation and/or other materials provided with the |
| 16 | * distribution. |
| 17 | * 3. Neither the name of the Company nor the names of its contributors |
| 18 | * may be used to endorse or promote products derived from this |
| 19 | * software without specific prior written permission. |
| 20 | */ |
| 21 | |
| 22 | #ifndef LY_LIBYANG_H_ |
| 23 | #define LY_LIBYANG_H_ |
| 24 | |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 25 | #include <stdio.h> |
| 26 | |
Michal Vasko | 2d162e1 | 2015-09-24 14:33:29 +0200 | [diff] [blame] | 27 | #include "tree_schema.h" |
| 28 | #include "tree_data.h" |
Radek Krejci | c6704c8 | 2015-10-06 11:12:45 +0200 | [diff] [blame] | 29 | #include "xml.h" |
Radek Krejci | 41912fe | 2015-10-22 10:22:12 +0200 | [diff] [blame] | 30 | #include "dict.h" |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 31 | |
Radek Krejci | 39d8d0d | 2015-08-17 13:42:45 +0200 | [diff] [blame] | 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 36 | /** |
| 37 | * @page howto How To ... |
| 38 | * |
| 39 | * - @subpage howtocontext |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 40 | * - @subpage howtoschemas |
| 41 | * - @subpage howtodata |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 42 | * - @subpage howtologger |
| 43 | */ |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 44 | |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 45 | /** @page howtocontext Context |
| 46 | * |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 47 | * The context concept allows callers to work in environments with different sets of YANG schemas. |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 48 | * |
| 49 | * The first step in libyang is to create a new context using ly_ctx_new(). It returns a handler |
| 50 | * used in the following work. |
| 51 | * |
| 52 | * When creating a new context, search dir can be specified (NULL is accepted) to provide directory |
| 53 | * where libyang will automatically search for schemas being imported or included. The search path |
| 54 | * can be later changed via ly_ctx_set_searchdir() function. Before exploring the specified search |
| 55 | * dir, libyang tries to get imported and included schemas from the current working directory first. |
| 56 | * |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 57 | * Schemas are added into the context using [parser functions](@ref parsers) - lys_parse() or lys_read(). |
| 58 | * Note, that parser functions for schemas have \b lys_ prefix while instance data parser functions have |
| 59 | * \b lyd_ prefix. |
| 60 | * |
Radek Krejci | f647e61 | 2015-07-30 11:36:07 +0200 | [diff] [blame] | 61 | * Context can hold multiple revisons of the same schema. |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 62 | * |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 63 | * Context holds all modules and their submodules internally. The list of available module names is |
| 64 | * provided via ly_ctx_get_module_names() functions. Similarly, caller can get also a list of submodules |
| 65 | * names of a specific module using ly_ctx_get_submodule_names() function. The returned names can be |
| 66 | * subsequently used to get the (sub)module structures using ly_ctx_get_module() and ly_ctx_get_submodule(). |
| 67 | * |
| 68 | * Modules held by a context cannot be removed one after one. The only way how to \em change modules in the |
| 69 | * context is to create a new context and remove the old one. To remove a context, there is ly_ctx_destroy() |
| 70 | * function. |
| 71 | * |
| 72 | * \note API for this group of functions is available in the [context module](@ref context). |
| 73 | * |
| 74 | */ |
| 75 | |
| 76 | /** |
| 77 | * @page howtoschemas Schemas |
| 78 | * |
| 79 | * Schema is an internal libyang's representation of a YANG data model. Each schema is connected with |
| 80 | * its [context](@ref howtocontext) and loaded using [parser functions](@ref parsers). It means, that |
| 81 | * the schema cannot be created (nor changed) programatically. In libyang, schemas are used only to |
| 82 | * access data model definitions. |
| 83 | * |
| 84 | * \note There are many functions to access information from the schema trees. Details are available in |
| 85 | * the [Schema Tree module](@ref schematree). |
| 86 | * |
| 87 | * YANG Features Manipulation |
| 88 | * -------------------------- |
| 89 | * |
| 90 | * The group of functions prefixed by \b lys_features_ are used to access and manipulate with the schema's |
| 91 | * features. |
| 92 | * |
| 93 | * The first two functions are used to access information about the features in the schema. |
| 94 | * lys_features_list() provides list of all features defined in the specific schema and its |
| 95 | * submodules. Optionally, it can also provides information about the state of all features. |
| 96 | * Alternatively, caller can use lys_features_state() function to get state of one specific |
| 97 | * feature. |
| 98 | * |
| 99 | * The remaining two functions, lys_features_enable() and lys_features_disable(), are used |
| 100 | * to enable and disable the specific feature. By default, when the module is loaded by libyang |
| 101 | * parser, all features are disabled. |
| 102 | * |
| 103 | * Note, that feature's state can affect some of the output formats (e.g. Tree format). |
| 104 | * |
| 105 | */ |
| 106 | |
| 107 | /** |
| 108 | * @page howtodata Data Instances |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 109 | * |
| 110 | */ |
Radek Krejci | 94ca54b | 2015-07-08 15:48:47 +0200 | [diff] [blame] | 111 | |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 112 | /** |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 113 | * |
| 114 | * @page howtologger Logger |
| 115 | * |
| 116 | * There are 4 verbosity levels defined as ::LY_LOG_LEVEL. The level can be |
| 117 | * changed by the ly_verb() function. By default, the verbosity level is |
| 118 | * set to #LY_LLERR value. |
| 119 | * |
| 120 | * In case the logger has an error message (LY_LLERR) to print, also an error |
| 121 | * code is recorded in extern ly_errno variable. Possible values are of type |
| 122 | * ::LY_ERR. |
| 123 | * |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 124 | * \note API for this group of functions is available in the [logger module](@ref logger). |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 125 | */ |
| 126 | |
| 127 | /** |
| 128 | * @defgroup context Context |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 129 | * @{ |
| 130 | * |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 131 | * Structures and functions to manipulate with the libyang "containers". The \em context concept allows callers |
| 132 | * to work in environments with different sets of YANG schemas. More detailed information can be found at |
| 133 | * @ref howtocontext page. |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 134 | */ |
| 135 | |
| 136 | /** |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 137 | * @brief libyang context handler. |
| 138 | */ |
| 139 | struct ly_ctx; |
| 140 | |
| 141 | /** |
| 142 | * @brief Create libyang context |
| 143 | * |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 144 | * Context is used to hold all information about schemas. Usually, the application is supposed |
Radek Krejci | 91b833c | 2015-09-04 11:49:43 +0200 | [diff] [blame] | 145 | * to work with a single context in which libyang is holding all schemas (and other internal |
| 146 | * information) according to which the data trees will be processed and validated. So, the schema |
| 147 | * trees are tightly connected with the specific context and they are held by the context internally |
| 148 | * - caller does not need to keep pointers to the schemas returned by lys_parse(), context knows |
| 149 | * about them. The data trees created with lyd_parse() are still connected with the specific context, |
| 150 | * but they are not internally held by the context. The data tree just points and lean on some data |
| 151 | * held by the context (schema tree, string dictionary, etc.). Therefore, in case of data trees, caller |
| 152 | * is supposed to keep pointers returned by the lyd_parse() and manage the data tree on its own. This |
| 153 | * also affects the number of instances of both tree types. While you can have only one instance of |
| 154 | * specific schema connected with a single context, number of data tree instances is not connected. |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 155 | * |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 156 | * @param[in] search_dir Directory where libyang will search for the imported or included modules |
| 157 | * and submodules. If no such directory is available, NULL is accepted. |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 158 | * |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 159 | * @return Pointer to the created libyang context, NULL in case of error. |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 160 | */ |
| 161 | struct ly_ctx *ly_ctx_new(const char *search_dir); |
| 162 | |
| 163 | /** |
Michal Vasko | 60ba9a6 | 2015-07-03 14:42:31 +0200 | [diff] [blame] | 164 | * @brief Change the search path in libyang context |
| 165 | * |
| 166 | * @param[in] ctx Context to be modified. |
| 167 | * @param[in] search_dir New search path to replace the current one in ctx. |
| 168 | */ |
| 169 | void ly_ctx_set_searchdir(struct ly_ctx *ctx, const char *search_dir); |
| 170 | |
| 171 | /** |
Radek Krejci | 5a79757 | 2015-10-21 15:45:45 +0200 | [diff] [blame] | 172 | * @brief Get current value of the search path in libyang context |
| 173 | * |
| 174 | * @param[in] ctx Context to query. |
| 175 | * @return Current value of the search path. |
| 176 | */ |
| 177 | const char *ly_ctx_get_searchdir(struct ly_ctx *ctx); |
| 178 | |
| 179 | /** |
Radek Krejci | 7ab2515 | 2015-08-07 14:48:45 +0200 | [diff] [blame] | 180 | * @brief Get data of an internal ietf-yang-library module. |
| 181 | * |
| 182 | * @param[in] ctx Context with the modules. |
| 183 | * @return Root data node corresponding to the model, NULL on error. |
| 184 | * Caller is responsible for freeing the returned data tree using lyd_free(). |
| 185 | */ |
| 186 | struct lyd_node *ly_ctx_info(struct ly_ctx *ctx); |
| 187 | |
| 188 | /** |
Radek Krejci | 96a10da | 2015-07-30 11:00:14 +0200 | [diff] [blame] | 189 | * @brief Get the names of the loaded modules. |
| 190 | * |
| 191 | * @param[in] ctx Context with the modules. |
| 192 | * @return NULL-terminated array of the module names, |
| 193 | * NULL on error. The returned array must be freed by the caller, do not free |
| 194 | * names in the array. Also remember that the names will be freed with freeing |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 195 | * the context. |
Radek Krejci | 96a10da | 2015-07-30 11:00:14 +0200 | [diff] [blame] | 196 | */ |
| 197 | const char **ly_ctx_get_module_names(struct ly_ctx *ctx); |
| 198 | |
| 199 | /** |
| 200 | * @brief Get the names of the loaded submodules of the specified module. |
| 201 | * |
| 202 | * @param[in] ctx Context with the modules. |
| 203 | * @param[in] module_name Name of the parent module. |
| 204 | * @return NULL-terminated array of submodule names of the parent module, |
| 205 | * NULL on error. The returned array must be freed by the caller, do not free |
| 206 | * names in the array. Also remember that the names will be freed with freeing |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 207 | * the context. |
Radek Krejci | 96a10da | 2015-07-30 11:00:14 +0200 | [diff] [blame] | 208 | */ |
| 209 | const char **ly_ctx_get_submodule_names(struct ly_ctx *ctx, const char *module_name); |
| 210 | |
| 211 | /** |
Radek Krejci | fd4e6e3 | 2015-08-10 15:00:51 +0200 | [diff] [blame] | 212 | * @brief Get pointer to the schema tree of the module of the specified name. |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 213 | * |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 214 | * @param[in] ctx Context to work in. |
| 215 | * @param[in] name Name of the YANG module to get. |
Radek Krejci | f647e61 | 2015-07-30 11:36:07 +0200 | [diff] [blame] | 216 | * @param[in] revision Optional revision date of the YANG module to get. If not specified, |
| 217 | * the schema in the newest revision is returned if any. |
| 218 | * @return Pointer to the data model structure, NULL if no schema following the name and |
Radek Krejci | fd4e6e3 | 2015-08-10 15:00:51 +0200 | [diff] [blame] | 219 | * revision requirements is present in the context. |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 220 | */ |
Radek Krejci | b804869 | 2015-08-05 13:36:34 +0200 | [diff] [blame] | 221 | struct lys_module *ly_ctx_get_module(struct ly_ctx *ctx, const char *name, const char *revision); |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 222 | |
| 223 | /** |
Michal Vasko | 8246596 | 2015-11-10 11:03:11 +0100 | [diff] [blame] | 224 | * @brief Try to find the model in a specific directory and then the searchpath |
| 225 | * and load it into context. |
| 226 | * |
| 227 | * @param[in] ctx Context to add to. |
| 228 | * @param[in] dir Optional directory to search in first. |
| 229 | * @param[in] name Name of the module to load. |
| 230 | * @param[in] revision Optional revision date of the module. If not specified, it is |
| 231 | * assumed that there is only one model revision in the searchpath (the first matching file |
| 232 | * is parsed). |
| 233 | * @return Pointer to the data model structure, NULL if not found or some error occured. |
| 234 | */ |
| 235 | struct lys_module *ly_ctx_load_module(struct ly_ctx *ctx, const char *dir, const char *name, const char *revision); |
| 236 | |
| 237 | /** |
Radek Krejci | fd4e6e3 | 2015-08-10 15:00:51 +0200 | [diff] [blame] | 238 | * @brief Get pointer to the schema tree of the module of the specified namespace |
| 239 | * |
| 240 | * @param[in] ctx Context to work in. |
| 241 | * @param[in] ns Namespace of the YANG module to get. |
| 242 | * @param[in] revision Optional revision date of the YANG module to get. If not specified, |
| 243 | * the schema in the newest revision is returned if any. |
| 244 | * @return Pointer to the data model structure, NULL if no schema following the namespace and |
| 245 | * revision requirements is present in the context. |
| 246 | */ |
| 247 | struct lys_module *ly_ctx_get_module_by_ns(struct ly_ctx *ctx, const char *ns, const char *revision); |
| 248 | |
| 249 | /** |
Michal Vasko | 7bf0688 | 2015-07-03 15:33:56 +0200 | [diff] [blame] | 250 | * @brief Get submodule from the context's search dir. |
| 251 | * |
| 252 | * @param[in] module Parent (belongs-to) module. |
| 253 | * @param[in] name Name of the YANG submodule to get. |
| 254 | * @param[in] revision Optional revision date of the YANG submodule to get. If |
| 255 | * not specified, the newest revision is returned (TODO). |
Michal Vasko | 7bf0688 | 2015-07-03 15:33:56 +0200 | [diff] [blame] | 256 | * @return Pointer to the data model structure. |
| 257 | */ |
Radek Krejci | b804869 | 2015-08-05 13:36:34 +0200 | [diff] [blame] | 258 | struct lys_submodule *ly_ctx_get_submodule(struct lys_module *module, const char *name, const char *revision); |
Michal Vasko | 7bf0688 | 2015-07-03 15:33:56 +0200 | [diff] [blame] | 259 | |
| 260 | /** |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 261 | * @brief Get schema node according to the given absolute schema node identifier. |
| 262 | * |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 263 | * @param[in] ctx Context to work in. |
| 264 | * @param[in] nodeid Absolute schema node identifier with module names used as |
| 265 | * prefixes. Prefix (module name) must be used whenever the child node is from |
| 266 | * other module (augments the parent node). The first node in the path must be |
| 267 | * always specified with the prefix. Here are some examples: |
| 268 | * |
| 269 | * - /ietf-netconf-monitoring:get-schema/input/identifier |
| 270 | * - /ietf-interfaces:interfaces/interface/ietf-ip:ipv4/address/ip |
| 271 | */ |
Michal Vasko | f7a03dc | 2015-10-22 16:09:06 +0200 | [diff] [blame] | 272 | struct lys_node *ly_ctx_get_node(struct ly_ctx *ctx, const char *nodeid); |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 273 | |
| 274 | /** |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 275 | * @brief Free all internal structures of the specified context. |
| 276 | * |
| 277 | * The function should be used before terminating the application to destroy |
| 278 | * and free all structures internally used by libyang. If the caller uses |
| 279 | * multiple contexts, the function should be called for each used context. |
| 280 | * |
| 281 | * All instance data are supposed to be freed before destroying the context. |
| 282 | * Data models are destroyed automatically as part of ly_ctx_destroy() call. |
| 283 | * |
| 284 | * @param[in] ctx libyang context to destroy |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 285 | */ |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 286 | void ly_ctx_destroy(struct ly_ctx *ctx); |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 287 | |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 288 | /**@} context */ |
| 289 | |
| 290 | /** |
| 291 | * @defgroup parsers Parsers |
| 292 | * @{ |
| 293 | * |
| 294 | * Parsers allows to read schema and data trees from a specific format. |
| 295 | * |
| 296 | * For schemas, the following formats are supported: |
| 297 | * - YANG |
| 298 | * |
| 299 | * Basic YANG schemas format described in [RFC 6020](http://tools.ietf.org/html/rfc6020). |
| 300 | * Currently, only YANG 1.0 is supported. |
| 301 | * |
| 302 | * \todo YANG input is not yet implemented |
| 303 | * |
| 304 | * - YIN |
| 305 | * |
| 306 | * Alternative XML-based format to YANG. The details can be found in |
| 307 | * [RFC 6020](http://tools.ietf.org/html/rfc6020#section-11). |
| 308 | * |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 309 | * For data instances, the following formats are supported: |
| 310 | * - \todo TBD |
| 311 | * |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 312 | */ |
| 313 | |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 314 | /** |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 315 | * @brief Load a schema into the specified context. |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 316 | * |
Radek Krejci | b20c62d | 2015-07-07 17:07:14 +0200 | [diff] [blame] | 317 | * LY_IN_YANG (YANG) format is not yet supported. |
| 318 | * |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 319 | * @param[in] ctx libyang context where to process the data model. |
| 320 | * @param[in] data The string containing the dumped data model in the specified |
Michal Vasko | d8aa32d | 2015-07-24 11:50:01 +0200 | [diff] [blame] | 321 | * format. |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 322 | * @param[in] format Format of the input data (YANG or YIN). |
| 323 | * @return Pointer to the data model structure or NULL on error. |
| 324 | */ |
Radek Krejci | b804869 | 2015-08-05 13:36:34 +0200 | [diff] [blame] | 325 | struct lys_module *lys_parse(struct ly_ctx *ctx, const char *data, LYS_INFORMAT format); |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 326 | |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 327 | /** |
| 328 | * @brief Read a schema from file into the specified context. |
| 329 | * |
| 330 | * LY_IN_YANG (YANG) format is not yet supported. |
| 331 | * |
| 332 | * \note Current implementation supports only reading data from standard (disk) file, not from sockets, pipes, etc. |
| 333 | * |
| 334 | * @param[in] ctx libyang context where to process the data model. |
Radek Krejci | 4910e24 | 2015-11-30 10:40:45 +0100 | [diff] [blame^] | 335 | * @param[in] fd File descriptor of a regular file (e.g. sockets are not supported) containing the schema |
| 336 | * in the specified format. |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 337 | * @param[in] format Format of the input data (YANG or YIN). |
| 338 | * @return Pointer to the data model structure or NULL on error. |
| 339 | */ |
Radek Krejci | b804869 | 2015-08-05 13:36:34 +0200 | [diff] [blame] | 340 | struct lys_module *lys_read(struct ly_ctx *ctx, int fd, LYS_INFORMAT format); |
Radek Krejci | da04f4a | 2015-05-21 12:54:09 +0200 | [diff] [blame] | 341 | |
| 342 | /** |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 343 | * @defgroup parseroptions Data parser options |
| 344 | * @ingroup parsers |
| 345 | * |
| 346 | * Various options to change the data tree parsers behavior. |
| 347 | * |
| 348 | * By default, parser silently ignores the data without a matching node in schema trees. If the caller want to stop |
| 349 | * parsing in case of presence of unknown data, the #LYD_OPT_STRICT can be used. The strict mode is useful for |
| 350 | * NETCONF servers, since NETCONF clients should always send data according to the capabilities announced by the server. |
| 351 | * On the other hand, the default non-strict mode is useful for clients receiving data from NETCONF server since |
| 352 | * clients are not required to understand everything the server does. Of course, the optimal strategy is to use |
| 353 | * filtering to get only the required data. |
| 354 | * |
Radek Krejci | 20cdf63 | 2015-11-09 14:44:58 +0100 | [diff] [blame] | 355 | * The #LYD_OPT_DESTRUCT option is used to optimize memory consumption profile of the parser in case the input |
| 356 | * data are no more needed after the parser function call. It continuously free the input data whenever it is |
| 357 | * processed for the output. This option is applicable only in case the input data are in the XML tree format. |
| 358 | * |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 359 | * Parser also expects that the provided data are complete and performs data validation according to all |
Radek Krejci | 20cdf63 | 2015-11-09 14:44:58 +0100 | [diff] [blame] | 360 | * implemented YANG rules. This can be problem in case of representing NETCONF's subtree filter data, |
| 361 | * edit-config's data or the received data (after get or get-config request) where a filter was applied - such data |
| 362 | * do not represent a complete data set and different validation rules can fail. Therefore there are other options |
| 363 | * to make parser to accept such a data. |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 364 | * |
| 365 | * @{ |
| 366 | */ |
Radek Krejci | 20cdf63 | 2015-11-09 14:44:58 +0100 | [diff] [blame] | 367 | #define LYD_OPT_STRICT 0x01 /**< instead of silent ignoring data without schema definition, raise an error. |
| 368 | Having an unknown element of the known namespace is always an error. */ |
| 369 | #define LYD_OPT_DESTRUCT 0x02 /**< safe consumed memory and free the processed XML data continuously. |
| 370 | On success, only the top level XML element is kept in the end. This |
| 371 | option is applicable only with lyd_parse_xml(). */ |
| 372 | #define LYD_OPT_EDIT 0x04 /**< make validation to accept NETCONF edit-config's content: |
| 373 | - mandatory nodes can be omitted |
| 374 | - leafrefs and instance-identifier are not resolved |
| 375 | - status data are not allowed */ |
| 376 | #define LYD_OPT_FILTER 0x08 /**< make validation to accept NETCONF subtree filter data: |
| 377 | - leafs/leaf-lists with no data are allowed (even not allowed e.g. by length restriction) |
| 378 | - multiple instances of container/leaf/.. are allowed |
| 379 | - list's keys/unique nodes are not required |
| 380 | - mandatory nodes can be omitted |
| 381 | - leafrefs and instance-identifier are not resolved |
| 382 | - data from different choice's branches are allowed */ |
| 383 | #define LYD_OPT_GETCONFIG 0x10 /**< make validation to accept get-config's result data even with applied filter: |
| 384 | - mandatory nodes can be omitted |
| 385 | - leafrefs and instance-identifier are not resolved |
| 386 | - list's keys/unique nodes are not required (so duplication is not checked) |
| 387 | - status data are not allowed */ |
| 388 | #define LYD_OPT_GET 0x20 /**< make validation to accept get's result data even with applied filter: |
| 389 | - same as for #LYD_OPT_GETCONFIG but the status data are allowed */ |
Radek Krejci | 04b97de | 2015-10-31 23:09:15 +0100 | [diff] [blame] | 390 | |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 391 | /** |
| 392 | * @} |
| 393 | */ |
| 394 | |
| 395 | /** |
Radek Krejci | b20c62d | 2015-07-07 17:07:14 +0200 | [diff] [blame] | 396 | * @brief Parse (and validate according to appropriate schema from the given context) data. |
| 397 | * |
Radek Krejci | 4f0a874 | 2015-08-12 10:09:28 +0200 | [diff] [blame] | 398 | * In case of LY_XML format, the data string is expected to contain XML data under a single |
| 399 | * XML element. The element is not parsed, but it is expected to keep XML data well formed in all |
| 400 | * cases. There are no restrictions for the element name or its namespace. |
Radek Krejci | b20c62d | 2015-07-07 17:07:14 +0200 | [diff] [blame] | 401 | * |
| 402 | * LY_JSON format is not yet supported. |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 403 | * |
| 404 | * @param[in] ctx Context to connect with the data tree being built here. |
| 405 | * @param[in] data Serialized data in the specified format. |
| 406 | * @param[in] format Format of the input data to be parsed. |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 407 | * @param[in] options Parser options, see @ref parseroptions. |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 408 | * @return Pointer to the built data tree. To free the returned structure, use lyd_free(). |
Radek Krejci | b20c62d | 2015-07-07 17:07:14 +0200 | [diff] [blame] | 409 | */ |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 410 | struct lyd_node *lyd_parse(struct ly_ctx *ctx, const char *data, LYD_FORMAT format, int options); |
Radek Krejci | b20c62d | 2015-07-07 17:07:14 +0200 | [diff] [blame] | 411 | |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 412 | /** |
Radek Krejci | c6704c8 | 2015-10-06 11:12:45 +0200 | [diff] [blame] | 413 | * @brief Parse (and validate according to appropriate schema from the given context) XML tree. |
| 414 | * |
| 415 | * The output data tree is parsed from the given XML tree previously parsed by one of the |
| 416 | * lyxml_read* functions. Note, that the parser removes successfully parsed data from the |
| 417 | * XML tree except the root element (see the note about XML format in lyd_parse()). When |
| 418 | * the given XML tree is successfully parsed, the given \p root is kept but it has no children |
| 419 | * which are returned as a top level nodes in the output data tree. |
| 420 | * |
| 421 | * The context must be the same as the context used to parse XML tree by lyxml_read* function. |
| 422 | * |
| 423 | * @param[in] ctx Context to connect with the data tree being built here. |
| 424 | * @param[in] root XML tree to parse (convert) to data tree. |
| 425 | * @param[in] options Parser options, see @ref parseroptions. |
| 426 | * @return Pointer to the built data tree. To free the returned structure, use lyd_free(). |
| 427 | */ |
| 428 | struct lyd_node *lyd_parse_xml(struct ly_ctx *ctx, struct lyxml_elem *root, int options); |
| 429 | |
| 430 | /** |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 431 | * @brief Read data from the given file |
| 432 | * |
| 433 | * TODO not implemented |
| 434 | * |
| 435 | * @param[in] ctx Context to connect with the data tree being built here. |
| 436 | * @param[in] fd The standard file descriptor of the file containing the data tree in the specified format. |
| 437 | * @param[in] format Format of the input data to be parsed. |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 438 | * @param[in] options Parser options, see @ref parseroptions. |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 439 | * @return Pointer to the built data tree. To free the returned structure, use lyd_free(). |
| 440 | */ |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 441 | struct lyd_node *lyd_read(struct ly_ctx *ctx, int fd, LYD_FORMAT format, int options); |
Radek Krejci | 704a7a9 | 2015-08-07 12:50:15 +0200 | [diff] [blame] | 442 | |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 443 | /**@} parsers */ |
| 444 | |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 445 | /** |
| 446 | * @defgroup schematree Schema Tree |
| 447 | * @{ |
| 448 | * |
| 449 | * Data structures and functions to manipulate and access schema tree. |
| 450 | * |
| 451 | * @} |
| 452 | */ |
| 453 | |
| 454 | /** |
| 455 | * @defgroup datatree Data Tree |
| 456 | * @{ |
| 457 | * |
| 458 | * Data structures and functions to manipulate and access instance data tree. |
| 459 | * |
| 460 | * @} |
| 461 | */ |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 462 | |
| 463 | /** |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 464 | * @defgroup printers Printers |
| 465 | * @{ |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 466 | * |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 467 | * Printers allows to serialize schema and data trees in a specific format. |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 468 | * |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 469 | * For schemas, the following formats are supported: |
| 470 | * - YANG |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 471 | * |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 472 | * Basic YANG schemas format described in [RFC 6020](http://tools.ietf.org/html/rfc6020). |
| 473 | * Currently, only YANG 1.0 is supported. |
| 474 | * |
| 475 | * - YIN |
| 476 | * |
| 477 | * Alternative XML-based format to YANG. The details can be found in |
| 478 | * [RFC 6020](http://tools.ietf.org/html/rfc6020#section-11). |
| 479 | * |
| 480 | * \todo YIN output is not yet implemented |
| 481 | * |
| 482 | * - Tree |
| 483 | * |
| 484 | * Simple tree structure of the module. |
| 485 | * |
| 486 | * - Info |
| 487 | * |
| 488 | * Detailed information about the specific node in the schema tree. |
Michal Vasko | 6d6076e | 2015-08-13 15:53:09 +0200 | [diff] [blame] | 489 | * The target can be more specific than the module itself: |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 490 | * |
Michal Vasko | 6d6076e | 2015-08-13 15:53:09 +0200 | [diff] [blame] | 491 | * - absolute-schema-nodeid \a /modules/module-set-id in \a ietf-yang-library |
| 492 | * - <b>typedef/</b>typedef-name \a typedef/revision-identifier in \a ietf-yang-library |
| 493 | * - <b>feature/</b>feature-name \a feature/ssh in \a ietf-netconf-server |
| 494 | * - <b>grouping/</b>grouping-name/descendant-schema-nodeid \a grouping/module or \a grouping/module/module/submodules |
| 495 | * in \a ietf-yang-library |
| 496 | * - <b>type/</b>leaf-or-leaflist \a type/modules/module-set-id in \a ietf-yang-library |
Radek Krejci | d9ba3e3 | 2015-07-30 15:08:18 +0200 | [diff] [blame] | 497 | * |
| 498 | * For data instances, the following formats are supported: |
| 499 | * - \todo TBD |
| 500 | * |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 501 | */ |
| 502 | |
| 503 | /** |
Radek Krejci | 912da45 | 2015-07-29 14:10:06 +0200 | [diff] [blame] | 504 | * @brief Print schema tree in the specified format. |
| 505 | * |
Radek Krejci | 87f5237 | 2015-10-09 09:34:46 +0200 | [diff] [blame] | 506 | * To write data into a file descriptor, use lys_print_fd(). |
| 507 | * |
Radek Krejci | 912da45 | 2015-07-29 14:10:06 +0200 | [diff] [blame] | 508 | * @param[in] module Schema tree to print. |
| 509 | * @param[in] f File stream where to print the schema. |
| 510 | * @param[in] format Schema output format. |
Radek Krejci | a9167ef | 2015-08-03 11:01:11 +0200 | [diff] [blame] | 511 | * @param[in] target_node Optional parameter for ::LYS_OUT_INFO format. It specifies which particular |
Radek Krejci | 912da45 | 2015-07-29 14:10:06 +0200 | [diff] [blame] | 512 | * node in the module will be printed. |
| 513 | * @return 0 on success, 1 on failure (#ly_errno is set). |
| 514 | */ |
Radek Krejci | b804869 | 2015-08-05 13:36:34 +0200 | [diff] [blame] | 515 | int lys_print(FILE *f, struct lys_module *module, LYS_OUTFORMAT format, const char *target_node); |
Radek Krejci | 912da45 | 2015-07-29 14:10:06 +0200 | [diff] [blame] | 516 | |
| 517 | /** |
Radek Krejci | 87f5237 | 2015-10-09 09:34:46 +0200 | [diff] [blame] | 518 | * @brief Print schema tree in the specified format. |
| 519 | * |
| 520 | * Same as lys_print(), but output is written into the specified file descriptor. |
| 521 | * |
| 522 | * @param[in] module Schema tree to print. |
| 523 | * @param[in] fd File descriptor where to print the data. |
| 524 | * @param[in] format Schema output format. |
| 525 | * @param[in] target_node Optional parameter for ::LYS_OUT_INFO format. It specifies which particular |
| 526 | * node in the module will be printed. |
| 527 | * @return 0 on success, 1 on failure (#ly_errno is set). |
| 528 | */ |
| 529 | int lys_print_fd(int fd, struct lys_module *module, LYS_OUTFORMAT format, const char *target_node); |
| 530 | |
| 531 | /** |
Radek Krejci | 6140e4e | 2015-10-09 15:50:55 +0200 | [diff] [blame] | 532 | * @brief Print schema tree in the specified format. |
| 533 | * |
Radek Krejci | 2fa0fc1 | 2015-10-14 18:14:29 +0200 | [diff] [blame] | 534 | * Same as lys_print(), but it allocates memory and store the data into it. |
| 535 | * It is up to caller to free the returned string by free(). |
| 536 | * |
| 537 | * @param[out] strp Pointer to store the resulting dump. |
| 538 | * @param[in] module Schema tree to print. |
| 539 | * @param[in] format Schema output format. |
| 540 | * @param[in] target_node Optional parameter for ::LYS_OUT_INFO format. It specifies which particular |
| 541 | * node in the module will be printed. |
| 542 | * @return 0 on success, 1 on failure (#ly_errno is set). |
| 543 | */ |
| 544 | int lys_print_mem(char **strp, struct lys_module *module, LYS_OUTFORMAT format, const char *target_node); |
| 545 | |
| 546 | /** |
| 547 | * @brief Print schema tree in the specified format. |
| 548 | * |
Radek Krejci | 6140e4e | 2015-10-09 15:50:55 +0200 | [diff] [blame] | 549 | * Same as lys_print(), but output is written via provided callback. |
| 550 | * |
| 551 | * @param[in] module Schema tree to print. |
| 552 | * @param[in] writeclb Callback function to write the data (see write(1)). |
Radek Krejci | 50929eb | 2015-10-09 18:14:15 +0200 | [diff] [blame] | 553 | * @param[in] arg Optional caller-specific argument to be passed to the \p writeclb callback. |
Radek Krejci | 6140e4e | 2015-10-09 15:50:55 +0200 | [diff] [blame] | 554 | * @param[in] format Schema output format. |
| 555 | * @param[in] target_node Optional parameter for ::LYS_OUT_INFO format. It specifies which particular |
| 556 | * node in the module will be printed. |
| 557 | * @return 0 on success, 1 on failure (#ly_errno is set). |
| 558 | */ |
Radek Krejci | 50929eb | 2015-10-09 18:14:15 +0200 | [diff] [blame] | 559 | int lys_print_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg, struct lys_module *module, LYS_OUTFORMAT format, const char *target_node); |
Radek Krejci | 6140e4e | 2015-10-09 15:50:55 +0200 | [diff] [blame] | 560 | |
| 561 | /** |
Radek Krejci | 912da45 | 2015-07-29 14:10:06 +0200 | [diff] [blame] | 562 | * @brief Print data tree in the specified format. |
| 563 | * |
Radek Krejci | 87f5237 | 2015-10-09 09:34:46 +0200 | [diff] [blame] | 564 | * To write data into a file descriptor, use lyd_print_fd(). |
| 565 | * |
Radek Krejci | 912da45 | 2015-07-29 14:10:06 +0200 | [diff] [blame] | 566 | * @param[in] root Root node of the data tree to print. It can be actually any (not only real root) |
| 567 | * node of the data tree to print the specific subtree. |
| 568 | * @param[in] f File stream where to print the data. |
| 569 | * @param[in] format Data output format. |
| 570 | * @return 0 on success, 1 on failure (#ly_errno is set). |
| 571 | */ |
Radek Krejci | a9167ef | 2015-08-03 11:01:11 +0200 | [diff] [blame] | 572 | int lyd_print(FILE *f, struct lyd_node *root, LYD_FORMAT format); |
Radek Krejci | 912da45 | 2015-07-29 14:10:06 +0200 | [diff] [blame] | 573 | |
Radek Krejci | 87f5237 | 2015-10-09 09:34:46 +0200 | [diff] [blame] | 574 | /** |
| 575 | * @brief Print data tree in the specified format. |
| 576 | * |
| 577 | * Same as lyd_print(), but output is written into the specified file descriptor. |
| 578 | * |
| 579 | * @param[in] root Root node of the data tree to print. It can be actually any (not only real root) |
| 580 | * node of the data tree to print the specific subtree. |
| 581 | * @param[in] fd File descriptor where to print the data. |
| 582 | * @param[in] format Data output format. |
| 583 | * @return 0 on success, 1 on failure (#ly_errno is set). |
| 584 | */ |
| 585 | int lyd_print_fd(int fd, struct lyd_node *root, LYD_FORMAT format); |
| 586 | |
Radek Krejci | 2fa0fc1 | 2015-10-14 18:14:29 +0200 | [diff] [blame] | 587 | |
| 588 | /** |
| 589 | * @brief Print data tree in the specified format. |
| 590 | * |
| 591 | * Same as lyd_print(), but it allocates memory and store the data into it. |
| 592 | * It is up to caller to free the returned string by free(). |
| 593 | * |
| 594 | * @param[out] strp Pointer to store the resulting dump. |
| 595 | * @param[in] root Root node of the data tree to print. It can be actually any (not only real root) |
| 596 | * node of the data tree to print the specific subtree. |
| 597 | * @param[in] format Data output format. |
| 598 | * @return 0 on success, 1 on failure (#ly_errno is set). |
| 599 | */ |
| 600 | int lyd_print_mem(char **strp, struct lyd_node *root, LYD_FORMAT format); |
| 601 | |
Radek Krejci | 6140e4e | 2015-10-09 15:50:55 +0200 | [diff] [blame] | 602 | /** |
| 603 | * @brief Print data tree in the specified format. |
| 604 | * |
| 605 | * Same as lyd_print(), but output is written via provided callback. |
| 606 | * |
| 607 | * @param[in] root Root node of the data tree to print. It can be actually any (not only real root) |
| 608 | * node of the data tree to print the specific subtree. |
| 609 | * @param[in] writeclb Callback function to write the data (see write(1)). |
Radek Krejci | 50929eb | 2015-10-09 18:14:15 +0200 | [diff] [blame] | 610 | * @param[in] arg Optional caller-specific argument to be passed to the \p writeclb callback. |
Radek Krejci | 6140e4e | 2015-10-09 15:50:55 +0200 | [diff] [blame] | 611 | * @param[in] format Data output format. |
| 612 | * @return 0 on success, 1 on failure (#ly_errno is set). |
| 613 | */ |
Radek Krejci | 50929eb | 2015-10-09 18:14:15 +0200 | [diff] [blame] | 614 | int lyd_print_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg, struct lyd_node *root, LYD_FORMAT format); |
Radek Krejci | 6140e4e | 2015-10-09 15:50:55 +0200 | [diff] [blame] | 615 | |
Radek Krejci | 912da45 | 2015-07-29 14:10:06 +0200 | [diff] [blame] | 616 | /**@} printers */ |
| 617 | |
| 618 | /** |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 619 | * @defgroup logger Logger |
| 620 | * @{ |
| 621 | * |
| 622 | * Publicly visible functions and values of the libyang logger. For more |
| 623 | * information, see \ref howtologger. |
| 624 | */ |
| 625 | |
| 626 | /** |
| 627 | * @typedef LY_LOG_LEVEL |
| 628 | * @brief Verbosity levels of the libyang logger. |
| 629 | */ |
| 630 | typedef enum { |
Radek Krejci | 6e4ffbb | 2015-06-16 10:34:41 +0200 | [diff] [blame] | 631 | LY_LLERR, /**< Print only error messages. */ |
| 632 | LY_LLWRN, /**< Print error and warning messages. */ |
| 633 | LY_LLVRB, /**< Besides errors and warnings, print some other verbose messages. */ |
| 634 | LY_LLDBG /**< Print all messages including some development debug messages. */ |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 635 | } LY_LOG_LEVEL; |
| 636 | |
| 637 | /** |
| 638 | * @brief Set logger verbosity level. |
| 639 | * @param[in] level Verbosity level. |
| 640 | */ |
| 641 | void ly_verb(LY_LOG_LEVEL level); |
| 642 | |
| 643 | /** |
| 644 | * @typedef LY_ERR |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 645 | * @brief libyang's error codes available via ly_errno extern variable. |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 646 | * @ingroup logger |
| 647 | */ |
| 648 | typedef enum { |
Radek Krejci | ae6817a | 2015-08-10 14:02:06 +0200 | [diff] [blame] | 649 | LY_SUCCESS, /**< no error, not set by functions, included just to complete #LY_ERR enumeration */ |
Radek Krejci | 6e4ffbb | 2015-06-16 10:34:41 +0200 | [diff] [blame] | 650 | LY_EMEM, /**< Memory allocation failure */ |
| 651 | LY_ESYS, /**< System call failure */ |
| 652 | LY_EINVAL, /**< Invalid value */ |
| 653 | LY_EINT, /**< Internal error */ |
| 654 | LY_EVALID /**< Validation failure */ |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 655 | } LY_ERR; |
Radek Krejci | 26715a4 | 2015-07-29 14:10:45 +0200 | [diff] [blame] | 656 | /** |
| 657 | * @brief libyang specific errno. |
| 658 | */ |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 659 | extern LY_ERR ly_errno; |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 660 | |
Radek Krejci | 3045cf3 | 2015-05-28 10:58:52 +0200 | [diff] [blame] | 661 | /**@} logger */ |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 662 | |
Radek Krejci | 39d8d0d | 2015-08-17 13:42:45 +0200 | [diff] [blame] | 663 | #ifdef __cplusplus |
| 664 | } |
| 665 | #endif |
| 666 | |
Radek Krejci | 9b4ca39 | 2015-04-10 08:31:27 +0200 | [diff] [blame] | 667 | #endif /* LY_LIBYANG_H_ */ |