Greenbone Vulnerability Management Libraries 21.4.4
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
35
37
38typedef struct osp_target osp_target_t;
39
41
43
47typedef enum
48{
58
62typedef enum
63{
72
73typedef struct
74{
75 const char *scan_id;
77
78typedef struct
79{
80 int start;
81 int end;
82 char *titles;
84
85typedef struct osp_param osp_param_t;
86
87/* OSP Connection handling */
88
90osp_connection_new (const char *, int, const char *, const char *,
91 const char *);
92
93void
95
96/* OSP commands */
97int
98osp_get_version (osp_connection_t *, char **, char **, char **, char **,
99 char **, char **);
100
101int
102osp_get_vts_version (osp_connection_t *, char **, char **error);
103
104int
106
107typedef struct
108{
109 char *filter;
112
117
118int
120
121int
122osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
123 const char *, char **);
124
125typedef struct
126{
127 GSList *targets;
128 GSList *vt_groups;
129 GSList *vts;
130 GHashTable *scanner_params;
131 const char *scan_id;
133
134int
136
137int
138osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
139
140int
141osp_get_scan_pop (osp_connection_t *, const char *, char **, int, int, char **);
142
145 char **);
146
147int
148osp_delete_scan (osp_connection_t *, const char *);
149
150int
151osp_stop_scan (osp_connection_t *, const char *, char **);
152
153int
154osp_get_scanner_details (osp_connection_t *, char **, GSList **);
155
156int
158 char **, char **);
159
160/* OSP scanner parameters handling */
161
163osp_param_new (void);
164
165const char *
166osp_param_id (const osp_param_t *);
167
168const char *
170
171const char *
173
174const char *
176
177const char *
179
180int
182
183void
185
186/* OSP credential handling */
187
189osp_credential_new (const char *, const char *, const char *);
190
191void
193
194const gchar *
196
197void
198osp_credential_set_auth_data (osp_credential_t *, const char *, const char *);
199
200/* OSP targets handling */
201
203osp_target_new (const char *, const char *, const char *, int, int, int);
204
205void
207
208void
210
211void
212osp_target_add_alive_test_methods (osp_target_t *, gboolean, gboolean, gboolean,
213 gboolean, gboolean);
214
215void
217
218/* OSP VT group handling */
219
221osp_vt_group_new (const char *);
222
223void
225
226/* OSP single VT handling */
227
229osp_vt_single_new (const char *);
230
231void
233
234void
235osp_vt_single_add_value (osp_vt_single_t *, const char *, const char *);
236
237#endif
void osp_target_free(osp_target_t *)
Free an OSP target, including all added credentials.
Definition: osp.c:1475
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
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 *)
Free a single OSP VT, including all preference values.
Definition: osp.c:1586
const char * osp_param_type_str(const osp_param_t *)
Get an OSP parameter in string format form its type.
Definition: osp.c:1149
void osp_target_add_alive_test_methods(osp_target_t *, gboolean, gboolean, gboolean, gboolean, gboolean)
Add alive test methods to OSP target.
Definition: osp.c:1498
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
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
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
const gchar * osp_credential_get_auth_data(osp_credential_t *, const char *)
Get authentication data from an OSP credential.
Definition: osp.c:1390
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
const char * osp_param_desc(const osp_param_t *)
Get an OSP parameter's description.
Definition: osp.c:1284
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
void osp_vt_single_add_value(osp_vt_single_t *, const char *, const char *)
Add a preference value to an OSP VT. This creates a copy of the name and value.
Definition: osp.c:1606
osp_vt_single_t * osp_vt_single_new(const char *)
Create a new single OSP VT.
Definition: osp.c:1568
osp_connection_t * osp_connection_new(const char *, int, const char *, 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
osp_param_t * osp_param_new(void)
Create a new OSP parameter.
Definition: osp.c:1241
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
osp_vt_group_t * osp_vt_group_new(const char *)
Create a new OSP VT group.
Definition: osp.c:1535
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
const char * osp_param_name(const osp_param_t *)
Get an OSP parameter's name.
Definition: osp.c:1269
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
void osp_target_set_finished_hosts(osp_target_t *, const char *)
Set the finished hosts of an OSP target.
Definition: osp.c:1463
osp_target_t * osp_target_new(const char *, const char *, const char *, int, int, int)
Create a new OSP target.
Definition: osp.c:1436
void osp_vt_group_free(osp_vt_group_t *)
Free a OSP VT group.
Definition: osp.c:1551
int osp_get_scan(osp_connection_t *, const char *, char **, int, char **)
Get a scan from an OSP server.
Definition: osp.c:701
const char * osp_param_id(const osp_param_t *)
Get an OSP parameter's id.
Definition: osp.c:1254
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 *)
Add a credential to an OSP target.
Definition: osp.c:1519
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