Greenbone Vulnerability Manager  22.4.0~dev1
Data Structures | Macros | Functions | Variables
gmp_license.c File Reference

GVM GMP layer: License information. More...

#include "gmp_license.h"
#include "manage_license.h"
#include "utils.h"

Data Structures

struct  get_license_t
 The get_license command. More...
 
struct  modify_license_t
 The modify_license command. More...
 

Macros

#define G_LOG_DOMAIN   "md gmp"
 GLib log domain.
 

Functions

static void get_license_reset ()
 Reset command data.
 
void get_license_start (gmp_parser_t *gmp_parser, const gchar **attribute_names, const gchar **attribute_values)
 Start a command. More...
 
void get_license_element_start (gmp_parser_t *gmp_parser, const gchar *name, const gchar **attribute_names, const gchar **attribute_values)
 Start element. More...
 
static void buffer_license_content_xml (GString *response, theia_license_t *license_data)
 Writes license data to a GString as XML. More...
 
static void get_license_run (gmp_parser_t *gmp_parser, GError **error)
 Execute command. More...
 
int get_license_element_end (gmp_parser_t *gmp_parser, GError **error, const gchar *name)
 End element. More...
 
void get_license_element_text (const gchar *text, gsize text_len)
 Add text to element. More...
 
static void modify_license_reset ()
 Reset command data.
 
void modify_license_start (gmp_parser_t *gmp_parser, const gchar **attribute_names, const gchar **attribute_values)
 Start a command. More...
 
void modify_license_element_start (gmp_parser_t *gmp_parser, const gchar *name, const gchar **attribute_names, const gchar **attribute_values)
 Start element. More...
 
static int modify_license (gchar *file_content, gboolean allow_empty, char **error_msg)
 Handles modifying the license. More...
 
static void modify_license_run (gmp_parser_t *gmp_parser, GError **error)
 Execute command. More...
 
int modify_license_element_end (gmp_parser_t *gmp_parser, GError **error, const gchar *name)
 End element. More...
 
void modify_license_element_text (const gchar *text, gsize text_len)
 Add text to element. More...
 

Variables

static get_license_t get_license_data
 Parser callback data. More...
 
static modify_license_t modify_license_data
 Parser callback data. More...
 

Detailed Description

GVM GMP layer: License information.

This includes function and variable definitions for GMP handling of license information.

Function Documentation

◆ buffer_license_content_xml()

static void buffer_license_content_xml ( GString *  response,
theia_license_t license_data 
)
static

Writes license data to a GString as XML.

Parameters
[in]responseThe GString buffer to write the license content to.
[in]license_dataThe license data struct to get the data from.

◆ get_license_element_end()

int get_license_element_end ( gmp_parser_t gmp_parser,
GError **  error,
const gchar *  name 
)

End element.

Parameters
[in]gmp_parserGMP parser.
[in]errorError parameter.
[in]nameElement name.
Returns
0 success, 1 command finished.

◆ get_license_element_start()

void get_license_element_start ( gmp_parser_t gmp_parser,
const gchar *  name,
const gchar **  attribute_names,
const gchar **  attribute_values 
)

Start element.

Parameters
[in]gmp_parserGMP parser.
[in]nameElement name.
[in]attribute_namesAll attribute names.
[in]attribute_valuesAll attribute values.

◆ get_license_element_text()

void get_license_element_text ( const gchar *  text,
gsize  text_len 
)

Add text to element.

Parameters
[in]textText.
[in]text_lenText length.

◆ get_license_run()

static void get_license_run ( gmp_parser_t gmp_parser,
GError **  error 
)
static

Execute command.

Parameters
[in]gmp_parserGMP parser.
[in]errorError parameter.

◆ get_license_start()

void get_license_start ( gmp_parser_t gmp_parser,
const gchar **  attribute_names,
const gchar **  attribute_values 
)

Start a command.

Parameters
[in]gmp_parserGMP parser.
[in]attribute_namesAll attribute names.
[in]attribute_valuesAll attribute values.

◆ modify_license()

static int modify_license ( gchar *  file_content,
gboolean  allow_empty,
char **  error_msg 
)
static

Handles modifying the license.

Parameters
[in]file_contentThe content of the new license file.
[in]allow_emptyWhether to allow an empty file.
[out]error_msgThe error message of the license update if any
Returns
0 success, 1 service unavailable, 2 empty file not allowed, 99 permission denied.

◆ modify_license_element_end()

int modify_license_element_end ( gmp_parser_t gmp_parser,
GError **  error,
const gchar *  name 
)

End element.

Parameters
[in]gmp_parserGMP parser.
[in]errorError parameter.
[in]nameElement name.
Returns
0 success, 1 command finished.

◆ modify_license_element_start()

void modify_license_element_start ( gmp_parser_t gmp_parser,
const gchar *  name,
const gchar **  attribute_names,
const gchar **  attribute_values 
)

Start element.

Parameters
[in]gmp_parserGMP parser.
[in]nameElement name.
[in]attribute_namesAll attribute names.
[in]attribute_valuesAll attribute values.

◆ modify_license_element_text()

void modify_license_element_text ( const gchar *  text,
gsize  text_len 
)

Add text to element.

Parameters
[in]textText.
[in]text_lenText length.

◆ modify_license_run()

static void modify_license_run ( gmp_parser_t gmp_parser,
GError **  error 
)
static

Execute command.

Parameters
[in]gmp_parserGMP parser.
[in]errorError parameter.

◆ modify_license_start()

void modify_license_start ( gmp_parser_t gmp_parser,
const gchar **  attribute_names,
const gchar **  attribute_values 
)

Start a command.

Parameters
[in]gmp_parserGMP parser.
[in]attribute_namesAll attribute names.
[in]attribute_valuesAll attribute values.

Variable Documentation

◆ get_license_data

get_license_t get_license_data
static

Parser callback data.

This is initially 0 because it's a global variable.

◆ modify_license_data

modify_license_t modify_license_data
static

Parser callback data.

This is initially 0 because it's a global variable.