Greenbone Vulnerability Management Libraries  11.0.1
nvti.h File Reference

Protos and data structures for NVT Information data sets. More...

#include <glib.h>
Include dependency graph for nvti.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct nvtpref nvtpref_t
 
typedef struct vtref vtref_t
 The structure for a cross reference of a VT. More...
 
typedef struct nvti nvti_t
 The structure of a information record that corresponds to a NVT. More...
 
typedef GHashTable nvtis_t
 A collection of information records corresponding to NVTs. More...
 

Functions

nvtpref_tnvtpref_new (int, gchar *, gchar *, gchar *)
 Create a new nvtpref structure filled with the given values. More...
 
void nvtpref_free (nvtpref_t *)
 Free memory of a nvtpref structure. More...
 
gchar * nvtpref_name (const nvtpref_t *)
 Get the Name of a NVT Preference. More...
 
gchar * nvtpref_type (const nvtpref_t *)
 Get the Type of a NVT Preference. More...
 
gchar * nvtpref_default (const nvtpref_t *)
 Get the Default of a NVT Preference. More...
 
int nvtpref_id (const nvtpref_t *)
 Get the ID of a NVT Preference. More...
 
vtref_tvtref_new (const gchar *, const gchar *, const gchar *)
 Create a new vtref structure filled with the given values. More...
 
void vtref_free (vtref_t *)
 Free memory of a vtref structure. More...
 
const gchar * vtref_type (const vtref_t *)
 Get the type of a reference. More...
 
const gchar * vtref_id (const vtref_t *)
 Get the id of a reference. More...
 
const gchar * vtref_text (const vtref_t *)
 Get the text of a reference. More...
 
int nvti_add_vtref (nvti_t *, vtref_t *)
 Add a reference to the VT Info. More...
 
guint nvti_vtref_len (const nvti_t *)
 Get the number of references of the NVT. More...
 
vtref_tnvti_vtref (const nvti_t *, guint)
 Get the n'th reference of the NVT. More...
 
nvti_tnvti_new (void)
 Create a new (empty) nvti structure. More...
 
void nvti_free (nvti_t *)
 Free memory of a nvti structure. More...
 
gchar * nvti_oid (const nvti_t *)
 Get the OID string. More...
 
gchar * nvti_name (const nvti_t *)
 Get the name. More...
 
gchar * nvti_summary (const nvti_t *)
 Get the summary. More...
 
gchar * nvti_affected (const nvti_t *)
 Get the text about affected systems. More...
 
gchar * nvti_impact (const nvti_t *)
 Get the text about impact. More...
 
time_t nvti_creation_time (const nvti_t *)
 Get the creation time. More...
 
time_t nvti_modification_time (const nvti_t *)
 Get the modification time. More...
 
gchar * nvti_insight (const nvti_t *)
 Get the text about insight. More...
 
gchar * nvti_refs (const nvti_t *, const gchar *, const char *, guint)
 
gchar * nvti_solution (const nvti_t *)
 Get the solution. More...
 
gchar * nvti_solution_type (const nvti_t *)
 Get the solution type. More...
 
gchar * nvti_tag (const nvti_t *)
 Get the tags. More...
 
gchar * nvti_cvss_base (const nvti_t *)
 Get the CVSS base. More...
 
gchar * nvti_dependencies (const nvti_t *)
 Get the dependencies list. More...
 
gchar * nvti_required_keys (const nvti_t *)
 Get the required keys list. More...
 
gchar * nvti_mandatory_keys (const nvti_t *)
 Get the mandatory keys list. More...
 
gchar * nvti_excluded_keys (const nvti_t *)
 Get the excluded keys list. More...
 
gchar * nvti_required_ports (const nvti_t *)
 Get the required ports list. More...
 
gchar * nvti_required_udp_ports (const nvti_t *)
 Get the required udp ports list. More...
 
gchar * nvti_detection (const nvti_t *)
 Get the text about detection. More...
 
gchar * nvti_qod_type (const nvti_t *)
 Get the QoD type. More...
 
gint nvti_timeout (const nvti_t *)
 Get the timeout for this NVT. More...
 
gint nvti_category (const nvti_t *)
 Get the category for this NVT. More...
 
gchar * nvti_family (const nvti_t *)
 Get the family name. More...
 
guint nvti_pref_len (const nvti_t *)
 Get the number of preferences of the NVT. More...
 
const nvtpref_tnvti_pref (const nvti_t *, guint)
 Get the n'th preferences of the NVT. More...
 
int nvti_set_oid (nvti_t *, const gchar *)
 Set the OID of a NVT Info. More...
 
int nvti_set_name (nvti_t *, const gchar *)
 Set the name of a NVT. More...
 
int nvti_set_summary (nvti_t *, const gchar *)
 Set the summary of a NVT. More...
 
int nvti_set_insight (nvti_t *, const gchar *)
 Set the insight text of a NVT. More...
 
int nvti_set_affected (nvti_t *, const gchar *)
 Set the affected text of a NVT. More...
 
int nvti_set_impact (nvti_t *, const gchar *)
 Set the impact text of a NVT. More...
 
int nvti_set_creation_time (nvti_t *, const time_t)
 Set the creation time of a NVT. More...
 
int nvti_set_modification_time (nvti_t *, const time_t)
 Set the modification time of a NVT. More...
 
int nvti_set_solution (nvti_t *, const gchar *)
 Set the solution of a NVT. More...
 
int nvti_set_solution_type (nvti_t *, const gchar *)
 Set the solution type of a NVT. More...
 
int nvti_add_tag (nvti_t *, const gchar *, const gchar *)
 Add a tag to the NVT tags. The tag names "last_modification" and "creation_date" are treated special: The value is expected to be a timestamp and it is being converted to seconds since epoch before added as a tag value. The tag name "cvss_base" will be ignored and not added. More...
 
int nvti_set_tag (nvti_t *, const gchar *)
 Set the tags of a NVT. More...
 
int nvti_set_cvss_base (nvti_t *, const gchar *)
 Set the CVSS base of an NVT. More...
 
int nvti_set_dependencies (nvti_t *, const gchar *)
 Set the dependencies of a NVT. More...
 
int nvti_set_required_keys (nvti_t *, const gchar *)
 Set the required keys of a NVT. More...
 
int nvti_set_mandatory_keys (nvti_t *, const gchar *)
 Set the mandatory keys of a NVT. More...
 
int nvti_set_excluded_keys (nvti_t *, const gchar *)
 Set the excluded keys of a NVT. More...
 
int nvti_set_required_ports (nvti_t *, const gchar *)
 Set the required ports of a NVT. More...
 
int nvti_set_required_udp_ports (nvti_t *, const gchar *)
 Set the required udp ports of a NVT. More...
 
int nvti_set_detection (nvti_t *, const gchar *)
 Set the detection text of a NVT. More...
 
