syslog-ng source
simple-function.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_SIMPLE_FUNCTION_H_INCLUDED
26 #define TEMPLATE_SIMPLE_FUNCTION_H_INCLUDED
27 
28 #include "template/function.h"
29 
30 /* function pointers for template functions */
31 
32 typedef struct _TFSimpleFuncState
33 {
34  gint argc;
35  LogTemplate **argv_templates;
37 
38 typedef void (*TFSimpleFunc)(LogMessage *msg, gint argc, GString *argv[], GString *result, LogMessageValueType *type);
39 
40 gboolean tf_simple_func_prepare(LogTemplateFunction *self, gpointer state, LogTemplate *parent, gint argc,
41  gchar *argv[], GError **error);
42 void tf_simple_func_eval(LogTemplateFunction *self, gpointer state, LogTemplateInvokeArgs *args);
43 void tf_simple_func_call(LogTemplateFunction *self, gpointer state, const LogTemplateInvokeArgs *args, GString *result,
44  LogMessageValueType *type);
45 void tf_simple_func_free_state(gpointer state);
46 
47 #define TEMPLATE_FUNCTION_SIMPLE(x) TEMPLATE_FUNCTION(TFSimpleFuncState, x, tf_simple_func_prepare, tf_simple_func_eval, tf_simple_func_call, tf_simple_func_free_state, x)
48 
49 #endif
gint argc
Definition: gprocess.c:130
gchar ** argv
Definition: gprocess.c:131
NVType LogMessageValueType
Definition: logmsg.h:195
void tf_simple_func_eval(LogTemplateFunction *self, gpointer state, LogTemplateInvokeArgs *args)
Definition: simple-function.c:69
void tf_simple_func_free_state(gpointer state)
Definition: simple-function.c:93
void(* TFSimpleFunc)(LogMessage *msg, gint argc, GString *argv[], GString *result, LogMessageValueType *type)
Definition: simple-function.h:38
void tf_simple_func_call(LogTemplateFunction *self, gpointer state, const LogTemplateInvokeArgs *args, GString *result, LogMessageValueType *type)
Definition: simple-function.c:83
gboolean tf_simple_func_prepare(LogTemplateFunction *self, gpointer state, LogTemplate *parent, gint argc, gchar *argv[], GError **error)
Definition: simple-function.c:41
Definition: function.h:39
Definition: simple-function.h:33
LogTemplate ** argv_templates
Definition: simple-function.h:35
gint argc
Definition: simple-function.h:34
GString * result
Definition: test_lexer_block.c:34
LogMessage * msg
Definition: test_rename.c:35
struct @95 state