Greenbone Vulnerability Management Libraries  21.4.2
osp.h
Go to the documentation of this file.
1 /* Copyright (C) 2014-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 
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_get_version (osp_connection_t *, char **, char **, char **, char **,
99  char **, char **);
100 
101 int
102 osp_get_vts_version (osp_connection_t *, char **, char **error);
103 
104 int
106 
107 typedef struct
108 {
109  char *filter;
112 
117 
118 int
120 
121 int
122 osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
123  const char *, char **);
124 
125 typedef struct
126 {
127  GSList *targets;
128  GSList *vt_groups;
129  GSList *vts;
130  GHashTable *scanner_params;
131  const char *scan_id;
133 
134 int
136 
137 int
138 osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
139 
140 int
141 osp_get_scan_pop (osp_connection_t *, const char *, char **, int, int, char **);
142 
145  char **);
146 
147 int
148 osp_delete_scan (osp_connection_t *, const char *);
149 
150 int
151 osp_stop_scan (osp_connection_t *, const char *, char **);
152 
153 int
154 osp_get_scanner_details (osp_connection_t *, char **, GSList **);
155 
156 int
158  char **, char **);
159 
160 /* OSP scanner parameters handling */
161 
162 osp_param_t *
163 osp_param_new (void);
164 
165 const char *
166 osp_param_id (const osp_param_t *);
167 
168 const char *
169 osp_param_name (const osp_param_t *);
170 
171 const char *
172 osp_param_desc (const osp_param_t *);
173 
174 const char *
176 
177 const char *
179 
180 int
182 
183 void
185 
186 /* OSP credential handling */
187 
189 osp_credential_new (const char *, const char *, const char *);
190 
191 void
193 
194 const gchar *
196 
197 void
198 osp_credential_set_auth_data (osp_credential_t *, const char *, const char *);
199 
200 /* OSP targets handling */
201 
202 osp_target_t *
203 osp_target_new (const char *, const char *, const char *, int, int, int);
204 
205 void
207 
208 void
210 
211 void
212 osp_target_add_alive_test_methods (osp_target_t *, gboolean, gboolean, gboolean,
213  gboolean, gboolean);
214 
215 void
217 
218 /* OSP VT group handling */
219 
221 osp_vt_group_new (const char *);
222 
223 void
225 
226 /* OSP single VT handling */
227 
229 osp_vt_single_new (const char *);
230 
231 void
233 
234 void
235 osp_vt_single_add_value (osp_vt_single_t *, const char *, const char *);
236 
237 #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:404
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:501
const char * osp_param_name(const osp_param_t *)
Get an OSP parameter's name.
Definition: osp.c:1269
const char * osp_param_id(const osp_param_t *)
Get an OSP parameter's id.
Definition: osp.c:1254
int osp_stop_scan(osp_connection_t *, const char *, char **)
Stop a scan on an OSP server.
Definition: osp.c:717
int osp_get_scanner_details(osp_connection_t *, char **, GSList **)
Get an OSP scanner's details.
Definition: osp.c:1185
void osp_vt_single_free(osp_vt_single_t *)
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:238
static const osp_get_vts_opts_t osp_get_vts_opts_default
Sensible default values for osp_get_vts_opts_t.
Definition: osp.h:116
const char * osp_param_default(const osp_param_t *)
Get an OSP parameter's default value.
Definition: osp.c:1299
const char * osp_param_type_str(const osp_param_t *)
Get an OSP parameter in string format form its type.
Definition: osp.c:1149
const char * osp_param_desc(const osp_param_t *)
Get an OSP parameter's description.
Definition: osp.c:1284
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:567
osp_credential_t * osp_credential_new(const char *, const char *, const char *)
Allocate and initialize a new OSP credential.
Definition: osp.c:1348
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:265
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:1405
int osp_param_mandatory(const osp_param_t *)
Get an OSP parameter's mandatory value.
Definition: osp.c:1314
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:796
int osp_get_vts_version(osp_connection_t *, char **, char **error)
Get the VTs version from an OSP server.
Definition: osp.c:350
const gchar * osp_credential_get_auth_data(osp_credential_t *, const char *)
Get authentication data from an OSP credential.
Definition: osp.c:1390
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:428
int osp_delete_scan(osp_connection_t *, const char *)
Delete a scan from an OSP server.
Definition: osp.c:466
void osp_credential_free(osp_credential_t *)
Free an OSP credential.
Definition: osp.c:1369
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:638
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:1241
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:701
void osp_param_free(osp_param_t *)
Free an OSP parameter.
Definition: osp.c:1327
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:994
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:108
char * filter
the filter to apply for a vt sub-selection.
Definition: osp.h:109
int version_only
if get only feed info or the vt collection
Definition: osp.h:110
Struct holding options for OSP parameters.
Definition: osp.c:61
Definition: osp.h:126
GSList * targets
Target hosts to scan.
Definition: osp.h:127
GSList * vts
Single VTs to use for the scan.
Definition: osp.h:129
GSList * vt_groups
VT groups to use for the scan.
Definition: osp.h:128
GHashTable * scanner_params
Table of scanner parameters.
Definition: osp.h:130
const char * scan_id
UUID to set for scan, null otherwise.
Definition: osp.h:131
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