OpenVAS Scanner 23.23.1
ipc_openvas.c File Reference
#include "ipc_openvas.h"
#include <json-glib/json-glib.h>

Go to the source code of this file.

Data Structures

struct  ipc_hostname
struct  ipc_user_agent
struct  ipc_lsc
struct  ipc_data

Macros

#define G_LOG_DOMAIN   "lib misc"
 GLib logging domain.

Typedefs

typedef struct ipc_hostname ipc_hostname_t
typedef struct ipc_user_agent ipc_user_agent_t
typedef struct ipc_lsc ipc_lsc_t

Functions

enum ipc_data_type ipc_get_data_type_from_data (ipc_data_t *data)
 Get the data type in data.
gchar * ipc_get_hostname_from_data (ipc_data_t *data)
 Get the hostname from IPC data.
gchar * ipc_get_hostname_source_from_data (ipc_data_t *data)
 Get the vhost hostname source from IPC data.
gchar * ipc_get_user_agent_from_data (ipc_data_t *data)
 Get the User-Agent from IPC data.
gboolean ipc_get_lsc_data_ready_flag (ipc_data_t *data)
 Get the package list from LSC IPC data.
ipc_data_tipc_data_type_from_hostname (const char *source, size_t source_len, const char *hostname, size_t hostname_len)
 initializes ipc_data for a hostname data.
static void ipc_hostname_destroy (ipc_hostname_t *data)
 Free ipc_hostname_t data.
ipc_data_tipc_data_type_from_user_agent (const char *user_agent, size_t user_agent_len)
 initializes ipc_data for the User-Agent.
static void ipc_user_agent_destroy (ipc_user_agent_t *data)
 Free a user agent data structure.
ipc_data_tipc_data_type_from_lsc (gboolean data_ready)
 initializes ipc_data for the table driven LSC.
static void ipc_lsc_destroy (ipc_lsc_t *data)
 Free a LSC data structure.
void ipc_data_destroy (ipc_data_t **data)
 destroys ipc_data.
const char * ipc_data_to_json (ipc_data_t *data)
 transforms ipc_data to a json string
ipc_data_tipc_data_from_json (const char *json, size_t len)
 transforms json string to a ipc_data struct

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "lib misc"

GLib logging domain.

Typedef Documentation

◆ ipc_hostname_t

typedef struct ipc_hostname ipc_hostname_t

◆ ipc_lsc_t

typedef struct ipc_lsc ipc_lsc_t

◆ ipc_user_agent_t

Function Documentation

◆ ipc_data_destroy()

void ipc_data_destroy ( ipc_data_t ** data)

destroys ipc_data.

Parameters
datathe ipc_data to be destroyed.

◆ ipc_data_from_json()

ipc_data_t * ipc_data_from_json ( const char * json,
size_t len )

transforms json string to a ipc_data struct

Parameters
jsonthe json representation to be transformed.
lenthe length of the json representation
Returns
a heap allocated ipc_data or NULL on failure.

◆ ipc_data_to_json()

const char * ipc_data_to_json ( ipc_data_t * data)

transforms ipc_data to a json string

Parameters
datathe ipc_data to be transformed.
Returns
a heap allocated achar array containing the json or NULL on failure.

◆ ipc_data_type_from_hostname()

ipc_data_t * ipc_data_type_from_hostname ( const char * source,
size_t source_len,
const char * hostname,
size_t hostname_len )

initializes ipc_data for a hostname data.

Parameters
sourcethe source of the hostname
hostnamethe name of the host
Returns
a heap initialized ipc_data or NULL on failure.

◆ ipc_data_type_from_lsc()

ipc_data_t * ipc_data_type_from_lsc ( gboolean data_ready)

initializes ipc_data for the table driven LSC.

Parameters
os_releaseThe OS release
Returns
a heap initialized ipc_data or NULL on failure.

◆ ipc_data_type_from_user_agent()

ipc_data_t * ipc_data_type_from_user_agent ( const char * user_agent,
size_t user_agent_len )

initializes ipc_data for the User-Agent.

Parameters
user_agentThe User-Agent
user_agent_lenLength of the user agent string.
Returns
a heap initialized ipc_data or NULL on failure.

◆ ipc_get_data_type_from_data()

enum ipc_data_type ipc_get_data_type_from_data ( ipc_data_t * data)

Get the data type in data.

Parameters
dataStructure containing the data and data type

@Return The corresponding ipc_data_type, IPC_DT_ERROR on error.

◆ ipc_get_hostname_from_data()

gchar * ipc_get_hostname_from_data ( ipc_data_t * data)

Get the hostname from IPC data.

Parameters
dataData structure of IPC_DT_HOSNAME type.

@Return a string containing the hostname, NULL on error.

◆ ipc_get_hostname_source_from_data()

gchar * ipc_get_hostname_source_from_data ( ipc_data_t * data)

Get the vhost hostname source from IPC data.

Parameters
dataData structure of IPC_DT_HOSNAME type.

@Return a string containing the vhost hostname source, NULL on error.

◆ ipc_get_lsc_data_ready_flag()

gboolean ipc_get_lsc_data_ready_flag ( ipc_data_t * data)

Get the package list from LSC IPC data.

Parameters
dataData structure of IPC_DT_LSC type.

@Return True if the data is ready for running with LSC, False otherwise.

◆ ipc_get_user_agent_from_data()

gchar * ipc_get_user_agent_from_data ( ipc_data_t * data)

Get the User-Agent from IPC data.

Parameters
dataData structure of IPC_DT_USER_AGENT type.

@Return a string containing the User-Agent, NULL on error.

◆ ipc_hostname_destroy()

void ipc_hostname_destroy ( ipc_hostname_t * data)
static

Free ipc_hostname_t data.

Parameters
dataThe hostname data structure to be free()'ed

◆ ipc_lsc_destroy()

void ipc_lsc_destroy ( ipc_lsc_t * data)
static

Free a LSC data structure.

Parameters
dataThe lsc data structure to be free()'ed

◆ ipc_user_agent_destroy()

void ipc_user_agent_destroy ( ipc_user_agent_t * data)
static

Free a user agent data structure.

Parameters
dataThe user agent data structure to be free()'ed