1
/* common header for syslogd
2
* Copyright 2007 Rainer Gerhards and Adiscon GmbH.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
* A copy of the GPL can be found in the file "COPYING" in this distribution.
20
#ifndef SYSLOGD_H_INCLUDED
21
#define SYSLOGD_H_INCLUDED 1
23
#include "syslogd-types.h"
29
/* config param: minimum message size to try compression. The smaller
30
* the message, the less likely is any compression gain. We check for
31
* gain before we submit the message. But to do so we still need to
32
* do the (costly) compress() call. The following setting sets a size
33
* for which no call to compress() is done at all. This may result in
34
* a few more bytes being transmited but better overall performance.
35
* Note: I have not yet checked the minimum UDP packet size. It might be
36
* that we do not save anything by compressing very small messages, because
37
* UDP might need to pad ;)
38
* rgerhards, 2006-11-30
40
#define MIN_SIZE_FOR_COMPRESS 60
43
#define MAXLINE 2048 /* maximum line length */
47
#define INTERNAL_MSG 0x001 /* msg generated by logmsgInternal() --> special handling */
48
#define SYNC_FILE 0x002 /* do fsync on file after printing */
49
#define ADDDATE 0x004 /* add a date to the message */
50
#define MARK 0x008 /* this message is a mark */
52
void dbgprintf(char *, ...);
53
void logerror(char *type);
54
void logerrorSz(char *type, char *errMsg);
55
void logerrorInt(char *type, int iErr);
57
void printchopped(char *hname, char *msg, int len, int fd, int iSourceType);
58
void freeAllSockets(int **socks);
59
int isAllowedSender(struct AllowedSenders *pAllowRoot, struct sockaddr *pFrom, const char *pszFromHost);
60
void getCurrTime(struct syslogTime *t);
61
int formatTimestampToMySQL(struct syslogTime *ts, char* pDst, size_t iLenDst);
62
int formatTimestamp3339(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
63
int formatTimestamp3164(struct syslogTime *ts, char* pBuf, size_t iLenBuf);
65
rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *dfltTplName);
66
rsRetVal cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts);
67
int getSubString(uchar **ppSrc, char *pDst, size_t DstSize, char cSep);
69
extern int glblHadMemShortage; /* indicates if we had memory shortage some time during the run */
70
extern syslogCODE rs_prioritynames[];
71
extern syslogCODE rs_facilitynames[];
72
extern char LocalHostName[];
76
extern int send_to_all;
77
extern int option_DisallowWarning;
79
extern char**LocalHosts;
80
extern int DisableDNS;
81
extern char **StripDomains;
82
extern char *LocalDomain;
83
extern int bDropMalPTRMsgs;
84
extern struct AllowedSenders *pAllowedSenders_TCP;
87
#endif /* #ifndef SYSLOGD_H_INCLUDED */