Greenbone Vulnerability Management Libraries 22.32.0
gmp.h File Reference

API for Greenbone Management Protocol communication. More...

#include "../base/array.h"
#include "../util/serverutils.h"
#include "../util/xmlutils.h"
#include <glib.h>
#include <glib/gtypes.h>
#include <gnutls/gnutls.h>
#include <stddef.h>
Include dependency graph for gmp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gmp_authenticate_info_opts_t
 Struct holding options for authentication. More...
struct  gmp_get_report_opts_t
 Struct holding options for gmp get_report command. More...
struct  gmp_get_tasks_opts_t
 Struct holding options for gmp get_tasks command. More...
struct  gmp_get_task_opts_t
 Struct holding options for gmp get_tasks command. More...
struct  gmp_create_task_opts_t
 Struct holding options for gmp create_task command. More...
struct  gmp_create_target_opts_t
 Struct holding options for gmp create_target command. More...
struct  gmp_get_system_reports_opts_t
 Struct holding options for gmp get_system_reports command. More...
struct  gmp_create_lsc_credential_opts_t
 Struct holding options for gmp create_lsc_credential command. More...
struct  gmp_delete_opts_t
 Struct holding options for various gmp delete_[...] commands. More...
struct  gmp_start_task_opts_t
 Struct holding options for gmp start_task command. More...

Functions

int gmp_read_create_response (gnutls_session_t *, gchar **)
 Read response status and resource UUID.
const char * gmp_task_status (entity_t status_response)
 Get the task status from a GMP GET_TASKS response.
int gmp_ping (gnutls_session_t *, int)
 "Ping" the manager.
int gmp_ping_c (gvm_connection_t *, int, gchar **)
 "Ping" the manager.
int gmp_authenticate (gnutls_session_t *session, const char *username, const char *password)
 Authenticate with the manager.
int gmp_authenticate_info_ext (gnutls_session_t *, gmp_authenticate_info_opts_t)
 Authenticate with the manager.
int gmp_authenticate_info_ext_c (gvm_connection_t *, gmp_authenticate_info_opts_t)
 Authenticate with the manager.
