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

Greenbone Vulnerability Management Libraries 23.1.1

Data Structures | Macros | Enumerations | Functions
cpeutils.h File Reference

Headers for CPE utils. More...

`#include <glib.h>`
`#include <stdio.h>`

Go to the source code of this file.

## Data Structures
struct | cpe_struct_t
| XML context. More...

## Macros
#define | CPE_COMPONENT_IS_ANY(component)

## Enumerations
enum | set_relation { DISJOINT , EQUAL , SUBSET , SUPERSET , UNDEFINED }

## Functions
char * | uri_cpe_to_fs_cpe (const char *)
| Convert a URI CPE to a formatted string CPE.
char * | uri_cpe_to_fs_product (const char *)
| Convert a URI CPE to a formatted string product.
char * | uri_cpe_to_uri_product (const char *)
| Convert a URI CPE to a formatted string product.
char * | fs_cpe_to_uri_cpe (const char *)
| Convert a formatted string CPE to a URI CPE.
char * | fs_cpe_to_uri_product (const char *)
| Convert a formatted string CPE to an URI product.
void | uri_cpe_to_cpe_struct (const char *, cpe_struct_t *)
| Read a URI CPE into the CPE struct.
char * | cpe_struct_to_uri_cpe (const cpe_struct_t *)
| Convert a CPE struct into a URI CPE.
char * | cpe_struct_to_uri_product (const cpe_struct_t *)
| Convert a CPE struct into a URI product.
char * | get_version_from_uri_cpe (const char *)
| Get the version from an uri cpe.
void | fs_cpe_to_cpe_struct (const char *, cpe_struct_t *)
| Read a formatted string CPE into the CPE struct.
char * | cpe_struct_to_fs_cpe (const cpe_struct_t *)
| Convert a CPE struct into a formatted string CPE.
char * | cpe_struct_to_fs_product (const cpe_struct_t *)
| Convert a CPE struct into a formatted string product.
void | cpe_struct_init (cpe_struct_t *)
| Initialize a CPE struct.
void | cpe_struct_free (cpe_struct_t *)
| Free a CPE struct.
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.
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. That means, that source is a superset of target if also the first part matches.

## Detailed Description

Headers for CPE utils.

## Macro Definition Documentation

## ◆ CPE_COMPONENT_IS_ANY

#define CPE_COMPONENT_IS_ANY | ( |  | component | ) |

Value:
(component[0] == 'A')

## Enumeration Type Documentation

## ◆ set_relation

enum set_relation

Enumerator
DISJOINT |
EQUAL |
SUBSET |
SUPERSET |
UNDEFINED |

## Function Documentation

## ◆ cpe_struct_free()

void cpe_struct_free | ( | cpe_struct_t * | cpe | ) |

Free a CPE struct.

Parameters

  [in,out] | cpe | The CPE to be freed.

## ◆ cpe_struct_init()

void cpe_struct_init | ( | cpe_struct_t * | cpe | ) |

Initialize a CPE struct.

Parameters

  [in,out] | cpe | The pointer to the CPE to initialize.

## ◆ cpe_struct_match()

gboolean cpe_struct_match | ( | cpe_struct_t * | source,
|  | cpe_struct_t * | target )

Returns if source is a match for target. That means that source is a superset of target.

Parameters

  [in] | source | The cpe_struct that represents a set of CPEs.
  [in] | target | The cpe_struct that represents a single CPE or or a set of CPEs that is checked if it is a subset of source meaning that it is matched by source.

Returns
  Returns if source is a match for target.

## ◆ cpe_struct_match_tail()

gboolean cpe_struct_match_tail | ( | cpe_struct_t * | source,
|  | cpe_struct_t * | target )

Returns if the part behind the version of source is a match for that part of target. That means, that source is a superset of target if also the first part matches.

Parameters

  [in] | source | The cpe_struct that represents a set of CPEs.
  [in] | target | The cpe_struct that represents a single CPE or or a set of CPEs that is checked if it is a subset of source meaning that it is matched by source.

