OpenVAS Libraries  7.0.9
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 modify
12  * it under the terms of the GNU General Public License version 2,
13  * or, at your option, any later version as published by the Free
14  * Software Foundation
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 "xml.h"
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #if 0
35 }
36 #endif
37 #endif
38 
44 typedef struct
45 {
46  const char* sort_field;
47  const char* sort_order;
48  const char* format_id;
49  const char* levels;
50  const char* report_id;
52  int autofp;
53  /* Boolean flags: */
54  int overrides;
59 
63 static const omp_get_report_opts_t omp_get_report_opts_defaults =
64  {
65  "ROWID", "ascending", "a994b278-1f62-11e1-96ac-406186ea4fc5", "hmlgd"
66  };
67 
71 typedef struct
72 {
73  const char* filter;
74  const char* actions;
75  /* Boolean flags: */
76  int details;
77  int rcfile;
79 
83 static const omp_get_tasks_opts_t omp_get_tasks_opts_defaults =
84  { "" };
85 
89 typedef struct
90 {
91  const char* actions;
92  const char* task_id;
93  /* Boolean flags: */
94  int details;
95  int rcfile;
97 
101 static const omp_get_task_opts_t omp_get_task_opts_defaults =
102  { };
103 
109 typedef struct
110 {
111  const char* config_id;
112  const char* target_id;
113  const char* name;
114  const char* comment;
115  const char* max_hosts;
116  const char* max_checks;
118 
122 static const omp_create_task_opts_t omp_create_task_opts_defaults =
123  { };
124 
128 typedef struct
129 {
131  const char* ssh_credential_id;
132  const char* smb_credential_id;
133  const char* port_range;
134  const char* name;
135  const char* comment;
136  const char* hosts;
138 
142 static const omp_create_target_opts_t omp_create_target_opts_defaults =
143  { 0 };
144 
148 typedef struct
149 {
150  const char* name;
151  const char* duration;
152  int brief;
154 
158 static const omp_get_system_reports_opts_t omp_get_system_reports_opts_defaults =
159  { };
160 
164 typedef struct
165 {
166  int ultimate;
168 
172 static const omp_delete_opts_t omp_delete_opts_defaults =
173  { 0 };
174 
178 static const omp_delete_opts_t omp_delete_opts_ultimate_defaults =
179  { 1 };
180 
181 int check_response (gnutls_session_t *);
182 
183 int omp_read_create_response (gnutls_session_t*, gchar **);
184 
185 const char *omp_task_status (entity_t status_response);
186 
187 int omp_ping (gnutls_session_t *, int);
188 
189 int omp_authenticate (gnutls_session_t * session, const char *username,
190  const char *password);
191 
192 int omp_authenticate_info (gnutls_session_t * session, const char *username,
193  const char *, char **, char **, char **);
194 
195 int omp_create_task_rc (gnutls_session_t *, const char *, unsigned int,
196  const char *, const char *, char **);
197 
198 int omp_create_task (gnutls_session_t *, const char *, const char *,
199  const char *, const char *, gchar **);
200 
201 int omp_create_task_ext (gnutls_session_t *, omp_create_task_opts_t, gchar **);
202 
203 int omp_start_task_report (gnutls_session_t *, const char *, char **);
204 
205 int omp_resume_or_start_task_report (gnutls_session_t *, const char *, char **);
206 
207 int omp_resume_or_start_task (gnutls_session_t *, const char *);
208 
209 int omp_stop_task (gnutls_session_t *, const char *);
210 
211 int omp_pause_task (gnutls_session_t*, const char*);
212 
213 int omp_resume_paused_task (gnutls_session_t*, const char*);
214 
215 int omp_resume_stopped_task_report (gnutls_session_t*, const char*, char**);
216 
217 int omp_get_tasks (gnutls_session_t *, const char *, int, int, entity_t *);
218 
219 int omp_get_tasks_ext (gnutls_session_t *, omp_get_tasks_opts_t, entity_t *);
220 
221 int omp_get_task_ext (gnutls_session_t *, omp_get_task_opts_t, entity_t *);
222 
223 int omp_get_targets (gnutls_session_t *, const char *, int, int, entity_t *);
224 
225 int omp_get_report_ext (gnutls_session_t *, omp_get_report_opts_t, entity_t *);
226 
227 int omp_delete_task (gnutls_session_t *, const char *);
228 
229 int omp_delete_task_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
230 
231 int omp_modify_task_file (gnutls_session_t *, const char *, const char *,
232  const void *, gsize);
233 
234 int omp_delete_report (gnutls_session_t*, const char*);
235 
236 int omp_create_target_ext (gnutls_session_t *, omp_create_target_opts_t,
237  gchar**);
238 
239 int omp_delete_target_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
240 
241 int omp_delete_config_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
242 
243 int omp_create_lsc_credential (gnutls_session_t *, const char *, const char *,
244  const char *, const char *, gchar **);
245 
246 int omp_create_lsc_credential_key (gnutls_session_t *, const char *,
247  const char *, const char *, const char *,
248  const char *, const char *, gchar **);
249 
250 int omp_delete_lsc_credential_ext (gnutls_session_t *, const char *,
252 
253 int omp_get_system_reports (gnutls_session_t *, const char *, int, entity_t *);
254 
255 int omp_get_system_reports_ext (gnutls_session_t *,
257  entity_t *);
258 
259 #if 0
260 {
261 #endif
262 #ifdef __cplusplus
263 }
264 #endif
265 
266 #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:1602
Struct holding options for omp get_report command.
Definition: omp.h:44
int omp_create_target_ext(gnutls_session_t *, omp_create_target_opts_t, gchar **)
Create a target.
Definition: omp.c:1313
int brief
Brief flag.
Definition: omp.h:152
int rcfile
If overrides, whether to include details.
Definition: omp.h:77
int omp_resume_paused_task(gnutls_session_t *, const char *)
Resume a paused task and read the manager response.
Definition: omp.c:795
int omp_read_create_response(gnutls_session_t *, gchar **)
Read response status and resource UUID.
Definition: omp.c:700
int omp_authenticate_info(gnutls_session_t *session, const char *username, const char *, char **, char **, char **)
Authenticate with the manager.
Definition: omp.c:250
int ultimate
Definition: omp.h:166
const char * sort_order
Definition: omp.h:47
int override_details
If overrides, whether to include details.
Definition: omp.h:55
const char * duration
Duration.
Definition: omp.h:151
const char * task_id
ID of single task to get.
Definition: omp.h:92
const char * name
Name of report.
Definition: omp.h:150
const char * target_id
ID of target.
Definition: omp.h:112
const char * omp_task_status(entity_t status_response)
Get the task status from an OMP GET_TASKS response.
Definition: omp.c:114
int omp_create_task_ext(gnutls_session_t *, omp_create_task_opts_t, gchar **)
Create a task.
Definition: omp.c:329
Struct holding options for omp get_tasks command.
Definition: omp.h:89
int omp_get_tasks_ext(gnutls_session_t *, omp_get_tasks_opts_t, entity_t *)
Get all tasks (generic version).
Definition: omp.c:1028
int omp_resume_stopped_task_report(gnutls_session_t *, const char *, char **)
Resume a stopped task and read the manager response.
Definition: omp.c:816
int overrides
Whether to include overrides in the report.
Definition: omp.h:54
int omp_get_task_ext(gnutls_session_t *, omp_get_task_opts_t, entity_t *)
Get a task (generic version).
Definition: omp.c:963
const char * ssh_credential_id
ID of SSH credential.
Definition: omp.h:131
Struct holding options for omp get_system_reports command.
Definition: omp.h:148
const char * comment
Comment on task.
Definition: omp.h:114
Struct holding options for omp get_tasks command.
Definition: omp.h:71
int omp_get_report_ext(gnutls_session_t *, omp_get_report_opts_t, entity_t *)
Get a report (generic version).
Definition: omp.c:1226
int omp_delete_target_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a target.
Definition: omp.c:1397
XML element.
Definition: xml.h:46
const char * sort_field
Definition: omp.h:46
const char * max_hosts
Max hosts preference.
Definition: omp.h:115
int omp_pause_task(gnutls_session_t *, const char *)
Pause a task and read the manager response.
Definition: omp.c:775
int omp_ping(gnutls_session_t *, int)
"Ping" the manager.
Definition: omp.c:136
const char * hosts
Name of target.
Definition: omp.h:136
int check_response(gnutls_session_t *)
Read response and convert status of response to a return value.
Definition: omp.c:655
int omp_modify_task_file(gnutls_session_t *, const char *, const char *, const void *, gsize)
Modify a file on a task.
Definition: omp.c:1089
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:418
int details
Whether to include overrides in the tasks.
Definition: omp.h:94
int omp_get_system_reports(gnutls_session_t *, const char *, int, entity_t *)
Get system reports.
Definition: omp.c:1628
const char * port_range
Port range.
Definition: omp.h:133
const char * actions
Actions argument.
Definition: omp.h:74
const char * levels
Result levels to include.
Definition: omp.h:49
const char * actions
Actions argument.
Definition: omp.h:91
int first_result
First result to get.
Definition: omp.h:51
const char * comment
Comment on target.
Definition: omp.h:135
int omp_create_task_rc(gnutls_session_t *, const char *, unsigned int, const char *, const char *, char **)
Create a task, given the task description as an RC file.
Definition: omp.c:467
int omp_stop_task(gnutls_session_t *, const char *)
Stop a task and read the manager response.
Definition: omp.c:755
int apply_overrides
Whether overrides are applied.
Definition: omp.h:56
int omp_start_task_report(gnutls_session_t *, const char *, char **)
Start a task and read the manager response.
Definition: omp.c:526
int omp_create_lsc_credential_key(gnutls_session_t *, const char *, const char *, const char *, const char *, const char *, const char *, gchar **)
Create an LSC Credential with a key.
Definition: omp.c:1529
Struct holding options for omp create_task command.
Definition: omp.h:109
int details
Whether to include overrides in the tasks.
Definition: omp.h:76
Struct holding options for omp create_target command.
Definition: omp.h:128
int omp_get_targets(gnutls_session_t *, const char *, int, int, entity_t *)
Get a target.
Definition: omp.c:1162
const char * smb_credential_id
ID of SMB credential.
Definition: omp.h:132
int ssh_credential_port
Port for SSH access.
Definition: omp.h:130
int omp_delete_task(gnutls_session_t *, const char *)
Delete a task and read the manager response.
Definition: omp.c:1142
int omp_get_system_reports_ext(gnutls_session_t *, omp_get_system_reports_opts_t, entity_t *)
Get system reports.
Definition: omp.c:1685
const char * name
Name of target.
Definition: omp.h:134
int autofp
Whether to trust vendor security updates. 0 No, 1 full match, 2 partial.
Definition: omp.h:52
int omp_delete_config_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a config.
Definition: omp.c:1420
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:874
Struct holding options for various omp delete_[...] commands.
Definition: omp.h:164
int rcfile
If overrides, whether to include details.
Definition: omp.h:95
const char * max_checks
Max checks preference.
Definition: omp.h:116
const char * filter
Filter argument.
Definition: omp.h:73
int omp_delete_report(gnutls_session_t *, const char *)
Remove a report.
Definition: omp.c:1291
int omp_resume_or_start_task_report(gnutls_session_t *, const char *, char **)
Resume or start a task and read the manager response.
Definition: omp.c:584
const char * name
Name of task.
Definition: omp.h:113
const char * config_id
ID of config.
Definition: omp.h:111
int omp_resume_or_start_task(gnutls_session_t *, const char *)
Resume or start a task and read the manager response.
Definition: omp.c:641
int result_hosts_only
Whether to include only hosts that have results.
Definition: omp.h:57
int omp_get_tasks(gnutls_session_t *, const char *, int, int, entity_t *)
Get the status of a task.
Definition: omp.c:899
const char * report_id
ID of single report to get.
Definition: omp.h:50
int omp_create_lsc_credential(gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
Create an LSC Credential.
Definition: omp.c:1446
const char * format_id
ID of required report format.
Definition: omp.h:48
int omp_authenticate(gnutls_session_t *session, const char *username, const char *password)
Authenticate with the manager.
Definition: omp.c:192