Greenbone Vulnerability Management Libraries 22.4.0
gmp.h
Go to the documentation of this file.
1/* Copyright (C) 2009-2022 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_GMP_H
26#define _GVM_GMP_H
27
28#include "../base/array.h" /* for array_t */
29#include "../util/serverutils.h" /* for gvm_connection_t */
30#include "../util/xmlutils.h" /* for entity_t */
31
32#include <glib.h> /* for gchar */
33#include <glib/gtypes.h> /* for gsize */
34#include <gnutls/gnutls.h> /* for gnutls_session_t */
35#include <stddef.h> /* for NULL */
36
40typedef struct
41{
42 int timeout;
43 const char *username;
44 const char *password;
45 char **role;
46 char **timezone;
47 char **pw_warning;
49
54 {0, NULL, NULL, NULL, NULL, NULL};
55
59typedef struct
60{
61 const char *sort_field;
62 const char *sort_order;
63 const char *format_id;
64 const char *levels;
65 const char *report_id;
68 int timeout;
71 int autofp;
73 char *type;
74 char *filter;
75 char *filt_id;
76 char *host;
77 char *pos;
78 char *timezone;
79 char *alert_id;
86 char *min_qod;
87 /* Boolean flags: */
88 int notes;
96
101 "ROWID",
102 "ascending",
103 "a994b278-1f62-11e1-96ac-406186ea4fc5",
104 "hmlgd",
105 NULL,
106 1,
107 -1,
108 0,
109 0,
110 0,
111 0,
112 NULL,
113 NULL,
114 NULL,
115 NULL,
116 NULL,
117 NULL,
118 NULL,
119 NULL,
120 NULL,
121 NULL,
122 NULL,
123 NULL,
124 NULL,
125 NULL,
126 0,
127 0,
128 0,
129 0,
130 0,
131 0,
132 0};
133
137typedef struct
138{
139 const char *filter;
141 const char *actions;
142 /* Boolean flags: */
144 int rcfile;
146
151 0};
152
156typedef struct
157{
158 const char *actions;
159 const char *task_id;
160 /* Boolean flags: */
162 int rcfile;
164
169 0};
170
174typedef struct
175{
177 const char *config_id;
178 const char *scanner_id;
179 const char *schedule_id;
180 const char *slave_id;
181 const char *target_id;
182 const char *name;
183 const char *comment;
184 const char *hosts_ordering;
185 const char *observers;
188 /* Preferences */
189 const char *in_assets;
190 const char *max_hosts;
191 const char *max_checks;
192 const char *source_iface;
193 /* Boolean flags: */
196
201 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
202 NULL, NULL, 0, NULL, NULL, NULL, NULL, 0};
203
207typedef struct
208{
210 const char *ssh_credential_id;
211 const char *smb_credential_id;
212 const char *esxi_credential_id;
213 const char *snmp_credential_id;
214 const char *port_range;
215 const char *name;
216 const char *comment;
217 const char *hosts;
218 const char *exclude_hosts;
219 const char *alive_tests;
220 /* Boolean flags: */
224
229 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0};
230
234typedef struct
235{
236 const char *name;
237 const char *duration;
238 const char *start_time;
239 const char *end_time;
240 const char *slave_id;
241 int brief;
243
248 gmp_get_system_reports_opts_defaults = {NULL, NULL, NULL, NULL, NULL, 0};
249
253typedef struct
254{
255 const char *name;
256 const char *community;
257 const char *login;
258 const char *passphrase;
259 const char *private_key;
260 const char *auth_algorithm;
261 const char *privacy_password;
262 const char *privacy_algorithm;
263 const char *comment;
265
270 gmp_create_lsc_credential_opts_defaults = {NULL, NULL, NULL, NULL, NULL,
271 NULL, NULL, NULL, NULL};
272
276typedef struct
277{
280
285
290
291int
292gmp_read_create_response (gnutls_session_t *, gchar **);
293
294const char *
295gmp_task_status (entity_t status_response);
296
297int
298gmp_ping (gnutls_session_t *, int);
299
300int
301gmp_ping_c (gvm_connection_t *, int, gchar **);
302
303int
304gmp_authenticate (gnutls_session_t *session, const char *username,
305 const char *password);
306
307int
309
310int
312
313int
314gmp_create_task (gnutls_session_t *, const char *, const char *, const char *,
315 const char *, gchar **);
316
317int
318gmp_create_task_ext (gnutls_session_t *, gmp_create_task_opts_t, gchar **);
319
320int
321gmp_start_task_report (gnutls_session_t *, const char *, char **);
322
323int
324gmp_start_task_report_c (gvm_connection_t *, const char *, char **);
325
329typedef struct
330{
331 const char *task_id;
333
335
336int
338
339int
340gmp_stop_task (gnutls_session_t *, const char *);
341
342int
343gmp_stop_task_c (gvm_connection_t *, const char *);
344
345int
346gmp_resume_task_report (gnutls_session_t *, const char *, char **);
347
348int
349gmp_resume_task_report_c (gvm_connection_t *, const char *, char **);
350
351int
352gmp_get_tasks (gnutls_session_t *, const char *, int, int, entity_t *);
353
354int
355gmp_get_tasks_ext (gnutls_session_t *, gmp_get_tasks_opts_t, entity_t *);
356
357int
358gmp_get_task_ext (gnutls_session_t *, gmp_get_task_opts_t, entity_t *);
359
360int
361gmp_get_targets (gnutls_session_t *, const char *, int, int, entity_t *);
362
363int
364gmp_get_report_ext (gnutls_session_t *, gmp_get_report_opts_t, entity_t *);
365
366int
367gmp_delete_port_list_ext (gnutls_session_t *, const char *, gmp_delete_opts_t);
368
369int
370gmp_delete_task (gnutls_session_t *, const char *);
371
372int
373gmp_delete_task_ext (gnutls_session_t *, const char *, gmp_delete_opts_t);
374
375int
376gmp_modify_task_file (gnutls_session_t *, const char *, const char *,
377 const void *, gsize);
378
379int
380gmp_delete_report (gnutls_session_t *, const char *);
381
382int
383gmp_create_target_ext (gnutls_session_t *, gmp_create_target_opts_t, gchar **);
384
385int
386gmp_delete_target_ext (gnutls_session_t *, const char *, gmp_delete_opts_t);
387
388int
389gmp_delete_config_ext (gnutls_session_t *, const char *, gmp_delete_opts_t);
390
391int
392gmp_create_lsc_credential_ext (gnutls_session_t *,
394
395int
396gmp_create_lsc_credential (gnutls_session_t *, const char *, const char *,
397 const char *, const char *, gchar **);
398
399int
400gmp_create_lsc_credential_key (gnutls_session_t *, const char *, const char *,
401 const char *, const char *, const char *,
402 gchar **);
403
404int
405gmp_delete_lsc_credential_ext (gnutls_session_t *, const char *,
407
408int
409gmp_get_system_reports (gnutls_session_t *, const char *, int, entity_t *);
410
411int
413 entity_t *);
414
415#endif /* not _GVM_GMP_H */
GPtrArray array_t
Definition: array.h:30
int gmp_get_system_reports(gnutls_session_t *, const char *, int, entity_t *)
Get system reports.
Definition: gmp.c:1979
int gmp_create_lsc_credential(gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
Create an LSC Credential.
Definition: gmp.c:1734
int gmp_delete_lsc_credential_ext(gnutls_session_t *, const char *, gmp_delete_opts_t)
Delete a LSC credential.
Definition: gmp.c:1947
static const gmp_delete_opts_t gmp_delete_opts_defaults
Sensible default values for gmp_get_report_opts_t.
Definition: gmp.h:284
int gmp_start_task_report(gnutls_session_t *, const char *, char **)
Start a task and read the manager response.
Definition: gmp.c:762
int gmp_start_task_ext_c(gvm_connection_t *, gmp_start_task_opts_t)
Start a task and read the manager response.
Definition: gmp.c:867
int gmp_delete_port_list_ext(gnutls_session_t *, const char *, gmp_delete_opts_t)
Delete a port list.
Definition: gmp.c:1494
int gmp_stop_task_c(gvm_connection_t *, const char *)
Stop a task and read the manager response.
Definition: gmp.c:980
static const gmp_get_tasks_opts_t gmp_get_tasks_opts_defaults
Sensible default values for gmp_get_tasks_opts_t.
Definition: gmp.h:150
static const gmp_authenticate_info_opts_t gmp_authenticate_info_opts_defaults
Sensible default values for gmp_authenticate_info_opts_t.
Definition: gmp.h:53
static const gmp_get_system_reports_opts_t gmp_get_system_reports_opts_defaults
Sensible default values for gmp_get_report_opts_t.
Definition: gmp.h:248
int gmp_create_task_ext(gnutls_session_t *, gmp_create_task_opts_t, gchar **)
Create a task.
Definition: gmp.c:547
static const gmp_start_task_opts_t gmp_start_task_opts_defaults
Definition: gmp.h:334
int gmp_delete_task(gnutls_session_t *, const char *)
Delete a task and read the manager response.
Definition: gmp.c:1330
int gmp_delete_task_ext(gnutls_session_t *, const char *, gmp_delete_opts_t)
Delete a task and read the manager response.
Definition: gmp.c:1102
int gmp_read_create_response(gnutls_session_t *, gchar **)
Read response status and resource UUID.
Definition: gmp.c:898
int gmp_resume_task_report(gnutls_session_t *, const char *, char **)
Resume a task and read the manager response.
Definition: gmp.c:999
int gmp_resume_task_report_c(gvm_connection_t *, const char *, char **)
Resume a task and read the manager response.
Definition: gmp.c:1044
int gmp_ping(gnutls_session_t *, int)
"Ping" the manager.
Definition: gmp.c:200
const char * gmp_task_status(entity_t status_response)
Get the task status from a GMP GET_TASKS response.
Definition: gmp.c:62
int gmp_create_lsc_credential_key(gnutls_session_t *, const char *, const char *, const char *, const char *, const char *, gchar **)
Create an LSC Credential with a key.
Definition: gmp.c:1802
int gmp_stop_task(gnutls_session_t *, const char *)
Stop a task and read the manager response.
Definition: gmp.c:956
int gmp_get_report_ext(gnutls_session_t *, gmp_get_report_opts_t, entity_t *)
Get a report (generic version).
Definition: gmp.c:1396
static const gmp_delete_opts_t gmp_delete_opts_ultimate_defaults
Default values for gmp_get_report_opts_t for ultimate deletion.
Definition: gmp.h:289
int gmp_authenticate(gnutls_session_t *session, const char *username, const char *password)
Authenticate with the manager.
Definition: gmp.c:331
static const gmp_get_report_opts_t gmp_get_report_opts_defaults
Sensible default values for gmp_get_report_opts_t.
Definition: gmp.h:100
int gmp_get_targets(gnutls_session_t *, const char *, int, int, entity_t *)
Get a target.
Definition: gmp.c:1358
int gmp_create_task(gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
Create a task given a config and target.
Definition: gmp.c:727
int gmp_delete_target_ext(gnutls_session_t *, const char *, gmp_delete_opts_t)
Delete a target.
Definition: gmp.c:1673
int gmp_get_tasks_ext(gnutls_session_t *, gmp_get_tasks_opts_t, entity_t *)
Get all tasks (generic version).
Definition: gmp.c:1206
static const gmp_create_lsc_credential_opts_t gmp_create_lsc_credential_opts_defaults
Sensible default values for gmp_create_lsc_credential_opts_t.
Definition: gmp.h:270
int gmp_get_task_ext(gnutls_session_t *, gmp_get_task_opts_t, entity_t *)
Get a task (generic version).
Definition: gmp.c:1169
int gmp_get_tasks(gnutls_session_t *, const char *, int, int, entity_t *)
Get the status of a task.
Definition: gmp.c:1134
static const gmp_create_target_opts_t gmp_create_target_opts_defaults
Sensible default values for gmp_get_report_opts_t.
Definition: gmp.h:228
int gmp_modify_task_file(gnutls_session_t *, const char *, const char *, const void *, gsize)
Modify a file on a task.
Definition: gmp.c:1273
int gmp_delete_config_ext(gnutls_session_t *, const char *, gmp_delete_opts_t)
Delete a config.
Definition: gmp.c:1702
static const gmp_get_task_opts_t gmp_get_task_opts_defaults
Sensible default values for gmp_get_tasks_opts_t.
Definition: gmp.h:168
int gmp_authenticate_info_ext(gnutls_session_t *, gmp_authenticate_info_opts_t)
Authenticate with the manager.
Definition: gmp.c:374
int gmp_ping_c(gvm_connection_t *, int, gchar **)
"Ping" the manager.
Definition: gmp.c:259
int gmp_get_system_reports_ext(gnutls_session_t *, gmp_get_system_reports_opts_t, entity_t *)
Get system reports.
Definition: gmp.c:2010
int gmp_create_lsc_credential_ext(gnutls_session_t *, gmp_create_lsc_credential_opts_t, gchar **)
Create an LSC credential.
Definition: gmp.c:1855
int gmp_authenticate_info_ext_c(gvm_connection_t *, gmp_authenticate_info_opts_t)
Authenticate with the manager.
Definition: gmp.c:455
int gmp_create_target_ext(gnutls_session_t *, gmp_create_target_opts_t, gchar **)
Create a target.
Definition: gmp.c:1552
static const gmp_create_task_opts_t gmp_create_task_opts_defaults
Sensible default values for gmp_get_report_opts_t.
Definition: gmp.h:200
int gmp_start_task_report_c(gvm_connection_t *, const char *, char **)
Start a task and read the manager response.
Definition: gmp.c:807
int gmp_delete_report(gnutls_session_t *, const char *)
Remove a report.
Definition: gmp.c:1522
XML element.
Definition: xmlutils.h:66
Struct holding options for authentication.
Definition: gmp.h:41
const char * password
Username.
Definition: gmp.h:44
int timeout
Timeout for authentication.
Definition: gmp.h:42
char ** pw_warning
[out] Password warning, NULL if password is okay.
Definition: gmp.h:47
char ** timezone
[out] Timezone if any, else NULL.
Definition: gmp.h:46
const char * username
Password.
Definition: gmp.h:43
char ** role
[out] Role.
Definition: gmp.h:45
Struct holding options for gmp create_lsc_credential command.
Definition: gmp.h:254
const char * privacy_password
SNMP privacy password.
Definition: gmp.h:261
const char * privacy_algorithm
SNMP privacy algorithm.
Definition: gmp.h:262
const char * login
Login.
Definition: gmp.h:257
const char * community
SNMP community.
Definition: gmp.h:256
const char * passphrase
Passphrase.
Definition: gmp.h:258
const char * comment
Comment on LSC credential.
Definition: gmp.h:263
const char * private_key
Private key.
Definition: gmp.h:259
const char * auth_algorithm
SNMP authentication algorithm.
Definition: gmp.h:260
const char * name
Name of LSC credential.
Definition: gmp.h:255
Struct holding options for gmp create_target command.
Definition: gmp.h:208
const char * exclude_hosts
Hosts to exclude.
Definition: gmp.h:218
const char * comment
Comment on target.
Definition: gmp.h:216
const char * smb_credential_id
ID of SMB credential.
Definition: gmp.h:211
int reverse_lookup_only
Scanner pref reverse_lookup_only.
Definition: gmp.h:221
int reverse_lookup_unify
Scanner pref reverse_lookup_unify.
Definition: gmp.h:222
const char * esxi_credential_id
ID of ESXi credential.
Definition: gmp.h:212
const char * snmp_credential_id
ID of SNMP credential.
Definition: gmp.h:213
const char * hosts
Name of target.
Definition: gmp.h:217
const char * port_range
Port range.
Definition: gmp.h:214
int ssh_credential_port
Port for SSH access.
Definition: gmp.h:209
const char * alive_tests
Alive tests.
Definition: gmp.h:219
const char * ssh_credential_id
ID of SSH credential.
Definition: gmp.h:210
const char * name
Name of target.
Definition: gmp.h:215
Struct holding options for gmp create_task command.
Definition: gmp.h:175
int schedule_periods
Number of periods the schedule must run for.
Definition: gmp.h:187
const char * max_checks
Max checks preference.
Definition: gmp.h:191
const char * slave_id
ID of task schedule.
Definition: gmp.h:180
array_t * alert_ids
Array of alert IDs.
Definition: gmp.h:176
const char * config_id
ID of config.
Definition: gmp.h:177
const char * in_assets
In assets preference.
Definition: gmp.h:189
const char * schedule_id
ID of task schedule.
Definition: gmp.h:179
const char * source_iface
Source iface preference.
Definition: gmp.h:192
array_t * observer_groups
IDs of observer groups.
Definition: gmp.h:186
const char * observers
Comma-separated string of observer users.
Definition: gmp.h:185
const char * name
Name of task.
Definition: gmp.h:182
const char * target_id
ID of target.
Definition: gmp.h:181
const char * scanner_id
ID of task scanner.
Definition: gmp.h:178
int alterable
Whether the task is alterable.
Definition: gmp.h:194
const char * max_hosts
Max hosts preference.
Definition: gmp.h:190
const char * hosts_ordering
Order for scanning target hosts.
Definition: gmp.h:184
const char * comment
Comment on task.
Definition: gmp.h:183
Struct holding options for various gmp delete_[...] commands.
Definition: gmp.h:277
int ultimate
Definition: gmp.h:278
Struct holding options for gmp get_report command.
Definition: gmp.h:60
int timeout
Timeout for GMP response.
Definition: gmp.h:68
char * search_phrase
Search phrase result filter.
Definition: gmp.h:83
int override_details
If overrides, whether to include details.
Definition: gmp.h:91
const char * sort_order
Definition: gmp.h:62
int first_result
First result to get.
Definition: gmp.h:66
int overrides
Whether to include overrides in the report.
Definition: gmp.h:90
int max_results
Maximum number of results to return.
Definition: gmp.h:67
char * delta_states
Delta states (Changed Gone New Same) to include.
Definition: gmp.h:81
const char * sort_field
Definition: gmp.h:61
char * delta_report_id
ID of report to compare single report to.
Definition: gmp.h:80
int ignore_pagination
Whether to ignore pagination filters.
Definition: gmp.h:94
char * timezone
Timezone.
Definition: gmp.h:78
char * type
Type of report.
Definition: gmp.h:73
char * pos
Position of report from end.
Definition: gmp.h:77
char * filt_id
ID of filter, to filter results.
Definition: gmp.h:75
const char * format_id
ID of required report format.
Definition: gmp.h:63
int host_max_results
Maximum number of results to return.
Definition: gmp.h:70
char * min_cvss_base
Minimum CVSS base filter.
Definition: gmp.h:85
char * host
Host for asset report.
Definition: gmp.h:76
const char * report_id
ID of single report to get.
Definition: gmp.h:65
char * min_qod
Minimum QoD filter.
Definition: gmp.h:86
int autofp
Definition: gmp.h:71
char * host_levels
Letter encoded threat level filter, for hosts.
Definition: gmp.h:82
char * host_search_phrase
Search phrase result filter.
Definition: gmp.h:84
char * filter
Term to filter results.
Definition: gmp.h:74
int host_first_result
Skip over results before this result number.
Definition: gmp.h:69
int notes_details
Whether to include details of above.
Definition: gmp.h:89
char * alert_id
ID of alert.
Definition: gmp.h:79
int result_hosts_only
Whether to include only hosts that have results.
Definition: gmp.h:93
const char * levels
Result levels to include.
Definition: gmp.h:64
int notes
Whether to include associated notes.
Definition: gmp.h:88
int apply_overrides
Whether overrides are applied.
Definition: gmp.h:92
Struct holding options for gmp get_system_reports command.
Definition: gmp.h:235
const char * duration
Duration.
Definition: gmp.h:237
const char * slave_id
ID of the slave to get report from.
Definition: gmp.h:240
int brief
Brief flag.
Definition: gmp.h:241
const char * end_time
Time of last data point.
Definition: gmp.h:239
const char * name
Name of report.
Definition: gmp.h:236
const char * start_time
Time of first data point.
Definition: gmp.h:238
Struct holding options for gmp get_tasks command.
Definition: gmp.h:157
int details
Whether to include overrides in the tasks.
Definition: gmp.h:161
const char * task_id
ID of single task to get.
Definition: gmp.h:159
int rcfile
Ignored. Removed since GMP 6.0.
Definition: gmp.h:162
const char * actions
Actions argument.
Definition: gmp.h:158
Struct holding options for gmp get_tasks command.
Definition: gmp.h:138
int rcfile
Ignored. Removed since GMP 6.0.
Definition: gmp.h:144
int timeout
Timeout for GMP response.
Definition: gmp.h:140
const char * actions
Actions argument.
Definition: gmp.h:141
int details
Whether to include overrides in the tasks.
Definition: gmp.h:143
const char * filter
Filter argument.
Definition: gmp.h:139
Struct holding options for gmp start_task command.
Definition: gmp.h:330
const char * task_id
ID of task.
Definition: gmp.h:331
Connection.
Definition: serverutils.h:44