Greenbone Vulnerability Management Libraries 22.8.0
Macros | Functions | Variables
prefs.c File Reference

Implementation of API to handle globally stored preferences. More...

#include "prefs.h"
#include "settings.h"
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Macros

#define G_LOG_DOMAIN   "libgvm base"
 GLib log domain.
 

Functions

void prefs_set (const gchar *key, const gchar *value)
 Set a string preference value via a key.
 
static void prefs_init (void)
 Initializes the preferences structure. If it was already initialized, remove old settings and start from scratch.
 
GHashTable * preferences_get (void)
 Get the pointer to the global preferences structure. Eventually this function should not be used anywhere.
 
const gchar * prefs_get (const gchar *key)
 Get a string preference value via a key.
 
int prefs_get_bool (const gchar *key)
 Get a boolean expression of a preference value via a key.
 
void prefs_config (const char *config)
 Apply the configs from given file as preferences.
 
void prefs_dump (void)
 Dump the preferences to stdout.
 

Variables

static GHashTable * global_prefs = NULL
 

Detailed Description

Implementation of API to handle globally stored preferences.

A global store of preferences to scanner and NVTs is handled by this module.

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "libgvm base"

GLib log domain.

Function Documentation

◆ preferences_get()

GHashTable * preferences_get ( void )

Get the pointer to the global preferences structure. Eventually this function should not be used anywhere.

Returns
Pointer to the global preferences structure.

◆ prefs_config()

void prefs_config ( const char * config)

Apply the configs from given file as preferences.

Parameters
configFilename of the configuration file.

◆ prefs_dump()

void prefs_dump ( void )

Dump the preferences to stdout.

◆ prefs_get()

const gchar * prefs_get ( const gchar * key)

Get a string preference value via a key.

Parameters
keyThe identifier for the preference.
Returns
A pointer to a string with the value for the preference. NULL in case for the key no preference was found or the preference is not of type string.

◆ prefs_get_bool()

int prefs_get_bool ( const gchar * key)

Get a boolean expression of a preference value via a key.

Parameters
keyThe identifier for the preference.
Returns
1 if the value is considered to represent "true" and 0 if the value is considered to represent "false". If the preference is of type string, value "yes" is true, anything else is false. Any other type or non-existing key is false.

◆ prefs_init()

static void prefs_init ( void )
static

Initializes the preferences structure. If it was already initialized, remove old settings and start from scratch.

◆ prefs_set()

void prefs_set ( const gchar * key,
const gchar * value )

Set a string preference value via a key.

Parameters
keyThe identifier for the preference. A copy of this will be created if necessary.
valueThe value to set. A copy of this will be created.

Variable Documentation

◆ global_prefs

GHashTable* global_prefs = NULL
static