#include <glib.h>
#include "../base/openvas_hosts.h"
#include "../misc/openvas_server.h"
#include "../omp/xml.h"
#include "osp.h"
Go to the source code of this file.
|
void | osp_connection_close (osp_connection_t *connection) |
|
int | osp_get_version (osp_connection_t *connection, char **s_name, char **s_version, char **d_name, char **d_version, char **p_name, char **p_version) |
|
int | osp_delete_scan (osp_connection_t *connection, const char *scan_id) |
|
int | osp_get_scan (osp_connection_t *connection, const char *scan_id, char **report_xml, int details, char **error) |
|
int | osp_stop_scan (osp_connection_t *connection, const char *scan_id, char **error) |
|
int | osp_start_scan (osp_connection_t *connection, const char *target, const char *ports, GHashTable *options, const char *scan_id, char **error) |
|
const char * | osp_param_type_str (const osp_param_t *param) |
|
int | osp_get_scanner_details (osp_connection_t *connection, char **desc, GSList **params) |
|
osp_param_t * | osp_param_new (void) |
|
const char * | osp_param_id (const osp_param_t *param) |
|
const char * | osp_param_name (const osp_param_t *param) |
|
const char * | osp_param_desc (const osp_param_t *param) |
|
const char * | osp_param_default (const osp_param_t *param) |
|
int | osp_param_mandatory (const osp_param_t *param) |
|
void | osp_param_free (osp_param_t *param) |
|
◆ G_LOG_DOMAIN
#define G_LOG_DOMAIN "lib osp" |
Definition at line 35 of file osp.c.
◆ osp_connection_close()
◆ osp_delete_scan()
Definition at line 240 of file osp.c.
249 ret = osp_send_command (connection, &entity,
"<delete_scan scan_id='%s'/>",
257 if (strcmp (status,
"200"))
const char * entity_attribute(entity_t entity, const char *name)
Get an attribute of an entity.
void free_entity(entity_t entity)
Free an entity, recursively.
◆ osp_get_scan()
int osp_get_scan |
( |
osp_connection_t * |
connection, |
|
|
const char * |
scan_id, |
|
|
char ** |
report_xml, |
|
|
int |
details, |
|
|
char ** |
error |
|
) |
| |
Definition at line 274 of file osp.c.
284 rc = osp_send_command
285 (connection, &entity,
"<get_scans scan_id='%s' details='%d'/>",
286 scan_id, details ? 1 : 0);
290 *error = g_strdup (
"Couldn't send get_scans command to scanner");
301 *error = g_strdup (text);
308 string = g_string_new (
"");
310 *report_xml = g_string_free (
string, FALSE);
const char * entity_attribute(entity_t entity, const char *name)
Get an attribute of an entity.
void print_entity_to_string(entity_t entity, GString *string)
Print an XML entity tree to a GString, appending it if string is not.
entity_t entity_child(entity_t entity, const char *name)
Get a child of an entity.
void free_entity(entity_t entity)
Free an entity, recursively.
◆ osp_get_scanner_details()
int osp_get_scanner_details |
( |
osp_connection_t * |
connection, |
|
|
char ** |
desc, |
|
|
GSList ** |
params |
|
) |
| |
Definition at line 497 of file osp.c.
505 if (osp_send_command (connection, &entity,
"<get_scanner_details/>"))
520 child = entities->data;
532 *params = g_slist_append (*params, param);
osp_param_t * osp_param_new(void)
char * entity_text(entity_t entity)
Get the text an entity.
entities_t entities
Children.
const char * entity_attribute(entity_t entity, const char *name)
Get an attribute of an entity.
entities_t next_entities(entities_t entities)
Return all the entities from an entities_t after the first.
entity_t entity_child(entity_t entity, const char *name)
Get a child of an entity.
void free_entity(entity_t entity)
Free an entity, recursively.
◆ osp_get_version()
int osp_get_version |
( |
osp_connection_t * |
connection, |
|
|
char ** |
s_name, |
|
|
char ** |
s_version, |
|
|
char ** |
d_name, |
|
|
char ** |
d_version, |
|
|
char ** |
p_name, |
|
|
char ** |
p_version |
|
) |
| |
Definition at line 157 of file osp.c.
166 if (osp_send_command (connection, &entity,
"<get_version/>"))
171 goto err_get_version;
174 goto err_get_version;
179 goto err_get_version;
185 goto err_get_version;
188 goto err_get_version;
193 goto err_get_version;
199 goto err_get_version;
202 goto err_get_version;
207 goto err_get_version;
215 g_warning (
"Erroneous OSP <get_version/> response.");
char * entity_text(entity_t entity)
Get the text an entity.
entity_t entity_child(entity_t entity, const char *name)
Get a child of an entity.
void free_entity(entity_t entity)
Free an entity, recursively.
◆ osp_param_default()
const char* osp_param_default |
( |
const osp_param_t * |
param | ) |
|
◆ osp_param_desc()
const char* osp_param_desc |
( |
const osp_param_t * |
param | ) |
|
◆ osp_param_free()
◆ osp_param_id()
◆ osp_param_mandatory()
◆ osp_param_name()
const char* osp_param_name |
( |
const osp_param_t * |
param | ) |
|
◆ osp_param_new()
◆ osp_param_type_str()
const char* osp_param_type_str |
( |
const osp_param_t * |
param | ) |
|
◆ osp_start_scan()
int osp_start_scan |
( |
osp_connection_t * |
connection, |
|
|
const char * |
target, |
|
|
const char * |
ports, |
|
|
GHashTable * |
options, |
|
|
const char * |
scan_id, |
|
|
char ** |
error |
|
) |
| |
Definition at line 386 of file osp.c.
391 char *options_str = NULL;
399 g_hash_table_foreach (options, option_concat_as_xml, &options_str);
401 rc = osp_send_command (connection, &entity,
402 "<start_scan target='%s' ports='%s' scan_id='%s'>" 403 "<scanner_params>%s</scanner_params></start_scan>",
404 target, ports ?:
"", scan_id ?:
"", options_str ?:
"");
405 g_free (options_str);
409 *error = g_strdup (
"Couldn't send start_scan command to scanner");
425 *error = g_strdup (text);
const char * entity_attribute(entity_t entity, const char *name)
Get an attribute of an entity.
void free_entity(entity_t entity)
Free an entity, recursively.
◆ osp_stop_scan()
int osp_stop_scan |
( |
osp_connection_t * |
connection, |
|
|
const char * |
scan_id, |
|
|
char ** |
error |
|
) |
| |
Definition at line 324 of file osp.c.
331 rc = osp_send_command
332 (connection, &entity,
"<stop_scan scan_id='%s'/>", scan_id);
336 *error = g_strdup (
"Couldn't send stop_scan command to scanner");
352 *error = g_strdup (text);
const char * entity_attribute(entity_t entity, const char *name)
Get an attribute of an entity.
void free_entity(entity_t entity)
Free an entity, recursively.