Open SCAP Library
cpelang.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 "cpeuri.h"
42 #include "oscap.h"
43 
47 typedef enum {
52 
55 
56  CPE_LANG_OPER_NAND = CPE_LANG_OPER_AND | CPE_LANG_OPER_NOT,
57  CPE_LANG_OPER_NOR = CPE_LANG_OPER_OR | CPE_LANG_OPER_NOT,
59 
64 struct cpe_lang_model;
65 
70 struct cpe_platform;
71 
76 struct cpe_testexpr;
77 
78 
79 /************************************************************/
91 
98 
104 struct cpe_testexpr_iterator;
111 
112 /************************************************************/
115 /************************************************************/
128 
135 
141 const struct cpe_name *cpe_testexpr_get_meta_cpe(const struct cpe_testexpr *item);
142 
148 const struct cpe_testexpr *cpe_testexpr_get_next(const struct cpe_testexpr *expr);
149 
155 
160 struct cpe_platform *cpe_lang_model_get_item(const struct cpe_lang_model *item, const char *key);
161 
166 const char *cpe_platform_get_id(const struct cpe_platform *item);
171 const char *cpe_platform_get_remark(const struct cpe_platform *item);
176 struct oscap_text_iterator *cpe_platform_get_titles(const struct cpe_platform *item);
181 const struct cpe_testexpr *cpe_platform_get_expr(const struct cpe_platform *item);
182 
183 /************************************************************/
186 /************************************************************/
198 bool cpe_lang_model_add_platform(struct cpe_lang_model *lang, struct cpe_platform *platform);
203 bool cpe_platform_add_title(struct cpe_platform *platform, struct oscap_text *title);
204 
209 /*bool cpe_lang_model_add_xmlns(struct cpe_lang_model * model, struct xml_metadata * xml);*/
210 
218 
223 bool cpe_platform_set_id(struct cpe_platform *platform, const char *new_id);
228 bool cpe_platform_set_remark(struct cpe_platform *platform, const char *new_remark);
235 bool cpe_platform_set_expr(struct cpe_platform *platform, struct cpe_testexpr *expr);
243 
251 bool cpe_testexpr_set_name(struct cpe_testexpr *expr, struct cpe_name *name);
252 
253 /************************************************************/
256 
257 void cpe_platform_iterator_remove(struct cpe_platform_iterator *it, struct cpe_lang_model *parent);
260 
265 struct cpe_lang_model *cpe_lang_model_new(void);
266 
271 struct cpe_testexpr *cpe_testexpr_new(void);
272 
277 struct cpe_platform *cpe_platform_new(void);
278 
284 struct cpe_testexpr * cpe_testexpr_clone(struct cpe_testexpr * old_expr);
285 
290 void cpe_testexpr_free(struct cpe_testexpr *expr);
291 
297 
302 void cpe_lang_model_free(struct cpe_lang_model *platformspec);
303 
308 void cpe_platform_free(struct cpe_platform *platform);
309 
310 /************************************************************/
321 const char * cpe_lang_model_supported(void);
322 
330 bool cpe_platform_match_cpe(struct cpe_name **cpe, size_t n, const struct cpe_platform *platform);
331 
332 /************************************************************/
339 struct cpe_lang_model *cpe_lang_model_import(const char *file);
340 
347 void cpe_lang_model_export(const struct cpe_lang_model *spec, const char *file);
348 
352 
353 #endif /* _CPELANG_H_ */