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 | ca376bd | 2020-06-11 16:04:06 +0200 | [diff] [blame] | 24 | #include "context.h" |
| 25 | #include "dict.h" |
Michal Vasko | afac782 | 2020-10-20 14:22:26 +0200 | [diff] [blame] | 26 | #include "in.h" |
Radek Krejci | 47fab89 | 2020-11-05 17:02:41 +0100 | [diff] [blame] | 27 | #include "log.h" |
| 28 | #include "out.h" |
Radek Krejci | 7931b19 | 2020-06-25 17:05:03 +0200 | [diff] [blame] | 29 | #include "parser_data.h" |
Radek Krejci | f0e1ba5 | 2020-05-22 15:14:35 +0200 | [diff] [blame] | 30 | #include "parser_schema.h" |
Radek Krejci | f0e1ba5 | 2020-05-22 15:14:35 +0200 | [diff] [blame] | 31 | #include "printer_data.h" |
| 32 | #include "printer_schema.h" |
Radek Krejci | 6caa6ab | 2018-10-24 10:04:48 +0200 | [diff] [blame] | 33 | #include "set.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" |
| 37 | |
Radek Krejci | 47fab89 | 2020-11-05 17:02:41 +0100 | [diff] [blame] | 38 | /* |
| 39 | * The following headers are supposed to be included explicitly: |
| 40 | * - plugins_types.h |
| 41 | * - plugins_exts.h |
| 42 | */ |
| 43 | |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 44 | /** |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 45 | * @mainpage About |
| 46 | * |
| 47 | * libyang is a library implementing processing of the YANG schemas and data modeled by the YANG language. The |
| 48 | * library is implemented in C for GNU/Linux and provides C API. |
| 49 | * |
| 50 | * @section about-features Main Features |
| 51 | * |
Radek Krejci | 8678fa4 | 2020-08-18 16:07:28 +0200 | [diff] [blame] | 52 | * - [Parsing (and validating) schemas](@ref howtoSchema) in YANG format. |
| 53 | * - [Parsing (and validating) schemas](@ref howtoSchema) in YIN format. |
| 54 | * - [Parsing, validating and printing instance data](@ref howtoData) in XML format. |
| 55 | * - [Parsing, validating and printing instance data](@ref howtoData) in JSON format |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 56 | * ([RFC 7951](https://tools.ietf.org/html/rfc7951)). |
Radek Krejci | 8678fa4 | 2020-08-18 16:07:28 +0200 | [diff] [blame] | 57 | * - [Manipulation with the instance data](@ref howtoDataManipulation). |
| 58 | * - Support for [default values in the instance data](@ref howtoDataWD) ([RFC 6243](https://tools.ietf.org/html/rfc6243)). |
| 59 | * - Support for [YANG extensions and user types](@ref howtoPlugins). |
Radek Krejci | 7510412 | 2021-04-01 15:37:45 +0200 | [diff] [blame^] | 60 | * - Support for [YANG Metadata](@ref howtoDataMetadata) ([RFC 7952](https://tools.ietf.org/html/rfc6243)). |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 61 | * |
| 62 | * The current implementation covers YANG 1.0 ([RFC 6020](https://tools.ietf.org/html/rfc6020)) as well as |
| 63 | * YANG 1.1 ([RFC 7950](https://tools.ietf.org/html/rfc7950)). |
| 64 | * |
| 65 | * @section about-license License |
| 66 | * |
Radek Krejci | 7510412 | 2021-04-01 15:37:45 +0200 | [diff] [blame^] | 67 | * Copyright (c) 2015-2021 CESNET, z.s.p.o. |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 68 | * |
| 69 | * (The BSD 3-Clause License) |
| 70 | * |
| 71 | * Redistribution and use in source and binary forms, with or without |
| 72 | * modification, are permitted provided that the following conditions |
| 73 | * are met: |
| 74 | * 1. Redistributions of source code must retain the above copyright |
| 75 | * notice, this list of conditions and the following disclaimer. |
| 76 | * 2. Redistributions in binary form must reproduce the above copyright |
| 77 | * notice, this list of conditions and the following disclaimer in |
| 78 | * the documentation and/or other materials provided with the |
| 79 | * distribution. |
| 80 | * 3. Neither the name of the Company nor the names of its contributors |
| 81 | * may be used to endorse or promote products derived from this |
| 82 | * software without specific prior written permission. |
| 83 | */ |
| 84 | |
| 85 | /** |
Radek Krejci | 52785a2 | 2019-09-11 12:57:26 +0200 | [diff] [blame] | 86 | * @page howto libyang API Overview |
Radek Krejci | e53a8dc | 2018-10-17 12:52:40 +0200 | [diff] [blame] | 87 | * |
Radek Krejci | 8678fa4 | 2020-08-18 16:07:28 +0200 | [diff] [blame] | 88 | * @section howtoGeneral General notes |
| 89 | * |
| 90 | * libyang is primarily intended for handling data modeled by YANG modeling language, so the library is supposed to be optimized |
| 91 | * for this purpose. However, as a side effect, the library has to be able precisely process YANG modules. Thus, it is usable by |
| 92 | * YANG module authors to validate their modules and schemas in the development process. |
| 93 | * |
| 94 | * - @subpage howtoStructures |
| 95 | * - @subpage howtoErrors |
| 96 | * - @subpage howtoLogger |
| 97 | * - @subpage howtoThreads |
| 98 | * - @subpage howtoContext |
Michal Vasko | afac782 | 2020-10-20 14:22:26 +0200 | [diff] [blame] | 99 | * - @subpage howtoInput |
| 100 | * - @subpage howtoOutput |
Radek Krejci | 8678fa4 | 2020-08-18 16:07:28 +0200 | [diff] [blame] | 101 | * - @subpage howtoSchema |
| 102 | * - @subpage howtoData |
| 103 | * - @subpage howtoXPath |
| 104 | * - @subpage howtoPlugins |
| 105 | */ |
| 106 | |
| 107 | /** |
| 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 |
| 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_COUNT 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). |
| 117 | * |
| 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. |
| 120 | * |
| 121 | * - ::LY_ARRAY_COUNT |
| 122 | * - ::LY_ARRAY_FOR |
| 123 | * |
| 124 | * @section struct_lists Lists |
| 125 | * |
| 126 | * The lists are structures connected via a `next` and `prev` pointers. Iterating over the siblings can be simply done by |
| 127 | * ::LY_LIST_FOR macro. Examples of such structures are ::lyd_node or ::lysc_node. |
| 128 | * |
| 129 | * The `prev` pointer is always filled. In case there is just a single item in the list, the `prev` pointer points to the |
| 130 | * item itself. Otherwise, the `prev` pointer of the first item points to the last item of the list. In contrast, the |
| 131 | * `next` pointer of the last item in the list is always NULL. |
| 132 | */ |
| 133 | |
| 134 | /** |
Radek Krejci | 290a6a5 | 2019-09-12 17:13:17 +0200 | [diff] [blame] | 135 | * @internal |
| 136 | * @page internals Developers' Notes |
| 137 | * @tableofcontents |
| 138 | * |
| 139 | * Following texts describes various internal subsystems and mechanism in libyang which are hidden from external users, but important |
| 140 | * for libyang developers. The texts should explain various decisions made and internal processes utilized in libyang. |
| 141 | */ |
| 142 | |
Radek Krejci | 0af5f5d | 2018-09-07 15:00:30 +0200 | [diff] [blame] | 143 | #ifdef __cplusplus |
| 144 | } |
| 145 | #endif |
Radek Krejci | 5aeea3a | 2018-09-05 13:29:36 +0200 | [diff] [blame] | 146 | |
| 147 | #endif /* LY_LIBYANG_H_ */ |