blob: 3c001fc891a00de0dd0491d01a15a98e4f803c75 [file] [log] [blame]
Radek Krejci5aeea3a2018-09-05 13:29:36 +02001/**
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 Krejci0af5f5d2018-09-07 15:00:30 +020018#include <stdint.h>
19
Radek Krejci5aeea3a2018-09-05 13:29:36 +020020#ifdef __cplusplus
21extern "C" {
22#endif
23
Radek Krejci6caa6ab2018-10-24 10:04:48 +020024#include "log.h"
25#include "set.h"
26#include "dict.h"
27#include "context.h"
28#include "tree_schema.h"
29
Radek Krejci5aeea3a2018-09-05 13:29:36 +020030/**
Radek Krejcie53a8dc2018-10-17 12:52:40 +020031 * @mainpage About
32 *
33 * libyang is a library implementing processing of the YANG schemas and data modeled by the YANG language. The
34 * library is implemented in C for GNU/Linux and provides C API.
35 *
36 * @section about-features Main Features
37 *
38 * - [Parsing (and validating) schemas](@ref howtoschemasparsers) in YANG format.
39 * - [Parsing (and validating) schemas](@ref howtoschemasparsers) in YIN format.
40 * - [Parsing, validating and printing instance data](@ref howtodata) in XML format.
41 * - [Parsing, validating and printing instance data](@ref howtodata) in JSON format
42 * ([RFC 7951](https://tools.ietf.org/html/rfc7951)).
43 * - [Manipulation with the instance data](@ref howtodatamanipulators).
44 * - Support for [default values in the instance data](@ref howtodatawd) ([RFC 6243](https://tools.ietf.org/html/rfc6243)).
45 * - Support for [YANG extensions and user types](@ref howtoschemaplugins).
46 * - Support for [YANG Metadata](@ref howtoschemametadata) ([RFC 7952](https://tools.ietf.org/html/rfc6243)).
47 *
48 * The current implementation covers YANG 1.0 ([RFC 6020](https://tools.ietf.org/html/rfc6020)) as well as
49 * YANG 1.1 ([RFC 7950](https://tools.ietf.org/html/rfc7950)).
50 *
51 * @section about-license License
52 *
53 * Copyright (c) 2015-2017 CESNET, z.s.p.o.
54 *
55 * (The BSD 3-Clause License)
56 *
57 * Redistribution and use in source and binary forms, with or without
58 * modification, are permitted provided that the following conditions
59 * are met:
60 * 1. Redistributions of source code must retain the above copyright
61 * notice, this list of conditions and the following disclaimer.
62 * 2. Redistributions in binary form must reproduce the above copyright
63 * notice, this list of conditions and the following disclaimer in
64 * the documentation and/or other materials provided with the
65 * distribution.
66 * 3. Neither the name of the Company nor the names of its contributors
67 * may be used to endorse or promote products derived from this
68 * software without specific prior written permission.
69 */
70
71/**
72 * @page howto How To ...
73 *
74 * - @subpage howtocontext
75 * - @subpage howtoschemas
76 * - @subpage howtodata
77 * - @subpage howtoxpath
78 * - @subpage howtoxml
79 * - @subpage howtothreads
80 * - @subpage howtologger
81 * - @subpage howtostructures
82 */
83
84/**
85 * @page howtostructures Data Structures
86 *
87 * @section sizedarrays Sized Arrays
88 *
89 * The structure starts with 32bit number storing size of the array - the number of the items inside. The size is part of the
Radek Krejci2c4e7172018-10-19 15:56:26 +020090 * array to have it allocated together with the array itself only when it is needed. However, the pointers to the array always
91 * points after the 32b number, so items can be accessed directly as for standard C arrays. Because of a known size (available
92 * via ::LY_ARRAY_SIZE macro), it is not terminated by any special byte (sequence), so there is also no limitation for specific
93 * content of the stored records (e.g. that first byte must not be NULL).
Radek Krejcie53a8dc2018-10-17 12:52:40 +020094 *
Radek Krejci2c4e7172018-10-19 15:56:26 +020095 * The sized arrays must be carefully freed (which should be done anyway only internally), since pointers to the sized arrays used
96 * in libyang structures, does not point to the beginning of the allocated space.
Radek Krejcie53a8dc2018-10-17 12:52:40 +020097 *
98 * - ::LY_ARRAY_SIZE
Radek Krejcie53a8dc2018-10-17 12:52:40 +020099 * - ::LY_ARRAY_FOR
100 *
101 * @section struct_lists Lists
102 *
103 * The lists are structures connected via a `next` pointer. Iterating over the siblings can be simply done by ::LY_LIST_FOR macro.
104 */
105
Radek Krejci0af5f5d2018-09-07 15:00:30 +0200106#ifdef __cplusplus
107}
108#endif
Radek Krejci5aeea3a2018-09-05 13:29:36 +0200109
110#endif /* LY_LIBYANG_H_ */