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
128#ifdef STUMPLESS_JOURNALD_TARGETS_SUPPORTED
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.
定义 config.h:31
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_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.
void stumpless_destroy_element_only(const struct stumpless_element *element)
Destroys an element, freeing any allocated memory.
void stumpless_unload_element_only(const struct stumpless_element *element)
Unloads an element, freeing any allocated memory.
struct stumpless_element * stumpless_add_param(struct stumpless_element *element, struct stumpless_param *param)
Adds a param to an element.
struct stumpless_element * stumpless_new_element(const char *name)
Creates a new element with the given name.
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 * 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.
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.
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.
size_t stumpless_get_param_count(const struct stumpless_element *element)
Returns the number of params in the given element.
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.
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.
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.
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.
struct stumpless_element * stumpless_load_element(struct stumpless_element *element, const char *name)
Loads a provided element with the given name.
const char * stumpless_get_element_name(const struct stumpless_element *element)
Returns the name of the given element.
struct stumpless_element * stumpless_set_element_name(struct stumpless_element *element, const char *name)
Sets the name of the given 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_index(const struct stumpless_element *element, size_t index)
Returns the value of the param at the given index in the given element.
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.
定义 element.h:81
struct stumpless_element * stumpless_copy_element(const struct stumpless_element *element)
Creates a copy of an element.
#define STUMPLESS_MAX_ELEMENT_NAME_LENGTH
The maximum length of an element name, as specified by RFC 5424.
定义 element.h:33
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.
void stumpless_unload_element_and_contents(const struct stumpless_element *e)
Unloads an element as well as all params that it contains.
const char * stumpless_element_to_string(const struct stumpless_element *element)
Returns name and params from element as a formatted string.
void stumpless_destroy_element(const struct stumpless_element *element)
An alias for stumpless_destroy_element_and_contents.
Types and functions for creating and modifying entries.
Types and functions for creating and modifying params.
An element of structured data.
定义 element.h:93
void * mutex
A pointer to a mutex which protects all element fields.
定义 element.h:139
stumpless_element_namer_func_t get_journald_name
Gets the name to use for the journald field corresponding to this element.
定义 element.h:132
size_t name_length
The number of characters in name.
定义 element.h:116
char name[32+1]
The name of the element.
定义 element.h:114
size_t param_count
The number of params in the array.
定义 element.h:127
struct stumpless_param ** params
The parameters this element contains.
定义 element.h:125
A log entry.
定义 entry.h:60
A parameter within a structured data element.
定义 param.h:93
char name[32+1]
The name of the parameter.
定义 param.h:108