summaryrefslogtreecommitdiffstats
path: root/tcps_sess.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-03 09:04:59 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-03 09:04:59 +0000
commit42730360196f1aaafaebb955c1a0a66a185e61ec (patch)
treea372aed0c06905d230ed383249028aa220417a1e /tcps_sess.c
parent9d8eb28ebd941694d8dcbc66c6e5c80cf90a206d (diff)
downloadrsyslog-42730360196f1aaafaebb955c1a0a66a185e61ec.tar.gz
rsyslog-42730360196f1aaafaebb955c1a0a66a185e61ec.tar.xz
rsyslog-42730360196f1aaafaebb955c1a0a66a185e61ec.zip
made imgssapi compile
Diffstat (limited to 'tcps_sess.c')
-rw-r--r--tcps_sess.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/tcps_sess.c b/tcps_sess.c
index 0cff9d88..56b7d9a5 100644
--- a/tcps_sess.c
+++ b/tcps_sess.c
@@ -47,6 +47,7 @@
#include "syslogd.h"
#include "module-template.h"
#include "net.h"
+#include "tcpsrv.h"
#include "tcps_sess.h"
#include "obj.h"
@@ -61,11 +62,6 @@ BEGINobjConstruct(tcps_sess) /* be sure to specify the object type also in END m
pThis->iMsg = 0; /* just make sure... */
pThis->bAtStrtOfFram = 1; /* indicate frame header expected */
pThis->eFraming = TCP_FRAMING_OCTET_STUFFING; /* just make sure... */
- if(pThis->pOnTCPSessConstruct != NULL) {
- // TODO: return value! Supply user pointer or whole
- // object?
- pThis->pOnTCPSessConstruct(pThis->pUsr);
- }
ENDobjConstruct(tcps_sess)
@@ -76,11 +72,11 @@ tcps_sessConstructFinalize(tcps_sess_t __attribute__((unused)) *pThis)
{
DEFiRet;
ISOBJ_TYPE_assert(pThis, tcps_sess);
- if(pThis->pOnTCPSessConstructFinalize != NULL) {
- // TODO: return value! Supply user pointer or whole
- // object?
- pThis->pOnTCPSessConstructFinalize(pThis->pUsr);
+ if(pThis->pSrv->OnSessConstructFinalize != NULL) {
+ CHKiRet(pThis->pSrv->OnSessConstructFinalize(&pThis->pUsr));
}
+
+finalize_it:
RETiRet;
}
@@ -88,11 +84,13 @@ tcps_sessConstructFinalize(tcps_sess_t __attribute__((unused)) *pThis)
/* destructor for the tcps_sess object */
BEGINobjDestruct(tcps_sess) /* be sure to specify the object type also in END and CODESTART macros! */
CODESTARTobjDestruct(tcps_sess)
- if(pThis->pOnTCPSessDestruct != NULL) {
- // TODO: return value! Supply user pointer or whole
- // object?
- pThis->pOnTCPSessDestruct(pThis->pUsr);
+ if(pThis->pSrv->pOnSessDestruct != NULL) {
+ pThis->pSrv->pOnSessDestruct(&pThis->pUsr);
}
+ /* now destruct our own properties */
+ if(pThis->fromHost != NULL)
+ free(pThis->fromHost);
+ close(pThis->sock);
ENDobjDestruct(tcps_sess)
@@ -110,17 +108,14 @@ SetHost(tcps_sess_t *pThis, uchar *pszHost)
ISOBJ_TYPE_assert(pThis, tcps_sess);
-RUNLOG_VAR("%p", pThis->fromHost);
if(pThis->fromHost != NULL) {
free(pThis->fromHost);
pThis->fromHost = NULL;
}
-RUNLOG;
if((pThis->fromHost = strdup((char*)pszHost)) == NULL)
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
-RUNLOG;
finalize_it:
RETiRet;
}
@@ -144,6 +139,26 @@ SetMsgIdx(tcps_sess_t *pThis, int idx)
}
+/* set out parent, the tcpsrv object */
+static rsRetVal
+SetTcpsrv(tcps_sess_t *pThis, tcpsrv_t *pSrv)
+{
+ DEFiRet;
+ ISOBJ_TYPE_assert(pThis, tcps_sess);
+ ISOBJ_TYPE_assert(pSrv, tcpsrv);
+ pThis->pSrv = pSrv;
+ RETiRet;
+}
+
+
+static rsRetVal
+SetUsrP(tcps_sess_t *pThis, void *pUsr)
+{
+ DEFiRet;
+ pThis->pUsr = pUsr;
+ RETiRet;
+}
+
/* This should be called before a normal (non forced) close
* of a TCP session. This function checks if there is any unprocessed
@@ -394,6 +409,8 @@ CODESTARTobjQueryInterface(tcps_sess)
pIf->Close = Close;
pIf->DataRcvd = DataRcvd;
+ pIf->SetUsrP = SetUsrP;
+ pIf->SetTcpsrv = SetTcpsrv;
pIf->SetHost = SetHost;
pIf->SetSock = SetSock;
pIf->SetMsgIdx = SetMsgIdx;