int nvti_set_qod_type (nvti_t *, const gchar *)
 Set the QoD type of a NVT. More...
 
int nvti_set_timeout (nvti_t *, const gint)
 Set the timeout of a NVT Info. More...
 
int nvti_set_category (nvti_t *, const gint)
 Set the category type of a NVT Info. More...
 
int nvti_set_family (nvti_t *, const gchar *)
 Set the family of a NVT. More...
 
int nvti_add_refs (nvti_t *, const gchar *, const gchar *, const gchar *)
 Add many new vtref from a comma-separated list. More...
 
int nvti_add_required_keys (nvti_t *, const gchar *)
 Add a required key of a NVT. More...
 
int nvti_add_mandatory_keys (nvti_t *, const gchar *)
 Add a mandatory key of a NVT. More...
 
int nvti_add_excluded_keys (nvti_t *, const gchar *)
 Add a excluded key of a NVT. More...
 
int nvti_add_required_ports (nvti_t *, const gchar *)
 Add a required port of a NVT. More...
 
int nvti_add_required_udp_ports (nvti_t *, const gchar *)
 Add a required udp port of a NVT. More...
 
int nvti_add_pref (nvti_t *, nvtpref_t *)
 Add a preference to the NVT Info. More...
 
nvtis_tnvtis_new (void)
 Make a collection of NVT Infos. More...
 
void nvtis_free (nvtis_t *)
 Free a collection of NVT Infos. More...
 
void nvtis_add (nvtis_t *, nvti_t *)
 Add an NVT Info to a collection of NVT Infos. More...
 
nvti_tnvtis_lookup (nvtis_t *, const char *)
 Add an NVT Info to a collection of NVT Infos. More...
 

Detailed Description

Protos and data structures for NVT Information data sets.

This file contains the protos for nvti.c

Definition in file nvti.h.

Typedef Documentation

◆ nvti_t

typedef struct nvti nvti_t

The structure of a information record that corresponds to a NVT.

Definition at line 60 of file nvti.h.

◆ nvtis_t

typedef GHashTable nvtis_t

A collection of information records corresponding to NVTs.

Definition at line 207 of file nvti.h.

◆ nvtpref_t

typedef struct nvtpref nvtpref_t

Definition at line 32 of file nvti.h.

◆ vtref_t

typedef struct vtref vtref_t

The structure for a cross reference of a VT.

Definition at line 55 of file nvti.h.

Function Documentation

◆ nvti_add_excluded_keys()

int nvti_add_excluded_keys ( nvti_t n,
const gchar *  key 
)

Add a excluded key of a NVT.

Parameters
nThe NVT Info structure.
keyThe excluded key to add. A copy will be created from this.
Returns
0 for success. 1 if n was NULL. 2 if key was NULL.

Definition at line 1673 of file nvti.c.

1674 {
1675  gchar *old;
1676 
1677  if (!n)
1678  return (1);
1679  if (!key)
1680  return (2);
1681 
1682  old = n->excluded_keys;
1683 
1684  if (old)
1685  {
1686  n->excluded_keys = g_strdup_printf ("%s, %s", old, key);
1687  g_free (old);
1688  }
1689  else
1690  n->excluded_keys = g_strdup (key);
1691 
1692  return (0);
1693 }

References nvti::excluded_keys.

◆ nvti_add_mandatory_keys()

int nvti_add_mandatory_keys ( nvti_t n,
const gchar *  key 
)

Add a mandatory key of a NVT.

Parameters
nThe NVT Info structure.
keyThe mandatory key to add. A copy will be created from this.
Returns
0 for success. 1 if n was NULL. 2 if key was NULL.

Definition at line 1641 of file nvti.c.

1642 {
1643  gchar *old;
1644 
1645  if (!n)
1646  return (1);
1647  if (!key)
1648  return (2);
1649 
1650  old = n->mandatory_keys;
1651 
1652  if (old)
1653  {
1654  n->mandatory_keys = g_strdup_printf ("%s, %s", old, key);
1655  g_free (old);
1656  }
1657  else
1658  n->mandatory_keys = g_strdup (key);
1659 
1660  return (0);
1661 }

References nvti::mandatory_keys.

◆ nvti_add_pref()

int nvti_add_pref ( nvti_t n,
nvtpref_t np 
)

Add a preference to the NVT Info.

Parameters
nThe NVT Info structure.
npThe NVT preference to add.
Returns
0 for success. Anything else indicates an error.

Definition at line 1769 of file nvti.c.

1770 {
1771  if (!n)
1772  return (-1);
1773 
1774  n->prefs = g_slist_append (n->prefs, np);
1775  return (0);
1776 }

References nvti::prefs.

◆ nvti_add_refs()

int nvti_add_refs ( nvti_t n,
const gchar *  type,
const gchar *  ref_ids,
const gchar *  ref_text 
)

Add many new vtref from a comma-separated list.

Parameters
nThe NVTI where to add the references.
typeThe type for all references. If NULL, then for ref_ids a syntax is expected that includes the type like "type:id,type:id".
ref_idsA CSV of reference to be added.
ref_textThe optional text accompanying all references.
Returns
0 for success. 1 if n was NULL, 2 if ref_ids was NULL.

Definition at line 1557 of file nvti.c.

1559 {
1560  gchar **split, **item;
1561 
1562  if (!n)
1563  return (1);
1564 
1565  if (!ref_ids)
1566  return (2);
1567 
1568  split = g_strsplit (ref_ids, ",", 0);
1569 
1570  for (item = split; *item; item++)
1571  {
1572  gchar *id;
1573 
1574  id = *item;
1575  g_strstrip (id);
1576 
1577  if (strcmp (id, "") == 0)
1578  continue;
1579 
1580  if (type)
1581  {
1582  nvti_add_vtref (n, vtref_new (type, id, ref_text));
1583  }
1584  else
1585  {
1586  gchar **split2;
1587 
1588  split2 = g_strsplit (id, ":", 2);
1589  if (split2[0] && split2[1])
1590  nvti_add_vtref (n, vtref_new (split2[0], split2[1], ""));
1591  g_strfreev (split2);
1592  }
1593  }
1594  g_strfreev (split);
1595 
1596  return (0);
1597 }

References nvti_add_vtref(), and vtref_new().

Referenced by redis_get_nvt_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nvti_add_required_keys()

int nvti_add_required_keys ( nvti_t n,
const gchar *  key 
)

Add a required key of a NVT.

Parameters
nThe NVT Info structure.
keyThe required key to add. A copy will be created from this.
Returns
0 for success. 1 if n was NULL. 2 if key was NULL.

Definition at line 1609 of file nvti.c.

