Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
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_ */
CVSS impact.
Definition: cvss_priv.h:81
bool cve_reference_set_value(struct cve_reference *reference, const char *new_value)
Set value of CVE reference.
bool cve_summary_set_summary(struct cve_summary *summary, const char *new_summary)
Set summary of CVE summary.
void cve_reference_iterator_reset(struct cve_reference_iterator *it)
bool cve_entry_set_modified(struct cve_entry *entry, const char *new_modified)
Set modified date of CVE entry.
const char * cve_reference_get_lang(const struct cve_reference *ref)
struct cve_configuration * cve_configuration_new(void)
New CVE vulnerability configuration.
Definition: cve_priv.c:259
bool cve_entry_set_published(struct cve_entry *entry, const char *new_published)
Set publish date of CVE entry.
void cve_model_free(struct cve_model *cve_model)
Free CVE model.
Definition: cve_priv.c:795
bool cve_entry_add_product(struct cve_entry *entry, struct cve_product *new_product)
void cve_configuration_free(struct cve_configuration *conf)
Free CVE configuration.
Definition: cve_priv.c:807
const char * cve_reference_get_source(const struct cve_reference *ref)
Get CVE reference source.
void cve_model_export(struct cve_model *cve, const char *file)
Export CVE model to XML file.
Definition: cve.c:70
General OpenScap functions and types.
const char * cve_reference_get_href(const struct cve_reference *ref)
Get CVE reference href.
const char * cve_entry_get_published(const struct cve_entry *entry)
Get CVE entry published date.
Structure holding CVE model.
Definition: cve_priv.c:65
void cve_entry_iterator_remove(struct cve_entry_iterator *it)
Structure holding CVE reference data.
Definition: cve_priv.c:77
void cve_summary_iterator_reset(struct cve_summary_iterator *it)
struct cve_entry * cve_entry_new(void)
New CVE entry.
Definition: cve_priv.c:215
struct cve_summary_iterator * cve_entry_get_summaries(const struct cve_entry *item)
Get CVE entry summary.
struct cve_summary * cve_summary_clone(struct cve_summary *old_sum)
Clone CVE summary.
Definition: cve_priv.c:338
void cve_product_iterator_reset(struct cve_product_iterator *it)
struct cve_summary * cve_summary_new(void)
New CVE summary.
Definition: cve_priv.c:324
Iterator over CVE references.
Interface to Common Platform Enumeration (CPE) URI.
Structure CVE vulnerable configuration data.
Definition: cve_priv.c:113
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
struct cwe_entry * cwe_entry_new(void)
New CWE entry.
Definition: cve_priv.c:282
bool cve_reference_set_href(struct cve_reference *reference, const char *new_href)
Set href of CVE reference.
const char * cve_entry_get_cwe(const struct cve_entry *item)
Get CVE entry CWE.
struct cwe_entry * cwe_entry_clone(struct cwe_entry *old_entry)
Clone CWE entry.
Definition: cve_priv.c:296
struct cve_configuration_iterator * cve_entry_get_configurations(const struct cve_entry *entry)
Get CVE .
bool cve_entry_set_id(struct cve_entry *entry, const char *new_id)
Set id of CVE entry.
void cve_reference_free(struct cve_reference *ref)
Free CVE reference.
Definition: cve_priv.c:828
struct cve_reference * cve_reference_new(void)
New CVE reference.
Definition: cve_priv.c:345
const char * cve_entry_get_modified(const struct cve_entry *entry)
Get CVE entry modified.
bool cve_entry_set_cwe(struct cve_entry *entry, const char *cwe)
Set cwe of CVE entry.
bool cwe_entry_set_value(struct cwe_entry *entry, const char *new_value)
Set value of CVE entry.
bool cve_model_add_entry(struct cve_model *model, struct cve_entry *new_entry)
Add entry to CVE model.
Structure holding CVE product data.
Definition: cve_priv.c:99
const char * cve_model_get_nvd_xml_version(const struct cve_model *item)
const char * cve_entry_get_id(const struct cve_entry *item)
Get CVE entry ID.
Structure holding CWE data.
Definition: cve_priv.c:106
Structure holding CVE entry data.
Definition: cve_priv.c:121
bool cve_model_set_nvd_xml_version(struct cve_model *obj, const char *newval)
struct cve_product * cve_product_clone(struct cve_product *old_product)
Clone CVE product.
Definition: cve_priv.c:317
struct cve_reference * cve_reference_clone(struct cve_reference *old_ref)
Clone CVE reference.
Definition: cve_priv.c:356
void cve_configuration_iterator_reset(struct cve_configuration_iterator *it)
bool cve_entry_set_sec_protection(struct cve_entry *entry, const char *new_protection)
Set protection of CVE entry.
const char * cve_model_supported(void)
Get supported version of CVE XML.
Definition: cve.c:82
const char * cve_reference_get_value(const struct cve_reference *ref)
Get CVE reference values.
bool cve_entry_add_reference(struct cve_entry *entry, struct cve_reference *new_reference)
void cve_entry_free(struct cve_entry *entry)
Free CVE entry.
Definition: cve_priv.c:852
void cve_product_free(struct cve_product *product)
Free CVE product.
Definition: cve_priv.c:818
const char * cve_entry_get_sec_protection(const struct cve_entry *entry)
Get CVE entry protection.
Iterator over CVE entries.
bool cve_entry_add_summary(struct cve_entry *entry, struct cve_summary *new_summary)
void cve_configuration_iterator_remove(struct cve_configuration_iterator *it)
bool cve_configuration_set_id(struct cve_configuration *conf, const char *new_id)
Set id of CVE configuration.
Iterator over CVE products.
struct cvss_impact * cve_entry_get_cvss(const struct cve_entry *item)
Get CVSS structure from CVE.
Definition: cve_priv.c:192
bool cve_product_set_value(struct cve_product *product, const char *new_value)
Set value of CVE product.
CPE language boolean expression.
Definition: cpelang_priv.h:52
Iterator over CVE vulnerable configurations.
const char * cve_configuration_get_id(const struct cve_configuration *conf)
Get CVE configuration id.
bool cve_model_set_pub_date(struct cve_model *obj, const char *newval)
struct cve_reference_iterator * cve_entry_get_references(const struct cve_entry *item)
Get an iterator to CVE entry&#39;s references.
void cwe_entry_free(struct cwe_entry *entry)
Free CVE entry.
Definition: cve_priv.c:842
struct cve_entry_iterator * cve_model_get_entries(const struct cve_model *cve_model)
Get en iterator to CVE entries.
struct cve_product_iterator * cve_entry_get_products(const struct cve_entry *entry)
Get CVE entry products.
bool cve_reference_set_lang(struct cve_reference *reference, const char *new_lang)
struct cve_model * cve_model_new(void)
New CVE model.
Definition: cve_priv.c:367
void cve_product_iterator_remove(struct cve_product_iterator *it)
void cve_entry_iterator_reset(struct cve_entry_iterator *it)
bool cve_reference_set_type(struct cve_reference *reference, const char *new_type)
Set type of CVE reference.
void cve_summary_free(struct cve_summary *summary)
Free CVE summary.
Definition: cve_priv.c:785
bool cve_entry_add_configuration(struct cve_entry *entry, struct cve_configuration *new_configuration)
const char * cve_reference_get_type(const struct cve_reference *ref)
Get CVE reference type.
void cve_summary_iterator_remove(struct cve_summary_iterator *it)
const char * cve_summary_get_summary(const struct cve_summary *summary)
Get value from CVE summary.
bool cve_reference_set_source(struct cve_reference *reference, const char *new_source)
Set source of CVE reference.
const char * cve_model_get_pub_date(const struct cve_model *item)
struct cve_product * cve_product_new(void)
New CVE product.
Definition: cve_priv.c:303
struct cve_model * cve_model_clone(struct cve_model *old_model)
Clone CVE model.
Definition: cve_priv.c:383
const char * cwe_entry_get_value(const struct cwe_entry *entry)
Get CVE entry value.
Iterator over CVE summaries.
struct cve_configuration * cve_configuration_clone(struct cve_configuration *old_conf)
Clone CVE configuration.
Definition: cve_priv.c:274
Structure holding CVE summary data.
Definition: cve_priv.c:92
void cve_reference_iterator_remove(struct cve_reference_iterator *it)
struct cve_entry * cve_entry_clone(struct cve_entry *old_entry)
Clone CVE entry.
Definition: cve_priv.c:239
struct cpe_testexpr * cve_configuration_get_expr(const struct cve_configuration *conf)
Get CVE configuration test expression.
Definition: cve_priv.c:201