Greenbone Vulnerability Management Libraries 22.41.0
nvti.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009-2023 Greenbone AG
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
12
13#ifndef _GVM_BASE_NVTI_H
14#define _GVM_BASE_NVTI_H
15
16#include <glib.h>
17
18#define NVTPREF_TIMEOUT_ID 0
19
20typedef struct nvtpref nvtpref_t;
21
23nvtpref_new (int, const gchar *, const gchar *, const gchar *);
24
25void
27
28gchar *
29nvtpref_name (const nvtpref_t *);
30
31gchar *
32nvtpref_type (const nvtpref_t *);
33
34gchar *
36
37int
38nvtpref_id (const nvtpref_t *);
39
43typedef struct vtref vtref_t;
44
48typedef struct vtseverity vtseverity_t;
49
53typedef struct nvti nvti_t;
54
55vtref_t *
56vtref_new (const gchar *, const gchar *, const gchar *);
57void
59const gchar *
60vtref_type (const vtref_t *);
61const gchar *
62vtref_id (const vtref_t *);
63const gchar *
64vtref_text (const vtref_t *);
65
67vtseverity_new (const gchar *, const gchar *, int, double, const gchar *);
68void
70const gchar *
72const gchar *
74const gchar *
76int
78double
80
81int
83guint
84nvti_vtref_len (const nvti_t *);
85vtref_t *
86nvti_vtref (const nvti_t *, guint);
87
88int
90guint
93nvti_vtseverity (const nvti_t *, guint);
94double
96gchar *
98
99nvti_t *
100nvti_new (void);
101void
102nvti_free (nvti_t *);
103
104gchar *
105nvti_oid (const nvti_t *);
106gchar *
107nvti_name (const nvti_t *);
108gchar *
109nvti_summary (const nvti_t *);
110gchar *
111nvti_affected (const nvti_t *);
112gchar *
113nvti_impact (const nvti_t *);
114time_t
115nvti_creation_time (const nvti_t *);
116time_t
118gchar *
119nvti_insight (const nvti_t *);
120gchar *
121nvti_refs (const nvti_t *, const gchar *, const char *, guint);
122gchar *
123nvti_solution (const nvti_t *);
124gchar *
125nvti_solution_type (const nvti_t *);
126gchar *
128gchar *
129nvti_tag (const nvti_t *);
130gchar *
131nvti_get_tag (const nvti_t *, const gchar *);
132gchar *
133nvti_cvss_base (const nvti_t *);
134gchar *
135nvti_dependencies (const nvti_t *);
136gchar *
137nvti_required_keys (const nvti_t *);
138gchar *
140gchar *
141nvti_excluded_keys (const nvti_t *);
142gchar *
144gchar *
146gchar *
147nvti_detection (const nvti_t *);
148gchar *
149nvti_qod_type (const nvti_t *);
150gchar *
151nvti_qod (const nvti_t *);
152gint
154gint
155nvti_category (const nvti_t *);
156gchar *
157nvti_family (const nvti_t *);
158guint
159nvti_pref_len (const nvti_t *);
160const nvtpref_t *
161nvti_pref (const nvti_t *, guint);
162
163int
164nvti_set_oid (nvti_t *, const gchar *);
165int
166nvti_set_name (nvti_t *, const gchar *);
167int
168nvti_put_name (nvti_t *, gchar *);
169int
170nvti_set_summary (nvti_t *, const gchar *);
171int
172nvti_put_summary (nvti_t *, gchar *);
173int
174nvti_set_insight (nvti_t *, const gchar *);
175int
176nvti_put_insight (nvti_t *, gchar *);
177int
178nvti_set_affected (nvti_t *, const gchar *);
179int
180nvti_put_affected (nvti_t *, gchar *);
181int
182nvti_set_impact (nvti_t *, const gchar *);
183int
184nvti_put_impact (nvti_t *, gchar *);
185int
186nvti_set_creation_time (nvti_t *, const time_t);
187int
188nvti_set_modification_time (nvti_t *, const time_t);
189int
190nvti_set_solution (nvti_t *, const gchar *);
191int
192nvti_put_solution (nvti_t *, gchar *);
193int
194nvti_set_solution_type (nvti_t *, const gchar *);
195int
196nvti_set_solution_method (nvti_t *, const gchar *);
197int
198nvti_add_tag (nvti_t *, const gchar *, const gchar *);
199int
200nvti_set_tag (nvti_t *, const gchar *);
201int
202nvti_set_cvss_base (nvti_t *, const gchar *);
203int
204nvti_set_dependencies (nvti_t *, const gchar *);
205int
206nvti_set_required_keys (nvti_t *, const gchar *);
207int
208nvti_set_mandatory_keys (nvti_t *, const gchar *);
209int
210nvti_set_excluded_keys (nvti_t *, const gchar *);
211int
212nvti_set_required_ports (nvti_t *, const gchar *);
213int
214nvti_set_required_udp_ports (nvti_t *, const gchar *);
215int
216nvti_set_detection (nvti_t *, const gchar *);
217int
218nvti_put_detection (nvti_t *, 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 *);
229int
230nvti_put_family (nvti_t *, gchar *);
231
232int
233nvti_add_refs (nvti_t *, const gchar *, const gchar *, const gchar *);
234int
235nvti_add_required_keys (nvti_t *, const gchar *);
236int
237nvti_add_mandatory_keys (nvti_t *, const gchar *);
238int
239nvti_add_excluded_keys (nvti_t *, const gchar *);
240int
241nvti_add_required_ports (nvti_t *, const gchar *);
242int
243nvti_add_required_udp_ports (nvti_t *, const gchar *);
244int
246
247/* Collections of NVT Infos. */
248
252typedef GHashTable nvtis_t;
253
254nvtis_t *
255nvtis_new (void);
256
257void
259
260void
262
263nvti_t *
264nvtis_lookup (nvtis_t *, const char *);
265
266#endif /* not _GVM_BASE_NVTI_H */
vtref_t * nvti_vtref(const nvti_t *n, guint p)
Get the n'th reference of the NVT.
Definition nvti.c:737
struct vtseverity vtseverity_t
The structure for a severity of a VT.
nvti_t * nvti_new(void)
Create a new (empty) nvti structure.
Definition nvti.c:559
int nvti_put_impact(nvti_t *n, gchar *impact)
Set the impact text of a NVT, using the given memory.
Definition nvti.c:1414
void vtseverity_free(vtseverity_t *s)
Free memory of a vtseverity structure.
Definition nvti.c:203
gchar * nvti_dependencies(const nvti_t *n)
Get the dependencies list.
Definition nvti.c:1032
int nvti_add_required_keys(nvti_t *n, const gchar *key)
Add a required key of a NVT.
Definition nvti.c:2020
guint nvti_pref_len(const nvti_t *n)
Get the number of preferences of the NVT.
Definition nvti.c:1171
int nvti_set_qod(nvti_t *n, const gchar *qod)
Set the QoD of a NVT.
Definition nvti.c:1880
gchar * nvti_detection(const nvti_t *n)
Get the text about detection.
Definition nvti.c:1116
gchar * nvti_required_udp_ports(const nvti_t *n)
Get the required udp ports list.
Definition nvti.c:1102
int nvti_set_solution(nvti_t *n, const gchar *solution)
Set the solution of a NVT.
Definition nvti.c:1472
gchar * nvti_get_tag(const nvti_t *n, const gchar *name)
Get a tag value by a tag name.
Definition nvti.c:982
gchar * nvti_summary(const nvti_t *n)
Get the summary.
Definition nvti.c:639
int nvti_set_solution_type(nvti_t *n, const gchar *solution_type)
Set the solution type of a NVT.
Definition nvti.c:1513
gchar * nvti_required_ports(const nvti_t *n)
Get the required ports list.
Definition nvti.c:1088
int nvti_put_insight(nvti_t *n, gchar *insight)
Set the insight text of a NVT, using the given memory.
Definition nvti.c:1334
gchar * nvti_refs(const nvti_t *n, const gchar *type, const gchar *exclude_types, guint use_types)
Get references as string.
Definition nvti.c:766
double nvti_severity_score(const nvti_t *n)
Get the maximum severity score.
Definition nvti.c:868
gchar * nvtpref_type(const nvtpref_t *np)
Get the Type of a NVT Preference.
Definition nvti.c:532
int nvti_set_excluded_keys(nvti_t *n, const gchar *excluded_keys)
Set the excluded keys of a NVT.
Definition nvti.c:1744
struct nvti nvti_t
The structure of a information record that corresponds to a NVT.
int nvti_set_qod_type(nvti_t *n, const gchar *qod_type)
Set the QoD type of a NVT.
Definition nvti.c:1856
int nvti_add_excluded_keys(nvti_t *n, const gchar *key)
Add a excluded key of a NVT.
Definition nvti.c:2084
int nvti_put_detection(nvti_t *n, gchar *detection)
Set the detection text of a NVT, using the given memory.
Definition nvti.c:1835
nvtis_t * nvtis_new(void)
Make a collection of NVT Infos.
Definition nvti.c:2208
int nvti_set_dependencies(nvti_t *n, const gchar *dependencies)
Set the dependencies of a NVT.
Definition nvti.c:1672
int nvti_set_required_ports(nvti_t *n, const gchar *required_ports)
Set the required ports of a NVT.
Definition nvti.c:1768
int nvti_set_oid(nvti_t *n, const gchar *oid)
Set the OID of a NVT Info.
Definition nvti.c:1214
int nvti_add_required_udp_ports(nvti_t *n, const gchar *port)
Add a required udp port of a NVT.
Definition nvti.c:2148
int nvti_set_tag(nvti_t *n, const gchar *tag)
Set the tags of a NVT.
Definition nvti.c:1625
int nvti_set_cvss_base(nvti_t *n, const gchar *cvss_base)
Set the CVSS base of an NVT.
Definition nvti.c:1648
int nvti_set_mandatory_keys(nvti_t *n, const gchar *mandatory_keys)
Set the mandatory keys of a NVT.
Definition nvti.c:1720
int nvti_put_name(nvti_t *n, gchar *name)
Set the name of a NVT, using the given memory.
Definition nvti.c:1254
int nvti_put_family(nvti_t *n, gchar *family)
Set the family of a NVT, using the given memory.
Definition nvti.c:1923
gint nvti_category(const nvti_t *n)
Get the category for this NVT.
Definition nvti.c:1199
int nvti_set_impact(nvti_t *n, const gchar *impact)
Set the impact text of a NVT.
Definition nvti.c:1394
const gchar * vtseverity_type(const vtseverity_t *s)
Get the type of a severity.
Definition nvti.c:223
int nvti_add_required_ports(nvti_t *n, const gchar *port)
Add a required port of a NVT.
Definition nvti.c:2116
struct nvtpref nvtpref_t
The structure for a preference of a NVT.
gchar * nvti_family(const nvti_t *n)
Get the family name.
Definition nvti.c:1158
gchar * nvti_severity_vector_from_tag(const nvti_t *n)
Get the severity score.
Definition nvti.c:900
struct vtref vtref_t
The structure for a cross reference of a VT.
gchar * nvti_solution_method(const nvti_t *n)
Get the solution method.
Definition nvti.c:952
guint nvti_vtseverities_len(const nvti_t *n)
Get the number of severities of the NVT.
Definition nvti.c:840
const nvtpref_t * nvti_pref(const nvti_t *n, guint p)
Get the n'th preferences of the NVT.
Definition nvti.c:1186
gchar * nvti_qod(const nvti_t *n)
Get the QoD.
Definition nvti.c:1144
gchar * nvti_excluded_keys(const nvti_t *n)
Get the excluded keys list.
Definition nvti.c:1074
int nvti_set_summary(nvti_t *n, const gchar *summary)
Set the summary of a NVT.
Definition nvti.c:1274
gchar * nvti_name(const nvti_t *n)
Get the name.
Definition nvti.c:625
gchar * nvti_oid(const nvti_t *n)
Get the OID string.
Definition nvti.c:611
nvtpref_t * nvtpref_new(int id, const gchar *name, const gchar *type, const gchar *dflt)
Create a new nvtpref structure filled with the given values.
Definition nvti.c:463
int nvti_put_affected(nvti_t *n, gchar *affected)
Set the affected text of a NVT, using the given memory.
Definition nvti.c:1374
int nvti_put_solution(nvti_t *n, gchar *solution)
Set the solution of a NVT, using the given memory.
Definition nvti.c:1492
double vtseverity_score(const vtseverity_t *s)
Get the score of a severity.
Definition nvti.c:279
const gchar * vtref_type(const vtref_t *r)
Get the type of a reference.
Definition nvti.c:117
int nvti_add_pref(nvti_t *n, nvtpref_t *np)
Add a preference to the NVT Info.
Definition nvti.c:2180
int nvti_put_summary(nvti_t *n, gchar *summary)
Set the summary of a NVT, using the given memory.
Definition nvti.c:1294
const gchar * vtseverity_value(const vtseverity_t *s)
Get the value of a severity.
Definition nvti.c:251
int nvti_set_insight(nvti_t *n, const gchar *insight)
Set the insight text of a NVT.
Definition nvti.c:1314
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:77
gchar * nvti_cvss_base(const nvti_t *n)
Get the CVSS base.
Definition nvti.c:1018
int nvti_set_required_keys(nvti_t *n, const gchar *required_keys)
Set the required keys of a NVT.
Definition nvti.c:1696
int nvti_add_vtseverity(nvti_t *vt, vtseverity_t *s)
Add a severity to the VT Info.
Definition nvti.c:426
void nvtpref_free(nvtpref_t *np)
Free memory of a nvtpref structure.
Definition nvti.c:484
int nvti_set_solution_method(nvti_t *n, const gchar *solution_method)
Set the solution method of a NVT.
Definition nvti.c:1534
int nvtpref_id(const nvtpref_t *np)
Get the ID of a NVT Preference.
Definition nvti.c:504
int nvti_set_name(nvti_t *n, const gchar *name)
Set the name of a NVT.
Definition nvti.c:1234
nvti_t * nvtis_lookup(nvtis_t *nvtis, const char *oid)
Add an NVT Info to a collection of NVT Infos.
Definition nvti.c:2250
gchar * nvti_qod_type(const nvti_t *n)
Get the QoD type.
Definition nvti.c:1130
int nvti_add_mandatory_keys(nvti_t *n, const gchar *key)
Add a mandatory key of a NVT.
Definition nvti.c:2052
time_t nvti_creation_time(const nvti_t *n)
Get the creation time.
Definition nvti.c:695
gchar * nvti_affected(const nvti_t *n)
Get the text about affected systems.
Definition nvti.c:667
vtseverity_t * nvti_vtseverity(const nvti_t *n, guint p)
Get the n'th reference of the NVT.
Definition nvti.c:855
vtseverity_t * vtseverity_new(const gchar *type, const gchar *origin, int date, double score, const gchar *value)
Create a new vtseverity structure filled with the given values.
Definition nvti.c:180
gchar * nvti_solution(const nvti_t *n)
Get the solution.
Definition nvti.c:924
int nvti_set_modification_time(nvti_t *n, const time_t modification_time)
Set the modification time of a NVT.
Definition nvti.c:1453
int nvti_set_creation_time(nvti_t *n, const time_t creation_time)
Set the creation time of a NVT.
Definition nvti.c:1434
gchar * nvti_required_keys(const nvti_t *n)
Get the required keys list.
Definition nvti.c:1046
gchar * nvti_insight(const nvti_t *n)
Get the text about insight.
Definition nvti.c:653
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.
Definition nvti.c:1968
time_t nvti_modification_time(const nvti_t *n)
Get the modification time.
Definition nvti.c:709
void vtref_free(vtref_t *ref)
Free memory of a vtref structure.
Definition nvti.c:97
const gchar * vtseverity_origin(const vtseverity_t *s)
Get the origin of a severity.
Definition nvti.c:237
guint nvti_vtref_len(const nvti_t *n)
Get the number of references of the NVT.
Definition nvti.c:722
int nvti_set_required_udp_ports(nvti_t *n, const gchar *required_udp_ports)
Set the required udp ports of a NVT.
Definition nvti.c:1792
gchar * nvti_mandatory_keys(const nvti_t *n)
Get the mandatory keys list.
Definition nvti.c:1060
gchar * nvtpref_default(const nvtpref_t *np)
Get the Default of a NVT Preference.
Definition nvti.c:546
int nvti_set_family(nvti_t *n, const gchar *family)
Set the family of a NVT.
Definition nvti.c:1903
gchar * nvtpref_name(const nvtpref_t *np)
Get the Name of a NVT Preference.
Definition nvti.c:518
int nvti_set_affected(nvti_t *n, const gchar *affected)
Set the affected text of a NVT.
Definition nvti.c:1354
int vtseverity_date(const vtseverity_t *s)
Get the date of a severity.
Definition nvti.c:265
gchar * nvti_solution_type(const nvti_t *n)
Get the solution type.
Definition nvti.c:938
const gchar * vtref_id(const vtref_t *r)
Get the id of a reference.
Definition nvti.c:131
int nvti_add_tag(nvti_t *n, const gchar *name, const gchar *value)
Add a tag to the NVT tags. The tag names "severity_date", "last_modification" and "creation_date" are...
Definition nvti.c:1561
void nvtis_add(nvtis_t *nvtis, nvti_t *nvti)
Add an NVT Info to a collection of NVT Infos.
Definition nvti.c:2233
gchar * nvti_impact(const nvti_t *n)
Get the text about impact.
Definition nvti.c:681
const gchar * vtref_text(const vtref_t *r)
Get the text of a reference.
Definition nvti.c:145
void nvtis_free(nvtis_t *nvtis)
Free a collection of NVT Infos.
Definition nvti.c:2220
int nvti_set_detection(nvti_t *n, const gchar *detection)
Set the detection text of a NVT.
Definition nvti.c:1815
gchar * nvti_tag(const nvti_t *n)
Get the tags.
Definition nvti.c:966
int nvti_set_category(nvti_t *n, const gint category)
Set the category type of a NVT Info.
Definition nvti.c:1943
void nvti_free(nvti_t *n)
Free memory of a nvti structure.
Definition nvti.c:570
int nvti_add_vtref(nvti_t *vt, vtref_t *ref)
Add a reference to the VT Info.
Definition nvti.c:408
gint nvti_timeout(const nvti_t *)
GHashTable nvtis_t
A collection of information records corresponding to NVTs.
Definition nvti.h:252
int nvti_set_timeout(nvti_t *, const gint)
The structure of a information record that corresponds to a NVT.
Definition nvti.c:358
The structure for a preference of a NVT.
Definition nvti.c:441
The structure for a cross reference of a VT.
Definition nvti.c:58
The structure for a severity of a VT.
Definition nvti.c:158