summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/cfsysline.c10
-rw-r--r--runtime/rsconf.c35
-rw-r--r--runtime/rsconf.h38
-rw-r--r--runtime/rsyslog.h1
-rw-r--r--runtime/typedefs.h5
5 files changed, 85 insertions, 4 deletions
diff --git a/runtime/cfsysline.c b/runtime/cfsysline.c
index 97b35bb2..2475c270 100644
--- a/runtime/cfsysline.c
+++ b/runtime/cfsysline.c
@@ -586,6 +586,13 @@ doFacility(uchar **pp, rsRetVal (*pSetHdlr)(void*, int), void *pVal)
}
+static rsRetVal
+doGoneAway(uchar **pp, rsRetVal (*pSetHdlr)(void*, int), void *pVal)
+{
+ errmsg.LogError(0, RS_RET_CMD_GONE_AWAY, "config directive is no longer supported -- ignored");
+ return RS_RET_CMD_GONE_AWAY;
+}
+
/* Implements the severity syntax.
* rgerhards, 2008-02-14
*/
@@ -717,6 +724,9 @@ static rsRetVal cslchCallHdlr(cslCmdHdlr_t *pThis, uchar **ppConfLine)
case eCmdHdlrGetWord:
pHdlr = doGetWord;
break;
+ case eCmdHdlrGoneAway:
+ pHdlr = doGoneAway;
+ break;
default:
iRet = RS_RET_NOT_IMPLEMENTED;
goto finalize_it;
diff --git a/runtime/rsconf.c b/runtime/rsconf.c
index 27d89fb6..d68420bf 100644
--- a/runtime/rsconf.c
+++ b/runtime/rsconf.c
@@ -2,7 +2,7 @@
*
* Module begun 2011-04-19 by Rainer Gerhards
*
- * Copyright 2007, 2008 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2011 by Rainer Gerhards and Adiscon GmbH.
*
* This file is part of the rsyslog runtime library.
*
@@ -33,15 +33,24 @@
#include "obj.h"
#include "srUtils.h"
#include "ruleset.h"
+#include "modules.h"
#include "rsconf.h"
+#include "cfsysline.h"
/* static data */
DEFobjStaticHelpers
+DEFobjCurrIf(ruleset)
+DEFobjCurrIf(module)
/* Standard-Constructor
*/
BEGINobjConstruct(rsconf) /* be sure to specify the object type also in END macro! */
+ pThis->globals.bDebugPrintTemplateList = 1;
+ pThis->globals.bDebugPrintModuleList = 1;
+ pThis->globals.bDebugPrintCfSysLineHandlerList = 1;
+ pThis->globals.bLogStatusMsgs = DFLT_bLogStatusMsgs;
+ pThis->globals.bErrMsgToStderr = 1;
pThis->templates.root = NULL;
pThis->templates.last = NULL;
pThis->templates.lastStatic = NULL;
@@ -71,6 +80,26 @@ ENDobjDestruct(rsconf)
/* DebugPrint support for the rsconf object */
BEGINobjDebugPrint(rsconf) /* be sure to specify the object type also in END and CODESTART macros! */
+ dbgprintf("configuration object %p\n", pThis);
+ dbgprintf("Global Settings:\n");
+ dbgprintf(" bDebugPrintTemplateList.............: %d\n",
+ pThis->globals.bDebugPrintTemplateList);
+ dbgprintf(" bDebugPrintModuleList : %d\n",
+ pThis->globals.bDebugPrintModuleList);
+ dbgprintf(" bDebugPrintCfSysLineHandlerList.....: %d\n",
+ pThis->globals.bDebugPrintCfSysLineHandlerList);
+ dbgprintf(" bLogStatusMsgs : %d\n",
+ pThis->globals.bLogStatusMsgs);
+ dbgprintf(" bErrMsgToStderr.....................: %d\n",
+ pThis->globals.bErrMsgToStderr);
+ ruleset.DebugPrintAll(pThis);
+ DBGPRINTF("\n");
+ if(pThis->globals.bDebugPrintTemplateList)
+ tplPrintList(pThis);
+ if(pThis->globals.bDebugPrintModuleList)
+ module.PrintList();
+ if(pThis->globals.bDebugPrintCfSysLineHandlerList)
+ dbgPrintCfSysLineHandlers();
CODESTARTobjDebugPrint(rsconf)
ENDobjDebugPrint(rsconf)
@@ -102,6 +131,8 @@ ENDobjQueryInterface(rsconf)
*/
BEGINObjClassInit(rsconf, 1, OBJ_IS_CORE_MODULE) /* class, version */
/* request objects we use */
+ CHKiRet(objUse(ruleset, CORE_COMPONENT));
+ CHKiRet(objUse(module, CORE_COMPONENT));
/* now set our own handlers */
OBJSetMethodHandler(objMethod_DEBUGPRINT, rsconfDebugPrint);
@@ -112,6 +143,8 @@ ENDObjClassInit(rsconf)
/* De-initialize the rsconf class.
*/
BEGINObjClassExit(rsconf, OBJ_IS_CORE_MODULE) /* class, version */
+ objRelease(ruleset, CORE_COMPONENT);
+ objRelease(module, CORE_COMPONENT);
ENDObjClassExit(rsconf)
/* vi:set ai:
diff --git a/runtime/rsconf.h b/runtime/rsconf.h
index 32488d08..68325852 100644
--- a/runtime/rsconf.h
+++ b/runtime/rsconf.h
@@ -27,9 +27,32 @@
/* --- configuration objects (the plan is to have ALL upper layers in this file) --- */
-/* the following structure is a container for all known templates
- * inside a specific configuration. -- rgerhards 2011-04-19
+/* globals are data items that are really global, and can be set only
+ * once (at least in theory, because the legacy system permits them to
+ * be re-set as often as the user likes).
*/
+struct globals_s {
+ int bDebugPrintTemplateList;
+ int bDebugPrintModuleList;
+ int bDebugPrintCfSysLineHandlerList;
+ int bLogStatusMsgs; /* log rsyslog start/stop/HUP messages? */
+ int bErrMsgToStderr; /* print error messages to stderr (in addition to everything else)? */
+};
+
+/* (global) defaults are global in the sense that they are accessible
+ * to all code, but they can change value and other objects (like
+ * actions) actually copy the value a global had at the time the action
+ * was defined. In that sense, a global default is just that, a default,
+ * wich can (and will) be changed in the course of config file
+ * processing. Once the config file has been processed, defaults
+ * can be dropped. The current code does not do this for simplicity.
+ * That is not a problem, because the defaults do not take up much memory.
+ * At a later stage, we may think about dropping them. -- rgerhards, 2011-04-19
+ */
+struct defaults_s {
+};
+
+
struct templates_s {
struct template *root; /* the root of the template list */
struct template *last; /* points to the last element of the template list */
@@ -56,9 +79,17 @@ struct rulesets_s {
/* the rsconf object */
struct rsconf_s {
BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */
+ globals_t globals;
+ defaults_t defaults;
templates_t templates;
actions_t actions;
rulesets_t rulesets;
+ /* note: rulesets include the complete output part:
+ * - rules
+ * - filter (as part of the action)
+ * - actions
+ * Of course, we need to debate if we shall change that some time...
+ */
};
@@ -75,4 +106,7 @@ ENDinterface(rsconf)
/* prototypes */
PROTOTYPEObj(rsconf);
+/* some defaults (to be removed?) */
+#define DFLT_bLogStatusMsgs 1
+
#endif /* #ifndef INCLUDED_RSCONF_H */
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index 78841410..fcc0d626 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -354,6 +354,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_ERR_LIBEE_INIT = -2201, /**< cannot obtain libee ctx */
RS_RET_ERR_LIBLOGNORM_INIT = -2202,/**< cannot obtain liblognorm ctx */
RS_RET_ERR_LIBLOGNORM_SAMPDB_LOAD = -2203,/**< liblognorm sampledb load failed */
+ RS_RET_CMD_GONE_AWAY = -2204,/**< config directive existed, but no longer supported */
/* RainerScript error messages (range 1000.. 1999) */
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */
diff --git a/runtime/typedefs.h b/runtime/typedefs.h
index 11cc467d..e46f509b 100644
--- a/runtime/typedefs.h
+++ b/runtime/typedefs.h
@@ -82,6 +82,8 @@ typedef struct statsobj_s statsobj_t;
typedef struct nsd_epworkset_s nsd_epworkset_t;
typedef struct templates_s templates_t;
typedef struct rulesets_s rulesets_t;
+typedef struct globals_s globals_t;
+typedef struct defaults_s defaults_t;
typedef struct actions_s actions_t;
typedef struct rsconf_s rsconf_t;
typedef rsRetVal (*prsf_t)(struct vmstk_s*, int); /* pointer to a RainerScript function */
@@ -150,7 +152,8 @@ typedef enum cslCmdHdlrType {
eCmdHdlrGetChar,
eCmdHdlrFacility,
eCmdHdlrSeverity,
- eCmdHdlrGetWord
+ eCmdHdlrGetWord,
+ eCmdHdlrGoneAway /* statment existed, but is no longer supported */
} ecslCmdHdrlType;