int gmp_create_task (gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
 Create a task given a config and target.
int gmp_create_task_ext (gnutls_session_t *, gmp_create_task_opts_t, gchar **)
 Create a task.
int gmp_start_task_report (gnutls_session_t *, const char *, char **)
 Start a task and read the manager response.
int gmp_start_task_report_c (gvm_connection_t *, const char *, char **)
 Start a task and read the manager response.
int gmp_start_task_ext_c (gvm_connection_t *, gmp_start_task_opts_t)
 Start a task and read the manager response.
int gmp_stop_task (gnutls_session_t *, const char *)
 Stop a task and read the manager response.
int gmp_stop_task_c (gvm_connection_t *, const char *)
 Stop a task and read the manager response.
int gmp_resume_task_report (gnutls_session_t *, const char *, char **)
 Resume a task and read the manager response.
int gmp_resume_task_report_c (gvm_connection_t *, const char *, char **)
 Resume a task and read the manager response.
int gmp_get_tasks (gnutls_session_t *, const char *, int, int, entity_t *)
 Get the status of a task.
int gmp_get_tasks_ext (gnutls_session_t *, gmp_get_tasks_opts_t, entity_t *)
 Get all tasks (generic version).
int gmp_get_task_ext (gnutls_session_t *, gmp_get_task_opts_t, entity_t *)
 Get a task (generic version).
int gmp_get_targets (gnutls_session_t *, const char *, int, int, entity_t *)
 Get a target.
int gmp_get_report_ext (gnutls_session_t *, gmp_get_report_opts_t, entity_t *)
 Get a report (generic version).
int gmp_delete_port_list_ext (gnutls_session_t *, const char *, gmp_delete_opts_t)
 Delete a port list.
int gmp_delete_task (gnutls_session_t *, const char *)
 Delete a task and read the manager response.
int gmp_delete_task_ext (gnutls_session_t *, const char *, gmp_delete_opts_t)
 Delete a task and read the manager response.
int gmp_modify_task_file (gnutls_session_t *, const char *, const char *, const void *, gsize)
 Modify a file on a task.
int gmp_delete_report (gnutls_session_t *, const char *)
 Remove a report.
int gmp_create_target_ext (gnutls_session_t *, gmp_create_target_opts_t, gchar **)
 Create a target.
int gmp_delete_target_ext (gnutls_session_t *, const char *, gmp_delete_opts_t)
 Delete a target.
int gmp_delete_config_ext (gnutls_session_t *, const char *, gmp_delete_opts_t)
 Delete a config.
int gmp_create_lsc_credential_ext (gnutls_session_t *, gmp_create_lsc_credential_opts_t, gchar **)
 Create an LSC credential.
int gmp_create_lsc_credential (gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
 Create an LSC Credential.
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.
int gmp_delete_lsc_credential_ext (gnutls_session_t *, const char *, gmp_delete_opts_t)
 Delete a LSC credential.
int gmp_get_system_reports (gnutls_session_t *, const char *, int, entity_t *)
 Get system reports.
int gmp_get_system_reports_ext (gnutls_session_t *, gmp_get_system_reports_opts_t, entity_t *)
 Get system reports.

Variables

static const gmp_authenticate_info_opts_t gmp_authenticate_info_opts_defaults
 Sensible default values for gmp_authenticate_info_opts_t.
static const gmp_get_report_opts_t gmp_get_report_opts_defaults
 Sensible default values for gmp_get_report_opts_t.
static const gmp_get_tasks_opts_t gmp_get_tasks_opts_defaults
 Sensible default values for gmp_get_tasks_opts_t.
static const gmp_get_task_opts_t gmp_get_task_opts_defaults
 Sensible default values for gmp_get_tasks_opts_t.
static const gmp_create_task_opts_t gmp_create_task_opts_defaults
 Sensible default values for gmp_get_report_opts_t.
static const gmp_create_target_opts_t gmp_create_target_opts_defaults
 Sensible default values for gmp_get_report_opts_t.
static const gmp_get_system_reports_opts_t gmp_get_system_reports_opts_defaults = {NULL, NULL, NULL, NULL, NULL, 0}
 Sensible default values for gmp_get_report_opts_t.
static const gmp_create_lsc_credential_opts_t gmp_create_lsc_credential_opts_defaults
 Sensible default values for gmp_create_lsc_credential_opts_t.
static const gmp_delete_opts_t gmp_delete_opts_defaults = {0}
 Sensible default values for gmp_get_report_opts_t.
static const gmp_delete_opts_t gmp_delete_opts_ultimate_defaults = {1}
 Default values for gmp_get_report_opts_t for ultimate deletion.
static const gmp_start_task_opts_t gmp_start_task_opts_defaults = {NULL}

Detailed Description

API for Greenbone Management Protocol communication.

Definition in file gmp.h.

Function Documentation

◆ gmp_authenticate()

int gmp_authenticate ( gnutls_session_t * session,
const char * username,
const char * password )

Authenticate with the manager.

Parameters
[in]sessionPointer to GNUTLS session.
[in]usernameUsername.
[in]passwordPassword.
Returns
0 on success, 1 if manager closed connection, 2 if auth failed, -1 on error.

Definition at line 321 of file gmp.c.

323{
324 entity_t entity;
325 int ret;
326
327 /* Send the auth request. */
328 ret = gvm_server_sendf_xml_quiet (session,
329 "<authenticate><credentials>"
330 "<username>%s</username>"
331 "<password>%s</password>"
332 "</credentials></authenticate>",
333 username ? username : "",
334 password ? password : "");
335 if (ret)
336 return ret;
337
338 /* Read the response. */
339
340 entity = NULL;
341 ret = gmp_check_response (session, &entity);
342 if (ret == 0)
343 {
344 free_entity (entity);
345 return ret;
346 }
347 else if (ret == -1)
348 return ret;
349 return 2;
350}
static int gmp_check_response(gnutls_session_t *session, entity_t *entity)
Read response and convert status of response to a return value.
Definition gmp.c:70
int gvm_server_sendf_xml_quiet(gnutls_session_t *session, const char *format,...)
Format and send an XML string to the server.
void free_entity(entity_t entity)
Free an entity, recursively.
Definition xmlutils.c:115
struct entity_s * entity_t
Definition xmlutils.h:58

References free_entity(), gmp_check_response(), and gvm_server_sendf_xml_quiet().

Here is the call graph for this function:

◆ gmp_authenticate_info_ext()

int gmp_authenticate_info_ext ( gnutls_session_t * session,
gmp_authenticate_info_opts_t opts )

Authenticate with the manager.

Parameters
[in]sessionPointer to GNUTLS session.
[in,out]optsIn: Struct containing the options to apply. Out: Additional account information if authentication was successful.
Returns
0 on success, 1 if manager closed connection, 2 if auth failed, 3 on timeout, -1 on error.

Definition at line 364 of file gmp.c.

366{
367 entity_t entity;
368 const char *status;
369 char first;
370 int ret;
371
372 *(opts.timezone) = NULL;
373
374 /* Send the auth request. */
375
376 ret = gvm_server_sendf_xml_quiet (session,
377 "<authenticate><credentials>"
378 "<username>%s</username>"
379 "<password>%s</password>"
380 "</credentials></authenticate>",
381 opts.username, opts.password);
382 if (ret)
383 return ret;
384
385 /* Read the response. */
386
387 entity = NULL;
388 switch (try_read_entity (session, opts.timeout, &entity))
389 {
390 case 0:
391 break;
392 case -4:
393 return 3;
394 default:
395 return -1;
396 }
397
398 /* Check the response. */
399
400 status = entity_attribute (entity, "status");
401 if (status == NULL)
402 {
403 free_entity (entity);
404 return -1;
405 }
406 if (strlen (status) == 0)
407 {
408 free_entity (entity);
409 return -1;
410 }
411 first = status[0];
412 if (first == '2')
413 {
414 entity_t timezone_entity, role_entity, pw_warn_entity;
415 /* Get the extra info. */
416 timezone_entity = entity_child (entity, "timezone");
417 if (timezone_entity)
418 *opts.timezone = g_strdup (entity_text (timezone_entity));
419 role_entity = entity_child (entity, "role");
420 if (role_entity)
421 *opts.role = g_strdup (entity_text (role_entity));
422 pw_warn_entity = entity_child (entity, "password_warning");
423 if (pw_warn_entity)
424 *(opts.pw_warning) = g_strdup (entity_text (pw_warn_entity));
425 else
426 *(opts.pw_warning) = NULL;
427
428 free_entity (entity);
429 return 0;
430 }
431 free_entity (entity);
432 return 2;
433}
const char * password
Username.
Definition gmp.h:30
int timeout
Timeout for authentication.
Definition gmp.h:28
char ** pw_warning
[out] Password warning, NULL if password is okay.
Definition gmp.h:33
char ** timezone
[out] Timezone if any, else NULL.
Definition gmp.h:32
const char * username
Password.
Definition gmp.h:29
char ** role
[out] Role.
Definition gmp.h:31
const char * entity_attribute(entity_t entity, const char *name)
Get an attribute of an entity.
Definition xmlutils.c:216
char * entity_text(entity_t entity)
Get the text an entity.
Definition xmlutils.c:145
int try_read_entity(gnutls_session_t *session, int timeout, entity_t *entity)
Try read an XML entity tree from the manager.
Definition xmlutils.c:1436
entity_t entity_child(entity_t entity, const char *name)
Get a child of an entity.
Definition xmlutils.c:193

References entity_attribute(), entity_child(), entity_text(), free_entity(), gvm_server_sendf_xml_quiet(), gmp_authenticate_info_opts_t::password, gmp_authenticate_info_opts_t::pw_warning, gmp_authenticate_info_opts_t::role, gmp_authenticate_info_opts_t::timeout, gmp_authenticate_info_opts_t::timezone, try_read_entity(), and gmp_authenticate_info_opts_t::username.

Here is the call graph for this function:

◆ gmp_authenticate_info_ext_c()

int gmp_authenticate_info_ext_c ( gvm_connection_t * connection,
gmp_authenticate_info_opts_t opts )

Authenticate with the manager.

Parameters
[in]connectionConnection
[in]optsStruct containing the options to apply.
Returns
0 on success, 1 if manager closed connection, 2 if auth failed, 3 on timeout, -1 on error.

Definition at line 445 of file gmp.c.

447{
448 entity_t entity;
449 const char *status;
450 char first;
451 int ret;
452
453 if (opts.timezone)
454 *(opts.timezone) = NULL;
455
456 /* Send the auth request. */
457
458 ret = gvm_connection_sendf_xml_quiet (connection,
459 "<authenticate>"
460 "<credentials>"
461 "<username>%s</username>"
462 "<password>%s</password>"
463 "</credentials>"
464 "</authenticate>",
465 opts.username, opts.password);
466 if (ret)
467 return ret;
468
469 /* Read the response. */
470
471 entity = NULL;
472 switch (try_read_entity_c (connection, opts.timeout, &entity))
473 {
474 case 0:
475 break;
476 case -4:
477 return 3;
478 default:
479 return -1;
480 }
481
482 /* Check the response. */
483
484 status = entity_attribute (entity, "status");
485 if (status == NULL)
486 {
487 free_entity (entity);
488 return -1;
489 }
490 if (strlen (status) == 0)
491 {
492 free_entity (entity);
493 return -1;
494 }
495 first = status[0];
496 if (first == '2')
497 {
498 entity_t timezone_entity, role_entity;
499 /* Get the extra info. */
500 timezone_entity = entity_child (entity, "timezone");
501 if (timezone_entity && opts.timezone)
502 *opts.timezone = g_strdup (entity_text (timezone_entity));
503 role_entity = entity_child (entity, "role");
504 if (role_entity && opts.role)
505 *opts.role = g_strdup (entity_text (role_entity));
506 if (opts.pw_warning)
507 {
508 entity_t pw_warn_entity;
509 pw_warn_entity = entity_child (entity, "password_warning");
510 if (pw_warn_entity)
511 *(opts.pw_warning) = g_strdup (entity_text (pw_warn_entity));
512 else
513 *(opts.pw_warning) = NULL;
514 }
515
516 free_entity (entity);
517 return 0;
518 }
519 free_entity (entity);
520 return 2;
521}
int gvm_connection_sendf_xml_quiet(gvm_connection_t *connection, const char *format,...)
Format and send an XML string to the server.
int try_read_entity_c(gvm_connection_t *connection, int timeout, entity_t *entity)
Try read an XML entity tree from the manager.
Definition xmlutils.c:1452

References entity_attribute(), entity_child(), entity_text(), free_entity(), gvm_connection_sendf_xml_quiet(), gmp_authenticate_info_opts_t::password, gmp_authenticate_info_opts_t::pw_warning, gmp_authenticate_info_opts_t::role, gmp_authenticate_info_opts_t::timeout, gmp_authenticate_info_opts_t::timezone, try_read_entity_c(), and gmp_authenticate_info_opts_t::username.

Here is the call graph for this function:

◆ gmp_create_lsc_credential()

int gmp_create_lsc_credential ( gnutls_session_t * session,
const char * name,
const char * login,
const char * password,
const char * comment,
gchar ** uuid )

Create an LSC Credential.

Parameters
[in]sessionPointer to GNUTLS session.
[in]nameName of LSC Credential.
[in]loginLogin associated with name.
[in]passwordPassword, or NULL for autogenerated credentials.
[in]commentLSC Credential comment.
[out]uuidEither NULL or address for UUID of created credential.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1724 of file gmp.c.

1727{
1728 int ret;
1729
1730 if (password)
1731 {
1732 if (comment)
1733 ret = gvm_server_sendf_xml_quiet (session,
1734 "<create_credential>"
1735 "<name>%s</name>"
1736 "<login>%s</login>"
1737 "<password>%s</password>"
1738 "<comment>%s</comment>"
1739 "</create_credential>",
1740 name, login, password, comment);
1741 else
1742 ret = gvm_server_sendf_xml_quiet (session,
1743 "<create_credential>"
1744 "<name>%s</name>"
1745 "<login>%s</login>"
1746 "<password>%s</password>"
1747 "</create_credential>",
1748 name, login, password);
1749 }
1750 else
1751 {
1752 if (comment)
1753 ret = gvm_server_sendf_xml (session,
1754 "<create_credential>"
1755 "<name>%s</name>"
1756 "<login>%s</login>"
1757 "<comment>%s</comment>"
1758 "</create_credential>",
1759 name, login, comment);
1760 else
1761 ret = gvm_server_sendf_xml (session,
1762 "<create_credential>"
1763 "<name>%s</name>"
1764 "<login>%s</login>"
1765 "</create_credential>",
1766 name, login);
1767 }
1768 if (ret)
1769 return -1;
1770
1771 ret = gmp_read_create_response (session, uuid);
1772 if (ret == 201)
1773 return 0;
1774 return ret;
1775}
int gmp_read_create_response(gnutls_session_t *session, gchar **uuid)
Read response status and resource UUID.
Definition gmp.c:888
int gvm_server_sendf_xml(gnutls_session_t *session, const char *format,...)
Format and send an XML string to the server.

References gmp_read_create_response(), gvm_server_sendf_xml(), and gvm_server_sendf_xml_quiet().

Here is the call graph for this function:

◆ gmp_create_lsc_credential_ext()

int gmp_create_lsc_credential_ext ( gnutls_session_t * session,
gmp_create_lsc_credential_opts_t opts,
gchar ** id )

Create an LSC credential.

Parameters
[in]sessionPointer to GNUTLS session.
[in]optsStruct containing the options to apply.
[out]idPointer for newly allocated ID of new LSC credential, or NULL. Only set on successful return.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1845 of file gmp.c.

1848{
1849 gchar *comment, *pass, *start, *snmp_elems;
1850 int ret;
1851
1852 /* Create the GMP request. */
1853
1854 if (opts.login == NULL)
1855 return -1;
1856
1857 start =
1858 g_markup_printf_escaped ("<create_credential>"
1859 "<name>%s</name>"
1860 "<login>%s</login>",
1861 opts.name ? opts.name : "unnamed", opts.login);
1862
1863 if (opts.comment)
1864 comment = g_markup_printf_escaped ("<comment>"
1865 "%s"
1866 "</comment>",
1867 opts.comment);
1868 else
1869 comment = NULL;
1870
1871 if (opts.private_key)
1872 pass = g_markup_printf_escaped ("<key>"
1873 "<phrase>%s</phrase>"
1874 "<private>%s</private>"
1875 "</key>",
1876 opts.passphrase ? opts.passphrase : "",
1877 opts.private_key);
1878 else
1879 {
1880 if (opts.passphrase)
1881 pass = g_markup_printf_escaped ("<password>"
1882 "%s"
1883 "</password>",
1884 opts.passphrase);
1885 else
1886 pass = NULL;
1887 }
1888
1889 if (opts.community && opts.auth_algorithm && opts.privacy_password
1890 && opts.privacy_algorithm)
1891 snmp_elems =
1892 g_markup_printf_escaped ("<community>"
1893 "%s"
1894 "</community>"
1895 "<auth_algorithm>"
1896 "%s"
1897 "</auth_algorithm>"
1898 "<privacy>"
1899 "<password>%s</password>"
1900 "<algorithm>%s</algorithm>"
1901 "</privacy>",
1902 opts.community, opts.auth_algorithm,
1904 else
1905 snmp_elems = NULL;
1906
1907 /* Send the request. */
1908
1909 ret = gvm_server_sendf (session, "%s%s%s%s</create_credential>", start,
1910 comment ? comment : "", pass ? pass : "",
1911 snmp_elems ? snmp_elems : "");
1912
1913 g_free (start);
1914 g_free (comment);
1915 g_free (pass);
1916 if (ret)
1917 return -1;
1918
1919 /* Read the response. */
1920
1921 ret = gmp_read_create_response (session, id);
1922 if (ret == 201)
1923 return 0;
1924 return ret;
1925}
int gvm_server_sendf(gnutls_session_t *session, const char *format,...)
Format and send a string to the server.
const char * privacy_password
SNMP privacy password.
Definition gmp.h:247
const char * privacy_algorithm
SNMP privacy algorithm.
Definition gmp.h:248
const char * login
Login.
Definition gmp.h:243
const char * community
SNMP community.
Definition gmp.h:242
const char * passphrase
Passphrase.
Definition gmp.h:244
const char * comment
Comment on LSC credential.
Definition gmp.h:249
const char * private_key
Private key.
Definition gmp.h:245
const char * auth_algorithm
SNMP authentication algorithm.
Definition gmp.h:246
const char * name
Name of LSC credential.
Definition gmp.h:241

References gmp_create_lsc_credential_opts_t::auth_algorithm, gmp_create_lsc_credential_opts_t::comment, gmp_create_lsc_credential_opts_t::community, gmp_read_create_response(), gvm_server_sendf(), gmp_create_lsc_credential_opts_t::login, gmp_create_lsc_credential_opts_t::name, gmp_create_lsc_credential_opts_t::passphrase, gmp_create_lsc_credential_opts_t::privacy_algorithm, gmp_create_lsc_credential_opts_t::privacy_password, and gmp_create_lsc_credential_opts_t::private_key.

Here is the call graph for this function:

◆ gmp_create_lsc_credential_key()

int gmp_create_lsc_credential_key ( gnutls_session_t * session,
const char * name,
const char * login,
const char * passphrase,
const char * private_key,
const char * comment,
gchar ** uuid )

Create an LSC Credential with a key.

Parameters
[in]sessionPointer to GNUTLS session.
[in]nameName of LSC Credential.
[in]loginLogin associated with name.
[in]passphrasePassphrase for private key.
[in]private_keyPrivate key.
[in]commentLSC Credential comment.
[out]uuidEither NULL or address for UUID of created credential.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1792 of file gmp.c.

1796{
1797 int ret;
1798
1799 if (comment)
1800 ret = gvm_server_sendf_xml (session,
1801 "<create_credential>"
1802 "<name>%s</name>"
1803 "<login>%s</login>"
1804 "<key>"
1805 "<phrase>%s</phrase>"
1806 "<private>%s</private>"
1807 "</key>"
1808 "<comment>%s</comment>"
1809 "</create_credential>",
1810 name, login, passphrase ? passphrase : "",
1811 private_key, comment);
1812 else
1813 ret = gvm_server_sendf_xml (session,
1814 "<create_credential>"
1815 "<name>%s</name>"
1816 "<login>%s</login>"
1817 "<key>"
1818 "<phrase>%s</phrase>"
1819 "<private>%s</private>"
1820 "</key>"
1821 "</create_credential>",
1822 name, login, passphrase ? passphrase : "",
1823 private_key);
1824
1825 if (ret)
1826 return -1;
1827
1828 ret = gmp_read_create_response (session, uuid);
1829 if (ret == 201)
1830 return 0;
1831 return ret;
1832}

References gmp_read_create_response(), and gvm_server_sendf_xml().

Here is the call graph for this function:

◆ gmp_create_target_ext()

int gmp_create_target_ext ( gnutls_session_t * session,
gmp_create_target_opts_t opts,
gchar ** id )

Create a target.

FIXME: Using the according opts it should be possible to generate any type of create_target request defined by the spec.

Parameters
[in]sessionPointer to GNUTLS session.
[in]optsStruct containing the options to apply.
[out]idPointer for newly allocated ID of new target, or NULL. Only set on successful return.
Returns
0 on success (GMP 201), -2 on connection error, GMP response code on GMP error, -1 other error.

Definition at line 1542 of file gmp.c.

1544{
1545 gchar *comment, *ssh, *smb, *esxi, *snmp, *port_range, *start;
1546 gchar *exclude_hosts, *alive_tests;
1547 int ret;
1548
1549 /* Create the GMP request. */
1550
1551 if (opts.hosts == NULL)
1552 return -1;
1553
1554 start =
1555 g_markup_printf_escaped ("<create_target>"
1556 "<name>%s</name>"
1557 "<hosts>%s</hosts>",
1558 opts.name ? opts.name : "unnamed", opts.hosts);
1559
1560 if (opts.exclude_hosts)
1561 exclude_hosts = g_markup_printf_escaped ("<exclude_hosts>"
1562 "%s"
1563 "</exclude_hosts>",
1564 opts.exclude_hosts);
1565 else
1566 exclude_hosts = NULL;
1567
1568 if (opts.alive_tests)
1569 alive_tests = g_markup_printf_escaped ("<alive_tests>"
1570 "%s"
1571 "</alive_tests>",
1572 opts.alive_tests);
1573 else
1574 alive_tests = NULL;
1575
1576 if (opts.comment)
1577 comment = g_markup_printf_escaped ("<comment>"
1578 "%s"
1579 "</comment>",
1580 opts.comment);
1581 else
1582 comment = NULL;
1583
1584 if (opts.ssh_credential_id)
1585 {
1586 if (opts.ssh_credential_port)
1587 ssh = g_markup_printf_escaped ("<ssh_lsc_credential id=\"%s\">"
1588 "<port>%i</port>"
1589 "</ssh_lsc_credential>",
1590 opts.ssh_credential_id,
1591 opts.ssh_credential_port);
1592 else
1593 ssh = g_markup_printf_escaped ("<ssh_lsc_credential id=\"%s\"/>",
1594 opts.ssh_credential_id);
1595 }
1596 else
1597 ssh = NULL;
1598
1599 if (opts.smb_credential_id)
1600 smb = g_markup_printf_escaped ("<smb_lsc_credential id=\"%s\"/>",
1601 opts.smb_credential_id);
1602 else
1603 smb = NULL;
1604
1605 if (opts.esxi_credential_id)
1606 esxi = g_markup_printf_escaped ("<esxi_lsc_credential id=\"%s\"/>",
1607 opts.esxi_credential_id);
1608 else
1609 esxi = NULL;
1610
1611 if (opts.snmp_credential_id)
1612 snmp = g_markup_printf_escaped ("<snmp_credential id=\"%s\"/>",
1613 opts.snmp_credential_id);
1614 else
1615 snmp = NULL;
1616
1617 if (opts.port_range)
1618 port_range =
1619 g_markup_printf_escaped ("<port_range>%s</port_range>", opts.port_range);
1620 else
1621 port_range = NULL;
1622
1623 /* Send the request. */
1624 ret = gvm_server_sendf (session,
1625 "%s%s%s%s%s%s%s%s%s"
1626 "<reverse_lookup_only>%d</reverse_lookup_only>"
1627 "<reverse_lookup_unify>%d</reverse_lookup_unify>"
1628 "</create_target>",
1629 start, exclude_hosts ? exclude_hosts : "",
1630 alive_tests ? alive_tests : "", ssh ? ssh : "",
1631 smb ? smb : "", esxi ? esxi : "", snmp ? snmp : "",
1632 port_range ? port_range : "", comment ? comment : "",
1634 g_free (start);
1635 g_free (exclude_hosts);
1636 g_free (alive_tests);
1637 g_free (ssh);
1638 g_free (smb);
1639 g_free (esxi);
1640 g_free (port_range);
1641 g_free (comment);
1642 if (ret)
1643 return -2;
1644
1645 /* Read the response. */
1646
1647 ret = gmp_read_create_response (session, id);
1648 if (ret == 201)
1649 return 0;
1650 return ret;
1651}
const char * exclude_hosts
Hosts to exclude.
Definition gmp.h:204
const char * comment
Comment on target.
Definition gmp.h:202
const char * smb_credential_id
ID of SMB credential.
Definition gmp.h:197
int reverse_lookup_only
Scanner pref reverse_lookup_only.
Definition gmp.h:207
int reverse_lookup_unify
Scanner pref reverse_lookup_unify.
Definition gmp.h:208
const char * esxi_credential_id
ID of ESXi credential.
Definition gmp.h:198
const char * snmp_credential_id
ID of SNMP credential.
Definition gmp.h:199
const char * hosts
Name of target.
Definition gmp.h:203
const char * port_range
Port range.
Definition gmp.h:200
int ssh_credential_port
Port for SSH access.
Definition gmp.h:195
const char * alive_tests
Alive tests.
Definition gmp.h:205
const char * ssh_credential_id
ID of SSH credential.
Definition gmp.h:196
const char * name
Name of target.
Definition gmp.h:201

References gmp_create_target_opts_t::alive_tests, gmp_create_target_opts_t::comment, gmp_create_target_opts_t::esxi_credential_id, gmp_create_target_opts_t::exclude_hosts, gmp_read_create_response(), gvm_server_sendf(), gmp_create_target_opts_t::hosts, gmp_create_target_opts_t::name, gmp_create_target_opts_t::port_range, gmp_create_target_opts_t::reverse_lookup_only, gmp_create_target_opts_t::reverse_lookup_unify, gmp_create_target_opts_t::smb_credential_id, gmp_create_target_opts_t::snmp_credential_id, gmp_create_target_opts_t::ssh_credential_id, and gmp_create_target_opts_t::ssh_credential_port.

Here is the call graph for this function:

◆ gmp_create_task()

int gmp_create_task ( gnutls_session_t * session,
const char * name,
const char * config,
const char * target,
const char * comment,
gchar ** id )

Create a task given a config and target.

Parameters
[in]sessionPointer to GNUTLS session.
[in]nameTask name.
[in]configTask config name.
[in]targetTask target name.
[in]commentTask comment.
[out]idPointer for newly allocated ID of new task. Only set on successful return.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 717 of file gmp.c.

720{
721 int ret;
722
723 ret = gvm_server_sendf_xml (session,
724 "<create_task>"
725 "<config id=\"%s\"/>"
726 "<target id=\"%s\"/>"
727 "<name>%s</name>"
728 "<comment>%s</comment>"
729 "</create_task>",
730 config, target, name, comment);
731 if (ret)
732 return -1;
733
734 /* Read the response. */
735
736 ret = gmp_read_create_response (session, id);
737 if (ret == 201)
738 return 0;
739 return ret;
740}

References gmp_read_create_response(), and gvm_server_sendf_xml().

Here is the call graph for this function:

◆ gmp_create_task_ext()

int gmp_create_task_ext ( gnutls_session_t * session,
gmp_create_task_opts_t opts,
gchar ** id )

Create a task.

FIXME: Using the according opts it should be possible to generate any type of create_task request defined by the spec.

Parameters
[in]sessionPointer to GNUTLS session.
[in]optsStruct containing the options to apply.
[out]idPointer for newly allocated ID of new task, or NULL. Only set on successful return.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 537 of file gmp.c.

539{
540 /* Create the GMP request. */
541
542 gchar *prefs, *start, *hosts_ordering, *scanner, *schedule, *slave;
543 GString *alerts, *observers;
544 int ret;
545 if ((opts.config_id == NULL) || (opts.target_id == NULL))
546 return -1;
547
548 prefs = NULL;
549 start = g_markup_printf_escaped (
550 "<create_task>"
551 "<config id=\"%s\"/>"
552 "<target id=\"%s\"/>"
553 "<name>%s</name>"
554 "<comment>%s</comment>"
555 "<alterable>%d</alterable>",
556 opts.config_id, opts.target_id, opts.name ? opts.name : "unnamed",
557 opts.comment ? opts.comment : "", opts.alterable ? 1 : 0);
558
559 if (opts.hosts_ordering)
560 hosts_ordering = g_strdup_printf ("<hosts_ordering>%s</hosts_ordering>",
561 opts.hosts_ordering);
562 else
563 hosts_ordering = NULL;
564
565 if (opts.scanner_id)
566 scanner = g_strdup_printf ("<scanner id=\"%s\"/>", opts.scanner_id);
567 else
568 scanner = NULL;
569
570 if (opts.schedule_id)
571 schedule = g_strdup_printf ("<schedule id=\"%s\"/>"
572 "<schedule_periods>%d</schedule_periods>",
573 opts.schedule_id, opts.schedule_periods);
574 else
575 schedule = NULL;
576
577 if (opts.slave_id)
578 slave = g_strdup_printf ("<slave id=\"%s\"/>", opts.slave_id);
579 else
580 slave = NULL;
581
582 if (opts.max_checks || opts.max_hosts || opts.in_assets || opts.source_iface)
583 {
584 gchar *in_assets, *checks, *hosts, *source_iface;
585
586 in_assets = checks = hosts = source_iface = NULL;
587
588 if (opts.in_assets)
589 in_assets = g_markup_printf_escaped ("<preference>"
590 "<scanner_name>"
591 "in_assets"
592 "</scanner_name>"
593 "<value>"
594 "%s"
595 "</value>"
596 "</preference>",
597 opts.in_assets);
598
599 if (opts.max_hosts)
600 hosts = g_markup_printf_escaped ("<preference>"
601 "<scanner_name>"
602 "max_hosts"
603 "</scanner_name>"
604 "<value>"
605 "%s"
606 "</value>"
607 "</preference>",
608 opts.max_hosts);
609
610 if (opts.max_checks)
611 checks = g_markup_printf_escaped ("<preference>"
612 "<scanner_name>"
613 "max_checks"
614 "</scanner_name>"
615 "<value>"
616 "%s"
617 "</value>"
618 "</preference>",
619 opts.max_checks);
620
621 if (opts.source_iface)
622 source_iface = g_markup_printf_escaped ("<preference>"
623 "<scanner_name>"
624 "source_iface"
625 "</scanner_name>"
626 "<value>"
627 "%s"
628 "</value>"
629 "</preference>",
630 opts.source_iface);
631
632 prefs =
633 g_strdup_printf ("<preferences>%s%s%s%s</preferences>",
634 in_assets ? in_assets : "", checks ? checks : "",
635 hosts ? hosts : "", source_iface ? source_iface : "");
636 g_free (in_assets);
637 g_free (checks);
638 g_free (hosts);
639 g_free (source_iface);
640 }
641
642 if (opts.alert_ids)
643 {
644 unsigned int i;
645 alerts = g_string_new ("");
646 for (i = 0; i < opts.alert_ids->len; i++)
647 {
648 char *alert = (char *) g_ptr_array_index (opts.alert_ids, i);
649 g_string_append_printf (alerts, "<alert id=\"%s\"/>", alert);
650 }
651 }
652 else
653 alerts = g_string_new ("");
654
655 if (opts.observers || opts.observer_groups)
656 {
657 observers = g_string_new ("<observers>");
658
659 if (opts.observers)
660 g_string_append (observers, opts.observers);
661
662 if (opts.observer_groups)
663 {
664 unsigned int i;
665 for (i = 0; i < opts.observer_groups->len; i++)
666 {
667 char *group =
668 (char *) g_ptr_array_index (opts.observer_groups, i);
669 g_string_append_printf (observers, "<group id=\"%s\"/>", group);
670 }
671 }
672 g_string_append (observers, "</observers>");
673 }
674 else
675 observers = g_string_new ("");
676
677 /* Send the request. */
678 ret = gvm_server_sendf (
679 session, "%s%s%s%s%s%s%s%s</create_task>", start, prefs ? prefs : "",
680 hosts_ordering ? hosts_ordering : "", scanner ? scanner : "",
681 schedule ? schedule : "", slave ? slave : "", alerts ? alerts->str : "",
682 observers ? observers->str : "");
683 g_free (start);
684 g_free (prefs);
685 g_free (hosts_ordering);
686 g_free (scanner);
687 g_free (schedule);
688 g_free (slave);
689 g_string_free (alerts, TRUE);
690 g_string_free (observers, TRUE);
691
692 if (ret)
693 return -1;
694
695 /* Read the response. */
696
697 ret = gmp_read_create_response (session, id);
698 if (ret == 201)
699 return 0;
700 return ret;
701}
int schedule_periods
Number of periods the schedule must run for.
Definition gmp.h:173
const char * max_checks
Max checks preference.
Definition gmp.h:177
const char * slave_id
ID of task schedule.
Definition gmp.h:166
array_t * alert_ids
Array of alert IDs.
Definition gmp.h:162
const char * config_id
ID of config.
Definition gmp.h:163
const char * in_assets
In assets preference.
Definition gmp.h:175
const char * schedule_id
ID of task schedule.
Definition gmp.h:165
const char * source_iface
Source iface preference.
Definition gmp.h:178
array_t * observer_groups
IDs of observer groups.
Definition gmp.h:172
const char * observers
Comma-separated string of observer users.
Definition gmp.h:171
const char * name
Name of task.
Definition gmp.h:168
const char * target_id
ID of target.
Definition gmp.h:167
const char * scanner_id
ID of task scanner.
Definition gmp.h:164
int alterable
Whether the task is alterable.
Definition gmp.h:180
const char * max_hosts
Max hosts preference.
Definition gmp.h:176
const char * hosts_ordering
Order for scanning target hosts.
Definition gmp.h:170
const char * comment
Comment on task.
Definition gmp.h:169

References gmp_create_task_opts_t::alert_ids, gmp_create_task_opts_t::alterable, gmp_create_task_opts_t::comment, gmp_create_task_opts_t::config_id, gmp_read_create_response(), gvm_server_sendf(), gmp_create_task_opts_t::hosts_ordering, gmp_create_task_opts_t::in_assets, gmp_create_task_opts_t::max_checks, gmp_create_task_opts_t::max_hosts, gmp_create_task_opts_t::name, gmp_create_task_opts_t::observer_groups, gmp_create_task_opts_t::observers, gmp_create_task_opts_t::scanner_id, gmp_create_task_opts_t::schedule_id, gmp_create_task_opts_t::schedule_periods, gmp_create_task_opts_t::slave_id, gmp_create_task_opts_t::source_iface, and gmp_create_task_opts_t::target_id.

Here is the call graph for this function:

◆ gmp_delete_config_ext()

int gmp_delete_config_ext ( gnutls_session_t * session,
const char * id,
gmp_delete_opts_t opts )

Delete a config.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idUUID of config.
[in]optsStruct containing the options to apply.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1692 of file gmp.c.

1694{
1695 entity_t entity;
1696 int ret;
1697
1698 if (gvm_server_sendf (session,
1699 "<delete_config config_id=\"%s\" ultimate=\"%d\"/>", id,
1700 opts.ultimate)
1701 == -1)
1702 return -1;
1703
1704 entity = NULL;
1705 ret = gmp_check_response (session, &entity);
1706 if (ret == 0)
1707 free_entity (entity);
1708 return ret;
1709}

References free_entity(), gmp_check_response(), gvm_server_sendf(), and gmp_delete_opts_t::ultimate.

Here is the call graph for this function:

◆ gmp_delete_lsc_credential_ext()

int gmp_delete_lsc_credential_ext ( gnutls_session_t * session,
const char * id,
gmp_delete_opts_t opts )

Delete a LSC credential.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idUUID of LSC credential.
[in]optsStruct containing the options to apply.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1937 of file gmp.c.

1939{
1940 entity_t entity;
1941 int ret;
1942
1943 if (gvm_server_sendf (session,
1944 "<delete_credential credential_id=\"%s\""
1945 " ultimate=\"%d\"/>",
1946 id, opts.ultimate)
1947 == -1)
1948 return -1;
1949
1950 entity = NULL;
1951 ret = gmp_check_response (session, &entity);
1952 if (ret == 0)
1953 free_entity (entity);
1954 return ret;
1955}

References free_entity(), gmp_check_response(), gvm_server_sendf(), and gmp_delete_opts_t::ultimate.

Here is the call graph for this function:

◆ gmp_delete_port_list_ext()

int gmp_delete_port_list_ext ( gnutls_session_t * session,
const char * id,
gmp_delete_opts_t opts )

Delete a port list.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idUUID of port list.
[in]optsStruct containing the options to apply.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1484 of file gmp.c.

1486{
1487 entity_t entity;
1488 int ret;
1489
1490 if (gvm_server_sendf (
1491 session, "<delete_port_list port_list_id=\"%s\" ultimate=\"%d\"/>", id,
1492 opts.ultimate)
1493 == -1)
1494 return -1;
1495
1496 entity = NULL;
1497 ret = gmp_check_response (session, &entity);
1498 if (ret == 0)
1499 free_entity (entity);
1500 return ret;
1501}

References free_entity(), gmp_check_response(), gvm_server_sendf(), and gmp_delete_opts_t::ultimate.

Here is the call graph for this function:

◆ gmp_delete_report()

int gmp_delete_report ( gnutls_session_t * session,
const char * id )

Remove a report.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idID of report.
Returns
0 on success, GMP response code on failure, -1 on error.

Definition at line 1512 of file gmp.c.

1513{
1514 entity_t entity;
1515 int ret;
1516
1517 if (gvm_server_sendf (session, "<delete_report report_id=\"%s\"/>", id))
1518 return -1;
1519
1520 entity = NULL;
1521 ret = gmp_check_response (session, &entity);
1522 if (ret == 0)
1523 free_entity (entity);
1524 return ret;
1525}

References free_entity(), gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_delete_target_ext()

int gmp_delete_target_ext ( gnutls_session_t * session,
const char * id,
gmp_delete_opts_t opts )

Delete a target.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idUUID of target.
[in]optsStruct containing the options to apply.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1663 of file gmp.c.

1665{
1666 entity_t entity;
1667 int ret;
1668
1669 if (gvm_server_sendf (session,
1670 "<delete_target target_id=\"%s\" ultimate=\"%d\"/>", id,
1671 opts.ultimate)
1672 == -1)
1673 return -1;
1674
1675 entity = NULL;
1676 ret = gmp_check_response (session, &entity);
1677 if (ret == 0)
1678 free_entity (entity);
1679 return ret;
1680}

References free_entity(), gmp_check_response(), gvm_server_sendf(), and gmp_delete_opts_t::ultimate.

Here is the call graph for this function:

◆ gmp_delete_task()

int gmp_delete_task ( gnutls_session_t * session,
const char * id )

Delete a task and read the manager response.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idID of task.
Returns
0 on success, GMP response code on failure, -1 on error.

Definition at line 1320 of file gmp.c.

1321{
1322 entity_t entity;
1323 int ret;
1324
1325 if (gvm_server_sendf (session, "<delete_task task_id=\"%s\"/>", id) == -1)
1326 return -1;
1327
1328 entity = NULL;
1329 ret = gmp_check_response (session, &entity);
1330 if (ret == 0)
1331 free_entity (entity);
1332 return ret;
1333}

References free_entity(), gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_delete_task_ext()

int gmp_delete_task_ext ( gnutls_session_t * session,
const char * id,
gmp_delete_opts_t opts )

Delete a task and read the manager response.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idID of task.
[in]optsStruct containing the options to apply.
Returns
0 on success, GMP response code on failure, -1 on error.

Definition at line 1092 of file gmp.c.

1094{
1095 entity_t entity;
1096 int ret;
1097
1098 if (gvm_server_sendf (session,
1099 "<delete_task task_id=\"%s\" ultimate=\"%d\"/>", id,
1100 opts.ultimate)
1101 == -1)
1102 return -1;
1103
1104 entity = NULL;
1105 ret = gmp_check_response (session, &entity);
1106 if (ret == 0)
1107 free_entity (entity);
1108 return ret;
1109}

References free_entity(), gmp_check_response(), gvm_server_sendf(), and gmp_delete_opts_t::ultimate.

Here is the call graph for this function:

◆ gmp_get_report_ext()

int gmp_get_report_ext ( gnutls_session_t * session,
gmp_get_report_opts_t opts,
entity_t * response )

Get a report (generic version).

FIXME: Using the according opts it should be possible to generate any type of get_reports request defined by the spec.

Parameters
[in]sessionPointer to GNUTLS session.
[in]optsStruct containing the options to apply.
[out]responseReport. On success contains GET_REPORT response.
Returns
0 on success, 2 on timeout, -1 or GMP response code on error.

Definition at line 1386 of file gmp.c.

1388{
1389 int ret;
1390 const char *status_code;
1391
1392 if (response == NULL)
1393 return -1;
1394
1395 if (gvm_server_sendf (
1396 session,
1397 "<get_reports"
1398 " details=\"1\""
1399 " report_id=\"%s\""
1400 " format_id=\"%s\""
1401 " host_first_result=\"%i\""
1402 " host_max_results=\"%i\""
1403 "%s%s%s"
1404 "%s%s%s"
1405 "%s%s%s"
1406 "%s%s%s"
1407 "%s%s%s"
1408 "%s%s%s"
1409 "%s%s%s"
1410 "%s%s%s"
1411 "%s%s%s"
1412 "%s%s%s"
1413 "%s%s%s"
1414 "%s%s%s"
1415 "%s%s%s"
1416 "%s%s%s"
1417 "%s%s%s%s%s%s%s/>",
1418 opts.report_id, opts.format_id, opts.host_first_result,
1419 opts.host_max_results, GMP_FMT_STRING_ATTRIB (opts, type),
1420 GMP_FMT_STRING_ATTRIB (opts, filter),
1421 GMP_FMT_STRING_ATTRIB (opts, filt_id),
1422 GMP_FMT_STRING_ATTRIB (opts, host), GMP_FMT_STRING_ATTRIB (opts, pos),
1423 GMP_FMT_STRING_ATTRIB (opts, timezone),
1424 GMP_FMT_STRING_ATTRIB (opts, alert_id),
1425 GMP_FMT_STRING_ATTRIB (opts, delta_report_id),
1426 GMP_FMT_STRING_ATTRIB (opts, delta_states),
1427 GMP_FMT_STRING_ATTRIB (opts, host_levels),
1428 GMP_FMT_STRING_ATTRIB (opts, search_phrase),
1429 GMP_FMT_STRING_ATTRIB (opts, host_search_phrase),
1430 GMP_FMT_STRING_ATTRIB (opts, min_cvss_base),
1431 GMP_FMT_STRING_ATTRIB (opts, min_qod),
1432 GMP_FMT_BOOL_ATTRIB (opts, notes),
1433 GMP_FMT_BOOL_ATTRIB (opts, notes_details),
1434 GMP_FMT_BOOL_ATTRIB (opts, overrides),
1435 GMP_FMT_BOOL_ATTRIB (opts, override_details),
1436 GMP_FMT_BOOL_ATTRIB (opts, apply_overrides),
1437 GMP_FMT_BOOL_ATTRIB (opts, result_hosts_only),
1438 GMP_FMT_BOOL_ATTRIB (opts, ignore_pagination)))
1439 return -1;
1440
1441 *response = NULL;
1442 switch (try_read_entity (session, opts.timeout, response))
1443 {
1444 case 0:
1445 break;
1446 case -4:
1447 return 2;
1448 default:
1449 return -1;
1450 }
1451
1452 /* Check the response. */
1453
1454 status_code = entity_attribute (*response, "status");
1455 if (status_code == NULL)
1456 {
1457 free_entity (*response);
1458 return -1;
1459 }
1460 if (strlen (status_code) == 0)
1461 {
1462 free_entity (*response);
1463 return -1;
1464 }
1465 if (status_code[0] == '2')
1466 return 0;
1467 ret = (int) strtol (status_code, NULL, 10);
1468 free_entity (*response);
1469 if (errno == ERANGE)
1470 return -1;
1471 return ret;
1472}
#define GMP_FMT_BOOL_ATTRIB(var, attrib)
Definition gmp.c:30
#define GMP_FMT_STRING_ATTRIB(var, attrib)
Definition gmp.c:33
int timeout
Timeout for GMP response.
Definition gmp.h:54
const char * format_id
ID of required report format.
Definition gmp.h:49
int host_max_results
Maximum number of results to return.
Definition gmp.h:56
const char * report_id
ID of single report to get.
Definition gmp.h:51
int host_first_result
Skip over results before this result number.
Definition gmp.h:55

References entity_attribute(), gmp_get_report_opts_t::format_id, free_entity(), GMP_FMT_BOOL_ATTRIB, GMP_FMT_STRING_ATTRIB, gvm_server_sendf(), gmp_get_report_opts_t::host_first_result, gmp_get_report_opts_t::host_max_results, gmp_get_report_opts_t::report_id, gmp_get_report_opts_t::timeout, and try_read_entity().

Here is the call graph for this function:

◆ gmp_get_system_reports()

int gmp_get_system_reports ( gnutls_session_t * session,
const char * name,
int brief,
entity_t * reports )

Get system reports.

Parameters
[in]sessionPointer to GNUTLS session.
[in]nameName of system report. NULL for all.
[in]briefWhether to request brief response.
[out]reportsReports return. On success contains GET_SYSTEM_REPORTS response.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1969 of file gmp.c.

1971{
1972 if (name)
1973 {
1974 if (gvm_server_sendf (session,
1975 "<get_system_reports name=\"%s\" brief=\"%i\"/>",
1976 name, brief)
1977 == -1)
1978 return -1;
1979 }
1980 else if (gvm_server_sendf (session, "<get_system_reports brief=\"%i\"/>",
1981 brief)
1982 == -1)
1983 return -1;
1984
1985 /* Read and check the response. */
1986 return gmp_check_response (session, reports);
1987}

References gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_get_system_reports_ext()

int gmp_get_system_reports_ext ( gnutls_session_t * session,
gmp_get_system_reports_opts_t opts,
entity_t * reports )

Get system reports.

Parameters
[in]sessionPointer to GNUTLS session.
[in]optsStruct containing the options to apply.
[out]reportsReports return. On success contains GET_SYSTEM_REPORTS response.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 2000 of file gmp.c.

2003{
2004 GString *request;
2005
2006 request = g_string_new ("<get_system_reports");
2007
2008 if (opts.slave_id)
2009 xml_string_append (request, " slave_id=\"%s\"", opts.slave_id);
2010
2011 if (opts.name)
2012 xml_string_append (request, " name=\"%s\"", opts.name);
2013
2014 if (opts.duration)
2015 xml_string_append (request, " duration=\"%s\"", opts.duration);
2016
2017 if (opts.start_time)
2018 xml_string_append (request, " start_time=\"%s\"", opts.start_time);
2019
2020 if (opts.end_time)
2021 xml_string_append (request, " end_time=\"%s\"", opts.end_time);
2022
2023 g_string_append (request, "/>");
2024
2025 /* Create the GMP request. */
2026
2027 if (gvm_server_sendf (session, "%s", request->str) == -1)
2028 {
2029 g_string_free (request, 1);
2030 return -1;
2031 }
2032 g_string_free (request, 1);
2033
2034 /* Read and check the response. */
2035 return gmp_check_response (session, reports);
2036}
const char * duration
Duration.
Definition gmp.h:223
const char * slave_id
ID of the slave to get report from.
Definition gmp.h:226
const char * end_time
Time of last data point.
Definition gmp.h:225
const char * name
Name of report.
Definition gmp.h:222
const char * start_time
Time of first data point.
Definition gmp.h:224
void xml_string_append(GString *xml, const char *format,...)
Append formatted escaped XML to a string.
Definition xmlutils.c:1849

References gmp_get_system_reports_opts_t::duration, gmp_get_system_reports_opts_t::end_time, gmp_check_response(), gvm_server_sendf(), gmp_get_system_reports_opts_t::name, gmp_get_system_reports_opts_t::slave_id, gmp_get_system_reports_opts_t::start_time, and xml_string_append().

Here is the call graph for this function:

◆ gmp_get_targets()

int gmp_get_targets ( gnutls_session_t * session,
const char * id,
int tasks,
int include_rcfile,
entity_t * target )

Get a target.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idID of target or NULL for all targets.
[in]tasksWhether to include tasks that use the target.
[in]include_rcfileNot used.
[out]targetTarget return. On success contains GET_TARGETS response.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1348 of file gmp.c.

1350{
1351 (void) include_rcfile;
1352 if (id == NULL)
1353 {
1354 if (gvm_server_sendf (session, "<get_targets tasks=\"%i\"/>", tasks)
1355 == -1)
1356 return -1;
1357 }
1358 else
1359 {
1360 if (gvm_server_sendf (session,
1361 "<get_targets"
1362 " target_id=\"%s\""
1363 " tasks=\"%i\"/>",
1364 id, tasks)
1365 == -1)
1366 return -1;
1367 }
1368
1369 /* Read the response. */
1370 return gmp_check_response (session, target);
1371}

References gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_get_task_ext()

int gmp_get_task_ext ( gnutls_session_t * session,
gmp_get_task_opts_t opts,
entity_t * response )

Get a task (generic version).

Parameters
[in]sessionPointer to GNUTLS session.
[in]optsStruct containing the options to apply.
[out]responseTask. On success contains GET_TASKS response.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1159 of file gmp.c.

1161{
1162 if ((response == NULL) || (opts.task_id == NULL))
1163 return -1;
1164
1165 if (opts.actions)
1166 {
1167 if (gvm_server_sendf (session,
1168 "<get_tasks"
1169 " task_id=\"%s\""
1170 " actions=\"%s\""
1171 "%s/>",
1172 opts.task_id, opts.actions,
1173 GMP_FMT_BOOL_ATTRIB (opts, details)))
1174 return -1;
1175 }
1176 else if (gvm_server_sendf (session,
1177 "<get_tasks"
1178 " task_id=\"%s\""
1179 "%s/>",
1180 opts.task_id, GMP_FMT_BOOL_ATTRIB (opts, details)))
1181 return -1;
1182
1183 return gmp_check_response (session, response);
1184}
const char * task_id
ID of single task to get.
Definition gmp.h:145
const char * actions
Actions argument.
Definition gmp.h:144

References gmp_get_task_opts_t::actions, gmp_check_response(), GMP_FMT_BOOL_ATTRIB, gvm_server_sendf(), and gmp_get_task_opts_t::task_id.

Here is the call graph for this function:

◆ gmp_get_tasks()

int gmp_get_tasks ( gnutls_session_t * session,
const char * id,
int details,
int include_rcfile,
entity_t * status )

Get the status of a task.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idID of task or NULL for all tasks.
[in]detailsWhether to request task details.
[in]include_rcfileIgnored. Removed since GMP 6.0.
[out]statusStatus return. On success contains GET_TASKS response.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1124 of file gmp.c.

1126{
1127 (void) include_rcfile;
1128 if (id == NULL)
1129 {
1130 if (gvm_server_sendf (session, "<get_tasks details=\"%i\"/>", details)
1131 == -1)
1132 return -1;
1133 }
1134 else
1135 {
1136 if (gvm_server_sendf (session,
1137 "<get_tasks"
1138 " task_id=\"%s\""
1139 " details=\"%i\"/>",
1140 id, details)
1141 == -1)
1142 return -1;
1143 }
1144
1145 /* Read the response. */
1146 return gmp_check_response (session, status);
1147}

References gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_get_tasks_ext()

int gmp_get_tasks_ext ( gnutls_session_t * session,
gmp_get_tasks_opts_t opts,
entity_t * response )

Get all tasks (generic version).

Parameters
[in]sessionPointer to GNUTLS session.
[in]optsStruct containing the options to apply.
[out]responseTasks. On success contains GET_TASKS response.
Returns
0 on success, 2 on timeout, -1 or GMP response code on error.

Definition at line 1196 of file gmp.c.

1198{
1199 int ret;
1200 const char *status_code;
1201 gchar *cmd;
1202
1203 if (response == NULL)
1204 return -1;
1205
1206 cmd = g_markup_printf_escaped ("<get_tasks"
1207 " filter=\"%s\"",
1208 opts.filter);
1209
1210 if (gvm_server_sendf (session, "%s%s/>", cmd,
1211 GMP_FMT_BOOL_ATTRIB (opts, details)))
1212 {
1213 g_free (cmd);
1214 return -1;
1215 }
1216 g_free (cmd);
1217
1218 *response = NULL;
1219 switch (try_read_entity (session, opts.timeout, response))
1220 {
1221 case 0:
1222 break;
1223 case -4:
1224 return 2;
1225 default:
1226 return -1;
1227 }
1228
1229 /* Check the response. */
1230
1231 status_code = entity_attribute (*response, "status");
1232 if (status_code == NULL)
1233 {
1234 free_entity (*response);
1235 return -1;
1236 }
1237 if (strlen (status_code) == 0)
1238 {
1239 free_entity (*response);
1240 return -1;
1241 }
1242 if (status_code[0] == '2')
1243 return 0;
1244 ret = (int) strtol (status_code, NULL, 10);
1245 free_entity (*response);
1246 if (errno == ERANGE)
1247 return -1;
1248 return ret;
1249}
int timeout
Timeout for GMP response.
Definition gmp.h:126
const char * filter
Filter argument.
Definition gmp.h:125

References entity_attribute(), gmp_get_tasks_opts_t::filter, free_entity(), GMP_FMT_BOOL_ATTRIB, gvm_server_sendf(), gmp_get_tasks_opts_t::timeout, and try_read_entity().

Here is the call graph for this function:

◆ gmp_modify_task_file()

int gmp_modify_task_file ( gnutls_session_t * session,
const char * id,
const char * name,
const void * content,
gsize content_len )

Modify a file on a task.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idID of task.
[in]nameName of file.
[in]contentNew content. NULL to remove file.
[in]content_lenLength of content.
Returns
0 on success, -1 or GMP response code on error.

Definition at line 1263 of file gmp.c.

1265{
1266 entity_t entity;
1267 int ret;
1268
1269 if (name == NULL)
1270 return -1;
1271
1272 if (gvm_server_sendf (session, "<modify_task task_id=\"%s\">", id))
1273 return -1;
1274
1275 if (content)
1276 {
1277 if (gvm_server_sendf (session, "<file name=\"%s\" action=\"update\">",
1278 name))
1279 return -1;
1280
1281 if (content_len)
1282 {
1283 gchar *base64_content =
1284 g_base64_encode ((guchar *) content, content_len);
1285 ret = gvm_server_sendf (session, "%s", base64_content);
1286 g_free (base64_content);
1287 if (ret)
1288 return -1;
1289 }
1290
1291 if (gvm_server_sendf (session, "</file>"))
1292 return -1;
1293 }
1294 else
1295 {
1296 if (gvm_server_sendf (session, "<file name=\"%s\" action=\"remove\" />",
1297 name))
1298 return -1;
1299 }
1300
1301 if (gvm_server_sendf (session, "</modify_task>"))
1302 return -1;
1303
1304 entity = NULL;
1305 ret = gmp_check_response (session, &entity);
1306 if (ret == 0)
1307 free_entity (entity);
1308 return ret;
1309}

References free_entity(), gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_ping()

int gmp_ping ( gnutls_session_t * session,
int timeout )

"Ping" the manager.

Parameters
[in]sessionPointer to GNUTLS session.
[in]timeoutServer idle time before giving up, in milliseconds. 0 to wait forever.
Returns
0 on success, 1 if manager closed connection, 2 on timeout, -1 on error.

Definition at line 190 of file gmp.c.

191{
192 entity_t entity;
193 const char *status;
194 char first;
195 int ret;
196
197 /* Send a GET_VERSION request. */
198
199 ret = gvm_server_sendf (session, "<get_version/>");
200 if (ret)
201 return ret;
202
203 /* Read the response, with a timeout. */
204
205 entity = NULL;
206 switch (try_read_entity (session, timeout, &entity))
207 {
208 case 0:
209 break;
210 case -4:
211 return 2;
212 default:
213 return -1;
214 }
215
216 /* Check the response. */
217
218 status = entity_attribute (entity, "status");
219 if (status == NULL)
220 {
221 free_entity (entity);
222 return -1;
223 }
224 if (strlen (status) == 0)
225 {
226 free_entity (entity);
227 return -1;
228 }
229 first = status[0];
230 free_entity (entity);
231 if (first == '2')
232 return 0;
233 return -1;
234}

References entity_attribute(), free_entity(), gvm_server_sendf(), and try_read_entity().

Referenced by Ensure(), Ensure(), Ensure(), and Ensure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gmp_ping_c()

int gmp_ping_c ( gvm_connection_t * connection,
int timeout,
gchar ** version )

"Ping" the manager.

Parameters
[in]connectionPointer to GNUTLS session.
[in]timeoutServer idle time before giving up, in milliseconds. 0 to wait forever.
[out]versionReturn location for freshly allocated version if required, else NULL.
Returns
0 on success, 1 if manager closed connection, 2 on timeout, -1 on error.

Definition at line 249 of file gmp.c.

250{
251 entity_t entity;
252 const char *status;
253 int ret;
254
255 if (version && *version)
256 *version = NULL;
257
258 /* Send a GET_VERSION request. */
259
260 ret = gvm_connection_sendf (connection, "<get_version/>");
261 if (ret)
262 return ret;
263
264 /* Read the response, with a timeout. */
265
266 entity = NULL;
267 switch (try_read_entity_c (connection, timeout, &entity))
268 {
269 case 0:
270 break;
271 case -4:
272 return 2;
273 default:
274 return -1;
275 }
276
277 /* Check the response. */
278
279 status = entity_attribute (entity, "status");
280 if (status == NULL)
281 {
282 free_entity (entity);
283 return -1;
284 }
285 if (strlen (status) == 0)
286 {
287 free_entity (entity);
288 return -1;
289 }
290 if (status[0] == '2')
291 {
292 if (version)
293 {
294 entity_t omp_version;
295 omp_version = entity_child (entity, "version");
296 if (omp_version == NULL)
297 {
298 free_entity (entity);
299 return -1;
300 }
301 *version = strdup (entity_text (omp_version));
302 }
303 free_entity (entity);
304 return 0;
305 }
306 free_entity (entity);
307 return -1;
308}
int gvm_connection_sendf(gvm_connection_t *connection, const char *format,...)
Format and send a string to the server.

References entity_attribute(), entity_child(), entity_text(), free_entity(), gvm_connection_sendf(), and try_read_entity_c().

Here is the call graph for this function:

◆ gmp_read_create_response()

int gmp_read_create_response ( gnutls_session_t * session,
gchar ** uuid )

Read response status and resource UUID.

Parameters
[in]sessionPointer to GNUTLS session.
[out]uuidEither NULL or address for freshly allocated UUID of created response.
Returns
GMP response code on success, -1 on error.

Definition at line 888 of file gmp.c.

889{
890 int ret;
891 const char *status;
892 entity_t entity;
893
894 /* Read the response. */
895
896 entity = NULL;
897 if (read_entity (session, &entity))
898 return -1;
899
900 /* Parse the response. */
901
902 status = entity_attribute (entity, "status");
903 if (status == NULL)
904 {
905 free_entity (entity);
906 return -1;
907 }
908 if (strlen (status) == 0)
909 {
910 free_entity (entity);
911 return -1;
912 }
913
914 if (uuid)
915 {
916 const char *id;
917
918 id = entity_attribute (entity, "id");
919 if (id == NULL)
920 {
921 free_entity (entity);
922 return -1;
923 }
924 if (strlen (id) == 0)
925 {
926 free_entity (entity);
927 return -1;
928 }
929 *uuid = g_strdup (id);
930 }
931
932 ret = atoi (status);
933 free_entity (entity);
934 return ret;
935}
int read_entity(gnutls_session_t *session, entity_t *entity)
Read an XML entity tree from the manager.
Definition xmlutils.c:1469

References entity_attribute(), free_entity(), and read_entity().

Referenced by Ensure(), Ensure(), Ensure(), Ensure(), gmp_create_lsc_credential(), gmp_create_lsc_credential_ext(), gmp_create_lsc_credential_key(), gmp_create_target_ext(), gmp_create_task(), and gmp_create_task_ext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gmp_resume_task_report()

int gmp_resume_task_report ( gnutls_session_t * session,
const char * task_id,
char ** report_id )

Resume a task and read the manager response.

Parameters
[in]sessionPointer to GNUTLS session.
[in]task_idID of task.
[out]report_idID of report.
Returns
0 on success, 1 on GMP failure, -1 on error.

Definition at line 989 of file gmp.c.

991{
992 int ret;
993 entity_t entity;
994 if (gvm_server_sendf (session, "<resume_task task_id=\"%s\"/>", task_id)
995 == -1)
996 return -1;
997
998 /* Read the response. */
999
1000 entity = NULL;
1001 ret = gmp_check_response (session, &entity);
1002
1003 if (ret == 0)
1004 {
1005 if (report_id)
1006 {
1007 entity_t report_id_xml = entity_child (entity, "report_id");
1008 if (report_id_xml)
1009 *report_id = g_strdup (entity_text (report_id_xml));
1010 else
1011 {
1012 free_entity (entity);
1013 return -1;
1014 }
1015 }
1016 free_entity (entity);
1017 return 0;
1018 }
1019 else if (ret == -1)
1020 return ret;
1021 return 1;
1022}

References entity_child(), entity_text(), free_entity(), gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_resume_task_report_c()

int gmp_resume_task_report_c ( gvm_connection_t * connection,
const char * task_id,
char ** report_id )

Resume a task and read the manager response.

Parameters
[in]connectionConnection.
[in]task_idID of task.
[out]report_idID of report.
Returns
0 on success, 1 on GMP failure, -1 on error.

Definition at line 1034 of file gmp.c.

1036{
1037 if (gvm_connection_sendf (connection, "<resume_task task_id=\"%s\"/>",
1038 task_id)
1039 == -1)
1040 return -1;
1041
1042 /* Read the response. */
1043
1044 entity_t entity = NULL;
1045 if (read_entity_c (connection, &entity))
1046 return -1;
1047
1048 /* Check the response. */
1049
1050 const char *status = entity_attribute (entity, "status");
1051 if (status == NULL)
1052 {
1053 free_entity (entity);
1054 return -1;
1055 }
1056 if (strlen (status) == 0)
1057 {
1058 free_entity (entity);
1059 return -1;
1060 }
1061 char first = status[0];
1062 if (first == '2')
1063 {
1064 if (report_id)
1065 {
1066 entity_t report_id_xml = entity_child (entity, "report_id");
1067 if (report_id_xml)
1068 *report_id = g_strdup (entity_text (report_id_xml));
1069 else
1070 {
1071 free_entity (entity);
1072 return -1;
1073 }
1074 }
1075 free_entity (entity);
1076 return 0;
1077 }
1078 free_entity (entity);
1079 return 1;
1080}
int read_entity_c(gvm_connection_t *connection, entity_t *entity)
Read an XML entity tree from the manager.
Definition xmlutils.c:1497

References entity_attribute(), entity_child(), entity_text(), free_entity(), gvm_connection_sendf(), and read_entity_c().

Here is the call graph for this function:

◆ gmp_start_task_ext_c()

int gmp_start_task_ext_c ( gvm_connection_t * connection,
gmp_start_task_opts_t opts )

Start a task and read the manager response.

Parameters
[in]connectionConnection.
[in]optsOptions to apply.
Returns
0 on success, 99 permission denied, -1 or GMP response code on error.

Definition at line 857 of file gmp.c.

858{
859 int ret;
860
861 /* Check args. */
862
863 if (opts.task_id == NULL)
864 return -1;
865
866 /* Send request. */
867
868 ret = gvm_connection_sendf (connection, "<start_task task_id=\"%s\"/>",
869 opts.task_id);
870 if (ret)
871 return -1;
872
873 /* Read response. */
874
875 return check_response_c (connection, 1);
876}
static int check_response_c(gvm_connection_t *connection, int convert_99)
Read response and convert status of response to a return value.
Definition gmp.c:119
const char * task_id
ID of task.
Definition gmp.h:317

References check_response_c(), gvm_connection_sendf(), and gmp_start_task_opts_t::task_id.

Here is the call graph for this function:

◆ gmp_start_task_report()

int gmp_start_task_report ( gnutls_session_t * session,
const char * task_id,
char ** report_id )

Start a task and read the manager response.

Parameters
[in]sessionPointer to GNUTLS session.
[in]task_idID of task.
[out]report_idID of report.
Returns
0 on success, 1 on failure, -1 on error.

Definition at line 752 of file gmp.c.

754{
755 int ret;
756 entity_t entity;
757 if (gvm_server_sendf (session, "<start_task task_id=\"%s\"/>", task_id) == -1)
758 return -1;
759
760 /* Read the response. */
761
762 entity = NULL;
763 ret = gmp_check_response (session, &entity);
764
765 if (ret == 0)
766 {
767 if (report_id)
768 {
769 entity_t report_id_xml = entity_child (entity, "report_id");
770 if (report_id_xml)
771 *report_id = g_strdup (entity_text (report_id_xml));
772 else
773 {
774 free_entity (entity);
775 return -1;
776 }
777 }
778 free_entity (entity);
779 return ret;
780 }
781 else if (ret == -1)
782 return ret;
783
784 return 1;
785}

References entity_child(), entity_text(), free_entity(), gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_start_task_report_c()

int gmp_start_task_report_c ( gvm_connection_t * connection,
const char * task_id,
char ** report_id )

Start a task and read the manager response.

Parameters
[in]connectionConnection.
[in]task_idID of task.
[out]report_idID of report.
Returns
0 on success, 1 on failure, -1 on error.

Definition at line 797 of file gmp.c.

799{
800 entity_t entity;
801 const char *status;
802 char first;
803
804 if (gvm_connection_sendf (connection, "<start_task task_id=\"%s\"/>", task_id)
805 == -1)
806 return -1;
807
808 /* Read the response. */
809
810 entity = NULL;
811 if (read_entity_c (connection, &entity))
812 return -1;
813
814 /* Check the response. */
815
816 status = entity_attribute (entity, "status");
817 if (status == NULL)
818 {
819 free_entity (entity);
820 return -1;
821 }
822 if (strlen (status) == 0)
823 {
824 free_entity (entity);
825 return -1;
826 }
827 first = status[0];
828 if (first == '2')
829 {
830 if (report_id)
831 {
832 entity_t report_id_xml = entity_child (entity, "report_id");
833 if (report_id_xml)
834 *report_id = g_strdup (entity_text (report_id_xml));
835 else
836 {
837 free_entity (entity);
838 return -1;
839 }
840 }
841 free_entity (entity);
842 return 0;
843 }
844 free_entity (entity);
845 return 1;
846}

References entity_attribute(), entity_child(), entity_text(), free_entity(), gvm_connection_sendf(), and read_entity_c().

Here is the call graph for this function:

◆ gmp_stop_task()

int gmp_stop_task ( gnutls_session_t * session,
const char * id )

Stop a task and read the manager response.

Parameters
[in]sessionPointer to GNUTLS session.
[in]idID of task.
Returns
0 on success, GMP response code on failure, -1 on error.

Definition at line 946 of file gmp.c.

947{
948 entity_t entity;
949 int ret;
950
951 if (gvm_server_sendf (session, "<stop_task task_id=\"%s\"/>", id) == -1)
952 return -1;
953
954 entity = NULL;
955 ret = gmp_check_response (session, &entity);
956 if (ret == 0)
957 free_entity (entity);
958 return ret;
959}

References free_entity(), gmp_check_response(), and gvm_server_sendf().

Here is the call graph for this function:

◆ gmp_stop_task_c()

int gmp_stop_task_c ( gvm_connection_t * connection,
const char * id )

Stop a task and read the manager response.

Parameters
[in]connectionConnection.
[in]idID of task.
Returns
0 on success, GMP response code on failure, -1 on error.

Definition at line 970 of file gmp.c.

971{
972 if (gvm_connection_sendf (connection, "<stop_task task_id=\"%s\"/>", id)
973 == -1)
974 return -1;
975
976 return gmp_check_response_c (connection);
977}
static int gmp_check_response_c(gvm_connection_t *connection)
Read response and convert status of response to a return value.
Definition gmp.c:174

References gmp_check_response_c(), and gvm_connection_sendf().

Here is the call graph for this function:

◆ gmp_task_status()

const char * gmp_task_status ( entity_t response)

Get the task status from a GMP GET_TASKS response.

Parameters
[in]responseGET_TASKS response.
Returns
The entity_text of the status entity if the entity is found, else NULL.

Definition at line 48 of file gmp.c.

49{
50 entity_t task = entity_child (response, "task");
51 if (task)
52 {
53 entity_t status = entity_child (task, "status");
54 if (status)
55 return entity_text (status);
56 }
57 return NULL;
58}

References entity_child(), and entity_text().

Referenced by Ensure(), Ensure(), and Ensure().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ gmp_authenticate_info_opts_defaults

const gmp_authenticate_info_opts_t gmp_authenticate_info_opts_defaults
static
Initial value:
=
{0, NULL, NULL, NULL, NULL, NULL}

Sensible default values for gmp_authenticate_info_opts_t.

Definition at line 39 of file gmp.h.

40 {0, NULL, NULL, NULL, NULL, NULL};

◆ gmp_create_lsc_credential_opts_defaults

const gmp_create_lsc_credential_opts_t gmp_create_lsc_credential_opts_defaults
static
Initial value:
= {NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL}

Sensible default values for gmp_create_lsc_credential_opts_t.

Definition at line 256 of file gmp.h.

256 {NULL, NULL, NULL, NULL, NULL,
257 NULL, NULL, NULL, NULL};

◆ gmp_create_target_opts_defaults

const gmp_create_target_opts_t gmp_create_target_opts_defaults
static
Initial value:
= {
0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0}

Sensible default values for gmp_get_report_opts_t.

Definition at line 214 of file gmp.h.

214 {
215 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0};

◆ gmp_create_task_opts_defaults

const gmp_create_task_opts_t gmp_create_task_opts_defaults
static
Initial value:
= {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, 0, NULL, NULL, NULL, NULL, 0}

Sensible default values for gmp_get_report_opts_t.

Definition at line 186 of file gmp.h.

186 {
187 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
188 NULL, NULL, 0, NULL, NULL, NULL, NULL, 0};

◆ gmp_delete_opts_defaults

const gmp_delete_opts_t gmp_delete_opts_defaults = {0}
static

Sensible default values for gmp_get_report_opts_t.

Definition at line 270 of file gmp.h.

270{0};

◆ gmp_delete_opts_ultimate_defaults

const gmp_delete_opts_t gmp_delete_opts_ultimate_defaults = {1}
static

Default values for gmp_get_report_opts_t for ultimate deletion.

Definition at line 275 of file gmp.h.

275{1};

◆ gmp_get_report_opts_defaults

const gmp_get_report_opts_t gmp_get_report_opts_defaults
static

Sensible default values for gmp_get_report_opts_t.

Definition at line 86 of file gmp.h.

86 {
87 "ROWID",
88 "ascending",
89 "a994b278-1f62-11e1-96ac-406186ea4fc5",
90 "hmlgd",
91 NULL,
92 1,
93 -1,
94 0,
95 0,
96 0,
97 0,
98 NULL,
99 NULL,
100 NULL,
101 NULL,
102 NULL,
103 NULL,
104 NULL,
105 NULL,
106 NULL,
107 NULL,
108 NULL,
109 NULL,
110 NULL,
111 NULL,
112 0,
113 0,
114 0,
115 0,
116 0,
117 0,
118 0};

◆ gmp_get_system_reports_opts_defaults

const gmp_get_system_reports_opts_t gmp_get_system_reports_opts_defaults = {NULL, NULL, NULL, NULL, NULL, 0}
static

Sensible default values for gmp_get_report_opts_t.

Definition at line 234 of file gmp.h.

234{NULL, NULL, NULL, NULL, NULL, 0};

◆ gmp_get_task_opts_defaults

const gmp_get_task_opts_t gmp_get_task_opts_defaults
static
Initial value:
= {NULL, NULL, 0,
0}

Sensible default values for gmp_get_tasks_opts_t.

Definition at line 154 of file gmp.h.

154 {NULL, NULL, 0,
155 0};

◆ gmp_get_tasks_opts_defaults

const gmp_get_tasks_opts_t gmp_get_tasks_opts_defaults
static
Initial value:
= {"", 0, NULL, 0,
0}

Sensible default values for gmp_get_tasks_opts_t.

Definition at line 136 of file gmp.h.

136 {"", 0, NULL, 0,
137 0};

◆ gmp_start_task_opts_defaults

const gmp_start_task_opts_t gmp_start_task_opts_defaults = {NULL}
static

Definition at line 320 of file gmp.h.

320{NULL};