OpenVAS Libraries  7.0.4
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* actions;
74  /* Boolean flags: */
75  int details;
76  int rcfile;
78 
82 static const omp_get_tasks_opts_t omp_get_tasks_opts_defaults =
83  { };
84 
88 typedef struct
89 {
90  const char* actions;
91  const char* task_id;
92  /* Boolean flags: */
93  int details;
94  int rcfile;
96 
100 static const omp_get_task_opts_t omp_get_task_opts_defaults =
101  { };
102 
108 typedef struct
109 {
110  const char* config_id;
111  const char* target_id;
112  const char* name;
113  const char* comment;
114  const char* max_hosts;
115  const char* max_checks;
117 
121 static const omp_create_task_opts_t omp_create_task_opts_defaults =
122  { };
123 
127 typedef struct
128 {
129  const char* ssh_credential_id;
130  const char* smb_credential_id;
131  const char* port_range;
132  const char* name;
133  const char* comment;
134  const char* hosts;
136 
140 static const omp_create_target_opts_t omp_create_target_opts_defaults =
141  { };
142 
146 typedef struct
147 {
148  const char* name;
149  const char* duration;
150  int brief;
152 
156 static const omp_get_system_reports_opts_t omp_get_system_reports_opts_defaults =
157  { };
158 
162 typedef struct
163 {
164  int ultimate;
166 
170 static const omp_delete_opts_t omp_delete_opts_defaults =
171  { 0 };
172 
176 static const omp_delete_opts_t omp_delete_opts_ultimate_defaults =
177  { 1 };
178 
179 int check_response (gnutls_session_t *);
180 
181 int omp_read_create_response (gnutls_session_t*, gchar **);
182 
183 const char *omp_task_status (entity_t status_response);
184 
185 int omp_ping (gnutls_session_t *, int);
186 
187 int omp_authenticate (gnutls_session_t * session, const char *username,
188  const char *password);
189 
190 int omp_authenticate_info (gnutls_session_t * session, const char *username,
191  const char *, char **, char **, char **);
192 
193 int omp_create_task_rc (gnutls_session_t *, const char *, unsigned int,
194  const char *, const char *, char **);
195 
196 int omp_create_task (gnutls_session_t *, const char *, const char *,
197  const char *, const char *, gchar **);
198 
199 int omp_create_task_ext (gnutls_session_t *, omp_create_task_opts_t, gchar **);
200 
201 int omp_start_task_report (gnutls_session_t *, const char *, char **);
202 
203 int omp_resume_or_start_task_report (gnutls_session_t *, const char *, char **);
204 
205 int omp_resume_or_start_task (gnutls_session_t *, const char *);
206 
207 int omp_stop_task (gnutls_session_t *, const char *);
208 
209 int omp_pause_task (gnutls_session_t*, const char*);
210 
211 int omp_resume_paused_task (gnutls_session_t*, const char*);
212 
213 int omp_resume_stopped_task_report (gnutls_session_t*, const char*, char**);
214 
215 int omp_get_tasks (gnutls_session_t *, const char *, int, int, entity_t *);
216 
217 int omp_get_tasks_ext (gnutls_session_t *, omp_get_tasks_opts_t, entity_t *);
218 
219 int omp_get_task_ext (gnutls_session_t *, omp_get_task_opts_t, entity_t *);
220 
221 int omp_get_targets (gnutls_session_t *, const char *, int, int, entity_t *);
222 
223 int omp_get_report_ext (gnutls_session_t *, omp_get_report_opts_t, entity_t *);
224 
225 int omp_delete_task (gnutls_session_t *, const char *);
226 
227 int omp_delete_task_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
228 
229 int omp_modify_task_file (gnutls_session_t *, const char *, const char *,
230  const void *, gsize);
231 
232 int omp_delete_report (gnutls_session_t*, const char*);
233 
234 int omp_create_target_ext (gnutls_session_t *, omp_create_target_opts_t,
235  gchar**);
236 
237 int omp_delete_target_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
238 
239 int omp_delete_config_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
240 
241 int omp_create_lsc_credential (gnutls_session_t *, const char *, const char *,
242  const char *, const char *, gchar **);
243 
244 int omp_create_lsc_credential_key (gnutls_session_t *, const char *,
245  const char *, const char *, const char *,
246  const char *, const char *, gchar **);
247 
248 int omp_delete_lsc_credential_ext (gnutls_session_t *, const char *,
250 
251 int omp_get_system_reports (gnutls_session_t *, const char *, int, entity_t *);
252 
253 int omp_get_system_reports_ext (gnutls_session_t *,
255  entity_t *);
256 
257 #if 0
258 {
259 #endif
260 #ifdef __cplusplus
261 }
262 #endif
263 
264 #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:1595
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:1315
int brief
Brief flag.
Definition: omp.h:150
int rcfile
If overrides, whether to include details.
Definition: omp.h:76
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:164
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:149
const char * task_id
ID of single task to get.
Definition: omp.h:91
const char * name
Name of report.
Definition: omp.h:148
const char * target_id
ID of target.
Definition: omp.h:111
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:88
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:129
Struct holding options for omp get_system_reports command.
Definition: omp.h:146
const char * comment
Comment on task.
Definition: omp.h:113
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:1228
int omp_delete_target_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a target.
Definition: omp.c:1390
XML element.
Definition: xml.h:46
const char * sort_field
Definition: omp.h:46
const char * max_hosts
Max hosts preference.
Definition: omp.h:114
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:134
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:1091
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:93
int omp_get_system_reports(gnutls_session_t *, const char *, int, entity_t *)
Get system reports.
Definition: omp.c:1621
const char * port_range
Port range.
Definition: omp.h:131
const char * actions
Actions argument.
Definition: omp.h:73
const char * levels
Result levels to include.
Definition: omp.h:49
const char * actions
Actions argument.
Definition: omp.h:90
int first_result
First result to get.
Definition: omp.h:51
const char * comment
Comment on target.
Definition: omp.h:133
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:1522
Struct holding options for omp create_task command.
Definition: omp.h:108
int details
Whether to include overrides in the tasks.
Definition: omp.h:75
Struct holding options for omp create_target command.
Definition: omp.h:127
int omp_get_targets(gnutls_session_t *, const char *, int, int, entity_t *)
Get a target.
Definition: omp.c:1164
const char * smb_credential_id
ID of SMB credential.
Definition: omp.h:130
int omp_delete_task(gnutls_session_t *, const char *)
Delete a task and read the manager response.
Definition: omp.c:1144
int omp_get_system_reports_ext(gnutls_session_t *, omp_get_system_reports_opts_t, entity_t *)
Get system reports.
Definition: omp.c:1678
const char * name
Name of target.
Definition: omp.h:132
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:1413
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:162
int rcfile
If overrides, whether to include details.
Definition: omp.h:94
const char * max_checks
Max checks preference.
Definition: omp.h:115
int omp_delete_report(gnutls_session_t *, const char *)
Remove a report.
Definition: omp.c:1293
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:112
const char * config_id
ID of config.
Definition: omp.h:110
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:1439
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