summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-05-05 14:19:12 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-05-05 14:19:12 +0200
commit7022e9019ebf9bf48ffd17ac11099f9cc2f22e4d (patch)
treef7cf32d138a95b1544d3643a1a18011c12115deb
parent74ab20fa5cb95a90b46a4b423dc85b507f17ad8d (diff)
downloadrsyslog-7022e9019ebf9bf48ffd17ac11099f9cc2f22e4d.tar.gz
rsyslog-7022e9019ebf9bf48ffd17ac11099f9cc2f22e4d.tar.xz
rsyslog-7022e9019ebf9bf48ffd17ac11099f9cc2f22e4d.zip
support for different forwarding stream drivers added
they can now be set on an action-by-action basis
-rw-r--r--Makefile.am3
-rw-r--r--doc/Makefile.am2
-rw-r--r--runtime/netstrm.c2
-rw-r--r--runtime/netstrms.c31
-rw-r--r--runtime/netstrms.h1
-rw-r--r--tools/omfile.c3
-rw-r--r--tools/omfwd.c17
7 files changed, 51 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index a3e67bc8..ab344867 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,9 @@ EXTRA_DIST = \
contrib/README \
rsyslog.conf \
COPYING.LESSER \
+ contrib/gnutls/ca.pem \
+ contrib/gnutls/cert.pem \
+ contrib/gnutls/key.pem \
$(man_MANS)
SUBDIRS = doc runtime .
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 6eb82b81..0b3f9da2 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -36,7 +36,7 @@ html_files = \
imklog.html \
professional_support.html \
queues.html \
- queueWorkerLogic.dia \
+ src/queueWorkerLogic.dia \
queueWorkerLogic.jpg \
queueWorkerLogic_small.jpg \
rainerscript.html \
diff --git a/runtime/netstrm.c b/runtime/netstrm.c
index 47c67a53..a1384a28 100644
--- a/runtime/netstrm.c
+++ b/runtime/netstrm.c
@@ -116,7 +116,7 @@ AcceptConnReq(netstrm_t *pThis, netstrm_t **ppNew)
/* accept the new connection */
CHKiRet(pThis->Drvr.AcceptConnReq(pThis->pDrvrData, &pNewNsd));
/* construct our object so that we can use it... */
- CHKiRet(objUse(netstrms, DONT_LOAD_LIB)); /* load netstrms obj if not already done so */
+ CHKiRet(objUse(netstrms, DONT_LOAD_LIB)); /* use netstrms obj if not already done so */
CHKiRet(netstrms.CreateStrm(pThis->pNS, ppNew));
(*ppNew)->pDrvrData = pNewNsd;
diff --git a/runtime/netstrms.c b/runtime/netstrms.c
index 86157f5f..fde0788d 100644
--- a/runtime/netstrms.c
+++ b/runtime/netstrms.c
@@ -103,6 +103,10 @@ CODESTARTobjDestruct(netstrms)
obj.ReleaseObj(__FILE__, pThis->pDrvrName+2, pThis->pDrvrName, (void*) &pThis->Drvr);
free(pThis->pDrvrName);
}
+ if(pThis->pBaseDrvrName != NULL) {
+ free(pThis->pBaseDrvrName);
+ pThis->pBaseDrvrName = NULL;
+ }
ENDobjDestruct(netstrms)
@@ -118,8 +122,30 @@ finalize_it:
}
-/* set the driver mode
- * rgerhards, 2008-04-30
+/* set the base driver name. If the driver name
+ * is set to NULL, the previously set name is deleted but
+ * no name set again (which results in the system default being
+ * used)-- rgerhards, 2008-05-05
+ */
+static rsRetVal
+SetDrvrName(netstrms_t *pThis, uchar *pszName)
+{
+ DEFiRet;
+ ISOBJ_TYPE_assert(pThis, netstrms);
+ if(pThis->pBaseDrvrName != NULL) {
+ free(pThis->pBaseDrvrName);
+ pThis->pBaseDrvrName = NULL;
+ }
+
+ if(pszName != NULL) {
+ CHKmalloc(pThis->pBaseDrvrName = (uchar*) strdup((char*) pszName));
+ }
+finalize_it:
+ RETiRet;
+}
+
+
+/* set the driver mode -- rgerhards, 2008-04-30
*/
static rsRetVal
SetDrvrMode(netstrms_t *pThis, int iMode)
@@ -191,6 +217,7 @@ CODESTARTobjQueryInterface(netstrms)
pIf->ConstructFinalize = netstrmsConstructFinalize;
pIf->Destruct = netstrmsDestruct;
pIf->CreateStrm = CreateStrm;
+ pIf->SetDrvrName = SetDrvrName;
pIf->SetDrvrMode = SetDrvrMode;
pIf->GetDrvrMode = GetDrvrMode;
finalize_it:
diff --git a/runtime/netstrms.h b/runtime/netstrms.h
index 8faccca7..1d1cc892 100644
--- a/runtime/netstrms.h
+++ b/runtime/netstrms.h
@@ -42,6 +42,7 @@ BEGINinterface(netstrms) /* name must also be changed in ENDinterface macro! */
rsRetVal (*ConstructFinalize)(netstrms_t *pThis);
rsRetVal (*Destruct)(netstrms_t **ppThis);
rsRetVal (*CreateStrm)(netstrms_t *pThis, netstrm_t **ppStrm);
+ rsRetVal (*SetDrvrName)(netstrms_t *pThis, uchar *pszName);
rsRetVal (*SetDrvrMode)(netstrms_t *pThis, int iMode);
int (*GetDrvrMode)(netstrms_t *pThis);
ENDinterface(netstrms)
diff --git a/tools/omfile.c b/tools/omfile.c
index 4b5eb280..285e798d 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -840,6 +840,5 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(regCfSysLineHdlr((uchar *)"actionfiledefaulttemplate", 0, eCmdHdlrGetWord, NULL, &pszTplName, NULL));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
-/*
- * vi:set ai:
+/* vi:set ai:
*/
diff --git a/tools/omfwd.c b/tools/omfwd.c
index e2a93267..113c3bef 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -77,6 +77,7 @@ DEFobjCurrIf(tcpclt)
typedef struct _instanceData {
netstrms_t *pNS; /* netstream subsystem */
netstrm_t *pNetstrm; /* our output netstream */
+ uchar *pszStrmDrvr;
int iStrmDrvrMode;
char *f_hname;
int *pSockArray; /* sockets to use for UDP */
@@ -92,7 +93,8 @@ typedef struct _instanceData {
} instanceData;
/* config data */
-static uchar *pszTplName = NULL; /* name of the default template to use */
+static uchar *pszTplName = NULL; /* name of the default template to use */
+static uchar *pszStrmDrvr = NULL; /* name of the stream driver to use */
static int iStrmDrvrMode = 0; /* mode for stream driver, driver-dependent (0 mostly means plain tcp) */
@@ -258,7 +260,8 @@ static rsRetVal TCPSendInit(void *pvData)
assert(pData != NULL);
if(pData->pNetstrm == NULL) {
CHKiRet(netstrms.Construct(&pData->pNS));
- /* here we may set another netstream driver (e.g. to do TLS) */
+ /* the stream driver must be set before the object is finalized! */
+ CHKiRet(netstrms.SetDrvrName(pData->pNS, pszStrmDrvr));
CHKiRet(netstrms.ConstructFinalize(pData->pNS));
/* now create the actual stream and connect to the server */
@@ -564,6 +567,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
CHKiRet(tcpclt.SetSendPrepRetry(pData->pTCPClt, TCPSendPrepRetry));
CHKiRet(tcpclt.SetFraming(pData->pTCPClt, tcp_framing));
pData->iStrmDrvrMode = iStrmDrvrMode;
+ CHKmalloc(pData->pszStrmDrvr = (uchar*)strdup((char*)pszStrmDrvr));
}
CODE_STD_FINALIZERparseSelectorAct
@@ -584,6 +588,10 @@ CODESTARTmodExit
free(pszTplName);
pszTplName = NULL;
}
+ if(pszStrmDrvr != NULL) {
+ free(pszStrmDrvr);
+ pszStrmDrvr = NULL;
+ }
ENDmodExit
@@ -602,6 +610,10 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
free(pszTplName);
pszTplName = NULL;
}
+ if(pszStrmDrvr != NULL) {
+ free(pszStrmDrvr);
+ pszStrmDrvr = NULL;
+ }
iStrmDrvrMode = 0;
return RS_RET_OK;
@@ -617,6 +629,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(net,LM_NET_FILENAME));
CHKiRet(regCfSysLineHdlr((uchar *)"actionforwarddefaulttemplate", 0, eCmdHdlrGetWord, NULL, &pszTplName, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"actionsendstreamdriver", 0, eCmdHdlrGetWord, NULL, &pszStrmDrvr, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionsendstreamdrivermode", 0, eCmdHdlrInt, NULL, &iStrmDrvrMode, NULL));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit