Helper functions to implement extension plugin's compile callback.
◆ lys_compile_extension_instance()
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] | ctx | YANG schema compile context to track the compilation state. |
[in] | ext_p | Parsed representation of the extension instance being processed. |
[in,out] | ext | Compiled 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] | ctx | YANG 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] | ctx | YANG 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] | ctx | YANG schema compilation context. |
- Returns
- path identifying the place in schema being currently processed by the schema compiler.
◆ lysc_ext_dup()
Duplicate the compiled extension (definition) structure.
- Parameters
-
[in] | orig | The 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] | ctx | Compile context with the path. |
[in] | parent_module | Module of the current node's parent to check difference with the currently processed module (taken from ctx ). |
[in] | name | Name 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). |