Greenbone Vulnerability Management Libraries  11.0.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
50 nvtpref_id (const nvtpref_t *);
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_tag (const nvti_t *);
109 gchar *
110 nvti_cvss_base (const nvti_t *);
111 gchar *
112 nvti_dependencies (const nvti_t *);
113 gchar *
114 nvti_required_keys (const nvti_t *);
115 gchar *
116 nvti_mandatory_keys (const nvti_t *);
117 gchar *
118 nvti_excluded_keys (const nvti_t *);
119 gchar *
120 nvti_required_ports (const nvti_t *);
121 gchar *
123 gchar *
124 nvti_detection (const nvti_t *);
125 gchar *
126 nvti_qod_type (const nvti_t *);
127 gint
128 nvti_timeout (const nvti_t *);
129 gint
130 nvti_category (const nvti_t *);
131 gchar *
132 nvti_family (const nvti_t *);
133 guint
134 nvti_pref_len (const nvti_t *);
135 const nvtpref_t *
136 nvti_pref (const nvti_t *, guint);
137 
138 int
139 nvti_set_oid (nvti_t *, const gchar *);
140 int
141 nvti_set_name (nvti_t *, const gchar *);
142 int
143 nvti_set_summary (nvti_t *, const gchar *);
144 int
145 nvti_set_insight (nvti_t *, const gchar *);
146 int
147 nvti_set_affected (nvti_t *, const gchar *);
148 int
149 nvti_set_impact (nvti_t *, const gchar *);
150 int
151 nvti_set_creation_time (nvti_t *, const time_t);
152 int
153 nvti_set_modification_time (nvti_t *, const time_t);
154 int
155 nvti_set_solution (nvti_t *, const gchar *);
156 int
157 nvti_set_solution_type (nvti_t *, const gchar *);
158 int
159 nvti_add_tag (nvti_t *, const gchar *, const gchar *);
160 int
161 nvti_set_tag (nvti_t *, const gchar *);
162 int
163 nvti_set_cvss_base (nvti_t *, const gchar *);
164 int
165 nvti_set_dependencies (nvti_t *, const gchar *);
166 int
167 nvti_set_required_keys (nvti_t *, const gchar *);
168 int
169 nvti_set_mandatory_keys (nvti_t *, const gchar *);
170 int
171 nvti_set_excluded_keys (nvti_t *, const gchar *);
172 int
173 nvti_set_required_ports (nvti_t *, const gchar *);
174 int
175 nvti_set_required_udp_ports (nvti_t *, const gchar *);
176 int
177 nvti_set_detection (nvti_t *, const gchar *);
178 int
179 nvti_set_qod_type (nvti_t *, const gchar *);
180 int
181 nvti_set_timeout (nvti_t *, const gint);
182 int
183 nvti_set_category (nvti_t *, const gint);
184 int
185 nvti_set_family (nvti_t *, const gchar *);
186 
187 int
188 nvti_add_refs (nvti_t *, const gchar *, const gchar *, const gchar *);
189 int
190 nvti_add_required_keys (nvti_t *, const gchar *);
191 int
192 nvti_add_mandatory_keys (nvti_t *, const gchar *);
193 int
194 nvti_add_excluded_keys (nvti_t *, const gchar *);
195 int
196 nvti_add_required_ports (nvti_t *, const gchar *);
197 int
198 nvti_add_required_udp_ports (nvti_t *, const gchar *);
199 int
201 
202 /* Collections of NVT Infos. */
203 
207 typedef GHashTable nvtis_t;
208 
209 nvtis_t *
210 nvtis_new (void);
211 
212 void
213 nvtis_free (nvtis_t *);
214 
215 void
216 nvtis_add (nvtis_t *, nvti_t *);
217 
218 nvti_t *
219 nvtis_lookup (nvtis_t *, const char *);
220 
221 #endif /* not _NVTI_H */
nvti_new
nvti_t * nvti_new(void)
Create a new (empty) nvti structure.
Definition: nvti.c:454
nvtis_t
GHashTable nvtis_t
A collection of information records corresponding to NVTs.
Definition: nvti.h:207
nvti_set_affected
int nvti_set_affected(nvti_t *, const gchar *)
Set the affected text of a NVT.
Definition: nvti.c:1055
nvti_set_impact
int nvti_set_impact(nvti_t *, const gchar *)
Set the impact text of a NVT.
Definition: nvti.c:1076
nvti_set_family
int nvti_set_family(nvti_t *, const gchar *)
Set the family of a NVT.
Definition: nvti.c:1492
nvti_oid
gchar * nvti_oid(const nvti_t *)
Get the OID string.
Definition: nvti.c:503
nvtpref_id
int nvtpref_id(const nvtpref_t *)
Get the ID of a NVT Preference.
Definition: nvti.c:398
vtref
The structure for a cross reference of a VT.
Definition: nvti.c:68
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:1347
nvti_detection
gchar * nvti_detection(const nvti_t *)
Get the text about detection.
Definition: nvti.c:873
nvti_set_qod_type
int nvti_set_qod_type(nvti_t *, const gchar *)
Set the QoD type of a NVT.
Definition: nvti.c:1468
nvtis_new
nvtis_t * nvtis_new(void)
Make a collection of NVT Infos.
Definition: nvti.c:1797
nvti_set_dependencies
int nvti_set_dependencies(nvti_t *, const gchar *)
Set the dependencies of a NVT.
Definition: nvti.c:1297
nvti_add_pref
int nvti_add_pref(nvti_t *, nvtpref_t *)
Add a preference to the NVT Info.
Definition: nvti.c:1769
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:1422
nvtpref_free
void nvtpref_free(nvtpref_t *)
Free memory of a nvtpref structure.
Definition: nvti.c:378
nvti_set_summary
int nvti_set_summary(nvti_t *, const gchar *)
Set the summary of a NVT.
Definition: nvti.c:1013
nvti_set_solution
int nvti_set_solution(nvti_t *, const gchar *)
Set the solution of a NVT.
Definition: nvti.c:1135
nvti_qod_type
gchar * nvti_qod_type(const nvti_t *)
Get the QoD type.
Definition: nvti.c:887
nvti_set_modification_time
int nvti_set_modification_time(nvti_t *, const time_t)
Set the modification time of a NVT.
Definition: nvti.c:1116
nvti_pref_len
guint nvti_pref_len(const nvti_t *)
Get the number of preferences of the NVT.
Definition: nvti.c:914
nvti_tag
gchar * nvti_tag(const nvti_t *)
Get the tags.
Definition: nvti.c:761
nvti_summary
gchar * nvti_summary(const nvti_t *)
Get the summary.
Definition: nvti.c:531
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:545
nvti_affected
gchar * nvti_affected(const nvti_t *)
Get the text about affected systems.
Definition: nvti.c:559
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:943
nvti_set_name
int nvti_set_name(nvti_t *, const gchar *)
Set the name of a NVT.
Definition: nvti.c:992
nvti_dependencies
gchar * nvti_dependencies(const nvti_t *)
Get the dependencies list.
Definition: nvti.c:789
nvti_family
gchar * nvti_family(const nvti_t *)
Get the family name.
Definition: nvti.c:901
nvti_pref
const nvtpref_t * nvti_pref(const nvti_t *, guint)
Get the n'th preferences of the NVT.
Definition: nvti.c:929
nvtpref
The structure for a preference of a NVT.
Definition: nvti.c:333
nvti_add_excluded_keys
int nvti_add_excluded_keys(nvti_t *, const gchar *)
Add a excluded key of a NVT.
Definition: nvti.c:1673
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:971
nvti_set_category
int nvti_set_category(nvti_t *, const gint)
Set the category type of a NVT Info.
Definition: nvti.c:1532
nvti_name
gchar * nvti_name(const nvti_t *)
Get the name.
Definition: nvti.c:517
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:1557
nvtpref_type
gchar * nvtpref_type(const nvtpref_t *)
Get the Type of a NVT Preference.
Definition: nvti.c:426
nvti_creation_time
time_t nvti_creation_time(const nvti_t *)
Get the creation time.
Definition: nvti.c:587
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:412
nvti_cvss_base
gchar * nvti_cvss_base(const nvti_t *)
Get the CVSS base.
Definition: nvti.c:775
nvti_required_ports
gchar * nvti_required_ports(const nvti_t *)
Get the required ports list.
Definition: nvti.c:845
nvti_required_keys
gchar * nvti_required_keys(const nvti_t *)
Get the required keys list.
Definition: nvti.c:803
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:1737
nvti_set_solution_type
int nvti_set_solution_type(nvti_t *, const gchar *)
Set the solution type of a NVT.
Definition: nvti.c:1157
nvti_set_creation_time
int nvti_set_creation_time(nvti_t *, const time_t)
Set the creation time of a NVT.
Definition: nvti.c:1097
nvtpref_new
nvtpref_t * nvtpref_new(int, gchar *, gchar *, gchar *)
Create a new nvtpref structure filled with the given values.
Definition: nvti.c:357
nvti_set_insight
int nvti_set_insight(nvti_t *, const gchar *)
Set the insight text of a NVT.
Definition: nvti.c:1034
nvti_set_cvss_base
int nvti_set_cvss_base(nvti_t *, const gchar *)
Set the CVSS base of an NVT.
Definition: nvti.c:1272
nvti_add_required_keys
int nvti_add_required_keys(nvti_t *, const gchar *)
Add a required key of a NVT.
Definition: nvti.c:1609
nvti_vtref_len
guint nvti_vtref_len(const nvti_t *)
Get the number of references of the NVT.
Definition: nvti.c:614
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:465
nvti_set_required_ports
int nvti_set_required_ports(nvti_t *, const gchar *)
Set the required ports of a NVT.
Definition: nvti.c:1397
nvti_modification_time
time_t nvti_modification_time(const nvti_t *)
Get the modification time.
Definition: nvti.c:601
nvtis_free
void nvtis_free(nvtis_t *)
Free a collection of NVT Infos.
Definition: nvti.c:1809
nvti_vtref
vtref_t * nvti_vtref(const nvti_t *, guint)
Get the n'th reference of the NVT.
Definition: nvti.c:629
nvtis_add
void nvtis_add(nvtis_t *, nvti_t *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:1822
nvti_required_udp_ports
gchar * nvti_required_udp_ports(const nvti_t *)
Get the required udp ports list.
Definition: nvti.c:859
nvti_set_required_keys
int nvti_set_required_keys(nvti_t *, const gchar *)
Set the required keys of a NVT.
Definition: nvti.c:1322
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:1185
nvti_set_excluded_keys
int nvti_set_excluded_keys(nvti_t *, const gchar *)
Set the excluded keys of a NVT.
Definition: nvti.c:1372
nvti_set_timeout
int nvti_set_timeout(nvti_t *, const gint)
Set the timeout of a NVT Info.
Definition: nvti.c:1513
nvti_category
gint nvti_category(const nvti_t *)
Get the category for this NVT.
Definition: nvti.c:956
nvti_add_required_ports
int nvti_add_required_ports(nvti_t *, const gchar *)
Add a required port of a NVT.
Definition: nvti.c:1705
nvtis_lookup
nvti_t * nvtis_lookup(nvtis_t *, const char *)
Add an NVT Info to a collection of NVT Infos.
Definition: nvti.c:1837
nvti_excluded_keys
gchar * nvti_excluded_keys(const nvti_t *)
Get the excluded keys list.
Definition: nvti.c:831
nvti_solution
gchar * nvti_solution(const nvti_t *)
Get the solution.
Definition: nvti.c:733
nvti_solution_type
gchar * nvti_solution_type(const nvti_t *)
Get the solution type.
Definition: nvti.c:747
nvti_add_vtref
int nvti_add_vtref(nvti_t *, vtref_t *)
Add a reference to the VT Info.
Definition: nvti.c:319
nvti_impact
gchar * nvti_impact(const nvti_t *)
Get the text about impact.
Definition: nvti.c:573
nvtpref_default
gchar * nvtpref_default(const nvtpref_t *)
Get the Default of a NVT Preference.
Definition: nvti.c:440
nvti_set_tag
int nvti_set_tag(nvti_t *, const gchar *)
Set the tags of a NVT.
Definition: nvti.c:1248
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:1446
nvti_mandatory_keys
gchar * nvti_mandatory_keys(const nvti_t *)
Get the mandatory keys list.
Definition: nvti.c:817
nvti_add_mandatory_keys
int nvti_add_mandatory_keys(nvti_t *, const gchar *)
Add a mandatory key of a NVT.
Definition: nvti.c:1641