diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-04-30 17:41:17 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-04-30 17:41:17 +0200 |
commit | 1c2268faa836ca70a4d13dcad57818413990ac62 (patch) | |
tree | 30cb04d334938986d831cecf091dfebe7d883bdd | |
parent | c370fc6305af0fc9c37f818d8b88726b899b0d0a (diff) | |
download | rsyslog-1c2268faa836ca70a4d13dcad57818413990ac62.tar.gz rsyslog-1c2268faa836ca70a4d13dcad57818413990ac62.tar.xz rsyslog-1c2268faa836ca70a4d13dcad57818413990ac62.zip |
restructured netstrm driver layer
the new structure prevents repetitive loads and unloads of
driver files; it also has less overhead
The "select" and regular driver are now contained in a single
file.
-rw-r--r-- | runtime/Makefile.am | 18 | ||||
-rw-r--r-- | runtime/nsd_gtls.c | 3 | ||||
-rw-r--r-- | runtime/nsd_ptcp.c | 3 | ||||
-rw-r--r-- | runtime/nsdsel_gtls.c | 35 | ||||
-rw-r--r-- | runtime/nsdsel_gtls.h | 3 | ||||
-rw-r--r-- | runtime/nsdsel_ptcp.c | 30 | ||||
-rw-r--r-- | runtime/nsdsel_ptcp.h | 3 | ||||
-rw-r--r-- | runtime/nssel.c | 4 |
8 files changed, 17 insertions, 82 deletions
diff --git a/runtime/Makefile.am b/runtime/Makefile.am index 381c3ae5..a7a2b91e 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -100,17 +100,10 @@ lmnetstrms_la_LIBADD = # plain tcp driver - main driver pkglib_LTLIBRARIES += lmnsd_ptcp.la -lmnsd_ptcp_la_SOURCES = nsd_ptcp.c nsd_ptcp.h +lmnsd_ptcp_la_SOURCES = nsd_ptcp.c nsd_ptcp.h nsdsel_ptcp.c nsdsel_ptcp.h lmnsd_ptcp_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags) lmnsd_ptcp_la_LDFLAGS = -module -avoid-version lmnsd_ptcp_la_LIBADD = - -# select interface for ptcp driver -pkglib_LTLIBRARIES += lmnsdsel_ptcp.la -lmnsdsel_ptcp_la_SOURCES = nsdsel_ptcp.c nsdsel_ptcp.h -lmnsdsel_ptcp_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags) -lmnsdsel_ptcp_la_LDFLAGS = -module -avoid-version -lmnsdsel_ptcp_la_LIBADD = endif # if ENABLE_INET # @@ -118,16 +111,9 @@ endif # if ENABLE_INET # if ENABLE_GNUTLS pkglib_LTLIBRARIES += lmnsd_gtls.la -lmnsd_gtls_la_SOURCES = nsd_gtls.c nsd_gtls.h +lmnsd_gtls_la_SOURCES = nsd_gtls.c nsd_gtls.h nsdsel_gtls.c nsdsel_gtls.h lmnsd_gtls_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags) $(gnutls_cflags) lmnsd_gtls_la_LDFLAGS = -module -avoid-version lmnsd_gtls_la_LIBADD = $(gnutls_libs) -# -# select interface for gtls driver -pkglib_LTLIBRARIES += lmnsdsel_gtls.la -lmnsdsel_gtls_la_SOURCES = nsdsel_gtls.c nsdsel_gtls.h -lmnsdsel_gtls_la_CPPFLAGS = $(pthreads_cflags) $(rsrt_cflags) -lmnsdsel_gtls_la_LDFLAGS = -module -avoid-version -lmnsdsel_gtls_la_LIBADD = $(gnutls_libs) endif diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c index d8279aaa..bed8c79c 100644 --- a/runtime/nsd_gtls.c +++ b/runtime/nsd_gtls.c @@ -33,6 +33,7 @@ #include "obj.h" #include "errmsg.h" #include "nsd_ptcp.h" +#include "nsdsel_gtls.h" #include "nsd_gtls.h" /* things to move to some better place/functionality - TODO */ @@ -571,6 +572,7 @@ ENDObjClassInit(nsd_gtls) BEGINmodExit CODESTARTmodExit + nsdsel_gtlsClassExit(); nsd_gtlsClassExit(); ENDmodExit @@ -587,6 +589,7 @@ CODESTARTmodInit /* Initialize all classes that are in our module - this includes ourselfs */ CHKiRet(nsd_gtlsClassInit(pModInfo)); /* must be done after tcps_sess, as we use it */ + CHKiRet(nsdsel_gtlsClassInit(pModInfo)); /* must be done after tcps_sess, as we use it */ ENDmodInit /* vi:set ai: */ diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c index e26347c3..5bad3bf4 100644 --- a/runtime/nsd_ptcp.c +++ b/runtime/nsd_ptcp.c @@ -47,6 +47,7 @@ #include "net.h" #include "netstrms.h" #include "netstrm.h" +#include "nsdsel_ptcp.h" #include "nsd_ptcp.h" MODULE_TYPE_LIB @@ -671,6 +672,7 @@ ENDObjClassInit(nsd_ptcp) BEGINmodExit CODESTARTmodExit + nsdsel_ptcpClassExit(); nsd_ptcpClassExit(); ENDmodExit @@ -687,6 +689,7 @@ CODESTARTmodInit /* Initialize all classes that are in our module - this includes ourselfs */ CHKiRet(nsd_ptcpClassInit(pModInfo)); /* must be done after tcps_sess, as we use it */ + CHKiRet(nsdsel_ptcpClassInit(pModInfo)); /* must be done after tcps_sess, as we use it */ ENDmodInit /* vi:set ai: */ diff --git a/runtime/nsdsel_gtls.c b/runtime/nsdsel_gtls.c index ab52999c..8c1e705b 100644 --- a/runtime/nsdsel_gtls.c +++ b/runtime/nsdsel_gtls.c @@ -37,11 +37,10 @@ #include "errmsg.h" #include "nsd.h" #include "nsd_gtls.h" +#include "nsd_ptcp.h" #include "nsdsel_ptcp.h" #include "nsdsel_gtls.h" -MODULE_TYPE_LIB - /* static data */ DEFobjStaticHelpers DEFobjCurrIf(errmsg) @@ -203,12 +202,12 @@ ENDobjQueryInterface(nsdsel_gtls) /* exit our class */ -BEGINObjClassExit(nsdsel_gtls, OBJ_IS_LOADABLE_MODULE) /* CHANGE class also in END MACRO! */ +BEGINObjClassExit(nsdsel_gtls, OBJ_IS_CORE_MODULE) /* CHANGE class also in END MACRO! */ CODESTARTObjClassExit(nsdsel_gtls) /* release objects we no longer need */ objRelease(glbl, CORE_COMPONENT); objRelease(errmsg, CORE_COMPONENT); - objRelease(nsdsel_ptcp, LM_NSDSEL_PTCP_FILENAME); + objRelease(nsdsel_ptcp, LM_NSD_PTCP_FILENAME); ENDObjClassExit(nsdsel_gtls) @@ -216,37 +215,13 @@ ENDObjClassExit(nsdsel_gtls) * before anything else is called inside this class. * rgerhards, 2008-02-19 */ -BEGINObjClassInit(nsdsel_gtls, 1, OBJ_IS_LOADABLE_MODULE) /* class, version */ +BEGINObjClassInit(nsdsel_gtls, 1, OBJ_IS_CORE_MODULE) /* class, version */ /* request objects we use */ CHKiRet(objUse(errmsg, CORE_COMPONENT)); CHKiRet(objUse(glbl, CORE_COMPONENT)); - CHKiRet(objUse(nsdsel_ptcp, LM_NSDSEL_PTCP_FILENAME)); + CHKiRet(objUse(nsdsel_ptcp, LM_NSD_PTCP_FILENAME)); /* set our own handlers */ ENDObjClassInit(nsdsel_gtls) - - -/* --------------- here now comes the plumbing that makes as a library module --------------- */ - - -BEGINmodExit -CODESTARTmodExit - nsdsel_gtlsClassExit(); -ENDmodExit - - -BEGINqueryEtryPt -CODESTARTqueryEtryPt -CODEqueryEtryPt_STD_LIB_QUERIES -ENDqueryEtryPt - - -BEGINmodInit() -CODESTARTmodInit - *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ - - /* Initialize all classes that are in our module - this includes ourselfs */ - CHKiRet(nsdsel_gtlsClassInit(pModInfo)); /* must be done after tcps_sess, as we use it */ -ENDmodInit /* vi:set ai: */ diff --git a/runtime/nsdsel_gtls.h b/runtime/nsdsel_gtls.h index a309d302..7c2df684 100644 --- a/runtime/nsdsel_gtls.h +++ b/runtime/nsdsel_gtls.h @@ -39,7 +39,4 @@ struct nsdsel_gtls_s { /* prototypes */ PROTOTYPEObj(nsdsel_gtls); -/* the name of our library binary */ -#define LM_NSDSEL_GTLS_FILENAME "lmnsdsel_gtls" - #endif /* #ifndef INCLUDED_NSDSEL_GTLS_H */ diff --git a/runtime/nsdsel_ptcp.c b/runtime/nsdsel_ptcp.c index b439063a..41b85e0c 100644 --- a/runtime/nsdsel_ptcp.c +++ b/runtime/nsdsel_ptcp.c @@ -37,8 +37,6 @@ #include "nsd_ptcp.h" #include "nsdsel_ptcp.h" -MODULE_TYPE_LIB - /* static data */ DEFobjStaticHelpers DEFobjCurrIf(errmsg) @@ -175,7 +173,7 @@ ENDobjQueryInterface(nsdsel_ptcp) /* exit our class */ -BEGINObjClassExit(nsdsel_ptcp, OBJ_IS_LOADABLE_MODULE) /* CHANGE class also in END MACRO! */ +BEGINObjClassExit(nsdsel_ptcp, OBJ_IS_CORE_MODULE) /* CHANGE class also in END MACRO! */ CODESTARTObjClassExit(nsdsel_ptcp) /* release objects we no longer need */ objRelease(glbl, CORE_COMPONENT); @@ -187,36 +185,12 @@ ENDObjClassExit(nsdsel_ptcp) * before anything else is called inside this class. * rgerhards, 2008-02-19 */ -BEGINObjClassInit(nsdsel_ptcp, 1, OBJ_IS_LOADABLE_MODULE) /* class, version */ +BEGINObjClassInit(nsdsel_ptcp, 1, OBJ_IS_CORE_MODULE) /* class, version */ /* request objects we use */ CHKiRet(objUse(errmsg, CORE_COMPONENT)); CHKiRet(objUse(glbl, CORE_COMPONENT)); /* set our own handlers */ ENDObjClassInit(nsdsel_ptcp) - - -/* --------------- here now comes the plumbing that makes as a library module --------------- */ - - -BEGINmodExit -CODESTARTmodExit - nsdsel_ptcpClassExit(); -ENDmodExit - - -BEGINqueryEtryPt -CODESTARTqueryEtryPt -CODEqueryEtryPt_STD_LIB_QUERIES -ENDqueryEtryPt - - -BEGINmodInit() -CODESTARTmodInit - *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ - - /* Initialize all classes that are in our module - this includes ourselfs */ - CHKiRet(nsdsel_ptcpClassInit(pModInfo)); /* must be done after tcps_sess, as we use it */ -ENDmodInit /* vi:set ai: */ diff --git a/runtime/nsdsel_ptcp.h b/runtime/nsdsel_ptcp.h index 93874e55..6c0c7fa7 100644 --- a/runtime/nsdsel_ptcp.h +++ b/runtime/nsdsel_ptcp.h @@ -41,7 +41,4 @@ struct nsdsel_ptcp_s { /* prototypes */ PROTOTYPEObj(nsdsel_ptcp); -/* the name of our library binary */ -#define LM_NSDSEL_PTCP_FILENAME "lmnsdsel_ptcp" - #endif /* #ifndef INCLUDED_NSDSEL_PTCP_H */ diff --git a/runtime/nssel.c b/runtime/nssel.c index 50228208..d11d5fe1 100644 --- a/runtime/nssel.c +++ b/runtime/nssel.c @@ -82,7 +82,7 @@ loadDrvr(nssel_t *pThis) * about this hack, but for the time being it is efficient and clean * enough. -- rgerhards, 2008-04-18 */ - CHKiRet(obj.UseObj(__FILE__, szDrvrName+2, szDrvrName, (void*) &pThis->Drvr)); + CHKiRet(obj.UseObj(__FILE__, szDrvrName+2, DONT_LOAD_LIB, (void*) &pThis->Drvr)); finalize_it: if(iRet != RS_RET_OK) { @@ -110,7 +110,7 @@ CODESTARTobjDestruct(nssel) * to release the driver */ if(pThis->pDrvrName != NULL) { - obj.ReleaseObj(__FILE__, pThis->pDrvrName+2, pThis->pDrvrName, (void*) &pThis->Drvr); + obj.ReleaseObj(__FILE__, pThis->pDrvrName+2, DONT_LOAD_LIB, (void*) &pThis->Drvr); free(pThis->pDrvrName); } ENDobjDestruct(nssel) |