Loading...
Searching...
No Matches
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

- ly_in_new_fd()
- ly_in_new_file()
- ly_in_new_filepath()
- ly_in_new_memory()
- ly_in_fd()
- ly_in_file()
- ly_in_filepath()
- ly_in_memory()
- ly_in_type()
- ly_in_parsed()
- ly_in_reset()
- ly_in_free()

## libyang Parsers List

- Parsing YANG Modules
- Parsing Data