Greenbone Vulnerability Management Libraries 22.4.0
nvti.h
Go to the documentation of this file.
1/* Copyright (C) 2009-2022 Greenbone Networks GmbH
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
27#ifndef _NVTI_H
28#define _NVTI_H
29
30#include <glib.h>
31
32#define NVTPREF_TIMEOUT_ID 0
33
34typedef struct nvtpref nvtpref_t;
35
37nvtpref_new (int, gchar *, gchar *, gchar *);
38
39void
41
42gchar *
43nvtpref_name (const nvtpref_t *);
44
45gchar *
46nvtpref_type (const nvtpref_t *);
47
48gchar *
50
51int
52nvtpref_id (const nvtpref_t *);
53
57typedef struct vtref vtref_t;
58
62typedef struct vtseverity vtseverity_t;
63
67typedef struct nvti nvti_t;
68
69vtref_t *
70vtref_new (const gchar *, const gchar *, const gchar *);
71void
73const gchar *
74vtref_type (const vtref_t *);
75const gchar *
76vtref_id (const vtref_t *);
77const gchar *
78vtref_text (const vtref_t *);
79
81vtseverity_new (const gchar *, const gchar *, int, double, const gchar *);
82void
84const gchar *
86const gchar *
88const gchar *
90int
92double
94
95int
97guint
98nvti_vtref_len (const nvti_t *);
99vtref_t *
100nvti_vtref (const nvti_t *, guint);
101
102int
104guint
107nvti_vtseverity (const nvti_t *, guint);
108double
110gchar *
112
113nvti_t *
114nvti_new (void);
115void
116nvti_free (nvti_t *);
117
118gchar *
119nvti_oid (const nvti_t *);
120gchar *
121nvti_name (const nvti_t *);
122gchar *
123nvti_summary (const nvti_t *);
124gchar *
125nvti_affected (const nvti_t *);
126gchar *
127nvti_impact (const nvti_t *);
128time_t
129nvti_creation_time (const nvti_t *);
130time_t
132gchar *
133nvti_insight (const nvti_t *);
134gchar *
135nvti_refs (const nvti_t *, const gchar *, const char *, guint);
136gchar *
137nvti_solution (const nvti_t *);
138gchar *
139nvti_solution_type (const nvti_t *);
140gchar *
142gchar *
143nvti_tag (const nvti_t *);
144gchar *
145nvti_get_tag (const nvti_t *, const gchar *);
146gchar *
147nvti_cvss_base (const nvti_t *);
148gchar *
149nvti_dependencies (const nvti_t *);
150gchar *
151nvti_required_keys (const nvti_t *);
152gchar *
154gchar *
155nvti_excluded_keys (const nvti_t *);
156gchar *
158gchar *
160gchar *
161nvti_detection (const nvti_t *);
162gchar *
163nvti_qod_type (const nvti_t *);
164gchar *
165nvti_qod (const nvti_t *);
166gint
168gint
169nvti_category (const nvti_t *);
170gchar *
171nvti_family (const nvti_t *);
172guint
173nvti_pref_len (const nvti_t *);
174const nvtpref_t *
175nvti_pref (const nvti_t *, guint);
176
177int
178nvti_set_oid (nvti_t *, const gchar *);
179int
180nvti_set_name (nvti_t *, const gchar *);
181int
182nvti_set_summary (nvti_t *, const gchar *);
183int
184nvti_set_insight (nvti_t *, const gchar *);
185int
186nvti_set_affected (nvti_t *, const gchar *);
187int
188nvti_set_impact (nvti_t *, const gchar *);
189int
190nvti_set_creation_time (nvti_t *, const time_t);
191int
192nvti_set_modification_time (nvti_t *, const time_t);
193int
194nvti_set_solution (nvti_t *, const gchar *);
195int
196nvti_set_solution_type (nvti_t *, const gchar *);
197int
198nvti_set_solution_method (nvti_t *, const gchar *);
199int
200nvti_add_tag (nvti_t *, const gchar *, const gchar *);
201int
202nvti_set_tag (nvti_t *, const gchar *);
203int
204nvti_set_cvss_base (nvti_t *, const gchar *);
205int
206nvti_set_dependencies (nvti_t *, const gchar *);
207int
208nvti_set_required_keys (nvti_t *, const gchar *);
209int
210nvti_set_mandatory_keys (nvti_t *, const gchar *);
211int
212nvti_set_excluded_keys (nvti_t *, const gchar *);
213int
214nvti_set_required_ports (nvti_t *, const gchar *);
215int
216nvti_set_required_udp_ports (nvti_t *, const gchar *);
217int
218nvti_set_detection (nvti_t *, const gchar *);
219int
220nvti_set_qod_type (nvti_t *, const gchar *);
221int
222nvti_set_qod (nvti_t *, const gchar *);
223int
224nvti_set_timeout (nvti_t *, const gint);
225int
226nvti_set_category (nvti_t *, const gint);
227int
228nvti_set_family (nvti_t *, const gchar *);
229
230int
231nvti_add_refs (nvti_t *, const gchar *, const gchar *, const gchar *);
232int
233nvti_add_required_keys (nvti_t *, const gchar *);
234int
235nvti_add_mandatory_keys (nvti_t *, const gchar *);
236int
237nvti_add_excluded_keys (nvti_t *, const gchar *);
238int
239nvti_add_required_ports (nvti_t *, const gchar *);
240int
241nvti_add_required_udp_ports (nvti_t *, const gchar *);
242int
244
245/* Collections of NVT Infos. */
246
250typedef GHashTable nvtis_t;
251
252nvtis_t *
253nvtis_new (void);
254
255void
257
258void
260
261nvti_t *
262nvtis_lookup (nvtis_t *, const char *);
263
264#endif /* not _NVTI_H */
int nvti_set_qod(nvti_t *, const gchar *)
Set the QoD of a NVT.
Definition: nvti.c:1790
nvti_t * nvti_new(void)
Create a new (empty) nvti structure.
Definition: nvti.c:609
void nvtpref_free(nvtpref_t *)
Free memory of a nvtpref structure.
Definition: nvti.c:533
void nvtis_add(nvtis_t *, nvti_t *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:2123
vtseverity_t * vtseverity_new(const gchar *, const gchar *, int, double, const gchar *)
Create a new vtseverity structure filled with the given values.
Definition: nvti.c:196
int nvti_set_modification_time(nvti_t *, const time_t)
Set the modification time of a NVT.
Definition: nvti.c:1403
int nvti_set_dependencies(nvti_t *, const gchar *)
Set the dependencies of a NVT.
Definition: nvti.c:1602
gchar * nvti_insight(const nvti_t *)
Get the text about insight.
Definition: nvti.c:703
guint nvti_pref_len(const nvti_t *)
Get the number of preferences of the NVT.
Definition: nvti.c:1221
gchar * nvti_oid(const nvti_t *)
Get the OID string.
Definition: nvti.c:661
guint nvti_vtref_len(const nvti_t *)
Get the number of references of the NVT.
Definition: nvti.c:772
gchar * nvtpref_name(const nvtpref_t *)
Get the Name of a NVT Preference.
Definition: nvti.c:567
void nvtis_free(nvtis_t *)
Free a collection of NVT Infos.
Definition: nvti.c:2110
int nvti_set_solution_method(nvti_t *, const gchar *)
Set the solution method of a NVT.
Definition: nvti.c:1464
nvtis_t * nvtis_new(void)
Make a collection of NVT Infos.
Definition: nvti.c:2098
gint nvti_timeout(const nvti_t *)
gchar * nvti_tag(const nvti_t *)
Get the tags.
Definition: nvti.c:1016
gchar * nvti_refs(const nvti_t *, const gchar *, const char *, guint)
double nvti_severity_score(const nvti_t *)
Get the maximum severity score.
Definition: nvti.c:918
gchar * nvti_mandatory_keys(const nvti_t *)
Get the mandatory keys list.
Definition: nvti.c:1110
gchar * nvti_qod(const nvti_t *)
Get the QoD.
Definition: nvti.c:1194
const gchar * vtref_id(const vtref_t *)
Get the id of a reference.
Definition: nvti.c:146
time_t nvti_modification_time(const nvti_t *)
Get the modification time.
Definition: nvti.c:759
double vtseverity_score(const vtseverity_t *)
Get the score of a severity.
Definition: nvti.c:295
int nvti_add_pref(nvti_t *, nvtpref_t *)
Add a preference to the NVT Info.
Definition: nvti.c:2070
gchar * nvti_solution_method(const nvti_t *)
Get the solution method.
Definition: nvti.c:1002
gchar * nvti_affected(const nvti_t *)
Get the text about affected systems.
Definition: nvti.c:717
time_t nvti_creation_time(const nvti_t *)
Get the creation time.
Definition: nvti.c:745
gchar * nvti_family(const nvti_t *)
Get the family name.
Definition: nvti.c:1208
int nvti_set_family(nvti_t *, const gchar *)
Set the family of a NVT.
Definition: nvti.c:1813
const nvtpref_t * nvti_pref(const nvti_t *, guint)
Get the n'th preferences of the NVT.
Definition: nvti.c:1236
gchar * nvti_name(const nvti_t *)
Get the name.
Definition: nvti.c:675
int nvti_set_insight(nvti_t *, const gchar *)
Set the insight text of a NVT.
Definition: nvti.c:1324
int nvti_set_cvss_base(nvti_t *, const gchar *)
Set the CVSS base of an NVT.
Definition: nvti.c:1578
int nvti_set_creation_time(nvti_t *, const time_t)
Set the creation time of a NVT.
Definition: nvti.c:1384
int nvti_set_required_udp_ports(nvti_t *, const gchar *)
Set the required udp ports of a NVT.
Definition: nvti.c:1722
const gchar * vtref_text(const vtref_t *)
Get the text of a reference.
Definition: nvti.c:160
nvti_t * nvtis_lookup(nvtis_t *, const char *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:2140
gchar * nvti_excluded_keys(const nvti_t *)
Get the excluded keys list.
Definition: nvti.c:1124
int nvti_add_vtseverity(nvti_t *, vtseverity_t *)
Add a severity to the VT Info.
Definition: nvti.c:474
vtseverity_t * nvti_vtseverity(const nvti_t *, guint)
Get the n'th reference of the NVT.
Definition: nvti.c:905
gchar * nvtpref_default(const nvtpref_t *)
Get the Default of a NVT Preference.
Definition: nvti.c:595
int nvti_set_detection(nvti_t *, const gchar *)
Set the detection text of a NVT.
Definition: nvti.c:1745
int nvti_set_tag(nvti_t *, const gchar *)
Set the tags of a NVT.
Definition: nvti.c:1555
gchar * nvti_detection(const nvti_t *)
Get the text about detection.
Definition: nvti.c:1166
int nvti_add_mandatory_keys(nvti_t *, const gchar *)
Add a mandatory key of a NVT.
Definition: nvti.c:1942
int nvti_add_excluded_keys(nvti_t *, const gchar *)
Add a excluded key of a NVT.
Definition: nvti.c:1974
int nvti_set_qod_type(nvti_t *, const gchar *)
Set the QoD type of a NVT.
Definition: nvti.c:1766
gchar * nvti_qod_type(const nvti_t *)
Get the QoD type.
Definition: nvti.c:1180
int nvti_add_tag(nvti_t *, const gchar *, const gchar *)
Add a tag to the NVT tags. The tag names "severity_date", "last_modification" and "creation_date" are...
Definition: nvti.c:1491
int nvti_add_required_udp_ports(nvti_t *, const gchar *)
Add a required udp port of a NVT.
Definition: nvti.c:2038
gchar * nvti_cvss_base(const nvti_t *)
Get the CVSS base.
Definition: nvti.c:1068
gchar * nvti_impact(const nvti_t *)
Get the text about impact.
Definition: nvti.c:731
int nvti_set_required_keys(nvti_t *, const gchar *)
Set the required keys of a NVT.
Definition: nvti.c:1626
GHashTable nvtis_t
A collection of information records corresponding to NVTs.
Definition: nvti.h:250
int nvti_add_refs(nvti_t *, const gchar *, const gchar *, const gchar *)
Add many new vtref from a comma-separated list.
Definition: nvti.c:1858
int nvti_add_required_keys(nvti_t *, const gchar *)
Add a required key of a NVT.
Definition: nvti.c:1910
nvtpref_t * nvtpref_new(int, gchar *, gchar *, gchar *)
Create a new nvtpref structure filled with the given values.
Definition: nvti.c:512
int nvti_set_impact(nvti_t *, const gchar *)
Set the impact text of a NVT.
Definition: nvti.c:1364
int nvti_set_summary(nvti_t *, const gchar *)
Set the summary of a NVT.
Definition: nvti.c:1304
gchar * nvti_required_keys(const nvti_t *)
Get the required keys list.
Definition: nvti.c:1096
int nvti_set_timeout(nvti_t *, const gint)
int nvtpref_id(const nvtpref_t *)
Get the ID of a NVT Preference.
Definition: nvti.c:553
gchar * nvti_solution(const nvti_t *)
Get the solution.
Definition: nvti.c:974
const gchar * vtseverity_type(const vtseverity_t *)
Get the type of a severity.
Definition: nvti.c:239
const gchar * vtseverity_value(const vtseverity_t *)
Get the value of a severity.
Definition: nvti.c:267
vtref_t * vtref_new(const gchar *, const gchar *, const gchar *)
Create a new vtref structure filled with the given values.
Definition: nvti.c:92
int nvti_set_required_ports(nvti_t *, const gchar *)
Set the required ports of a NVT.
Definition: nvti.c:1698
int nvti_set_solution_type(nvti_t *, const gchar *)
Set the solution type of a NVT.
Definition: nvti.c:1443
gchar * nvtpref_type(const nvtpref_t *)
Get the Type of a NVT Preference.
Definition: nvti.c:581
int nvti_add_required_ports(nvti_t *, const gchar *)
Add a required port of a NVT.
Definition: nvti.c:2006
const gchar * vtref_type(const vtref_t *)
Get the type of a reference.
Definition: nvti.c:132
int nvti_set_category(nvti_t *, const gint)
Set the category type of a NVT Info.
Definition: nvti.c:1833
int nvti_set_mandatory_keys(nvti_t *, const gchar *)
Set the mandatory keys of a NVT.
Definition: nvti.c:1650
int nvti_set_affected(nvti_t *, const gchar *)
Set the affected text of a NVT.
Definition: nvti.c:1344
gchar * nvti_solution_type(const nvti_t *)
Get the solution type.
Definition: nvti.c:988
void vtseverity_free(vtseverity_t *)
Free memory of a vtseverity structure.
Definition: nvti.c:219
gchar * nvti_get_tag(const nvti_t *, const gchar *)
Get a tag value by a tag name.
Definition: nvti.c:1032
int vtseverity_date(const vtseverity_t *)
Get the date of a severity.
Definition: nvti.c:281
vtref_t * nvti_vtref(const nvti_t *, guint)
Get the n'th reference of the NVT.
Definition: nvti.c:787
int nvti_set_name(nvti_t *, const gchar *)
Set the name of a NVT.
Definition: nvti.c:1284
const gchar * vtseverity_origin(const vtseverity_t *)
Get the origin of a severity.
Definition: nvti.c:253
int nvti_add_vtref(nvti_t *, vtref_t *)
Add a reference to the VT Info.
Definition: nvti.c:455
int nvti_set_solution(nvti_t *, const gchar *)
Set the solution of a NVT.
Definition: nvti.c:1422
guint nvti_vtseverities_len(const nvti_t *)
Get the number of severities of the NVT.
Definition: nvti.c:890
void nvti_free(nvti_t *)
Free memory of a nvti structure.
Definition: nvti.c:620
gchar * nvti_dependencies(const nvti_t *)
Get the dependencies list.
Definition: nvti.c:1082
void vtref_free(vtref_t *)
Free memory of a vtref structure.
Definition: nvti.c:112
gchar * nvti_summary(const nvti_t *)
Get the summary.
Definition: nvti.c:689
gint nvti_category(const nvti_t *)
Get the category for this NVT.
Definition: nvti.c:1249
gchar * nvti_required_ports(const nvti_t *)
Get the required ports list.
Definition: nvti.c:1138
gchar * nvti_required_udp_ports(const nvti_t *)
Get the required udp ports list.
Definition: nvti.c:1152
int nvti_set_oid(nvti_t *, const gchar *)
Set the OID of a NVT Info.
Definition: nvti.c:1264
gchar * nvti_severity_vector_from_tag(const nvti_t *)
Get the severity score.
Definition: nvti.c:950
int nvti_set_excluded_keys(nvti_t *, const gchar *)
Set the excluded keys of a NVT.
Definition: nvti.c:1674
The structure of a information record that corresponds to a NVT.
Definition: nvti.c:405
The structure for a preference of a NVT.
Definition: nvti.c:489
The structure for a cross reference of a VT.
Definition: nvti.c:72
The structure for a severity of a VT.
Definition: nvti.c:173