cpeutils.h
Go to the documentation of this file.
/* SPDX-FileCopyrightText: 2009-2024 Greenbone AG
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef _GVM_UTIL_CPEUTILS_H
#define _GVM_UTIL_CPEUTILS_H
#include <glib.h>
#include <stdio.h>
typedef struct
{
char *part;
char *vendor;
char *product;
char *version;
char *update;
char *edition;
char *sw_edition;
char *target_sw;
char *target_hw;
char *other;
char *language;
} cpe_struct_t;
char *
uri_cpe_to_fs_cpe (const char *);
char *
uri_cpe_to_fs_product (const char *);
char *
uri_cpe_to_uri_product (const char *);
char *
fs_cpe_to_uri_cpe (const char *);
char *
fs_cpe_to_uri_product (const char *);
void
uri_cpe_to_cpe_struct (const char *, cpe_struct_t *);
char *
cpe_struct_to_uri_cpe (const cpe_struct_t *);
char *
cpe_struct_to_uri_product (const cpe_struct_t *);
char *
get_version_from_uri_cpe (const char *);
void
fs_cpe_to_cpe_struct (const char *, cpe_struct_t *);
char *
cpe_struct_to_fs_cpe (const cpe_struct_t *);
char *
cpe_struct_to_fs_product (const cpe_struct_t *);
void
cpe_struct_init (cpe_struct_t *);
void
cpe_struct_free (cpe_struct_t *);
gboolean
cpe_struct_match (cpe_struct_t *, cpe_struct_t *);
gboolean
cpe_struct_match_tail (cpe_struct_t *, cpe_struct_t *);
enum set_relation
{
DISJOINT,
EQUAL,
SUBSET,
SUPERSET,
UNDEFINED
};
#define CPE_COMPONENT_IS_ANY(component) (component[0] == 'A')
#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