• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

/home/pvrabec/project/openscap/openscap-0.6.3/src/CPE/public/cpelang.h

Go to the documentation of this file.
00001 
00013 /*
00014  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
00015  * All Rights Reserved.
00016  *
00017  * This library is free software; you can redistribute it and/or
00018  * modify it under the terms of the GNU Lesser General Public
00019  * License as published by the Free Software Foundation; either
00020  * version 2.1 of the License, or (at your option) any later version.
00021  *
00022  * This library is distributed in the hope that it will be useful, 
00023  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00024  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025  * Lesser General Public License for more details.
00026  *
00027  * You should have received a copy of the GNU Lesser General Public
00028  * License along with this library; if not, write to the Free Software 
00029  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00030  *
00031  * Authors:
00032  *      Lukas Kuklinek <lkuklinek@redhat.com>
00033  *      Maros Barabas <mbarabas@redhat.com>
00034  */
00035 
00036 #ifndef CPELANG_H_
00037 #define CPELANG_H_
00038 
00039 #include <stdlib.h>
00040 
00041 #include "cpeuri.h"
00042 #include "oscap.h"
00043 
00047 typedef enum {
00048         CPE_LANG_OPER_INVALID = 0x00,   
00049         CPE_LANG_OPER_AND = 0x01,       
00050         CPE_LANG_OPER_OR = 0x02,        
00051         CPE_LANG_OPER_MATCH = 0x04,     
00052 
00053         CPE_LANG_OPER_MASK = 0xFF,      
00054         CPE_LANG_OPER_NOT = 0x100,      
00055 
00056         CPE_LANG_OPER_NAND = CPE_LANG_OPER_AND | CPE_LANG_OPER_NOT,
00057         CPE_LANG_OPER_NOR = CPE_LANG_OPER_OR | CPE_LANG_OPER_NOT,
00058 } cpe_lang_oper_t;
00059 
00064 struct cpe_lang_model;
00065 
00070 struct cpe_platform;
00071 
00076 struct cpe_testexpr;
00077 
00078 
00079 /************************************************************/
00090 struct cpe_platform_iterator;
00091 
00093 struct cpe_platform *cpe_platform_iterator_next(struct cpe_platform_iterator *it);
00095 bool cpe_platform_iterator_has_more(struct cpe_platform_iterator *it);
00097 void cpe_platform_iterator_free(struct cpe_platform_iterator *it);
00098 
00104 struct cpe_testexpr_iterator;
00106 struct cpe_testexpr *cpe_testexpr_iterator_next(struct cpe_testexpr_iterator *it);
00108 bool cpe_testexpr_iterator_has_more(struct cpe_testexpr_iterator *it);
00110 void cpe_testexpr_iterator_free(struct cpe_testexpr_iterator *it);
00111 
00112 /************************************************************/
00115 /************************************************************/
00127 cpe_lang_oper_t cpe_testexpr_get_oper(const struct cpe_testexpr *item);
00128 
00134 struct cpe_testexpr_iterator *cpe_testexpr_get_meta_expr(const struct cpe_testexpr *item);
00135 
00141 const struct cpe_name *cpe_testexpr_get_meta_cpe(const struct cpe_testexpr *item);
00142 
00148 const struct cpe_testexpr *cpe_testexpr_get_next(const struct cpe_testexpr *expr);
00149 
00154 struct cpe_platform_iterator *cpe_lang_model_get_platforms(const struct cpe_lang_model *item);
00155 
00160 struct cpe_platform *cpe_lang_model_get_item(const struct cpe_lang_model *item, const char *key);
00161 
00166 const char *cpe_platform_get_id(const struct cpe_platform *item);
00171 const char *cpe_platform_get_remark(const struct cpe_platform *item);
00176 struct oscap_text_iterator *cpe_platform_get_titles(const struct cpe_platform *item);
00181 const struct cpe_testexpr *cpe_platform_get_expr(const struct cpe_platform *item);
00182 
00183 /************************************************************/
00186 /************************************************************/
00198 bool cpe_lang_model_add_platform(struct cpe_lang_model *lang, struct cpe_platform *platform);
00203 bool cpe_platform_add_title(struct cpe_platform *platform, struct oscap_text *title);
00204 
00209 /*bool cpe_lang_model_add_xmlns(struct cpe_lang_model * model, struct xml_metadata * xml);*/
00210 
00217 bool cpe_testexpr_add_subexpression(struct cpe_testexpr *expr, struct cpe_testexpr *sub);
00218 
00223 bool cpe_platform_set_id(struct cpe_platform *platform, const char *new_id);
00228 bool cpe_platform_set_remark(struct cpe_platform *platform, const char *new_remark);
00235 bool cpe_platform_set_expr(struct cpe_platform *platform, struct cpe_testexpr *expr);
00242 bool cpe_testexpr_set_oper(struct cpe_testexpr *expr, cpe_lang_oper_t oper);
00243 
00251 bool cpe_testexpr_set_name(struct cpe_testexpr *expr, struct cpe_name *name);
00252 
00253 /************************************************************/
00256 
00257 void cpe_platform_iterator_remove(struct cpe_platform_iterator *it, struct cpe_lang_model *parent);
00258 
00263 struct cpe_lang_model *cpe_lang_model_new(void);
00264 
00269 struct cpe_testexpr *cpe_testexpr_new(void);
00270 
00275 struct cpe_platform *cpe_platform_new(void);
00276 
00277 
00278 
00283 void cpe_testexpr_free(struct cpe_testexpr *expr);
00284 
00289 void cpe_lang_model_free(struct cpe_lang_model *platformspec);
00290 
00295 void cpe_platform_free(struct cpe_platform *platform);
00296 
00297 /************************************************************/
00308 const char * cpe_lang_model_supported(void);
00309 
00317 bool cpe_platform_match_cpe(struct cpe_name **cpe, size_t n, const struct cpe_platform *platform);
00318 
00319 /************************************************************/
00326 struct cpe_lang_model *cpe_lang_model_import(const char *file);
00327 
00334 void cpe_lang_model_export(const struct cpe_lang_model *spec, const char *file);
00335 
00339 
00340 #endif                          /* _CPELANG_H_ */

Generated on Tue Sep 14 2010 for Open SCAP Library by  doxygen 1.7.1