Greenbone Vulnerability Management Libraries  22.8.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 
13 #ifndef _NVTI_H
14 #define _NVTI_H
15 
16 #include <glib.h>
17 
18 #define NVTPREF_TIMEOUT_ID 0
19 
20 typedef struct nvtpref nvtpref_t;
21 
22 nvtpref_t *
23 nvtpref_new (int, const gchar *, const gchar *, const gchar *);
24 
25 void
27 
28 gchar *
29 nvtpref_name (const nvtpref_t *);
30 
31 gchar *
32 nvtpref_type (const nvtpref_t *);
33 
34 gchar *
35 nvtpref_default (const nvtpref_t *);
36 
37 int
39 
43 typedef struct vtref vtref_t;
44 
48 typedef struct vtseverity vtseverity_t;
49 
53 typedef struct nvti nvti_t;
54 
55 vtref_t *
56 vtref_new (const gchar *, const gchar *, const gchar *);
57 void
59 const gchar *
60 vtref_type (const vtref_t *);
61 const gchar *
62 vtref_id (const vtref_t *);
63 const gchar *
64 vtref_text (const vtref_t *);
65 
67 vtseverity_new (const gchar *, const gchar *, int, double, const gchar *);
68 void
70 const gchar *
72 const gchar *
74 const gchar *
76 int
78 double
80 
81 int
83 guint
84 nvti_vtref_len (const nvti_t *);
85 vtref_t *
86 nvti_vtref (const nvti_t *, guint);
87 
88 int
90 guint
93 nvti_vtseverity (const nvti_t *, guint);
94 double
95 nvti_severity_score (const nvti_t *);
96 gchar *
98 
99 nvti_t *
100 nvti_new (void);
101 void
102 nvti_free (nvti_t *);
103 
104 gchar *
105 nvti_oid (const nvti_t *);
106 gchar *
107 nvti_name (const nvti_t *);
108 gchar *
109 nvti_summary (const nvti_t *);
110 gchar *
111 nvti_affected (const nvti_t *);
112 gchar *
113 nvti_impact (const nvti_t *);
114 time_t
115 nvti_creation_time (const nvti_t *);
116 time_t
118 gchar *
119 nvti_insight (const nvti_t *);
120 gchar *
121 nvti_refs (const nvti_t *, const gchar *, const char *, guint);
122 gchar *
123 nvti_solution (const nvti_t *);
124 gchar *
125 nvti_solution_type (const nvti_t *);
126 gchar *
127 nvti_solution_method (const nvti_t *);
128 gchar *
129 nvti_tag (const nvti_t *);
130 gchar *
131 nvti_get_tag (const nvti_t *, const gchar *);
132 gchar *
133 nvti_cvss_base (const nvti_t *);
134 gchar *
135 nvti_dependencies (const nvti_t *);
136 gchar *
137 nvti_required_keys (const nvti_t *);
138 gchar *
139 nvti_mandatory_keys (const nvti_t *);
140 gchar *
141 nvti_excluded_keys (const nvti_t *);
142 gchar *
143 nvti_required_ports (const nvti_t *);
144 gchar *
146 gchar *
147 nvti_detection (const nvti_t *);
148 gchar *
149 nvti_qod_type (const nvti_t *);
150 gchar *
151 nvti_qod (const nvti_t *);
152 gint
154 gint
155 nvti_category (const nvti_t *);
156 gchar *
157 nvti_family (const nvti_t *);
158 guint
159 nvti_pref_len (const nvti_t *);
160 const nvtpref_t *
161 nvti_pref (const nvti_t *, guint);
162 
163 int
164 nvti_set_oid (nvti_t *, const gchar *);
165 int
166 nvti_set_name (nvti_t *, const gchar *);
167 int
168 nvti_put_name (nvti_t *, gchar *);
169 int
170 nvti_set_summary (nvti_t *, const gchar *);
171 int
172 nvti_put_summary (nvti_t *, gchar *);
173 int
174 nvti_set_insight (nvti_t *, const gchar *);
175 int
176 nvti_put_insight (nvti_t *, gchar *);
177 int
178 nvti_set_affected (nvti_t *, const gchar *);
179 int
180 nvti_put_affected (nvti_t *, gchar *);
181 int
182 nvti_set_impact (nvti_t *, const gchar *);
183 int
184 nvti_put_impact (nvti_t *, gchar *);
185 int
186 nvti_set_creation_time (nvti_t *, const time_t);
187 int
188 nvti_set_modification_time (nvti_t *, const time_t);
189 int
190 nvti_set_solution (nvti_t *, const gchar *);
191 int
192 nvti_put_solution (nvti_t *, gchar *);
193 int
194 nvti_set_solution_type (nvti_t *, const gchar *);
195 int
196 nvti_set_solution_method (nvti_t *, const gchar *);
197 int
198 nvti_add_tag (nvti_t *, const gchar *, const gchar *);
199 int
200 nvti_set_tag (nvti_t *, const gchar *);
201 int
202 nvti_set_cvss_base (nvti_t *, const gchar *);
203 int
204 nvti_set_dependencies (nvti_t *, const gchar *);
205 int
206 nvti_set_required_keys (nvti_t *, const gchar *);
207 int
208 nvti_set_mandatory_keys (nvti_t *, const gchar *);
209 int
210 nvti_set_excluded_keys (nvti_t *, const gchar *);
211 int
212 nvti_set_required_ports (nvti_t *, const gchar *);
213 int
214 nvti_set_required_udp_ports (nvti_t *, const gchar *);
215 int
216 nvti_set_detection (nvti_t *, const gchar *);
217 int
218 nvti_put_detection (nvti_t *, gchar *);
219 int
220 nvti_set_qod_type (nvti_t *, const gchar *);
221 int
222 nvti_set_qod (nvti_t *, const gchar *);
223 int
224 nvti_set_timeout (nvti_t *, const gint);
225 int
226 nvti_set_category (nvti_t *, const gint);
227 int
228 nvti_set_family (nvti_t *, const gchar *);
229 int
230 nvti_put_family (nvti_t *, gchar *);
231 
232 int
233 nvti_add_refs (nvti_t *, const gchar *, const gchar *, const gchar *);
234 int
235 nvti_add_required_keys (nvti_t *, const gchar *);
236 int
237 nvti_add_mandatory_keys (nvti_t *, const gchar *);
238 int
239 nvti_add_excluded_keys (nvti_t *, const gchar *);
240 int
241 nvti_add_required_ports (nvti_t *, const gchar *);
242 int
243 nvti_add_required_udp_ports (nvti_t *, const gchar *);
244 int
246 
247 /* Collections of NVT Infos. */
248 
252 typedef GHashTable nvtis_t;
253 
254 nvtis_t *
255 nvtis_new (void);
256 
257 void
258 nvtis_free (nvtis_t *);
259 
260 void
261 nvtis_add (nvtis_t *, nvti_t *);
262 
263 nvti_t *
264 nvtis_lookup (nvtis_t *, const char *);
265 
266 #endif /* not _NVTI_H */
nvti_new
nvti_t * nvti_new(void)
Create a new (empty) nvti structure.
Definition: nvti.c:597
vtseverity_value
const gchar * vtseverity_value(const vtseverity_t *)
Get the value of a severity.
Definition: nvti.c:253
nvtis_t
GHashTable nvtis_t
A collection of information records corresponding to NVTs.
Definition: nvti.h:252
nvti_put_insight
int nvti_put_insight(nvti_t *, gchar *)
Set the insight text of a NVT, using the given memory.
Definition: nvti.c:1372
vtseverity_type
const gchar * vtseverity_type(const vtseverity_t *)
Get the type of a severity.
Definition: nvti.c:225
nvti_set_affected
int nvti_set_affected(nvti_t *, const gchar *)
Set the affected text of a NVT.
Definition: nvti.c:1392
nvti_set_impact
int nvti_set_impact(nvti_t *, const gchar *)
Set the impact text of a NVT.
Definition: nvti.c:1432
nvti_set_family
int nvti_set_family(nvti_t *, const gchar *)
Set the family of a NVT.
Definition: nvti.c:1941
nvti_oid
gchar * nvti_oid(const nvti_t *)
Get the OID string.
Definition: nvti.c:649
nvtpref_id
int nvtpref_id(const nvtpref_t *)
Get the ID of a NVT Preference.
Definition: nvti.c:541
vtref
The structure for a cross reference of a VT.
Definition: nvti.c:58
nvti_refs
gchar * nvti_refs(const nvti_t *, const gchar *, const char *, guint)
nvti_set_mandatory_keys
int nvti_set_mandatory_keys(nvti_t *, const gchar *)
Set the mandatory keys of a NVT.
Definition: nvti.c:1758
nvti_vtseverity
vtseverity_t * nvti_vtseverity(const nvti_t *, guint)
Get the n'th reference of the NVT.
Definition: nvti.c:893
nvti_detection
gchar * nvti_detection(const nvti_t *)
Get the text about detection.
Definition: nvti.c:1154
nvti_put_detection
int nvti_put_detection(nvti_t *, gchar *)
Set the detection text of a NVT, using the given memory.
Definition: nvti.c:1873
nvti_get_tag
gchar * nvti_get_tag(const nvti_t *, const gchar *)
Get a tag value by a tag name.
Definition: nvti.c:1020
nvti_set_qod_type
int nvti_set_qod_type(nvti_t *, const gchar *)
Set the QoD type of a NVT.
Definition: nvti.c:1894
nvtis_new
nvtis_t * nvtis_new(void)
Make a collection of NVT Infos.
Definition: nvti.c:2246
nvti_set_dependencies
int nvti_set_dependencies(nvti_t *, const gchar *)
Set the dependencies of a NVT.
Definition: nvti.c:1710
nvti_add_pref
int nvti_add_pref(nvti_t *, nvtpref_t *)
Add a preference to the NVT Info.
Definition: nvti.c:2218
nvti_set_required_udp_ports
int nvti_set_required_udp_ports(nvti_t *, const gchar *)
Set the required udp ports of a NVT.
Definition: nvti.c:1830
nvtpref_free
void nvtpref_free(nvtpref_t *)
Free memory of a nvtpref structure.
Definition: nvti.c:521
nvti_set_summary
int nvti_set_summary(nvti_t *, const gchar *)
Set the summary of a NVT.
Definition: nvti.c:1312
nvti_set_solution
int nvti_set_solution(nvti_t *, const gchar *)
Set the solution of a NVT.
Definition: nvti.c:1510
nvti_qod_type
gchar * nvti_qod_type(const nvti_t *)
Get the QoD type.
Definition: nvti.c:1168
nvti_set_modification_time
int nvti_set_modification_time(nvti_t *, const time_t)
Set the modification time of a NVT.
Definition: nvti.c:1491
nvti_pref_len
guint nvti_pref_len(const nvti_t *)
Get the number of preferences of the NVT.
Definition: nvti.c:1209
vtseverity_new
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:182
nvti_tag
gchar * nvti_tag(const nvti_t *)
Get the tags.
Definition: nvti.c:1004
nvti_summary
gchar * nvti_summary(const nvti_t *)
Get the summary.
Definition: nvti.c:677
nvtpref_new
nvtpref_t * nvtpref_new(int, const gchar *, const gchar *, const gchar *)
Create a new nvtpref structure filled with the given values.
Definition: nvti.c:500
nvti
The structure of a information record that corresponds to a NVT.
Definition: nvti.c:394
nvti_insight
gchar * nvti_insight(const nvti_t *)
Get the text about insight.
Definition: nvti.c:691
nvti_affected
gchar * nvti_affected(const nvti_t *)
Get the text about affected systems.
Definition: nvti.c:705
vtref_new
vtref_t * vtref_new(const gchar *, const gchar *, const gchar *)
Create a new vtref structure filled with the given values.
Definition: nvti.c:78
nvti_add_vtseverity
int nvti_add_vtseverity(nvti_t *, vtseverity_t *)
Add a severity to the VT Info.
Definition: nvti.c:462
nvti_timeout
gint nvti_timeout(const nvti_t *)
nvti_set_name
int nvti_set_name(nvti_t *, const gchar *)
Set the name of a NVT.
Definition: nvti.c:1272
nvti_vtseverities_len
guint nvti_vtseverities_len(const nvti_t *)
Get the number of severities of the NVT.
Definition: nvti.c:878
nvti_dependencies
gchar * nvti_dependencies(const nvti_t *)
Get the dependencies list.
Definition: nvti.c:1070
nvti_severity_score
double nvti_severity_score(const nvti_t *)
Get the maximum severity score.
Definition: nvti.c:906
nvti_put_affected
int nvti_put_affected(nvti_t *, gchar *)
Set the affected text of a NVT, using the given memory.
Definition: nvti.c:1412
nvti_family
gchar * nvti_family(const nvti_t *)
Get the family name.
Definition: nvti.c:1196
nvti_pref
const nvtpref_t * nvti_pref(const nvti_t *, guint)
Get the n'th preferences of the NVT.
Definition: nvti.c:1224
nvtpref
The structure for a preference of a NVT.
Definition: nvti.c:477
nvti_add_excluded_keys
int nvti_add_excluded_keys(nvti_t *, const gchar *)
Add a excluded key of a NVT.
Definition: nvti.c:2122
nvti_set_solution_method
int nvti_set_solution_method(nvti_t *, const gchar *)
Set the solution method of a NVT.
Definition: nvti.c:1572
vtref_text
const gchar * vtref_text(const vtref_t *)
Get the text of a reference.
Definition: nvti.c:146
nvti_set_oid
int nvti_set_oid(nvti_t *, const gchar *)
Set the OID of a NVT Info.
Definition: nvti.c:1252
nvti_set_category
int nvti_set_category(nvti_t *, const gint)
Set the category type of a NVT Info.
Definition: nvti.c:1981
vtseverity
The structure for a severity of a VT.
Definition: nvti.c:159
nvti_name
gchar * nvti_name(const nvti_t *)
Get the name.
Definition: nvti.c:663
nvti_put_solution
int nvti_put_solution(nvti_t *, gchar *)
Set the solution of a NVT, using the given memory.
Definition: nvti.c:1530
nvti_add_refs
int nvti_add_refs(nvti_t *, const gchar *, const gchar *, const gchar *)
Add many new vtref from a comma-separated list.
Definition: nvti.c:2006
nvtpref_type
gchar * nvtpref_type(const nvtpref_t *)
Get the Type of a NVT Preference.
Definition: nvti.c:569
nvti_creation_time
time_t nvti_creation_time(const nvti_t *)
Get the creation time.
Definition: nvti.c:733
vtref_free
void vtref_free(vtref_t *)
Free memory of a vtref structure.
Definition: nvti.c:98
nvtpref_name
gchar * nvtpref_name(const nvtpref_t *)
Get the Name of a NVT Preference.
Definition: nvti.c:555
nvti_cvss_base
gchar * nvti_cvss_base(const nvti_t *)
Get the CVSS base.
Definition: nvti.c:1056
nvti_required_ports
gchar * nvti_required_ports(const nvti_t *)
Get the required ports list.
Definition: nvti.c:1126
vtseverity_date
int vtseverity_date(const vtseverity_t *)
Get the date of a severity.
Definition: nvti.c:267
nvti_required_keys
gchar * nvti_required_keys(const nvti_t *)
Get the required keys list.
Definition: nvti.c:1084
nvti_add_required_udp_ports
int nvti_add_required_udp_ports(nvti_t *, const gchar *)
Add a required udp port of a NVT.
Definition: nvti.c:2186
nvti_solution_method
gchar * nvti_solution_method(const nvti_t *)
Get the solution method.
Definition: nvti.c:990
nvti_set_solution_type
int nvti_set_solution_type(nvti_t *, const gchar *)
Set the solution type of a NVT.
Definition: nvti.c:1551
nvti_set_creation_time
int nvti_set_creation_time(nvti_t *, const time_t)
Set the creation time of a NVT.
Definition: nvti.c:1472
nvti_set_insight
int nvti_set_insight(nvti_t *, const gchar *)
Set the insight text of a NVT.
Definition: nvti.c:1352
nvti_set_cvss_base
int nvti_set_cvss_base(nvti_t *, const gchar *)
Set the CVSS base of an NVT.
Definition: nvti.c:1686
nvti_add_required_keys
int nvti_add_required_keys(nvti_t *, const gchar *)
Add a required key of a NVT.
Definition: nvti.c:2058
nvti_vtref_len
guint nvti_vtref_len(const nvti_t *)
Get the number of references of the NVT.
Definition: nvti.c:760
vtref_id
const gchar * vtref_id(const vtref_t *)
Get the id of a reference.
Definition: nvti.c:132
nvti_free
void nvti_free(nvti_t *)
Free memory of a nvti structure.
Definition: nvti.c:608
nvti_set_required_ports
int nvti_set_required_ports(nvti_t *, const gchar *)
Set the required ports of a NVT.
Definition: nvti.c:1806
nvti_put_impact
int nvti_put_impact(nvti_t *, gchar *)
Set the impact text of a NVT, using the given memory.
Definition: nvti.c:1452
nvti_modification_time
time_t nvti_modification_time(const nvti_t *)
Get the modification time.
Definition: nvti.c:747
vtseverity_free
void vtseverity_free(vtseverity_t *)
Free memory of a vtseverity structure.
Definition: nvti.c:205
nvtis_free
void nvtis_free(nvtis_t *)
Free a collection of NVT Infos.
Definition: nvti.c:2258
nvti_vtref
vtref_t * nvti_vtref(const nvti_t *, guint)
Get the n'th reference of the NVT.
Definition: nvti.c:775
nvtis_add
void nvtis_add(nvtis_t *, nvti_t *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:2271
nvti_required_udp_ports
gchar * nvti_required_udp_ports(const nvti_t *)
Get the required udp ports list.
Definition: nvti.c:1140
nvti_qod
gchar * nvti_qod(const nvti_t *)
Get the QoD.
Definition: nvti.c:1182
nvti_set_required_keys
int nvti_set_required_keys(nvti_t *, const gchar *)
Set the required keys of a NVT.
Definition: nvti.c:1734
nvti_put_name
int nvti_put_name(nvti_t *, gchar *)
Set the name of a NVT, using the given memory.
Definition: nvti.c:1292
nvti_add_tag
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:1599
nvti_set_excluded_keys
int nvti_set_excluded_keys(nvti_t *, const gchar *)
Set the excluded keys of a NVT.
Definition: nvti.c:1782
nvti_set_timeout
int nvti_set_timeout(nvti_t *, const gint)
vtseverity_score
double vtseverity_score(const vtseverity_t *)
Get the score of a severity.
Definition: nvti.c:281
nvti_category
gint nvti_category(const nvti_t *)
Get the category for this NVT.
Definition: nvti.c:1237
nvti_add_required_ports
int nvti_add_required_ports(nvti_t *, const gchar *)
Add a required port of a NVT.
Definition: nvti.c:2154
nvtis_lookup
nvti_t * nvtis_lookup(nvtis_t *, const char *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:2288
nvti_excluded_keys
gchar * nvti_excluded_keys(const nvti_t *)
Get the excluded keys list.
Definition: nvti.c:1112
nvti_set_qod
int nvti_set_qod(nvti_t *, const gchar *)
Set the QoD of a NVT.
Definition: nvti.c:1918
nvti_solution
gchar * nvti_solution(const nvti_t *)
Get the solution.
Definition: nvti.c:962
nvti_solution_type
gchar * nvti_solution_type(const nvti_t *)
Get the solution type.
Definition: nvti.c:976
nvti_add_vtref
int nvti_add_vtref(nvti_t *, vtref_t *)
Add a reference to the VT Info.
Definition: nvti.c:444
nvti_impact
gchar * nvti_impact(const nvti_t *)
Get the text about impact.
Definition: nvti.c:719
nvtpref_default
gchar * nvtpref_default(const nvtpref_t *)
Get the Default of a NVT Preference.
Definition: nvti.c:583
nvti_set_tag
int nvti_set_tag(nvti_t *, const gchar *)
Set the tags of a NVT.
Definition: nvti.c:1663
vtref_type
const gchar * vtref_type(const vtref_t *)
Get the type of a reference.
Definition: nvti.c:118
nvti_put_family
int nvti_put_family(nvti_t *, gchar *)
Set the family of a NVT, using the given memory.
Definition: nvti.c:1961
nvti_set_detection
int nvti_set_detection(nvti_t *, const gchar *)
Set the detection text of a NVT.
Definition: nvti.c:1853
nvti_mandatory_keys
gchar * nvti_mandatory_keys(const nvti_t *)
Get the mandatory keys list.
Definition: nvti.c:1098
nvti_severity_vector_from_tag
gchar * nvti_severity_vector_from_tag(const nvti_t *)
Get the severity score.
Definition: nvti.c:938
nvti_add_mandatory_keys
int nvti_add_mandatory_keys(nvti_t *, const gchar *)
Add a mandatory key of a NVT.
Definition: nvti.c:2090
vtseverity_origin
const gchar * vtseverity_origin(const vtseverity_t *)
Get the origin of a severity.
Definition: nvti.c:239
nvti_put_summary
int nvti_put_summary(nvti_t *, gchar *)
Set the summary of a NVT, using the given memory.
Definition: nvti.c:1332