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