Greenbone Vulnerability Management Libraries 22.5.1
osp.h
Go to the documentation of this file.
1/* Copyright (C) 2014-2022 Greenbone AG
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_check_feed (osp_connection_t *, int *, int *, char **, char **);
99
100int
101osp_get_version (osp_connection_t *, char **, char **, char **, char **,
102 char **, char **);
103
104int
105osp_get_vts_version (osp_connection_t *, char **, char **error);
106
107int
108osp_get_vts_feed_info (osp_connection_t *, char **, char **, char **, char **,
109 char **);
110
111int
113
114typedef struct
115{
116 char *filter;
119
124
125int
127
128int
129osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
130 const char *, char **);
131
132typedef struct
133{
134 GSList *targets;
135 GSList *vt_groups;
136 GSList *vts;
137 GHashTable *scanner_params;
138 const char *scan_id;
140
141int
143
144int
145osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
146
147int
148osp_get_scan_pop (osp_connection_t *, const char *, char **, int, int, char **);
149
152 char **);
153
154int
155osp_delete_scan (osp_connection_t *, const char *);
156
157int
158osp_stop_scan (osp_connection_t *, const char *, char **);
159
160int
161osp_get_scanner_details (osp_connection_t *, char **, GSList **);
162
163int
165 char **, char **);
166
167/* OSP scanner parameters handling */
168
170osp_param_new (void);
171
172const char *
173osp_param_id (const osp_param_t *);
174
175const char *
177
178const char *
180
181const char *
183
184const char *
186
187int
189
190void
192
193/* OSP credential handling */
194
196osp_credential_new (const char *, const char *, const char *);
197
198void
200
201const gchar *
203
204void
205osp_credential_set_auth_data (osp_credential_t *, const char *, const char *);
206
207/* OSP targets handling */
208
210osp_target_new (const char *, const char *, const char *, int, int, int);
211
212void
214
215void
217
218void
219osp_target_add_alive_test_methods (osp_target_t *, gboolean, gboolean, gboolean,
220 gboolean, gboolean);
221
222void
224
225/* OSP VT group handling */
226
228osp_vt_group_new (const char *);
229
230void
232
233/* OSP single VT handling */
234
236osp_vt_single_new (const char *);
237
238void
240
241void
242osp_vt_single_add_value (osp_vt_single_t *, const char *, const char *);
243
244#endif
void osp_target_free(osp_target_t *)
Free an OSP target, including all added credentials.
Definition: osp.c:1645
int osp_get_vts(osp_connection_t *, entity_t *)
Get all VTs from an OSP server.
Definition: osp.c:574
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:671
int osp_stop_scan(osp_connection_t *, const char *, char **)
Stop a scan on an OSP server.
Definition: osp.c:887
int osp_get_scanner_details(osp_connection_t *, char **, GSList **)
Get an OSP scanner's details.
Definition: osp.c:1355
void osp_vt_single_free(osp_vt_single_t *)
Free a single OSP VT, including all preference values.
Definition: osp.c:1756
const char * osp_param_type_str(const osp_param_t *)
Get an OSP parameter in string format form its type.
Definition: osp.c:1319
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:510
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:1668
void osp_connection_close(osp_connection_t *)
Close a connection to an OSP server.
Definition: osp.c:246
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:1469
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:737
osp_credential_t * osp_credential_new(const char *, const char *, const char *)
Allocate and initialize a new OSP credential.
Definition: osp.c:1518
int osp_get_version(osp_connection_t *, char **, char **, char **, char **, char **, char **)
Get the scanner version from an OSP server.
Definition: osp.c:367
const gchar * osp_credential_get_auth_data(osp_credential_t *, const char *)
Get authentication data from an OSP credential.
Definition: osp.c:1560
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:1454
void osp_credential_set_auth_data(osp_credential_t *, const char *, const char *)
Get authentication data from an OSP credential.
Definition: osp.c:1575
int osp_check_feed(osp_connection_t *, int *, int *, char **, char **)
Gets additional status info about the feed.
Definition: osp.c:274
int osp_param_mandatory(const osp_param_t *)
Get an OSP parameter's mandatory value.
Definition: osp.c:1484
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:1776
osp_vt_single_t * osp_vt_single_new(const char *)
Create a new single OSP VT.
Definition: osp.c:1738
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:966
int osp_get_vts_version(osp_connection_t *, char **, char **error)
Get the VTs version from an OSP server.
Definition: osp.c:452
osp_param_t * osp_param_new(void)
Create a new OSP parameter.
Definition: osp.c:1411
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:598
osp_vt_group_t * osp_vt_group_new(const char *)
Create a new OSP VT group.
Definition: osp.c:1705
int osp_delete_scan(osp_connection_t *, const char *)
Delete a scan from an OSP server.
Definition: osp.c:636
void osp_credential_free(osp_credential_t *)
Free an OSP credential.
Definition: osp.c:1539
const char * osp_param_name(const osp_param_t *)
Get an OSP parameter's name.
Definition: osp.c:1439
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:808
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:1633
osp_target_t * osp_target_new(const char *, const char *, const char *, int, int, int)
Create a new OSP target.
Definition: osp.c:1606
void osp_vt_group_free(osp_vt_group_t *)
Free a OSP VT group.
Definition: osp.c:1721
int osp_get_scan(osp_connection_t *, const char *, char **, int, char **)
Get a scan from an OSP server.
Definition: osp.c:871
const char * osp_param_id(const osp_param_t *)
Get an OSP parameter's id.
Definition: osp.c:1424
void osp_param_free(osp_param_t *)
Free an OSP parameter.
Definition: osp.c:1497
void osp_target_add_credential(osp_target_t *, osp_credential_t *)
Add a credential to an OSP target.
Definition: osp.c:1689
int osp_start_scan_ext(osp_connection_t *, osp_start_scan_opts_t, char **)
Start an OSP scan against a target.
Definition: osp.c:1164
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