Skip to content

Commit

Permalink
Merge pull request #250 from janowagner/resolve_tags
Browse files Browse the repository at this point in the history
Make QoD Type an explicit element of stuct nvti.
  • Loading branch information
mattmundell authored Jul 21, 2019
2 parents 2490cfd + 99dec22 commit b15abf5
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
40 changes: 40 additions & 0 deletions base/nvti.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ nvti_free (nvti_t *n)
g_free (n->excluded_keys);
g_free (n->required_ports);
g_free (n->required_udp_ports);
g_free (n->qod_type);
g_free (n->family);
g_slist_free_full (n->refs, (void (*) (void *)) vtref_free);
g_slist_free_full (n->prefs, (void (*) (void *)) nvtpref_free);
Expand Down Expand Up @@ -578,6 +579,20 @@ nvti_required_udp_ports (const nvti_t *n)
return (n ? n->required_udp_ports : NULL);
}

/**
* @brief Get the QoD type.
*
* @param n The NVT Info structure of which the QoD type should
* be returned.
*
* @return The QoD type as string. Don't free this.
*/
gchar *
nvti_qod_type (const nvti_t *n)
{
return (n ? n->qod_type : NULL);
}

/**
* @brief Get the family name.
*
Expand Down Expand Up @@ -887,6 +902,31 @@ nvti_set_required_udp_ports (nvti_t *n, const gchar *required_udp_ports)
return (0);
}

/**
* @brief Set the QoD type of a NVT.
*
* @param n The NVT Info structure.
*
* @param qod_type The QoD type to set. A copy will be created from this.
* The string is not checked, any string is accepted as type.
*
* @return 0 for success. Anything else indicates an error.
*/
int
nvti_set_qod_type (nvti_t *n, const gchar *qod_type)
{
if (!n)
return (-1);

if (n->qod_type)
g_free (n->qod_type);
if (qod_type && qod_type[0])
n->qod_type = g_strdup (qod_type);
else
n->qod_type = NULL;
return (0);
}

/**
* @brief Set the family of a NVT.
*
Expand Down
6 changes: 6 additions & 0 deletions base/nvti.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ typedef struct nvti
gchar
*required_udp_ports; /**< @brief List of required UDP ports of this NVT*/

gchar *qod_type; /**< @brief Quality of detection type */

GSList *refs; /**< @brief Collection of VT references */
GSList *prefs; /**< @brief Collection of NVT preferences */

Expand Down Expand Up @@ -142,6 +144,8 @@ gchar *
nvti_required_ports (const nvti_t *);
gchar *
nvti_required_udp_ports (const nvti_t *);
gchar *
nvti_qod_type (const nvti_t *);
gint
nvti_timeout (const nvti_t *);
gint
Expand Down Expand Up @@ -174,6 +178,8 @@ nvti_set_required_ports (nvti_t *, const gchar *);
int
nvti_set_required_udp_ports (nvti_t *, const gchar *);
int
nvti_set_qod_type (nvti_t *, const gchar *);
int
nvti_set_timeout (nvti_t *, const gint);
int
nvti_set_category (nvti_t *, const gint);
Expand Down

0 comments on commit b15abf5

Please sign in to comment.