47 #define G_LOG_DOMAIN "lib nvti" 73 np->
type = g_strdup (type);
75 np->
dflt = g_strdup (dflt);
111 return (np ? np->
name : NULL);
125 return (np ? np->
type : NULL);
139 return (np ? np->
dflt : NULL);
201 int i, len = g_slist_length (n->
prefs);
202 for (i = 0; i < len; i++)
204 g_slist_free (n->
prefs);
220 return (n ? n->
oid : NULL);
234 return (n ? n->
version : NULL);
248 return (n ? n->
name : NULL);
276 return (n ? n->
cve : NULL);
290 return (n ? n->
bid : NULL);
304 return (n ? n->
xref : NULL);
318 return (n ? n->
tag : NULL);
430 return (n ? n->
family : NULL);
443 return (n ? g_slist_length (n->
prefs) : 0);
458 return (n ? g_slist_nth_data (n->
prefs, p) : NULL);
526 n->
version = g_strdup (version);
589 n->
cve = g_strdup (cve);
610 n->
bid = g_strdup (bid);
632 n->
xref = g_strdup (xref);
656 n->
tag = g_strdup (tag);
679 if (cvss_base && cvss_base[0])
703 if (dependencies && dependencies[0])
727 if (required_keys && required_keys[0])
751 if (mandatory_keys && mandatory_keys[0])
775 if (excluded_keys && excluded_keys[0])
799 if (required_ports && required_ports[0])
823 if (required_udp_ports && required_udp_ports[0])
847 n->
family = g_strdup (family);
904 if (! cve_id)
return (2);
910 n->
cve = g_strdup_printf (
"%s, %s", old, cve_id);
914 n->
cve = g_strdup (cve_id);
934 if (! bid_id)
return (2);
940 n->
bid = g_strdup_printf (
"%s, %s", old, bid_id);
944 n->
bid = g_strdup (bid_id);
964 if (! key)
return (2);
994 if (! key)
return (2);
1023 if (! n)
return (1);
1024 if (! key)
return (2);
1053 if (! n)
return (1);
1054 if (! port)
return (2);
1083 if (! n)
return (1);
1084 if (! port)
return (2);
1126 free_nvti_for_hash_table (gpointer
nvti)
1137 return g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
1138 free_nvti_for_hash_table);
1150 g_hash_table_destroy (nvtis);
1177 return g_hash_table_lookup (nvtis,
oid);
gchar * copyright
Copyright for the NVT.
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_copyright(nvti_t *n, const gchar *copyright)
Set the copyright of a 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_copyright(const nvti_t *n)
Get the copyright notice.
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 * version
Version 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 timout 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.
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_set_version(nvti_t *n, const gchar *version)
Set the version 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.
gchar * nvti_version(const nvti_t *n)
Get the version.
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.