/usr/include/syslog-ng/logmatcher.h is in syslog-ng-dev 3.5.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | /*
* Copyright (c) 2002-2010 BalaBit IT Ltd, Budapest, Hungary
* Copyright (c) 1998-2010 Balázs Scheidler
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As an additional exemption you are allowed to compile & link against the
* OpenSSL libraries as published by the OpenSSL project. See the file
* COPYING for details.
*
*/
#ifndef LOGMATCHER_H_INCLUDED
#define LOGMATCHER_H_INCLUDED
#include "logmsg.h"
#include "template/templates.h"
enum
{
LMR_POSIX_REGEXP,
LMR_PCRE_REGEXP,
LMR_STRING,
LMR_GLOB,
};
enum
{
/* use global search/replace */
/* use global search/replace */
LMF_GLOBAL = 0x0001,
LMF_ICASE = 0x0002,
LMF_MATCH_ONLY = 0x0004,
/* POSIX + PCRE common flags */
LMF_NEWLINE= 0x0008,
LMF_UTF8 = 0x0010,
LMF_STORE_MATCHES = 0x0020,
LMF_VALID_REGEXP_FLAGS = 0x0037,
/* string flags */
LMF_SUBSTRING = 0x0040,
LMF_PREFIX = 0x0080,
LMF_VALID_STRING_FLAGS = 0x00C7,
};
typedef struct _LogMatcher LogMatcher;
struct _LogMatcher
{
gint ref_cnt;
gint type;
gint flags;
gboolean (*compile)(LogMatcher *s, const gchar *re);
/* value_len can be -1 to indicate unknown length */
gboolean (*match)(LogMatcher *s, LogMessage *msg, gint value_handle, const gchar *value, gssize value_len);
/* value_len can be -1 to indicate unknown length, new_length can be returned as -1 to indicate unknown length */
gchar *(*replace)(LogMatcher *s, LogMessage *msg, gint value_handle, const gchar *value, gssize value_len, LogTemplate *replacement, gssize *new_length);
void (*free_fn)(LogMatcher *s);
};
static inline gboolean
log_matcher_compile(LogMatcher *s, const gchar *re)
{
return s->compile(s, re);
}
static inline gboolean
log_matcher_match(LogMatcher *s, LogMessage *msg, gint value_handle, const gchar *value, gssize value_len)
{
return s->match(s, msg, value_handle, value, value_len);
}
static inline gchar *
log_matcher_replace(LogMatcher *s, LogMessage *msg, gint value_handle, const gchar *value, gssize value_len, LogTemplate *replacement, gssize *new_length)
{
if (s->replace)
return s->replace(s, msg, value_handle, value, value_len, replacement, new_length);
return NULL;
}
static inline void
log_matcher_set_flags(LogMatcher *s, gint flags)
{
s->flags = flags;
}
gint log_matcher_lookup_flag(const gchar* flag);
LogMatcher *log_matcher_posix_re_new(void);
LogMatcher *log_matcher_pcre_re_new(void);
LogMatcher *log_matcher_string_new(void);
LogMatcher *log_matcher_glob_new(void);
LogMatcher *log_matcher_new(const gchar *type);
LogMatcher *log_matcher_ref(LogMatcher *s);
void log_matcher_unref(LogMatcher *s);
#endif
|