OpenVAS Libraries
9.0.3
|
Implementation of API to handle NVT Info Cache. More...
#include <sys/stat.h>
#include "nvticache.h"
#include "kb.h"
#include <string.h>
#include <assert.h>
#include <stdlib.h>
Go to the source code of this file.
Macros | |
#define | G_LOG_DOMAIN "lib nvticache" |
Functions | |
int | nvticache_initialized (void) |
Return whether the nvt cache is initialized. More... | |
int | nvticache_init (const char *src, const char *kb_path) |
Initializes the nvti cache. More... | |
kb_t | nvticache_get_kb (void) |
Return the nvticache kb. More... | |
int | nvticache_check (const gchar *filename) |
Check if the nvt for the given filename exists in cache. More... | |
void | nvticache_reset () |
Reset connection to KB. To be called after a fork(). More... | |
int | nvticache_add (const nvti_t *nvti, const char *filename) |
Add a NVT Information to the cache. More... | |
char * | nvticache_get_src (const char *oid) |
Get the full source filename of an OID. More... | |
char * | nvticache_get_oid (const char *filename) |
Get the OID from a plugin filename. More... | |
char * | nvticache_get_filename (const char *oid) |
Get the filename from a plugin OID. More... | |
char * | nvticache_get_required_keys (const char *oid) |
Get the Required Keys from a plugin OID. More... | |
char * | nvticache_get_mandatory_keys (const char *oid) |
Get the Mandatory Keys from a plugin OID. More... | |
char * | nvticache_get_excluded_keys (const char *oid) |
Get the Excluded Keys from a plugin OID. More... | |
char * | nvticache_get_required_udp_ports (const char *oid) |
Get the Required udp ports from a plugin OID. More... | |
char * | nvticache_get_required_ports (const char *oid) |
Get the Required ports from a plugin OID. More... | |
char * | nvticache_get_dependencies (const char *oid) |
Get the Dependencies from a plugin OID. More... | |
int | nvticache_get_category (const char *oid) |
Get the Category from a plugin OID. More... | |
int | nvticache_get_timeout (const char *oid) |
Get the Timeout from a plugin OID. More... | |
char * | nvticache_get_name (const char *oid) |
Get the name from a plugin OID. More... | |
char * | nvticache_get_version (const char *oid) |
Get the version from a plugin OID. More... | |
char * | nvticache_get_copyright (const char *oid) |
Get the copyright from a plugin OID. More... | |
char * | nvticache_get_cves (const char *oid) |
Get the cves from a plugin OID. More... | |
char * | nvticache_get_bids (const char *oid) |
Get the bids from a plugin OID. More... | |
char * | nvticache_get_xrefs (const char *oid) |
Get the xrefs from a plugin OID. More... | |
char * | nvticache_get_family (const char *oid) |
Get the family from a plugin OID. More... | |
char * | nvticache_get_tags (const char *oid) |
Get the tags from a plugin OID. More... | |
GSList * | nvticache_get_prefs (const char *oid) |
Get the prefs from a plugin OID. More... | |
GSList * | nvticache_get_oids () |
Get the list of nvti OIDs. More... | |
size_t | nvticache_count () |
Get the number of nvt's in the cache. More... | |
void | nvticache_delete (const char *oid) |
Variables | |
char * | src_path = NULL |
kb_t | cache_kb = NULL |
Implementation of API to handle NVT Info Cache.
This file contains all methods to handle NVT Information Cache (nvticache_t).
The module consequently uses glib datatypes and api for memory management etc.
Definition in file nvticache.c.
#define G_LOG_DOMAIN "lib nvticache" |
Definition at line 49 of file nvticache.c.
int nvticache_add | ( | const nvti_t * | nvti, |
const char * | filename | ||
) |
Add a NVT Information to the cache.
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" ) |
Definition at line 157 of file nvticache.c.
References cache_kb, nvti_oid(), nvticache_delete(), nvticache_get_filename(), oid, and src_path.
int nvticache_check | ( | const gchar * | filename | ) |
Check if the nvt for the given filename exists in cache.
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" ) |
Definition at line 114 of file nvticache.c.
References cache_kb, and src_path.
size_t nvticache_count | ( | void | ) |
Get the number of nvt's in the cache.
Definition at line 579 of file nvticache.c.
References cache_kb.
void nvticache_delete | ( | const char * | oid | ) |
Definition at line 587 of file nvticache.c.
References cache_kb, nvticache_get_filename(), and oid.
Referenced by nvticache_add().
char* nvticache_get_bids | ( | const char * | oid | ) |
Get the bids from a plugin OID.
[in] | oid | OID to match. |
Definition at line 462 of file nvticache.c.
References cache_kb.
int nvticache_get_category | ( | const char * | oid | ) |
Get the Category from a plugin OID.
[in] | oid | OID to match. |
Definition at line 366 of file nvticache.c.
References cache_kb.
char* nvticache_get_copyright | ( | const char * | oid | ) |
Get the copyright from a plugin OID.
[in] | oid | OID to match. |
Definition at line 434 of file nvticache.c.
References cache_kb.
char* nvticache_get_cves | ( | const char * | oid | ) |
Get the cves from a plugin OID.
[in] | oid | OID to match. |
Definition at line 448 of file nvticache.c.
References cache_kb.
char* nvticache_get_dependencies | ( | const char * | oid | ) |
Get the Dependencies from a plugin OID.
[in] | oid | OID to match. |
Definition at line 352 of file nvticache.c.
References cache_kb.
char* nvticache_get_excluded_keys | ( | const char * | oid | ) |
Get the Excluded Keys from a plugin OID.
[in] | oid | OID to match. |
Definition at line 310 of file nvticache.c.
References cache_kb.
char* nvticache_get_family | ( | const char * | oid | ) |
Get the family from a plugin OID.
[in] | oid | OID to match. |
Definition at line 490 of file nvticache.c.
References cache_kb.
char* nvticache_get_filename | ( | const char * | oid | ) |
Get the filename from a plugin OID.
[in] | oid | OID to match. |
Definition at line 268 of file nvticache.c.
References cache_kb.
Referenced by nvticache_add(), and nvticache_delete().
kb_t nvticache_get_kb | ( | void | ) |
Return the nvticache kb.
Definition at line 97 of file nvticache.c.
References cache_kb.
Referenced by exec_nasl_script().
char* nvticache_get_mandatory_keys | ( | const char * | oid | ) |
Get the Mandatory Keys from a plugin OID.
[in] | oid | OID to match. |
Definition at line 296 of file nvticache.c.
References cache_kb.
char* nvticache_get_name | ( | const char * | oid | ) |
Get the name from a plugin OID.
[in] | oid | OID to match. |
Definition at line 406 of file nvticache.c.
References cache_kb.
Referenced by get_plugin_preference().
char* nvticache_get_oid | ( | const char * | filename | ) |
Get the OID from a plugin filename.
filename | Filename to lookup. |
Definition at line 237 of file nvticache.c.
References cache_kb.
GSList* nvticache_get_oids | ( | void | ) |
Get the list of nvti OIDs.
Definition at line 553 of file nvticache.c.
References cache_kb.
GSList* nvticache_get_prefs | ( | const char * | oid | ) |
Get the prefs from a plugin OID.
[in] | oid | OID to match. |
Definition at line 518 of file nvticache.c.
Referenced by get_plugin_preference().
char* nvticache_get_required_keys | ( | const char * | oid | ) |
Get the Required Keys from a plugin OID.
[in] | oid | OID to match. |
Definition at line 282 of file nvticache.c.
References cache_kb.
char* nvticache_get_required_ports | ( | const char * | oid | ) |
Get the Required ports from a plugin OID.
[in] | oid | OID to match. |
Definition at line 338 of file nvticache.c.
References cache_kb.
char* nvticache_get_required_udp_ports | ( | const char * | oid | ) |
Get the Required udp ports from a plugin OID.
[in] | oid | OID to match. |
Definition at line 324 of file nvticache.c.
References cache_kb.
char* nvticache_get_src | ( | const char * | oid | ) |
Get the full source filename of an OID.
oid | The OID to look up. |
Definition at line 215 of file nvticache.c.
References cache_kb.
char* nvticache_get_tags | ( | const char * | oid | ) |
Get the tags from a plugin OID.
[in] | oid | OID to match. |
Definition at line 504 of file nvticache.c.
References cache_kb.
Referenced by proto_post_wrapped().
int nvticache_get_timeout | ( | const char * | oid | ) |
Get the Timeout from a plugin OID.
[in] | oid | OID to match. |
Definition at line 386 of file nvticache.c.
References cache_kb.
char* nvticache_get_version | ( | const char * | oid | ) |
Get the version from a plugin OID.
[in] | oid | OID to match. |
Definition at line 420 of file nvticache.c.
References cache_kb.
char* nvticache_get_xrefs | ( | const char * | oid | ) |
Get the xrefs from a plugin OID.
[in] | oid | OID to match. |
Definition at line 476 of file nvticache.c.
References cache_kb.
int nvticache_init | ( | const char * | src, |
const char * | kb_path | ||
) |
Initializes the nvti cache.
cache | The directory where the cache is to be stored. |
src | The directory that contains the nvt files. |
kb_path | Path to kb socket. |
Definition at line 73 of file nvticache.c.
References cache_kb, and src_path.
int nvticache_initialized | ( | void | ) |
Return whether the nvt cache is initialized.
Definition at line 60 of file nvticache.c.
References cache_kb.
Referenced by exec_nasl_script(), get_plugin_preference(), and proto_post_wrapped().
void nvticache_reset | ( | ) |
Reset connection to KB. To be called after a fork().
Definition at line 138 of file nvticache.c.
References cache_kb.
kb_t cache_kb = NULL |
Definition at line 52 of file nvticache.c.
Referenced by nvticache_add(), nvticache_check(), nvticache_count(), nvticache_delete(), nvticache_get_bids(), nvticache_get_category(), nvticache_get_copyright(), nvticache_get_cves(), nvticache_get_dependencies(), nvticache_get_excluded_keys(), nvticache_get_family(), nvticache_get_filename(), nvticache_get_kb(), nvticache_get_mandatory_keys(), nvticache_get_name(), nvticache_get_oid(), nvticache_get_oids(), nvticache_get_prefs(), nvticache_get_required_keys(), nvticache_get_required_ports(), nvticache_get_required_udp_ports(), nvticache_get_src(), nvticache_get_tags(), nvticache_get_timeout(), nvticache_get_version(), nvticache_get_xrefs(), nvticache_init(), nvticache_initialized(), and nvticache_reset().
char* src_path = NULL |
Definition at line 51 of file nvticache.c.
Referenced by nvticache_add(), nvticache_check(), and nvticache_init().