OpenVAS Scanner  6.0.1
Macros | Functions
comm.c File Reference

Communication manager; it manages the NTP Protocol version 1.0 and 1.1. More...

#include "comm.h"
#include "../misc/network.h"
#include "../misc/nvt_categories.h"
#include "../misc/plugutils.h"
#include "../nasl/nasl.h"
#include "ntp.h"
#include "pluginload.h"
#include "pluginscheduler.h"
#include "sighand.h"
#include "utils.h"
#include <errno.h>
#include <glib.h>
#include <gvm/base/prefs.h>
#include <gvm/util/nvticache.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Macros

#define G_LOG_DOMAIN   "sd main"
 GLib log domain. More...
 

Functions

int comm_init (int soc)
 Initializes the communication between the scanner (us) and the client. More...
 
int comm_loading (int soc)
 Informs the client that the scanner is still loading. More...
 
static int is_client_present (int soc)
 
void comm_terminate (int soc)
 This function must be called at the end of a session. More...
 
void send_plug_info (int soc, const char *oid)
 Sends a plugin info. More...
 
static void comm_send_pluginlist (int soc, GSList *oids)
 Sends the list of plugins that the scanner could load to the client,. More...
 
static void send_plugins_preferences (int soc, GSList *oids)
 Sends the list of plugins preferences to the client. More...
 
static void comm_send_preferences (int soc, GSList *oids)
 Sends the preferences of the scanner. More...
 
int comm_wait_order (struct scan_globals *globals)
 This function waits for the attack order of the client. Meanwhile, it processes all the messages the client could send. More...
 
static int is_valid_feed_version (const char *feed_version)
 Determine whether a buffer contains a valid feed version. More...
 
void comm_send_nvt_info (int soc)
 Send the OTP NVT_INFO message and then handle any COMPLETE_LIST. More...
 

Detailed Description

Communication manager; it manages the NTP Protocol version 1.0 and 1.1.

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "sd main"

GLib log domain.

Function Documentation

◆ comm_init()

int comm_init ( int  soc)

Initializes the communication between the scanner (us) and the client.

Returns
0 if success, -1 if error.

◆ comm_loading()

int comm_loading ( int  soc)

Informs the client that the scanner is still loading.

Parameters
[in]socSocket to send and receive from.
Returns
0 if success, -1 if error.

◆ comm_send_nvt_info()

void comm_send_nvt_info ( int  soc)

Send the OTP NVT_INFO message and then handle any COMPLETE_LIST.

◆ comm_send_pluginlist()

static void comm_send_pluginlist ( int  soc,
GSList *  oids 
)
static

Sends the list of plugins that the scanner could load to the client,.

using the OTP format (calls send_plug_info for each).

Parameters
socSocket to use for sending list of plugins.
oidsList of OIDs to send.
See also
send_plug_info

◆ comm_send_preferences()

static void comm_send_preferences ( int  soc,
GSList *  oids 
)
static

Sends the preferences of the scanner.

Parameters
socSocket to use for sending.
oidsList of OIDs to send.

◆ comm_terminate()

void comm_terminate ( int  soc)

This function must be called at the end of a session.

◆ comm_wait_order()

int comm_wait_order ( struct scan_globals globals)

This function waits for the attack order of the client. Meanwhile, it processes all the messages the client could send.

◆ is_client_present()

static int is_client_present ( int  soc)
static

Determines if the client is still connected.

Returns
1 if the client is here, 0 if it's not.

◆ is_valid_feed_version()

static int is_valid_feed_version ( const char *  feed_version)
static

Determine whether a buffer contains a valid feed version.

Parameters
[in]feed_versionBuffer containing feed_version.
Returns
1 is valid feed_version, 0 otherwise.

◆ send_plug_info()

void send_plug_info ( int  soc,
const char *  oid 
)

Sends a plugin info.

◆ send_plugins_preferences()

static void send_plugins_preferences ( int  soc,
GSList *  oids 
)
static

Sends the list of plugins preferences to the client.

Parameters
socSocket to use for sending list of preferences.
oidsList OIDs to send.