syslog-ng source
repr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2014 Balabit
3  * Copyright (c) 1998-2014 Balázs Scheidler
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 TEMPLATE_REPR_H_INCLUDED
26 #define TEMPLATE_REPR_H_INCLUDED
27 
28 #include "template/function.h"
29 #include "template/macros.h"
30 #include "logmsg/logmsg.h"
31 
32 enum
33 {
36  LTE_FUNC
37 };
38 
39 typedef struct _LogTemplateElem
40 {
41  gsize text_len;
42  gchar *text;
43  gchar *default_value;
44  guint16 msg_ref;
45  guint8 type;
46  union
47  {
48  guint macro;
50  struct
51  {
52  LogTemplateFunction *ops;
53  gpointer state;
54  } func;
55  };
57 
58 
59 LogTemplateElem *log_template_elem_new_macro(const gchar *text, guint macro, gchar *default_value, gint msg_ref);
60 LogTemplateElem *log_template_elem_new_value(const gchar *text, gchar *value_name, gchar *default_value, gint msg_ref);
61 LogTemplateElem *log_template_elem_new_func(LogTemplate *template,
62  const gchar *text, gint argc, gchar *argv[], gint msg_ref,
63  GError **error);
64 
65 static inline gboolean
66 log_template_elem_is_literal_string(const LogTemplateElem *self)
67 {
68  return self->type == LTE_MACRO && self->macro == M_NONE;
69 }
70 
71 void log_template_elem_free_list(GList *el);
72 
73 
74 #endif
gint argc
Definition: gprocess.c:130
gchar ** argv
Definition: gprocess.c:131
@ M_NONE
Definition: macros.h:35
guint32 NVHandle
Definition: nvtable.h:35
@ LTE_VALUE
Definition: repr.h:35
@ LTE_MACRO
Definition: repr.h:34
@ LTE_FUNC
Definition: repr.h:36
LogTemplateElem * log_template_elem_new_value(const gchar *text, gchar *value_name, gchar *default_value, gint msg_ref)
Definition: repr.c:43
LogTemplateElem * log_template_elem_new_func(LogTemplate *template, const gchar *text, gint argc, gchar *argv[], gint msg_ref, GError **error)
Definition: repr.c:125
void log_template_elem_free_list(GList *el)
Definition: repr.c:176
LogTemplateElem * log_template_elem_new_macro(const gchar *text, guint macro, gchar *default_value, gint msg_ref)
Definition: repr.c:28
Definition: repr.h:40
gsize text_len
Definition: repr.h:41
LogTemplateFunction * ops
Definition: repr.h:52
gpointer state
Definition: repr.h:53
guint macro
Definition: repr.h:48
guint16 msg_ref
Definition: repr.h:44
gchar * text
Definition: repr.h:42
guint8 type
Definition: repr.h:45
gchar * default_value
Definition: repr.h:43
NVHandle value_handle
Definition: repr.h:49