Greenbone Vulnerability Management Libraries 22.35.9
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 1716 of file gmp.c.

1719{
1720 int ret;
1721
1722 if (password)
1723 {
1724 if (comment)
1725 ret = gvm_server_sendf_xml_quiet (session,
1726 "<create_credential>"
1727 "<name>%s</name>"
1728 "<login>%s</login>"
1729 "<password>%s</password>"
1730 "<comment>%s</comment>"
1731 "</create_credential>",
1732 name, login, password, comment);
1733 else
1734 ret = gvm_server_sendf_xml_quiet (session,
1735 "<create_credential>"
1736 "<name>%s</name>"
1737 "<login>%s</login>"
1738 "<password>%s</password>"
1739 "</create_credential>",
1740 name, login, password);
1741 }
1742 else
1743 {
1744 if (comment)
1745 ret = gvm_server_sendf_xml (session,
1746 "<create_credential>"
1747 "<name>%s</name>"
1748 "<login>%s</login>"
1749 "<comment>%s</comment>"
1750 "</create_credential>",
1751 name, login, comment);
1752 else
1753 ret = gvm_server_sendf_xml (session,
1754 "<create_credential>"
1755 "<name>%s</name>"
1756 "<login>%s</login>"
1757 "</create_credential>",
1758 name, login);
1759 }
1760 if (ret)
1761 return -1;
1762
1763 ret = gmp_read_create_response (session, uuid);
1764 if (ret == 201)
1765 return 0;
1766 return ret;
1767}
int gmp_read_create_response(gnutls_session_t *session, gchar **uuid)
Read response status and resource UUID.
Definition gmp.c:880
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 1837 of file gmp.c.

