Greenbone Vulnerability Management Libraries  22.4.1
osp.h
Go to the documentation of this file.
1 /* Copyright (C) 2014-2022 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 
25 #ifndef _GVM_OSP_H
26 #define _GVM_OSP_H
27 
28 #include "../util/xmlutils.h"
29 
30 #include <glib.h> /* for GHashTable, GSList */
31 
32 /* Type definitions */
33 
34 typedef struct osp_connection osp_connection_t;
35 
36 typedef struct osp_credential osp_credential_t;
37 
38 typedef struct osp_target osp_target_t;
39 
40 typedef struct osp_vt_group osp_vt_group_t;
41 
42 typedef struct osp_vt_single osp_vt_single_t;
43 
47 typedef enum
48 {
58 
62 typedef enum
63 {
72 
73 typedef struct
74 {
75  const char *scan_id;
77 
78 typedef struct
79 {
80  int start;
81  int end;
82  char *titles;
84 
85 typedef struct osp_param osp_param_t;
86 
87 /* OSP Connection handling */
88 
90 osp_connection_new (const char *, int, const char *, const char *,
91  const char *);
92 
93 void
95 
96 /* OSP commands */
97 int
98 osp_check_feed (osp_connection_t *, int *, int *, char **, char **);
99 
100 int
101 osp_get_version (osp_connection_t *, char **, char **, char **, char **,
102  char **, char **);
103 
104 int
105 osp_get_vts_version (osp_connection_t *, char **, char **error);
106 
107 int
108 osp_get_vts_feed_info (osp_connection_t *, char **, char **, char **, char **,
109  char **);
110 
111 int
113 
114 typedef struct
115 {
116  char *filter;
119 
124 
125 int
127 
128 int
129 osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
130  const char *, char **);
131 
132 typedef struct
133 {
134  GSList *targets;
135  GSList *vt_groups;
136  GSList *vts;
137  GHashTable *scanner_params;
138  const char *scan_id;
140 
141 int
143 
144 int
145 osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
146 
147 int
148 osp_get_scan_pop (osp_connection_t *, const char *, char **, int, int, char **);
149 
152  char **);
153 
154 int
155 osp_delete_scan (osp_connection_t *, const char *);
156 
157 int
158 osp_stop_scan (osp_connection_t *, const char *, char **);
159 
160 int
161 osp_get_scanner_details (osp_connection_t *, char **, GSList **);
162 
163 int
165  char **, char **);
166 
167 /* OSP scanner parameters handling */
168 
169 osp_param_t *
170 osp_param_new (void);
171 
172 const char *
173 osp_param_id (const osp_param_t *);
174 
175 const char *
176 osp_param_name (const osp_param_t *);
177 
178 const char *
179 osp_param_desc (const osp_param_t *);
180 
181 const char *
183 
184 const char *
186 
187 int
189 
190 void
192 
193 /* OSP credential handling */
194 
196 osp_credential_new (const char *, const char *, const char *);
197 
198 void
200 
201 const gchar *
203 
204 void
205 osp_credential_set_auth_data (osp_credential_t *, const char *, const char *);
206 
207 /* OSP targets handling */
208 
209 osp_target_t *
210 osp_target_new (const char *, const char *, const char *, int, int, int);
211 
212 void
214 
215 void
217 
218 void
219 osp_target_add_alive_test_methods (osp_target_t *, gboolean, gboolean, gboolean,
220  gboolean, gboolean);
221 
222 void
224 
225 /* OSP VT group handling */
226 
228 osp_vt_group_new (const char *);
229 
230 void
232 
233 /* OSP single VT handling */
234 
236 osp_vt_single_new (const char *);
237 
238 void
240 
241 void
242 osp_vt_single_add_value (osp_vt_single_t *, const char *, const char *);
243 
244 #endif
void osp_target_free(osp_target_t *)
osp_vt_single_t * osp_vt_single_new(const char *)
int osp_get_vts(osp_connection_t *, entity_t *)
Get all VTs from an OSP server.
Definition: osp.c:567
int osp_get_performance_ext(osp_connection_t *, osp_get_performance_opts_t, char **, char **)
Get performance graphics from an OSP server.
Definition: osp.c:664
const char * osp_param_name(const osp_param_t *)
Get an OSP parameter's name.
Definition: osp.c:1432
const char * osp_param_id(const osp_param_t *)
Get an OSP parameter's id.
Definition: osp.c:1417
int osp_stop_scan(osp_connection_t *, const char *, char **)
Stop a scan on an OSP server.
Definition: osp.c:880
int osp_get_scanner_details(osp_connection_t *, char **, GSList **)
Get an OSP scanner's details.
Definition: osp.c:1348
void osp_vt_single_free(osp_vt_single_t *)
int osp_get_vts_feed_info(osp_connection_t *, char **, char **, char **, char **, char **)
Get the VTs version as well as other feed info from an OSP server.
Definition: osp.c:503
void osp_target_add_alive_test_methods(osp_target_t *, gboolean, gboolean, gboolean, gboolean, gboolean)
void osp_connection_close(osp_connection_t *)
Close a connection to an OSP server.
Definition: osp.c:239
static const osp_get_vts_opts_t osp_get_vts_opts_default
Sensible default values for osp_get_vts_opts_t.
Definition: osp.h:123
const char * osp_param_default(const osp_param_t *)
Get an OSP parameter's default value.
Definition: osp.c:1462
const char * osp_param_type_str(const osp_param_t *)
Get an OSP parameter in string format form its type.
Definition: osp.c:1312
const char * osp_param_desc(const osp_param_t *)
Get an OSP parameter's description.
Definition: osp.c:1447
osp_scan_status_t osp_get_scan_status_ext(osp_connection_t *, osp_get_scan_status_opts_t, char **)
Get a scan status from an OSP server.
Definition: osp.c:730
osp_credential_t * osp_credential_new(const char *, const char *, const char *)
Allocate and initialize a new OSP credential.
Definition: osp.c:1511
osp_target_t * osp_target_new(const char *, const char *, const char *, int, int, int)
int osp_get_version(osp_connection_t *, char **, char **, char **, char **, char **, char **)
Get the scanner version from an OSP server.
Definition: osp.c:360
osp_scan_status_t
OSP scan status.
Definition: osp.h:63
@ OSP_SCAN_STATUS_QUEUED
Definition: osp.h:69
@ OSP_SCAN_STATUS_STOPPED
Definition: osp.h:67
@ OSP_SCAN_STATUS_INTERRUPTED
Definition: osp.h:70
@ OSP_SCAN_STATUS_FINISHED
Definition: osp.h:68
@ OSP_SCAN_STATUS_RUNNING
Definition: osp.h:66
@ OSP_SCAN_STATUS_ERROR
Definition: osp.h:64
@ OSP_SCAN_STATUS_INIT
Definition: osp.h:65
void osp_credential_set_auth_data(osp_credential_t *, const char *, const char *)
Get authentication data from an OSP credential.
Definition: osp.c:1568
int osp_check_feed(osp_connection_t *, int *, int *, char **, char **)
Gets additional status info about the feed.
Definition: osp.c:267
int osp_param_mandatory(const osp_param_t *)
Get an OSP parameter's mandatory value.
Definition: osp.c:1477
osp_vt_group_t * osp_vt_group_new(const char *)
void osp_vt_single_add_value(osp_vt_single_t *, const char *, const char *)
int osp_start_scan(osp_connection_t *, const char *, const char *, GHashTable *, const char *, char **)
Start an OSP scan against a target.
Definition: osp.c:959
int osp_get_vts_version(osp_connection_t *, char **, char **error)
Get the VTs version from an OSP server.
Definition: osp.c:445
const gchar * osp_credential_get_auth_data(osp_credential_t *, const char *)
Get authentication data from an OSP credential.
Definition: osp.c:1553
osp_connection_t * osp_connection_new(const char *, int, const char *, const char *, const char *)
int osp_get_vts_ext(osp_connection_t *, osp_get_vts_opts_t, entity_t *)
Get filtered set of VTs from an OSP server.
Definition: osp.c:591
int osp_delete_scan(osp_connection_t *, const char *)
Delete a scan from an OSP server.
Definition: osp.c:629
void osp_credential_free(osp_credential_t *)
Free an OSP credential.
Definition: osp.c:1532
int osp_get_scan_pop(osp_connection_t *, const char *, char **, int, int, char **)
Get a scan from an OSP server, optionally removing the results.
Definition: osp.c:801
osp_param_type_t
OSP parameter types.
Definition: osp.h:48
@ OSP_PARAM_TYPE_BOOLEAN
Definition: osp.h:53
@ OSP_PARAM_TYPE_STR
Definition: osp.h:50
@ OSP_PARAM_TYPE_INT
Definition: osp.h:49
@ OSP_PARAM_TYPE_SELECTION
Definition: osp.h:55
@ OSP_PARAM_TYPE_PASSWORD
Definition: osp.h:51
@ OSP_PARAM_TYPE_FILE
Definition: osp.h:52
@ OSP_PARAM_TYPE_CRD_UP
Definition: osp.h:56
@ OSP_PARAM_TYPE_OVALDEF_FILE
Definition: osp.h:54
osp_param_t * osp_param_new(void)
Create a new OSP parameter.
Definition: osp.c:1404
void osp_target_set_finished_hosts(osp_target_t *, const char *)
void osp_vt_group_free(osp_vt_group_t *)
int osp_get_scan(osp_connection_t *, const char *, char **, int, char **)
Get a scan from an OSP server.
Definition: osp.c:864
void osp_param_free(osp_param_t *)
Free an OSP parameter.
Definition: osp.c:1490
void osp_target_add_credential(osp_target_t *, osp_credential_t *)
int osp_start_scan_ext(osp_connection_t *, osp_start_scan_opts_t, char **)
Start an OSP scan against a target.
Definition: osp.c:1157
XML element.
Definition: xmlutils.h:66
Struct holding options for OSP connection.
Definition: osp.c:50
Struct credential information for OSP.
Definition: osp.c:74
Definition: osp.h:79
int start
Definition: osp.h:80
char * titles
Definition: osp.h:82
int end
Definition: osp.h:81
Definition: osp.h:74
const char * scan_id
UUID of the scan which get the status from.
Definition: osp.h:75
Definition: osp.h:115
char * filter
the filter to apply for a vt sub-selection.
Definition: osp.h:116
int version_only
if get only feed info or the vt collection
Definition: osp.h:117
Struct holding options for OSP parameters.
Definition: osp.c:61
Definition: osp.h:133
GSList * targets
Target hosts to scan.
Definition: osp.h:134
GSList * vts
Single VTs to use for the scan.
Definition: osp.h:136
GSList * vt_groups
VT groups to use for the scan.
Definition: osp.h:135
GHashTable * scanner_params
Table of scanner parameters.
Definition: osp.h:137
const char * scan_id
UUID to set for scan, null otherwise.
Definition: osp.h:138
Struct holding target information.
Definition: osp.c:85
Struct holding vt_group information.
Definition: osp.c:107
Struct holding vt_group information.
Definition: osp.c:115