summaryrefslogtreecommitdiffstats
path: root/runtime
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 /runtime
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
Diffstat (limited to 'runtime')
-rw-r--r--runtime/netstrm.c2
-rw-r--r--runtime/netstrms.c31
-rw-r--r--runtime/netstrms.h1
3 files changed, 31 insertions, 3 deletions
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)