1840{
1841 gchar *comment, *pass, *start, *snmp_elems;
1842 int ret;
1843
1844 /* Create the GMP request. */
1845
1846 if (opts.login == NULL)
1847 return -1;
1848
1849 start =
1850 g_markup_printf_escaped ("<create_credential>"
1851 "<name>%s</name>"
1852 "<login>%s</login>",
1853 opts.name ? opts.name : "unnamed", opts.login);
1854
1855 if (opts.comment)
1856 comment = g_markup_printf_escaped ("<comment>"
1857 "%s"
1858 "</comment>",
1859 opts.comment);
1860 else
1861 comment = NULL;
1862
1863 if (opts.private_key)
1864 pass = g_markup_printf_escaped ("<key>"
1865 "<phrase>%s</phrase>"
1866 "<private>%s</private>"
1867 "</key>",
1868 opts.passphrase ? opts.passphrase : "",
1869 opts.private_key);
1870 else
1871 {
1872 if (opts.passphrase)
1873 pass = g_markup_printf_escaped ("<password>"
1874 "%s"
1875 "</password>",
1876 opts.passphrase);
1877 else
1878 pass = NULL;
1879 }
1880
1881 if (opts.community && opts.auth_algorithm && opts.privacy_password
1882 && opts.privacy_algorithm)
1883 snmp_elems =
1884 g_markup_printf_escaped ("<community>"
1885 "%s"
1886 "</community>"
1887 "<auth_algorithm>"
1888 "%s"
1889 "</auth_algorithm>"
1890 "<privacy>"
1891 "<password>%s</password>"
1892 "<algorithm>%s</algorithm>"
1893 "</privacy>",
1894 opts.community, opts.auth_algorithm,
1896 else
1897 snmp_elems = NULL;
1898
1899 /* Send the request. */
1900
1901 ret = gvm_server_sendf (session, "%s%s%s%s</create_credential>", start,
1902 comment ? comment : "", pass ? pass : "",
1903 snmp_elems ? snmp_elems : "");
1904
1905 g_free (start);
1906 g_free (comment);
1907 g_free (pass);
1908 if (ret)
1909 return -1;
1910
1911 /* Read the response. */
1912
1913 ret = gmp_read_create_response (session, id);
1914 if (ret == 201)
1915 return 0;
1916 return ret;
1917}
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 1784 of file gmp.c.

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

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 1534 of file gmp.c.

1536{
1537 gchar *comment, *ssh, *smb, *esxi, *snmp, *port_range, *start;
1538 gchar *exclude_hosts, *alive_tests;
1539 int ret;
1540
1541 /* Create the GMP request. */
1542
1543 if (opts.hosts == NULL)
1544 return -1;
1545
1546 start =
1547 g_markup_printf_escaped ("<create_target>"
1548 "<name>%s</name>"
1549 "<hosts>%s</hosts>",
1550 opts.name ? opts.name : "unnamed", opts.hosts);
1551
1552 if (opts.exclude_hosts)
1553 exclude_hosts = g_markup_printf_escaped ("<exclude_hosts>"
1554 "%s"
1555 "</exclude_hosts>",
1556 opts.exclude_hosts);
1557 else
1558 exclude_hosts = NULL;
1559
1560 if (opts.alive_tests)
1561 alive_tests = g_markup_printf_escaped ("<alive_tests>"
1562 "%s"
1563 "</alive_tests>",
1564 opts.alive_tests);
1565 else
1566 alive_tests = NULL;
1567
1568 if (opts.comment)
1569 comment = g_markup_printf_escaped ("<comment>"
1570 "%s"
1571 "</comment>",
1572 opts.comment);
1573 else
1574 comment = NULL;
1575
1576 if (opts.ssh_credential_id)
1577 {
1578 if (opts.ssh_credential_port)
1579 ssh = g_markup_printf_escaped ("<ssh_lsc_credential id=\"%s\">"
1580 "<port>%i</port>"
1581 "</ssh_lsc_credential>",
1582 opts.ssh_credential_id,
1583 opts.ssh_credential_port);
1584 else
1585 ssh = g_markup_printf_escaped ("<ssh_lsc_credential id=\"%s\"/>",
1586 opts.ssh_credential_id);
1587 }
1588 else
1589 ssh = NULL;
1590
1591 if (opts.smb_credential_id)
1592 smb = g_markup_printf_escaped ("<smb_lsc_credential id=\"%s\"/>",
1593 opts.smb_credential_id);
1594 else
1595 smb = NULL;
1596
1597 if (opts.esxi_credential_id)
1598 esxi = g_markup_printf_escaped ("<esxi_lsc_credential id=\"%s\"/>",
1599 opts.esxi_credential_id);
1600 else
1601 esxi = NULL;
1602
1603 if (opts.snmp_credential_id)
1604 snmp = g_markup_printf_escaped ("<snmp_credential id=\"%s\"/>",
1605 opts.snmp_credential_id);
1606 else
1607 snmp = NULL;
1608
1609 if (opts.port_range)
1610 port_range =
1611 g_markup_printf_escaped ("<port_range>%s</port_range>", opts.port_range);
1612 else
1613 port_range = NULL;
1614
1615 /* Send the request. */
1616 ret = gvm_server_sendf (session,
1617 "%s%s%s%s%s%s%s%s%s"
1618 "<reverse_lookup_only>%d</reverse_lookup_only>"
1619 "<reverse_lookup_unify>%d</reverse_lookup_unify>"
1620 "</create_target>",
1621 start, exclude_hosts ? exclude_hosts : "",
1622 alive_tests ? alive_tests : "", ssh ? ssh : "",
1623 smb ? smb : "", esxi ? esxi : "", snmp ? snmp : "",
1624 port_range ? port_range : "", comment ? comment : "",
1626 g_free (start);
1627 g_free (exclude_hosts);
1628 g_free (alive_tests);
1629 g_free (ssh);
1630 g_free (smb);
1631 g_free (esxi);
1632 g_free (port_range);
1633 g_free (comment);
1634 if (ret)
1635 return -2;
1636
1637 /* Read the response. */
1638
1639 ret = gmp_read_create_response (session, id);
1640 if (ret == 201)
1641 return 0;
1642 return ret;
1643}
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 709 of file gmp.c.

712{
713 int ret;
714
715 ret = gvm_server_sendf_xml (session,
716 "<create_task>"
717 "<config id=\"%s\"/>"
718 "<target id=\"%s\"/>"
719 "<name>%s</name>"
720 "<comment>%s</comment>"
721 "</create_task>",
722 config, target, name, comment);
723 if (ret)
724 return -1;
725
726 /* Read the response. */
727
728 ret = gmp_read_create_response (session, id);
729 if (ret == 201)
730 return 0;
731 return ret;
732}

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, *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.scanner_id)
560 scanner = g_strdup_printf ("<scanner id=\"%s\"/>", opts.scanner_id);
561 else
562 scanner = NULL;
563
564 if (opts.schedule_id)
565 schedule = g_strdup_printf ("<schedule id=\"%s\"/>"
566 "<schedule_periods>%d</schedule_periods>",
567 opts.schedule_id, opts.schedule_periods);
568 else
569 schedule = NULL;
570
571 if (opts.slave_id)
572 slave = g_strdup_printf ("<slave id=\"%s\"/>", opts.slave_id);
573 else
574 slave = NULL;
575
576 if (opts.max_checks || opts.max_hosts || opts.in_assets || opts.source_iface)
577 {
578 gchar *in_assets, *checks, *hosts, *source_iface;
579
580 in_assets = checks = hosts = source_iface = NULL;
581
582 if (opts.in_assets)
583 in_assets = g_markup_printf_escaped ("<preference>"
584 "<scanner_name>"
585 "in_assets"
586 "</scanner_name>"
587 "<value>"
588 "%s"
589 "</value>"
590 "</preference>",
591 opts.in_assets);
592
593 if (opts.max_hosts)
594 hosts = g_markup_printf_escaped ("<preference>"
595 "<scanner_name>"
596 "max_hosts"
597 "</scanner_name>"
598 "<value>"
599 "%s"
600 "</value>"
601 "</preference>",
602 opts.max_hosts);
603
604 if (opts.max_checks)
605 checks = g_markup_printf_escaped ("<preference>"
606 "<scanner_name>"
607 "max_checks"
608 "</scanner_name>"
609 "<value>"
610 "%s"
611 "</value>"
612 "</preference>",
613 opts.max_checks);
614
615 if (opts.source_iface)
616 source_iface = g_markup_printf_escaped ("<preference>"
617 "<scanner_name>"
618 "source_iface"
619 "</scanner_name>"
620 "<value>"
621 "%s"
622 "</value>"
623 "</preference>",
624 opts.source_iface);
625
626 prefs =
627 g_strdup_printf ("<preferences>%s%s%s%s</preferences>",
628 in_assets ? in_assets : "", checks ? checks : "",
629 hosts ? hosts : "", source_iface ? source_iface : "");
630 g_free (in_assets);
631 g_free (checks);
632 g_free (hosts);
633 g_free (source_iface);
634 }
635
636 if (opts.alert_ids)
637 {
638 unsigned int i;
639 alerts = g_string_new ("");
640 for (i = 0; i < opts.alert_ids->len; i++)
641 {
642 char *alert = (char *) g_ptr_array_index (opts.alert_ids, i);
643 g_string_append_printf (alerts, "<alert id=\"%s\"/>", alert);
644 }
645 }
646 else
647 alerts = g_string_new ("");
648
649 if (opts.observers || opts.observer_groups)
650 {
651 observers = g_string_new ("<observers>");
652
653 if (opts.observers)
654 g_string_append (observers, opts.observers);
655
656 if (opts.observer_groups)
657 {
658 unsigned int i;
659 for (i = 0; i < opts.observer_groups->len; i++)
660 {
661 char *group =
662 (char *) g_ptr_array_index (opts.observer_groups, i);
663 g_string_append_printf (observers, "<group id=\"%s\"/>", group);
664 }
665 }
666 g_string_append (observers, "</observers>");
667 }
668 else
669 observers = g_string_new ("");
670
671 /* Send the request. */
672 ret = gvm_server_sendf (
673 session, "%s%s%s%s%s%s%s</create_task>", start, prefs ? prefs : "",
674 scanner ? scanner : "", schedule ? schedule : "", slave ? slave : "",
675 alerts ? alerts->str : "", observers ? observers->str : "");
676 g_free (start);
677 g_free (prefs);
678 g_free (scanner);
679 g_free (schedule);
680 g_free (slave);
681 g_string_free (alerts, TRUE);
682 g_string_free (observers, TRUE);
683
684 if (ret)
685 return -1;
686
687 /* Read the response. */
688
689 ret = gmp_read_create_response (session, id);
690 if (ret == 201)
691 return 0;
692 return ret;
693}
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 * 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::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 1684 of file gmp.c.

