23#ifndef __STUMPLESS_ELEMENT_H
24# define __STUMPLESS_ELEMENT_H
28# include <stumpless/config.h>
33# define STUMPLESS_MAX_ELEMENT_NAME_LENGTH 32
42#ifdef STUMPLESS_JOURNALD_TARGETS_SUPPORTED
81( *stumpless_element_namer_func_t )(
const struct stumpless_entry *entry,
128#ifdef STUMPLESS_JOURNALD_TARGETS_SUPPORTED
132 stumpless_element_namer_func_t get_journald_name;
134#ifdef STUMPLESS_THREAD_SAFETY_SUPPORTED
178 const char *param_name,
179 const char *param_value );
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
Definition config.h:31
STUMPLESS_PUBLIC_FUNCTION const char * stumpless_element_to_string(const struct stumpless_element *element)
Returns name and params from element as a formatted string.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION const char * stumpless_get_element_name(const struct stumpless_element *element)
Returns the name of the given element.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION void stumpless_unload_element_and_contents(const struct stumpless_element *e)
Unloads an element as well as all params that it contains.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_element * stumpless_add_param(struct stumpless_element *element, struct stumpless_param *param)
Adds a param to an element.
STUMPLESS_PUBLIC_FUNCTION void stumpless_destroy_element_only(const struct stumpless_element *element)
Destroys an element, freeing any allocated memory.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_element * stumpless_new_element(const char *name)
Creates a new element with the given name.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_element * stumpless_load_element(struct stumpless_element *element, const char *name)
Loads a provided element with the given name.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_element * stumpless_set_element_name(struct stumpless_element *element, const char *name)
Sets the name of the given element.
STUMPLESS_PUBLIC_FUNCTION size_t stumpless_get_param_count(const struct stumpless_element *element)
Returns the number of params in the given element.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_element * stumpless_copy_element(const struct stumpless_element *element)
Creates a copy of an element.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION void stumpless_unload_element_only(const struct stumpless_element *element)
Unloads an element, freeing any allocated memory.
STUMPLESS_PUBLIC_FUNCTION void stumpless_destroy_element(const struct stumpless_element *element)
An alias for stumpless_destroy_element_and_contents.
STUMPLESS_PUBLIC_FUNCTION 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.
#define STUMPLESS_MAX_ELEMENT_NAME_LENGTH
The maximum length of an element name, as specified by RFC 5424.
Definition element.h:33
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
STUMPLESS_PUBLIC_FUNCTION 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.
Types and functions for creating and modifying entries.
Types and functions for creating and modifying params.
An element of structured data.
Definition element.h:93
size_t name_length
The number of characters in name.
Definition element.h:116
char name[32+1]
The name of the element.
Definition element.h:114
size_t param_count
The number of params in the array.
Definition element.h:127
struct stumpless_param ** params
The parameters this element contains.
Definition element.h:125
A log entry.
Definition entry.h:60
A parameter within a structured data element.
Definition param.h:93
char name[32+1]
The name of the parameter.
Definition param.h:108