Greenbone Vulnerability Management Libraries  21.4.2
nvti.h
Go to the documentation of this file.
1 /* Copyright (C) 2009-2021 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 typedef struct nvtpref nvtpref_t;
33 
34 nvtpref_t *
35 nvtpref_new (int, gchar *, gchar *, gchar *);
36 
37 void
39 
40 gchar *
41 nvtpref_name (const nvtpref_t *);
42 
43 gchar *
44 nvtpref_type (const nvtpref_t *);
45 
46 gchar *
47 nvtpref_default (const nvtpref_t *);
48 
49 int
51 
55 typedef struct vtref vtref_t;
56 
60 typedef struct vtseverity vtseverity_t;
61 
65 typedef struct nvti nvti_t;
66 
67 vtref_t *
68 vtref_new (const gchar *, const gchar *, const gchar *);
69 void
71 const gchar *
72 vtref_type (const vtref_t *);
73 const gchar *
74 vtref_id (const vtref_t *);
75 const gchar *
76 vtref_text (const vtref_t *);
77 
79 vtseverity_new (const gchar *, const gchar *, int, double, const gchar *);
80 void
82 const gchar *
84 const gchar *
86 const gchar *
88 int
90 double
92 
93 int
95 guint
96 nvti_vtref_len (const nvti_t *);
97 vtref_t *
98 nvti_vtref (const nvti_t *, guint);
99 
100 int
102 guint
103 nvti_vtseverities_len (const nvti_t *);
104 vtseverity_t *
105 nvti_vtseverity (const nvti_t *, guint);
106 double
107 nvti_severity_score (const nvti_t *);
108 
109 nvti_t *
110 nvti_new (void);
111 void
112 nvti_free (nvti_t *);
113 
114 gchar *
115 nvti_oid (const nvti_t *);
116 gchar *
117 nvti_name (const nvti_t *);
118 gchar *
119 nvti_summary (const nvti_t *);
120 gchar *
121 nvti_affected (const nvti_t *);
122 gchar *
123 nvti_impact (const nvti_t *);
124 time_t
125 nvti_creation_time (const nvti_t *);
126 time_t
128 gchar *
129 nvti_insight (const nvti_t *);
130 gchar *
131 nvti_refs (const nvti_t *, const gchar *, const char *, guint);
132 gchar *
133 nvti_solution (const nvti_t *);
134 gchar *
135 nvti_solution_type (const nvti_t *);
136 gchar *
137 nvti_solution_method (const nvti_t *);
138 gchar *
139 nvti_tag (const nvti_t *);
140 gchar *
141 nvti_get_tag (const nvti_t *, const gchar *);
142 gchar *
143 nvti_cvss_base (const nvti_t *);
144 gchar *
145 nvti_dependencies (const nvti_t *);
146 gchar *
147 nvti_required_keys (const nvti_t *);
148 gchar *
149 nvti_mandatory_keys (const nvti_t *);
150 gchar *
151 nvti_excluded_keys (const nvti_t *);
152 gchar *
153 nvti_required_ports (const nvti_t *);
154 gchar *
156 gchar *
157 nvti_detection (const nvti_t *);
158 gchar *
159 nvti_qod_type (const nvti_t *);
160 gchar *
161 nvti_qod (const nvti_t *);
162 gint
163 nvti_timeout (const nvti_t *);
164 gint
165 nvti_category (const nvti_t *);
166 gchar *
167 nvti_family (const nvti_t *);
168 guint
169 nvti_pref_len (const nvti_t *);
170 const nvtpref_t *
171 nvti_pref (const nvti_t *, guint);
172 
173 int
174 nvti_set_oid (nvti_t *, const gchar *);
175 int
176 nvti_set_name (nvti_t *, const gchar *);
177 int
178 nvti_set_summary (nvti_t *, const gchar *);
179 int
180 nvti_set_insight (nvti_t *, const gchar *);
181 int
182 nvti_set_affected (nvti_t *, const gchar *);
183 int
184 nvti_set_impact (nvti_t *, const 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_set_solution_type (nvti_t *, const gchar *);
193 int
194 nvti_set_solution_method (nvti_t *, const gchar *);
195 int
196 nvti_add_tag (nvti_t *, const gchar *, const gchar *);
197 int
198 nvti_set_tag (nvti_t *, const gchar *);
199 int
200 nvti_set_cvss_base (nvti_t *, const gchar *);
201 int
202 nvti_set_dependencies (nvti_t *, const gchar *);
203 int
204 nvti_set_required_keys (nvti_t *, const gchar *);
205 int
206 nvti_set_mandatory_keys (nvti_t *, const gchar *);
207 int
208 nvti_set_excluded_keys (nvti_t *, const gchar *);
209 int
210 nvti_set_required_ports (nvti_t *, const gchar *);
211 int
212 nvti_set_required_udp_ports (nvti_t *, const gchar *);
213 int
214 nvti_set_detection (nvti_t *, const gchar *);
215 int
216 nvti_set_qod_type (nvti_t *, const gchar *);
217 int
218 nvti_set_qod (nvti_t *, const gchar *);
219 int
220 nvti_set_timeout (nvti_t *, const gint);
221 int
222 nvti_set_category (nvti_t *, const gint);
223 int
224 nvti_set_family (nvti_t *, const gchar *);
225 
226 int
227 nvti_add_refs (nvti_t *, const gchar *, const gchar *, const gchar *);
228 int
229 nvti_add_required_keys (nvti_t *, const gchar *);
230 int
231 nvti_add_mandatory_keys (nvti_t *, const gchar *);
232 int
233 nvti_add_excluded_keys (nvti_t *, const gchar *);
234 int
235 nvti_add_required_ports (nvti_t *, const gchar *);
236 int
237 nvti_add_required_udp_ports (nvti_t *, const gchar *);
238 int
240 
241 /* Collections of NVT Infos. */
242 
246 typedef GHashTable nvtis_t;
247 
248 nvtis_t *
249 nvtis_new (void);
250 
251 void
252 nvtis_free (nvtis_t *);
253 
254 void
255 nvtis_add (nvtis_t *, nvti_t *);
256 
257 nvti_t *
258 nvtis_lookup (nvtis_t *, const char *);
259 
260 #endif /* not _NVTI_H */
int nvti_set_qod(nvti_t *, const gchar *)
Set the QoD of a NVT.
Definition: nvti.c:1778
void nvtpref_free(nvtpref_t *)
Free memory of a nvtpref structure.
Definition: nvti.c:537
gchar * nvti_summary(const nvti_t *)
Get the summary.
Definition: nvti.c:693
void nvtis_add(nvtis_t *, nvti_t *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:2130
gchar * nvti_tag(const nvti_t *)
Get the tags.
Definition: nvti.c:990
nvtpref_t * nvtpref_new(int, gchar *, gchar *, gchar *)
Create a new nvtpref structure filled with the given values.
Definition: nvti.c:516
gchar * nvti_required_keys(const nvti_t *)
Get the required keys list.
Definition: nvti.c:1070
gchar * nvti_solution(const nvti_t *)
Get the solution.
Definition: nvti.c:948
int nvti_set_modification_time(nvti_t *, const time_t)
Set the modification time of a NVT.
Definition: nvti.c:1391
int nvti_set_dependencies(nvti_t *, const gchar *)
Set the dependencies of a NVT.
Definition: nvti.c:1590
gchar * nvti_qod_type(const nvti_t *)
Get the QoD type.
Definition: nvti.c:1154
guint nvti_pref_len(const nvti_t *)
Get the number of preferences of the NVT.
Definition: nvti.c:1195
gchar * nvti_refs(const nvti_t *, const gchar *, const char *, guint)
gchar * nvti_oid(const nvti_t *)
Get the OID string.
Definition: nvti.c:665
const nvtpref_t * nvti_pref(const nvti_t *, guint)
Get the n'th preferences of the NVT.
Definition: nvti.c:1210
vtref_t * vtref_new(const gchar *, const gchar *, const gchar *)
Create a new vtref structure filled with the given values.
Definition: nvti.c:92
guint nvti_vtref_len(const nvti_t *)
Get the number of references of the NVT.
Definition: nvti.c:776
gchar * nvti_qod(const nvti_t *)
Get the QoD.
Definition: nvti.c:1168
void nvtis_free(nvtis_t *)
Free a collection of NVT Infos.
Definition: nvti.c:2117
int nvti_set_solution_method(nvti_t *, const gchar *)
Set the solution method of a NVT.
Definition: nvti.c:1452
gint nvti_timeout(const nvti_t *)
Get the timeout for this NVT.
Definition: nvti.c:1224
double nvti_severity_score(const nvti_t *)
Get the maximum severity score.
Definition: nvti.c:922
gchar * nvtpref_default(const nvtpref_t *)
Get the Default of a NVT Preference.
Definition: nvti.c:599
time_t nvti_modification_time(const nvti_t *)
Get the modification time.
Definition: nvti.c:763
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:2077
time_t nvti_creation_time(const nvti_t *)
Get the creation time.
Definition: nvti.c:749
nvtis_t * nvtis_new(void)
Make a collection of NVT Infos.
Definition: nvti.c:2105
int nvti_set_family(nvti_t *, const gchar *)
Set the family of a NVT.
Definition: nvti.c:1801
gchar * nvti_required_udp_ports(const nvti_t *)
Get the required udp ports list.
Definition: nvti.c:1126
int nvti_set_insight(nvti_t *, const gchar *)
Set the insight text of a NVT.
Definition: nvti.c:1312
int nvti_set_cvss_base(nvti_t *, const gchar *)
Set the CVSS base of an NVT.
Definition: nvti.c:1566
gchar * nvti_affected(const nvti_t *)
Get the text about affected systems.
Definition: nvti.c:721
const gchar * vtseverity_value(const vtseverity_t *)
Get the value of a severity.
Definition: nvti.c:267
int nvti_set_creation_time(nvti_t *, const time_t)
Set the creation time of a NVT.
Definition: nvti.c:1372
nvti_t * nvtis_lookup(nvtis_t *, const char *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:2147
int nvti_set_required_udp_ports(nvti_t *, const gchar *)
Set the required udp ports of a NVT.
Definition: nvti.c:1710
int nvti_add_vtseverity(nvti_t *, vtseverity_t *)
Add a severity to the VT Info.
Definition: nvti.c:478
int nvti_set_detection(nvti_t *, const gchar *)
Set the detection text of a NVT.
Definition: nvti.c:1733
int nvti_set_tag(nvti_t *, const gchar *)
Set the tags of a NVT.
Definition: nvti.c:1543
gchar * nvti_required_ports(const nvti_t *)
Get the required ports list.
Definition: nvti.c:1112
int nvti_add_mandatory_keys(nvti_t *, const gchar *)
Add a mandatory key of a NVT.
Definition: nvti.c:1949
const gchar * vtseverity_origin(const vtseverity_t *)
Get the origin of a severity.
Definition: nvti.c:253
int nvti_add_excluded_keys(nvti_t *, const gchar *)
Add a excluded key of a NVT.
Definition: nvti.c:1981
int nvti_set_qod_type(nvti_t *, const gchar *)
Set the QoD type of a NVT.
Definition: nvti.c:1754
gchar * nvti_solution_type(const nvti_t *)
Get the solution type.
Definition: nvti.c:962
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:1479
gchar * nvti_excluded_keys(const nvti_t *)
Get the excluded keys list.
Definition: nvti.c:1098
int nvti_add_required_udp_ports(nvti_t *, const gchar *)
Add a required udp port of a NVT.
Definition: nvti.c:2045
int nvti_set_required_keys(nvti_t *, const gchar *)
Set the required keys of a NVT.
Definition: nvti.c:1614
GHashTable nvtis_t
A collection of information records corresponding to NVTs.
Definition: nvti.h:246
gchar * nvti_family(const nvti_t *)
Get the family name.
Definition: nvti.c:1182
int nvti_add_refs(nvti_t *, const gchar *, const gchar *, const gchar *)
Add many new vtref from a comma-separated list.
Definition: nvti.c:1865
int nvti_add_required_keys(nvti_t *, const gchar *)
Add a required key of a NVT.
Definition: nvti.c:1917
int nvti_set_impact(nvti_t *, const gchar *)
Set the impact text of a NVT.
Definition: nvti.c:1352
gchar * nvti_name(const nvti_t *)
Get the name.
Definition: nvti.c:679
int nvti_set_summary(nvti_t *, const gchar *)
Set the summary of a NVT.
Definition: nvti.c:1292
const gchar * vtref_id(const vtref_t *)
Get the id of a reference.
Definition: nvti.c:146
int nvti_set_timeout(nvti_t *, const gint)
Set the timeout of a NVT Info.
Definition: nvti.c:1821
const gchar * vtref_type(const vtref_t *)
Get the type of a reference.
Definition: nvti.c:132
gchar * nvtpref_name(const nvtpref_t *)
Get the Name of a NVT Preference.
Definition: nvti.c:571
int nvtpref_id(const nvtpref_t *)
Get the ID of a NVT Preference.
Definition: nvti.c:557
int nvti_set_required_ports(nvti_t *, const gchar *)
Set the required ports of a NVT.
Definition: nvti.c:1686
int nvti_set_solution_type(nvti_t *, const gchar *)
Set the solution type of a NVT.
Definition: nvti.c:1431
vtseverity_t * nvti_vtseverity(const nvti_t *, guint)
Get the n'th reference of the NVT.
Definition: nvti.c:909
int nvti_add_required_ports(nvti_t *, const gchar *)
Add a required port of a NVT.
Definition: nvti.c:2013
int nvti_set_category(nvti_t *, const gint)
Set the category type of a NVT Info.
Definition: nvti.c:1840
int nvti_set_mandatory_keys(nvti_t *, const gchar *)
Set the mandatory keys of a NVT.
Definition: nvti.c:1638
int nvti_set_affected(nvti_t *, const gchar *)
Set the affected text of a NVT.
Definition: nvti.c:1332
void vtseverity_free(vtseverity_t *)
Free memory of a vtseverity structure.
Definition: nvti.c:219
gchar * nvti_cvss_base(const nvti_t *)
Get the CVSS base.
Definition: nvti.c:1042
int vtseverity_date(const vtseverity_t *)
Get the date of a severity.
Definition: nvti.c:281
const gchar * vtseverity_type(const vtseverity_t *)
Get the type of a severity.
Definition: nvti.c:239
int nvti_set_name(nvti_t *, const gchar *)
Set the name of a NVT.
Definition: nvti.c:1272
gchar * nvti_impact(const nvti_t *)
Get the text about impact.
Definition: nvti.c:735
int nvti_add_vtref(nvti_t *, vtref_t *)
Add a reference to the VT Info.
Definition: nvti.c:459
int nvti_set_solution(nvti_t *, const gchar *)
Set the solution of a NVT.
Definition: nvti.c:1410
guint nvti_vtseverities_len(const nvti_t *)
Get the number of severities of the NVT.
Definition: nvti.c:894
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
gchar * nvti_detection(const nvti_t *)
Get the text about detection.
Definition: nvti.c:1140
void nvti_free(nvti_t *)
Free memory of a nvti structure.
Definition: nvti.c:624
gchar * nvti_mandatory_keys(const nvti_t *)
Get the mandatory keys list.
Definition: nvti.c:1084
void vtref_free(vtref_t *)
Free memory of a vtref structure.
Definition: nvti.c:112
vtref_t * nvti_vtref(const nvti_t *, guint)
Get the n'th reference of the NVT.
Definition: nvti.c:791
gchar * nvti_solution_method(const nvti_t *)
Get the solution method.
Definition: nvti.c:976
gint nvti_category(const nvti_t *)
Get the category for this NVT.
Definition: nvti.c:1237
gchar * nvtpref_type(const nvtpref_t *)
Get the Type of a NVT Preference.
Definition: nvti.c:585
const gchar * vtref_text(const vtref_t *)
Get the text of a reference.
Definition: nvti.c:160
gchar * nvti_get_tag(const nvti_t *, const gchar *)
Get a tag value by a tag name.
Definition: nvti.c:1006
int nvti_set_oid(nvti_t *, const gchar *)
Set the OID of a NVT Info.
Definition: nvti.c:1252
int nvti_set_excluded_keys(nvti_t *, const gchar *)
Set the excluded keys of a NVT.
Definition: nvti.c:1662
gchar * nvti_dependencies(const nvti_t *)
Get the dependencies list.
Definition: nvti.c:1056
nvti_t * nvti_new(void)
Create a new (empty) nvti structure.
Definition: nvti.c:613
gchar * nvti_insight(const nvti_t *)
Get the text about insight.
Definition: nvti.c:707
The structure of a information record that corresponds to a NVT.
Definition: nvti.c:408
The structure for a preference of a NVT.
Definition: nvti.c:493
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