1 /* syslogd-type.h
2  * This file contains type defintions used by syslogd and its modules.
3  * It is a required input for any module.
4  *
5  * File begun on 2007-07-13 by RGerhards (extracted from syslogd.c)
6  *
7  * Copyright 2007-2018 Adiscon GmbH.
8  *
9  * This file is part of the rsyslog runtime library.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  *       http://www.apache.org/licenses/LICENSE-2.0
16  *       -or-
17  *       see COPYING.ASL20 in the source distribution
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 #ifndef	SYSLOGD_TYPES_INCLUDED
26 #define	SYSLOGD_TYPES_INCLUDED 1
27 
28 #include "stringbuf.h"
29 #include <sys/param.h>
30 
31 /* we use RSTRUE/FALSE to prevent name claches with other packages */
32 #define RSFALSE 0
33 #define RSTRUE 1
34 
35 #define MAXFNAME	4096	/* max file pathname length */
36 
37 #define	_DB_MAXDBLEN	128	/* maximum number of db */
38 #define _DB_MAXUNAMELEN	128	/* maximum number of user name */
39 #define	_DB_MAXPWDLEN	128 	/* maximum number of user's pass */
40 #define _DB_DELAYTIMEONERROR	20	/* If an error occur we stop logging until
41 					   a delayed time is over */
42 
43 
44 /* we define features of the syslog code. This features can be used
45  * to check if modules are compatible with them - and possible other
46  * applications I do not yet envision. -- rgerhards, 2007-07-24
47  */
48 typedef enum _syslogFeature {
49 	sFEATURERepeatedMsgReduction = 1,	/* for output modules */
50 	sFEATURENonCancelInputTermination = 2,	/* for input modules */
51 	sFEATUREAutomaticSanitazion = 3,	/* for parser modules */
52 	sFEATUREAutomaticPRIParsing = 4		/* for parser modules */
53 } syslogFeature;
54 
55 /* we define our own facility and severities */
56 /* facility and severity codes */
57 typedef struct _syslogCode {
58 	char    *c_name;
59 	int     c_val;
60 } syslogCODE;
61 
62 /* values for host comparisons specified with host selector blocks
63  * (+host, -host). rgerhards 2005-10-18.
64  */
65 enum _EHostnameCmpMode {
66 	HN_NO_COMP = 0, /* do not compare hostname */
67 	HN_COMP_MATCH = 1, /* hostname must match */
68 	HN_COMP_NOMATCH = 2 /* hostname must NOT match */
69 };
70 typedef enum _EHostnameCmpMode EHostnameCmpMode;
71 
72 /* time type numerical values for structure below */
73 #define TIME_TYPE_UNINIT	0
74 #define TIME_TYPE_RFC3164	1
75 #define TIME_TYPE_RFC5424	2
76 /* rgerhards 2004-11-11: the following structure represents
77  * a time as it is used in syslog.
78  * rgerhards, 2009-06-23: packed structure for better cache performance
79  * (but left ultimate decision about packing to compiler)
80  */
81 struct syslogTime {
82 	intTiny timeType;	/* 0 - unitinialized , 1 - RFC 3164, 2 - syslog-protocol */
83 	intTiny month;
84 	intTiny day;
85 	intTiny wday;
86 	intTiny hour; /* 24 hour clock */
87 	intTiny minute;
88 	intTiny second;
89 	intTiny secfracPrecision;
90 	intTiny OffsetMinute;	/* UTC offset in minutes */
91 	intTiny OffsetHour;	/* UTC offset in hours
92 				 * full UTC offset minutes = OffsetHours*60 + OffsetMinute. Then use
93 				 * OffsetMode to know the direction.
94 				 */
95 	char OffsetMode;	/* UTC offset + or - */
96 	short year;
97 	int secfrac;	/* fractional seconds (must be 32 bit!) */
98 	intTiny inUTC;	/* forced UTC? */
99 };
100 typedef struct syslogTime syslogTime_t;
101 
102 struct tzinfo {
103 	char *id;
104 	char offsMode;
105 	int8_t offsHour;
106 	int8_t offsMin;
107 };
108 typedef struct tzinfo tzinfo_t;
109 
110 typedef enum 	{ ACT_STRING_PASSING = 0, ACT_ARRAY_PASSING = 1, ACT_MSG_PASSING = 2,
111 	  ACT_JSON_PASSING = 3} paramPassing_t;
112 
113 #endif /* #ifndef SYSLOGD_TYPES_INCLUDED */
114 /* vi:set ai:
115  */
116