libyang  2.0.7
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
Plugins: Extensions compilation support
Collaboration diagram for Plugins: Extensions compilation support:

Modules

 Schema compile flags
 

Functions

LY_ERR lys_compile_extension_instance (struct lysc_ctx *ctx, const struct lysp_ext_instance *ext_p, struct lysc_ext_instance *ext)
 Compile substatements of an extension instance. More...
 
struct ly_ctxlysc_ctx_get_ctx (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for libyang context. More...
 
uint32_t * lysc_ctx_get_options (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for compilation options. More...
 
const char * lysc_ctx_get_path (const struct lysc_ctx *ctx)
 YANG schema compilation context getter for path being currently processed. More...
 
struct lysc_extlysc_ext_dup (struct lysc_ext *orig)
 Duplicate the compiled extension (definition) structure. More...
 
void lysc_update_path (struct lysc_ctx *ctx, struct lys_module *parent_module, const char *name)
 Update path in the compile context, which is used for logging where the compilation failed. More...
 

Detailed Description

Helper functions to implement extension plugin's compile callback.

Function Documentation

◆ lys_compile_extension_instance()

LY_ERR lys_compile_extension_instance ( struct lysc_ctx *  ctx,
const struct lysp_ext_instance ext_p,
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]ctxYANG schema compile context to track the compilation state.
[in]ext_pParsed 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.

◆ lysc_ctx_get_ctx()

struct ly_ctx* lysc_ctx_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.

◆ lysc_ctx_get_options()

uint32_t* lysc_ctx_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.

◆ lysc_ctx_get_path()

const char* lysc_ctx_get_path ( const struct lysc_ctx *  ctx)

YANG schema compilation context getter for path being currently processed.

Parameters
[in]ctxYANG schema compilation context.
Returns
path identifying the place in schema being currently processed by the schema compiler.

◆ lysc_ext_dup()

struct lysc_ext* lysc_ext_dup ( struct lysc_ext orig)

Duplicate the compiled extension (definition) structure.

Parameters
[in]origThe extension structure to duplicate.
Returns
The duplicated structure to use.

◆ lysc_update_path()

void lysc_update_path ( struct lysc_ctx *  ctx,
struct lys_module parent_module,
const char *  name 
)

Update path in the compile context, which is used for logging where the compilation failed.

Parameters
[in]ctxCompile context with the path.
[in]parent_moduleModule of the current node's parent to check difference with the currently processed module (taken from ctx).
[in]nameName of the node to update path with. If NULL, the last segment is removed. If the format is {keyword}, the following call updates the segment to the form ‘{keyword='name’}` (to remove this compound segment, 2 calls with NULL name must be used).