syslog-ng source
parser-expr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2012 Balabit
3  * Copyright (c) 1998-2012 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 LOGPARSER_H_INCLUDED
26 #define LOGPARSER_H_INCLUDED
27 
28 #include "logmsg/logmsg.h"
29 #include "messages.h"
30 #include "logpipe.h"
31 #include "template/templates.h"
32 #include "stats/stats-registry.h"
33 #include <string.h>
34 
35 typedef struct _LogParser LogParser;
36 
37 struct _LogParser
38 {
39  LogPipe super;
40  LogTemplate *template_obj;
42  gboolean (*process)(LogParser *s, LogMessage **pmsg, const LogPathOptions *path_options, const gchar *input,
43  gsize input_len);
44  gchar *name;
45 };
46 
47 gboolean log_parser_deinit_method(LogPipe *s);
48 void log_parser_queue_method(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options);
49 gboolean log_parser_init_method(LogPipe *s);
50 void log_parser_set_template(LogParser *self, LogTemplate *template_obj);
51 void log_parser_clone_settings(LogParser *self, LogParser *cloned);
52 void log_parser_init_instance(LogParser *self, GlobalConfig *cfg);
53 void log_parser_free_method(LogPipe *self);
54 
55 static inline gboolean
56 log_parser_process(LogParser *self, LogMessage **pmsg, const LogPathOptions *path_options, const gchar *input,
57  gssize input_len)
58 {
59  if (input_len < 0)
60  input_len = strlen(input);
61  return self->process(self, pmsg, path_options, input, input_len);
62 }
63 
64 gboolean log_parser_process_message(LogParser *self, LogMessage **pmsg, const LogPathOptions *path_options);
65 
66 #endif
void log_parser_set_template(LogParser *self, LogTemplate *template_obj)
Definition: parser-expr.c:33
void log_parser_init_instance(LogParser *self, GlobalConfig *cfg)
Definition: parser-expr.c:182
void log_parser_queue_method(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options)
Definition: parser-expr.c:89
void log_parser_clone_settings(LogParser *self, LogParser *cloned)
Definition: parser-expr.c:40
gboolean log_parser_init_method(LogPipe *s)
Definition: parser-expr.c:135
gboolean log_parser_process_message(LogParser *self, LogMessage **pmsg, const LogPathOptions *path_options)
Definition: parser-expr.c:47
void log_parser_free_method(LogPipe *self)
Definition: parser-expr.c:172
gboolean log_parser_deinit_method(LogPipe *s)
Definition: parser-expr.c:162
Definition: stats-counter.h:67
Definition: parser-expr.h:38
gboolean(* process)(LogParser *s, LogMessage **pmsg, const LogPathOptions *path_options, const gchar *input, gsize input_len)
Definition: parser-expr.h:42
LogPipe super
Definition: parser-expr.h:39
StatsCounterItem * processed_messages
Definition: parser-expr.h:41
LogTemplate * template_obj
Definition: parser-expr.h:40
gchar * name
Definition: parser-expr.h:44
GlobalConfig * cfg
Definition: test_batched_ack_tracker.c:34
LogMessage * msg
Definition: test_rename.c:35
LogPathOptions path_options
Definition: test_wildcard_file_reader.c:62