summaryrefslogtreecommitdiffstats
path: root/runtime/glbl.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-18 11:40:15 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-18 11:40:15 +0200
commit1daf8d492f932739b6fcde732812116c7666b2bc (patch)
tree24dd3b699f1e4277919a64f4d9f513e1821b7b01 /runtime/glbl.c
parentea4a3a3cd95faf9328def84e3e253d6c1a4375f7 (diff)
downloadrsyslog-1daf8d492f932739b6fcde732812116c7666b2bc.tar.gz
rsyslog-1daf8d492f932739b6fcde732812116c7666b2bc.tar.xz
rsyslog-1daf8d492f932739b6fcde732812116c7666b2bc.zip
converted netstrm into generic netstrm and the nsd_pctp driver
Diffstat (limited to 'runtime/glbl.c')
-rw-r--r--runtime/glbl.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/runtime/glbl.c b/runtime/glbl.c
index 047fd611..1e51b0e0 100644
--- a/runtime/glbl.c
+++ b/runtime/glbl.c
@@ -38,6 +38,11 @@
#include "cfsysline.h"
#include "glbl.h"
+/* some defaults */
+#ifndef DFLT_NETSTRM_DRVR
+# define DFLT_NETSTRM_DRVR ((uchar*)"lmnsd_ptcp")
+#endif
+
/* static data */
DEFobjStaticHelpers
@@ -54,6 +59,7 @@ static uchar *LocalHostName = NULL;/* our hostname - read-only after startup */
static uchar *LocalDomain; /* our local domain name - read-only after startup */
static char **StripDomains = NULL;/* these domains may be stripped before writing logs - r/o after s.u., never touched by init */
static char **LocalHosts = NULL;/* these hosts are logged with their hostname - read-only after startup, never touched by init */
+static uchar *pszDfltNetstrmDrvr = NULL; /* module name of default netstream driver */
/* define a macro for the simple properties' set and get functions
@@ -84,6 +90,7 @@ SIMP_PROP(StripDomains, StripDomains, char**)
SIMP_PROP(LocalHosts, LocalHosts, char**)
SIMP_PROP_SET(LocalHostName, LocalHostName, uchar*)
+SIMP_PROP_SET(DfltNetstrmDrvr, pszDfltNetstrmDrvr, uchar*) // TODO: use custom function which frees existing value
#undef SIMP_PROP
#undef SIMP_PROP_SET
@@ -99,8 +106,7 @@ GetLocalHostName(void)
}
-/* return the current working directory.
- */
+/* return the current working directory */
static uchar*
GetWorkDir(void)
{
@@ -108,6 +114,14 @@ GetWorkDir(void)
}
+/* return the current default netstream driver */
+static uchar*
+GetDfltNetstrmDrvr(void)
+{
+ return(pszDfltNetstrmDrvr == NULL ? DFLT_NETSTRM_DRVR : pszWorkDir);
+}
+
+
/* queryInterface function
* rgerhards, 2008-02-21
*/
@@ -134,6 +148,7 @@ CODESTARTobjQueryInterface(glbl)
SIMP_PROP(LocalDomain)
SIMP_PROP(StripDomains)
SIMP_PROP(LocalHosts)
+ SIMP_PROP(DfltNetstrmDrvr)
#undef SIMP_PROP
finalize_it:
ENDobjQueryInterface(glbl)
@@ -144,6 +159,10 @@ ENDobjQueryInterface(glbl)
*/
static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
+ if(pszDfltNetstrmDrvr != NULL) {
+ free(pszDfltNetstrmDrvr);
+ pszDfltNetstrmDrvr = NULL;
+ }
if(pszWorkDir != NULL) {
free(pszWorkDir);
pszWorkDir = NULL;
@@ -172,6 +191,8 @@ ENDObjClassInit(glbl)
* rgerhards, 2008-04-17
*/
BEGINObjClassExit(glbl, OBJ_IS_CORE_MODULE) /* class, version */
+ if(pszDfltNetstrmDrvr != NULL)
+ free(pszDfltNetstrmDrvr);
if(pszWorkDir != NULL)
free(pszWorkDir);
if(LocalHostName != NULL)