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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 #include "oscap_export.h"
42 
47 struct cve_model;
52 struct cve_entry;
57 struct cve_summary;
62 struct cve_product;
67 struct cve_configuration;
72 struct cwe_entry;
77 struct cve_reference;
78 
79 // fwd
80 struct cvss_impact;
81 
82 /************************************************************/
95 OSCAP_API struct cve_entry_iterator *cve_model_get_entries(const struct cve_model *cve_model);
96 
102 OSCAP_API const char *cve_entry_get_id(const struct cve_entry *item);
103 
109 OSCAP_API const char *cve_entry_get_cwe(const struct cve_entry *item);
110 
116 OSCAP_API struct cve_summary_iterator *cve_entry_get_summaries(const struct cve_entry *item);
117 
123 OSCAP_API struct cve_reference_iterator *cve_entry_get_references(const struct cve_entry *item);
124 
130 OSCAP_API const char *cve_reference_get_value(const struct cve_reference *ref);
131 
137 OSCAP_API const char *cve_reference_get_href(const struct cve_reference *ref);
138 
144 OSCAP_API const char *cve_reference_get_type(const struct cve_reference *ref);
145 
151 OSCAP_API const char *cve_reference_get_source(const struct cve_reference *ref);
153 OSCAP_API const char *cve_reference_get_lang(const struct cve_reference *ref);
154 
160 OSCAP_API const char *cve_summary_get_summary(const struct cve_summary *summary);
166 OSCAP_API const char *cve_product_get_value(const struct cve_product *product);
172 OSCAP_API const char *cwe_entry_get_value(const struct cwe_entry *entry);
178 OSCAP_API const char *cve_configuration_get_id(const struct cve_configuration *conf);
184 OSCAP_API const char *cve_entry_get_published(const struct cve_entry *entry);
190 OSCAP_API const char *cve_entry_get_modified(const struct cve_entry *entry);
196 OSCAP_API const char *cve_entry_get_sec_protection(const struct cve_entry *entry);
197 
203 OSCAP_API struct cve_product_iterator *cve_entry_get_products(const struct cve_entry *entry);
209 OSCAP_API struct cve_configuration_iterator *cve_entry_get_configurations(const struct cve_entry *entry);
215 OSCAP_API const struct cpe_testexpr *cve_configuration_get_expr(const struct cve_configuration *conf);
216 
222 OSCAP_API const struct cvss_impact *cve_entry_get_cvss(const struct cve_entry *item);
223 
224 /************************************************************/
227 /************************************************************/
242 OSCAP_API bool cve_model_add_entry(struct cve_model *model, struct cve_entry *new_entry);
243 
245 OSCAP_API bool cve_entry_add_product(struct cve_entry *entry, struct cve_product *new_product);
246 
248 OSCAP_API bool cve_entry_add_reference(struct cve_entry *entry, struct cve_reference *new_reference);
249 
251 OSCAP_API bool cve_entry_add_summary(struct cve_entry *entry, struct cve_summary *new_summary);
252 
254 OSCAP_API bool cve_entry_add_configuration(struct cve_entry *entry, struct cve_configuration *new_configuration);
255 
263 OSCAP_API bool cve_entry_set_id(struct cve_entry *entry, const char *new_id);
271 OSCAP_API bool cve_entry_set_published(struct cve_entry *entry, const char *new_published);
279 OSCAP_API bool cve_entry_set_modified(struct cve_entry *entry, const char *new_modified);
287 OSCAP_API bool cve_entry_set_sec_protection(struct cve_entry *entry, const char *new_protection);
295 OSCAP_API bool cve_entry_set_cwe(struct cve_entry *entry, const char *cwe);
303 OSCAP_API bool cwe_entry_set_value(struct cwe_entry *entry, const char *new_value);
304 
312 OSCAP_API bool cve_reference_set_value(struct cve_reference *reference, const char *new_value);
320 OSCAP_API bool cve_reference_set_href(struct cve_reference *reference, const char *new_href);
328 OSCAP_API bool cve_reference_set_type(struct cve_reference *reference, const char *new_type);
336 OSCAP_API bool cve_reference_set_source(struct cve_reference *reference, const char *new_source);
337 
339 OSCAP_API bool cve_reference_set_lang(struct cve_reference *reference, const char *new_lang);
340 
348 OSCAP_API bool cve_configuration_set_id(struct cve_configuration *conf, const char *new_id);
356 OSCAP_API bool cve_product_set_value(struct cve_product *product, const char *new_value);
364 OSCAP_API bool cve_summary_set_summary(struct cve_summary *summary, const char *new_summary);
365 
366 /************************************************************/
369 /************************************************************/
381 struct cve_entry_iterator;
385 OSCAP_API struct cve_entry *cve_entry_iterator_next(struct cve_entry_iterator *it);
389 OSCAP_API bool cve_entry_iterator_has_more(struct cve_entry_iterator *it);
393 OSCAP_API void cve_entry_iterator_free(struct cve_entry_iterator *it);
394 
400 struct cve_summary_iterator;
404 OSCAP_API struct cve_summary *cve_summary_iterator_next(struct cve_summary_iterator *it);
408 OSCAP_API bool cve_summary_iterator_has_more(struct cve_summary_iterator *it);
412 OSCAP_API void cve_summary_iterator_free(struct cve_summary_iterator *it);
413 
419 struct cve_product_iterator;
423 OSCAP_API struct cve_product *cve_product_iterator_next(struct cve_product_iterator *it);
427 OSCAP_API bool cve_product_iterator_has_more(struct cve_product_iterator *it);
431 OSCAP_API void cve_product_iterator_free(struct cve_product_iterator *it);
432 
442 OSCAP_API struct cve_configuration *cve_configuration_iterator_next(struct cve_configuration_iterator *it);
446 OSCAP_API bool cve_configuration_iterator_has_more(struct cve_configuration_iterator *it);
450 OSCAP_API void cve_configuration_iterator_free(struct cve_configuration_iterator *it);
451 
461 OSCAP_API struct cve_reference *cve_reference_iterator_next(struct cve_reference_iterator *it);
465 OSCAP_API bool cve_reference_iterator_has_more(struct cve_reference_iterator *it);
469 OSCAP_API void cve_reference_iterator_free(struct cve_reference_iterator *it);
470 
471 
472 /************************************************************/
475 /************************************************************/
486 OSCAP_API const char * cve_model_supported(void);
487 
488 /************************************************************/
496 OSCAP_API struct cve_entry *cve_entry_new(void);
502 OSCAP_API struct cve_configuration *cve_configuration_new(void);
508 OSCAP_API struct cwe_entry *cwe_entry_new(void);
514 OSCAP_API struct cve_product *cve_product_new(void);
520 OSCAP_API struct cve_summary *cve_summary_new(void);
526 OSCAP_API struct cve_reference *cve_reference_new(void);
532 OSCAP_API struct cve_model *cve_model_new(void);
533 
539 OSCAP_API struct cve_entry * cve_entry_clone(struct cve_entry * old_entry);
540 
546 OSCAP_API struct cve_configuration * cve_configuration_clone(struct cve_configuration * old_conf);
547 
553 OSCAP_API struct cwe_entry * cwe_entry_clone(struct cwe_entry * old_entry);
554 
560 OSCAP_API struct cve_product * cve_product_clone(struct cve_product * old_product);
561 
567 OSCAP_API struct cve_summary * cve_summary_clone(struct cve_summary * old_sum);
568 
574 OSCAP_API struct cve_reference * cve_reference_clone(struct cve_reference * old_ref);
575 
581 OSCAP_API struct cve_model * cve_model_clone(struct cve_model * old_model);
582 
588 OSCAP_API void cve_model_free(struct cve_model *cve_model);
589 
595 OSCAP_API void cve_entry_free(struct cve_entry *entry);
596 
602 OSCAP_API void cve_summary_free(struct cve_summary *summary);
603 
609 OSCAP_API void cve_product_free(struct cve_product *product);
610 
616 OSCAP_API void cve_reference_free(struct cve_reference *ref);
617 
623 OSCAP_API void cwe_entry_free(struct cwe_entry *entry);
624 
630 OSCAP_API void cve_configuration_free(struct cve_configuration *conf);
631 
634 OSCAP_API void cve_entry_iterator_remove(struct cve_entry_iterator *it);
637 OSCAP_API void cve_entry_iterator_reset(struct cve_entry_iterator *it);
638 
640 OSCAP_API void cve_product_iterator_remove(struct cve_product_iterator *it);
642 OSCAP_API void cve_product_iterator_reset(struct cve_product_iterator *it);
643 
645 OSCAP_API void cve_reference_iterator_remove(struct cve_reference_iterator *it);
647 OSCAP_API void cve_reference_iterator_reset(struct cve_reference_iterator *it);
648 
650 OSCAP_API void cve_summary_iterator_remove(struct cve_summary_iterator *it);
652 OSCAP_API void cve_summary_iterator_reset(struct cve_summary_iterator *it);
653 
658 
665 OSCAP_API void cve_model_export(struct cve_model *cve, const char *file);
666 
674 OSCAP_API struct cve_model *cve_model_import(const char *file);
675 
677 OSCAP_API const char *cve_model_get_nvd_xml_version(const struct cve_model *item);
679 OSCAP_API bool cve_model_set_nvd_xml_version(struct cve_model *obj, const char *newval);
681 OSCAP_API const char *cve_model_get_pub_date(const struct cve_model *item);
683 OSCAP_API bool cve_model_set_pub_date(struct cve_model *obj, const char *newval);
684 
687 #endif /* _CVE_H_ */
CVSS impact.
Definition: cvss_priv.h:80
OSCAP_API void cve_entry_iterator_remove(struct cve_entry_iterator *it)
OSCAP_API struct cwe_entry * cwe_entry_new(void)
New CWE entry.
Definition: cve_priv.c:282
OSCAP_API bool cve_reference_set_href(struct cve_reference *reference, const char *new_href)
Set href of CVE reference.
OSCAP_API const char * cve_model_supported(void)
Get supported version of CVE XML.
Definition: cve.c:82
OSCAP_API bool cve_model_set_nvd_xml_version(struct cve_model *obj, const char *newval)
OSCAP_API void cve_summary_free(struct cve_summary *summary)
Free CVE summary.
Definition: cve_priv.c:785
General OpenScap functions and types.
OSCAP_API struct cve_configuration * cve_configuration_clone(struct cve_configuration *old_conf)
Clone CVE configuration.
Definition: cve_priv.c:274
OSCAP_API struct cve_reference_iterator * cve_entry_get_references(const struct cve_entry *item)
Get an iterator to CVE entry&#39;s references.
OSCAP_API bool cve_summary_set_summary(struct cve_summary *summary, const char *new_summary)
Set summary of CVE summary.
OSCAP_API const char * cve_reference_get_type(const struct cve_reference *ref)
Get CVE reference type.
Structure holding CVE model
Definition: cve_priv.c:65
OSCAP_API const char * cve_model_get_nvd_xml_version(const struct cve_model *item)
OSCAP_API bool cve_entry_add_product(struct cve_entry *entry, struct cve_product *new_product)
Structure holding CVE reference data.
Definition: cve_priv.c:77
OSCAP_API struct cve_summary_iterator * cve_entry_get_summaries(const struct cve_entry *item)
Get CVE entry summary.
OSCAP_API bool cve_configuration_set_id(struct cve_configuration *conf, const char *new_id)
Set id of CVE configuration.
OSCAP_API bool cve_entry_add_reference(struct cve_entry *entry, struct cve_reference *new_reference)
OSCAP_API struct cve_reference * cve_reference_clone(struct cve_reference *old_ref)
Clone CVE reference.
Definition: cve_priv.c:356
OSCAP_API const char * cve_entry_get_id(const struct cve_entry *item)
Get CVE entry ID.
OSCAP_API const char * cve_entry_get_modified(const struct cve_entry *entry)
Get CVE entry modified.
OSCAP_API const char * cve_entry_get_cwe(const struct cve_entry *item)
Get CVE entry CWE.
OSCAP_API void cve_configuration_free(struct cve_configuration *conf)
Free CVE configuration.
Definition: cve_priv.c:807
OSCAP_API void cve_summary_iterator_remove(struct cve_summary_iterator *it)
OSCAP_API struct cve_entry_iterator * cve_model_get_entries(const struct cve_model *cve_model)
Get en iterator to CVE entries.
Iterator over CVE references.
Interface to Common Platform Enumeration (CPE) URI.
Structure CVE vulnerable configuration data.
Definition: cve_priv.c:113
OSCAP_API const char * cwe_entry_get_value(const struct cwe_entry *entry)
Get CVE entry value.
OSCAP_API struct cve_entry * cve_entry_new(void)
New CVE entry.
Definition: cve_priv.c:215
OSCAP_API bool cve_model_set_pub_date(struct cve_model *obj, const char *newval)
OSCAP_API const char * cve_reference_get_href(const struct cve_reference *ref)
Get CVE reference href.
OSCAP_API void cve_model_free(struct cve_model *cve_model)
Free CVE model.
Definition: cve_priv.c:795
OSCAP_API bool cve_model_add_entry(struct cve_model *model, struct cve_entry *new_entry)
Add entry to CVE model.
OSCAP_API const char * cve_configuration_get_id(const struct cve_configuration *conf)
Get CVE configuration id.
OSCAP_API void cve_summary_iterator_reset(struct cve_summary_iterator *it)
OSCAP_API const char * cve_reference_get_source(const struct cve_reference *ref)
Get CVE reference source.
OSCAP_API struct cve_product_iterator * cve_entry_get_products(const struct cve_entry *entry)
Get CVE entry products.
OSCAP_API const char * cve_entry_get_sec_protection(const struct cve_entry *entry)
Get CVE entry protection.
OSCAP_API void cve_reference_free(struct cve_reference *ref)
Free CVE reference.
Definition: cve_priv.c:828
Structure holding CVE product data.
Definition: cve_priv.c:99
OSCAP_API struct cve_configuration_iterator * cve_entry_get_configurations(const struct cve_entry *entry)
Get CVE .
OSCAP_API struct cve_summary * cve_summary_clone(struct cve_summary *old_sum)
Clone CVE summary.
Definition: cve_priv.c:338
OSCAP_API struct cve_reference * cve_reference_new(void)
New CVE reference.
Definition: cve_priv.c:345
Structure holding CWE data.
Definition: cve_priv.c:106
Structure holding CVE entry data.
Definition: cve_priv.c:121
OSCAP_API struct cve_model * cve_model_import(const char *file)
Parses the specified XML file and creates a list of CVE data structures.
Definition: cve.c:50
OSCAP_API const struct cvss_impact * cve_entry_get_cvss(const struct cve_entry *item)
Get CVSS structure from CVE.
Definition: cve_priv.c:192
OSCAP_API bool cve_reference_set_type(struct cve_reference *reference, const char *new_type)
Set type of CVE reference.
OSCAP_API struct cve_summary * cve_summary_new(void)
New CVE summary.
Definition: cve_priv.c:324
OSCAP_API struct cve_product * cve_product_clone(struct cve_product *old_product)
Clone CVE product.
Definition: cve_priv.c:317
OSCAP_API const char * cve_reference_get_lang(const struct cve_reference *ref)
OSCAP_API const char * cve_reference_get_value(const struct cve_reference *ref)
Get CVE reference values.
OSCAP_API void cve_product_free(struct cve_product *product)
Free CVE product.
Definition: cve_priv.c:818
OSCAP_API struct cve_model * cve_model_clone(struct cve_model *old_model)
Clone CVE model.
Definition: cve_priv.c:383
OSCAP_API bool cve_reference_set_lang(struct cve_reference *reference, const char *new_lang)
OSCAP_API const struct cpe_testexpr * cve_configuration_get_expr(const struct cve_configuration *conf)
Get CVE configuration test expression.
Definition: cve_priv.c:201
OSCAP_API bool cwe_entry_set_value(struct cwe_entry *entry, const char *new_value)
Set value of CVE entry.
Iterator over CVE entries.
OSCAP_API const char * cve_summary_get_summary(const struct cve_summary *summary)
Get value from CVE summary.
OSCAP_API const char * cve_model_get_pub_date(const struct cve_model *item)
OSCAP_API bool cve_entry_add_configuration(struct cve_entry *entry, struct cve_configuration *new_configuration)
Iterator over CVE products.
OSCAP_API void cwe_entry_free(struct cwe_entry *entry)
Free CVE entry.
Definition: cve_priv.c:842
CPE language boolean expression.
Definition: cpelang_priv.h:51
OSCAP_API bool cve_product_set_value(struct cve_product *product, const char *new_value)
Set value of CVE product.
OSCAP_API void cve_entry_free(struct cve_entry *entry)
Free CVE entry.
Definition: cve_priv.c:852
Iterator over CVE vulnerable configurations.
OSCAP_API void cve_configuration_iterator_reset(struct cve_configuration_iterator *it)
OSCAP_API struct cwe_entry * cwe_entry_clone(struct cwe_entry *old_entry)
Clone CWE entry.
Definition: cve_priv.c:296
OSCAP_API struct cve_configuration * cve_configuration_new(void)
New CVE vulnerability configuration.
Definition: cve_priv.c:259
OSCAP_API bool cve_entry_set_modified(struct cve_entry *entry, const char *new_modified)
Set modified date of CVE entry.
OSCAP_API struct cve_model * cve_model_new(void)
New CVE model.
Definition: cve_priv.c:367
OSCAP_API bool cve_entry_set_id(struct cve_entry *entry, const char *new_id)
Set id of CVE entry.
OSCAP_API void cve_product_iterator_reset(struct cve_product_iterator *it)
OSCAP_API bool cve_entry_set_cwe(struct cve_entry *entry, const char *cwe)
Set cwe of CVE entry.
OSCAP_API void cve_reference_iterator_remove(struct cve_reference_iterator *it)
OSCAP_API void cve_entry_iterator_reset(struct cve_entry_iterator *it)
OSCAP_API const char * cve_entry_get_published(const struct cve_entry *entry)
Get CVE entry published date.
OSCAP_API bool cve_entry_set_published(struct cve_entry *entry, const char *new_published)
Set publish date of CVE entry.
OSCAP_API bool cve_reference_set_source(struct cve_reference *reference, const char *new_source)
Set source of CVE reference.
OSCAP_API void cve_model_export(struct cve_model *cve, const char *file)
Export CVE model to XML file.
Definition: cve.c:70
OSCAP_API struct cve_product * cve_product_new(void)
New CVE product.
Definition: cve_priv.c:303
OSCAP_API void cve_product_iterator_remove(struct cve_product_iterator *it)
OSCAP_API void cve_configuration_iterator_remove(struct cve_configuration_iterator *it)
OSCAP_API bool cve_reference_set_value(struct cve_reference *reference, const char *new_value)
Set value of CVE reference.
OSCAP_API bool cve_entry_add_summary(struct cve_entry *entry, struct cve_summary *new_summary)
OSCAP_API void cve_reference_iterator_reset(struct cve_reference_iterator *it)
Iterator over CVE summaries.
OSCAP_API struct cve_entry * cve_entry_clone(struct cve_entry *old_entry)
Clone CVE entry.
Definition: cve_priv.c:239
Structure holding CVE summary data.
Definition: cve_priv.c:92
OSCAP_API bool cve_entry_set_sec_protection(struct cve_entry *entry, const char *new_protection)
Set protection of CVE entry.