1686{
1687 entity_t entity;
1688 int ret;
1689
1690 if (gvm_server_sendf (session,
1691 "<delete_config config_id=\"%s\" ultimate=\"%d\"/>", id,
1692 opts.ultimate)
1693 == -1)
1694 return -1;
1695
1696 entity = NULL;
1697 ret = gmp_check_response (session, &entity);
1698 if (ret == 0)
1699 free_entity (entity);
1700 return ret;
1701}

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 1929 of file gmp.c.

1931{
1932 entity_t entity;
1933 int ret;
1934
1935 if (gvm_server_sendf (session,
1936 "<delete_credential credential_id=\"%s\""
1937 " ultimate=\"%d\"/>",
1938 id, opts.ultimate)
1939 == -1)
1940 return -1;
1941
1942 entity = NULL;
1943 ret = gmp_check_response (session, &entity);
1944 if (ret == 0)
1945 free_entity (entity);
1946 return ret;
1947}

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 1476 of file gmp.c.

1478{
1479 entity_t entity;
1480 int ret;
1481
1482 if (gvm_server_sendf (
1483 session, "<delete_port_list port_list_id=\"%s\" ultimate=\"%d\"/>", id,
1484 opts.ultimate)
1485 == -1)
1486 return -1;
1487
1488 entity = NULL;
1489 ret = gmp_check_response (session, &entity);
1490 if (ret == 0)
1491 free_entity (entity);
1492 return ret;
1493}

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 1504 of file gmp.c.