1610 {
1611  gchar *old;
1612 
1613  if (!n)
1614  return (1);
1615  if (!key)
1616  return (2);
1617 
1618  old = n->required_keys;
1619 
1620  if (old)
1621  {
1622  n->required_keys = g_strdup_printf ("%s, %s", old, key);
1623  g_free (old);
1624  }
1625  else
1626  n->required_keys = g_strdup (key);
1627 
1628  return (0);
1629 }

References nvti::required_keys.

◆ nvti_add_required_ports()

int nvti_add_required_ports ( nvti_t n,
const gchar *  port 
)

Add a required port of a NVT.

Parameters
nThe NVT Info structure.
portThe required port to add. A copy will be created from this.
Returns
0 for success. 1 if n was NULL. 2 if port was NULL.

Definition at line 1705 of file nvti.c.

1706 {
1707  gchar *old;
1708 
1709  if (!n)
1710  return (1);
1711  if (!port)
1712  return (2);
1713 
1714  old = n->required_ports;
1715 
1716  if (old)
1717  {
1718  n->required_ports = g_strdup_printf ("%s, %s", old, port);
1719  g_free (old);
1720  }
1721  else
1722  n->required_ports = g_strdup (port);
1723 
1724  return (0);
1725 }

References nvti::required_ports.

◆ nvti_add_required_udp_ports()

int nvti_add_required_udp_ports ( nvti_t n,
const gchar *  port 
)

Add a required udp port of a NVT.

Parameters
nThe NVT Info structure.
portThe required udp port to add. A copy will be created from this.
Returns
0 for success. 1 if n was NULL. 2 if port was NULL.

Definition at line 1737 of file nvti.c.

1738 {
1739  gchar *old;
1740 
1741  if (!n)
1742  return (1);
1743  if (!port)
1744  return (2);
1745 
1746  old = n->required_udp_ports;
1747 
1748  if (old)
1749  {
1750  n->required_udp_ports = g_strdup_printf ("%s, %s", old, port);
1751  g_free (old);
1752  }
1753  else
1754  n->required_udp_ports = g_strdup (port);
1755 
1756  return (0);
1757 }

References nvti::required_udp_ports.

◆ nvti_add_tag()

int nvti_add_tag ( nvti_t n,
const gchar *  name,
const gchar *  value 
)

Add a tag to the NVT tags. The tag names "last_modification" and "creation_date" are treated special: The value is expected to be a timestamp and it is being converted to seconds since epoch before added as a tag value. The tag name "cvss_base" will be ignored and not added.

Parameters
nThe NVT Info structure.
nameThe tag name. A copy will be created from this.
valueThe tag value. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1185 of file nvti.c.

1186 {
1187  gchar *newvalue = NULL;
1188 
1189  if (!n)
1190  return (-1);
1191 
1192  if (!name || !name[0])
1193  return (-2);
1194 
1195  if (!value || !value[0])
1196  return (-3);
1197 
1198  if (!strcmp (name, "last_modification"))
1199  {
1201  newvalue = g_strdup_printf ("%i", (int) nvti_modification_time (n));
1202  }
1203  else if (!strcmp (name, "creation_date"))
1204  {
1206  newvalue = g_strdup_printf ("%i", (int) nvti_creation_time (n));
1207  }
1208  else if (!strcmp (name, "cvss_base"))
1209  {
1210  /* Ignore this tag because it is not being used.
1211  * It is redundant with the tag cvss_base_vector from which
1212  * it is computed.
1213  * Once GOS 6 and GVM 11 are retired, all set_tag commands
1214  * in the NASL scripts can be removed that set "cvss_base".
1215  * Once this happened this exception can be removed from the code.
1216  */
1217  return (0);
1218  }
1219 
1220  if (n->tag)
1221  {
1222  gchar *newtag;
1223 
1224  newtag =
1225  g_strconcat (n->tag, "|", name, "=", newvalue ? newvalue : value, NULL);
1226  g_free (n->tag);
1227  n->tag = newtag;
1228  }
1229  else
1230  n->tag = g_strconcat (name, "=", newvalue ? newvalue : value, NULL);
1231 
1232  if (newvalue)
1233  g_free (newvalue);
1234 
1235  return (0);
1236 }

References nvti_creation_time(), nvti_modification_time(), nvti_set_creation_time(), nvti_set_modification_time(), parse_nvt_timestamp(), and nvti::tag.

Here is the call graph for this function:

◆ nvti_add_vtref()

int nvti_add_vtref ( nvti_t vt,
vtref_t ref 
)

Add a reference to the VT Info.

Parameters
vtThe VT Info structure.
refThe VT reference to add.
Returns
0 for success. Anything else indicates an error.

Definition at line 319 of file nvti.c.

320 {
321  if (!vt)
322  return (-1);
323 
324  vt->refs = g_slist_append (vt->refs, ref);
325  return (0);
326 }

References nvti::refs.

Referenced by nvti_add_refs().

Here is the caller graph for this function:

◆ nvti_affected()

gchar* nvti_affected ( const nvti_t n)

Get the text about affected systems.

Parameters
nThe NVT Info structure of which the affected description should be returned.
Returns
The affected string. Don't free this.

Definition at line 559 of file nvti.c.

560 {
561  return (n ? n->affected : NULL);
562 }

References nvti::affected.

◆ nvti_category()

gint nvti_category ( const nvti_t n)

Get the category for this NVT.

Parameters
nThe NVT Info structure of which the category should be returned.
Returns
The category integer code. A value <= 0 indicates it is not set.

Definition at line 956 of file nvti.c.

957 {
958  return (n ? n->category : -1);
959 }

References nvti::category.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_creation_time()

time_t nvti_creation_time ( const nvti_t n)

Get the creation time.

Parameters
nThe NVT Info structure of which the creation time should be returned.
Returns
The creation time in seconds since epoch.

Definition at line 587 of file nvti.c.

588 {
589  return (n ? n->creation_time : 0);
590 }

References nvti::creation_time.

Referenced by nvti_add_tag().

Here is the caller graph for this function:

◆ nvti_cvss_base()

gchar* nvti_cvss_base ( const nvti_t n)

Get the CVSS base.

Parameters
nThe NVT Info structure of which the CVSS base should be returned.
Returns
The cvss_base string. Don't free this.

Definition at line 775 of file nvti.c.

776 {
777  return (n ? n->cvss_base : NULL);
778 }

References nvti::cvss_base.

◆ nvti_dependencies()

gchar* nvti_dependencies ( const nvti_t n)

Get the dependencies list.

Parameters
nThe NVT Info structure of which the name should be returned.
Returns
The dependencies string. Don't free this.

Definition at line 789 of file nvti.c.

790 {
791  return (n ? n->dependencies : NULL);
792 }

References nvti::dependencies.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_detection()

gchar* nvti_detection ( const nvti_t n)

Get the text about detection.

Parameters
nThe NVT Info structure of which the detection should be returned.
Returns
The detection string. Don't free this.

Definition at line 873 of file nvti.c.

