Greenbone Vulnerability Manager  22.4.0~dev1
Macros | Functions
manage_sql_nvts.h File Reference

Manager Manage library: SQL backend headers. More...

Go to the source code of this file.

Macros

#define NVT_INFO_ITERATOR_FILTER_COLUMNS
 Filter columns for NVT info iterator. More...
 
#define NVT_ITERATOR_COLUMNS
 NVT iterator columns. More...
 
#define NVT_ITERATOR_COLUMNS_NVTS
 NVT iterator columns. More...
 

Functions

const char * get_osp_vt_update_socket ()
 Get the current file socket for OSP NVT update. More...
 
void set_osp_vt_update_socket (const char *new_socket)
 Set the file socket for OSP NVT update. More...
 
int check_osp_vt_update_socket ()
 Check the files socket used for OSP NVT update. More...
 
void check_db_nvts ()
 Ensures the sanity of nvts cache in DB.
 
int check_config_families ()
 Ensure that all configs refer to the right NVT families. More...
 
void manage_sync_nvts (int(*)())
 Sync NVTs if newer NVTs are available. More...
 
int update_or_rebuild_nvts (int)
 Update or rebuild NVT db. More...
 
int nvts_feed_version_status ()
 Check VTs feed version status. More...
 
int manage_update_nvt_cache_osp (const gchar *)
 Update VTs via OSP. More...
 
char * nvt_family (const char *)
 Get the family of an NVT. More...
 
int family_count ()
 Get the number of families. More...
 

Detailed Description

Manager Manage library: SQL backend headers.

Macro Definition Documentation

◆ NVT_INFO_ITERATOR_FILTER_COLUMNS

#define NVT_INFO_ITERATOR_FILTER_COLUMNS
Value:
{ GET_ITERATOR_FILTER_COLUMNS, "version", "cve", \
"family", "cvss_base", "severity", "cvss", "script_tags", "qod", \
"qod_type", "solution_type", "solution", "summary", "insight", \
"affected", "impact", "detection", "solution_method", NULL }

Filter columns for NVT info iterator.

◆ NVT_ITERATOR_COLUMNS

#define NVT_ITERATOR_COLUMNS
Value:
{ \
GET_ITERATOR_COLUMNS_PREFIX (""), \
{ "''", "_owner", KEYWORD_TYPE_STRING }, \
{ "0", NULL, KEYWORD_TYPE_INTEGER }, \
{ "oid", NULL, KEYWORD_TYPE_STRING }, \
{ "modification_time", "version", KEYWORD_TYPE_INTEGER }, \
{ "name", NULL, KEYWORD_TYPE_STRING }, \
{ "cve", NULL, KEYWORD_TYPE_STRING }, \
{ "tag", NULL, KEYWORD_TYPE_STRING }, \
{ "category", NULL, KEYWORD_TYPE_STRING }, \
{ "family", NULL, KEYWORD_TYPE_STRING }, \
{ "cvss_base", NULL, KEYWORD_TYPE_DOUBLE }, \
{ "cvss_base", "severity", KEYWORD_TYPE_DOUBLE }, \
{ "cvss_base", "cvss", KEYWORD_TYPE_DOUBLE }, \
{ "qod", NULL, KEYWORD_TYPE_INTEGER }, \
{ "qod_type", NULL, KEYWORD_TYPE_STRING }, \
{ "solution_type", NULL, KEYWORD_TYPE_STRING }, \
{ "tag", "script_tags", KEYWORD_TYPE_STRING}, \
{ "solution", NULL, KEYWORD_TYPE_STRING}, \
{ "summary", NULL, KEYWORD_TYPE_STRING }, \
{ "insight", NULL, KEYWORD_TYPE_STRING }, \
{ "affected", NULL, KEYWORD_TYPE_STRING }, \
{ "impact", NULL, KEYWORD_TYPE_STRING }, \
{ "detection", NULL, KEYWORD_TYPE_STRING }, \
{ "solution_method", NULL, KEYWORD_TYPE_STRING }, \
{ NULL, NULL, KEYWORD_TYPE_UNKNOWN } \
}

NVT iterator columns.

◆ NVT_ITERATOR_COLUMNS_NVTS

