Skip to content

Commit a8e855b

Browse files
lePicimichalvasko
authored andcommitted
doc UPDATE added explanations to plugins
1 parent 017e315 commit a8e855b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/plugins.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,22 @@ extern "C" {
3838
* Furthermore, there are several internal plugins, implementing built-in data types and selected derived types and YANG
3939
* extensions. These internal plugins uses the same API and can be taken as examples for implementing user plugins. Internal
4040
* plugins are always loaded with the first created [context](@ref howtoContext) and unloaded with destroying the last one.
41-
* The external plugins are in the same phase loaded from the default directories specified at compile time via cmake
42-
* variables `PLUGINS_DIR` (where the `extensions` and `types` subdirectories are added for each plugin type) or separately
43-
* via `PLUGINS_DIR_EXTENSIONS` and `PLUGINS_DIR_TYPES` for each plugin type. The default directories can be replaced runtime
44-
* using environment variables `LIBYANG_TYPES_PLUGINS_DIR` and `LIBYANG_EXTENSIONS_PLUGINS_DIR`.
41+
* The external plugins are in the same phase loaded as dynamic shared objects (shared libraries) from the default directories
42+
* specified at compile time via cmake variables `PLUGINS_DIR` (where the `extensions` and `types` subdirectories are added
43+
* for each plugin type) or separately via `PLUGINS_DIR_EXTENSIONS` and `PLUGINS_DIR_TYPES` for each plugin type. The default
44+
* directories can be replaced runtime using environment variables `LIBYANG_TYPES_PLUGINS_DIR` and `LIBYANG_EXTENSIONS_PLUGINS_DIR`.
45+
* There is also a separate function ::lyplg_add() to manually add a plugin (dynamic shared object) anytime later.
46+
* Another option to manually add an external plugin is using the ::lyplg_add_extension_plugin() or ::lyplg_add_type_plugin()
47+
* which is useful when loading a dynamic shared object is problematic. These functions allow for setting the necessary callbacks
48+
* for the plugin at runtime.
4549
*
4650
* Order of the plugins determines their priority. libyang searches for the first match with the extension and type, so the
4751
* firstly loaded plugin for the specific item is used. Since the internal plugins are loaded always before the external
4852
* plugins, the internal plugins cannot be replaced.
4953
*
50-
* There is also a separate function ::lyplg_add() to add a plugin anytime later. Note, that such a plugin is being used
51-
* after it is added with the lowest priority among other already loaded plugins. Also note that since all the plugins are
52-
* unloaded with the destruction of the last context, creating a new context after that starts the standard plugins
53-
* initiation and the manually added plugins are not loaded automatically.
54+
* Note, that manually added plugin via lyplg_add*() function is added with the lowest priority among other already loaded plugins.
55+
* Also note that since all the plugins are unloaded with the destruction of the last context, creating a new context after that
56+
* starts the standard plugins initiation and the manually added plugins are not loaded automatically.
5457
*
5558
* The following pages contain description of the API for creating user plugins.
5659
*

0 commit comments

Comments
 (0)