libyang  3.4.2
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
Input Processing

libyang provides a mechanism to generalize work with the inputs (and outputs) of the different types. The ly_in handler can be created providing necessary information connected with the specific input type and then used throughout the parser functions processing the input data. Using a generic input handler avoids need to have a set of functions for each parser functionality and results in simpler API.

The API allows to alter the source of the data behind the handler by another source. Also resetting a seekable source input is possible with ly_in_reset() to re-read the input.

Note
Currently, libyang supports only reading data from standard (disk) file, not from sockets, pipes, etc. The reason is that the parsers expects all the data to be present in the file (input data are complete). In future, we would like to change the internal mechanism and support sequential processing of the input data. In XML wording - we have DOM parser, but in future we would like to move to something like a SAX parser.
This mechanism was introduced in libyang 2.0. To simplify transition from libyang 1.0 to version 2.0 and also for some simple use case where using the input handler would be an overkill, there are some basic parsers functions that do not require input handler. But remember, that functionality of these function can be limited in particular cases in contrast to the functions using input handlers.

Functions List

libyang Parsers List