1505{
1506 entity_t entity;
1507 int ret;
1508
1509 if (gvm_server_sendf (session, "<delete_report report_id=\"%s\"/>", id))
1510 return -1;
1511
1512 entity = NULL;
1513 ret = gmp_check_response (session, &entity);
1514 if (ret == 0)
1515 free_entity (entity);
1516 return ret;
1517}

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 1655 of file gmp.c.

1657{
1658 entity_t entity;
1659 int ret;
1660
1661 if (gvm_server_sendf (session,
1662 "<delete_target target_id=\"%s\" ultimate=\"%d\"/>", id,
1663 opts.ultimate)
1664 == -1)
1665 return -1;
1666
1667 entity = NULL;
1668 ret = gmp_check_response (session, &entity);
1669 if (ret == 0)
1670 free_entity (entity);
1671 return ret;
1672}

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 1312 of file gmp.c.

1313{
1314 entity_t entity;
1315 int ret;
1316
1317 if (gvm_server_sendf (session, "<delete_task task_id=\"%s\"/>", id) == -1)
1318 return -1;
1319
1320 entity = NULL;
1321 ret = gmp_check_response (session, &entity);
1322 if (ret == 0)
1323 free_entity (entity);
1324 return ret;
1325}

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 1084 of file gmp.c.

1086{
1087 entity_t entity;
1088 int ret;
1089
1090 if (gvm_server_sendf (session,
1091 "<delete_task task_id=\"%s\" ultimate=\"%d\"/>", id,
1092 opts.ultimate)
1093 == -1)
1094 return -1;
1095
1096 entity = NULL;
1097 ret = gmp_check_response (session, &entity);
1098 if (ret == 0)
1099 free_entity (entity);
1100 return ret;
1101}

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 1378 of file gmp.c.

