summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-11-03 18:44:02 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-11-03 18:44:02 +0100
commitb1db196953713dd09c499a3edf81347bd903c19e (patch)
tree7c4d1d4a92337f0cd1538c7cd9bc77904901ce8d /tools
parent6f511cecfae3592f271627ebcb41e6a8c4f831e9 (diff)
downloadrsyslog-b1db196953713dd09c499a3edf81347bd903c19e.tar.gz
rsyslog-b1db196953713dd09c499a3edf81347bd903c19e.tar.xz
rsyslog-b1db196953713dd09c499a3edf81347bd903c19e.zip
one step closer to dynamically loadable parsers
This is a milestone commit, which adds new code that breaks nothing, but also does not add any visible change. Just prep work...
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am1
-rw-r--r--tools/pmrfc5424.c9
-rw-r--r--tools/pmrfc5424.h33
-rw-r--r--tools/syslogd.c4
4 files changed, 47 insertions, 0 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 233061e6..1dff4b45 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -16,6 +16,7 @@ rsyslogd_SOURCES = \
omdiscard.c \
omdiscard.h \
pmrfc5424.c \
+ pmrfc5424.h \
iminternal.c \
iminternal.h \
pidfile.c \
diff --git a/tools/pmrfc5424.c b/tools/pmrfc5424.c
index 61b2aff9..acc21817 100644
--- a/tools/pmrfc5424.c
+++ b/tools/pmrfc5424.c
@@ -38,14 +38,18 @@
#include "module-template.h"
#include "glbl.h"
#include "errmsg.h"
+#include "parser.h"
+#include "unicode-helper.h"
MODULE_TYPE_PARSER
+PARSER_NAME("rsyslog.rfc5424")
/* internal structures
*/
DEF_PMOD_STATIC_DATA
DEFobjCurrIf(errmsg)
DEFobjCurrIf(glbl)
+DEFobjCurrIf(parser)
/* config data */
@@ -66,6 +70,7 @@ CODESTARTmodExit
/* release what we no longer need */
objRelease(errmsg, CORE_COMPONENT);
objRelease(glbl, CORE_COMPONENT);
+ objRelease(parser, CORE_COMPONENT);
ENDmodExit
@@ -82,6 +87,10 @@ CODESTARTmodInit
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ CHKiRet(objUse(parser, CORE_COMPONENT));
+
+ dbgprintf("rfc5424 parser init called\n");
+ dbgprintf("GetParserName addr %p\n", GetParserName);
ENDmodInit
/* vim:set ai:
diff --git a/tools/pmrfc5424.h b/tools/pmrfc5424.h
new file mode 100644
index 00000000..df2a1c81
--- /dev/null
+++ b/tools/pmrfc5424.h
@@ -0,0 +1,33 @@
+/* pmrfc5424.h
+ * These are the definitions for the RFCC5424 parser module.
+ *
+ * File begun on 2009-11-03 by RGerhards
+ *
+ * Copyright 2009 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 PMRFC54254_H_INCLUDED
+#define PMRFC54254_H_INCLUDED 1
+
+/* prototypes */
+rsRetVal modInitpmrfc5424(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()), modInfo_t*);
+
+#endif /* #ifndef PMRFC54254_H_INCLUDED */
+/* vi:set ai:
+ */
diff --git a/tools/syslogd.c b/tools/syslogd.c
index c1277d3e..3fb54467 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -125,6 +125,7 @@
#include "omfwd.h"
#include "omfile.h"
#include "omdiscard.h"
+#include "pmrfc5424.h"
#include "threads.h"
#include "wti.h"
#include "queue.h"
@@ -1913,6 +1914,9 @@ static rsRetVal loadBuildInModules(void)
*/
CHKiRet(module.doModInit(modInitUsrMsg, (uchar*) "builtin-usrmsg", NULL));
+ /* load build-in parser modules */
+ CHKiRet(module.doModInit(modInitpmrfc5424, UCHAR_CONSTANT("builtin-pmrfc5424"), NULL));
+
/* ok, initialization of the command handler probably does not 100% belong right in
* this space here. However, with the current design, this is actually quite a good
* place to put it. We might decide to shuffle it around later, but for the time