Greenbone Vulnerability Management Libraries: util/cpeutils.h Source File

Greenbone Vulnerability Management Libraries 23.1.1

cpeutils.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009-2024 Greenbone AG
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
10
11#ifndef _GVM_UTIL_CPEUTILS_H
12#define _GVM_UTIL_CPEUTILS_H
13
14#include <glib.h>
15#include <stdio.h>
16
22 typedef struct
23{
24 char *part;
25 char *vendor;
26 char *product;
27 char *version;
28 char *update;
29 char *edition;
30 char *sw_edition;
31 char *target_sw;
32 char *target_hw;
33 char *other;
34 char *language;
35} cpe_struct_t;
36
37char *
38 uri_cpe_to_fs_cpe (const char *);
39
40char *
41 uri_cpe_to_fs_product (const char *);
42
43char *
44 uri_cpe_to_uri_product (const char *);
45
46char *
47 fs_cpe_to_uri_cpe (const char *);
48
49char *
50 fs_cpe_to_uri_product (const char *);
51
52void
53 uri_cpe_to_cpe_struct (const char *, cpe_struct_t *);
54
55char *
56 cpe_struct_to_uri_cpe (const cpe_struct_t *);
57
58char *
59 cpe_struct_to_uri_product (const cpe_struct_t *);
60
61char *
62 get_version_from_uri_cpe (const char *);
63
64void
65 fs_cpe_to_cpe_struct (const char *, cpe_struct_t *);
66
67char *
68 cpe_struct_to_fs_cpe (const cpe_struct_t *);
69
70char *
71 cpe_struct_to_fs_product (const cpe_struct_t *);
72
73void
74 cpe_struct_init (cpe_struct_t *);
75
76void
77 cpe_struct_free (cpe_struct_t *);
78
79gboolean
80 cpe_struct_match (cpe_struct_t *, cpe_struct_t *);
81
82gboolean
83 cpe_struct_match_tail (cpe_struct_t *, cpe_struct_t *);
84
85 enum set_relation
86{
87 DISJOINT,
88 EQUAL,
89 SUBSET,
90 SUPERSET,
91 UNDEFINED
92};
93
94#define CPE_COMPONENT_IS_ANY(component) (component[0] == 'A')
95
96#endif /* not _GVM_UTIL_CPEUTILS_H */
cpe_struct_init
void cpe_struct_init(cpe_struct_t *)
Initialize a CPE struct.
Definition cpeutils.c:1184
fs_cpe_to_cpe_struct
void fs_cpe_to_cpe_struct(const char *, cpe_struct_t *)
Read a formatted string CPE into the CPE struct.
Definition cpeutils.c:366
cpe_struct_to_uri_cpe
char * cpe_struct_to_uri_cpe(const cpe_struct_t *)
Convert a CPE struct into a URI CPE.
Definition cpeutils.c:240
uri_cpe_to_cpe_struct
void uri_cpe_to_cpe_struct(const char *, cpe_struct_t *)
Read a URI CPE into the CPE struct.
Definition cpeutils.c:200
cpe_struct_to_fs_product
char * cpe_struct_to_fs_product(const cpe_struct_t *)
Convert a CPE struct into a formatted string product.
Definition cpeutils.c:496
cpe_struct_match_tail
gboolean cpe_struct_match_tail(cpe_struct_t *, cpe_struct_t *)
Returns if the part behind the version of source is a match for that part of target....
Definition cpeutils.c:1333
get_version_from_uri_cpe
char * get_version_from_uri_cpe(const char *)
Get the version from an uri cpe.
Definition cpeutils.c:350
fs_cpe_to_uri_product
char * fs_cpe_to_uri_product(const char *)
Convert a formatted string CPE to an URI product.
Definition cpeutils.c:180
cpe_struct_free
void cpe_struct_free(cpe_struct_t *)
Free a CPE struct.
Definition cpeutils.c:1208
set_relation
set_relation
Definition cpeutils.h:86
SUBSET
@ SUBSET
Definition cpeutils.h:89
DISJOINT
@ DISJOINT
Definition cpeutils.h:87
EQUAL
@ EQUAL
Definition cpeutils.h:88
UNDEFINED
@ UNDEFINED
Definition cpeutils.h:91
SUPERSET
@ SUPERSET
Definition cpeutils.h:90
uri_cpe_to_uri_product
char * uri_cpe_to_uri_product(const char *)
Convert a URI CPE to a formatted string product.
Definition cpeutils.c:140
cpe_struct_to_uri_product
char * cpe_struct_to_uri_product(const cpe_struct_t *)
Convert a CPE struct into a URI product.
Definition cpeutils.c:309
fs_cpe_to_uri_cpe
char * fs_cpe_to_uri_cpe(const char *)
Convert a formatted string CPE to a URI CPE.
Definition cpeutils.c:160
uri_cpe_to_fs_product
char * uri_cpe_to_fs_product(const char *)
Convert a URI CPE to a formatted string product.
Definition cpeutils.c:120
cpe_struct_to_fs_cpe
char * cpe_struct_to_fs_cpe(const cpe_struct_t *)
Convert a CPE struct into a formatted string CPE.
Definition cpeutils.c:402
cpe_struct_match
gboolean cpe_struct_match(cpe_struct_t *, cpe_struct_t *)
Returns if source is a match for target. That means that source is a superset of target.
Definition cpeutils.c:1278
uri_cpe_to_fs_cpe
char * uri_cpe_to_fs_cpe(const char *)
Convert a URI CPE to a formatted string CPE.
Definition cpeutils.c:100
cpe_struct_t
XML context.
Definition cpeutils.h:23
cpe_struct_t::sw_edition
char * sw_edition
Definition cpeutils.h:30
cpe_struct_t::target_sw
char * target_sw
Definition cpeutils.h:31
cpe_struct_t::vendor
char * vendor
Definition cpeutils.h:25
cpe_struct_t::version
char * version
Definition cpeutils.h:27
cpe_struct_t::update
char * update
Definition cpeutils.h:28
cpe_struct_t::product
char * product
Definition cpeutils.h:26
cpe_struct_t::part
char * part
Definition cpeutils.h:24
cpe_struct_t::edition
char * edition
Definition cpeutils.h:29
cpe_struct_t::language
char * language
Definition cpeutils.h:34
cpe_struct_t::target_hw
char * target_hw
Definition cpeutils.h:32
cpe_struct_t::other
char * other
Definition cpeutils.h:33