Open SCAP Library
/home/pvrabec/project/openscap/openscap-0.8.1/src/CVE/public/cve.h
Go to the documentation of this file.
00001 
00011 /*
00012  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
00013  * All Rights Reserved.
00014  *
00015  * This library is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU Lesser General Public
00017  * License as published by the Free Software Foundation; either
00018  * version 2.1 of the License, or (at your option) any later version.
00019  *
00020  * This library is distributed in the hope that it will be useful, 
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00023  * Lesser General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU Lesser General Public
00026  * License along with this library; if not, write to the Free Software 
00027  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028  *
00029  * Authors:
00030  *      Maros Barabas  <mbarabas@redhat.com>
00031  *      Tomas Heinrich <theinric@redhat.com>
00032  */
00033 
00034 #ifndef _CVE_H_
00035 #define _CVE_H_
00036 
00037 #include <stdbool.h>
00038 #include <time.h>
00039 #include "oscap.h"
00040 #include "cpeuri.h"
00041 
00046 struct cve_model;
00051 struct cve_entry;
00056 struct cve_summary;
00061 struct cve_product;
00066 struct cve_configuration;
00071 struct cwe_entry;
00076 struct cve_reference;
00077 
00078 // fwd
00079 struct cvss_impact;
00080 
00081 /************************************************************/
00094 struct cve_entry_iterator *cve_model_get_entries(const struct cve_model *cve_model);
00095 
00101 const char *cve_entry_get_id(const struct cve_entry *item);
00102 
00108 const char *cve_entry_get_cwe(const struct cve_entry *item);
00109 
00115 struct cve_summary_iterator *cve_entry_get_summaries(const struct cve_entry *item);
00116 
00122 struct cve_reference_iterator *cve_entry_get_references(const struct cve_entry *item);
00123 
00129 const char *cve_reference_get_value(const struct cve_reference *ref);
00130 
00136 const char *cve_reference_get_href(const struct cve_reference *ref);
00137 
00143 const char *cve_reference_get_type(const struct cve_reference *ref);
00144 
00150 const char *cve_reference_get_source(const struct cve_reference *ref);
00152 const char *cve_reference_get_lang(const struct cve_reference *ref);
00153 
00159 const char *cve_summary_get_summary(const struct cve_summary *summary);
00165 const char *cve_product_get_value(const struct cve_product *product);
00171 const char *cwe_entry_get_value(const struct cwe_entry *entry);
00177 const char *cve_configuration_get_id(const struct cve_configuration *conf);
00183 const char *cve_entry_get_published(const struct cve_entry *entry);
00189 const char *cve_entry_get_modified(const struct cve_entry *entry);
00195 const char *cve_entry_get_sec_protection(const struct cve_entry *entry);
00196 
00202 struct cve_product_iterator *cve_entry_get_products(const struct cve_entry *entry);
00208 struct cve_configuration_iterator *cve_entry_get_configurations(const struct cve_entry *entry);
00214 const struct cpe_testexpr *cve_configuration_get_expr(const struct cve_configuration *conf);
00215 
00221 const struct cvss_impact *cve_entry_get_cvss(const struct cve_entry *item);
00222 
00223 /************************************************************/
00226 /************************************************************/
00241 bool cve_model_add_entry(struct cve_model *model, struct cve_entry *new_entry);
00242 
00244 bool cve_entry_add_product(struct cve_entry *entry, struct cve_product *new_product);
00245 
00247 bool cve_entry_add_reference(struct cve_entry *entry, struct cve_reference *new_reference);
00248 
00250 bool cve_entry_add_summary(struct cve_entry *entry, struct cve_summary *new_summary);
00251 
00253 bool cve_entry_add_configuration(struct cve_entry *entry, struct cve_configuration *new_configuration);
00254 
00262 bool cve_entry_set_id(struct cve_entry *entry, const char *new_id);
00270 bool cve_entry_set_published(struct cve_entry *entry, const char *new_published);
00278 bool cve_entry_set_modified(struct cve_entry *entry, const char *new_modified);
00286 bool cve_entry_set_sec_protection(struct cve_entry *entry, const char *new_protection);
00294 bool cve_entry_set_cwe(struct cve_entry *entry, const char *cwe);
00302 bool cwe_entry_set_value(struct cwe_entry *entry, const char *new_value);
00303 
00311 bool cve_reference_set_value(struct cve_reference *reference, const char *new_value);
00319 bool cve_reference_set_href(struct cve_reference *reference, const char *new_href);
00327 bool cve_reference_set_type(struct cve_reference *reference, const char *new_type);
00335 bool cve_reference_set_source(struct cve_reference *reference, const char *new_source);
00336 
00338 bool cve_reference_set_lang(struct cve_reference *reference, const char *new_lang);
00339 
00347 bool cve_configuration_set_id(struct cve_configuration *conf, const char *new_id);
00355 bool cve_product_set_value(struct cve_product *product, const char *new_value);
00363 bool cve_summary_set_summary(struct cve_summary *summary, const char *new_summary);
00364 
00365 /************************************************************/
00368 /************************************************************/
00380 struct cve_entry_iterator;
00384 struct cve_entry *cve_entry_iterator_next(struct cve_entry_iterator *it);
00388 bool cve_entry_iterator_has_more(struct cve_entry_iterator *it);
00392 void cve_entry_iterator_free(struct cve_entry_iterator *it);
00393 
00399 struct cve_summary_iterator;
00403 struct cve_summary *cve_summary_iterator_next(struct cve_summary_iterator *it);
00407 bool cve_summary_iterator_has_more(struct cve_summary_iterator *it);
00411 void cve_summary_iterator_free(struct cve_summary_iterator *it);
00412 
00418 struct cve_product_iterator;
00422 struct cve_product *cve_product_iterator_next(struct cve_product_iterator *it);
00426 bool cve_product_iterator_has_more(struct cve_product_iterator *it);
00430 void cve_product_iterator_free(struct cve_product_iterator *it);
00431 
00437 struct cve_configuration_iterator;
00441 struct cve_configuration *cve_configuration_iterator_next(struct cve_configuration_iterator *it);
00445 bool cve_configuration_iterator_has_more(struct cve_configuration_iterator *it);
00449 void cve_configuration_iterator_free(struct cve_configuration_iterator *it);
00450 
00456 struct cve_reference_iterator;
00460 struct cve_reference *cve_reference_iterator_next(struct cve_reference_iterator *it);
00464 bool cve_reference_iterator_has_more(struct cve_reference_iterator *it);
00468 void cve_reference_iterator_free(struct cve_reference_iterator *it);
00469 
00470 
00471 /************************************************************/
00474 /************************************************************/
00485 const char * cve_model_supported(void);
00486 
00487 /************************************************************/
00495 struct cve_entry *cve_entry_new(void);
00501 struct cve_configuration *cve_configuration_new(void);
00507 struct cwe_entry *cwe_entry_new(void);
00513 struct cve_product *cve_product_new(void);
00519 struct cve_summary *cve_summary_new(void);
00525 struct cve_reference *cve_reference_new(void);
00531 struct cve_model *cve_model_new(void);
00532 
00538 struct cve_entry * cve_entry_clone(struct cve_entry * old_entry);
00539 
00545 struct cve_configuration * cve_configuration_clone(struct cve_configuration * old_conf);
00546 
00552 struct cwe_entry * cwe_entry_clone(struct cwe_entry * old_entry);
00553 
00559 struct cve_product * cve_product_clone(struct cve_product * old_product);
00560 
00566 struct cve_summary * cve_summary_clone(struct cve_summary * old_sum);
00567 
00573 struct cve_reference * cve_reference_clone(struct cve_reference * old_ref);
00574 
00580 struct cve_model * cve_model_clone(struct cve_model * old_model);
00581 
00587 void cve_model_free(struct cve_model *cve_model);
00588 
00594 void cve_entry_free(struct cve_entry *entry);
00595 
00601 void cve_summary_free(struct cve_summary *summary);
00602 
00608 void cve_product_free(struct cve_product *product);
00609 
00615 void cve_reference_free(struct cve_reference *ref);
00616 
00622 void cwe_entry_free(struct cwe_entry *entry);
00623 
00629 void cve_configuration_free(struct cve_configuration *conf);
00630 
00633 
00634 void cve_entry_iterator_remove(struct cve_entry_iterator *it);
00636 void cve_entry_iterator_reset(struct cve_entry_iterator *it);
00637 
00639 void cve_product_iterator_remove(struct cve_product_iterator *it);
00641 void cve_product_iterator_reset(struct cve_product_iterator *it);
00642 
00644 void cve_reference_iterator_remove(struct cve_reference_iterator *it);
00646 void cve_reference_iterator_reset(struct cve_reference_iterator *it);
00647 
00649 void cve_summary_iterator_remove(struct cve_summary_iterator *it);
00651 void cve_summary_iterator_reset(struct cve_summary_iterator *it);
00652 
00654 void cve_configuration_iterator_remove(struct cve_configuration_iterator *it);
00656 void cve_configuration_iterator_reset(struct cve_configuration_iterator *it);
00657 
00664 void cve_model_export(struct cve_model *cve, const char *file);
00665 
00673 struct cve_model *cve_model_import(const char *file);
00674 
00676 const char *cve_model_get_nvd_xml_version(const struct cve_model *item);
00678 bool cve_model_set_nvd_xml_version(struct cve_model *obj, const char *newval);
00680 time_t cve_model_get_pub_date(const struct cve_model *item);
00682 bool cve_model_set_pub_date(struct cve_model *obj, time_t newval);
00683 
00686 #endif                          /* _CVE_H_ */