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 
20 typedef struct osp_connection osp_connection_t;
21 
22 typedef struct osp_credential osp_credential_t;
23 
24 typedef struct osp_target osp_target_t;
25 
26 typedef struct osp_vt_group osp_vt_group_t;
27 
28 typedef struct osp_vt_single osp_vt_single_t;
29 
33 typedef enum
34 {
44 
48 typedef enum
49 {
58 
59 typedef struct
60 {
61  const char *scan_id;
63 
64 typedef struct
65 {
66  int start;
67  int end;
68  char *titles;
70 
71 typedef struct osp_param osp_param_t;
72 
73 /* OSP Connection handling */
74 
76 osp_connection_new (const char *, int, const char *, const char *,
77  const char *);
78 
79 void
81 
82 /* OSP commands */
83 int
84 osp_check_feed (osp_connection_t *, int *, int *, char **, char **);
85 
86 int
87 osp_get_version (osp_connection_t *, char **, char **, char **, char **,
88  char **, char **);
89 
90 int
91 osp_get_vts_version (osp_connection_t *, char **, char **error);
92 
93 int
94 osp_get_vts_feed_info (osp_connection_t *, char **, char **, char **, char **,
95  char **);
96 
97 int
99 
100 typedef struct
101 {
102  char *filter;
105 
110 
111 int
113 
114 int
116 
117 int
118 osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
119  const char *, char **);
120 
121 typedef struct
122 {
123  GSList *targets;
124  GSList *vt_groups;
125  GSList *vts;
126  GHashTable *scanner_params;
127  const char *scan_id;
129 
130 int
132 
133 int
134 osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
135 
136 int
137 osp_get_scan_pop (osp_connection_t *, const char *, char **, int, int, char **);
138 
141  char **);
142 
143 int
144 osp_delete_scan (osp_connection_t *, const char *);
145 
146 int
147 osp_stop_scan (osp_connection_t *, const char *, char **);
148 
149 int
150 osp_get_scanner_details (osp_connection_t *, char **, GSList **);
151 
152 int
154  char **, char **);
155 
156 /* OSP scanner parameters handling */
157 
158 osp_param_t *
159 osp_param_new (void);
160 
161 const char *
162 osp_param_id (const osp_param_t *);
163 
164 const char *
165 osp_param_name (const osp_param_t *);
166 
167 const char *
168 osp_param_desc (const osp_param_t *);
169 
170 const char *
172 
173 const char *
175 
176 int
178 
179 void
181 
182 /* OSP credential handling */
183 
185 osp_credential_new (const char *, const char *, const char *);
186 
187 void
189 
190 const gchar *
192 
193 void
194 osp_credential_set_auth_data (osp_credential_t *, const char *, const char *);
195 
196 /* OSP targets handling */
197 
198 osp_target_t *
199 osp_target_new (const char *, const char *, const char *, int, int, int);
200 
201 void
203 
204 void
206 
207 void
208 osp_target_add_alive_test_methods (osp_target_t *, gboolean, gboolean, gboolean,
209  gboolean, gboolean);
210 
211 void
213 
214 /* OSP VT group handling */
215 
217 osp_vt_group_new (const char *);
218 
219 void
221 
222 /* OSP single VT handling */
223 
225 osp_vt_single_new (const char *);
226 
227 void
229 
230 void
231 osp_vt_single_add_value (osp_vt_single_t *, const char *, const char *);
232 
233 #endif
OSP_SCAN_STATUS_FINISHED
@ OSP_SCAN_STATUS_FINISHED
Definition: osp.h:54
osp_scan_status_t
osp_scan_status_t
OSP scan status.
Definition: osp.h:49
osp_vt_single_add_value
void osp_vt_single_add_value(osp_vt_single_t *, const char *, const char *)
OSP_SCAN_STATUS_RUNNING
@ OSP_SCAN_STATUS_RUNNING
Definition: osp.h:52
osp_param_id
const char * osp_param_id(const osp_param_t *)
Get an OSP parameter's id.
Definition: osp.c:1510
OSP_PARAM_TYPE_SELECTION
@ OSP_PARAM_TYPE_SELECTION
Definition: osp.h:41
OSP_PARAM_TYPE_OVALDEF_FILE
@ OSP_PARAM_TYPE_OVALDEF_FILE
Definition: osp.h:40
osp_param_type_str
const char * osp_param_type_str(const osp_param_t *)
Get an OSP parameter in string format form its type.
Definition: osp.c:1405
osp_connection_new
osp_connection_t * osp_connection_new(const char *, int, const char *, const char *, const char *)
osp_get_performance_opts_t::end
int end
Definition: osp.h:67
osp_start_scan_opts_t::scanner_params
GHashTable * scanner_params
Table of scanner parameters.
Definition: osp.h:126
osp_delete_scan
int osp_delete_scan(osp_connection_t *, const char *)
Delete a scan from an OSP server.
Definition: osp.c:722
osp_get_vts_opts_default
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
osp_credential_set_auth_data
void osp_credential_set_auth_data(osp_credential_t *, const char *, const char *)
Get authentication data from an OSP credential.
Definition: osp.c:1661
osp_get_performance_ext
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:757
osp_param_free
void osp_param_free(osp_param_t *)
Free an OSP parameter.
Definition: osp.c:1583
osp_get_scan_status_opts_t::scan_id
const char * scan_id
UUID of the scan which get the status from.
Definition: osp.h:61
osp_start_scan_opts_t::scan_id
const char * scan_id
UUID to set for scan, null otherwise.
Definition: osp.h:127
osp_start_scan_ext
int osp_start_scan_ext(osp_connection_t *, osp_start_scan_opts_t, char **)
Start an OSP scan against a target.
Definition: osp.c:1250
osp_start_scan
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:1052
osp_get_scan_status_opts_t
Definition: osp.h:60
osp_get_performance_opts_t::start
int start
Definition: osp.h:66
osp_target_set_finished_hosts
void osp_target_set_finished_hosts(osp_target_t *, const char *)
osp_start_scan_opts_t
Definition: osp.h:122
osp_get_vts_ext
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:645
OSP_PARAM_TYPE_PASSWORD
@ OSP_PARAM_TYPE_PASSWORD
Definition: osp.h:37
osp_vt_group_free
void osp_vt_group_free(osp_vt_group_t *)
OSP_PARAM_TYPE_FILE
@ OSP_PARAM_TYPE_FILE
Definition: osp.h:38
osp_get_version
int osp_get_version(osp_connection_t *, char **, char **, char **, char **, char **, char **)
Get the scanner version from an OSP server.
Definition: osp.c:414
osp_get_vts_opts_t::filter
char * filter
the filter to apply for a vt sub-selection.
Definition: osp.h:102
osp_stop_scan
int osp_stop_scan(osp_connection_t *, const char *, char **)
Stop a scan on an OSP server.
Definition: osp.c:973
OSP_PARAM_TYPE_BOOLEAN
@ OSP_PARAM_TYPE_BOOLEAN
Definition: osp.h:39
osp_start_scan_opts_t::vt_groups
GSList * vt_groups
VT groups to use for the scan.
Definition: osp.h:124
osp_param_default
const char * osp_param_default(const osp_param_t *)
Get an OSP parameter's default value.
Definition: osp.c:1555
osp_credential_get_auth_data
const gchar * osp_credential_get_auth_data(osp_credential_t *, const char *)
Get authentication data from an OSP credential.
Definition: osp.c:1646
osp_vt_single_free
void osp_vt_single_free(osp_vt_single_t *)
OSP_SCAN_STATUS_ERROR
@ OSP_SCAN_STATUS_ERROR
Definition: osp.h:50
osp_target_free
void osp_target_free(osp_target_t *)
OSP_SCAN_STATUS_QUEUED
@ OSP_SCAN_STATUS_QUEUED
Definition: osp.h:55
osp_param_name
const char * osp_param_name(const osp_param_t *)
Get an OSP parameter's name.
Definition: osp.c:1525
osp_get_vts_ext_str
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:684
osp_get_scanner_details
int osp_get_scanner_details(osp_connection_t *, char **, GSList **)
Get an OSP scanner's details.
Definition: osp.c:1441
OSP_SCAN_STATUS_INTERRUPTED
@ OSP_SCAN_STATUS_INTERRUPTED
Definition: osp.h:56
osp_check_feed
int osp_check_feed(osp_connection_t *, int *, int *, char **, char **)
Gets additional status info about the feed.
Definition: osp.c:321
osp_credential_new
osp_credential_t * osp_credential_new(const char *, const char *, const char *)
Allocate and initialize a new OSP credential.
Definition: osp.c:1604
osp_param
Struct holding options for OSP parameters.
Definition: osp.c:47
osp_param_desc
const char * osp_param_desc(const osp_param_t *)
Get an OSP parameter's description.
Definition: osp.c:1540
osp_get_performance_opts_t::titles
char * titles
Definition: osp.h:68
OSP_PARAM_TYPE_CRD_UP
@ OSP_PARAM_TYPE_CRD_UP
Definition: osp.h:42
OSP_PARAM_TYPE_STR
@ OSP_PARAM_TYPE_STR
Definition: osp.h:36
osp_connection_close
void osp_connection_close(osp_connection_t *)
Close a connection to an OSP server.
Definition: osp.c:293
osp_vt_single_new
osp_vt_single_t * osp_vt_single_new(const char *)
osp_credential_free
void osp_credential_free(osp_credential_t *)
Free an OSP credential.
Definition: osp.c:1625
OSP_SCAN_STATUS_INIT
@ OSP_SCAN_STATUS_INIT
Definition: osp.h:51
osp_get_vts_opts_t
Definition: osp.h:101
entity_s
XML element.
Definition: xmlutils.h:52
osp_param_type_t
osp_param_type_t
OSP parameter types.
Definition: osp.h:34
osp_get_scan_pop
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:894
OSP_PARAM_TYPE_INT
@ OSP_PARAM_TYPE_INT
Definition: osp.h:35
osp_get_vts
int osp_get_vts(osp_connection_t *, entity_t *)
Get all VTs from an OSP server.
Definition: osp.c:621
osp_get_vts_version
int osp_get_vts_version(osp_connection_t *, char **, char **error)
Get the VTs version from an OSP server.
Definition: osp.c:499
osp_credential
Struct credential information for OSP.
Definition: osp.c:60
osp_get_scan
int osp_get_scan(osp_connection_t *, const char *, char **, int, char **)
Get a scan from an OSP server.
Definition: osp.c:957
osp_get_vts_feed_info
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:557
osp_target_new
osp_target_t * osp_target_new(const char *, const char *, const char *, int, int, int)
osp_start_scan_opts_t::targets
GSList * targets
Target hosts to scan.
Definition: osp.h:123
osp_vt_single
Struct holding vt_group information.
Definition: osp.c:101
osp_target
Struct holding target information.
Definition: osp.c:71
osp_get_scan_status_ext
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:823
osp_get_vts_opts_t::version_only
int version_only
if get only feed info or the vt collection
Definition: osp.h:103
osp_param_mandatory
int osp_param_mandatory(const osp_param_t *)
Get an OSP parameter's mandatory value.
Definition: osp.c:1570
OSP_SCAN_STATUS_STOPPED
@ OSP_SCAN_STATUS_STOPPED
Definition: osp.h:53
osp_get_performance_opts_t
Definition: osp.h:65
osp_connection
Struct holding options for OSP connection.
Definition: osp.c:36
osp_param_new
osp_param_t * osp_param_new(void)
Create a new OSP parameter.
Definition: osp.c:1497
osp_start_scan_opts_t::vts
GSList * vts
Single VTs to use for the scan.
Definition: osp.h:125
osp_target_add_alive_test_methods
void osp_target_add_alive_test_methods(osp_target_t *, gboolean, gboolean, gboolean, gboolean, gboolean)
osp_vt_group_new
osp_vt_group_t * osp_vt_group_new(const char *)
osp_vt_group
Struct holding vt_group information.
Definition: osp.c:93
osp_target_add_credential
void osp_target_add_credential(osp_target_t *, osp_credential_t *)