874 {
875  return (n ? n->detection : NULL);
876 }

References nvti::detection.

◆ nvti_excluded_keys()

gchar* nvti_excluded_keys ( const nvti_t n)

Get the excluded keys list.

Parameters
nThe NVT Info structure of which the name should be returned.
Returns
The excluded keys string. Don't free this.

Definition at line 831 of file nvti.c.

832 {
833  return (n ? n->excluded_keys : NULL);
834 }

References nvti::excluded_keys.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_family()

gchar* nvti_family ( const nvti_t n)

Get the family name.

Parameters
nThe NVT Info structure of which the name should be returned.
Returns
The family name string. Don't free this.

Definition at line 901 of file nvti.c.

902 {
903  return (n ? n->family : NULL);
904 }

References nvti::family.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_free()

void nvti_free ( nvti_t n)

Free memory of a nvti structure.

Parameters
nThe structure to be freed.

Definition at line 465 of file nvti.c.

466 {
467  if (!n)
468  return;
469 
470  g_free (n->oid);
471  g_free (n->name);
472  g_free (n->summary);
473  g_free (n->insight);
474  g_free (n->affected);
475  g_free (n->impact);
476  g_free (n->solution);
477  g_free (n->solution_type);
478  g_free (n->tag);
479  g_free (n->cvss_base);
480  g_free (n->dependencies);
481  g_free (n->required_keys);
482  g_free (n->mandatory_keys);
483  g_free (n->excluded_keys);
484  g_free (n->required_ports);
485  g_free (n->required_udp_ports);
486  g_free (n->detection);
487  g_free (n->qod_type);
488  g_free (n->family);
489  g_slist_free_full (n->refs, (void (*) (void *)) vtref_free);
490  g_slist_free_full (n->prefs, (void (*) (void *)) nvtpref_free);
491  g_free (n);
492 }

References nvti::affected, nvti::cvss_base, nvti::dependencies, nvti::detection, nvti::excluded_keys, nvti::family, nvti::impact, nvti::insight, nvti::mandatory_keys, nvti::name, nvtpref_free(), nvti::oid, nvti::prefs, nvti::qod_type, nvti::refs, nvti::required_keys, nvti::required_ports, nvti::required_udp_ports, nvti::solution, nvti::solution_type, nvti::summary, nvti::tag, and vtref_free().

Referenced by free_nvti_for_hash_table().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nvti_impact()

gchar* nvti_impact ( const nvti_t n)

Get the text about impact.

Parameters
nThe NVT Info structure of which the impact description should be returned.
Returns
The impact string. Don't free this.

Definition at line 573 of file nvti.c.

574 {
575  return (n ? n->impact : NULL);
576 }

References nvti::impact.

◆ nvti_insight()

gchar* nvti_insight ( const nvti_t n)

Get the text about insight.

Parameters
nThe NVT Info structure of which the insight description should be returned.
Returns
The insight string. Don't free this.

Definition at line 545 of file nvti.c.

546 {
547  return (n ? n->insight : NULL);
548 }

References nvti::insight.

◆ nvti_mandatory_keys()

gchar* nvti_mandatory_keys ( const nvti_t n)

Get the mandatory keys list.

Parameters
nThe NVT Info structure of which the name should be returned.
Returns
The mandatory keys string. Don't free this.

Definition at line 817 of file nvti.c.

818 {
819  return (n ? n->mandatory_keys : NULL);
820 }

References nvti::mandatory_keys.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_modification_time()

time_t nvti_modification_time ( const nvti_t n)

Get the modification time.

Parameters
nThe NVT Info structure of which the modification time should be returned.
Returns
The modification time in seconds since epoch.

Definition at line 601 of file nvti.c.

602 {
603  return (n ? n->modification_time : 0);
604 }

References nvti::modification_time.

Referenced by nvti_add_tag().

Here is the caller graph for this function:

◆ nvti_name()

gchar* nvti_name ( const nvti_t n)

Get the name.

Parameters
nThe NVT Info structure of which the name should be returned.
Returns
The name string. Don't free this.

Definition at line 517 of file nvti.c.

518 {
519  return (n ? n->name : NULL);
520 }

References nvti::name.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_new()

nvti_t* nvti_new ( void  )

Create a new (empty) nvti structure.

Returns
NULL in case the memory could not be allocated. Else an empty nvti structure which needs to be released using nvti_free . The whole struct is initialized with 0's.

Definition at line 454 of file nvti.c.

455 {
456  return ((nvti_t *) g_malloc0 (sizeof (nvti_t)));
457 }

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_oid()

gchar* nvti_oid ( const nvti_t n)

Get the OID string.

Parameters
nThe NVT Info structure of which the OID should be returned.
Returns
The OID string. Don't free this.

Definition at line 503 of file nvti.c.

504 {
505  return (n ? n->oid : NULL);
506 }

References nvti::oid.

Referenced by nvticache_add(), nvtis_add(), and redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_pref()

const nvtpref_t* nvti_pref ( const nvti_t n,
guint  p 
)

Get the n'th preferences of the NVT.

Parameters
nThe NVT Info structure.
pThe position of the preference to return.
Returns
The preference. NULL on error.

Definition at line 929 of file nvti.c.

930 {
931  return (n ? g_slist_nth_data (n->prefs, p) : NULL);
932 }

References nvti::prefs.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_pref_len()

guint nvti_pref_len ( const nvti_t n)

Get the number of preferences of the NVT.

Parameters
nThe NVT Info structure.
Returns
The number of preferences.

Definition at line 914 of file nvti.c.

915 {
916  return (n ? g_slist_length (n->prefs) : 0);
917 }

References nvti::prefs.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_qod_type()

gchar* nvti_qod_type ( const nvti_t n)

Get the QoD type.

Parameters
nThe NVT Info structure of which the QoD type should be returned.
Returns
The QoD type as string. Don't free this.

Definition at line 887 of file nvti.c.

888 {
889  return (n ? n->qod_type : NULL);
890 }

References nvti::qod_type.

◆ nvti_refs()

gchar* nvti_refs ( const nvti_t ,
const gchar *  ,
const char *  ,
guint   
)

◆ nvti_required_keys()

gchar* nvti_required_keys ( const nvti_t n)

Get the required keys list.

Parameters
nThe NVT Info structure of which the name should be returned.
Returns
The required keys string. Don't free this.

Definition at line 803 of file nvti.c.

804 {
805  return (n ? n->required_keys : NULL);
806 }

References nvti::required_keys.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_required_ports()

gchar* nvti_required_ports ( const nvti_t n)

Get the required ports list.

Parameters
nThe NVT Info structure of which the name should be returned.
Returns
The required ports string. Don't free this.

Definition at line 845 of file nvti.c.

846 {
847  return (n ? n->required_ports : NULL);
848 }

References nvti::required_ports.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_required_udp_ports()

