Go to the documentation of this file.
23 #ifndef __STUMPLESS_ELEMENT_H
24 # define __STUMPLESS_ELEMENT_H
33 # define STUMPLESS_MAX_ELEMENT_NAME_LENGTH 32
42 #ifdef STUMPLESS_JOURNALD_TARGETS_SUPPORTED
128 #ifdef STUMPLESS_JOURNALD_TARGETS_SUPPORTED
134 #ifdef STUMPLESS_THREAD_SAFETY_SUPPORTED
178 const char *param_name,
179 const char *param_value );
const char * stumpless_get_param_name_by_index(const struct stumpless_element *element, size_t index)
Gets the name of the param with the given index in this element.
size_t param_count
The number of params in the array.
Definition: element.h:127
struct stumpless_element * stumpless_set_param_value_by_index(struct stumpless_element *element, size_t index, const char *value)
Sets the value of the param at the given index in the given element.
struct stumpless_element * stumpless_set_param(struct stumpless_element *element, size_t index, struct stumpless_param *param)
Puts the param at the given index in the given element.
char * name
The name of the parameter.
Definition: param.h:105
void stumpless_destroy_element_only(const struct stumpless_element *element)
Destroys an element, freeing any allocated memory.
size_t(* stumpless_element_namer_func_t)(const struct stumpless_entry *entry, size_t element_index, char *destination, size_t size)
Gets the name to use for the journald field corresponding to this element.
Definition: element.h:81
struct stumpless_element * stumpless_set_param_value_by_name(struct stumpless_element *element, const char *name, const char *value)
Sets the value of the first param with the given name in the given element.
struct stumpless_element * stumpless_new_element(const char *name)
Creates a new element with the given name.
struct stumpless_element * stumpless_set_element_name(struct stumpless_element *element, const char *name)
Sets the name of the given element.
size_t name_length
The number of characters in name.
Definition: element.h:116
A parameter within a structured data element.
Definition: param.h:90
stumpless_element_namer_func_t get_journald_name
Gets the name to use for the journald field corresponding to this element.
Definition: element.h:132
size_t stumpless_get_param_count(const struct stumpless_element *element)
Returns the number of params in the given element.
char name[32+1]
The name of the element.
Definition: element.h:114
struct stumpless_element * stumpless_add_param(struct stumpless_element *element, struct stumpless_param *param)
Adds a param to an element.
void stumpless_destroy_element_and_contents(const struct stumpless_element *e)
Destroys an element as well as all params that it contains, freeing any allocated memory.
const char * stumpless_get_param_value_by_name(const struct stumpless_element *element, const char *name)
Returns the value of the first param with the given name in the given element.
struct stumpless_param ** params
The parameters this element contains.
Definition: element.h:125
const char * stumpless_get_param_value_by_index(const struct stumpless_element *element, size_t index)
Returns the value of the param at the given index in the given element.
struct stumpless_element * stumpless_add_new_param(struct stumpless_element *element, const char *param_name, const char *param_value)
Creates a new param and adds it to the given element.
void * mutex
A pointer to a mutex which protects all element fields.
Definition: element.h:139
#define STUMPLESS_MAX_ELEMENT_NAME_LENGTH
The maximum length of an element name, as specified by RFC 5424.
Definition: element.h:33
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
Definition: config.h:31
const char * stumpless_element_to_string(const struct stumpless_element *element)
Returns name and params from element as a formatted string.
struct stumpless_param * stumpless_get_param_by_index(const struct stumpless_element *element, size_t index)
Returns the param in the given element at the specified index.
struct stumpless_param * stumpless_get_param_by_name(const struct stumpless_element *element, const char *name)
Returns the first occurrence of a param with the given name in element, if it is found.
A log entry.
Definition: entry.h:63
struct stumpless_element * stumpless_copy_element(const struct stumpless_element *element)
Creates a copy of an element.
const char * stumpless_get_element_name(const struct stumpless_element *element)
Returns the name of the given element.
size_t stumpless_get_param_name_count(const struct stumpless_element *element, const char *name)
Gives the number of params with the given name found in the given element.
An element of structured data.
Definition: element.h:93
void stumpless_destroy_element(const struct stumpless_element *element)
An alias for stumpless_destroy_element_and_contents.
size_t stumpless_get_param_index(const struct stumpless_element *element, const char *name)
Gives the index of the first occurrence of a param with the given name in the given element.
bool stumpless_element_has_param(const struct stumpless_element *element, const char *name)
True if the given element has a param with the given name, false otherwise.