Debian Codegraph @

src/CPE/public/cpe_lang.h

raw symbols SCIP
1 /**
2 * @addtogroup CPE
3 * @{
4 * @addtogroup cpelang CPE Language
5 * @{
6 *
7 * @image html cpe_language.png "Class diagram"
8 * @file cpe_lang.h
9 *
10 * @brief Interface to Common Platform Enumeration (CPE) Language
11 */
12
13 /*
14 * Copyright 2009--2014 Red Hat Inc., Durham, North Carolina.
15 * All Rights Reserved.
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 *
31 * Authors:
32 * Lukas Kuklinek <[email protected]>
33 * Maros Barabas <[email protected]>
34 */
35
36 #ifndef CPELANG_H_
37 #define CPELANG_H_cxx . . $ `src/CPE/public/cpe_lang.h:37:9`!
38
39 #include <stdlib.h>
40
41 #include "cpe_name.h"cxx . . $ `<file>/src/CPE/public/cpe_name.h`/
42 #include "oscap.h"cxx . . $ `<file>/src/common/public/oscap.h`/
43 #include "oscap_text.h"cxx . . $ `<file>/src/common/public/oscap_text.h`/
44 #include "oscap_source.h"cxx . . $ `<file>/src/source/public/oscap_source.h`/
45 #include "oscap_export.h"cxx . . $ `<file>/src/common/public/oscap_export.h`/
46
47 /**
48 * CPE language operators
49 */
50 typedef enumcxx . . $ $anonymous_type_ebdfe4a1ec68b912_0# {
51 CPE_LANG_OPER_INVALIDcxx . . $ CPE_LANG_OPER_INVALID. = 0x00, ///< invalid or unknown operation
52 CPE_LANG_OPER_ANDcxx . . $ CPE_LANG_OPER_AND. = 0x01, ///< logical AND
53 CPE_LANG_OPER_ORcxx . . $ CPE_LANG_OPER_OR. = 0x02, ///< logical OR
54 CPE_LANG_OPER_MATCHcxx . . $ CPE_LANG_OPER_MATCH. = 0x04, ///< fact-ref = match given CPE name against available dictionaries
55 CPE_LANG_OPER_CHECKcxx . . $ CPE_LANG_OPER_CHECK. = 0x08, ///< check-ref = evaluate given check
56
57 CPE_LANG_OPER_MASKcxx . . $ CPE_LANG_OPER_MASK. = 0xFF, ///< mask to extract the operator w/o possible negation
58 CPE_LANG_OPER_NOTcxx . . $ CPE_LANG_OPER_NOT. = 0x100, ///< negate
59
60 CPE_LANG_OPER_NANDcxx . . $ CPE_LANG_OPER_NAND. = CPE_LANG_OPER_ANDcxx . . $ CPE_LANG_OPER_AND. | CPE_LANG_OPER_NOTcxx . . $ CPE_LANG_OPER_NOT.,
61 CPE_LANG_OPER_NORcxx . . $ CPE_LANG_OPER_NOR. = CPE_LANG_OPER_ORcxx . . $ CPE_LANG_OPER_OR. | CPE_LANG_OPER_NOTcxx . . $ CPE_LANG_OPER_NOT.,
62 } cpe_lang_oper_tcxx . . $ cpe_lang_oper_t#;
63
64 /**
65 * @struct cpe_lang_model
66 * CPE platform specification
67 */
68 struct cpe_lang_modelcxx . . $ cpe_lang_model#;
69
70 /**
71 * @struct cpe_platform
72 * Single platform representation in CPE language
73 */
74 struct cpe_platformcxx . . $ cpe_platform#;
75
76 /**
77 * @struct cpe_testexpr
78 * CPE language boolean expression
79 */
80 struct cpe_testexprcxx . . $ cpe_testexpr#;
81
82
83 /************************************************************/
84 /**
85 * @name Iterators
86 * @{
87 * */
88
89 /**
90 * @struct cpe_platform_iterator
91 * Iterator over CPE dictionary items.
92 * @see oscap_iterator
93 */
94 struct cpe_platform_iteratorcxx . . $ cpe_platform_iterator#;
95
96 /// @memberof cpe_platform_iterator
97 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_platformcxx . . $ cpe_platform# *cpe_platform_iterator_nextcxx . . $ cpe_platform_iterator_next(7f7c1d7dc803cfdc).(struct cpe_platform_iteratorcxx . . $ cpe_platform_iterator# *it);
98 /// @memberof cpe_platform_iterator
99 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_platform_iterator_has_morecxx . . $ cpe_platform_iterator_has_more(65e2cbd4785c2551).(struct cpe_platform_iteratorcxx . . $ cpe_platform_iterator# *it);
100 /// @memberof cpe_platform_iterator
101 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_platform_iterator_freecxx . . $ cpe_platform_iterator_free(4e5f942f423c69bd).(struct cpe_platform_iteratorcxx . . $ cpe_platform_iterator# *it);
102
103 /**
104 * @struct cpe_testexpr_iterator
105 * Iterator over CPE language expressions.
106 * @see oscap_iterator
107 */
108 struct cpe_testexpr_iteratorcxx . . $ cpe_testexpr_iterator#;
109 /// @memberof cpe_testexpr_iterator
110 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_testexprcxx . . $ cpe_testexpr# *cpe_testexpr_iterator_nextcxx . . $ cpe_testexpr_iterator_next(ad067f1041d5ea06).(struct cpe_testexpr_iteratorcxx . . $ cpe_testexpr_iterator# *it);
111 /// @memberof cpe_testexpr_iterator
112 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_testexpr_iterator_has_morecxx . . $ cpe_testexpr_iterator_has_more(536763e4ec1e10be).(struct cpe_testexpr_iteratorcxx . . $ cpe_testexpr_iterator# *it);
113 /// @memberof cpe_testexpr_iterator
114 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_testexpr_iterator_freecxx . . $ cpe_testexpr_iterator_free(5de3cf5f18e21d56).(struct cpe_testexpr_iteratorcxx . . $ cpe_testexpr_iterator# *it);
115
116 /************************************************************/
117 /** @} End of Iterators group */
118
119 /************************************************************/
120 /**
121 * @name Getters
122 * Return value is pointer to structure's member. Do not free unless you null the pointer in the structure.
123 * Use remove function otherwise.
124 * @{
125 * */
126
127 /**
128 * cpe_testexpr functions to get variable members
129 * @memberof cpe_testexpr
130 */
131 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! cpe_lang_oper_tcxx . . $ cpe_lang_oper_t# cpe_testexpr_get_opercxx . . $ cpe_testexpr_get_oper(3e064e29640ede32).(const struct cpe_testexprcxx . . $ cpe_testexpr# *item);
132
133 /**
134 * Get CPE expression subexpression.
135 * Not valid for CPE_LANG_OPER_MATCH operation.
136 * @memberof cpe_testexpr
137 */
138 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_testexpr_iteratorcxx . . $ cpe_testexpr_iterator# *cpe_testexpr_get_meta_exprcxx . . $ cpe_testexpr_get_meta_expr(dc0b6fbbcdcf7a54).(const struct cpe_testexprcxx . . $ cpe_testexpr# *item);
139
140 /**
141 * Get CPE name to match against.
142 * Only valid for CPE_LANG_OPER_MATCH.
143 * @memberof cpe_testexpr
144 */
145 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const struct cpe_namecxx . . $ cpe_name# *cpe_testexpr_get_meta_cpecxx . . $ cpe_testexpr_get_meta_cpe(c4e3bde4985cd277).(const struct cpe_testexprcxx . . $ cpe_testexpr# *item);
146
147 /**
148 * Get check system to evaluate
149 * Only valid for CPE_LANG_OPER_CHECK.
150 * @memberof cpe_testexpr
151 */
152 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char* cpe_testexpr_get_meta_check_systemcxx . . $ cpe_testexpr_get_meta_check_system(7874a5a4db6d0ea3).(const struct cpe_testexprcxx . . $ cpe_testexpr# *item);
153
154 /**
155 * Get check href to evaluate
156 * Only valid for CPE_LANG_OPER_CHECK.
157 * @memberof cpe_testexpr
158 */
159 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char* cpe_testexpr_get_meta_check_hrefcxx . . $ cpe_testexpr_get_meta_check_href(7874a5a4db6d0ea3).(const struct cpe_testexprcxx . . $ cpe_testexpr# *item);
160
161 /**
162 * Get check idref to evaluate
163 * Only valid for CPE_LANG_OPER_CHECK.
164 * @memberof cpe_testexpr
165 */
166 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char* cpe_testexpr_get_meta_check_idcxx . . $ cpe_testexpr_get_meta_check_id(7874a5a4db6d0ea3).(const struct cpe_testexprcxx . . $ cpe_testexpr# *item);
167
168 /**
169 * Function to get next expr from array
170 * @param expr CPE Test expression structure
171 * @memberof cpe_testexpr
172 */
173 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const struct cpe_testexprcxx . . $ cpe_testexpr# *cpe_testexpr_get_nextcxx . . $ cpe_testexpr_get_next(9c239aeae8429e37).(const struct cpe_testexprcxx . . $ cpe_testexpr# *expr);
174
175 /**
176 * cpe_lang_model function to get CPE platforms
177 * @memberof cpe_lang_model
178 */
179 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_platform_iteratorcxx . . $ cpe_platform_iterator# *cpe_lang_model_get_platformscxx . . $ cpe_lang_model_get_platforms(f2dcce499b3da7f).(const struct cpe_lang_modelcxx . . $ cpe_lang_model# *item);
180
181 /**
182 * cpe_lang_model function to get CPE platforms
183 * @memberof cpe_lang_model
184 */
185 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_platformcxx . . $ cpe_platform# *cpe_lang_model_get_itemcxx . . $ cpe_lang_model_get_item(dc6ef1735840ff3a).(const struct cpe_lang_modelcxx . . $ cpe_lang_model# *item, const char *key);
186
187 /**
188 * Verify whether given CPE platform idref is applicable by evaluating test expression associated with it
189 *
190 * @memberof cpe_lang_model
191 * @param platform idref to the platform to verify (do not pass with "#" prepended)
192 * @param lang_model used CPE language model
193 * @return true if lang model contains given platform and the platform is applicable
194 */
195 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_platform_applicable_lang_modelcxx . . $ cpe_platform_applicable_lang_model(1e40406a95e00665).(const char* platform, struct cpe_lang_modelcxx . . $ cpe_lang_model# *lang_model, cpe_check_fncxx . . $ cpe_check_fn# check_cb, cpe_dict_fncxx . . $ cpe_dict_fn# dict_cb, void* usr);
196
197 /**
198 * cpe_platform functions to get id
199 * @memberof cpe_platform
200 */
201 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char *cpe_platform_get_idcxx . . $ cpe_platform_get_id(c66f80c0d9ba7afc).(const struct cpe_platformcxx . . $ cpe_platform# *item);
202 /**
203 * cpe_platform functions to get remark
204 * @memberof cpe_platform
205 */
206 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char *cpe_platform_get_remarkcxx . . $ cpe_platform_get_remark(c66f80c0d9ba7afc).(const struct cpe_platformcxx . . $ cpe_platform# *item);
207 /**
208 * cpe_platform functions to get titles
209 * @memberof cpe_platform
210 */
211 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *cpe_platform_get_titlescxx . . $ cpe_platform_get_titles(de4ad9073264bbca).(const struct cpe_platformcxx . . $ cpe_platform# *item);
212 /**
213 * cpe_platform functions to get test expression
214 * @memberof cpe_platform
215 */
216 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const struct cpe_testexprcxx . . $ cpe_testexpr# *cpe_platform_get_exprcxx . . $ cpe_platform_get_expr(bf8f903aa86dc72).(const struct cpe_platformcxx . . $ cpe_platform# *item);
217
218 /************************************************************/
219 /** @} End of Getters group */
220
221 /************************************************************/
222 /**
223 * @name Setters
224 * For lists use add functions. Parameters of set functions are duplicated in memory and need to
225 * be freed by caller.
226 * @{
227 */
228
229 /**
230 * Add platform to CPE lang model
231 * @memberof cpe_lang_model
232 */
233 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_lang_model_add_platformcxx . . $ cpe_lang_model_add_platform(432b66e9f8294365).(struct cpe_lang_modelcxx . . $ cpe_lang_model# *lang, struct cpe_platformcxx . . $ cpe_platform# *platform);
234 /**
235 * Add title to platform
236 * @memberof cpe_platform
237 */
238 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_platform_add_titlecxx . . $ cpe_platform_add_title(b0ced5501bd91d4c).(struct cpe_platformcxx . . $ cpe_platform# *platform, struct oscap_textcxx . . $ oscap_text# *title);
239
240 /**
241 * Add XML namespace to CPE lang model
242 * @memberof cpe_lang_model
243 */
244 /*bool cpe_lang_model_add_xmlns(struct cpe_lang_model * model, struct xml_metadata * xml);*/
245
246 /**
247 * Add an subexpression to a compound CPE language expression.
248 *
249 * Expression has to be of type CPE_LANG_OPER_AND or CPE_LANG_OPER_OR, possibly with negation.
250 * @memberof cpe_testexpr
251 */
252 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_testexpr_add_subexpressioncxx . . $ cpe_testexpr_add_subexpression(b7ea1134ea321da0).(struct cpe_testexprcxx . . $ cpe_testexpr# *expr, struct cpe_testexprcxx . . $ cpe_testexpr# *sub);
253
254 /**
255 * Set ID of CPE platform
256 * @memberof cpe_platform
257 */
258 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_platform_set_idcxx . . $ cpe_platform_set_id(634074294dfedd80).(struct cpe_platformcxx . . $ cpe_platform# *platform, const char *new_id);
259 /**
260 * Set remark of CPE platform
261 * @memberof cpe_platform
262 */
263 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_platform_set_remarkcxx . . $ cpe_platform_set_remark(634074294dfedd80).(struct cpe_platformcxx . . $ cpe_platform# *platform, const char *new_remark);
264 /**
265 * Set evaluation expression for this CPE platform.
266 *
267 * Expression has to be a logical-test (i.e. its operation shall be AND or OR, possibly with negation)
268 * @memberof cpe_platform
269 */
270 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_platform_set_exprcxx . . $ cpe_platform_set_expr(2c554d0f1d06047).(struct cpe_platformcxx . . $ cpe_platform# *platform, struct cpe_testexprcxx . . $ cpe_testexpr# *expr);
271 /**
272 * Set CPE operation.
273 *
274 * Any subexpressions and CPE names associated with this expression will be removed.
275 * @memberof cpe_testexpr
276 */
277 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_testexpr_set_opercxx . . $ cpe_testexpr_set_oper(a81c4f4860bbd256).(struct cpe_testexprcxx . . $ cpe_testexpr# *expr, cpe_lang_oper_tcxx . . $ cpe_lang_oper_t# oper);
278
279 /**
280 * Set CPE name.
281 *
282 * If the expression does not have type CPE_LANG_OPER_MATCH,
283 * this function has no effect and returns false.
284 * @memberof cpe_testexpr
285 */
286 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! cpe_testexpr_set_namecxx . . $ cpe_testexpr_set_name(4b6b2c5f1efb8515).(struct cpe_testexprcxx . . $ cpe_testexpr# *expr, struct cpe_namecxx . . $ cpe_name# *name);
287
288 /************************************************************/
289 /** @} End of Setters group */
290
291 /// @memberof cpe_platform_iterator
292 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_platform_iterator_removecxx . . $ cpe_platform_iterator_remove(64b2b482953f5a20).(struct cpe_platform_iteratorcxx . . $ cpe_platform_iterator# *it, struct cpe_lang_modelcxx . . $ cpe_lang_model# *parent);
293 /// @memberof cpe_testexpr_iterator
294 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_platform_iterator_resetcxx . . $ cpe_platform_iterator_reset(4e5f942f423c69bd).(struct cpe_platform_iteratorcxx . . $ cpe_platform_iterator# *it);
295
296 /**
297 * Constructor of CPE Language model
298 * @memberof cpe_lang_model
299 */
300 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_lang_modelcxx . . $ cpe_lang_model# *cpe_lang_model_newcxx . . $ cpe_lang_model_new(10106115398edfb7).(void);
301
302 /**
303 * Constructor of CPE test expression
304 * @memberof cpe_testexpr
305 */
306 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_testexprcxx . . $ cpe_testexpr# *cpe_testexpr_newcxx . . $ cpe_testexpr_new(978cee8b60e30924).(void);
307
308 /**
309 * Constructor of CPE Platform
310 * @memberof cpe_platform
311 */
312 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_platformcxx . . $ cpe_platform# *cpe_platform_newcxx . . $ cpe_platform_new(384f5286090d0f0e).(void);
313
314 /**
315 * Clone CPE test expression
316 * @param old_expr CPE test expression
317 * @memberof cpe_testexpr
318 */
319 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_testexprcxx . . $ cpe_testexpr# * cpe_testexpr_clonecxx . . $ cpe_testexpr_clone(1b84d5fe86fb2d1c).(struct cpe_testexprcxx . . $ cpe_testexpr# * old_expr);
320
321 /**
322 * Free function of CPE test expression
323 * @memberof cpe_testexpr
324 */
325 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_testexpr_freecxx . . $ cpe_testexpr_free(b690e72de733ed28).(struct cpe_testexprcxx . . $ cpe_testexpr# *expr);
326
327 /**
328 * Reset function of CPE test expression
329 * @memberof cpe_testexpr
330 */
331 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_testexpr_iterator_resetcxx . . $ cpe_testexpr_iterator_reset(5de3cf5f18e21d56).(struct cpe_testexpr_iteratorcxx . . $ cpe_testexpr_iterator# *it);
332
333 /**
334 * Free function of CPE test expression
335 * @memberof cpe_lang_model
336 */
337 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_lang_model_freecxx . . $ cpe_lang_model_free(c742481f50ae5bc0).(struct cpe_lang_modelcxx . . $ cpe_lang_model# *platformspec);
338
339 /**
340 * Free function of CPE Platform
341 * @memberof cpe_platform
342 */
343 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_platform_freecxx . . $ cpe_platform_free(8682ed6dccd22538).(struct cpe_platformcxx . . $ cpe_platform# *platform);
344
345 /************************************************************/
346 /**
347 * @name Evaluators
348 * @{
349 * */
350
351 /**
352 * Get supported version of CPE language XML
353 * @return version of XML file format
354 * @memberof cpe_lang_model
355 */
356 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char * cpe_lang_model_supportedcxx . . $ cpe_lang_model_supported(33a1f659e94feb42).(void);
357
358 /************************************************************/
359 /** @} End of Evaluators group */
360
361 /**
362 * Load CPE language model from an oscap_source.
363 * @memberof cpe_lang_model
364 */
365 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct cpe_lang_modelcxx . . $ cpe_lang_model# *cpe_lang_model_import_sourcecxx . . $ cpe_lang_model_import_source(f203883dd62a12b8).(struct oscap_sourcecxx . . $ oscap_source# *source);
366
367 /**
368 * Write the lang_model to a file.
369 * @memberof cpe_lang_model
370 * @param spec CPE lang model
371 * @param file filename
372 */
373 OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void cpe_lang_model_exportcxx . . $ cpe_lang_model_export(4858f5190288acad).(const struct cpe_lang_modelcxx . . $ cpe_lang_model# *spec, const char *file);
374
375 /**@}*/
376
377 /**@}*/
378
379 #endif /* _CPELANG_H_ */