1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
* @file common.h
* @author Radek Krejci <rkrejci@cesnet.cz>
* @author Adam Piecek <piecek@cesnet.cz>
* @brief libyang's yanglint tool - common functions and definitions for both interactive and non-interactive mode.
*
* Copyright (c) 2023 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*/
/**
* @brief Default context creation options.
*/
/**
* @brief Default data parsing flags.
*/
/**
* @brief Default data validation flags.
*/
/**
* @brief log error message
*/
/**
* @brief log warning message
*/
;
/**
* @brief Log a yanglint message.
*
* @param[in] err Whether the message is an error or a warning.
* @param[in] format Message format.
* @param[in] ... Format arguments.
*/
void ;
/**
* @brief Parse path of a schema module file into the directory and module name.
*
* @param[in] path Schema module file path to be parsed.
* @param[out] dir Pointer to the directory path where the file resides. Caller is expected to free the returned string.
* @param[out] module Pointer to the name of the module (without file suffixes or revision information) specified by the
* @p path. Caller is expected to free the returned string.
* @return 0 on success
* @return -1 on error
*/
int ;
/**
* @brief Get input handler for the specified path.
*
* Using the @p format_schema and @p format_data the type of the file can be limited (by providing NULL) or it can be
* got known if both types are possible.
*
* @param[in] filepath Path of the file to open.
* @param[out] format_schema Format of the schema detected from the file name. If NULL specified, the schema formats are
* prohibited and such files are refused.
* @param[out] format_data Format of the data detected from the file name. If NULL specified, the data formats are
* prohibited and such files are refused.
* @param[out] in Created input handler referring the file behind the @p filepath. Can be NULL.
* @return 0 on success.
* @return -1 on failure.
*/
int ;
/**
* @brief Get schema format of the @p filename's content according to the @p filename's suffix.
*
* @param[in] filename Name of the file to examine.
* @return Detected schema input format.
*/
LYS_INFORMAT ;
/**
* @brief Get data format of the @p filename's content according to the @p filename's suffix.
*
* @param[in] filename Name of the file to examine.
* @return Detected data input format.
*/
LYD_FORMAT ;
/**
* @brief Get format of the @p filename's content according to the @p filename's suffix.
*
* Either the @p schema or @p data parameter is set.
*
* @param[in] filepath Name of the file to examine.
* @param[out] schema_form Pointer to a variable to store the input schema format.
* @param[out] data_form Pointer to a variable to store the expected input data format.
* @return zero in case a format was successfully detected.
* @return nonzero in case it is not possible to get valid format from the @p filename.
*/
int ;
/**
* @brief Get the node specified by the path.
*
* @param[in] ctx libyang context with schema.
* @param[in] schema_path Path to the wanted node.
* @return Pointer to the schema node specified by the path on success, NULL otherwise.
*/
const struct lysc_node *;
/**
* @brief General callback providing run-time extension instance data.
*
* @param[in] ext Compiled extension instance.
* @param[in] user_data User-supplied callback data.
* @param[out] ext_data Provided extension instance data.
* @param[out] ext_data_free Whether the extension instance should free @p ext_data or not.
* @return LY_ERR value.
*/
LY_ERR ;
/**
* @brief Concatenation of paths into one string.
*
* @param[in,out] searchpaths Collection of paths in the single string. Paths are delimited by colon ":"
* (on Windows, used semicolon ";" instead).
* @param[in] path Path to add.
* @return LY_ERR value.
*/
LY_ERR ;
/* COMMON_H_ */