Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make QoD Type an explicit element of stuct nvti. #250

Merged
merged 1 commit into from
Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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