Greenbone Vulnerability Management Libraries  11.0.0
osp.h
Go to the documentation of this file.
1 /* Copyright (C) 2014-2019 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 <glib.h> /* for GHashTable, GSList */
29 #include "../util/xmlutils.h"
30 
31 /* Type definitions */
32 
34 
36 
37 typedef struct osp_target osp_target_t;
38 
40 
42 
46 typedef enum
47 {
57 
61 typedef enum
62 {
69 
70 
71 typedef struct {
72  const char *scan_id;
74 
75 typedef struct {
76  int start;
77  int end;
78  char *titles;
80 
81 typedef struct osp_param osp_param_t;
82 
83 /* OSP Connection handling */
84 
86 osp_connection_new (const char *, int, const char *, const char *,
87  const char *);
88 
89 void
91 
92 /* OSP commands */
93 int
94 osp_get_version (osp_connection_t *, char **, char **, char **, char **,
95  char **, char **);
96 
97 int
99 
100 int
102 
103 typedef struct {
104  char *filter;
106 
107 int
109 
110 int
111 osp_start_scan (osp_connection_t *, const char *, const char *, GHashTable *,
112  const char *, char **);
113 
114 typedef struct {
115  GSList *targets;
116  GSList *vt_groups;
117  GSList *vts;
118  GHashTable *scanner_params;
119  int parallel;
120  const char *scan_id;
122 
123 int
125 
126 int
127 osp_get_scan (osp_connection_t *, const char *, char **, int, char **);
128 
129 int
131  const char *,
132  char **,
133  int,
134  int,
135  char **);
136 
140  char **);
141 
142 int
143 osp_delete_scan (osp_connection_t *, const char *);
144 
145 int
146 osp_stop_scan (osp_connection_t *, const char *, char **);
147 
148 int
149 osp_get_scanner_details (osp_connection_t *, char **, GSList **);
150 
151 
152 int
155  char **,
156  char **);
157 
158 /* OSP scanner parameters handling */
159 
160 osp_param_t *
161 osp_param_new (void);
162 
163 const char *
164 osp_param_id (const osp_param_t *);
165 
166 const char *
167 osp_param_name (const osp_param_t *);
168 
169 const char *
170 osp_param_desc (const osp_param_t *);
171 
172 const char *
174 
175 const char *
177 
178 int
180 
181 void
183 
184 /* OSP credential handling */
185 
187 osp_credential_new (const char *, const char *, const char *);
188 
189 void
191 
192 const gchar*
194 
195 void
196 osp_credential_set_auth_data (osp_credential_t *, const char*, const char*);
197 
198 
199 /* OSP targets handling */
200 
201 osp_target_t *
202 osp_target_new (const char *, const char *, const char *);
203 
204 void
206 
207 void
209 
210 /* OSP VT group handling */
211 
213 osp_vt_group_new (const char *);
214 
215 void
217 
218 /* OSP single VT handling */
219 
221 osp_vt_single_new (const char *);
222 
223 void
225 
226 void
227 osp_vt_single_add_value (osp_vt_single_t *, const char*, const char*);
228 
229 #endif
OSP_SCAN_STATUS_FINISHED
@ OSP_SCAN_STATUS_FINISHED
Definition: osp.h:67
osp_start_scan_opts_t::parallel
int parallel
Number of parallel scans.
Definition: osp.h:119
osp_scan_status_t
osp_scan_status_t
OSP scan status.
Definition: osp.h:61
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:65
osp_param_id
const char * osp_param_id(const osp_param_t *)
Get an OSP parameter's id.
Definition: osp.c:1204
OSP_PARAM_TYPE_SELECTION
@ OSP_PARAM_TYPE_SELECTION
Definition: osp.h:54
OSP_PARAM_TYPE_OVALDEF_FILE
@ OSP_PARAM_TYPE_OVALDEF_FILE
Definition: osp.h:53
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:1099
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:77
osp_start_scan_opts_t::scanner_params
GHashTable * scanner_params
Table of scanner parameters.
Definition: osp.h:118
osp_delete_scan
int osp_delete_scan(osp_connection_t *, const char *)
Delete a scan from an OSP server.
Definition: osp.c:429
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:1359
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:464
osp_param_free
void osp_param_free(osp_param_t *)
Free an OSP parameter.
Definition: osp.c:1277
osp_get_scan_status_opts_t::scan_id
const char * scan_id
UUID of the scan which get the status from.
Definition: osp.h:72
osp_start_scan_opts_t::scan_id
const char * scan_id
UUID to set for scan, null otherwise.
Definition: osp.h:120
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:938
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:758
osp_get_vts_version
int osp_get_vts_version(osp_connection_t *, char **)
Get the VTs version from an OSP server.
Definition: osp.c:334
osp_get_scan_status_opts_t
Definition: osp.h:71
osp_get_performance_opts_t::start
int start
Definition: osp.h:76
osp_start_scan_opts_t
Definition: osp.h:114
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:400
OSP_PARAM_TYPE_PASSWORD
@ OSP_PARAM_TYPE_PASSWORD
Definition: osp.h:50
osp_vt_group_free
void osp_vt_group_free(osp_vt_group_t *)
OSP_PARAM_TYPE_FILE
@ OSP_PARAM_TYPE_FILE
Definition: osp.h:51
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:250
osp_get_vts_opts_t::filter
char * filter
the filter to apply for a vt sub-selection.
Definition: osp.h:104
osp_stop_scan
int osp_stop_scan(osp_connection_t *, const char *, char **)
Stop a scan on an OSP server.
Definition: osp.c:679
OSP_PARAM_TYPE_BOOLEAN
@ OSP_PARAM_TYPE_BOOLEAN
Definition: osp.h:52
osp_start_scan_opts_t::vt_groups
GSList * vt_groups
VT groups to use for the scan.
Definition: osp.h:116
osp_param_default
const char * osp_param_default(const osp_param_t *)
Get an OSP parameter's default value.
Definition: osp.c:1249
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:1343
osp_vt_single_free
void osp_vt_single_free(osp_vt_single_t *)
OSP_SCAN_STATUS_ERROR
@ OSP_SCAN_STATUS_ERROR
Definition: osp.h:63
osp_target_free
void osp_target_free(osp_target_t *)
osp_param_name
const char * osp_param_name(const osp_param_t *)
Get an OSP parameter's name.
Definition: osp.c:1219
osp_get_scanner_details
int osp_get_scanner_details(osp_connection_t *, char **, GSList **)
Get an OSP scanner's details.
Definition: osp.c:1135
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:1299
osp_param
Struct holding options for OSP parameters.
Definition: osp.c:60
osp_param_desc
const char * osp_param_desc(const osp_param_t *)
Get an OSP parameter's description.
Definition: osp.c:1234
osp_get_performance_opts_t::titles
char * titles
Definition: osp.h:78
OSP_PARAM_TYPE_CRD_UP
@ OSP_PARAM_TYPE_CRD_UP
Definition: osp.h:55
OSP_PARAM_TYPE_STR
@ OSP_PARAM_TYPE_STR
Definition: osp.h:49
osp_connection_close
void osp_connection_close(osp_connection_t *)
Close a connection to an OSP server.
Definition: osp.c:223
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:1322
OSP_SCAN_STATUS_INIT
@ OSP_SCAN_STATUS_INIT
Definition: osp.h:64
osp_get_vts_opts_t
Definition: osp.h:103
osp_target_new
osp_target_t * osp_target_new(const char *, const char *, const char *)
entity_s
XML element.
Definition: xmlutils.h:65
osp_param_type_t
osp_param_type_t
OSP parameter types.
Definition: osp.h:46
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:597
OSP_PARAM_TYPE_INT
@ OSP_PARAM_TYPE_INT
Definition: osp.h:48
osp_get_vts
int osp_get_vts(osp_connection_t *, entity_t *)
Get all VTs from an OSP server.
Definition: osp.c:376
osp_credential
Struct credential information for OSP.
Definition: osp.c:73
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:663
osp_start_scan_opts_t::targets
GSList * targets
Target hosts to scan.
Definition: osp.h:115
osp_vt_single
Struct holding vt_group information.
Definition: osp.c:103
osp_target
Struct holding target information.
Definition: osp.c:84
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:530
osp_param_mandatory
int osp_param_mandatory(const osp_param_t *)
Get an OSP parameter's mandatory value.
Definition: osp.c:1264
OSP_SCAN_STATUS_STOPPED
@ OSP_SCAN_STATUS_STOPPED
Definition: osp.h:66
osp_get_performance_opts_t
Definition: osp.h:75
osp_connection
Struct holding options for OSP connection.
Definition: osp.c:49
osp_param_new
osp_param_t * osp_param_new(void)
Create a new OSP parameter.
Definition: osp.c:1191
osp_start_scan_opts_t::vts
GSList * vts
Single VTs to use for the scan.
Definition: osp.h:117
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:95
osp_target_add_credential
void osp_target_add_credential(osp_target_t *, osp_credential_t *)