diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/netstrm.h | 1 | ||||
-rw-r--r-- | runtime/netstrms.c | 28 | ||||
-rw-r--r-- | runtime/netstrms.h | 3 | ||||
-rw-r--r-- | runtime/nsd_gtls.c | 6 | ||||
-rw-r--r-- | runtime/nsd_ptcp.c | 4 |
5 files changed, 36 insertions, 6 deletions
diff --git a/runtime/netstrm.h b/runtime/netstrm.h index b6a01555..b2131ff7 100644 --- a/runtime/netstrm.h +++ b/runtime/netstrm.h @@ -31,6 +31,7 @@ struct netstrm_s { BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */ nsd_t *pDrvrData; /**< the driver's data elements (at most other places, this is called pNsd) */ nsd_if_t Drvr; /**< our stream driver */ + //int iDrvrMode; /**< mode to be used for our driver */ netstrms_t *pNS; /**< pointer to our netstream subsystem object */ }; diff --git a/runtime/netstrms.c b/runtime/netstrms.c index 501d97dd..86157f5f 100644 --- a/runtime/netstrms.c +++ b/runtime/netstrms.c @@ -118,6 +118,32 @@ finalize_it: } +/* set the driver mode + * rgerhards, 2008-04-30 + */ +static rsRetVal +SetDrvrMode(netstrms_t *pThis, int iMode) +{ + DEFiRet; + ISOBJ_TYPE_assert(pThis, netstrms); + pThis->iDrvrMode = iMode; + RETiRet; +} + + +/* return the driver mode + * We use non-standard calling conventions because it makes an awful lot + * of sense here. + * rgerhards, 2008-04-30 + */ +static int +GetDrvrMode(netstrms_t *pThis) +{ + ISOBJ_TYPE_assert(pThis, netstrms); + return pThis->iDrvrMode; +} + + /* create an instance of a netstrm object. It is initialized with default * values. The current driver is used. The caller may set netstrm properties * and must call ConstructFinalize(). @@ -165,6 +191,8 @@ CODESTARTobjQueryInterface(netstrms) pIf->ConstructFinalize = netstrmsConstructFinalize; pIf->Destruct = netstrmsDestruct; pIf->CreateStrm = CreateStrm; + pIf->SetDrvrMode = SetDrvrMode; + pIf->GetDrvrMode = GetDrvrMode; finalize_it: ENDobjQueryInterface(netstrms) diff --git a/runtime/netstrms.h b/runtime/netstrms.h index 7dfc0d1d..8faccca7 100644 --- a/runtime/netstrms.h +++ b/runtime/netstrms.h @@ -31,6 +31,7 @@ struct netstrms_s { BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */ uchar *pBaseDrvrName; /**< nsd base driver name to use, or NULL if system default */ uchar *pDrvrName; /**< full base driver name (set when driver is loaded) */ + int iDrvrMode; /**< current default driver mode */ nsd_if_t Drvr; /**< our stream driver */ }; @@ -41,6 +42,8 @@ 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 (*SetDrvrMode)(netstrms_t *pThis, int iMode); + int (*GetDrvrMode)(netstrms_t *pThis); ENDinterface(netstrms) #define netstrmsCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */ diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c index bed8c79c..b1713240 100644 --- a/runtime/nsd_gtls.c +++ b/runtime/nsd_gtls.c @@ -208,7 +208,6 @@ gtlsEndSess(nsd_gtls_t *pThis) /* Standard-Constructor */ BEGINobjConstruct(nsd_gtls) /* be sure to specify the object type also in END macro! */ iRet = nsd_ptcp.Construct(&pThis->pTcp); - pThis->iMode = 1; // TODO: remove! ENDobjConstruct(nsd_gtls) @@ -236,6 +235,7 @@ SetMode(nsd_t *pNsd, int mode) DEFiRet; nsd_gtls_t *pThis = (nsd_gtls_t*) pNsd; +dbgprintf("SetMOde tries to set mode %d\n", mode); ISOBJ_TYPE_assert((pThis), nsd_gtls); if(mode != 0 && mode != 1) ABORT_FINALIZE(RS_RET_INVAID_DRVR_MODE); @@ -352,6 +352,7 @@ AcceptConnReq(nsd_t *pNsd, nsd_t **ppNew) CHKiRet(nsd_ptcp.Destruct(&pNew->pTcp)); CHKiRet(nsd_ptcp.AcceptConnReq(pThis->pTcp, &pNew->pTcp)); +RUNLOG_VAR("%d", pThis->iMode); if(pThis->iMode == 0) { /* we are in non-TLS mode, so we are done */ *ppNew = (nsd_t*) pNew; @@ -373,8 +374,7 @@ AcceptConnReq(nsd_t *pNsd, nsd_t **ppNew) } else if(gnuRet != 0) { ABORT_FINALIZE(RS_RET_TLS_HANDSHAKE_ERR); } - - pThis->iMode = 1; /* this session is now in TLS mode! */ + pNew->iMode = 1; /* this session is now in TLS mode! */ *ppNew = (nsd_t*) pNew; diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c index 5bad3bf4..c5480a05 100644 --- a/runtime/nsd_ptcp.c +++ b/runtime/nsd_ptcp.c @@ -432,13 +432,11 @@ 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)); CHKiRet(pNS->Drvr.SetSock(pNewNsd, sock)); -RUNLOG; + CHKiRet(pNS->Drvr.SetMode(pNewNsd, netstrms.GetDrvrMode(pNS))); CHKiRet(netstrms.CreateStrm(pNS, &pNewStrm)); pNewStrm->pDrvrData = (nsd_t*) pNewNsd; -RUNLOG; CHKiRet(fAddLstn(pUsr, pNewStrm)); pNewNsd = NULL; pNewStrm = NULL; |