Open SCAP Library
|
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 /************************************************************/ 00091 struct cve_entry_iterator *cve_model_get_entries(const struct cve_model *cve_model); 00092 00098 const char *cve_entry_get_id(const struct cve_entry *item); 00099 00105 const char *cve_entry_get_cwe(const struct cve_entry *item); 00106 00112 struct cve_summary_iterator *cve_entry_get_summaries(const struct cve_entry *item); 00113 00119 struct cve_reference_iterator *cve_entry_get_references(const struct cve_entry *item); 00120 00126 const char *cve_reference_get_value(const struct cve_reference *ref); 00127 00133 const char *cve_reference_get_href(const struct cve_reference *ref); 00134 00140 const char *cve_reference_get_type(const struct cve_reference *ref); 00141 00147 const char *cve_reference_get_source(const struct cve_reference *ref); 00149 const char *cve_reference_get_lang(const struct cve_reference *ref); 00150 00156 const char *cve_summary_get_summary(const struct cve_summary *summary); 00162 const char *cve_product_get_value(const struct cve_product *product); 00168 const char *cwe_entry_get_value(const struct cwe_entry *entry); 00174 const char *cve_configuration_get_id(const struct cve_configuration *conf); 00180 const char *cve_entry_get_published(const struct cve_entry *entry); 00186 const char *cve_entry_get_modified(const struct cve_entry *entry); 00192 const char *cve_entry_get_sec_protection(const struct cve_entry *entry); 00193 00199 struct cve_product_iterator *cve_entry_get_products(const struct cve_entry *entry); 00205 struct cve_configuration_iterator *cve_entry_get_configurations(const struct cve_entry *entry); 00211 const struct cpe_testexpr *cve_configuration_get_expr(const struct cve_configuration *conf); 00212 00218 const struct cvss_entry *cve_entry_get_cvss(const struct cve_entry *item); 00219 00220 /************************************************************/ 00223 /************************************************************/ 00238 bool cve_model_add_entry(struct cve_model *model, struct cve_entry *new_entry); 00239 00241 bool cve_entry_add_product(struct cve_entry *entry, struct cve_product *new_product); 00242 00244 bool cve_entry_add_reference(struct cve_entry *entry, struct cve_reference *new_reference); 00245 00247 bool cve_entry_add_summary(struct cve_entry *entry, struct cve_summary *new_summary); 00248 00250 bool cve_entry_add_configuration(struct cve_entry *entry, struct cve_configuration *new_configuration); 00251 00259 bool cve_entry_set_id(struct cve_entry *entry, const char *new_id); 00267 bool cve_entry_set_published(struct cve_entry *entry, const char *new_published); 00275 bool cve_entry_set_modified(struct cve_entry *entry, const char *new_modified); 00283 bool cve_entry_set_sec_protection(struct cve_entry *entry, const char *new_protection); 00291 bool cve_entry_set_cwe(struct cve_entry *entry, const char *cwe); 00299 bool cwe_entry_set_value(struct cwe_entry *entry, const char *new_value); 00300 00308 bool cve_reference_set_value(struct cve_reference *reference, const char *new_value); 00316 bool cve_reference_set_href(struct cve_reference *reference, const char *new_href); 00324 bool cve_reference_set_type(struct cve_reference *reference, const char *new_type); 00332 bool cve_reference_set_source(struct cve_reference *reference, const char *new_source); 00333 00335 bool cve_reference_set_lang(struct cve_reference *reference, const char *new_lang); 00336 00344 bool cve_configuration_set_id(struct cve_configuration *conf, const char *new_id); 00352 bool cve_product_set_value(struct cve_product *product, const char *new_value); 00360 bool cve_summary_set_summary(struct cve_summary *summary, const char *new_summary); 00361 00362 /************************************************************/ 00365 /************************************************************/ 00377 struct cve_entry_iterator; 00381 struct cve_entry *cve_entry_iterator_next(struct cve_entry_iterator *it); 00385 bool cve_entry_iterator_has_more(struct cve_entry_iterator *it); 00389 void cve_entry_iterator_free(struct cve_entry_iterator *it); 00390 00396 struct cve_summary_iterator; 00400 struct cve_summary *cve_summary_iterator_next(struct cve_summary_iterator *it); 00404 bool cve_summary_iterator_has_more(struct cve_summary_iterator *it); 00408 void cve_summary_iterator_free(struct cve_summary_iterator *it); 00409 00415 struct cve_product_iterator; 00419 struct cve_product *cve_product_iterator_next(struct cve_product_iterator *it); 00423 bool cve_product_iterator_has_more(struct cve_product_iterator *it); 00427 void cve_product_iterator_free(struct cve_product_iterator *it); 00428 00434 struct cve_configuration_iterator; 00438 struct cve_configuration *cve_configuration_iterator_next(struct cve_configuration_iterator *it); 00442 bool cve_configuration_iterator_has_more(struct cve_configuration_iterator *it); 00446 void cve_configuration_iterator_free(struct cve_configuration_iterator *it); 00447 00453 struct cve_reference_iterator; 00457 struct cve_reference *cve_reference_iterator_next(struct cve_reference_iterator *it); 00461 bool cve_reference_iterator_has_more(struct cve_reference_iterator *it); 00465 void cve_reference_iterator_free(struct cve_reference_iterator *it); 00466 00467 00468 /************************************************************/ 00471 /************************************************************/ 00482 const char * cve_model_supported(void); 00483 00484 /************************************************************/ 00492 struct cve_entry *cve_entry_new(void); 00498 struct cve_configuration *cve_configuration_new(void); 00504 struct cwe_entry *cwe_entry_new(void); 00510 struct cve_product *cve_product_new(void); 00516 struct cve_summary *cve_summary_new(void); 00522 struct cve_reference *cve_reference_new(void); 00528 struct cve_model *cve_model_new(void); 00529 00535 struct cve_entry * cve_entry_clone(struct cve_entry * old_entry); 00536 00542 struct cve_configuration * cve_configuration_clone(struct cve_configuration * old_conf); 00543 00549 struct cwe_entry * cwe_entry_clone(struct cwe_entry * old_entry); 00550 00556 struct cve_product * cve_product_clone(struct cve_product * old_product); 00557 00563 struct cve_summary * cve_summary_clone(struct cve_summary * old_sum); 00564 00570 struct cve_reference * cve_reference_clone(struct cve_reference * old_ref); 00571 00577 struct cve_model * cve_model_clone(struct cve_model * old_model); 00578 00584 void cve_model_free(struct cve_model *cve_model); 00585 00591 void cve_entry_free(struct cve_entry *entry); 00592 00598 void cve_summary_free(struct cve_summary *summary); 00599 00605 void cve_product_free(struct cve_product *product); 00606 00612 void cve_reference_free(struct cve_reference *ref); 00613 00619 void cwe_entry_free(struct cwe_entry *entry); 00620 00626 void cve_configuration_free(struct cve_configuration *conf); 00627 00630 00631 void cve_entry_iterator_remove(struct cve_entry_iterator *it); 00633 void cve_entry_iterator_reset(struct cve_entry_iterator *it); 00634 00636 void cve_product_iterator_remove(struct cve_product_iterator *it); 00638 void cve_product_iterator_reset(struct cve_product_iterator *it); 00639 00641 void cve_reference_iterator_remove(struct cve_reference_iterator *it); 00643 void cve_reference_iterator_reset(struct cve_reference_iterator *it); 00644 00646 void cve_summary_iterator_remove(struct cve_summary_iterator *it); 00648 void cve_summary_iterator_reset(struct cve_summary_iterator *it); 00649 00651 void cve_configuration_iterator_remove(struct cve_configuration_iterator *it); 00653 void cve_configuration_iterator_reset(struct cve_configuration_iterator *it); 00654 00661 void cve_model_export(struct cve_model *cve, const char *file); 00662 00670 struct cve_model *cve_model_import(const char *file); 00671 00673 const char *cve_model_get_nvd_xml_version(const struct cve_model *item); 00675 bool cve_model_set_nvd_xml_version(struct cve_model *obj, const char *newval); 00677 time_t cve_model_get_pub_date(const struct cve_model *item); 00679 bool cve_model_set_pub_date(struct cve_model *obj, time_t newval); 00680 00683 #endif /* _CVE_H_ */