Greenbone Vulnerability Management Libraries 23.1.2
osp.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2014-2023 Greenbone AG
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
10
11#ifndef _GVM_OSP_OSP_H
12#define _GVM_OSP_OSP_H
13
15#include "../util/xmlutils.h"
16
17#include <glib.h> /* for GHashTable, GSList */
18
19/* Type definitions */
20
22
23typedef struct osp_target osp_target_t;
24
26
28
43
57
58typedef struct
59{
60 const char *scan_id;
62
63typedef struct
64{
65 int start;
66 int end;
67 char *titles;
69
70typedef struct osp_param osp_param_t;
71
72/* OSP Connection handling */
73
75osp_connection_new (const char *, int, const char *, const char *,
76 const char *);
77
78void
80
81/* OSP commands */
82int
83osp_check_feed (osp_connection_t *, int *, int *, char **, char **);
84
85int
86osp_get_version (osp_connection_t *, char **, char **, char **, char **,
87 char **, char **);
88
89int
90osp_get_vts_version (osp_connection_t *, char **, char **error);
91
92int
93osp_get_vts_feed_info (osp_connection_t *, char **, char **, char **, char **,
94 char **);
95
96int
98
99typedef struct
100{
101 char *filter;
104
109
110int
112
113int
115
116int
117osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
118 const char *, char **);
119
120typedef struct
121{
122 GSList *targets;
123 GSList *vt_groups;
124 GSList *vts;
125 GHashTable *scanner_params;
126 const char *scan_id;
128
129int
131
132int
133osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
134
135int
136osp_get_scan_pop (osp_connection_t *, const char *, char **, int, int, char **);
137
140 char **);
141
142int
143osp_delete_scan (osp_connection_t *, const char *);
144
145int
146osp_stop_scan (osp_connection_t *, const char *, char **);
147
148int
149osp_get_scanner_details (osp_connection_t *, char **, GSList **);
150
151int
153 char **, char **);
154
155/* OSP scanner parameters handling */
156
158osp_param_new (void);
159
160const char *
161osp_param_id (const osp_param_t *);
162
163const char *
165
166const char *
168
169const char *
171
172const char *
174
175int
177
178void
180
181/* OSP targets handling */
182
184osp_target_new (const char *, const char *, const char *, int, int, int);
185
186void
188
189void
191
192void
193osp_target_add_alive_test_methods (osp_target_t *, gboolean, gboolean, gboolean,
194 gboolean, gboolean);
195
196void
198
199/* OSP VT group handling */
200
202osp_vt_group_new (const char *);
203
204void
206
207/* OSP single VT handling */
208
210osp_vt_single_new (const char *);
211
212void
214
215void
216osp_vt_single_add_value (osp_vt_single_t *, const char *, const char *);
217
218#endif /* not _GVM_OSP_OSP_H */
Functions for handling scan credentials.
struct scan_credential scan_credential_t
Definition credentialutils.h:16
void osp_target_free(osp_target_t *)
Free an OSP target, including all added credentials.
Definition osp.c:1642
int osp_get_vts(osp_connection_t *, entity_t *)
Get all VTs from an OSP server.
Definition osp.c:607
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:743
int osp_stop_scan(osp_connection_t *, const char *, char **)
Stop a scan on an OSP server.
Definition osp.c:959
int osp_get_scanner_details(osp_connection_t *, char **, GSList **)
Get an OSP scanner's details.
Definition osp.c:1437
void osp_vt_single_free(osp_vt_single_t *)
Free a single OSP VT, including all preference values.
Definition osp.c:1754
void osp_target_add_credential(osp_target_t *, scan_credential_t *)
Add a credential to an OSP target.
Definition osp.c:1687
struct osp_connection osp_connection_t
Definition osp.h:21
const char * osp_param_type_str(const osp_param_t *)
Get an OSP parameter in string format form its type.
Definition osp.c:1401
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:543
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:1666
struct osp_target osp_target_t
Definition osp.h:23
void osp_connection_close(osp_connection_t *)
Close a connection to an OSP server.
Definition osp.c:279
static const osp_get_vts_opts_t osp_get_vts_opts_default
Sensible default values for osp_get_vts_opts_t.
Definition osp.h:108
struct osp_vt_group osp_vt_group_t
Definition osp.h:25
const char * osp_param_default(const osp_param_t *)
Get an OSP parameter's default value.
Definition osp.c:1551
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:809
int osp_get_version(osp_connection_t *, char **, char **, char **, char **, char **, char **)
Get the scanner version from an OSP server.
Definition osp.c:400
osp_scan_status_t
OSP scan status.
Definition osp.h:48
@ OSP_SCAN_STATUS_QUEUED
Definition osp.h:54
@ OSP_SCAN_STATUS_STOPPED
Definition osp.h:52
@ OSP_SCAN_STATUS_INTERRUPTED
Definition osp.h:55
@ OSP_SCAN_STATUS_FINISHED
Definition osp.h:53
@ OSP_SCAN_STATUS_RUNNING
Definition osp.h:51
@ OSP_SCAN_STATUS_ERROR
Definition osp.h:49
@ OSP_SCAN_STATUS_INIT
Definition osp.h:50
const char * osp_param_desc(const osp_param_t *)
Get an OSP parameter's description.
Definition osp.c:1536
struct osp_vt_single osp_vt_single_t
Definition osp.h:27
int osp_check_feed(osp_connection_t *, int *, int *, char **, char **)
Gets additional status info about the feed.
Definition osp.c:307
int osp_param_mandatory(const osp_param_t *)
Get an OSP parameter's mandatory value.
Definition osp.c:1566
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:1774
osp_vt_single_t * osp_vt_single_new(const char *)
Create a new single OSP VT.
Definition osp.c:1736
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:1038
int osp_get_vts_version(osp_connection_t *, char **, char **error)
Get the VTs version from an OSP server.
Definition osp.c:485
osp_param_t * osp_param_new(void)
Create a new OSP parameter.
Definition osp.c:1493
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:631
osp_vt_group_t * osp_vt_group_new(const char *)
Create a new OSP VT group.
Definition osp.c:1703
int osp_delete_scan(osp_connection_t *, const char *)
Delete a scan from an OSP server.
Definition osp.c:708
struct osp_param osp_param_t
Definition osp.h:70
const char * osp_param_name(const osp_param_t *)
Get an OSP parameter's name.
Definition osp.c:1521
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:880
osp_param_type_t
OSP parameter types.
Definition osp.h:33
@ OSP_PARAM_TYPE_BOOLEAN
Definition osp.h:38
@ OSP_PARAM_TYPE_STR
Definition osp.h:35
@ OSP_PARAM_TYPE_INT
Definition osp.h:34
@ OSP_PARAM_TYPE_SELECTION
Definition osp.h:40
@ OSP_PARAM_TYPE_PASSWORD
Definition osp.h:36
@ OSP_PARAM_TYPE_FILE
Definition osp.h:37
@ OSP_PARAM_TYPE_CRD_UP
Definition osp.h:41
@ OSP_PARAM_TYPE_OVALDEF_FILE
Definition osp.h:39
void osp_target_set_finished_hosts(osp_target_t *, const char *)
Set the finished hosts of an OSP target.
Definition osp.c:1630
osp_target_t * osp_target_new(const char *, const char *, const char *, int, int, int)
Create a new OSP target.
Definition osp.c:1603
void osp_vt_group_free(osp_vt_group_t *)
Free a OSP VT group.
Definition osp.c:1719
int osp_get_scan(osp_connection_t *, const char *, char **, int, char **)
Get a scan from an OSP server.
Definition osp.c:943
const char * osp_param_id(const osp_param_t *)
Get an OSP parameter's id.
Definition osp.c:1506
void osp_param_free(osp_param_t *)
Free an OSP parameter.
Definition osp.c:1579
int osp_get_vts_ext_str(osp_connection_t *, osp_get_vts_opts_t, gchar **)
Get filtered set of VTs from an OSP server.
Definition osp.c:670
int osp_start_scan_ext(osp_connection_t *, osp_start_scan_opts_t, char **)
Start an OSP scan against a target.
Definition osp.c:1246
Struct holding options for OSP connection.
Definition osp.c:36
Definition osp.h:64
int start
Definition osp.h:65
char * titles
Definition osp.h:67
int end
Definition osp.h:66
Definition osp.h:59
const char * scan_id
UUID of the scan which get the status from.
Definition osp.h:60
Definition osp.h:100
char * filter
the filter to apply for a vt sub-selection.
Definition osp.h:101
int version_only
if get only feed info or the vt collection
Definition osp.h:102
Struct holding options for OSP parameters.
Definition osp.c:47
Definition osp.h:121
GSList * targets
Target hosts to scan.
Definition osp.h:122
GSList * vts
Single VTs to use for the scan.
Definition osp.h:124
GSList * vt_groups
VT groups to use for the scan.
Definition osp.h:123
GHashTable * scanner_params
Table of scanner parameters.
Definition osp.h:125
const char * scan_id
UUID to set for scan, null otherwise.
Definition osp.h:126
Struct holding target information.
Definition osp.c:60
Struct holding vt_group information.
Definition osp.c:82
Struct holding vt_group information.
Definition osp.c:90
Headers for simple XML reader.
struct entity_s * entity_t
Definition xmlutils.h:58