Greenbone Vulnerability Manager
22.4.0~dev1
|
GVM GMP layer: GET commands. More...
#include "gmp_get.h"
#include "gmp_base.h"
#include "manage_acl.h"
#include <stdlib.h>
#include <string.h>
Macros | |
#define | G_LOG_DOMAIN "md gmp" |
GLib log domain. | |
Functions | |
void | get_data_parse_attributes (get_data_t *data, const gchar *type, const gchar **attribute_names, const gchar **attribute_values) |
Parse attributes for a GET command. More... | |
int | init_get (gchar *command, get_data_t *get, const gchar *setting_name, int *first) |
Init for a GET handler. More... | |
int | get_next (iterator_t *resources, get_data_t *get, int *first, int *count, int(*init)(iterator_t *, const get_data_t *)) |
Iterate a GET iterator. More... | |
int | send_get_start (const char *type, int(*write_to_client)(const char *, void *), void *write_to_client_data) |
Send start of GET response. More... | |
int | send_get_common (const char *type, get_data_t *get, iterator_t *iterator, int(*write_to_client)(const char *, void *), void *write_to_client_data, int writable, int in_use) |
Send common part of GET response for a single resource. More... | |
int | buffer_get_filter_xml (GString *msg, const char *type, const get_data_t *get, const char *filter_term, const char *extra_xml) |
Write data of a GET command filter to a string buffer as XML. More... | |
static int | send_get_end_internal (const char *type, get_data_t *get, int get_counts, int count, int filtered, int full, int(*write_to_client)(const char *, void *), void *write_to_client_data) |
Send end of GET response. More... | |
int | send_get_end (const char *type, get_data_t *get, int count, int filtered, int full, int(*write_to_client)(const char *, void *), void *write_to_client_data) |
Send end of GET response. More... | |
int | send_get_end_no_counts (const char *type, get_data_t *get, int(*write_to_client)(const char *, void *), void *write_to_client_data) |
Send end of GET response, skipping result counts. More... | |
GVM GMP layer: GET commands.
Common GET command code for the GVM GMP layer.
int buffer_get_filter_xml | ( | GString * | msg, |
const char * | type, | ||
const get_data_t * | get, | ||
const char * | filter_term, | ||
const char * | extra_xml | ||
) |
Write data of a GET command filter to a string buffer as XML.
[in] | msg | The string buffer to write to. |
[in] | type | The filtered type. |
[in] | get | GET data. |
[in] | filter_term | Filter term. |
[in] | extra_xml | Extra XML to include in the FILTER element. |
void get_data_parse_attributes | ( | get_data_t * | data, |
const gchar * | type, | ||
const gchar ** | attribute_names, | ||
const gchar ** | attribute_values | ||
) |
Parse attributes for a GET command.
[in] | data | GET operation data. |
[in] | type | Resource type. |
[in] | attribute_names | XML attribute names. |
[in] | attribute_values | XML attribute values. |
int get_next | ( | iterator_t * | resources, |
get_data_t * | get, | ||
int * | first, | ||
int * | count, | ||
int(*)(iterator_t *, const get_data_t *) | init | ||
) |
Iterate a GET iterator.
If the user requested to start at an offset from the first result, but the result set was empty, then reset the iterator to start from the first result.
[in] | resources | Resource iterator. |
[in] | get | GET command data. |
[out] | first | First. Number of first item to get. |
[out] | count | Count. |
[in] | init | Init function, to reset the iterator. |
int init_get | ( | gchar * | command, |
get_data_t * | get, | ||
const gchar * | setting_name, | ||
int * | first | ||
) |
Init for a GET handler.
[in] | command | GMP command name. |
[in] | get | GET data. |
[in] | setting_name | Type name for setting. |
[out] | first | First result, from filter. |
int send_get_common | ( | const char * | type, |
get_data_t * | get, | ||
iterator_t * | iterator, | ||
int(*)(const char *, void *) | write_to_client, | ||
void * | write_to_client_data, | ||
int | writable, | ||
int | in_use | ||
) |
Send common part of GET response for a single resource.
[in] | type | Type. |
[in] | get | GET data. |
[in] | iterator | Iterator. |
[in] | write_to_client | Function that sends to clients. |
[in] | write_to_client_data | Data for write_to_client. |
[in] | writable | Whether the resource is writable. |
[in] | in_use | Whether the resource is in use. |
int send_get_end | ( | const char * | type, |
get_data_t * | get, | ||
int | count, | ||
int | filtered, | ||
int | full, | ||
int(*)(const char *, void *) | write_to_client, | ||
void * | write_to_client_data | ||
) |
Send end of GET response.
[in] | type | Type. |
[in] | get | GET data. |
[in] | count | Page count. |
[in] | filtered | Filtered count. |
[in] | full | Full count. |
[in] | write_to_client | Function that sends to clients. |
[in] | write_to_client_data | Data for write_to_client. |
|
static |
Send end of GET response.
[in] | type | Type. |
[in] | get | GET data. |
[in] | get_counts | Include counts. |
[in] | count | Page count. |
[in] | filtered | Filtered count. |
[in] | full | Full count. |
[in] | write_to_client | Function that sends to clients. |
[in] | write_to_client_data | Data for write_to_client. |
int send_get_end_no_counts | ( | const char * | type, |
get_data_t * | get, | ||
int(*)(const char *, void *) | write_to_client, | ||
void * | write_to_client_data | ||
) |
Send end of GET response, skipping result counts.
[in] | type | Type. |
[in] | get | GET data. |
[in] | write_to_client | Function that sends to clients. |
[in] | write_to_client_data | Data for write_to_client. |
int send_get_start | ( | const char * | type, |
int(*)(const char *, void *) | write_to_client, | ||
void * | write_to_client_data | ||
) |
Send start of GET response.
[in] | type | Type. |
[in] | write_to_client | Function that sends to clients. |
[in] | write_to_client_data | Data for write_to_client. |