summaryrefslogtreecommitdiffstats
path: root/runtime/nsd_ptcp.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-25 12:54:59 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-25 12:54:59 +0200
commit75cf92117c118f9aca37b39f44ad1e1e759f78bf (patch)
treed0017f4419daa9e0ae22117f44b78208a4b35307 /runtime/nsd_ptcp.c
parent21bea2e1df044771f713fa426bf6b005385c40da (diff)
downloadrsyslog-75cf92117c118f9aca37b39f44ad1e1e759f78bf.tar.gz
rsyslog-75cf92117c118f9aca37b39f44ad1e1e759f78bf.tar.xz
rsyslog-75cf92117c118f9aca37b39f44ad1e1e759f78bf.zip
made gtls server driver work in plain tcp mode
Diffstat (limited to 'runtime/nsd_ptcp.c')
-rw-r--r--runtime/nsd_ptcp.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c
index 584cc93f..2a74e061 100644
--- a/runtime/nsd_ptcp.c
+++ b/runtime/nsd_ptcp.c
@@ -93,7 +93,6 @@ ENDobjDestruct(nsd_ptcp)
/* Provide access to the underlying OS socket. This is primarily
* useful for other drivers (like nsd_gtls) who utilize ourselfs
* for some of their functionality. -- rgerhards, 2008-04-18
- * TODO: what about the server socket structure?
*/
static rsRetVal
GetSock(nsd_t *pNsd, int *pSock)
@@ -110,6 +109,26 @@ GetSock(nsd_t *pNsd, int *pSock)
}
+/* Provide access to the underlying OS socket. This is primarily
+ * useful for other drivers (like nsd_gtls) who utilize ourselfs
+ * for some of their functionality.
+ * This function sets the socket -- rgerhards, 2008-04-25
+ */
+static rsRetVal
+SetSock(nsd_t *pNsd, int sock)
+{
+ nsd_ptcp_t *pThis = (nsd_ptcp_t*) pNsd;
+ DEFiRet;
+
+ ISOBJ_TYPE_assert((pThis), nsd_ptcp);
+ assert(sock >= 0);
+
+ pThis->sock = sock;
+
+ RETiRet;
+}
+
+
/* abort a connection. This is meant to be called immediately
* before the Destruct call. -- rgerhards, 2008-03-24
*/
@@ -211,7 +230,6 @@ finalize_it:
}
-
/* accept an incoming connection request
* rgerhards, 2008-04-22
*/
@@ -397,10 +415,13 @@ LstnInit(netstrms_t *pNS, void *pUsr, rsRetVal(*fAddLstn)(void*,netstrm_t*),
* construct a new netstrm obj and hand it over to the upper layers for inclusion
* into their socket array. -- rgerhards, 2008-04-23
*/
+RUNLOG_VAR("%d", sock);
CHKiRet(pNS->Drvr.Construct(&pNewNsd));
- ((nsd_ptcp_t*)pNewNsd)->sock = sock;
+ CHKiRet(pNS->Drvr.SetSock(pNewNsd, sock));
+RUNLOG;
CHKiRet(netstrms.CreateStrm(pNS, &pNewStrm));
pNewStrm->pDrvrData = (nsd_t*) pNewNsd;
+RUNLOG;
CHKiRet(fAddLstn(pUsr, pNewStrm));
pNewNsd = NULL;
pNewStrm = NULL;
@@ -587,6 +608,7 @@ CODESTARTobjQueryInterface(nsd_ptcp)
pIf->Destruct = (rsRetVal(*)(nsd_t**)) nsd_ptcpDestruct;
pIf->Abort = Abort;
pIf->GetSock = GetSock;
+ pIf->SetSock = SetSock;
pIf->Rcv = Rcv;
pIf->Send = Send;
pIf->LstnInit = LstnInit;