Greenbone Vulnerability Management Libraries  20.8.0
nvti.h
Go to the documentation of this file.
1 /* Copyright (C) 2009-2019 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 nvti nvti_t;
61 
62 vtref_t *
63 vtref_new (const gchar *, const gchar *, const gchar *);
64 void
66 const gchar *
67 vtref_type (const vtref_t *);
68 const gchar *
69 vtref_id (const vtref_t *);
70 const gchar *
71 vtref_text (const vtref_t *);
72 
73 int
75 guint
76 nvti_vtref_len (const nvti_t *);
77 vtref_t *
78 nvti_vtref (const nvti_t *, guint);
79 
80 nvti_t *
81 nvti_new (void);
82 void
83 nvti_free (nvti_t *);
84 
85 gchar *
86 nvti_oid (const nvti_t *);
87 gchar *
88 nvti_name (const nvti_t *);
89 gchar *
90 nvti_summary (const nvti_t *);
91 gchar *
92 nvti_affected (const nvti_t *);
93 gchar *
94 nvti_impact (const nvti_t *);
95 time_t
96 nvti_creation_time (const nvti_t *);
97 time_t
99 gchar *
100 nvti_insight (const nvti_t *);
101 gchar *
102 nvti_refs (const nvti_t *, const gchar *, const char *, guint);
103 gchar *
104 nvti_solution (const nvti_t *);
105 gchar *
106 nvti_solution_type (const nvti_t *);
107 gchar *
108 nvti_solution_method (const nvti_t *);
109 gchar *
110 nvti_tag (const nvti_t *);
111 gchar *
112 nvti_get_tag (const nvti_t *, const gchar *);
113 gchar *
114 nvti_cvss_base (const nvti_t *);
115 gchar *
116 nvti_dependencies (const nvti_t *);
117 gchar *
118 nvti_required_keys (const nvti_t *);
119 gchar *
120 nvti_mandatory_keys (const nvti_t *);
121 gchar *
122 nvti_excluded_keys (const nvti_t *);
123 gchar *
124 nvti_required_ports (const nvti_t *);
125 gchar *
127 gchar *
128 nvti_detection (const nvti_t *);
129 gchar *
130 nvti_qod_type (const nvti_t *);
131 gchar *
132 nvti_qod (const nvti_t *);
133 gint
134 nvti_timeout (const nvti_t *);
135 gint
136 nvti_category (const nvti_t *);
137 gchar *
138 nvti_family (const nvti_t *);
139 guint
140 nvti_pref_len (const nvti_t *);
141 const nvtpref_t *
142 nvti_pref (const nvti_t *, guint);
143 
144 int
145 nvti_set_oid (nvti_t *, const gchar *);
146 int
147 nvti_set_name (nvti_t *, const gchar *);
148 int
149 nvti_set_summary (nvti_t *, const gchar *);
150 int
151 nvti_set_insight (nvti_t *, const gchar *);
152 int
153 nvti_set_affected (nvti_t *, const gchar *);
154 int
155 nvti_set_impact (nvti_t *, const gchar *);
156 int
157 nvti_set_creation_time (nvti_t *, const time_t);
158 int
159 nvti_set_modification_time (nvti_t *, const time_t);
160 int
161 nvti_set_solution (nvti_t *, const gchar *);
162 int
163 nvti_set_solution_type (nvti_t *, const gchar *);
164 int
165 nvti_set_solution_method (nvti_t *, const gchar *);
166 int
167 nvti_add_tag (nvti_t *, const gchar *, const gchar *);
168 int
169 nvti_set_tag (nvti_t *, const gchar *);
170 int
171 nvti_set_cvss_base (nvti_t *, const gchar *);
172 int
173 nvti_set_dependencies (nvti_t *, const gchar *);
174 int
175 nvti_set_required_keys (nvti_t *, const gchar *);
176 int
177 nvti_set_mandatory_keys (nvti_t *, const gchar *);
178 int
179 nvti_set_excluded_keys (nvti_t *, const gchar *);
180 int
181 nvti_set_required_ports (nvti_t *, const gchar *);
182 int
183 nvti_set_required_udp_ports (nvti_t *, const gchar *);
184 int
185 nvti_set_detection (nvti_t *, const gchar *);
186 int
187 nvti_set_qod_type (nvti_t *, const gchar *);
188 int
189 nvti_set_qod (nvti_t *, const gchar *);
190 int
191 nvti_set_timeout (nvti_t *, const gint);
192 int
193 nvti_set_category (nvti_t *, const gint);
194 int
195 nvti_set_family (nvti_t *, const gchar *);
196 
197 int
198 nvti_add_refs (nvti_t *, const gchar *, const gchar *, const gchar *);
199 int
200 nvti_add_required_keys (nvti_t *, const gchar *);
201 int
202 nvti_add_mandatory_keys (nvti_t *, const gchar *);
203 int
204 nvti_add_excluded_keys (nvti_t *, const gchar *);
205 int
206 nvti_add_required_ports (nvti_t *, const gchar *);
207 int
208 nvti_add_required_udp_ports (nvti_t *, const gchar *);
209 int
211 
212 /* Collections of NVT Infos. */
213 
217 typedef GHashTable nvtis_t;
218 
219 nvtis_t *
220 nvtis_new (void);
221 
222 void
223 nvtis_free (nvtis_t *);
224 
225 void
226 nvtis_add (nvtis_t *, nvti_t *);
227 
228 nvti_t *
229 nvtis_lookup (nvtis_t *, const char *);
230 
231 #endif /* not _NVTI_H */
nvti_new
nvti_t * nvti_new(void)
Create a new (empty) nvti structure.
Definition: nvti.c:455
nvtis_t
GHashTable nvtis_t
A collection of information records corresponding to NVTs.
Definition: nvti.h:217
nvti_set_affected
int nvti_set_affected(nvti_t *, const gchar *)
Set the affected text of a NVT.
Definition: nvti.c:1120
nvti_set_impact
int nvti_set_impact(nvti_t *, const gchar *)
Set the impact text of a NVT.
Definition: nvti.c:1140
nvti_set_family
int nvti_set_family(nvti_t *, const gchar *)
Set the family of a NVT.
Definition: nvti.c:1587
nvti_oid
gchar * nvti_oid(const nvti_t *)
Get the OID string.
Definition: nvti.c:506
nvtpref_id
int nvtpref_id(const nvtpref_t *)
Get the ID of a NVT Preference.
Definition: nvti.c:399
vtref
The structure for a cross reference of a VT.
Definition: nvti.c:69
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:1424
nvti_detection
gchar * nvti_detection(const nvti_t *)
Get the text about detection.
Definition: nvti.c:928
nvti_get_tag
gchar * nvti_get_tag(const nvti_t *, const gchar *)
Get a tag value by a tag name.
Definition: nvti.c:794
nvti_set_qod_type
int nvti_set_qod_type(nvti_t *, const gchar *)
Set the QoD type of a NVT.
Definition: nvti.c:1540
nvtis_new
nvtis_t * nvtis_new(void)
Make a collection of NVT Infos.
Definition: nvti.c:1891
nvti_set_dependencies
int nvti_set_dependencies(nvti_t *, const gchar *)
Set the dependencies of a NVT.
Definition: nvti.c:1376
nvti_add_pref
int nvti_add_pref(nvti_t *, nvtpref_t *)
Add a preference to the NVT Info.
Definition: nvti.c:1863
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:1496
nvtpref_free
void nvtpref_free(nvtpref_t *)
Free memory of a nvtpref structure.
Definition: nvti.c:379
nvti_set_summary
int nvti_set_summary(nvti_t *, const gchar *)
Set the summary of a NVT.
Definition: nvti.c:1080
nvti_set_solution
int nvti_set_solution(nvti_t *, const gchar *)
Set the solution of a NVT.
Definition: nvti.c:1198
nvti_qod_type
gchar * nvti_qod_type(const nvti_t *)
Get the QoD type.
Definition: nvti.c:942
nvti_set_modification_time
int nvti_set_modification_time(nvti_t *, const time_t)
Set the modification time of a NVT.
Definition: nvti.c:1179
nvti_pref_len
guint nvti_pref_len(const nvti_t *)
Get the number of preferences of the NVT.
Definition: nvti.c:983
nvti_tag
gchar * nvti_tag(const nvti_t *)
Get the tags.
Definition: nvti.c:778
nvti_summary
gchar * nvti_summary(const nvti_t *)
Get the summary.
Definition: nvti.c:534
nvti
The structure of a information record that corresponds to a NVT.
Definition: nvti.c:270
nvti_insight
gchar * nvti_insight(const nvti_t *)
Get the text about insight.
Definition: nvti.c:548
nvti_affected
gchar * nvti_affected(const nvti_t *)
Get the text about affected systems.
Definition: nvti.c:562
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:89
nvti_timeout
gint nvti_timeout(const nvti_t *)
Get the timeout for this NVT.
Definition: nvti.c:1012
nvti_set_name
int nvti_set_name(nvti_t *, const gchar *)
Set the name of a NVT.
Definition: nvti.c:1060
nvti_dependencies
gchar * nvti_dependencies(const nvti_t *)
Get the dependencies list.
Definition: nvti.c:844
nvti_family
gchar * nvti_family(const nvti_t *)
Get the family name.
Definition: nvti.c:970
nvti_pref
const nvtpref_t * nvti_pref(const nvti_t *, guint)
Get the n'th preferences of the NVT.
Definition: nvti.c:998
nvtpref
The structure for a preference of a NVT.
Definition: nvti.c:335
nvti_add_excluded_keys
int nvti_add_excluded_keys(nvti_t *, const gchar *)
Add a excluded key of a NVT.
Definition: nvti.c:1767
nvti_set_solution_method
int nvti_set_solution_method(nvti_t *, const gchar *)
Set the solution method of a NVT.
Definition: nvti.c:1240
vtref_text
const gchar * vtref_text(const vtref_t *)
Get the text of a reference.
Definition: nvti.c:157
nvti_set_oid
int nvti_set_oid(nvti_t *, const gchar *)
Set the OID of a NVT Info.
Definition: nvti.c:1040
nvti_set_category
int nvti_set_category(nvti_t *, const gint)
Set the category type of a NVT Info.
Definition: nvti.c:1626
nvti_name
gchar * nvti_name(const nvti_t *)
Get the name.
Definition: nvti.c:520
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:1651
nvtpref_type
gchar * nvtpref_type(const nvtpref_t *)
Get the Type of a NVT Preference.
Definition: nvti.c:427
nvti_creation_time
time_t nvti_creation_time(const nvti_t *)
Get the creation time.
Definition: nvti.c:590
vtref_free
void vtref_free(vtref_t *)
Free memory of a vtref structure.
Definition: nvti.c:109
nvtpref_name
gchar * nvtpref_name(const nvtpref_t *)
Get the Name of a NVT Preference.
Definition: nvti.c:413
nvti_cvss_base
gchar * nvti_cvss_base(const nvti_t *)
Get the CVSS base.
Definition: nvti.c:830
nvti_required_ports
gchar * nvti_required_ports(const nvti_t *)
Get the required ports list.
Definition: nvti.c:900
nvti_required_keys
gchar * nvti_required_keys(const nvti_t *)
Get the required keys list.
Definition: nvti.c:858
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:1831
nvti_solution_method
gchar * nvti_solution_method(const nvti_t *)
Get the solution method.
Definition: nvti.c:764
nvti_set_solution_type
int nvti_set_solution_type(nvti_t *, const gchar *)
Set the solution type of a NVT.
Definition: nvti.c:1219
nvti_set_creation_time
int nvti_set_creation_time(nvti_t *, const time_t)
Set the creation time of a NVT.
Definition: nvti.c:1160
nvtpref_new
nvtpref_t * nvtpref_new(int, gchar *, gchar *, gchar *)
Create a new nvtpref structure filled with the given values.
Definition: nvti.c:358
nvti_set_insight
int nvti_set_insight(nvti_t *, const gchar *)
Set the insight text of a NVT.
Definition: nvti.c:1100
nvti_set_cvss_base
int nvti_set_cvss_base(nvti_t *, const gchar *)
Set the CVSS base of an NVT.
Definition: nvti.c:1352
nvti_add_required_keys
int nvti_add_required_keys(nvti_t *, const gchar *)
Add a required key of a NVT.
Definition: nvti.c:1703
nvti_vtref_len
guint nvti_vtref_len(const nvti_t *)
Get the number of references of the NVT.
Definition: nvti.c:617
vtref_id
const gchar * vtref_id(const vtref_t *)
Get the id of a reference.
Definition: nvti.c:143
nvti_free
void nvti_free(nvti_t *)
Free memory of a nvti structure.
Definition: nvti.c:466
nvti_set_required_ports
int nvti_set_required_ports(nvti_t *, const gchar *)
Set the required ports of a NVT.
Definition: nvti.c:1472
nvti_modification_time
time_t nvti_modification_time(const nvti_t *)
Get the modification time.
Definition: nvti.c:604
nvtis_free
void nvtis_free(nvtis_t *)
Free a collection of NVT Infos.
Definition: nvti.c:1903
nvti_vtref
vtref_t * nvti_vtref(const nvti_t *, guint)
Get the n'th reference of the NVT.
Definition: nvti.c:632
nvtis_add
void nvtis_add(nvtis_t *, nvti_t *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:1916
nvti_required_udp_ports
gchar * nvti_required_udp_ports(const nvti_t *)
Get the required udp ports list.
Definition: nvti.c:914
nvti_qod
gchar * nvti_qod(const nvti_t *)
Get the QoD.
Definition: nvti.c:956
nvti_set_required_keys
int nvti_set_required_keys(nvti_t *, const gchar *)
Set the required keys of a NVT.
Definition: nvti.c:1400
nvti_add_tag
int nvti_add_tag(nvti_t *, const gchar *, const gchar *)
Add a tag to the NVT tags. The tag names "last_modification" and "creation_date" are treated special:...
Definition: nvti.c:1267
nvti_set_excluded_keys
int nvti_set_excluded_keys(nvti_t *, const gchar *)
Set the excluded keys of a NVT.
Definition: nvti.c:1448
nvti_set_timeout
int nvti_set_timeout(nvti_t *, const gint)
Set the timeout of a NVT Info.
Definition: nvti.c:1607
nvti_category
gint nvti_category(const nvti_t *)
Get the category for this NVT.
Definition: nvti.c:1025
nvti_add_required_ports
int nvti_add_required_ports(nvti_t *, const gchar *)
Add a required port of a NVT.
Definition: nvti.c:1799
nvtis_lookup
nvti_t * nvtis_lookup(nvtis_t *, const char *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:1933
nvti_excluded_keys
gchar * nvti_excluded_keys(const nvti_t *)
Get the excluded keys list.
Definition: nvti.c:886
nvti_set_qod
int nvti_set_qod(nvti_t *, const gchar *)
Set the QoD of a NVT.
Definition: nvti.c:1564
nvti_solution
gchar * nvti_solution(const nvti_t *)
Get the solution.
Definition: nvti.c:736
nvti_solution_type
gchar * nvti_solution_type(const nvti_t *)
Get the solution type.
Definition: nvti.c:750
nvti_add_vtref
int nvti_add_vtref(nvti_t *, vtref_t *)
Add a reference to the VT Info.
Definition: nvti.c:320
nvti_impact
gchar * nvti_impact(const nvti_t *)
Get the text about impact.
Definition: nvti.c:576
nvtpref_default
gchar * nvtpref_default(const nvtpref_t *)
Get the Default of a NVT Preference.
Definition: nvti.c:441
nvti_set_tag
int nvti_set_tag(nvti_t *, const gchar *)
Set the tags of a NVT.
Definition: nvti.c:1329
vtref_type
const gchar * vtref_type(const vtref_t *)
Get the type of a reference.
Definition: nvti.c:129
nvti_set_detection
int nvti_set_detection(nvti_t *, const gchar *)
Set the detection text of a NVT.
Definition: nvti.c:1519
nvti_mandatory_keys
gchar * nvti_mandatory_keys(const nvti_t *)
Get the mandatory keys list.
Definition: nvti.c:872
nvti_add_mandatory_keys
int nvti_add_mandatory_keys(nvti_t *, const gchar *)
Add a mandatory key of a NVT.
Definition: nvti.c:1735