gchar* nvti_required_udp_ports ( const nvti_t n)

Get the required udp ports list.

Parameters
nThe NVT Info structure of which the name should be returned.
Returns
The required udp ports string. Don't free this.

Definition at line 859 of file nvti.c.

860 {
861  return (n ? n->required_udp_ports : NULL);
862 }

References nvti::required_udp_ports.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_set_affected()

int nvti_set_affected ( nvti_t n,
const gchar *  affected 
)

Set the affected text of a NVT.

Parameters
nThe NVT Info structure.
affectedThe affected text to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1055 of file nvti.c.

1056 {
1057  if (!n)
1058  return (-1);
1059 
1060  if (n->affected)
1061  g_free (n->affected);
1062  n->affected = g_strdup (affected);
1063  return (0);
1064 }

References nvti::affected.

◆ nvti_set_category()

int nvti_set_category ( nvti_t n,
const gint  category 
)

Set the category type of a NVT Info.

Parameters
nThe NVT Info structure.
categoryThe category to set. Values <= 0 will indicate it is not set.
Returns
0 for success. Anything else indicates an error.

Definition at line 1532 of file nvti.c.

1533 {
1534  if (!n)
1535  return (-1);
1536 
1537  n->category = category;
1538  return (0);
1539 }

References nvti::category.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_creation_time()

int nvti_set_creation_time ( nvti_t n,
const time_t  creation_time 
)

Set the creation time of a NVT.

Parameters
nThe NVT Info structure.
creation_timeThe creation time to set.
Returns
0 for success. Anything else indicates an error.

Definition at line 1097 of file nvti.c.

1098 {
1099  if (!n)
1100  return (-1);
1101 
1102  n->creation_time = creation_time;
1103  return (0);
1104 }

References nvti::creation_time.

Referenced by nvti_add_tag().

Here is the caller graph for this function:

◆ nvti_set_cvss_base()

int nvti_set_cvss_base ( nvti_t n,
const gchar *  cvss_base 
)

Set the CVSS base of an NVT.

Parameters
nThe NVT Info structure.
cvss_baseThe CVSS base to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1272 of file nvti.c.

1273 {
1274  if (!n)
1275  return (-1);
1276 
1277  if (n->cvss_base)
1278  g_free (n->cvss_base);
1279  if (cvss_base && cvss_base[0])
1280  n->cvss_base = g_strdup (cvss_base);
1281  else
1282  n->cvss_base = NULL;
1283  return (0);
1284 }

References nvti::cvss_base.

◆ nvti_set_dependencies()

int nvti_set_dependencies ( nvti_t n,
const gchar *  dependencies 
)

Set the dependencies of a NVT.

Parameters
nThe NVT Info structure.
dependenciesThe dependencies to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1297 of file nvti.c.

1298 {
1299  if (!n)
1300  return (-1);
1301 
1302  if (n->dependencies)
1303  g_free (n->dependencies);
1304  if (dependencies && dependencies[0])
1305  n->dependencies = g_strdup (dependencies);
1306  else
1307  n->dependencies = NULL;
1308  return (0);
1309 }

References nvti::dependencies.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_detection()

int nvti_set_detection ( nvti_t n,
const gchar *  detection 
)

Set the detection text of a NVT.

Parameters
nThe NVT Info structure.
detectionThe detection text to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1446 of file nvti.c.

1447 {
1448  if (!n)
1449  return (-1);
1450 
1451  if (n->detection)
1452  g_free (n->detection);
1453  n->detection = g_strdup (detection);
1454  return (0);
1455 }

References nvti::detection.

◆ nvti_set_excluded_keys()

int nvti_set_excluded_keys ( nvti_t n,
const gchar *  excluded_keys 
)

Set the excluded keys of a NVT.

Parameters
nThe NVT Info structure.
excluded_keysThe excluded keys to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1372 of file nvti.c.

1373 {
1374  if (!n)
1375  return (-1);
1376 
1377  if (n->excluded_keys)
1378  g_free (n->excluded_keys);
1379  if (excluded_keys && excluded_keys[0])
1380  n->excluded_keys = g_strdup (excluded_keys);
1381  else
1382  n->excluded_keys = NULL;
1383  return (0);
1384 }

References nvti::excluded_keys.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_family()

int nvti_set_family ( nvti_t n,
const gchar *  family 
)

Set the family of a NVT.

Parameters
nThe NVT Info structure.
familyThe family to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1492 of file nvti.c.

1493 {
1494  if (!n)
1495  return (-1);
1496 
1497  if (n->family)
1498  g_free (n->family);
1499  n->family = g_strdup (family);
1500  return (0);
1501 }

References nvti::family.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_impact()

int nvti_set_impact ( nvti_t n,
const gchar *  impact 
)

Set the impact text of a NVT.

Parameters
nThe NVT Info structure.
affectedThe impact text to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1076 of file nvti.c.

1077 {
1078  if (!n)
1079  return (-1);
1080 
1081  if (n->impact)
1082  g_free (n->impact);
1083  n->impact = g_strdup (impact);
1084  return (0);
1085 }

References nvti::impact.

◆ nvti_set_insight()

int nvti_set_insight ( nvti_t n,
const gchar *  insight 
)

Set the insight text of a NVT.

Parameters
nThe NVT Info structure.
insightThe insight text to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1034 of file nvti.c.

1035 {
1036  if (!n)
1037  return (-1);
1038 
1039  if (n->insight)
1040  g_free (n->insight);
1041  n->insight = g_strdup (insight);
1042  return (0);
1043 }

References nvti::insight.

◆ nvti_set_mandatory_keys()

int nvti_set_mandatory_keys ( nvti_t n,
const gchar *  mandatory_keys 
)

Set the mandatory keys of a NVT.

Parameters
nThe NVT Info structure.
mandatory_keysThe mandatory keys to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1347 of file nvti.c.

1348 {
1349  if (!n)
1350  return (-1);
1351 
1352  if (n->mandatory_keys)
1353  g_free (n->mandatory_keys);
1354  if (mandatory_keys && mandatory_keys[0])
1355  n->mandatory_keys = g_strdup (mandatory_keys);
1356  else
1357  n->mandatory_keys = NULL;
1358  return (0);
1359 }

References nvti::mandatory_keys.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_modification_time()

int nvti_set_modification_time ( nvti_t n,
const time_t  modification_time 
)

Set the modification time of a NVT.

Parameters
nThe NVT Info structure.
modification_timeThe modification time to set.
Returns
0 for success. Anything else indicates an error.

Definition at line 1116 of file nvti.c.

1117 {
1118  if (!n)
1119  return (-1);
1120 
1121  n->modification_time = modification_time;
1122  return (0);
1123 }

References nvti::modification_time.

Referenced by nvti_add_tag().

Here is the caller graph for this function:

◆ nvti_set_name()

int nvti_set_name ( nvti_t n,
const gchar *  name 
)

