OpenVAS Libraries  8.0.3
Data Structures | Typedefs | Functions
nvticache.h File Reference

Protos and data structures for NVT Information Cache. More...

#include <glib.h>
#include "nvti.h"

Go to the source code of this file.

Data Structures

struct  nvticache
 The structure for a NVTI Cache. More...
 

Typedefs

typedef struct nvticache nvticache_t
 The structure for a NVTI Cache. More...
 

Functions

void nvticache_init (const gchar *, const gchar *)
 Initializes the nvti cache. More...
 
int nvticache_initialized (void)
 Return whether the nvt cache is initialized. More...
 
void nvticache_free (void)
 Free the nvti cache. More...
 
nvti_tnvticache_get (const gchar *)
 Retrieve NVT Information from the nvt cache for the given filename. More...
 
int nvticache_add (const nvti_t *, const char *)
 Add a NVT Information to the cache. More...
 
nvti_tnvticache_get_by_oid_full (const char *)
 Get a full NVTI from the cache by OID. More...
 
char * nvticache_get_src (const char *)
 Get the full source filename of an OID. More...
 
const char * nvticache_get_filename (const char *)
 Get the source filename of an OID without the NVT main directory path. More...
 

Detailed Description

Protos and data structures for NVT Information Cache.

This file contains the protos for nvticache.c

Typedef Documentation

typedef struct nvticache nvticache_t

The structure for a NVTI Cache.

The elements of this structure should never be accessed directly. Only the functions corresponding to this module should be used.

Function Documentation

int nvticache_add ( const nvti_t nvti,
const char *  filename 
)

Add a NVT Information to the cache.

Parameters
nvtiThe NVT Information to add
filenameThe name of the original NVT without the path to the base location of NVTs (e.g. "scriptname1.nasl" or even "subdir1/subdir2/scriptname2.nasl" )
Returns
0 in case of success, anything else indicates an error.
void nvticache_free ( void  )

Free the nvti cache.

nvti_t* nvticache_get ( const gchar *  filename)

Retrieve NVT Information from the nvt cache for the given filename.

Parameters
filenameThe name of the original NVT without the path to the base location of NVTs (e.g. "scriptname1.nasl" or even "subdir1/subdir2/scriptname2.nasl" )
Returns
NULL in case the data could not be delivered. Else a nvti structure that should be freed with nvti_free().
nvti_t* nvticache_get_by_oid_full ( const char *  oid)

Get a full NVTI from the cache by OID.

Parameters
oidThe OID to look up
Returns
A full copy of the NVTI object or NULL if not found.
const char* nvticache_get_filename ( const char *  oid)

Get the source filename of an OID without the NVT main directory path.

Parameters
oidThe OID to look up.
Returns
Filename matching OID if found, NULL otherwise. The filename path does not cover the full path with the NVT main directory. Just the path below the NVT main directory.
char* nvticache_get_src ( const char *  oid)

Get the full source filename of an OID.

Parameters
oidThe OID to look up.
Returns
Filename with full path matching OID if found, NULL otherwise.
void nvticache_init ( const gchar *  cache_path,
const gchar *  src_path 
)

Initializes the nvti cache.

Parameters
cache_pathThe directory where the cache is to be stored.
src_pathThe directory that contains the nvt files.
int nvticache_initialized ( void  )

Return whether the nvt cache is initialized.

Returns
1 if cache is initialized, 0 otherwise.