Loading...
Searching...
No Matches
Context options
Context
Collaboration diagram for Context options:

## Macros

#define | LY_CTX_ALL_IMPLEMENTED 0x01
#define | LY_CTX_BUILTIN_PLUGINS_ONLY 0x0800
#define | LY_CTX_DISABLE_SEARCHDIR_CWD 0x10
#define | LY_CTX_DISABLE_SEARCHDIRS 0x08
#define | LY_CTX_ENABLE_IMP_FEATURES 0x0100
#define | LY_CTX_EXPLICIT_COMPILE 0x80
#define | LY_CTX_LEAFREF_EXTENDED 0x0200
#define | LY_CTX_LEAFREF_LINKING 0x0400
#define | LY_CTX_NO_YANGLIBRARY 0x04
#define | LY_CTX_PREFER_SEARCHDIRS 0x20
#define | LY_CTX_REF_IMPLEMENTED 0x02
#define | LY_CTX_SET_PRIV_PARSED 0x40

## Detailed Description

Options to change context behavior.

## Macro Definition Documentation

## LY_CTX_ALL_IMPLEMENTED

#define LY_CTX_ALL_IMPLEMENTED 0x01

All the imported modules of the schema being parsed are implemented.

Definition at line 161 of file context.h.

## LY_CTX_BUILTIN_PLUGINS_ONLY

#define LY_CTX_BUILTIN_PLUGINS_ONLY 0x0800

By default, context uses all available plugins for types and extensions, both included and external. This options prevents all included plugins to be loaded except for built-in YANG types so all derived types will use these and for all purposes behave as the base type. The option can be used for cases when invalid data needs to be stored in YANG node values.

Definition at line 209 of file context.h.

## LY_CTX_DISABLE_SEARCHDIR_CWD

#define LY_CTX_DISABLE_SEARCHDIR_CWD 0x10

Do not automatically search for schemas in current working directory, which is by default searched automatically (despite not recursively).

Definition at line 180 of file context.h.

## LY_CTX_DISABLE_SEARCHDIRS

#define LY_CTX_DISABLE_SEARCHDIRS 0x08

Do not search for schemas in context's searchdirs neither in current working directory. It is entirely skipped and the only way to get schema data for imports or for ly_ctx_load_module() is to use the callbacks provided by caller via ly_ctx_set_module_imp_clb()

Definition at line 177 of file context.h.

## LY_CTX_ENABLE_IMP_FEATURES

#define LY_CTX_ENABLE_IMP_FEATURES 0x0100

By default, all features of newly implemented imported modules of a module that is being loaded are disabled. With this flag they all become enabled.

Definition at line 198 of file context.h.

## LY_CTX_EXPLICIT_COMPILE

#define LY_CTX_EXPLICIT_COMPILE 0x80

If this flag is set, the compiled modules and their schema nodes are not automatically updated (compiled) on any context changes. In other words, they do not immediately take effect. To do that, call ly_ctx_compile(). Changes requiring compilation include adding new modules, changing their features, and implementing parsed-only modules. This option allows efficient compiled context creation without redundant recompilations.

Definition at line 195 of file context.h.

## LY_CTX_LEAFREF_EXTENDED

#define LY_CTX_LEAFREF_EXTENDED 0x0200

By default, path attribute of leafref accepts only path as defined in RFC 7950. By using this option, the path attribute will also allow using XPath functions as deref()

Definition at line 200 of file context.h.

## LY_CTX_LEAFREF_LINKING

#define LY_CTX_LEAFREF_LINKING 0x0400

Link valid leafref nodes with its target during validation if leafref node is not using 'require-instance false;'. It also enables usage of lyd_leafref_get_links and lyd_leafref_link_node_tree APIs.

Definition at line 204 of file context.h.

## LY_CTX_NO_YANGLIBRARY

#define LY_CTX_NO_YANGLIBRARY 0x04

Do not internally implement ietf-yang-library module. The option causes that function ly_ctx_get_yanglib_data() does not work (returns LY_EINVAL) until the ietf-yang-library module is loaded manually. While any revision of this schema can be loaded with this option, note that the only revisions implemented by ly_ctx_get_yanglib_data() are 2016-06-21 and 2019-01-04. This option cannot be changed on existing context.

Definition at line 173 of file context.h.

## LY_CTX_PREFER_SEARCHDIRS

#define LY_CTX_PREFER_SEARCHDIRS 0x20

When searching for schema, prefer searchdirs instead of user callback.

Definition at line 181 of file context.h.

## LY_CTX_REF_IMPLEMENTED

#define LY_CTX_REF_IMPLEMENTED 0x02

Implement all imported modules "referenced" from an implemented module. Normally, leafrefs, augment and deviation targets are implemented as specified by YANG 1.1. In addition to this, implement any modules of nodes referenced by when and must conditions and by any default values. Generally, only if all these modules are implemented, the explicitly implemented modules can be properly used and instantiated in data.

Definition at line 167 of file context.h.

## LY_CTX_SET_PRIV_PARSED

#define LY_CTX_SET_PRIV_PARSED 0x40

For all compiled nodes, their private objects (lysc_node.priv) are used by libyang as a reference to the corresponding parsed node (lysp_node). The exception are "case" statements, which are omitted (shorthand), in that case the private objects are set to NULL. So if this option is set, the user must not change private objects. Setting this option by ly_ctx_set_options() may result in context recompilation. Resetting this option by ly_ctx_unset_options() cause that private objects will be set to NULL.

Definition at line 189 of file context.h.