diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | Makefile.am | 51 | ||||
-rw-r--r-- | action.c | 2 | ||||
-rw-r--r-- | cfsysline.c | 2 | ||||
-rw-r--r-- | conf.c | 7 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | dirty.h | 92 | ||||
-rw-r--r-- | gss-misc.c | 3 | ||||
-rw-r--r-- | outchannel.c | 2 | ||||
-rw-r--r-- | parse.h | 19 | ||||
-rw-r--r-- | plugins/imfile/imfile.c | 2 | ||||
-rw-r--r-- | plugins/imgssapi/imgssapi.c | 2 | ||||
-rw-r--r-- | plugins/imklog/imklog.c | 2 | ||||
-rw-r--r-- | plugins/imklog/imklog.h | 2 | ||||
-rw-r--r-- | plugins/imklog/linux.c | 1 | ||||
-rw-r--r-- | plugins/immark/immark.c | 2 | ||||
-rw-r--r-- | plugins/imrelp/imrelp.c | 2 | ||||
-rw-r--r-- | plugins/imtcp/imtcp.c | 2 | ||||
-rw-r--r-- | plugins/imudp/imudp.c | 2 | ||||
-rw-r--r-- | plugins/imuxsock/imuxsock.c | 3 | ||||
-rw-r--r-- | plugins/omgssapi/omgssapi.c | 3 | ||||
-rw-r--r-- | plugins/omlibdbi/omlibdbi.c | 2 | ||||
-rw-r--r-- | plugins/ommail/ommail.c | 2 | ||||
-rw-r--r-- | plugins/ommysql/ommysql.c | 2 | ||||
-rw-r--r-- | plugins/ompgsql/ompgsql.c | 2 | ||||
-rw-r--r-- | plugins/omrelp/omrelp.c | 2 | ||||
-rw-r--r-- | plugins/omsnmp/omsnmp.c | 2 | ||||
-rw-r--r-- | plugins/omtesting/omtesting.c | 2 | ||||
-rw-r--r-- | runtime/errmsg.c | 2 | ||||
-rw-r--r-- | runtime/modules.c | 2 | ||||
-rw-r--r-- | runtime/msg.c | 2 | ||||
-rw-r--r-- | runtime/msg.h | 1 | ||||
-rw-r--r-- | runtime/net.c | 2 | ||||
-rw-r--r-- | runtime/queue.c | 2 | ||||
-rw-r--r-- | runtime/rsyslog.h | 16 | ||||
-rw-r--r-- | runtime/srutils.c | 2 | ||||
-rw-r--r-- | runtime/stream.c | 2 | ||||
-rw-r--r-- | runtime/wti.c | 2 | ||||
-rw-r--r-- | runtime/wtp.c | 2 | ||||
-rw-r--r-- | tcpclt.c | 2 | ||||
-rw-r--r-- | tcps_sess.c | 2 | ||||
-rw-r--r-- | tcpsrv.c | 2 | ||||
-rw-r--r-- | template.c | 2 | ||||
-rw-r--r-- | threads.c | 2 | ||||
-rw-r--r-- | tools/iminternal.c (renamed from iminternal.c) | 0 | ||||
-rw-r--r-- | tools/iminternal.h (renamed from iminternal.h) | 0 | ||||
-rw-r--r-- | tools/omdiscard.c (renamed from omdiscard.c) | 0 | ||||
-rw-r--r-- | tools/omdiscard.h (renamed from omdiscard.h) | 0 | ||||
-rw-r--r-- | tools/omfile.c (renamed from omfile.c) | 3 | ||||
-rw-r--r-- | tools/omfile.h (renamed from omfile.h) | 0 | ||||
-rw-r--r-- | tools/omfwd.c (renamed from omfwd.c) | 0 | ||||
-rw-r--r-- | tools/omfwd.h (renamed from omfwd.h) | 0 | ||||
-rw-r--r-- | tools/omshell.c (renamed from omshell.c) | 0 | ||||
-rw-r--r-- | tools/omshell.h (renamed from omshell.h) | 0 | ||||
-rw-r--r-- | tools/omusrmsg.c (renamed from omusrmsg.c) | 0 | ||||
-rw-r--r-- | tools/omusrmsg.h (renamed from omusrmsg.h) | 0 | ||||
-rw-r--r-- | tools/pidfile.c (renamed from pidfile.c) | 0 | ||||
-rw-r--r-- | tools/pidfile.h (renamed from pidfile.h) | 0 | ||||
-rw-r--r-- | tools/rsyslog.conf.5 (renamed from rsyslog.conf.5) | 0 | ||||
-rw-r--r-- | tools/rsyslogd.8 (renamed from rsyslogd.8) | 0 | ||||
-rw-r--r-- | tools/syslogd.c (renamed from syslogd.c) | 5 | ||||
-rw-r--r-- | tools/syslogd.h (renamed from syslogd.h) | 71 |
62 files changed, 164 insertions, 179 deletions
@@ -2,6 +2,7 @@ model, because some modularization is still outstanding. In theory, this shall enable other utilities but rsyslogd to use the same runtime +- changed directory structure, files are now better organized --------------------------------------------------------------------------- Version 3.17.1 (rgerhards), 2008-04-15 - removed dependency on MAXHOSTNAMELEN as much as it made sense. diff --git a/Makefile.am b/Makefile.am index 123030ce..ef2a0baa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,52 +1,5 @@ sbin_PROGRAMS = man_MANS = - -if ENABLE_RSYSLOGD -sbin_PROGRAMS += rsyslogd -rsyslogd_SOURCES = \ - syslogd.c \ - syslogd.h \ - omshell.c \ - omshell.h \ - omusrmsg.c \ - omusrmsg.h \ - omfwd.c \ - omfwd.h \ - omfile.c \ - omfile.h \ - omdiscard.c \ - omdiscard.h \ - iminternal.c \ - iminternal.h \ - pidfile.c \ - pidfile.h \ - \ - action.c \ - action.h \ - threads.c \ - threads.h \ - \ - parse.c \ - parse.h \ - \ - outchannel.c \ - outchannel.h \ - template.c \ - template.h \ - conf.c \ - conf.h \ - cfsysline.c \ - cfsysline.h - -rsyslogd_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags) -rsyslogd_LDADD = $(zlib_libs) $(pthreads_libs) $(dl_libs) $(rt_libs) $(rsrt_libs) -rsyslogd_LDFLAGS = -export-dynamic - -man_MANS += rsyslogd.8 rsyslog.conf.5 - -endif # if ENABLE_RSYSLOGD - -# now come the library plugins pkglib_LTLIBRARIES = if ENABLE_RFC3195 @@ -111,6 +64,10 @@ SUBDIRS = doc runtime . SUBDIRS += plugins/immark plugins/imuxsock plugins/imtcp plugins/imudp plugins/omtesting +if ENABLE_RSYSLOGD +SUBDIRS += tools +endif + if ENABLE_IMKLOG SUBDIRS += plugins/imklog endif @@ -34,7 +34,7 @@ #include <time.h> #include <errno.h> -#include "syslogd.h" +#include "dirty.h" #include "template.h" #include "action.h" #include "modules.h" diff --git a/cfsysline.c b/cfsysline.c index 1fd03a46..9f2372af 100644 --- a/cfsysline.c +++ b/cfsysline.c @@ -32,7 +32,7 @@ #include <pwd.h> #include <grp.h> -#include "syslogd.h" /* TODO: when the module interface & library design is done, this should be able to go away */ +#include "dirty.h" /* TODO: when the module interface & library design is done, this should be able to go away */ #include "cfsysline.h" #include "obj.h" #include "errmsg.h" @@ -45,7 +45,8 @@ #endif #include "rsyslog.h" -#include "syslogd.h" +#include "syslogd.h" /* this actually *is* part of the syslogd! */ +#include "dirty.h" #include "parse.h" #include "action.h" #include "template.h" @@ -57,6 +58,10 @@ #include "stringbuf.h" #include "srUtils.h" #include "errmsg.h" +#include "net.h" +#include "expr.h" +#include "ctok.h" +#include "ctok_token.h" /* forward definitions */ diff --git a/configure.ac b/configure.ac index 8ea017ee..f352457b 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ(2.61) AC_INIT([rsyslog],[3.17.1],[rsyslog@lists.adiscon.com]) AM_INIT_AUTOMAKE -AC_CONFIG_SRCDIR([syslogd.c]) +AC_CONFIG_SRCDIR([ChangeLog]) AC_CONFIG_HEADERS([config.h]) AC_GNU_SOURCE @@ -635,6 +635,7 @@ AM_CONDITIONAL(ENABLE_IMTEMPLATE, test x$enable_imtemplate = xyes) AC_CONFIG_FILES([Makefile \ runtime/Makefile \ + tools/Makefile \ doc/Makefile \ plugins/imudp/Makefile \ plugins/imtcp/Makefile \ diff --git a/dirty.h b/dirty.h new file mode 100644 index 00000000..5783daf8 --- /dev/null +++ b/dirty.h @@ -0,0 +1,92 @@ +/* This file is an aid to support non-modular object accesses + * while we do not have fully modularized everything. Once this is + * done, this file can (and should) be deleted. Presence of it + * also somewhat indicates that the runtime library is not really + * yet a runtime library, because it depends on some functionality + * residing somewhere else. + * + * Copyright 2007, 2008 Rainer Gerhards and Adiscon GmbH. + * + * This file is part of rsyslog. + * + * Rsyslog is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Rsyslog 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Rsyslog. If not, see <http://www.gnu.org/licenses/>. + * + * A copy of the GPL can be found in the file "COPYING" in this distribution. + */ +#ifndef DIRTY_H_INCLUDED +#define DIRTY_H_INCLUDED 1 + +#define MAXLINE 2048 /* maximum line length */ + +#define MSG_PARSE_HOSTNAME 1 +#define MSG_DONT_PARSE_HOSTNAME 0 + +/* Flags to logmsg(). + */ +#define NOFLAG 0x000 /* no flag is set (to be used when a flag must be specified and none is required) */ +#define INTERNAL_MSG 0x001 /* msg generated by logmsgInternal() --> special handling */ +#define SYNC_FILE 0x002 /* do fsync on file after printing */ +#define ADDDATE 0x004 /* add a date to the message */ +#define MARK 0x008 /* this message is a mark */ + +#ifdef USE_NETZIP +/* config param: minimum message size to try compression. The smaller + * the message, the less likely is any compression gain. We check for + * gain before we submit the message. But to do so we still need to + * do the (costly) compress() call. The following setting sets a size + * for which no call to compress() is done at all. This may result in + * a few more bytes being transmited but better overall performance. + * Note: I have not yet checked the minimum UDP packet size. It might be + * that we do not save anything by compressing very small messages, because + * UDP might need to pad ;) + * rgerhards, 2006-11-30 + */ +#define MIN_SIZE_FOR_COMPRESS 60 +#endif + +extern int glblHadMemShortage; /* indicates if we had memory shortage some time during the run */ +extern int DisableDNS; +extern char **StripDomains; +extern char *LocalDomain; +extern char**LocalHosts; +extern uchar *LocalHostName; +extern int family; +extern int bDropMalPTRMsgs; +extern int option_DisallowWarning; + +rsRetVal submitMsg(msg_t *pMsg); +int getSubString(uchar **ppSrc, char *pDst, size_t DstSize, char cSep); +rsRetVal logmsgInternal(int pri, char *msg, int flags); +rsRetVal parseAndSubmitMessage(char *hname, char *msg, int len, int bParseHost, int flags, flowControl_t flowCtlType); + +/* TODO: the following 2 need to go in conf obj interface... */ +rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *dfltTplName); +rsRetVal cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *pszTpl); + +/* Intervals at which we flush out "message repeated" messages, + * in seconds after previous message is logged. After each flush, + * we move to the next interval until we reach the largest. + * TODO: move this to action object! Only action.c and syslogd.c use it. + */ +extern int bActExecWhenPrevSusp; +extern int iActExecOnceInterval; +extern int MarkInterval; +extern int repeatinterval[2]; +extern int bReduceRepeatMsgs; +#define MAXREPEAT ((int)((sizeof(repeatinterval) / sizeof(repeatinterval[0])) - 1)) +#define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount]) +#define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \ + (f)->f_repeatcount = MAXREPEAT; \ + } +#endif /* #ifndef DIRTY_H_INCLUDED */ @@ -41,11 +41,10 @@ #include <fcntl.h> #endif #include <gssapi/gssapi.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "srUtils.h" #include "net.h" -#include "omfwd.h" #include "template.h" #include "msg.h" #include "module-template.h" diff --git a/outchannel.c b/outchannel.c index d013ea08..5c348b63 100644 --- a/outchannel.c +++ b/outchannel.c @@ -37,7 +37,7 @@ #include <assert.h> #include "stringbuf.h" #include "outchannel.h" -#include "syslogd.h" +#include "dirty.h" static struct outchannel *ochRoot = NULL; /* the root of the outchannel list */ static struct outchannel *ochLast = NULL; /* points to the last element of the outchannel list */ @@ -101,24 +101,9 @@ int parsIsAtEndOfParseString(rsParsObj *pThis); int parsGetCurrentPosition(rsParsObj *pThis); char parsPeekAtCharAtParsPtr(rsParsObj *pThis); #ifdef SYSLOG_INET -rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits); -#endif - -#if 0 /* later! - but leave it in in case we need it some day... */ -/* Parse a property - * This is a complex parsing routine. It parses an property - * entry suitable for use in the property replacer. It is currently - * just an idea if this should be a parser function. - */ -parsRet parsProp(parseObj *pThis, ?? **pPropEtry); +rsRetVal parsAddrWithBits(rsParsObj *pThis, netAddr_t **pIP, int *pBits); #endif #endif -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * tab-width: 8 - * End: - * vi:set ai: +/* vim:set ai: */ diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index 75e54f04..925d0175 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -36,7 +36,7 @@ # include <sys/stat.h> #endif #include "rsyslog.h" /* error codes etc... */ -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" /* access to config file objects */ #include "module-template.h" /* generic module interface code - very important, read it! */ #include "srUtils.h" /* some utility functions */ diff --git a/plugins/imgssapi/imgssapi.c b/plugins/imgssapi/imgssapi.c index 74d5d5c5..c9ac45d1 100644 --- a/plugins/imgssapi/imgssapi.c +++ b/plugins/imgssapi/imgssapi.c @@ -45,7 +45,7 @@ #endif #include <gssapi/gssapi.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" #include "module-template.h" #include "net.h" diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c index c6fb1592..1420e1af 100644 --- a/plugins/imklog/imklog.c +++ b/plugins/imklog/imklog.c @@ -45,7 +45,7 @@ #include <stdarg.h> #include <ctype.h> -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" #include "obj.h" #include "msg.h" diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h index a37ecc9e..0847140b 100644 --- a/plugins/imklog/imklog.h +++ b/plugins/imklog/imklog.h @@ -28,7 +28,7 @@ #define IMKLOG_H_INCLUDED 1 #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" /* interface to "drivers" * the platform specific drivers must implement these entry points. Only one diff --git a/plugins/imklog/linux.c b/plugins/imklog/linux.c index a742a456..d00723dd 100644 --- a/plugins/imklog/linux.c +++ b/plugins/imklog/linux.c @@ -32,7 +32,6 @@ #include <signal.h> #include <string.h> #include <pthread.h> -#include "syslogd.h" #include "cfsysline.h" #include "template.h" #include "msg.h" diff --git a/plugins/immark/immark.c b/plugins/immark/immark.c index 30118de0..1907bb25 100644 --- a/plugins/immark/immark.c +++ b/plugins/immark/immark.c @@ -37,7 +37,7 @@ #include <signal.h> #include <string.h> #include <pthread.h> -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" #include "module-template.h" diff --git a/plugins/imrelp/imrelp.c b/plugins/imrelp/imrelp.c index b7308016..6c969261 100644 --- a/plugins/imrelp/imrelp.c +++ b/plugins/imrelp/imrelp.c @@ -38,7 +38,7 @@ #include <sys/socket.h> #include <librelp.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" #include "module-template.h" #include "net.h" diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c index 7baa95f2..b7f8f0b5 100644 --- a/plugins/imtcp/imtcp.c +++ b/plugins/imtcp/imtcp.c @@ -39,7 +39,7 @@ #include <fcntl.h> #endif #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" #include "module-template.h" #include "net.h" diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c index cda794c3..3103c4f8 100644 --- a/plugins/imudp/imudp.c +++ b/plugins/imudp/imudp.c @@ -33,7 +33,7 @@ #include <unistd.h> #include <netdb.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "net.h" #include "cfsysline.h" #include "module-template.h" diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index f8798039..3ef2c3d1 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -35,11 +35,12 @@ #include <unistd.h> #include <sys/stat.h> #include <sys/un.h> -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" #include "module-template.h" #include "srUtils.h" #include "errmsg.h" +#include "net.h" MODULE_TYPE_INPUT diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c index 078343d5..b8b0b240 100644 --- a/plugins/omgssapi/omgssapi.c +++ b/plugins/omgssapi/omgssapi.c @@ -43,11 +43,10 @@ #endif #include <pthread.h> #include <gssapi/gssapi.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "srUtils.h" #include "net.h" -#include "omfwd.h" #include "template.h" #include "msg.h" #include "cfsysline.h" diff --git a/plugins/omlibdbi/omlibdbi.c b/plugins/omlibdbi/omlibdbi.c index a942a453..661aee6f 100644 --- a/plugins/omlibdbi/omlibdbi.c +++ b/plugins/omlibdbi/omlibdbi.c @@ -40,7 +40,7 @@ #include <errno.h> #include <time.h> #include <dbi/dbi.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "cfsysline.h" #include "srUtils.h" diff --git a/plugins/ommail/ommail.c b/plugins/ommail/ommail.c index 218c73c9..0dda78e9 100644 --- a/plugins/ommail/ommail.c +++ b/plugins/ommail/ommail.c @@ -44,7 +44,7 @@ #include <netdb.h> #include <time.h> #include <sys/socket.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "srUtils.h" #include "cfsysline.h" diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c index 0522e31d..472cb10d 100644 --- a/plugins/ommysql/ommysql.c +++ b/plugins/ommysql/ommysql.c @@ -37,7 +37,7 @@ #include <time.h> #include <mysql/mysql.h> #include <mysql/errmsg.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "srUtils.h" #include "template.h" diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c index 1d7b2eb7..77fd6a07 100644 --- a/plugins/ompgsql/ompgsql.c +++ b/plugins/ompgsql/ompgsql.c @@ -36,7 +36,7 @@ #include <errno.h> #include <time.h> #include <libpq-fe.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "srUtils.h" #include "template.h" diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c index 04571682..182307f6 100644 --- a/plugins/omrelp/omrelp.c +++ b/plugins/omrelp/omrelp.c @@ -36,7 +36,7 @@ #include <errno.h> #include <ctype.h> #include <librelp.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "srUtils.h" #include "cfsysline.h" diff --git a/plugins/omsnmp/omsnmp.c b/plugins/omsnmp/omsnmp.c index 161ec073..21165f9b 100644 --- a/plugins/omsnmp/omsnmp.c +++ b/plugins/omsnmp/omsnmp.c @@ -36,7 +36,7 @@ #include <netdb.h> #include <ctype.h> #include <assert.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "cfsysline.h" #include "module-template.h" diff --git a/plugins/omtesting/omtesting.c b/plugins/omtesting/omtesting.c index 15d3cb80..411bcf88 100644 --- a/plugins/omtesting/omtesting.c +++ b/plugins/omtesting/omtesting.c @@ -49,7 +49,7 @@ #include <string.h> #include <ctype.h> #include <assert.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "module-template.h" diff --git a/runtime/errmsg.c b/runtime/errmsg.c index 42f84724..01d392b7 100644 --- a/runtime/errmsg.c +++ b/runtime/errmsg.c @@ -33,7 +33,7 @@ #include <assert.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "obj.h" #include "errmsg.h" #include "sysvar.h" diff --git a/runtime/modules.c b/runtime/modules.c index f10390c7..8ae9f038 100644 --- a/runtime/modules.c +++ b/runtime/modules.c @@ -49,7 +49,7 @@ #include <unistd.h> #include <sys/file.h> -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" #include "modules.h" #include "errmsg.h" diff --git a/runtime/msg.c b/runtime/msg.c index ed9cdbbb..e5ed19c6 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -36,7 +36,7 @@ #include <assert.h> #include <ctype.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "srUtils.h" #include "stringbuf.h" #include "template.h" diff --git a/runtime/msg.h b/runtime/msg.h index 56ce56bb..9ec038dd 100644 --- a/runtime/msg.h +++ b/runtime/msg.h @@ -107,7 +107,6 @@ struct msg { char *pszTIMESTAMP_PgSQL;/* TIMESTAMP as PgSQL formatted string (always 21 characters) */ int msgFlags; /* flags associated with this message */ }; -typedef struct msg msg_t; /* new name */ /* function prototypes */ diff --git a/runtime/net.c b/runtime/net.c index 84c286d2..70e7d6f6 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -55,7 +55,7 @@ #include <fcntl.h> #include <unistd.h> -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "module-template.h" #include "parse.h" diff --git a/runtime/queue.c b/runtime/queue.c index 0f58c545..11c073a0 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -43,7 +43,7 @@ #include <errno.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "queue.h" #include "stringbuf.h" #include "srUtils.h" diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h index 2dfc266b..5ec3a369 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -44,9 +44,25 @@ # define _FILE_OFFSET_BITS 64 #endif +/* portability: not all platforms have these defines, so we + * define them here if they are missing. -- rgerhards, 2008-03-04 + */ +#ifndef LOG_MAKEPRI +# define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) +#endif +#ifndef LOG_PRI +# define LOG_PRI(p) ((p) & LOG_PRIMASK) +#endif +#ifndef LOG_FAC +# define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) +#endif + + /* define some base data types */ typedef struct thrdInfo thrdInfo_t; typedef struct filed selector_t; /* TODO: this so far resides in syslogd.c, think about modularization */ +typedef struct NetAddr netAddr_t; +typedef struct msg msg_t; /* some universal 64 bit define... */ typedef long long int64; diff --git a/runtime/srutils.c b/runtime/srutils.c index 93908767..f1208c26 100644 --- a/runtime/srutils.c +++ b/runtime/srutils.c @@ -44,7 +44,7 @@ #define TRUE 1 #define FALSE 0 #include "srUtils.h" -#include "syslogd.h" +#include "dirty.h" #include "obj.h" diff --git a/runtime/stream.c b/runtime/stream.c index 1be4571a..7274b807 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -41,7 +41,7 @@ #include <errno.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "stringbuf.h" #include "srUtils.h" #include "obj.h" diff --git a/runtime/wti.c b/runtime/wti.c index 82cd2165..88439049 100644 --- a/runtime/wti.c +++ b/runtime/wti.c @@ -40,7 +40,7 @@ #include <errno.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "stringbuf.h" #include "srUtils.h" #include "wtp.h" diff --git a/runtime/wtp.c b/runtime/wtp.c index fcc7589c..98f1bdbe 100644 --- a/runtime/wtp.c +++ b/runtime/wtp.c @@ -41,7 +41,7 @@ #include <errno.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "stringbuf.h" #include "srUtils.h" #include "wtp.h" @@ -38,7 +38,7 @@ #if HAVE_FCNTL_H #include <fcntl.h> #endif -#include "syslogd.h" +#include "dirty.h" #include "syslogd-types.h" #include "net.h" #include "tcpclt.h" diff --git a/tcps_sess.c b/tcps_sess.c index 001f32f0..b5c9c31f 100644 --- a/tcps_sess.c +++ b/tcps_sess.c @@ -44,7 +44,7 @@ #include <fcntl.h> #endif #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "module-template.h" #include "net.h" #include "tcpsrv.h" @@ -54,7 +54,7 @@ #include <fcntl.h> #endif #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "cfsysline.h" #include "module-template.h" #include "net.h" @@ -33,7 +33,7 @@ #include "syslogd-types.h" #include "template.h" #include "msg.h" -#include "syslogd.h" +#include "dirty.h" #include "obj.h" #include "errmsg.h" @@ -33,7 +33,7 @@ #include <assert.h> #include "rsyslog.h" -#include "syslogd.h" +#include "dirty.h" #include "linkedlist.h" #include "threads.h" diff --git a/iminternal.c b/tools/iminternal.c index 60460a99..60460a99 100644 --- a/iminternal.c +++ b/tools/iminternal.c diff --git a/iminternal.h b/tools/iminternal.h index 8dc0f171..8dc0f171 100644 --- a/iminternal.h +++ b/tools/iminternal.h diff --git a/omdiscard.c b/tools/omdiscard.c index f13144e8..f13144e8 100644 --- a/omdiscard.c +++ b/tools/omdiscard.c diff --git a/omdiscard.h b/tools/omdiscard.h index 116308a4..116308a4 100644 --- a/omdiscard.h +++ b/tools/omdiscard.h diff --git a/omfile.c b/tools/omfile.c index 6a53a723..6bdd17eb 100644 --- a/omfile.c +++ b/tools/omfile.c @@ -85,6 +85,7 @@ static int bEnableSync = 0;/* enable syncing of files (no dash in front of pathn static uchar *pszTplName = NULL; /* name of the default template to use */ /* end globals for default values */ + typedef struct _instanceData { uchar f_fname[MAXFNAME];/* file or template name (display only) */ short fd; /* file descriptor for (current) file */ @@ -775,7 +776,7 @@ CODESTARTparseSelectorAct pData->fileType = eTypeTTY; untty(); } - if (strcmp((char*) p, ctty) == 0) + if (strcmp((char*) p, _PATH_CONSOLE) == 0) pData->fileType = eTypeCONSOLE; break; default: diff --git a/omfile.h b/tools/omfile.h index 03e081f3..03e081f3 100644 --- a/omfile.h +++ b/tools/omfile.h diff --git a/omshell.c b/tools/omshell.c index 2176c101..2176c101 100644 --- a/omshell.c +++ b/tools/omshell.c diff --git a/omshell.h b/tools/omshell.h index 3061ad07..3061ad07 100644 --- a/omshell.h +++ b/tools/omshell.h diff --git a/omusrmsg.c b/tools/omusrmsg.c index 42d3291d..42d3291d 100644 --- a/omusrmsg.c +++ b/tools/omusrmsg.c diff --git a/omusrmsg.h b/tools/omusrmsg.h index 52e780f7..52e780f7 100644 --- a/omusrmsg.h +++ b/tools/omusrmsg.h diff --git a/pidfile.c b/tools/pidfile.c index 2be13da6..2be13da6 100644 --- a/pidfile.c +++ b/tools/pidfile.c diff --git a/pidfile.h b/tools/pidfile.h index 40be9069..40be9069 100644 --- a/pidfile.h +++ b/tools/pidfile.h diff --git a/rsyslog.conf.5 b/tools/rsyslog.conf.5 index 1c47f535..1c47f535 100644 --- a/rsyslog.conf.5 +++ b/tools/rsyslog.conf.5 diff --git a/rsyslogd.8 b/tools/rsyslogd.8 index 2aa911d9..2aa911d9 100644 --- a/rsyslogd.8 +++ b/tools/rsyslogd.8 diff --git a/syslogd.c b/tools/syslogd.c index 68ffe5ce..95a23e99 100644 --- a/syslogd.c +++ b/tools/syslogd.c @@ -237,17 +237,12 @@ static rsRetVal GlobalClassExit(void); # define _PATH_DEV "/dev/" #endif -#ifndef _PATH_CONSOLE -#define _PATH_CONSOLE "/dev/console" -#endif - #ifndef _PATH_TTY #define _PATH_TTY "/dev/tty" #endif static uchar *ConfFile = (uchar*) _PATH_LOGCONF; /* read-only after startup */ static char *PidFile = _PATH_LOGPID; /* read-only after startup */ -char ctty[] = _PATH_CONSOLE; /* this is read-only; used by omfile -- TODO: remove that dependency */ static pid_t myPid; /* our pid for use in self-generated messages, e.g. on startup */ /* mypid is read-only after the initial fork() */ diff --git a/syslogd.h b/tools/syslogd.h index a26af519..01580a51 100644 --- a/syslogd.h +++ b/tools/syslogd.h @@ -29,44 +29,11 @@ #include "linkedlist.h" #include "expr.h" -/* portability: not all platforms have these defines, so we - * define them here if they are missing. -- rgerhards, 2008-03-04 - */ -#ifndef LOG_MAKEPRI -# define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) -#endif -#ifndef LOG_PRI -# define LOG_PRI(p) ((p) & LOG_PRIMASK) -#endif -#ifndef LOG_FAC -# define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) -#endif - -#ifdef USE_NETZIP -/* config param: minimum message size to try compression. The smaller - * the message, the less likely is any compression gain. We check for - * gain before we submit the message. But to do so we still need to - * do the (costly) compress() call. The following setting sets a size - * for which no call to compress() is done at all. This may result in - * a few more bytes being transmited but better overall performance. - * Note: I have not yet checked the minimum UDP packet size. It might be - * that we do not save anything by compressing very small messages, because - * UDP might need to pad ;) - * rgerhards, 2006-11-30 - */ -#define MIN_SIZE_FOR_COMPRESS 60 +#ifndef _PATH_CONSOLE +#define _PATH_CONSOLE "/dev/console" #endif -#define MAXLINE 2048 /* maximum line length */ - -/* Flags to logmsg(). - */ -#define NOFLAG 0x000 /* no flag is set (to be used when a flag must be specified and none is required) */ -#define INTERNAL_MSG 0x001 /* msg generated by logmsgInternal() --> special handling */ -#define SYNC_FILE 0x002 /* do fsync on file after printing */ -#define ADDDATE 0x004 /* add a date to the message */ -#define MARK 0x008 /* this message is a mark */ /* This structure represents the files that will have log * copies printed. @@ -115,15 +82,9 @@ struct filed { }; -#define MSG_PARSE_HOSTNAME 1 -#define MSG_DONT_PARSE_HOSTNAME 0 -rsRetVal parseAndSubmitMessage(char *hname, char *msg, int len, int bParseHost, int flags, flowControl_t flowCtlType); #include "net.h" /* TODO: remove when you remoe isAllowedSender from here! */ void untty(void); rsRetVal selectorConstruct(selector_t **ppThis); -rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *dfltTplName); -rsRetVal cflineParseFileName(uchar* p, uchar *pFileName, omodStringRequest_t *pOMSR, int iEntry, int iTplOpts, uchar *pszTpl); -int getSubString(uchar **ppSrc, char *pDst, size_t DstSize, char cSep); rsRetVal selectorDestruct(void *pVal); rsRetVal selectorAddList(selector_t *f); /* the following prototypes should go away once we have an input @@ -131,35 +92,9 @@ rsRetVal selectorAddList(selector_t *f); */ rsRetVal logmsgInternal(int pri, char *msg, int flags); void logmsg(msg_t *pMsg, int flags); -rsRetVal submitMsg(msg_t *pMsg); -extern int glblHadMemShortage; /* indicates if we had memory shortage some time during the run */ -extern uchar *LocalHostName; -extern int family; extern int NoHops; extern int send_to_all; -extern int option_DisallowWarning; extern int Debug; -extern char**LocalHosts; -extern int DisableDNS; -extern char **StripDomains; -extern char *LocalDomain; -extern int bDropMalPTRMsgs; -extern char ctty[]; -extern int MarkInterval; -extern int bReduceRepeatMsgs; -extern int bActExecWhenPrevSusp; -extern int iActExecOnceInterval; - -/* Intervals at which we flush out "message repeated" messages, - * in seconds after previous message is logged. After each flush, - * we move to the next interval until we reach the largest. - * TODO: move this to action object! - */ -extern int repeatinterval[2]; -#define MAXREPEAT ((int)((sizeof(repeatinterval) / sizeof(repeatinterval[0])) - 1)) -#define REPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount]) -#define BACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \ - (f)->f_repeatcount = MAXREPEAT; \ - } +#include "dirty.h" #endif /* #ifndef SYSLOGD_H_INCLUDED */ |