blob: 588f63abbe7d71939c54d1e2941875ee0357a5fb [file] [log] [blame]
Radek Krejcid7e8a622018-10-29 15:54:55 +01001/**
2 * @file extesnions.h
3 * @author Radek Krejci <rkrejci@cesnet.cz>
4 * @brief libyang support for YANG extensions implementation.
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_EXTENSIONS_H_
16#define LY_EXTENSIONS_H_
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/**
23 * @defgroup extensions YANG Extensions
24 *
25 * @{
26 */
27
28/**
29 * @brief Extension instance structure parent enumeration
30 */
31typedef enum {
32 LYEXT_PAR_MODULE, /**< ::lys_module or ::lys_submodule */
33 LYEXT_PAR_NODE, /**< ::lys_node (and the derived structures) */
34 LYEXT_PAR_TPDF, /**< ::lys_tpdf */
35 LYEXT_PAR_TYPE, /**< ::lys_type */
36 LYEXT_PAR_TYPE_BIT, /**< ::lys_type_bit */
37 LYEXT_PAR_TYPE_ENUM, /**< ::lys_type_enum */
38 LYEXT_PAR_FEATURE, /**< ::lys_feature */
39 LYEXT_PAR_RESTR, /**< ::lys_restr - YANG's must, range, length and pattern statements */
40 LYEXT_PAR_WHEN, /**< ::lys_when */
41 LYEXT_PAR_IDENT, /**< ::lys_ident */
42 LYEXT_PAR_EXT, /**< ::lys_ext */
43 LYEXT_PAR_EXTINST, /**< ::lys_ext_instance */
44 LYEXT_PAR_REFINE, /**< ::lys_refine */
45 LYEXT_PAR_DEVIATION, /**< ::lys_deviation */
46 LYEXT_PAR_DEVIATE, /**< ::lys_deviate */
47 LYEXT_PAR_IMPORT, /**< ::lys_import */
48 LYEXT_PAR_INCLUDE, /**< ::lysp_include */
49 LYEXT_PAR_REVISION, /**< ::lysc_revision */
50} LYEXT_PARENT;
51
52/**
53 * @brief Enum of substatements in which extension instances can appear.
54 */
55typedef enum {
56 LYEXT_SUBSTMT_SELF = 0, /**< extension of the structure itself, not substatement's */
57 LYEXT_SUBSTMT_ARGUMENT, /**< extension of the argument statement, can appear in lys_ext */
58 LYEXT_SUBSTMT_BASE, /**< extension of the base statement, can appear (repeatedly) in lys_type and lys_ident */
59 LYEXT_SUBSTMT_BELONGSTO, /**< extension of the belongs-to statement, can appear in lys_submodule */
60 LYEXT_SUBSTMT_CONTACT, /**< extension of the contact statement, can appear in lys_module */
61 LYEXT_SUBSTMT_DEFAULT, /**< extension of the default statement, can appear in lys_node_leaf, lys_node_leaflist,
62 lys_node_choice and lys_deviate */
63 LYEXT_SUBSTMT_DESCRIPTION, /**< extension of the description statement, can appear in lys_module, lys_submodule,
64 lys_node, lys_import, lys_include, lys_ext, lys_feature, lys_tpdf, lys_restr,
65 lys_ident, lys_deviation, lys_type_enum, lys_type_bit, lys_when and lys_revision */
66 LYEXT_SUBSTMT_ERRTAG, /**< extension of the error-app-tag statement, can appear in lys_restr */
67 LYEXT_SUBSTMT_ERRMSG, /**< extension of the error-message statement, can appear in lys_restr */
68 LYEXT_SUBSTMT_KEY, /**< extension of the key statement, can appear in lys_node_list */
69 LYEXT_SUBSTMT_NAMESPACE, /**< extension of the namespace statement, can appear in lys_module */
70 LYEXT_SUBSTMT_ORGANIZATION, /**< extension of the organization statement, can appear in lys_module and lys_submodule */
71 LYEXT_SUBSTMT_PATH, /**< extension of the path statement, can appear in lys_type */
72 LYEXT_SUBSTMT_PREFIX, /**< extension of the prefix statement, can appear in lys_module, lys_submodule (for
73 belongs-to's prefix) and lys_import */
74 LYEXT_SUBSTMT_PRESENCE, /**< extension of the presence statement, can appear in lys_node_container */
75 LYEXT_SUBSTMT_REFERENCE, /**< extension of the reference statement, can appear in lys_module, lys_submodule,
76 lys_node, lys_import, lys_include, lys_revision, lys_tpdf, lys_restr, lys_ident,
77 lys_ext, lys_feature, lys_deviation, lys_type_enum, lys_type_bit and lys_when */
78 LYEXT_SUBSTMT_REVISIONDATE, /**< extension of the revision-date statement, can appear in lys_import and lys_include */
79 LYEXT_SUBSTMT_UNITS, /**< extension of the units statement, can appear in lys_tpdf, lys_node_leaf,
80 lys_node_leaflist and lys_deviate */
81 LYEXT_SUBSTMT_VALUE, /**< extension of the value statement, can appear in lys_type_enum */
82 LYEXT_SUBSTMT_VERSION, /**< extension of the yang-version statement, can appear in lys_module and lys_submodule */
83 LYEXT_SUBSTMT_MODIFIER, /**< extension of the modifier statement, can appear in lys_restr */
84 LYEXT_SUBSTMT_REQINSTANCE, /**< extension of the require-instance statement, can appear in lys_type */
85 LYEXT_SUBSTMT_YINELEM, /**< extension of the yin-element statement, can appear in lys_ext */
86 LYEXT_SUBSTMT_CONFIG, /**< extension of the config statement, can appear in lys_node and lys_deviate */
87 LYEXT_SUBSTMT_MANDATORY, /**< extension of the mandatory statement, can appear in lys_node_leaf, lys_node_choice,
88 lys_node_anydata and lys_deviate */
89 LYEXT_SUBSTMT_ORDEREDBY, /**< extension of the ordered-by statement, can appear in lys_node_list and lys_node_leaflist */
90 LYEXT_SUBSTMT_STATUS, /**< extension of the status statement, can appear in lys_tpdf, lys_node, lys_ident,
91 lys_ext, lys_feature, lys_type_enum and lys_type_bit */
92 LYEXT_SUBSTMT_FRACDIGITS, /**< extension of the fraction-digits statement, can appear in lys_type */
93 LYEXT_SUBSTMT_MAX, /**< extension of the max-elements statement, can appear in lys_node_list,
94 lys_node_leaflist and lys_deviate */
95 LYEXT_SUBSTMT_MIN, /**< extension of the min-elements statement, can appear in lys_node_list,
96 lys_node_leaflist and lys_deviate */
97 LYEXT_SUBSTMT_POSITION, /**< extension of the position statement, can appear in lys_type_bit */
98 LYEXT_SUBSTMT_UNIQUE, /**< extension of the unique statement, can appear in lys_node_list and lys_deviate */
99 LYEXT_SUBSTMT_IFFEATURE, /**< extension of the if-feature statement */
100} LYEXT_SUBSTMT;
101
102/** @} */
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif /* LY_TREE_SCHEMA_H_ */