Set the name of a NVT.

Parameters
nThe NVT Info structure.
nameThe name to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 992 of file nvti.c.

993 {
994  if (!n)
995  return (-1);
996 
997  if (n->name)
998  g_free (n->name);
999  n->name = g_strdup (name);
1000  return (0);
1001 }

References nvti::name.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_oid()

int nvti_set_oid ( nvti_t n,
const gchar *  oid 
)

Set the OID of a NVT Info.

Parameters
nThe NVT Info structure.
oidThe OID to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 971 of file nvti.c.

972 {
973  if (!n)
974  return (-1);
975 
976  if (n->oid)
977  g_free (n->oid);
978  n->oid = g_strdup (oid);
979  return (0);
980 }

References nvti::oid.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_qod_type()

int nvti_set_qod_type ( nvti_t n,
const gchar *  qod_type 
)

Set the QoD type of a NVT.

Parameters
nThe NVT Info structure.
qod_typeThe QoD type to set. A copy will be created from this. The string is not checked, any string is accepted as type.
Returns
0 for success. Anything else indicates an error.

Definition at line 1468 of file nvti.c.

1469 {
1470  if (!n)
1471  return (-1);
1472 
1473  if (n->qod_type)
1474  g_free (n->qod_type);
1475  if (qod_type && qod_type[0])
1476  n->qod_type = g_strdup (qod_type);
1477  else
1478  n->qod_type = NULL;
1479  return (0);
1480 }

References nvti::qod_type.

◆ nvti_set_required_keys()

int nvti_set_required_keys ( nvti_t n,
const gchar *  required_keys 
)

Set the required keys of a NVT.

Parameters
nThe NVT Info structure.
required_keysThe required keys to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1322 of file nvti.c.

1323 {
1324  if (!n)
1325  return (-1);
1326 
1327  if (n->required_keys)
1328  g_free (n->required_keys);
1329  if (required_keys && required_keys[0])
1330  n->required_keys = g_strdup (required_keys);
1331  else
1332  n->required_keys = NULL;
1333  return (0);
1334 }

References nvti::required_keys.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_required_ports()

int nvti_set_required_ports ( nvti_t n,
const gchar *  required_ports 
)

Set the required ports of a NVT.

Parameters
nThe NVT Info structure.
required_portsThe required ports to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1397 of file nvti.c.

1398 {
1399  if (!n)
1400  return (-1);
1401 
1402  if (n->required_ports)
1403  g_free (n->required_ports);
1404  if (required_ports && required_ports[0])
1405  n->required_ports = g_strdup (required_ports);
1406  else
1407  n->required_ports = NULL;
1408  return (0);
1409 }

References nvti::required_ports.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_required_udp_ports()

int nvti_set_required_udp_ports ( nvti_t n,
const gchar *  required_udp_ports 
)

Set the required udp ports of a NVT.

Parameters
nThe NVT Info structure.
required_udp_portsThe required udp ports to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1422 of file nvti.c.

1423 {
1424  if (!n)
1425  return (-1);
1426 
1427  if (n->required_udp_ports)
1428  g_free (n->required_udp_ports);
1429  if (required_udp_ports && required_udp_ports[0])
1430  n->required_udp_ports = g_strdup (required_udp_ports);
1431  else
1432  n->required_udp_ports = NULL;
1433  return (0);
1434 }

References nvti::required_udp_ports.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_solution()

int nvti_set_solution ( nvti_t n,
const gchar *  solution 
)

Set the solution of a NVT.

Parameters
nThe NVT Info structure.
solutionThe solution to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1135 of file nvti.c.

1136 {
1137  if (!n)
1138  return (-1);
1139 
1140  if (n->solution)
1141  g_free (n->solution);
1142  n->solution = g_strdup (solution);
1143  return (0);
1144 }

References nvti::solution.

◆ nvti_set_solution_type()

int nvti_set_solution_type ( nvti_t n,
const gchar *  solution_type 
)

Set the solution type of a NVT.

Parameters
nThe NVT Info structure.
solution_typeThe solution type to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1157 of file nvti.c.

1158 {
1159  if (!n)
1160  return (-1);
1161 
1162  if (n->solution_type)
1163  g_free (n->solution_type);
1164  n->solution_type = g_strdup (solution_type);
1165  return (0);
1166 }

References nvti::solution_type.

◆ nvti_set_summary()

int nvti_set_summary ( nvti_t n,
const gchar *  summary 
)

Set the summary of a NVT.

Parameters
nThe NVT Info structure.
solutionThe summary to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1013 of file nvti.c.

1014 {
1015  if (!n)
1016  return (-1);
1017 
1018  if (n->summary)
1019  g_free (n->summary);
1020  n->summary = g_strdup (summary);
1021  return (0);
1022 }

References nvti::summary.

◆ nvti_set_tag()

int nvti_set_tag ( nvti_t n,
const gchar *  tag 
)

Set the tags of a NVT.

Parameters
nThe NVT Info structure.
tagThe tags to set. A copy will be created from this.
Returns
0 for success. Anything else indicates an error.

Definition at line 1248 of file nvti.c.

1249 {
1250  if (!n)
1251  return (-1);
1252 
1253  if (n->tag)
1254  g_free (n->tag);
1255  if (tag && tag[0])
1256  n->tag = g_strdup (tag);
1257  else
1258  n->tag = NULL;
1259  return (0);
1260 }

References nvti::tag.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_set_timeout()

int nvti_set_timeout ( nvti_t n,
const gint  timeout 
)

Set the timeout of a NVT Info.

Parameters
nThe NVT Info structure.
timeoutThe timeout to set. Values <= 0 will indicate it is not set.
Returns
0 for success. Anything else indicates an error.

Definition at line 1513 of file nvti.c.

1514 {
1515  if (!n)
1516  return (-1);
1517 
1518  n->timeout = timeout;
1519  return (0);
1520 }

References nvti::timeout.

Referenced by redis_get_nvt_all().

Here is the caller graph for this function:

◆ nvti_solution()

gchar* nvti_solution ( const nvti_t n)

Get the solution.

Parameters
nThe NVT Info structure of which the solution should be returned.
Returns
The solution string. Don't free this.

Definition at line 733 of file nvti.c.

734 {
735  return (n ? n->solution : NULL);
736 }

References nvti::solution.

◆ nvti_solution_type()

gchar* nvti_solution_type ( const nvti_t n)

Get the solution type.

Parameters
nThe NVT Info structure of which the solution type should be returned.
Returns
The solution type string. Don't free this.

Definition at line 747 of file nvti.c.

748 {
749  return (n ? n->solution_type : NULL);
750 }

References nvti::solution_type.

◆ nvti_summary()

gchar* nvti_summary ( const nvti_t n)

Get the summary.

Parameters
nThe NVT Info structure of which the summary should be returned.
Returns
The summary string. Don't free this.

