syslog-ng source
kv-parser.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Balabit
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 as published
6  * by the Free Software Foundation, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * As an additional exemption you are allowed to compile & link against the
18  * OpenSSL libraries as published by the OpenSSL project. See the file
19  * COPYING for details.
20  */
21 
22 #ifndef KVPARSER_H_INCLUDED
23 #define KVPARSER_H_INCLUDED
24 
25 #include "parser/parser-expr.h"
27 
28 /* base class */
29 typedef struct _KVParser KVParser;
30 struct _KVParser
31 {
32  LogParser super;
35  gchar *prefix;
37  gsize prefix_len;
38  void (*init_scanner)(KVParser *self, KVScanner *kv_scanner);
39 };
40 
41 static inline void
42 kv_parser_init_scanner(KVParser *self, KVScanner *kv_scanner)
43 {
44  self->init_scanner(self, kv_scanner);
45 }
46 
47 void kv_parser_set_prefix(LogParser *p, const gchar *prefix);
48 void kv_parser_set_value_separator(LogParser *p, gchar value_separator);
49 void kv_parser_set_pair_separator(LogParser *p, const gchar *pair_separator);
50 void kv_parser_set_stray_words_value_name(LogParser *s, const gchar *value_name);
52 
53 void kv_parser_init_scanner_method(KVParser *self, KVScanner *kv_scanner);
54 
55 gboolean kv_parser_init_method(LogPipe *s);
56 gboolean kv_parser_deinit_method(LogPipe *s);
57 LogPipe *kv_parser_clone_method(KVParser *dst, KVParser *src);
58 void kv_parser_init_instance(KVParser *self, GlobalConfig *cfg);
59 LogParser *kv_parser_new(GlobalConfig *cfg);
60 
61 #endif
gboolean kv_parser_init_method(LogPipe *s)
void kv_parser_set_pair_separator(LogParser *p, const gchar *pair_separator)
Definition: kv-parser.c:61
LogParser * kv_parser_new(GlobalConfig *cfg)
Definition: kv-parser.c:180
void kv_parser_init_scanner_method(KVParser *self, KVScanner *kv_scanner)
Definition: kv-parser.c:98
gboolean kv_parser_deinit_method(LogPipe *s)
void kv_parser_set_value_separator(LogParser *p, gchar value_separator)
Definition: kv-parser.c:53
LogPipe * kv_parser_clone_method(KVParser *dst, KVParser *src)
Definition: kv-parser.c:137
gboolean kv_parser_is_valid_separator_character(gchar c)
void kv_parser_set_prefix(LogParser *p, const gchar *prefix)
Definition: kv-parser.c:35
void kv_parser_init_instance(KVParser *self, GlobalConfig *cfg)
Definition: kv-parser.c:169
void kv_parser_set_stray_words_value_name(LogParser *s, const gchar *value_name)
Definition: kv-parser.c:70
Definition: kv-parser.h:31
gchar * stray_words_value_name
Definition: kv-parser.h:36
gsize prefix_len
Definition: kv-parser.h:37
gchar * pair_separator
Definition: kv-parser.h:34
gchar * prefix
Definition: kv-parser.h:35
gchar value_separator
Definition: kv-parser.h:33
void(* init_scanner)(KVParser *self, KVScanner *kv_scanner)
Definition: kv-parser.h:38
LogParser super
Definition: kv-parser.h:32
GlobalConfig * cfg
Definition: test_batched_ack_tracker.c:34
KVScanner kv_scanner
Definition: test_linux_audit_scanner.c:30