syslog-ng source
syslog-names.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2011 Balabit
3  * Copyright (c) 1998-2011 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 __SYSLOG_NAMES_H_INCLUDED
26 #define __SYSLOG_NAMES_H_INCLUDED
27 
28 #include "syslog-ng.h"
29 
30 #define SYSLOG_FACMASK 0x03f8 /* mask to extract facility part */
31 /* facility of pri */
32 #define SYSLOG_FAC(p) (((p) & SYSLOG_FACMASK) >> 3)
33 
34 #define SYSLOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
35 /* extract priority */
36 #define SYSLOG_PRI(p) ((p) & SYSLOG_PRIMASK)
37 
38 #define SYSLOG_SEVERITY_CODE(n) ((n) & 7)
39 #define SYSLOG_FACILITY_CODE(n) ((n) << 3)
40 
41 struct sl_name
42 {
43  const char *name;
44  int value;
45 };
46 
47 extern struct sl_name sl_severities[];
48 extern struct sl_name sl_facilities[];
49 
50 /* returns an index where this name is found */
51 int syslog_name_lookup_id_by_name(const char *name, struct sl_name names[]);
52 int syslog_name_lookup_value_by_name(const char *name, struct sl_name names[]);
53 const char *syslog_name_lookup_name_by_value(int value, struct sl_name names[]);
54 
55 guint32 syslog_make_range(guint32 r1, guint32 r2);
56 
57 static inline gint
58 syslog_name_lookup_severity_by_name(const gchar *name)
59 {
61 }
62 
63 gint syslog_name_lookup_severity_by_name_alias(const gchar *name, gssize name_len);
64 
65 static inline gint
66 syslog_name_lookup_facility_by_name(const gchar *name)
67 {
69 }
70 
71 static inline const gchar *
72 syslog_name_lookup_severity_by_value(int value)
73 {
75 }
76 
77 static inline const gchar *
78 syslog_name_lookup_facility_by_value(int value)
79 {
81 }
82 
83 #endif
const gchar * name
Definition: debugger.c:265
Definition: syslog-names.h:42
int value
Definition: syslog-names.h:44
const char * name
Definition: syslog-names.h:43
gint syslog_name_lookup_severity_by_name_alias(const gchar *name, gssize name_len)
Definition: syslog-names.c:151
int syslog_name_lookup_id_by_name(const char *name, struct sl_name names[])
Definition: syslog-names.c:95
guint32 syslog_make_range(guint32 r1, guint32 r2)
Definition: syslog-names.c:129
struct sl_name sl_severities[]
Definition: syslog-names.c:28
int syslog_name_lookup_value_by_name(const char *name, struct sl_name names[])
Definition: syslog-names.c:101
const char * syslog_name_lookup_name_by_value(int value, struct sl_name names[])
Definition: syslog-names.c:114
struct sl_name sl_facilities[]
Definition: syslog-names.c:48
GString * value
Definition: test_decode.c:28