Greenbone Vulnerability Management Libraries 22.8.0
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
11#ifndef _GVM_OSP_H
12#define _GVM_OSP_H
13
14#include "../util/xmlutils.h"
15
16#include <glib.h> /* for GHashTable, GSList */
17
18/* Type definitions */
19
21
23
24typedef struct osp_target osp_target_t;
25
27
29
44
58
59typedef struct
60{
61 const char *scan_id;
63
64typedef struct
65{
66 int start;
67 int end;
68 char *titles;
70
71typedef struct osp_param osp_param_t;
72
73/* OSP Connection handling */
74
76osp_connection_new (const char *, int, const char *, const char *,
77 const char *);
78
79void
81
82/* OSP commands */
83int
84osp_check_feed (osp_connection_t *, int *, int *, char **, char **);
85
86int
87osp_get_version (osp_connection_t *, char **, char **, char **, char **,
88 char **, char **);
89
90int
91osp_get_vts_version (osp_connection_t *, char **, char **error);
92
93int
94osp_get_vts_feed_info (osp_connection_t *, char **, char **, char **, char **,
95 char **);
96
97int
99
100typedef struct
101{
102 char *filter;
105
110
111int
113
114int
116
117int
118osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
119 const char *, char **);
120
121typedef struct
122{
123 GSList *targets;
124 GSList *vt_groups;
125 GSList *vts;
126 GHashTable *scanner_params;
127 const char *scan_id;
129
130int
132
133int
134osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
135
136int
137osp_get_scan_pop (osp_connection_t *, const char *, char **, int, int, char **);
138
141 char **);
142
143int
144osp_delete_scan (osp_connection_t *, const char *);
145
146int
147osp_stop_scan (osp_connection_t *, const char *, char **);
148
149int
150osp_get_scanner_details (osp_connection_t *, char **, GSList **);
151
152int
154 char **, char **);
155
156/* OSP scanner parameters handling */
157
159osp_param_new (void);
160
161const char *
162osp_param_id (const osp_param_t *);
163
164const char *
166
167const char *
169
170const char *
172
173const char *
175
176int
178
179void
181
182/* OSP credential handling */
183
185osp_credential_new (const char *, const char *, const char *);
186
187void
189
190const gchar *
192
193void
194osp_credential_set_auth_data (osp_credential_t *, const char *, const char *);
195
196/* OSP targets handling */
197
199osp_target_new (const char *, const char *, const char *, int, int, int);
200
201void
203
204void
206
207void
208osp_target_add_alive_test_methods (osp_target_t *, gboolean, gboolean, gboolean,
209 gboolean, gboolean);
210
211void
213
214/* OSP VT group handling */
215
217osp_vt_group_new (const char *);
218
219void
221
222/* OSP single VT handling */
223
225osp_vt_single_new (const char *);
226
227void
229
230void
231osp_vt_single_add_value (osp_vt_single_t *, const char *, const char *);
232
233#endif
void osp_target_free(osp_target_t *)
Free an OSP target, including all added credentials.
Definition osp.c:1730
int osp_get_vts(osp_connection_t *, entity_t *)
Get all VTs from an OSP server.
Definition osp.c:618
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:754
int osp_stop_scan(osp_connection_t *, const char *, char **)
Stop a scan on an OSP server.
Definition osp.c:970
int osp_get_scanner_details(osp_connection_t *, char **, GSList **)
Get an OSP scanner's details.
Definition osp.c:1438
void osp_vt_single_free(osp_vt_single_t *)
Free a single OSP VT, including all preference values.
Definition osp.c:1841
const char * osp_param_type_str(const osp_param_t *)
Get an OSP parameter in string format form its type.
Definition osp.c:1402
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:554
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:1753
void osp_connection_close(osp_connection_t *)
Close a connection to an OSP server.
Definition osp.c:290
static const osp_get_vts_opts_t osp_get_vts_opts_default
Sensible default values for osp_get_vts_opts_t.
Definition osp.h:109
const char * osp_param_default(const osp_param_t *)
Get an OSP parameter's default value.
Definition osp.c:1552
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:820
osp_credential_t * osp_credential_new(const char *, const char *, const char *)
Allocate and initialize a new OSP credential.
Definition osp.c:1601
int osp_get_version(osp_connection_t *, char **, char **, char **, char **, char **, char **)
Get the scanner version from an OSP server.
Definition osp.c:411
const gchar * osp_credential_get_auth_data(osp_credential_t *, const char *)
Get authentication data from an OSP credential.
Definition osp.c:1643
osp_scan_status_t
OSP scan status.
Definition osp.h:49
@ OSP_SCAN_STATUS_QUEUED
Definition osp.h:55
@ OSP_SCAN_STATUS_STOPPED
Definition osp.h:53
@ OSP_SCAN_STATUS_INTERRUPTED
Definition osp.h:56
@ OSP_SCAN_STATUS_FINISHED
Definition osp.h:54
@ OSP_SCAN_STATUS_RUNNING
Definition osp.h:52
@ OSP_SCAN_STATUS_ERROR
Definition osp.h:50
@ OSP_SCAN_STATUS_INIT
Definition osp.h:51
const char * osp_param_desc(const osp_param_t *)
Get an OSP parameter's description.
Definition osp.c:1537
void osp_credential_set_auth_data(osp_credential_t *, const char *, const char *)
Get authentication data from an OSP credential.
Definition osp.c:1658
int osp_check_feed(osp_connection_t *, int *, int *, char **, char **)
Gets additional status info about the feed.
Definition osp.c:318
int osp_param_mandatory(const osp_param_t *)
Get an OSP parameter's mandatory value.
Definition osp.c:1567
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:1861
osp_vt_single_t * osp_vt_single_new(const char *)
Create a new single OSP VT.
Definition osp.c:1823
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:1049
int osp_get_vts_version(osp_connection_t *, char **, char **error)
Get the VTs version from an OSP server.
Definition osp.c:496
osp_param_t * osp_param_new(void)
Create a new OSP parameter.
Definition osp.c:1494
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:642
osp_vt_group_t * osp_vt_group_new(const char *)
Create a new OSP VT group.
Definition osp.c:1790
int osp_delete_scan(osp_connection_t *, const char *)
Delete a scan from an OSP server.
Definition osp.c:719
void osp_credential_free(osp_credential_t *)
Free an OSP credential.
Definition osp.c:1622
const char * osp_param_name(const osp_param_t *)
Get an OSP parameter's name.
Definition osp.c:1522
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:891
osp_param_type_t
OSP parameter types.
Definition osp.h:34
@ OSP_PARAM_TYPE_BOOLEAN
Definition osp.h:39
@ OSP_PARAM_TYPE_STR
Definition osp.h:36
@ OSP_PARAM_TYPE_INT
Definition osp.h:35
@ OSP_PARAM_TYPE_SELECTION
Definition osp.h:41
@ OSP_PARAM_TYPE_PASSWORD
Definition osp.h:37
@ OSP_PARAM_TYPE_FILE
Definition osp.h:38
@ OSP_PARAM_TYPE_CRD_UP
Definition osp.h:42
@ OSP_PARAM_TYPE_OVALDEF_FILE
Definition osp.h:40
void osp_target_set_finished_hosts(osp_target_t *, const char *)
Set the finished hosts of an OSP target.
Definition osp.c:1718
osp_target_t * osp_target_new(const char *, const char *, const char *, int, int, int)
Create a new OSP target.
Definition osp.c:1691
void osp_vt_group_free(osp_vt_group_t *)
Free a OSP VT group.
Definition osp.c:1806
int osp_get_scan(osp_connection_t *, const char *, char **, int, char **)
Get a scan from an OSP server.
Definition osp.c:954
const char * osp_param_id(const osp_param_t *)
Get an OSP parameter's id.
Definition osp.c:1507
void osp_param_free(osp_param_t *)
Free an OSP parameter.
Definition osp.c:1580
void osp_target_add_credential(osp_target_t *, osp_credential_t *)
Add a credential to an OSP target.
Definition osp.c:1774
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:681
int osp_start_scan_ext(osp_connection_t *, osp_start_scan_opts_t, char **)
Start an OSP scan against a target.
Definition osp.c:1247
XML element.
Definition xmlutils.h:52
Struct holding options for OSP connection.
Definition osp.c:36
Struct credential information for OSP.
Definition osp.c:60
Definition osp.h:65
int start
Definition osp.h:66
char * titles
Definition osp.h:68
int end
Definition osp.h:67
Definition osp.h:60
const char * scan_id
UUID of the scan which get the status from.
Definition osp.h:61
Definition osp.h:101
char * filter
the filter to apply for a vt sub-selection.
Definition osp.h:102
int version_only
if get only feed info or the vt collection
Definition osp.h:103
Struct holding options for OSP parameters.
Definition osp.c:47
Definition osp.h:122
GSList * targets
Target hosts to scan.
Definition osp.h:123
GSList * vts
Single VTs to use for the scan.
Definition osp.h:125
GSList * vt_groups
VT groups to use for the scan.
Definition osp.h:124
GHashTable * scanner_params
Table of scanner parameters.
Definition osp.h:126
const char * scan_id
UUID to set for scan, null otherwise.
Definition osp.h:127
Struct holding target information.
Definition osp.c:71
Struct holding vt_group information.
Definition osp.c:93
Struct holding vt_group information.
Definition osp.c:101
Headers for simple XML reader.