Greenbone Vulnerability Management Libraries
11.0.1
|
Protos and data structures for NVT Information Cache. More...
Go to the source code of this file.
Macros | |
#define | NVTICACHE_STR "nvticache10" |
Functions | |
int | nvticache_init (const char *, const char *) |
Initializes the nvti cache. More... | |
void | nvticache_reset () |
Reset connection to KB. To be called after a fork(). More... | |
kb_t | nvticache_get_kb () |
Return the nvticache kb. More... | |
void | nvticache_save () |
Save the nvticache to disk. More... | |
int | nvticache_initialized (void) |
Return whether the nvt cache is initialized. More... | |
int | nvticache_check (const gchar *) |
Check if the nvt for the given filename exists in cache. More... | |
int | nvticache_add (const nvti_t *, const char *) |
Add a NVT Information to the cache. More... | |
char * | nvticache_get_src (const char *) |
Get the full source filename of an OID. More... | |
char * | nvticache_get_oid (const char *) |
Get the OID from a plugin filename. More... | |
char * | nvticache_get_name (const char *) |
Get the name from a plugin OID. More... | |
char * | nvticache_get_tags (const char *) |
Get the tags from a plugin OID. More... | |
GSList * | nvticache_get_prefs (const char *) |
Get the prefs from a plugin OID. More... | |
char * | nvticache_get_cves (const char *) |
Get the cves from a plugin OID. More... | |
char * | nvticache_get_bids (const char *) |
Get the bids from a plugin OID. More... | |
char * | nvticache_get_xrefs (const char *) |
Get the xrefs from a plugin OID. More... | |
char * | nvticache_get_family (const char *) |
Get the family from a plugin OID. More... | |
char * | nvticache_get_filename (const char *) |
Get the filename from a plugin OID. More... | |
char * | nvticache_get_required_keys (const char *) |
Get the Required Keys from a plugin OID. More... | |
char * | nvticache_get_mandatory_keys (const char *) |
Get the Mandatory Keys from a plugin OID. More... | |
char * | nvticache_get_excluded_keys (const char *) |
Get the Excluded Keys from a plugin OID. More... | |
char * | nvticache_get_required_ports (const char *) |
Get the Required ports from a plugin OID. More... | |
char * | nvticache_get_required_udp_ports (const char *) |
Get the Required udp ports from a plugin OID. More... | |
int | nvticache_get_category (const char *) |
Get the Category from a plugin OID. More... | |
int | nvticache_get_timeout (const char *) |
Get the Timeout from a plugin OID. More... | |
char * | nvticache_get_dependencies (const char *) |
Get the Dependencies from a plugin OID. More... | |
nvti_t * | nvticache_get_nvt (const char *) |
Get the nvti from a plugin OID. More... | |
GSList * | nvticache_get_oids (void) |
Get the list of nvti OIDs. More... | |
size_t | nvticache_count (void) |
Get the number of nvt's in the cache. More... | |
void | nvticache_delete (const char *) |
Delete NVT from the cache. More... | |
char * | nvticache_feed_version (void) |
Get the NVT feed version. More... | |
int | nvticache_check_feed (void) |
Check if the plugins feed was newer than cached feed. More... | |
Protos and data structures for NVT Information Cache.
This file contains the protos for nvticache.c
Definition in file nvticache.h.
#define NVTICACHE_STR "nvticache10" |
Definition at line 36 of file nvticache.h.
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 215 of file nvticache.c.
References cache_kb, cache_saved, kb_nvt_add(), nvti_oid(), nvticache_delete(), nvticache_get_filename(), 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 115 of file nvticache.c.
References cache_kb, kb_nvt_get(), NVT_TIMESTAMP_POS, and src_path.
int nvticache_check_feed | ( | void | ) |
Check if the plugins feed was newer than cached feed.
Definition at line 627 of file nvticache.c.
References cache_kb, kb_item_get_str(), nvt_feed_version(), and NVTICACHE_STR.
size_t nvticache_count | ( | ) |
Get the number of nvt's in the cache.
Definition at line 575 of file nvticache.c.
References cache_kb, and kb_item_count().
void nvticache_delete | ( | const char * | oid | ) |
Delete NVT from the cache.
[in] | oid | OID to match. |
Definition at line 588 of file nvticache.c.
References cache_kb, kb_del_items(), and nvticache_get_filename().
Referenced by nvticache_add().
char* nvticache_feed_version | ( | void | ) |
Get the NVT feed version.
Definition at line 616 of file nvticache.c.
References cache_kb, kb_item_get_str(), and NVTICACHE_STR.
Referenced by nvticache_save().
char* nvticache_get_bids | ( | const char * | oid | ) |
Get the bids from a plugin OID.
[in] | oid | OID to match. |
Definition at line 459 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_BIDS_POS.
int nvticache_get_category | ( | const char * | oid | ) |
Get the Category from a plugin OID.
[in] | oid | OID to match. |
Definition at line 391 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_CATEGORY_POS.
char* nvticache_get_cves | ( | const char * | oid | ) |
Get the cves from a plugin OID.
[in] | oid | OID to match. |
Definition at line 445 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_CVES_POS.
char* nvticache_get_dependencies | ( | const char * | oid | ) |
Get the Dependencies from a plugin OID.
[in] | oid | OID to match. |
Definition at line 377 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_DEPENDENCIES_POS.
char* nvticache_get_excluded_keys | ( | const char * | oid | ) |
Get the Excluded Keys from a plugin OID.
[in] | oid | OID to match. |
Definition at line 335 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_EXCLUDED_KEYS_POS.
char* nvticache_get_family | ( | const char * | oid | ) |
Get the family from a plugin OID.
[in] | oid | OID to match. |
Definition at line 487 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_FAMILY_POS.
char* nvticache_get_filename | ( | const char * | oid | ) |
Get the filename from a plugin OID.
[in] | oid | OID to match. |
Definition at line 293 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_FILENAME_POS.
Referenced by nvticache_add(), and nvticache_delete().
kb_t nvticache_get_kb | ( | void | ) |
Return the nvticache kb.
Definition at line 98 of file nvticache.c.
References cache_kb.
char* nvticache_get_mandatory_keys | ( | const char * | oid | ) |
Get the Mandatory Keys from a plugin OID.
[in] | oid | OID to match. |
Definition at line 321 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_MANDATORY_KEYS_POS.
char* nvticache_get_name | ( | const char * | oid | ) |
Get the name from a plugin OID.
[in] | oid | OID to match. |
Definition at line 431 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_NAME_POS.
nvti_t* nvticache_get_nvt | ( | const char * | oid | ) |
Get the nvti from a plugin OID.
[in] | oid | OID to match. |
Definition at line 515 of file nvticache.c.
References cache_kb, and kb_nvt_get_all().
char* nvticache_get_oid | ( | const char * | filename | ) |
Get the OID from a plugin filename.
filename | Filename to lookup. |
Definition at line 278 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_OID_POS.
GSList* nvticache_get_oids | ( | ) |
Get the list of nvti OIDs.
Definition at line 562 of file nvticache.c.
References cache_kb, and kb_nvt_get_oids().
GSList* nvticache_get_prefs | ( | const char * | oid | ) |
Get the prefs from a plugin OID.
[in] | oid | OID to match. |
Definition at line 529 of file nvticache.c.
References cache_kb, kb_item_free(), kb_item_get_all(), kb_item::next, nvtpref_new(), and kb_item::v_str.
char* nvticache_get_required_keys | ( | const char * | oid | ) |
Get the Required Keys from a plugin OID.
[in] | oid | OID to match. |
Definition at line 307 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_REQUIRED_KEYS_POS.
char* nvticache_get_required_ports | ( | const char * | oid | ) |
Get the Required ports from a plugin OID.
[in] | oid | OID to match. |
Definition at line 363 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_REQUIRED_PORTS_POS.
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 349 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_REQUIRED_UDP_PORTS_POS.
char* nvticache_get_src | ( | const char * | oid | ) |
Get the full source filename of an OID.
oid | The OID to look up. |
Definition at line 256 of file nvticache.c.
References cache_kb, kb_nvt_get(), NVT_FILENAME_POS, and src_path.
char* nvticache_get_tags | ( | const char * | oid | ) |
Get the tags from a plugin OID.
[in] | oid | OID to match. |
Definition at line 501 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_TAGS_POS.
int nvticache_get_timeout | ( | const char * | oid | ) |
Get the Timeout from a plugin OID.
[in] | oid | OID to match. |
Definition at line 411 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_TIMEOUT_POS.
char* nvticache_get_xrefs | ( | const char * | oid | ) |
Get the xrefs from a plugin OID.
[in] | oid | OID to match. |
Definition at line 473 of file nvticache.c.
References cache_kb, kb_nvt_get(), and NVT_XREFS_POS.
int nvticache_init | ( | const char * | src, |
const char * | kb_path | ||
) |
Initializes the nvti cache.
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, kb_find(), kb_item_set_str(), kb_lnk_reset(), kb_new(), NVTICACHE_STR, and src_path.
int nvticache_initialized | ( | void | ) |
Return whether the nvt cache is initialized.
Definition at line 59 of file nvticache.c.
References cache_kb.
void nvticache_reset | ( | ) |
Reset connection to KB. To be called after a fork().
Definition at line 136 of file nvticache.c.
References cache_kb, and kb_lnk_reset().
void nvticache_save | ( | ) |
Save the nvticache to disk.
Definition at line 182 of file nvticache.c.
References cache_kb, cache_saved, kb_item_set_str(), kb_save(), nvt_feed_version(), nvticache_feed_version(), and NVTICACHE_STR.