syslog-ng source
value-pairs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2014 Balabit
3  * Copyright (c) 2011-2014 Gergely Nagy <algernon@balabit.hu>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  *
23  */
24 
25 #ifndef VALUE_PAIRS_H_INCLUDED
26 #define VALUE_PAIRS_H_INCLUDED 1
27 
28 #include "syslog-ng.h"
29 #include "logmsg/nvtable.h"
30 #include "logmsg/type-hinting.h"
31 #include "value-pairs/transforms.h"
32 #include "template/templates.h"
33 #include "atomic.h"
34 
35 typedef struct _ValuePairs ValuePairs;
36 
37 typedef gboolean
38 (*VPForeachFunc) (const gchar *name, LogMessageValueType type, const gchar *value,
39  gsize value_len, gpointer user_data);
40 
41 typedef gboolean
42 (*VPWalkValueCallbackFunc) (const gchar *name, const gchar *prefix,
43  LogMessageValueType type, const gchar *value, gsize value_len,
44  gpointer *prefix_data, gpointer user_data);
45 typedef gboolean (*VPWalkCallbackFunc)(const gchar *name,
46  const gchar *prefix, gpointer *prefix_data,
47  const gchar *prev, gpointer *prev_data,
48  gpointer user_data);
49 
50 gboolean value_pairs_add_scope(ValuePairs *vp, const gchar *scope);
51 void value_pairs_add_glob_pattern(ValuePairs *vp, const gchar *pattern, gboolean include);
52 void value_pairs_add_glob_patterns(ValuePairs *vp, GList *patterns, gboolean include);
53 void value_pairs_add_pair(ValuePairs *vp, const gchar *key, LogTemplate *value);
54 
55 void value_pairs_add_transforms(ValuePairs *vp, ValuePairsTransformSet *vpts);
56 void value_pairs_set_cast_to_strings(ValuePairs *vp, gboolean enable);
57 void value_pairs_set_auto_cast(ValuePairs *vp);
58 gboolean value_pairs_is_cast_to_strings_explicit(ValuePairs *vp);
59 
60 void value_pairs_set_include_bytes(ValuePairs *vp, gboolean enable);
61 
62 gboolean value_pairs_foreach_sorted(ValuePairs *vp, VPForeachFunc func,
63  GCompareFunc compare_func,
64  LogMessage *msg, LogTemplateEvalOptions *options,
65  gpointer user_data);
66 gboolean value_pairs_foreach(ValuePairs *vp, VPForeachFunc func,
67  LogMessage *msg, LogTemplateEvalOptions *options,
68  gpointer user_data);
69 
70 gboolean value_pairs_walk(ValuePairs *vp,
71  VPWalkCallbackFunc obj_start_func,
72  VPWalkValueCallbackFunc process_value_func,
73  VPWalkCallbackFunc obj_end_func,
74  LogMessage *msg, LogTemplateEvalOptions *options,
75  gchar key_delimiter,
76  gpointer user_data);
77 
78 ValuePairs *value_pairs_new(GlobalConfig *cfg);
79 ValuePairs *value_pairs_new_default(GlobalConfig *cfg);
80 ValuePairs *value_pairs_ref(ValuePairs *self);
81 void value_pairs_unref(ValuePairs *self);
82 
83 void value_pairs_global_init(void);
84 void value_pairs_global_deinit(void);
85 
86 
87 #endif
const gchar * name
Definition: debugger.c:265
NVType LogMessageValueType
Definition: logmsg.h:195
Definition: eval.h:34
Definition: internals.h:32
GPtrArray * patterns
Definition: internals.h:36
GlobalConfig * cfg
Definition: test_batched_ack_tracker.c:34
GString * value
Definition: test_decode.c:28
LogMessage * msg
Definition: test_rename.c:35
struct tm key
Definition: cache.c:63
void value_pairs_add_transforms(ValuePairs *vp, ValuePairsTransformSet *vpts)
Definition: value-pairs.c:954
void value_pairs_set_cast_to_strings(ValuePairs *vp, gboolean enable)
Definition: value-pairs.c:961
gboolean value_pairs_walk(ValuePairs *vp, VPWalkCallbackFunc obj_start_func, VPWalkValueCallbackFunc process_value_func, VPWalkCallbackFunc obj_end_func, LogMessage *msg, LogTemplateEvalOptions *options, gchar key_delimiter, gpointer user_data)
Definition: value-pairs.c:877
void value_pairs_global_deinit(void)
Definition: value-pairs.c:1124
ValuePairs * value_pairs_ref(ValuePairs *self)
Definition: value-pairs.c:1052
void value_pairs_add_pair(ValuePairs *vp, const gchar *key, LogTemplate *value)
Definition: value-pairs.c:947
void value_pairs_unref(ValuePairs *self)
Definition: value-pairs.c:1064
void value_pairs_add_glob_pattern(ValuePairs *vp, const gchar *pattern, gboolean include)
Definition: value-pairs.c:925
void value_pairs_global_init(void)
Definition: value-pairs.c:1101
gboolean value_pairs_foreach_sorted(ValuePairs *vp, VPForeachFunc func, GCompareFunc compare_func, LogMessage *msg, LogTemplateEvalOptions *options, gpointer user_data)
Definition: value-pairs.c:445
void value_pairs_set_auto_cast(ValuePairs *vp)
Definition: value-pairs.c:968
void value_pairs_set_include_bytes(ValuePairs *vp, gboolean enable)
Definition: value-pairs.c:982
gboolean value_pairs_is_cast_to_strings_explicit(ValuePairs *vp)
Definition: value-pairs.c:976
gboolean(* VPWalkValueCallbackFunc)(const gchar *name, const gchar *prefix, LogMessageValueType type, const gchar *value, gsize value_len, gpointer *prefix_data, gpointer user_data)
Definition: value-pairs.h:42
gboolean value_pairs_add_scope(ValuePairs *vp, const gchar *scope)
Definition: value-pairs.c:906
gboolean(* VPForeachFunc)(const gchar *name, LogMessageValueType type, const gchar *value, gsize value_len, gpointer user_data)
Definition: value-pairs.h:38
ValuePairs * value_pairs_new(GlobalConfig *cfg)
Definition: value-pairs.c:988
gboolean value_pairs_foreach(ValuePairs *vp, VPForeachFunc func, LogMessage *msg, LogTemplateEvalOptions *options, gpointer user_data)
Definition: value-pairs.c:481
void value_pairs_add_glob_patterns(ValuePairs *vp, GList *patterns, gboolean include)
Definition: value-pairs.c:933
ValuePairs * value_pairs_new_default(GlobalConfig *cfg)
Definition: value-pairs.c:1014
gboolean(* VPWalkCallbackFunc)(const gchar *name, const gchar *prefix, gpointer *prefix_data, const gchar *prev, gpointer *prev_data, gpointer user_data)
Definition: value-pairs.h:45