stumpless 2.2.0
Loading...
Searching...
No Matches
param.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: Apache-2.0 */
2
3/*
4 * Copyright 2018-2022 Joel E. Anderson
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
23#ifndef __STUMPLESS_PARAM_H
24# define __STUMPLESS_PARAM_H
25
26# include <stddef.h>
27# include <stumpless/config.h>
28# include <stumpless/entry.h>
29
31# define STUMPLESS_MAX_PARAM_NAME_LENGTH 32
32
33# ifdef __cplusplus
34extern "C" {
35# endif
36
37// this is required due to the circular dependency with the entry header.
38struct stumpless_entry;
39
40#ifdef STUMPLESS_JOURNALD_TARGETS_SUPPORTED
79typedef
80size_t
81( *stumpless_param_namer_func_t )( const struct stumpless_entry *entry,
82 size_t element_index,
83 size_t param_index,
84 char *destination,
85 size_t size );
86#endif
87
125 char *value;
128# ifdef STUMPLESS_JOURNALD_TARGETS_SUPPORTED
130 stumpless_param_namer_func_t get_journald_name;
131# endif
132# ifdef STUMPLESS_THREAD_SAFETY_SUPPORTED
137 void *mutex;
138# endif
139};
140
164struct stumpless_param *
166
187void
189
220const char *
222
253const char *
255
297struct stumpless_param *
299 const char *name,
300 const char *value );
301
328struct stumpless_param *
329stumpless_new_param( const char *name, const char *value );
330
356struct stumpless_param *
358
386struct stumpless_param *
387stumpless_set_param_name( struct stumpless_param *param, const char *name );
388
416struct stumpless_param *
417stumpless_set_param_value( struct stumpless_param *param, const char *value );
418
419
447const char *
449
476void
478
479# ifdef __cplusplus
480} /* extern "C" */
481# endif
482
483#endif /* __STUMPLESS_PARAM_H */
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
Definition config.h:31
Types and functions for creating and modifying entries.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_param * stumpless_set_param_value(struct stumpless_param *param, const char *value)
Sets the value of the given param.
STUMPLESS_PUBLIC_FUNCTION const char * stumpless_param_to_string(const struct stumpless_param *param)
Returns the name and the value from param as a formatted string.
STUMPLESS_PUBLIC_FUNCTION void stumpless_destroy_param(const struct stumpless_param *param)
Destroys a param, freeing any allocated memory.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_param * stumpless_copy_param(const struct stumpless_param *param)
Creates a copy of a param.
STUMPLESS_PUBLIC_FUNCTION const char * stumpless_get_param_value(const struct stumpless_param *param)
Returns the value of the given param.
#define STUMPLESS_MAX_PARAM_NAME_LENGTH
The maximum length of a parameter name, as specified by RFC 5424.
Definition param.h:31
STUMPLESS_PUBLIC_FUNCTION void stumpless_unload_param(const struct stumpless_param *param)
Unloads a param.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_param * stumpless_new_param_from_string(const char *string)
Creates a new param given a string by parsing the string and calling stumpless_new_param.
STUMPLESS_PUBLIC_FUNCTION const char * stumpless_get_param_name(const struct stumpless_param *param)
Returns the name of the given param.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_param * stumpless_new_param(const char *name, const char *value)
Creates a new param with the given name and value.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_param * stumpless_set_param_name(struct stumpless_param *param, const char *name)
Sets the name of the given param.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_param * stumpless_load_param(struct stumpless_param *param, const char *name, const char *value)
Loads a provided param with the given values.
A log entry.
Definition entry.h:60
A parameter within a structured data element.
Definition param.h:93
size_t name_length
The number of characters in name (not including the NULL character).
Definition param.h:110
char * value
The value may be any UTF-8 string.
Definition param.h:125
char name[32+1]
The name of the parameter.
Definition param.h:108
size_t value_length
The number of characters in value (not including the NULL character).
Definition param.h:127