1380{
1381 int ret;
1382 const char *status_code;
1383
1384 if (response == NULL)
1385 return -1;
1386
1387 if (gvm_server_sendf (
1388 session,
1389 "<get_reports"
1390 " details=\"1\""
1391 " report_id=\"%s\""
1392 " format_id=\"%s\""
1393 " host_first_result=\"%i\""
1394 " host_max_results=\"%i\""
1395 "%s%s%s"
1396 "%s%s%s"
1397 "%s%s%s"
1398 "%s%s%s"
1399 "%s%s%s"
1400 "%s%s%s"
1401 "%s%s%s"
1402 "%s%s%s"
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%s%s%s%s/>",
1410 opts.report_id, opts.format_id, opts.host_first_result,
1411 opts.host_max_results, GMP_FMT_STRING_ATTRIB (opts, type),
1412 GMP_FMT_STRING_ATTRIB (opts, filter),
1413 GMP_FMT_STRING_ATTRIB (opts, filt_id),
1414 GMP_FMT_STRING_ATTRIB (opts, host), GMP_FMT_STRING_ATTRIB (opts, pos),
1415 GMP_FMT_STRING_ATTRIB (opts, timezone),
1416 GMP_FMT_STRING_ATTRIB (opts, alert_id),
1417 GMP_FMT_STRING_ATTRIB (opts, delta_report_id),
1418 GMP_FMT_STRING_ATTRIB (opts, delta_states),
1419 GMP_FMT_STRING_ATTRIB (opts, host_levels),
1420 GMP_FMT_STRING_ATTRIB (opts, search_phrase),
1421 GMP_FMT_STRING_ATTRIB (opts, host_search_phrase),
1422 GMP_FMT_STRING_ATTRIB (opts, min_cvss_base),
1423 GMP_FMT_STRING_ATTRIB (opts, min_qod),
1424 GMP_FMT_BOOL_ATTRIB (opts, notes),
1425 GMP_FMT_BOOL_ATTRIB (opts, notes_details),
1426 GMP_FMT_BOOL_ATTRIB (opts, overrides),
1427 GMP_FMT_BOOL_ATTRIB (opts, override_details),
1428 GMP_FMT_BOOL_ATTRIB (opts, apply_overrides),
1429 GMP_FMT_BOOL_ATTRIB (opts, result_hosts_only),
1430 GMP_FMT_BOOL_ATTRIB (opts, ignore_pagination)))
1431 return -1;
1432
1433 *response = NULL;
1434 switch (try_read_entity (session, opts.timeout, response))
1435 {
1436 case 0:
1437 break;
1438 case -4:
1439 return 2;
1440 default:
1441 return -1;
1442 }
1443
1444 /* Check the response. */
1445
1446 status_code = entity_attribute (*response, "status");
1447 if (status_code == NULL)
1448 {
1449 free_entity (*response);
1450 return -1;
1451 }
1452 if (strlen (status_code) == 0)
1453 {
1454 free_entity (*response);
1455 return -1;
1456 }
1457 if (status_code[0] == '2')
1458 return 0;
1459 ret = (int) strtol (status_code, NULL, 10);
1460 free_entity (*response);
1461 if (errno == ERANGE)
1462 return -1;
1463 return ret;
1464}
#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 1961 of file gmp.c.

1963{
1964 if (name)
1965 {
1966 if (gvm_server_sendf (session,
1967 "<get_system_reports name=\"%s\" brief=\"%i\"/>",
1968 name, brief)
1969 == -1)
1970 return -1;
1971 }
1972 else if (gvm_server_sendf (session, "<get_system_reports brief=\"%i\"/>",
1973 brief)
1974 == -1)
1975 return -1;
1976
1977 /* Read and check the response. */
1978 return gmp_check_response (session, reports);
1979}

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 1992 of file gmp.c.

