Protos and data structures for NVT Information Cache.
More...
#include <glib.h>
#include "nvti.h"
Go to the source code of this file.
Protos and data structures for NVT Information Cache.
This file contains the protos for nvticache.c
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.
int nvticache_add |
( |
const nvti_t * |
nvti, |
|
|
const char * |
filename |
|
) |
| |
Add a NVT Information to the cache.
- Parameters
-
nvti | The NVT Information to add |
filename | The 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 |
| ) |
|
nvti_t* nvticache_get |
( |
const gchar * |
filename | ) |
|
Retrieve NVT Information from the nvt cache for the given filename.
- Parameters
-
filename | The 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
-
- 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
-
- 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
-
- 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_path | The directory where the cache is to be stored. |
src_path | The 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.