52 #define G_LOG_DOMAIN "lib nvti" 76 np->
name = g_strdup (name);
80 np->
dflt = g_strdup (dflt);
116 return (np ? np->
name : NULL);
130 return (np ? np->
type : NULL);
144 return (np ? np->
dflt : NULL);
202 int i, len = g_slist_length (n->
prefs);
203 for (i = 0; i < len; i++)
205 g_slist_free (n->
prefs);
221 return (n ? n->
oid : NULL);
235 return (n ? n->
name : NULL);
249 return (n ? n->
cve : NULL);
263 return (n ? n->
bid : NULL);
277 return (n ? n->
xref : NULL);
291 return (n ? n->
tag : NULL);
403 return (n ? n->
family : NULL);
416 return (n ? g_slist_length (n->
prefs) : 0);
431 return (n ? g_slist_nth_data (n->
prefs, p) : NULL);
478 n->
oid = g_strdup (oid);
499 n->
name = g_strdup (name);
520 n->
cve = g_strdup (cve);
541 n->
bid = g_strdup (bid);
563 n->
xref = g_strdup (xref);
587 n->
tag = g_strdup (tag);
610 if (cvss_base && cvss_base[0])
635 if (dependencies && dependencies[0])
660 if (required_keys && required_keys[0])
685 if (mandatory_keys && mandatory_keys[0])
710 if (excluded_keys && excluded_keys[0])
735 if (required_ports && required_ports[0])
760 if (required_udp_ports && required_udp_ports[0])
784 n->
family = g_strdup (family);
849 n->
cve = g_strdup_printf (
"%s, %s", old, cve_id);
853 n->
cve = g_strdup (cve_id);
881 n->
bid = g_strdup_printf (
"%s, %s", old, bid_id);
885 n->
bid = g_strdup (bid_id);
1090 return g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
1103 g_hash_table_destroy (nvtis);
1130 return g_hash_table_lookup (nvtis, oid);
int nvti_set_category(nvti_t *n, const gint category)
Set the category type of a NVT Info.
gchar * nvtpref_default(const nvtpref_t *np)
Get the Default of a NVT Preference.
gchar * nvtpref_name(const nvtpref_t *np)
Get the Name of a NVT Preference.
gchar * nvti_xref(const nvti_t *n)
Get the xref's.
void nvti_free(nvti_t *n)
Free memory of a nvti structure.
gchar * nvti_required_ports(const nvti_t *n)
Get the required ports list.
gchar * required_keys
List of required KB keys of this NVT.
int nvti_set_cvss_base(nvti_t *n, const gchar *cvss_base)
Set the CVSS base of an NVT.
nvti_t * nvti_new(void)
Create a new (empty) nvti structure.
int nvti_set_family(nvti_t *n, const gchar *family)
Set the family of a NVT.
gchar * nvtpref_type(const nvtpref_t *np)
Get the Type of a NVT Preference.
int nvti_set_required_ports(nvti_t *n, const gchar *required_ports)
Set the required ports of a NVT.
nvtpref_t * nvtpref_new(gchar *name, gchar *type, gchar *dflt)
Create a new nvtpref structure filled with the given values.
gchar * nvti_cve(const nvti_t *n)
Get the CVE references.
gchar * cvss_base
CVSS base score for this NVT.
gchar * name
Name of the preference.
The structure of a information record that corresponds to a NVT.
gint timeout
Default timeout time for this NVT.
const nvtpref_t * nvti_pref(const nvti_t *n, guint p)
Get the n'th preferences of the NVT.
gchar * bid
List of Bugtraq IDs, this NVT corresponds to.
gint nvti_category(const nvti_t *n)
Get the category for this NVT.
void nvtpref_free(nvtpref_t *np)
Free memory of a nvtpref structure.
int nvti_set_timeout(nvti_t *n, const gint timeout)
Set the timeout of a NVT Info.
int nvti_set_tag(nvti_t *n, const gchar *tag)
Set the tags of a NVT.
int nvti_add_required_udp_ports(nvti_t *n, const gchar *port)
Add a required udp port of a NVT.
gint nvti_timeout(const nvti_t *n)
Get the timeout for this NVT.
int nvti_add_cve(nvti_t *n, const gchar *cve_id)
Add a single CVE ID of a NVT.
int nvti_set_cve(nvti_t *n, const gchar *cve)
Set the CVE references of a NVT.
gint category
The category, this NVT belongs to.
static void free_nvti_for_hash_table(gpointer nvti)
Free an NVT Info, for g_hash_table_destroy.
gchar * nvti_tag(const nvti_t *n)
Get the tag.
gchar * nvti_family(const nvti_t *n)
Get the family name.
gchar * type
Preference type.
gchar * nvti_dependencies(const nvti_t *n)
Get the dependencies list.
gchar * nvti_excluded_keys(const nvti_t *n)
Get the excluded keys list.
gchar * required_udp_ports
List of required UDP ports of this NVT.
gchar * nvti_mandatory_keys(const nvti_t *n)
Get the mandatory keys list.
void nvtis_add(nvtis_t *nvtis, nvti_t *nvti)
Add an NVT Info to a collection of NVT Infos.
int nvti_set_oid(nvti_t *n, const gchar *oid)
Set the OID of a NVT Info.
gchar * cve
List of CVEs, this NVT corresponds to.
int nvti_add_mandatory_keys(nvti_t *n, const gchar *key)
Add a mandatory key of a NVT.
int nvti_add_bid(nvti_t *n, const gchar *bid_id)
Add a single BID ID of a NVT.
int nvti_set_mandatory_keys(nvti_t *n, const gchar *mandatory_keys)
Set the mandatory keys of a NVT.
int nvti_set_name(nvti_t *n, const gchar *name)
Set the name of a NVT.
int nvti_set_xref(nvti_t *n, const gchar *xref)
Set the xrefs of a NVT.
Protos and data structures for NVT Information data sets.
int nvti_add_pref(nvti_t *n, nvtpref_t *np)
Add a preference to the NVT Info.
gchar * excluded_keys
List of excluded KB keys of this NVT.
int nvti_set_bid(nvti_t *n, const gchar *bid)
Set the bid references of a NVT.
gchar * nvti_required_udp_ports(const nvti_t *n)
Get the required udp ports list.
int nvti_set_required_udp_ports(nvti_t *n, const gchar *required_udp_ports)
Set the required udp ports of a NVT.
gchar * dependencies
List of dependencies of this NVT.
gchar * dflt
Default value of the preference.
int nvti_add_excluded_keys(nvti_t *n, const gchar *key)
Add a excluded key of a NVT.
nvtis_t * nvtis_new(void)
Make a collection of NVT Infos.
gchar * required_ports
List of required ports of this NVT.
int nvti_set_excluded_keys(nvti_t *n, const gchar *excluded_keys)
Set the excluded keys of a NVT.
void nvtis_free(nvtis_t *nvtis)
Free a collection of NVT Infos.
gchar * family
Family the NVT belongs to.
The structure for a preference of a NVT.
int nvti_set_dependencies(nvti_t *n, const gchar *dependencies)
Set the dependencies of a NVT.
gchar * nvti_required_keys(const nvti_t *n)
Get the required keys list.
gchar * mandatory_keys
List of mandatory KB keys of this NVT.
gchar * tag
List of tags attached to this NVT.
int nvti_add_required_ports(nvti_t *n, const gchar *port)
Add a required port of a NVT.
nvti_t * nvtis_lookup(nvtis_t *nvtis, const char *oid)
Add an NVT Info to a collection of NVT Infos.
int nvti_add_required_keys(nvti_t *n, const gchar *key)
Add a required key of a NVT.
guint nvti_pref_len(const nvti_t *n)
Get the number of preferences of the NVT.
gchar * nvti_cvss_base(const nvti_t *n)
Get the CVSS base.
gchar * nvti_oid(const nvti_t *n)
Get the OID string.
gchar * nvti_bid(const nvti_t *n)
Get the bid references.
GHashTable nvtis_t
A collection of information records corresponding to NVTs.
gchar * xref
List of Cross-references, this NVT corresponds to.
int nvti_set_required_keys(nvti_t *n, const gchar *required_keys)
Set the required keys of a NVT.
gchar * nvti_name(const nvti_t *n)
Get the name.
GSList * prefs
Collection of NVT preferences.