1995{
1996 GString *request;
1997
1998 request = g_string_new ("<get_system_reports");
1999
2000 if (opts.slave_id)
2001 xml_string_append (request, " slave_id=\"%s\"", opts.slave_id);
2002
2003 if (opts.name)
2004 xml_string_append (request, " name=\"%s\"", opts.name);
2005
2006 if (opts.duration)
2007 xml_string_append (request, " duration=\"%s\"", opts.duration);
2008
2009 if (opts.start_time)
2010 xml_string_append (request, " start_time=\"%s\"", opts.start_time);
2011
2012 if (opts.end_time)
2013 xml_string_append (request, " end_time=\"%s\"", opts.end_time);
2014
2015 g_string_append (request, "/>");
2016
2017 /* Create the GMP request. */
2018
2019 if (gvm_server_sendf (session, "%s", request->str) == -1)
2020 {
2021 g_string_free (request, 1);
2022 return -1;
2023 }
2024 g_string_free (request, 1);
2025
2026 /* Read and check the response. */
2027 return gmp_check_response (session, reports);
2028}
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 1340 of file gmp.c.

1342{
1343 (void) include_rcfile;
1344 if (id == NULL)
1345 {
1346 if (gvm_server_sendf (session, "<get_targets tasks=\"%i\"/>", tasks)
1347 == -1)
1348 return -1;
1349 }
1350 else
1351 {
1352 if (gvm_server_sendf (session,
1353 "<get_targets"
1354 " target_id=\"%s\""
1355 " tasks=\"%i\"/>",
1356 id, tasks)
1357 == -1)
1358 return -1;
1359 }
1360
1361 /* Read the response. */
1362 return gmp_check_response (session, target);
1363}

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 1151 of file gmp.c.

1153{
1154 if ((response == NULL) || (opts.task_id == NULL))
1155 return -1;
1156
1157 if (opts.actions)
1158 {
1159 if (gvm_server_sendf (session,
1160 "<get_tasks"
1161 " task_id=\"%s\""
1162 " actions=\"%s\""
1163 "%s/>",
1164 opts.task_id, opts.actions,
1165 GMP_FMT_BOOL_ATTRIB (opts, details)))
1166 return -1;
1167 }
1168 else if (gvm_server_sendf (session,
1169 "<get_tasks"
1170 " task_id=\"%s\""
1171 "%s/>",
1172 opts.task_id, GMP_FMT_BOOL_ATTRIB (opts, details)))
1173 return -1;
1174
1175 return gmp_check_response (session, response);
1176}
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 1116 of file gmp.c.

1118{
1119 (void) include_rcfile;
1120 if (id == NULL)
1121 {
1122 if (gvm_server_sendf (session, "<get_tasks details=\"%i\"/>", details)
1123 == -1)
1124 return -1;
1125 }
1126 else
1127 {
1128 if (gvm_server_sendf (session,
1129 "<get_tasks"
1130 " task_id=\"%s\""
1131 " details=\"%i\"/>",
1132 id, details)
1133 == -1)
1134 return -1;
1135 }
1136
1137 /* Read the response. */
1138 return gmp_check_response (session, status);
1139}

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 1188 of file gmp.c.

1190{
1191 int ret;
1192 const char *status_code;
1193 gchar *cmd;
1194
1195 if (response == NULL)
1196 return -1;
1197
1198 cmd = g_markup_printf_escaped ("<get_tasks"
1199 " filter=\"%s\"",
1200 opts.filter);
1201
1202 if (gvm_server_sendf (session, "%s%s/>", cmd,
1203 GMP_FMT_BOOL_ATTRIB (opts, details)))
1204 {
1205 g_free (cmd);
1206 return -1;
1207 }
1208 g_free (cmd);
1209
1210 *response = NULL;
1211 switch (try_read_entity (session, opts.timeout, response))
1212 {
1213 case 0:
1214 break;
1215 case -4:
1216 return 2;
1217 default:
1218 return -1;
1219 }
1220
1221 /* Check the response. */
1222
1223 status_code = entity_attribute (*response, "status");
1224 if (status_code == NULL)
1225 {
1226 free_entity (*response);
1227 return -1;
1228 }
1229 if (strlen (status_code) == 0)
1230 {
1231 free_entity (*response);
1232 return -1;
1233 }
1234 if (status_code[0] == '2')
1235 return 0;
1236 ret = (int) strtol (status_code, NULL, 10);
1237 free_entity (*response);
1238 if (errno == ERANGE)
1239 return -1;
1240 return ret;
1241}
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 1255 of file gmp.c.

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

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 880 of file gmp.c.

