Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file libyang.h |
| 3 | * @author Radek Krejci <rkrejci@cesnet.cz> |
| 4 | * @brief The main libyang public header. |
| 5 | * |
| 6 | * Copyright (c) 2015 - 2018 CESNET, z.s.p.o. |
| 7 | * |
| 8 | * This source code is licensed under BSD 3-Clause License (the "License"). |
| 9 | * You may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
| 11 | * |
| 12 | * https://opensource.org/licenses/BSD-3-Clause |
| 13 | */ |
| 14 | |
| 15 | #ifndef LY_LIBYANG_H_ |
| 16 | #define LY_LIBYANG_H_ |
| 17 | |
Radek Krejci | 0af5f5d | 2018-09-07 15:00:30 +0200 | [diff] [blame] | 18 | #include <stdint.h> |
| 19 | |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 20 | #ifdef __cplusplus |
| 21 | extern "C" { |
| 22 | #endif |
| 23 | |
Radek Krejci | 6caa6ab | 2018-10-24 10:04:48 +0200 | [diff] [blame] | 24 | #include "log.h" |
Radek Krejci | f0e1ba5 | 2020-05-22 15:14:35 +0200 | [diff] [blame] | 25 | #include "parser.h" |
| 26 | #include "parser_schema.h" |
| 27 | #include "plugins_types.h" |
| 28 | #include "printer.h" |
| 29 | #include "printer_data.h" |
| 30 | #include "printer_schema.h" |
Radek Krejci | 6caa6ab | 2018-10-24 10:04:48 +0200 | [diff] [blame] | 31 | #include "set.h" |
| 32 | #include "dict.h" |
| 33 | #include "context.h" |
Radek Krejci | e7b9509 | 2019-05-15 11:03:07 +0200 | [diff] [blame] | 34 | #include "tree.h" |
| 35 | #include "tree_data.h" |
Radek Krejci | 6caa6ab | 2018-10-24 10:04:48 +0200 | [diff] [blame] | 36 | #include "tree_schema.h" |
Radek Krejci | a5bba31 | 2020-01-09 15:41:20 +0100 | [diff] [blame] | 37 | #include "printer.h" |
| 38 | #include "printer_data.h" |
Radek Krejci | d3ca063 | 2019-04-16 16:54:54 +0200 | [diff] [blame] | 39 | #include "printer_schema.h" |
Radek Krejci | e7b9509 | 2019-05-15 11:03:07 +0200 | [diff] [blame] | 40 | #include "printer_data.h" |
Radek Krejci | 74a3e23 | 2019-07-16 10:46:05 +0200 | [diff] [blame] | 41 | #include "plugins_types.h" |
Radek Krejci | 6caa6ab | 2018-10-24 10:04:48 +0200 | [diff] [blame] | 42 | |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 43 | /** |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 44 | * @mainpage About |
| 45 | * |
| 46 | * libyang is a library implementing processing of the YANG schemas and data modeled by the YANG language. The |
| 47 | * library is implemented in C for GNU/Linux and provides C API. |
| 48 | * |
| 49 | * @section about-features Main Features |
| 50 | * |
| 51 | * - [Parsing (and validating) schemas](@ref howtoschemasparsers) in YANG format. |
| 52 | * - [Parsing (and validating) schemas](@ref howtoschemasparsers) in YIN format. |
| 53 | * - [Parsing, validating and printing instance data](@ref howtodata) in XML format. |
| 54 | * - [Parsing, validating and printing instance data](@ref howtodata) in JSON format |
| 55 | * ([RFC 7951](https://tools.ietf.org/html/rfc7951)). |
| 56 | * - [Manipulation with the instance data](@ref howtodatamanipulators). |
| 57 | * - Support for [default values in the instance data](@ref howtodatawd) ([RFC 6243](https://tools.ietf.org/html/rfc6243)). |
| 58 | * - Support for [YANG extensions and user types](@ref howtoschemaplugins). |
| 59 | * - Support for [YANG Metadata](@ref howtoschemametadata) ([RFC 7952](https://tools.ietf.org/html/rfc6243)). |
| 60 | * |
| 61 | * The current implementation covers YANG 1.0 ([RFC 6020](https://tools.ietf.org/html/rfc6020)) as well as |
| 62 | * YANG 1.1 ([RFC 7950](https://tools.ietf.org/html/rfc7950)). |
| 63 | * |
| 64 | * @section about-license License |
| 65 | * |
| 66 | * Copyright (c) 2015-2017 CESNET, z.s.p.o. |
| 67 | * |
| 68 | * (The BSD 3-Clause License) |
| 69 | * |
| 70 | * Redistribution and use in source and binary forms, with or without |
| 71 | * modification, are permitted provided that the following conditions |
| 72 | * are met: |
| 73 | * 1. Redistributions of source code must retain the above copyright |
| 74 | * notice, this list of conditions and the following disclaimer. |
| 75 | * 2. Redistributions in binary form must reproduce the above copyright |
| 76 | * notice, this list of conditions and the following disclaimer in |
| 77 | * the documentation and/or other materials provided with the |
| 78 | * distribution. |
| 79 | * 3. Neither the name of the Company nor the names of its contributors |
| 80 | * may be used to endorse or promote products derived from this |
| 81 | * software without specific prior written permission. |
| 82 | */ |
| 83 | |
| 84 | /** |
Radek Krejci | 52785a2 | 2019-09-11 12:57:26 +0200 | [diff] [blame] | 85 | * @page howto libyang API Overview |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 86 | * |
| 87 | * - @subpage howtocontext |
| 88 | * - @subpage howtoschemas |
| 89 | * - @subpage howtodata |
| 90 | * - @subpage howtoxpath |
| 91 | * - @subpage howtoxml |
| 92 | * - @subpage howtothreads |
| 93 | * - @subpage howtologger |
Radek Krejci | 290a6a5 | 2019-09-12 17:13:17 +0200 | [diff] [blame] | 94 | * - @subpage howtoplugins |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 95 | * - @subpage howtostructures |
| 96 | */ |
| 97 | |
| 98 | /** |
Radek Krejci | 290a6a5 | 2019-09-12 17:13:17 +0200 | [diff] [blame] | 99 | * @internal |
| 100 | * @page internals Developers' Notes |
| 101 | * @tableofcontents |
| 102 | * |
| 103 | * Following texts describes various internal subsystems and mechanism in libyang which are hidden from external users, but important |
| 104 | * for libyang developers. The texts should explain various decisions made and internal processes utilized in libyang. |
| 105 | */ |
| 106 | |
| 107 | /** |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 108 | * @page howtostructures Data Structures |
| 109 | * |
| 110 | * @section sizedarrays Sized Arrays |
| 111 | * |
| 112 | * The structure starts with 32bit number storing size of the array - the number of the items inside. The size is part of the |
Radek Krejci | 2c4e717 | 2018-10-19 15:56:26 +0200 | [diff] [blame] | 113 | * array to have it allocated together with the array itself only when it is needed. However, the pointers to the array always |
| 114 | * points after the 32b number, so items can be accessed directly as for standard C arrays. Because of a known size (available |
| 115 | * via ::LY_ARRAY_SIZE macro), it is not terminated by any special byte (sequence), so there is also no limitation for specific |
| 116 | * content of the stored records (e.g. that first byte must not be NULL). |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 117 | * |
Radek Krejci | 2c4e717 | 2018-10-19 15:56:26 +0200 | [diff] [blame] | 118 | * The sized arrays must be carefully freed (which should be done anyway only internally), since pointers to the sized arrays used |
| 119 | * in libyang structures, does not point to the beginning of the allocated space. |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 120 | * |
| 121 | * - ::LY_ARRAY_SIZE |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 122 | * - ::LY_ARRAY_FOR |
| 123 | * |
| 124 | * @section struct_lists Lists |
| 125 | * |
| 126 | * The lists are structures connected via a `next` pointer. Iterating over the siblings can be simply done by ::LY_LIST_FOR macro. |
| 127 | */ |
| 128 | |
Radek Krejci | 950f6a5 | 2019-09-12 17:15:32 +0200 | [diff] [blame] | 129 | /** |
| 130 | * @page howtoplugins Plugins |
| 131 | * |
| 132 | * libyang supports several types of plugins to better support generic features of YANG that need some specific code for |
| 133 | * their specific instances in YANG schemas. This is the case of YANG types, which are derived from YANG built-in types |
| 134 | * (which are implemented by libyang), but the description of the derived type can specify some additional requirements or |
| 135 | * restriction that cannot be implemented generically and some special code is needed. The second case for libyang plugins |
| 136 | * are YANG extensions. For YANG extensions, most of the specification stays in their description (e.g. allowed substatements |
| 137 | * or place of the extension instanciation) and libyang is not able to process such a text in a generic way. In both cases, |
| 138 | * libyang provides API to provide functionality implementing the specifics of each type or extension. |
| 139 | */ |
Radek Krejci | 0af5f5d | 2018-09-07 15:00:30 +0200 | [diff] [blame] | 140 | #ifdef __cplusplus |
| 141 | } |
| 142 | #endif |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 143 | |
| 144 | #endif /* LY_LIBYANG_H_ */ |