GVM GMP layer: Base facilities.
More...
#include "gmp_base.h"
#include "manage.h"
#include <stdlib.h>
#include <string.h>
#include <gvm/base/strings.h>
|
int | find_attribute (const gchar **attribute_names, const gchar **attribute_values, const char *attribute_name, const gchar **attribute_value) |
| Find an attribute in a parser callback list of attributes. More...
|
|
int | append_attribute (const gchar **attribute_names, const gchar **attribute_values, const char *attribute_name, gchar **string) |
| Find an attribute in a parser callback list of attributes and append. More...
|
|
void | buffer_xml_append_printf (GString *buffer, const char *format,...) |
| Format XML into a buffer. More...
|
|
gboolean | send_to_client (const char *msg, int(*user_send_to_client)(const char *, void *), void *user_send_to_client_data) |
| Send a response message to the client. More...
|
|
gboolean | send_find_error_to_client (const char *command, const char *type, const char *id, gmp_parser_t *gmp_parser) |
| Send an XML find error response message to the client. More...
|
|
void | error_send_to_client (GError **error) |
| Set an out of space parse error on a GError. More...
|
|
void | internal_error_send_to_client (GError **error) |
| Set an internal error on a GError. More...
|
|
static void | log_event_internal (const char *type, const char *type_name, const char *id, const char *action, int fail) |
| Creates a log event entry for a resource action. More...
|
|
void | log_event (const char *type, const char *type_name, const char *id, const char *action) |
| Creates a log event entry for a resource action. More...
|
|
void | log_event_fail (const char *type, const char *type_name, const char *id, const char *action) |
| Creates a log event failure entry for a resource action. More...
|
|
GVM GMP layer: Base facilities.
GMP base facilities used by all modules, but not exported for users of the GMP layer (i.e. gmpd.c).
◆ append_attribute()
int append_attribute |
( |
const gchar ** |
attribute_names, |
|
|
const gchar ** |
attribute_values, |
|
|
const char * |
attribute_name, |
|
|
gchar ** |
string |
|
) |
| |
Find an attribute in a parser callback list of attributes and append.
it to a string using gvm_append_string.
- Parameters
-
[in] | attribute_names | List of names. |
[in] | attribute_values | List of values. |
[in] | attribute_name | Name of sought attribute. |
[out] | string | String to append attribute value to, if found. |
- Returns
- 1 if found and appended, else 0.
◆ buffer_xml_append_printf()
void buffer_xml_append_printf |
( |
GString * |
buffer, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Format XML into a buffer.
- Parameters
-
[in] | buffer | Buffer. |
[in] | format | Format string for XML. |
[in] | ... | Arguments for format string. |
◆ error_send_to_client()
void error_send_to_client |
( |
GError ** |
error | ) |
|
Set an out of space parse error on a GError.
- Parameters
-
◆ find_attribute()
int find_attribute |
( |
const gchar ** |
attribute_names, |
|
|
const gchar ** |
attribute_values, |
|
|
const char * |
attribute_name, |
|
|
const gchar ** |
attribute_value |
|
) |
| |
Find an attribute in a parser callback list of attributes.
- Parameters
-
[in] | attribute_names | List of names. |
[in] | attribute_values | List of values. |
[in] | attribute_name | Name of sought attribute. |
[out] | attribute_value | Attribute value return. |
- Returns
- 1 if found, else 0.
◆ internal_error_send_to_client()
void internal_error_send_to_client |
( |
GError ** |
error | ) |
|
Set an internal error on a GError.
- Parameters
-
◆ log_event()
void log_event |
( |
const char * |
type, |
|
|
const char * |
type_name, |
|
|
const char * |
id, |
|
|
const char * |
action |
|
) |
| |
Creates a log event entry for a resource action.
- Parameters
-
[in] | type | Resource type. |
[in] | type_name | Resource type name. |
[in] | id | Resource id. |
[in] | action | Action done. |
◆ log_event_fail()
void log_event_fail |
( |
const char * |
type, |
|
|
const char * |
type_name, |
|
|
const char * |
id, |
|
|
const char * |
action |
|
) |
| |
Creates a log event failure entry for a resource action.
- Parameters
-
[in] | type | Resource type. |
[in] | type_name | Resource type name. |
[in] | id | Resource id. |
[in] | action | Action done. |
◆ log_event_internal()
static void log_event_internal |
( |
const char * |
type, |
|
|
const char * |
type_name, |
|
|
const char * |
id, |
|
|
const char * |
action, |
|
|
int |
fail |
|
) |
| |
|
static |
Creates a log event entry for a resource action.
- Parameters
-
[in] | type | Resource type. |
[in] | type_name | Resource type name. |
[in] | id | Resource id. |
[in] | action | Action done. |
[in] | fail | Whether it is a fail event. |
◆ send_find_error_to_client()
gboolean send_find_error_to_client |
( |
const char * |
command, |
|
|
const char * |
type, |
|
|
const char * |
id, |
|
|
gmp_parser_t * |
gmp_parser |
|
) |
| |
Send an XML find error response message to the client.
- Parameters
-
[in] | command | Command name. |
[in] | type | Resource type. |
[in] | id | Resource ID. |
[in] | gmp_parser | GMP Parser. |
- Returns
- TRUE if out of space in to_client, else FALSE.
◆ send_to_client()
gboolean send_to_client |
( |
const char * |
msg, |
|
|
int(*)(const char *, void *) |
user_send_to_client, |
|
|
void * |
user_send_to_client_data |
|
) |
| |
Send a response message to the client.
- Parameters
-
[in] | msg | The message, a string. |
[in] | user_send_to_client | Function to send to client. |
[in] | user_send_to_client_data | Argument to user_send_to_client . |
- Returns
- TRUE if send to client failed, else FALSE.