Definition at line 531 of file nvti.c.

532 {
533  return (n ? n->summary : NULL);
534 }

References nvti::summary.

◆ nvti_tag()

gchar* nvti_tag ( const nvti_t n)

Get the tags.

Parameters
nThe NVT Info structure of which the tags should be returned.
Returns
The tags string. Don't free this.

Definition at line 761 of file nvti.c.

762 {
763  return (n ? n->tag : NULL);
764 }

References nvti::tag.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_timeout()

gint nvti_timeout ( const nvti_t n)

Get the timeout for this NVT.

Parameters
nThe NVT Info structure of which the timeout should be returned.
Returns
The timeout integer number. A value <= 0 indicates it is not set.

Definition at line 943 of file nvti.c.

944 {
945  return (n ? n->timeout : -1);
946 }

References nvti::timeout.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvti_vtref()

vtref_t* nvti_vtref ( const nvti_t n,
guint  p 
)

Get the n'th reference of the NVT.

Parameters
nThe NVT Info structure.
pThe position of the reference to return.
Returns
The reference. NULL on error.

Definition at line 629 of file nvti.c.

630 {
631  return (n ? g_slist_nth_data (n->refs, p) : NULL);
632 }

References nvti::refs.

◆ nvti_vtref_len()

guint nvti_vtref_len ( const nvti_t n)

Get the number of references of the NVT.

Parameters
nThe NVT Info structure.
Returns
The number of references.

Definition at line 614 of file nvti.c.

615 {
616  return (n ? g_slist_length (n->refs) : 0);
617 }

References nvti::refs.

◆ nvtis_add()

void nvtis_add ( nvtis_t nvtis,
nvti_t nvti 
)

Add an NVT Info to a collection of NVT Infos.

Parameters
nvtisThe collection of NVT Infos.
nvtiThe NVT Info to add.

Definition at line 1822 of file nvti.c.

1823 {
1824  if (nvti)
1825  g_hash_table_insert (nvtis, (gpointer) nvti_oid (nvti), (gpointer) nvti);
1826 }

References nvti_oid().

Here is the call graph for this function:

◆ nvtis_free()

void nvtis_free ( nvtis_t nvtis)

Free a collection of NVT Infos.

Parameters
nvtisThe collection of NVT Infos.

Definition at line 1809 of file nvti.c.

1810 {
1811  if (nvtis)
1812  g_hash_table_destroy (nvtis);
1813 }

◆ nvtis_lookup()

nvti_t* nvtis_lookup ( nvtis_t nvtis,
const char *  oid 
)

Add an NVT Info to a collection of NVT Infos.

Parameters
nvtisThe collection of NVT Infos.
oidThe OID of the NVT.
Returns
The NVT Info, if found, else NULL.

Definition at line 1837 of file nvti.c.

1838 {
1839  return g_hash_table_lookup (nvtis, oid);
1840 }

◆ nvtis_new()

nvtis_t* nvtis_new ( void  )

Make a collection of NVT Infos.

Returns
An empty collection of NVT Infos.

Definition at line 1797 of file nvti.c.

1798 {
1799  return g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
1801 }

References free_nvti_for_hash_table().

Here is the call graph for this function:

◆ nvtpref_default()

gchar* nvtpref_default ( const nvtpref_t np)

Get the Default of a NVT Preference.

Parameters
npThe NVT Pref structure of which the Default should be returned.
Returns
The default string. Don't free this.

Definition at line 440 of file nvti.c.

441 {
442  return (np ? np->dflt : NULL);
443 }

References nvtpref::dflt.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvtpref_free()

void nvtpref_free ( nvtpref_t np)

Free memory of a nvtpref structure.

Parameters
npThe structure to be freed.

Definition at line 378 of file nvti.c.

379 {
380  if (!np)
381  return;
382 
383  g_free (np->name);
384  g_free (np->type);
385  g_free (np->dflt);
386  g_free (np);
387 }

References nvtpref::dflt, nvtpref::name, and nvtpref::type.

Referenced by nvti_free().

Here is the caller graph for this function:

◆ nvtpref_id()

int nvtpref_id ( const nvtpref_t np)

Get the ID of a NVT Preference.

Parameters
npThe NVT Pref structure of which the Name should be returned.
Returns
The ID value.

Definition at line 398 of file nvti.c.

399 {
400  return np ? np->id : -1;
401 }

References nvtpref::id.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvtpref_name()

gchar* nvtpref_name ( const nvtpref_t np)

Get the Name of a NVT Preference.

Parameters
npThe NVT Pref structure of which the Name should be returned.
Returns
The name string. Don't free this.

Definition at line 412 of file nvti.c.

413 {
414  return (np ? np->name : NULL);
415 }

References nvtpref::name.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ nvtpref_new()

nvtpref_t* nvtpref_new ( int  id,
gchar *  name,
gchar *  type,
gchar *  dflt 
)

Create a new nvtpref structure filled with the given values.

Parameters
idThe ID to be set.
nameThe name to be set. A copy will created of this.
typeThe type to be set. A copy will created of this.
dfltThe default to be set. A copy will created of this.
Returns
NULL in case the memory could not be allocated. Else a nvtpref structure which needs to be released using nvtpref_free .

Definition at line 357 of file nvti.c.

358 {
359  nvtpref_t *np = g_malloc0 (sizeof (nvtpref_t));
360 
361  np->id = id;
362  if (name)
363  np->name = g_strdup (name);
364  if (type)
365  np->type = g_strdup (type);
366  if (dflt)
367  np->dflt = g_strdup (dflt);
368 
369  return (np);
370 }

References nvtpref::dflt, nvtpref::id, nvtpref::name, and nvtpref::type.

Referenced by nvticache_get_prefs().

Here is the caller graph for this function:

◆ nvtpref_type()

gchar* nvtpref_type ( const nvtpref_t np)

Get the Type of a NVT Preference.

Parameters
npThe NVT Pref structure of which the Type should be returned.
Returns
The type string. Don't free this.

Definition at line 426 of file nvti.c.

427 {
428  return (np ? np->type : NULL);
429 }

References nvtpref::type.

Referenced by redis_add_nvt().

Here is the caller graph for this function:

◆ vtref_free()

void vtref_free ( vtref_t ref)

Free memory of a vtref structure.

Parameters
refThe structure to be freed.

Definition at line 109 of file nvti.c.

110 {
111  if (!ref)
112  return;
113 
114  g_free (ref->type);
115  g_free (ref->ref_id);
116  g_free (ref->ref_text);
117  g_free (ref);
118 }

References vtref::ref_id, vtref::ref_text, and vtref::type.

Referenced by nvti_free().

Here is the caller graph for this function:

◆ vtref_id()

const gchar* vtref_id ( const vtref_t r)

Get the id of a reference.

