libyang  3.6.0
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Plugins: Extensions compilation support
Collaboration diagram for Plugins: Extensions compilation support:

Modules

 Schema compile flags
 

Typedefs

typedef LY_ERR(* lyplg_ext_compile_clb )(struct lysc_ctx *cctx, const struct lysp_ext_instance *extp, struct lysc_ext_instance *ext)
 Callback to compile extension from the lysp_ext_instance to the lysc_ext_instance. The later structure is generally prepared and only the extension specific data are supposed to be added (if any). More...
 

Functions

LIBYANG_API_DECL LY_ERR lyplg_ext_compile_extension_instance (struct lysc_ctx *ctx, const struct lysp_ext_instance *extp, struct lysc_ext_instance *ext)
 Compile substatements of an extension instance. More...
 
LIBYANG_API_DECL struct ly_ctxlyplg_ext_compile_get_ctx (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for libyang context. More...
 
LIBYANG_API_DECL struct
lys_module
lyplg_ext_compile_get_cur_mod (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for current module. More...
 
LIBYANG_API_DECL uint32_t * lyplg_ext_compile_get_options (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for compilation options. More...
 
LIBYANG_API_DECL struct
lysp_module
lyplg_ext_compile_get_pmod (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for currently processed module. More...
 
LIBYANG_API_DECL void lyplg_ext_compile_log (const struct lysc_ctx *cctx, const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err, const char *format,...)
 Log a message from an extension plugin using the compiled extension instance. More...
 
LIBYANG_API_DEF void lyplg_ext_compile_log_err (const struct ly_err_item *eitem, const struct lysc_ext_instance *ext)
 Log a message from an extension plugin using the compiled extension instance and a generated error item. More...
 
LIBYANG_API_DECL void lyplg_ext_compile_log_path (const char *path, const struct lysc_ext_instance *ext, LY_LOG_LEVEL level, LY_ERR err, const char *format,...)
 Log a message from an extension plugin using the compiled extension instance with an explicit error path. More...
 

Detailed Description

Implementing extension plugin compile callback.

Typedef Documentation

typedef LY_ERR(* lyplg_ext_compile_clb)(struct lysc_ctx *cctx, const struct lysp_ext_instance *extp, struct lysc_ext_instance *ext)

Callback to compile extension from the lysp_ext_instance to the lysc_ext_instance. The later structure is generally prepared and only the extension specific data are supposed to be added (if any).

The parsed generic statements can be processed by the callback on its own or the lyplg_ext_compile_extension_instance() function can be used to let the compilation to libyang following the standard rules for processing the YANG statements.

Parameters
[in]cctxCurrent compile context.
[in]extpParsed extension instance data.
[in,out]extPrepared compiled extension instance structure where an addition, extension-specific, data are supposed to be placed for later use (data validation or use of external tool).
Returns
LY_SUCCESS in case of success.
LY_ENOT in case the extension instance is not supported and should be removed.
LY_ERR error on error.

Definition at line 576 of file plugins_exts.h.

Function Documentation

LIBYANG_API_DECL LY_ERR lyplg_ext_compile_extension_instance ( struct lysc_ctx *  ctx,
const struct lysp_ext_instance extp,
struct lysc_ext_instance ext 
)

Compile substatements of an extension instance.

Uses standard libyang schema compiler to transform YANG statements into the compiled schema structures. The plugins are supposed to use this function when the extension instance's substatements are supposed to be compiled in a standard way (or if just the Schema compile flags are enough to modify the compilation process).

Parameters
[in]ctxCompile context.
[in]extpParsed representation of the extension instance being processed.
[in,out]extCompiled extension instance with the prepared lysc_ext_instance.substmts array, which will be updated by storing the compiled data.
Returns
LY_SUCCESS on success.
LY_EVALID if compilation of the substatements fails.
LY_ENOT if the extension is disabled (by if-feature) and should be ignored.
LIBYANG_API_DECL struct ly_ctx* lyplg_ext_compile_get_ctx ( const struct lysc_ctx *  ctx)

YANG schema compilation context getter for libyang context.

Parameters
[in]ctxYANG schema compilation context.
Returns
libyang context connected with the compilation context.
LIBYANG_API_DECL struct lys_module* lyplg_ext_compile_get_cur_mod ( const struct lysc_ctx *  ctx)

YANG schema compilation context getter for current module.

Parameters
[in]ctxYANG schema compilation context.
Returns
current module.
LIBYANG_API_DECL uint32_t* lyplg_ext_compile_get_options ( const struct lysc_ctx *  ctx)

YANG schema compilation context getter for compilation options.

Parameters
[in]ctxYANG schema compilation context.
Returns
pointer to the compilation options to allow modifying them with Schema compile flags values.
LIBYANG_API_DECL struct lysp_module* lyplg_ext_compile_get_pmod ( const struct lysc_ctx *  ctx)

YANG schema compilation context getter for currently processed module.

Parameters
[in]ctxYANG schema compilation context.
Returns
Currently processed module.
LIBYANG_API_DECL void lyplg_ext_compile_log ( const struct lysc_ctx *  cctx,
const struct lysc_ext_instance ext,
LY_LOG_LEVEL  level,
LY_ERR  err,
const char *  format,
  ... 
)

Log a message from an extension plugin using the compiled extension instance.

Parameters
[in]cctxOptional compile context to generate the path from.
[in]extCompiled extension instance.
[in]levelLog message level (error, warning, etc.)
[in]errError type code.
[in]formatFormat string to print.
LIBYANG_API_DEF void lyplg_ext_compile_log_err ( const struct ly_err_item eitem,
const struct lysc_ext_instance ext 
)

Log a message from an extension plugin using the compiled extension instance and a generated error item.

Parameters
[in]eitemError item to log.
[in]extCompiled extension instance.
LIBYANG_API_DECL void lyplg_ext_compile_log_path ( const char *  path,
const struct lysc_ext_instance ext,
LY_LOG_LEVEL  level,
LY_ERR  err,
const char *  format,
  ... 
)

Log a message from an extension plugin using the compiled extension instance with an explicit error path.

Parameters
[in]pathLog error schema path to use.
[in]extCompiled extension instance.
[in]levelLog message level (error, warning, etc.)
[in]errError type code.
[in]formatFormat string to print.