Returns
  Returns if source is a match for target.

## ◆ cpe_struct_to_fs_cpe()

char * cpe_struct_to_fs_cpe | ( | const cpe_struct_t * | cpe | ) |

Convert a CPE struct into a formatted string CPE.

Parameters

  [in] | cpe | A pointer to the CPE struct.

Returns
  A formatted string CPE.

## ◆ cpe_struct_to_fs_product()

char * cpe_struct_to_fs_product | ( | const cpe_struct_t * | cpe | ) |

Convert a CPE struct into a formatted string product.

Parameters

  [in] | cpe | A pointer to the CPE struct.

Returns
  A formatted string product.

## ◆ cpe_struct_to_uri_cpe()

char * cpe_struct_to_uri_cpe | ( | const cpe_struct_t * | cpe | ) |

Convert a CPE struct into a URI CPE.

Parameters

  [in] | cpe | A pointer to the CPE struct.

Returns
  A CPE v2.2-conformant URI.

## ◆ cpe_struct_to_uri_product()

char * cpe_struct_to_uri_product | ( | const cpe_struct_t * | cpe | ) |

Convert a CPE struct into a URI product.

Parameters

  [in] | cpe | A pointer to the CPE struct.

Returns
  A CPE v2.2-conformant URI product.

## ◆ fs_cpe_to_cpe_struct()

void fs_cpe_to_cpe_struct | ( | const char * | fs_cpe,
|  | cpe_struct_t * | cpe )

Read a formatted string CPE into the CPE struct.

Parameters

  [in] | fs_cpe | A formatted string CPE.
  [out] | cpe | Pointer to the filled CPE struct.

## ◆ fs_cpe_to_uri_cpe()

char * fs_cpe_to_uri_cpe | ( | const char * | fs_cpe | ) |

Convert a formatted string CPE to a URI CPE.

Parameters

  [in] | fs_cpe | A formatted string CPE.

Returns
  A CPE v2.2-conformant URI.

## ◆ fs_cpe_to_uri_product()

char * fs_cpe_to_uri_product | ( | const char * | fs_cpe | ) |

Convert a formatted string CPE to an URI product.

Parameters

  [in] | fs_cpe | A formatted string CPE.

Returns
  An URI product.

## ◆ get_version_from_uri_cpe()

char * get_version_from_uri_cpe | ( | const char * | uri_cpe | ) |

Get the version from an uri cpe.

Parameters

  [in] | uri_cpe | The uri cpe to get the version from.

Returns
  The version of the uri cpe.

## ◆ uri_cpe_to_cpe_struct()

void uri_cpe_to_cpe_struct | ( | const char * | uri_cpe,
|  | cpe_struct_t * | cpe )

Read a URI CPE into the CPE struct.

Parameters

  [in] | uri_cpe | A CPE v2.2-conformant URI.
  [out] | cpe | Pointer to the filled CPE struct.

## ◆ uri_cpe_to_fs_cpe()

char * uri_cpe_to_fs_cpe | ( | const char * | uri_cpe | ) |

Convert a URI CPE to a formatted string CPE.

Parameters

  [in] | uri_cpe | A CPE v2.2-conformant URI.

Returns
  A formatted string CPE.

## ◆ uri_cpe_to_fs_product()

char * uri_cpe_to_fs_product | ( | const char * | uri_cpe | ) |

Convert a URI CPE to a formatted string product.

Parameters

  [in] | uri_cpe | A CPE v2.2-conformant URI.

Returns
  A formatted string product.

## ◆ uri_cpe_to_uri_product()

char * uri_cpe_to_uri_product | ( | const char * | uri_cpe | ) |

Convert a URI CPE to a formatted string product.

Parameters

  [in] | uri_cpe | A CPE v2.2-conformant URI.

Returns
  A CPE v2.2-conformant URI product.