Parameters
rThe VT Reference structure of which the id should be returned.
Returns
The id string. Don't free this.

Definition at line 143 of file nvti.c.

144 {
145  return (r ? r->ref_id : NULL);
146 }

References vtref::ref_id.

◆ vtref_new()

vtref_t* vtref_new ( const gchar *  type,
const gchar *  ref_id,
const gchar *  ref_text 
)

Create a new vtref structure filled with the given values.

Parameters
typeThe type to be set.
ref_idThe actual reference to be set.
ref_textThe optional text accompanying a reference.
Returns
NULL in case the memory could not be allocated. Else a vtref structure which needs to be released using vtref_free .

Definition at line 89 of file nvti.c.

90 {
91  vtref_t *ref = g_malloc0 (sizeof (vtref_t));
92 
93  if (type)
94  ref->type = g_strdup (type);
95  if (ref_id)
96  ref->ref_id = g_strdup (ref_id);
97  if (ref_text)
98  ref->ref_text = g_strdup (ref_text);
99 
100  return (ref);
101 }

References vtref::ref_id, vtref::ref_text, and vtref::type.

Referenced by nvti_add_refs().

Here is the caller graph for this function:

◆ vtref_text()

const gchar* vtref_text ( const vtref_t r)

Get the text of a reference.

Parameters
rThe VT Reference structure of which the id should be returned.
Returns
The id string. Don't free this.

Definition at line 157 of file nvti.c.

158 {
159  return (r ? r->ref_text : NULL);
160 }

References vtref::ref_text.

◆ vtref_type()

const gchar* vtref_type ( const vtref_t r)

Get the type of a reference.

Parameters
rThe VT Reference structure of which the type should be returned.
Returns
The type string. Don't free this.

Definition at line 129 of file nvti.c.

130 {
131  return (r ? r->type : NULL);
132 }

References vtref::type.

nvti_add_vtref
int nvti_add_vtref(nvti_t *vt, vtref_t *ref)
Add a reference to the VT Info.
Definition: nvti.c:319
nvti::mandatory_keys
gchar * mandatory_keys
List of mandatory KB keys of this NVT.
Definition: nvti.c:291
nvti::insight
gchar * insight
The insight.
Definition: nvti.c:276
vtref::ref_text
gchar * ref_text
Optional additional text.
Definition: nvti.c:72
nvti::required_keys
gchar * required_keys
List of required KB keys of this NVT.
Definition: nvti.c:290
nvti::solution_type
gchar * solution_type
The solution type.
Definition: nvti.c:284
nvti_set_creation_time
int nvti_set_creation_time(nvti_t *n, const time_t creation_time)
Set the creation time of a NVT.
Definition: nvti.c:1097
vtref
The structure for a cross reference of a VT.
Definition: nvti.c:68
nvti::detection
gchar * detection
Detection description.
Definition: nvti.c:297
nvti_oid
gchar * nvti_oid(const nvti_t *n)
Get the OID string.
Definition: nvti.c:503
nvti::name
gchar * name
The name.
Definition: nvti.c:273
nvti::solution
gchar * solution
The solution.
Definition: nvti.c:283
nvtpref::dflt
gchar * dflt
Default value of the preference.
Definition: nvti.c:338
vtref::type
gchar * type
Reference type ("cve", "bid", ...)
Definition: nvti.c:70
nvti::timeout
gint timeout
Default timeout time for this NVT.
Definition: nvti.c:304
nvti::creation_time
time_t creation_time
Time of creation, seconds since epoch.
Definition: nvti.c:280
nvti::cvss_base
gchar * cvss_base
CVSS base score for this NVT.
Definition: nvti.c:287
nvti::affected
gchar * affected
Affected systems.
Definition: nvti.c:277
nvti::required_udp_ports
gchar * required_udp_ports
List of required UDP ports of this NVT.
Definition: nvti.c:295
nvti::category
gint category
The category, this NVT belongs to.
Definition: nvti.c:305
nvti
The structure of a information record that corresponds to a NVT.
Definition: nvti.c:270
nvti_modification_time
time_t nvti_modification_time(const nvti_t *n)
Get the modification time.
Definition: nvti.c:601
vtref_free
void vtref_free(vtref_t *ref)
Free memory of a vtref structure.
Definition: nvti.c:109
nvtpref::name
gchar * name
Name of the preference.
Definition: nvti.c:337
nvti::oid
gchar * oid
Object ID.
Definition: nvti.c:272
nvti::excluded_keys
gchar * excluded_keys
List of excluded KB keys of this NVT.
Definition: nvti.c:292
nvti_set_modification_time
int nvti_set_modification_time(nvti_t *n, const time_t modification_time)
Set the modification time of a NVT.
Definition: nvti.c:1116
nvtpref
The structure for a preference of a NVT.
Definition: nvti.c:333
nvtpref_free
void nvtpref_free(nvtpref_t *np)
Free memory of a nvtpref structure.
Definition: nvti.c:378
nvtpref::type
gchar * type
Preference type.
Definition: nvti.c:336
nvti::impact
gchar * impact
Impact of vulnerability.
Definition: nvti.c:278
vtref_new
vtref_t * vtref_new(const gchar *type, const gchar *ref_id, const gchar *ref_text)
Create a new vtref structure filled with the given values.
Definition: nvti.c:89
free_nvti_for_hash_table
static void free_nvti_for_hash_table(gpointer nvti)
Free an NVT Info, for g_hash_table_destroy.
Definition: nvti.c:1786
nvti::summary
gchar * summary
The summary.
Definition: nvti.c:275
nvti::family
gchar * family
Family the NVT belongs to.
Definition: nvti.c:306
nvtpref::id
int id
Preference ID.
Definition: nvti.c:335
nvti::modification_time
time_t modification_time
Time of last change, sec. since epoch.
Definition: nvti.c:281
nvti::dependencies
gchar * dependencies
List of dependencies of this NVT.
Definition: nvti.c:289
nvti::tag
gchar * tag
List of tags attached to this NVT.
Definition: nvti.c:286
nvti::required_ports
gchar * required_ports
List of required ports of this NVT.
Definition: nvti.c:293
nvti::qod_type
gchar * qod_type
Quality of detection type.
Definition: nvti.c:298
nvti_creation_time
time_t nvti_creation_time(const nvti_t *n)
Get the creation time.
Definition: nvti.c:587
parse_nvt_timestamp
static time_t parse_nvt_timestamp(const gchar *str_time)
Try convert an NVT tag time string into epoch time or return 0 upon parse errors.
Definition: nvti.c:173
nvti::prefs
GSList * prefs
Collection of NVT preferences.
Definition: nvti.c:301
nvti::refs
GSList * refs
Collection of VT references.
Definition: nvti.c:300
vtref::ref_id
gchar * ref_id
Actual reference ID ("CVE-2018-1234", etc)
Definition: nvti.c:71