881{
882 int ret;
883 const char *status;
884 entity_t entity;
885
886 /* Read the response. */
887
888 entity = NULL;
889 if (read_entity (session, &entity))
890 return -1;
891
892 /* Parse the response. */
893
894 status = entity_attribute (entity, "status");
895 if (status == NULL)
896 {
897 free_entity (entity);
898 return -1;
899 }
900 if (strlen (status) == 0)
901 {
902 free_entity (entity);
903 return -1;
904 }
905
906 if (uuid)
907 {
908 const char *id;
909
910 id = entity_attribute (entity, "id");
911 if (id == NULL)
912 {
913 free_entity (entity);
914 return -1;
915 }
916 if (strlen (id) == 0)
917 {
918 free_entity (entity);
919 return -1;
920 }
921 *uuid = g_strdup (id);
922 }
923
924 ret = atoi (status);
925 free_entity (entity);
926 return ret;
927}
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 981 of file gmp.c.

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

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 1026 of file gmp.c.

1028{
1029 if (gvm_connection_sendf (connection, "<resume_task task_id=\"%s\"/>",
1030 task_id)
1031 == -1)
1032 return -1;
1033
1034 /* Read the response. */
1035
1036 entity_t entity = NULL;
1037 if (read_entity_c (connection, &entity))
1038 return -1;
1039
1040 /* Check the response. */
1041
1042 const char *status = entity_attribute (entity, "status");
1043 if (status == NULL)
1044 {
1045 free_entity (entity);
1046 return -1;
1047 }
1048 if (strlen (status) == 0)
1049 {
1050 free_entity (entity);
1051 return -1;
1052 }
1053 char first = status[0];
1054 if (first == '2')
1055 {
1056 if (report_id)
1057 {
1058 entity_t report_id_xml = entity_child (entity, "report_id");
1059 if (report_id_xml)
1060 *report_id = g_strdup (entity_text (report_id_xml));
1061 else
1062 {
1063 free_entity (entity);
1064 return -1;
1065 }
1066 }
1067 free_entity (entity);
1068 return 0;
1069 }
1070 free_entity (entity);
1071 return 1;
1072}
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 849 of file gmp.c.

850{
851 int ret;
852
853 /* Check args. */
854
855 if (opts.task_id == NULL)
856 return -1;
857
858 /* Send request. */
859
860 ret = gvm_connection_sendf (connection, "<start_task task_id=\"%s\"/>",
861 opts.task_id);
862 if (ret)
863 return -1;
864
865 /* Read response. */
866
867 return check_response_c (connection, 1);
868}
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 744 of file gmp.c.

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

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 789 of file gmp.c.

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

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 938 of file gmp.c.

939{
940 entity_t entity;
941 int ret;
942
943 if (gvm_server_sendf (session, "<stop_task task_id=\"%s\"/>", id) == -1)
944 return -1;
945
946 entity = NULL;
947 ret = gmp_check_response (session, &entity);
948 if (ret == 0)
949 free_entity (entity);
950 return ret;
951}

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 962 of file gmp.c.

963{
964 if (gvm_connection_sendf (connection, "<stop_task task_id=\"%s\"/>", id)
965 == -1)
966 return -1;
967
968 return gmp_check_response_c (connection);
969}
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.

39 {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};