Open SCAP Library
cve_nvd.h
Go to the documentation of this file.
1 
11 /*
12  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
13  * All Rights Reserved.
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Lesser General Public
17  * License as published by the Free Software Foundation; either
18  * version 2.1 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23  * Lesser General Public License for more details.
24  *
25  * You should have received a copy of the GNU Lesser General Public
26  * License along with this library; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28  *
29  * Authors:
30  * Maros Barabas <mbarabas@redhat.com>
31  * Tomas Heinrich <theinric@redhat.com>
32  */
33 
34 #ifndef _CVE_H_
35 #define _CVE_H_
36 
37 #include <stdbool.h>
38 #include <time.h>
39 #include "oscap.h"
40 #include "cpe_name.h"
41 
46 struct cve_model;
51 struct cve_entry;
56 struct cve_summary;
61 struct cve_product;
66 struct cve_configuration;
71 struct cwe_entry;
76 struct cve_reference;
77 
78 // fwd
79 struct cvss_impact;
80 
81 /************************************************************/
95 
101 const char *cve_entry_get_id(const struct cve_entry *item);
102 
108 const char *cve_entry_get_cwe(const struct cve_entry *item);
109 
115 struct cve_summary_iterator *cve_entry_get_summaries(const struct cve_entry *item);
116 
122 struct cve_reference_iterator *cve_entry_get_references(const struct cve_entry *item);
123 
129 const char *cve_reference_get_value(const struct cve_reference *ref);
130 
136 const char *cve_reference_get_href(const struct cve_reference *ref);
137 
143 const char *cve_reference_get_type(const struct cve_reference *ref);
144 
150 const char *cve_reference_get_source(const struct cve_reference *ref);
152 const char *cve_reference_get_lang(const struct cve_reference *ref);
153 
159 const char *cve_summary_get_summary(const struct cve_summary *summary);
165 const char *cve_product_get_value(const struct cve_product *product);
171 const char *cwe_entry_get_value(const struct cwe_entry *entry);
177 const char *cve_configuration_get_id(const struct cve_configuration *conf);
183 const char *cve_entry_get_published(const struct cve_entry *entry);
189 const char *cve_entry_get_modified(const struct cve_entry *entry);
195 const char *cve_entry_get_sec_protection(const struct cve_entry *entry);
196 
202 struct cve_product_iterator *cve_entry_get_products(const struct cve_entry *entry);
214 const struct cpe_testexpr *cve_configuration_get_expr(const struct cve_configuration *conf);
215 
221 const struct cvss_impact *cve_entry_get_cvss(const struct cve_entry *item);
222 
223 /************************************************************/
226 /************************************************************/
241 bool cve_model_add_entry(struct cve_model *model, struct cve_entry *new_entry);
242 
244 bool cve_entry_add_product(struct cve_entry *entry, struct cve_product *new_product);
245 
247 bool cve_entry_add_reference(struct cve_entry *entry, struct cve_reference *new_reference);
248 
250 bool cve_entry_add_summary(struct cve_entry *entry, struct cve_summary *new_summary);
251 
253 bool cve_entry_add_configuration(struct cve_entry *entry, struct cve_configuration *new_configuration);
254 
262 bool cve_entry_set_id(struct cve_entry *entry, const char *new_id);
270 bool cve_entry_set_published(struct cve_entry *entry, const char *new_published);
278 bool cve_entry_set_modified(struct cve_entry *entry, const char *new_modified);
286 bool cve_entry_set_sec_protection(struct cve_entry *entry, const char *new_protection);
294 bool cve_entry_set_cwe(struct cve_entry *entry, const char *cwe);
302 bool cwe_entry_set_value(struct cwe_entry *entry, const char *new_value);
303 
311 bool cve_reference_set_value(struct cve_reference *reference, const char *new_value);
319 bool cve_reference_set_href(struct cve_reference *reference, const char *new_href);
327 bool cve_reference_set_type(struct cve_reference *reference, const char *new_type);
335 bool cve_reference_set_source(struct cve_reference *reference, const char *new_source);
336 
338 bool cve_reference_set_lang(struct cve_reference *reference, const char *new_lang);
339 
347 bool cve_configuration_set_id(struct cve_configuration *conf, const char *new_id);
355 bool cve_product_set_value(struct cve_product *product, const char *new_value);
363 bool cve_summary_set_summary(struct cve_summary *summary, const char *new_summary);
364 
365 /************************************************************/
368 /************************************************************/
380 struct cve_entry_iterator;
384 struct cve_entry *cve_entry_iterator_next(struct cve_entry_iterator *it);
388 bool cve_entry_iterator_has_more(struct cve_entry_iterator *it);
392 void cve_entry_iterator_free(struct cve_entry_iterator *it);
393 
399 struct cve_summary_iterator;
403 struct cve_summary *cve_summary_iterator_next(struct cve_summary_iterator *it);
407 bool cve_summary_iterator_has_more(struct cve_summary_iterator *it);
411 void cve_summary_iterator_free(struct cve_summary_iterator *it);
412 
418 struct cve_product_iterator;
422 struct cve_product *cve_product_iterator_next(struct cve_product_iterator *it);
426 bool cve_product_iterator_has_more(struct cve_product_iterator *it);
430 void cve_product_iterator_free(struct cve_product_iterator *it);
431 
441 struct cve_configuration *cve_configuration_iterator_next(struct cve_configuration_iterator *it);
445 bool cve_configuration_iterator_has_more(struct cve_configuration_iterator *it);
449 void cve_configuration_iterator_free(struct cve_configuration_iterator *it);
450 
460 struct cve_reference *cve_reference_iterator_next(struct cve_reference_iterator *it);
464 bool cve_reference_iterator_has_more(struct cve_reference_iterator *it);
468 void cve_reference_iterator_free(struct cve_reference_iterator *it);
469 
470 
471 /************************************************************/
474 /************************************************************/
485 const char * cve_model_supported(void);
486 
487 /************************************************************/
495 struct cve_entry *cve_entry_new(void);
507 struct cwe_entry *cwe_entry_new(void);
513 struct cve_product *cve_product_new(void);
519 struct cve_summary *cve_summary_new(void);
525 struct cve_reference *cve_reference_new(void);
531 struct cve_model *cve_model_new(void);
532 
538 struct cve_entry * cve_entry_clone(struct cve_entry * old_entry);
539 
546 
552 struct cwe_entry * cwe_entry_clone(struct cwe_entry * old_entry);
553 
559 struct cve_product * cve_product_clone(struct cve_product * old_product);
560 
566 struct cve_summary * cve_summary_clone(struct cve_summary * old_sum);
567 
573 struct cve_reference * cve_reference_clone(struct cve_reference * old_ref);
574 
580 struct cve_model * cve_model_clone(struct cve_model * old_model);
581 
587 void cve_model_free(struct cve_model *cve_model);
588 
594 void cve_entry_free(struct cve_entry *entry);
595 
601 void cve_summary_free(struct cve_summary *summary);
602 
608 void cve_product_free(struct cve_product *product);
609 
615 void cve_reference_free(struct cve_reference *ref);
616 
622 void cwe_entry_free(struct cwe_entry *entry);
623 
629 void cve_configuration_free(struct cve_configuration *conf);
630 
633 
637 
642 
647 
652 
657 
664 void cve_model_export(struct cve_model *cve, const char *file);
665 
673 struct cve_model *cve_model_import(const char *file);
674 
676 const char *cve_model_get_nvd_xml_version(const struct cve_model *item);
678 bool cve_model_set_nvd_xml_version(struct cve_model *obj, const char *newval);
680 const char *cve_model_get_pub_date(const struct cve_model *item);
682 bool cve_model_set_pub_date(struct cve_model *obj, const char *newval);
683 
686 #endif /* _CVE_H_ */