| 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_MAXCONNINFOLEN 2048 /* maximum length connection string */ |
| 38 |
#define _DB_MAXDBLEN 128 /* maximum number of db */ |
| 39 |
#define _DB_MAXUNAMELEN 128 /* maximum number of user name */ |
| 40 |
#define _DB_MAXPWDLEN 128 /* maximum number of user's pass */ |
| 41 |
#define _DB_DELAYTIMEONERROR 20 /* If an error occur we stop logging until a delayed time is over */ |
| 42 |
|
| 43 |
/* we define features of the syslog code. This features can be used |
| 44 |
* to check if modules are compatible with them - and possible other |
| 45 |
* applications I do not yet envision. -- rgerhards, 2007-07-24 |
| 46 |
*/ |
| 47 |
typedef enum _syslogFeature { |
| 48 |
sFEATURERepeatedMsgReduction = 1, /* for output modules */ |
| 49 |
sFEATURENonCancelInputTermination = 2, /* for input modules */ |
| 50 |
sFEATUREAutomaticSanitazion = 3, /* for parser modules */ |
| 51 |
sFEATUREAutomaticPRIParsing = 4 /* for parser modules */ |
| 52 |
} syslogFeature; |
| 53 |
|
| 54 |
/* we define our own facility and severities */ |
| 55 |
/* facility and severity codes */ |
| 56 |
typedef struct _syslogCode { |
| 57 |
char *c_name; |
| 58 |
int c_val; |
| 59 |
} syslogCODE; |
| 60 |
|
| 61 |
/* values for host comparisons specified with host selector blocks |
| 62 |
* (+host, -host). rgerhards 2005-10-18. |
| 63 |
*/ |
| 64 |
enum _EHostnameCmpMode { |
| 65 |
HN_NO_COMP = 0, /* do not compare hostname */ |
| 66 |
HN_COMP_MATCH = 1, /* hostname must match */ |
| 67 |
HN_COMP_NOMATCH = 2 /* hostname must NOT match */ |
| 68 |
}; |
| 69 |
typedef enum _EHostnameCmpMode EHostnameCmpMode; |
| 70 |
|
| 71 |
/* time type numerical values for structure below */ |
| 72 |
#define TIME_TYPE_UNINIT 0 |
| 73 |
#define TIME_TYPE_RFC3164 1 |
| 74 |
#define TIME_TYPE_RFC5424 2 |
| 75 |
/* rgerhards 2004-11-11: the following structure represents |
| 76 |
* a time as it is used in syslog. |
| 77 |
* rgerhards, 2009-06-23: packed structure for better cache performance |
| 78 |
* (but left ultimate decision about packing to compiler) |
| 79 |
*/ |
| 80 |
struct syslogTime { |
| 81 |
intTiny timeType; /* 0 - unitinialized , 1 - RFC 3164, 2 - syslog-protocol */ |
| 82 |
intTiny month; |
| 83 |
intTiny day; |
| 84 |
intTiny wday; |
| 85 |
intTiny hour; /* 24 hour clock */ |
| 86 |
intTiny minute; |
| 87 |
intTiny second; |
| 88 |
intTiny secfracPrecision; |
| 89 |
intTiny OffsetMinute; /* UTC offset in minutes */ |
| 90 |
intTiny OffsetHour; /* UTC offset in hours |
| 91 |
* full UTC offset minutes = OffsetHours*60 + OffsetMinute. Then use |
| 92 |
* OffsetMode to know the direction. |
| 93 |
*/ |
| 94 |
char OffsetMode; /* UTC offset + or - */ |
| 95 |
short year; |
| 96 |
int secfrac; /* fractional seconds (must be 32 bit!) */ |
| 97 |
intTiny inUTC; /* forced UTC? */ |
| 98 |
}; |
| 99 |
typedef struct syslogTime syslogTime_t; |
| 100 |
|
| 101 |
struct tzinfo { |
| 102 |
char *id; |
| 103 |
char offsMode; |
| 104 |
int8_t offsHour; |
| 105 |
int8_t offsMin; |
| 106 |
}; |
| 107 |
typedef struct tzinfo tzinfo_t; |
| 108 |
|
| 109 |
typedef enum { |
| 110 |
ACT_STRING_PASSING = 0, |
| 111 |
ACT_ARRAY_PASSING = 1, |
| 112 |
ACT_MSG_PASSING = 2, |
| 113 |
ACT_JSON_PASSING = 3 |
| 114 |
} paramPassing_t; |
| 115 |
|
| 116 |
#endif /* #ifndef SYSLOGD_TYPES_INCLUDED */ |
| 117 |
/* vi:set ai: |
| 118 |
*/ |