OpenVAS Libraries  8.0.8
omp.h
Go to the documentation of this file.
1 /* openvase-libraries/omp
2  * $Id$
3  * Description: Header for OMP client interface.
4  *
5  * Authors:
6  * Matthew Mundell <matt@mundell.ukfsn.org>
7  *
8  * Copyright:
9  * Copyright (C) 2009 Greenbone Networks GmbH
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25 
26 #ifndef _OPENVAS_LIBRARIES_OMP_H
27 #define _OPENVAS_LIBRARIES_OMP_H
28 
29 #include "../base/array.h"
30 #include "xml.h"
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #if 0
36 }
37 #endif
38 #endif
39 
43 typedef struct
44 {
45  int timeout;
46  const char *username;
47  const char *password;
48  char **role;
49  char **severity;
50  char **timezone;
51  char **pw_warning;
53 
57 static const omp_authenticate_info_opts_t omp_authenticate_info_opts_defaults =
58  {
59  0
60  };
61 
65 typedef struct
66 {
67  const char* sort_field;
68  const char* sort_order;
69  const char* format_id;
70  const char* levels;
71  const char* report_id;
74  int timeout;
77  int autofp;
78  char *type;
79  char *host;
80  char *pos;
81  char *timezone;
82  char *alert_id;
84  char *delta_states;
85  char *host_levels;
86  char *search_phrase;
88  char *min_cvss_base;
89  char *min_qod;
90  /* Boolean flags: */
91  int notes;
93  int overrides;
99 
103 static const omp_get_report_opts_t omp_get_report_opts_defaults =
104  {
105  "ROWID", "ascending", "a994b278-1f62-11e1-96ac-406186ea4fc5", "hmlgd",
106  NULL, 1, -1, 0
107  };
108 
112 typedef struct
113 {
114  const char* filter;
115  int timeout;
116  const char* actions;
117  /* Boolean flags: */
118  int details;
119  int rcfile;
121 
125 static const omp_get_tasks_opts_t omp_get_tasks_opts_defaults =
126  { "", 0 };
127 
131 typedef struct
132 {
133  const char* actions;
134  const char* task_id;
135  /* Boolean flags: */
136  int details;
137  int rcfile;
139 
143 static const omp_get_task_opts_t omp_get_task_opts_defaults =
144  { };
145 
149 typedef struct
150 {
152  const char* config_id;
153  const char* scanner_id;
154  const char* schedule_id;
155  const char* slave_id;
156  const char* target_id;
157  const char* name;
158  const char* comment;
159  const char* hosts_ordering;
160  const char* observers;
163  /* Preferences */
164  const char* in_assets;
165  const char* max_hosts;
166  const char* max_checks;
167  const char* source_iface;
168  /* Boolean flags: */
169  int alterable;
171 
175 static const omp_create_task_opts_t omp_create_task_opts_defaults =
176  { };
177 
181 typedef struct
182 {
184  const char* ssh_credential_id;
185  const char* smb_credential_id;
186  const char* esxi_credential_id;
187  const char* port_range;
188  const char* name;
189  const char* comment;
190  const char* hosts;
191  const char* exclude_hosts;
192  const char* alive_tests;
193  /* Boolean flags: */
197 
201 static const omp_create_target_opts_t omp_create_target_opts_defaults =
202  { 0 };
203 
207 typedef struct
208 {
209  const char* name;
210  const char* duration;
211  const char* slave_id;
212  int brief;
214 
218 static const omp_get_system_reports_opts_t omp_get_system_reports_opts_defaults =
219  { };
220 
224 typedef struct
225 {
226  const char *name;
227  const char *login;
228  const char *passphrase;
229  const char *private_key;
230  const char *comment;
232 
236 static const omp_create_lsc_credential_opts_t omp_create_lsc_credential_opts_defaults =
237  { };
238 
242 typedef struct
243 {
244  int ultimate;
246 
250 static const omp_delete_opts_t omp_delete_opts_defaults =
251  { 0 };
252 
256 static const omp_delete_opts_t omp_delete_opts_ultimate_defaults =
257  { 1 };
258 
259 int check_response (gnutls_session_t *);
260 
261 int omp_read_create_response (gnutls_session_t*, gchar **);
262 
263 const char *omp_task_status (entity_t status_response);
264 
265 int omp_ping (gnutls_session_t *, int);
266 
267 int omp_authenticate (gnutls_session_t * session, const char *username,
268  const char *password);
269 
271 
272 int omp_create_task (gnutls_session_t *, const char *, const char *,
273  const char *, const char *, gchar **);
274 
275 int omp_create_task_ext (gnutls_session_t *, omp_create_task_opts_t, gchar **);
276 
277 int omp_start_task_report (gnutls_session_t *, const char *, char **);
278 
279 int omp_stop_task (gnutls_session_t *, const char *);
280 
281 int omp_resume_task_report (gnutls_session_t*, const char*, char**);
282 
283 int omp_get_tasks (gnutls_session_t *, const char *, int, int, entity_t *);
284 
285 int omp_get_tasks_ext (gnutls_session_t *, omp_get_tasks_opts_t, entity_t *);
286 
287 int omp_get_task_ext (gnutls_session_t *, omp_get_task_opts_t, entity_t *);
288 
289 int omp_get_targets (gnutls_session_t *, const char *, int, int, entity_t *);
290 
291 int omp_get_report_ext (gnutls_session_t *, omp_get_report_opts_t, entity_t *);
292 
293 int omp_delete_port_list_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
294 
295 int omp_delete_task (gnutls_session_t *, const char *);
296 
297 int omp_delete_task_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
298 
299 int omp_modify_task_file (gnutls_session_t *, const char *, const char *,
300  const void *, gsize);
301 
302 int omp_delete_report (gnutls_session_t*, const char*);
303 
304 int omp_create_target_ext (gnutls_session_t *, omp_create_target_opts_t,
305  gchar**);
306 
307 int omp_delete_target_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
308 
309 int omp_delete_config_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
310 
312  gchar**);
313 
314 int omp_create_lsc_credential (gnutls_session_t *, const char *, const char *,
315  const char *, const char *, gchar **);
316 
317 int omp_create_lsc_credential_key (gnutls_session_t *, const char *,
318  const char *, const char *, const char *,
319  const char *, gchar **);
320 
321 int omp_delete_lsc_credential_ext (gnutls_session_t *, const char *,
323 
324 int omp_get_system_reports (gnutls_session_t *, const char *, int, entity_t *);
325 
326 int omp_get_system_reports_ext (gnutls_session_t *,
328  entity_t *);
329 
330 #if 0
331 {
332 #endif
333 #ifdef __cplusplus
334 }
335 #endif
336 
337 #endif /* not _OPENVAS_LIBRARIES_OMP_H */
int omp_delete_lsc_credential_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a LSC credential.
Definition: omp.c:1707
int timeout
Timeout for OMP response.
Definition: omp.h:74
Struct holding options for omp get_report command.
Definition: omp.h:65
int reverse_lookup_only
Scanner pref reverse_lookup_only.
Definition: omp.h:194
int omp_create_target_ext(gnutls_session_t *, omp_create_target_opts_t, gchar **)
Create a target.
Definition: omp.c:1321
int brief
Brief flag.
Definition: omp.h:212
int rcfile
Ignored. Removed since OMP 6.0.
Definition: omp.h:119
int omp_read_create_response(gnutls_session_t *, gchar **)
Read response status and resource UUID.
Definition: omp.c:680
const char * login
Login.
Definition: omp.h:227
int ultimate
Definition: omp.h:244
const char * sort_order
Definition: omp.h:68
int override_details
If overrides, whether to include details.
Definition: omp.h:94
const char * duration
Duration.
Definition: omp.h:210
const char * task_id
ID of single task to get.
Definition: omp.h:134
const char * name
Name of report.
Definition: omp.h:209
const char * target_id
ID of target.
Definition: omp.h:156
int schedule_periods
Number of periods the schedule must run for.
Definition: omp.h:162
const char * omp_task_status(entity_t status_response)
Get the task status from an OMP GET_TASKS response.
Definition: omp.c:119
int omp_create_task_ext(gnutls_session_t *, omp_create_task_opts_t, gchar **)
Create a task.
Definition: omp.c:342
Struct holding options for omp get_tasks command.
Definition: omp.h:131
const char * hosts_ordering
Order for scanning target hosts.
Definition: omp.h:159
int omp_delete_port_list_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a port list.
Definition: omp.c:1276
char * timezone
Timezone.
Definition: omp.h:81
char * host
Host for asset report.
Definition: omp.h:79
int omp_get_tasks_ext(gnutls_session_t *, omp_get_tasks_opts_t, entity_t *)
Get all tasks (generic version).
Definition: omp.c:963
char * delta_states
Delta states (Changed Gone New Same) to include.
Definition: omp.h:84
char * alert_id
ID of alert.
Definition: omp.h:82
const char * comment
Comment on LSC credential.
Definition: omp.h:230
int overrides
Whether to include overrides in the report.
Definition: omp.h:93
int alterable
Whether the task is alterable.
Definition: omp.h:169
int omp_get_task_ext(gnutls_session_t *, omp_get_task_opts_t, entity_t *)
Get a task (generic version).
Definition: omp.c:900
int omp_create_lsc_credential_ext(gnutls_session_t *, omp_create_lsc_credential_opts_t, gchar **)
Create an LSC credential.
Definition: omp.c:1631
const char * slave_id
ID of the slave to get report from.
Definition: omp.h:211
const char * ssh_credential_id
ID of SSH credential.
Definition: omp.h:184
Struct holding options for omp get_system_reports command.
Definition: omp.h:207
const char * comment
Comment on task.
Definition: omp.h:158
int host_first_result
Skip over results before this result number.
Definition: omp.h:75
Struct holding options for omp get_tasks command.
Definition: omp.h:112
int omp_get_report_ext(gnutls_session_t *, omp_get_report_opts_t, entity_t *)
Get a report (generic version).
Definition: omp.c:1169
array_t * alert_ids
Array of alert IDs.
Definition: omp.h:151
int omp_delete_target_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a target.
Definition: omp.c:1442
array_t * observer_groups
IDs of observer groups.
Definition: omp.h:161
const char * passphrase
Passphrase.
Definition: omp.h:228
XML element.
Definition: xml.h:46
const char * alive_tests
Alive tests.
Definition: omp.h:192
char * type
Type of report.
Definition: omp.h:78
const char * slave_id
ID of task schedule.
Definition: omp.h:155
const char * sort_field
Definition: omp.h:67
const char * esxi_credential_id
ID of ESXi credential.
Definition: omp.h:186
const char * max_hosts
Max hosts preference.
Definition: omp.h:165
char * host_levels
Letter encoded threat level filter, for hosts.
Definition: omp.h:85
int omp_resume_task_report(gnutls_session_t *, const char *, char **)
Resume a task and read the manager response.
Definition: omp.c:756
char * delta_report_id
ID of report to compare single report to.
Definition: omp.h:83
const char * source_iface
Source iface preference.
Definition: omp.h:167
int omp_ping(gnutls_session_t *, int)
"Ping" the manager.
Definition: omp.c:141
const char * hosts
Name of target.
Definition: omp.h:190
int timeout
Timeout for authentication.
Definition: omp.h:45
GPtrArray array_t
Definition: array.h:31
Struct holding options for authentication.
Definition: omp.h:43
int check_response(gnutls_session_t *)
Read response and convert status of response to a return value.
Definition: omp.c:635
int omp_modify_task_file(gnutls_session_t *, const char *, const char *, const void *, gsize)
Modify a file on a task.
Definition: omp.c:1031
int omp_create_task(gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
Create a task given a config and target.
Definition: omp.c:537
int ignore_pagination
Whether to ignore pagination filters.
Definition: omp.h:97
int details
Whether to include overrides in the tasks.
Definition: omp.h:136
int omp_get_system_reports(gnutls_session_t *, const char *, int, entity_t *)
Get system reports.
Definition: omp.c:1733
Struct holding options for omp create_lsc_credential command.
Definition: omp.h:224
char ** severity
[out] Severity class setting.
Definition: omp.h:49
const char * port_range
Port range.
Definition: omp.h:187
const char * actions
Actions argument.
Definition: omp.h:116
char * search_phrase
Search phrase result filter.
Definition: omp.h:86
const char * levels
Result levels to include.
Definition: omp.h:70
const char * actions
Actions argument.
Definition: omp.h:133
int first_result
First result to get.
Definition: omp.h:72
const char * exclude_hosts
Hosts to exclude.
Definition: omp.h:191
int host_max_results
Maximum number of results to return.
Definition: omp.h:76
int timeout
Timeout for OMP response.
Definition: omp.h:115
const char * comment
Comment on target.
Definition: omp.h:189
const char * username
Password.
Definition: omp.h:46
int omp_stop_task(gnutls_session_t *, const char *)
Stop a task and read the manager response.
Definition: omp.c:735
const char * password
Username.
Definition: omp.h:47
int apply_overrides
Whether overrides are applied.
Definition: omp.h:95
int omp_start_task_report(gnutls_session_t *, const char *, char **)
Start a task and read the manager response.
Definition: omp.c:578
char * pos
Position of report from end.
Definition: omp.h:80
Struct holding options for omp create_task command.
Definition: omp.h:149
int details
Whether to include overrides in the tasks.
Definition: omp.h:118
Struct holding options for omp create_target command.
Definition: omp.h:181
int omp_get_targets(gnutls_session_t *, const char *, int, int, entity_t *)
Get a target.
Definition: omp.c:1105
const char * smb_credential_id
ID of SMB credential.
Definition: omp.h:185
const char * scanner_id
ID of task scanner.
Definition: omp.h:153
int ssh_credential_port
Port for SSH access.
Definition: omp.h:183
int omp_delete_task(gnutls_session_t *, const char *)
Delete a task and read the manager response.
Definition: omp.c:1084
const char * in_assets
In assets preference.
Definition: omp.h:164
const char * schedule_id
ID of task schedule.
Definition: omp.h:154
int omp_get_system_reports_ext(gnutls_session_t *, omp_get_system_reports_opts_t, entity_t *)
Get system reports.
Definition: omp.c:1790
const char * name
Name of target.
Definition: omp.h:188
char * min_cvss_base
Minimum CVSS base filter.
Definition: omp.h:88
int autofp
Whether to trust vendor security updates. 0 No, 1 full match, 2 partial.
Definition: omp.h:77
int omp_delete_config_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a config.
Definition: omp.c:1465
int omp_delete_task_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a task and read the manager response.
Definition: omp.c:814
Struct holding options for various omp delete_[...] commands.
Definition: omp.h:242
char ** timezone
[out] Timezone if any, else NULL.
Definition: omp.h:50
int rcfile
Ignored. Removed since OMP 6.0.
Definition: omp.h:137
char ** pw_warning
[out] Password warning, NULL if password is okay.
Definition: omp.h:51
int notes_details
Whether to include details of above.
Definition: omp.h:92
int omp_authenticate_info_ext(gnutls_session_t *, omp_authenticate_info_opts_t)
Authenticate with the manager.
Definition: omp.c:253
const char * max_checks
Max checks preference.
Definition: omp.h:166
char * min_qod
Minimum QoD filter.
Definition: omp.h:89
const char * filter
Filter argument.
Definition: omp.h:114
const char * name
Name of LSC credential.
Definition: omp.h:226
char ** role
[out] Role.
Definition: omp.h:48
int omp_delete_report(gnutls_session_t *, const char *)
Remove a report.
Definition: omp.c:1298
const char * name
Name of task.
Definition: omp.h:157
int max_results
Maximum number of results to return.
Definition: omp.h:73
const char * config_id
ID of config.
Definition: omp.h:152
char * host_search_phrase
Search phrase result filter.
Definition: omp.h:87
int notes
Whether to include associated notes.
Definition: omp.h:91
int reverse_lookup_unify
Scanner pref reverse_lookup_unify.
Definition: omp.h:195
int result_hosts_only
Whether to include only hosts that have results.
Definition: omp.h:96
int omp_get_tasks(gnutls_session_t *, const char *, int, int, entity_t *)
Get the status of a task.
Definition: omp.c:839
const char * report_id
ID of single report to get.
Definition: omp.h:71
int omp_create_lsc_credential(gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
Create an LSC Credential.
Definition: omp.c:1491
const char * private_key
Private key.
Definition: omp.h:229
const char * format_id
ID of required report format.
Definition: omp.h:69
int omp_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: omp.c:1570
int omp_authenticate(gnutls_session_t *session, const char *username, const char *password)
Authenticate with the manager.
Definition: omp.c:197
const char * observers
Comma-separated string of observer users.
Definition: omp.h:160