#define NVT_ITERATOR_COLUMNS_NVTS
Value:
{ \
GET_ITERATOR_COLUMNS_PREFIX ("nvts."), \
{ "''", "_owner", KEYWORD_TYPE_STRING }, \
{ "0", NULL, KEYWORD_TYPE_STRING }, \
{ "oid", NULL, KEYWORD_TYPE_STRING }, \
{ "modification_time", "version", KEYWORD_TYPE_INTEGER }, \
{ "nvts.name", NULL, KEYWORD_TYPE_STRING }, \
{ "cve", NULL, KEYWORD_TYPE_STRING }, \
{ "tag", NULL, KEYWORD_TYPE_STRING }, \
{ "category", NULL, KEYWORD_TYPE_STRING }, \
{ "nvts.family", NULL, KEYWORD_TYPE_STRING }, \
{ "cvss_base", NULL, KEYWORD_TYPE_DOUBLE }, \
{ "cvss_base", "severity", KEYWORD_TYPE_DOUBLE }, \
{ "cvss_base", "cvss", KEYWORD_TYPE_DOUBLE }, \
{ "qod", NULL, KEYWORD_TYPE_INTEGER }, \
{ "qod_type", NULL, KEYWORD_TYPE_STRING }, \
{ "solution_type", NULL, KEYWORD_TYPE_STRING }, \
{ "tag", "script_tags", KEYWORD_TYPE_STRING }, \
{ "solution", NULL, KEYWORD_TYPE_STRING }, \
{ "summary", NULL, KEYWORD_TYPE_STRING }, \
{ "insight", NULL, KEYWORD_TYPE_STRING }, \
{ "affected", NULL, KEYWORD_TYPE_STRING }, \
{ "impact", NULL, KEYWORD_TYPE_STRING }, \
{ "detection", NULL, KEYWORD_TYPE_STRING }, \
{ "solution_method", NULL, KEYWORD_TYPE_STRING }, \
{ NULL, NULL, KEYWORD_TYPE_UNKNOWN } \
}

NVT iterator columns.

Function Documentation

◆ check_config_families()

int check_config_families ( )

Ensure that all configs refer to the right NVT families.

When the family of an NVT is changed in the feed, then the config refers to the wrong family.

Returns
0 success, -1 error.

◆ check_osp_vt_update_socket()

int check_osp_vt_update_socket ( )

Check the files socket used for OSP NVT update.

Returns
0 success, 1 no socket found.

◆ family_count()

int family_count ( )

Get the number of families.

Returns
Total number of families.

◆ get_osp_vt_update_socket()

const char* get_osp_vt_update_socket ( )

Get the current file socket for OSP NVT update.

Returns
The path of the file socket for OSP NVT update.

◆ manage_sync_nvts()

void manage_sync_nvts ( int(*)()  fork_update_nvt_cache)

Sync NVTs if newer NVTs are available.

Parameters
[in]fork_update_nvt_cacheFunction to do the update.

◆ manage_update_nvt_cache_osp()

int manage_update_nvt_cache_osp ( const gchar *  update_socket)

Update VTs via OSP.

Expect to be called in the child after a fork.

Parameters
[in]update_socketSocket to use to contact ospd-openvas scanner.
Returns
0 success, -1 error, 1 VT integrity check failed.

◆ nvt_family()

char* nvt_family ( const char *  oid)

Get the family of an NVT.

Parameters
[in]oidThe OID of the NVT.
Returns
Newly allocated string of the family, or NULL.

◆ nvts_feed_version_status()

int nvts_feed_version_status ( )

Check VTs feed version status.

Returns
0 VTs feed current, 1 VT update needed, -1 error.

◆ set_osp_vt_update_socket()

void set_osp_vt_update_socket ( const char *  new_socket)

Set the file socket for OSP NVT update.

Parameters
new_socketThe new path of the file socket for OSP NVT update.

◆ update_or_rebuild_nvts()

int update_or_rebuild_nvts ( int  update)

Update or rebuild NVT db.

Caller must get the lock.

Parameters
[in]update0 rebuild, else update.
Returns
0 success, -1 error, -1 no osp update socket, -2 could not connect to osp update socket -3 failed to get scanner version