Open SCAP Library
cpe_lang.h
Go to the documentation of this file.
1 
13 /*
14  * Copyright 2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  *
31  * Authors:
32  * Lukas Kuklinek <lkuklinek@redhat.com>
33  * Maros Barabas <mbarabas@redhat.com>
34  */
35 
36 #ifndef CPELANG_H_
37 #define CPELANG_H_
38 
39 #include <stdlib.h>
40 
41 #include "cpe_name.h"
42 #include "oscap_text.h"
43 
47 typedef enum {
53 
56 
57  CPE_LANG_OPER_NAND = CPE_LANG_OPER_AND | CPE_LANG_OPER_NOT,
58  CPE_LANG_OPER_NOR = CPE_LANG_OPER_OR | CPE_LANG_OPER_NOT,
60 
65 struct cpe_lang_model;
66 
71 struct cpe_platform;
72 
77 struct cpe_testexpr;
78 
79 
80 /************************************************************/
92 
99 
105 struct cpe_testexpr_iterator;
112 
113 /************************************************************/
116 /************************************************************/
129 
136 
142 const struct cpe_name *cpe_testexpr_get_meta_cpe(const struct cpe_testexpr *item);
143 
149 const char* cpe_testexpr_get_meta_check_system(const struct cpe_testexpr *item);
150 
156 const char* cpe_testexpr_get_meta_check_href(const struct cpe_testexpr *item);
157 
163 const char* cpe_testexpr_get_meta_check_id(const struct cpe_testexpr *item);
164 
170 const struct cpe_testexpr *cpe_testexpr_get_next(const struct cpe_testexpr *expr);
171 
177 
182 struct cpe_platform *cpe_lang_model_get_item(const struct cpe_lang_model *item, const char *key);
183 
192 bool cpe_platform_applicable_lang_model(const char* platform, struct cpe_lang_model *lang_model, cpe_check_fn check_cb, cpe_dict_fn dict_cb, void* usr);
193 
198 const char *cpe_platform_get_id(const struct cpe_platform *item);
203 const char *cpe_platform_get_remark(const struct cpe_platform *item);
208 struct oscap_text_iterator *cpe_platform_get_titles(const struct cpe_platform *item);
213 const struct cpe_testexpr *cpe_platform_get_expr(const struct cpe_platform *item);
214 
215 /************************************************************/
218 /************************************************************/
230 bool cpe_lang_model_add_platform(struct cpe_lang_model *lang, struct cpe_platform *platform);
235 bool cpe_platform_add_title(struct cpe_platform *platform, struct oscap_text *title);
236 
241 /*bool cpe_lang_model_add_xmlns(struct cpe_lang_model * model, struct xml_metadata * xml);*/
242 
250 
255 bool cpe_platform_set_id(struct cpe_platform *platform, const char *new_id);
260 bool cpe_platform_set_remark(struct cpe_platform *platform, const char *new_remark);
267 bool cpe_platform_set_expr(struct cpe_platform *platform, struct cpe_testexpr *expr);
275 
283 bool cpe_testexpr_set_name(struct cpe_testexpr *expr, struct cpe_name *name);
284 
285 /************************************************************/
288 
289 void cpe_platform_iterator_remove(struct cpe_platform_iterator *it, struct cpe_lang_model *parent);
292 
297 struct cpe_lang_model *cpe_lang_model_new(void);
298 
303 struct cpe_testexpr *cpe_testexpr_new(void);
304 
309 struct cpe_platform *cpe_platform_new(void);
310 
316 struct cpe_testexpr * cpe_testexpr_clone(struct cpe_testexpr * old_expr);
317 
322 void cpe_testexpr_free(struct cpe_testexpr *expr);
323 
329 
334 void cpe_lang_model_free(struct cpe_lang_model *platformspec);
335 
340 void cpe_platform_free(struct cpe_platform *platform);
341 
342 /************************************************************/
353 const char * cpe_lang_model_supported(void);
354 
359 char * cpe_lang_model_detect_version(const char* file);
360 
368 bool cpe_platform_match_cpe(struct cpe_name **cpe, size_t n, const struct cpe_platform *platform);
369 
370 /************************************************************/
377 struct cpe_lang_model *cpe_lang_model_import(const char *file);
378 
384 bool cpe_lang_model_set_origin_file(struct cpe_lang_model* lang_model, const char* origin_file);
385 
393 const char* cpe_lang_model_get_origin_file(const struct cpe_lang_model* lang_model);
394 
401 void cpe_lang_model_export(const struct cpe_lang_model *spec, const char *file);
402 
407 #endif /* _CPELANG_H_ */