many structural improvements
This commit is contained in:
@@ -19,110 +19,44 @@
|
||||
#include "cac.h"
|
||||
#include "netiiu.h"
|
||||
|
||||
netiiu::netiiu ( cac *pClientCtxIn ) : pClientCtx ( pClientCtxIn )
|
||||
{
|
||||
}
|
||||
|
||||
netiiu::~netiiu ()
|
||||
{
|
||||
}
|
||||
|
||||
void netiiu::show ( unsigned level ) const
|
||||
{
|
||||
::printf ( "network IO base class\n" );
|
||||
if ( level > 1 ) {
|
||||
tsDLIterConstBD < nciu > pChan = this->channelList.firstIter ();
|
||||
while ( pChan.valid () ) {
|
||||
pChan->show ( level - 1u );
|
||||
pChan++;
|
||||
}
|
||||
}
|
||||
if ( level > 2u ) {
|
||||
::printf ( "\tcac pointer %p\n",
|
||||
static_cast <void *> ( this->pClientCtx ) );
|
||||
}
|
||||
}
|
||||
|
||||
void netiiu::connectTimeoutNotify ()
|
||||
{
|
||||
tsDLIterBD < nciu > chan = this->channelList.firstIter ();
|
||||
while ( chan.valid () ) {
|
||||
chan->connectTimeoutNotify ();
|
||||
chan++;
|
||||
}
|
||||
}
|
||||
|
||||
void netiiu::resetChannelRetryCounts ()
|
||||
{
|
||||
tsDLIterBD < nciu > chan = this->channelList.firstIter ();
|
||||
while ( chan.valid () ) {
|
||||
chan->resetRetryCount ();
|
||||
chan++;
|
||||
}
|
||||
}
|
||||
|
||||
bool netiiu::searchMsg ( unsigned short retrySeqNumber, unsigned &retryNoForThisChannel )
|
||||
{
|
||||
bool success;
|
||||
|
||||
if ( nciu *pChan = this->channelList.get () ) {
|
||||
success = pChan->searchMsg ( retrySeqNumber, retryNoForThisChannel );
|
||||
if ( success ) {
|
||||
this->channelList.add ( *pChan );
|
||||
}
|
||||
else {
|
||||
this->channelList.push ( *pChan );
|
||||
}
|
||||
}
|
||||
else {
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool netiiu::ca_v42_ok () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool netiiu::pushDatagramMsg ( const caHdr &, const void *, ca_uint16_t )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void netiiu::lastChannelDetachNotify ( epicsGuard < class callbackMutex > & /* cbLocker */ )
|
||||
{
|
||||
}
|
||||
|
||||
void netiiu::writeRequest ( nciu &, unsigned, unsigned, const void * )
|
||||
void netiiu::writeRequest ( epicsGuard < cacMutex > &, nciu &,
|
||||
unsigned, unsigned, const void * )
|
||||
{
|
||||
throw cacChannel::notConnected();
|
||||
}
|
||||
|
||||
void netiiu::writeNotifyRequest ( nciu &, netWriteNotifyIO &, unsigned, unsigned, const void * )
|
||||
void netiiu::writeNotifyRequest ( epicsGuard < cacMutex > &,
|
||||
nciu &, netWriteNotifyIO &, unsigned, unsigned, const void * )
|
||||
{
|
||||
throw cacChannel::notConnected();
|
||||
}
|
||||
|
||||
void netiiu::readNotifyRequest ( nciu &, netReadNotifyIO &, unsigned, unsigned )
|
||||
void netiiu::readNotifyRequest ( epicsGuard < cacMutex > &,
|
||||
nciu &, netReadNotifyIO &, unsigned, unsigned )
|
||||
{
|
||||
throw cacChannel::notConnected();
|
||||
}
|
||||
|
||||
void netiiu::createChannelRequest ( nciu & )
|
||||
void netiiu::clearChannelRequest ( epicsGuard < cacMutex > &, ca_uint32_t, ca_uint32_t )
|
||||
{
|
||||
}
|
||||
|
||||
void netiiu::clearChannelRequest ( ca_uint32_t, ca_uint32_t )
|
||||
void netiiu::subscriptionRequest ( epicsGuard < cacMutex > &,
|
||||
nciu &, netSubscription & )
|
||||
{
|
||||
}
|
||||
|
||||
void netiiu::subscriptionRequest ( nciu &, netSubscription & )
|
||||
{
|
||||
}
|
||||
|
||||
void netiiu::subscriptionCancelRequest ( nciu &, netSubscription & )
|
||||
void netiiu::subscriptionCancelRequest ( epicsGuard < cacMutex > &,
|
||||
nciu &, netSubscription & )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -150,36 +84,32 @@ void netiiu::flushRequest ()
|
||||
{
|
||||
}
|
||||
|
||||
bool netiiu::flushBlockThreshold () const
|
||||
bool netiiu::flushBlockThreshold ( epicsGuard < cacMutex > & ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void netiiu::flushRequestIfAboveEarlyThreshold ()
|
||||
void netiiu::flushRequestIfAboveEarlyThreshold ( epicsGuard < cacMutex > & )
|
||||
{
|
||||
}
|
||||
|
||||
void netiiu::blockUntilSendBacklogIsReasonable
|
||||
( epicsGuard < callbackMutex > *, epicsGuard < epicsMutex > & )
|
||||
( epicsGuard < callbackMutex > *, epicsGuard < cacMutex > & )
|
||||
{
|
||||
}
|
||||
|
||||
int netiiu::printf ( const char *pformat, ... )
|
||||
{
|
||||
va_list theArgs;
|
||||
int status;
|
||||
|
||||
va_start ( theArgs, pformat );
|
||||
|
||||
status = this->pClientCtx->vPrintf ( pformat, theArgs );
|
||||
|
||||
va_end ( theArgs );
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void netiiu::requestRecvProcessPostponedFlush ()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void netiiu::uninstallChannel ( epicsGuard < callbackMutex > &,
|
||||
epicsGuard < cacMutex > &, nciu & )
|
||||
{
|
||||
throw cacChannel::notConnected();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
118
src/ca/netiiu.h
118
src/ca/netiiu.h
@@ -24,90 +24,72 @@
|
||||
class netWriteNotifyIO;
|
||||
class netReadNotifyIO;
|
||||
class netSubscription;
|
||||
class cacMutex;
|
||||
union osiSockAddr;
|
||||
|
||||
class cac;
|
||||
class callbackMutex;
|
||||
|
||||
class netiiu {
|
||||
public:
|
||||
netiiu ( cac * );
|
||||
virtual ~netiiu ();
|
||||
void show ( unsigned level ) const;
|
||||
unsigned channelCount () const;
|
||||
void connectTimeoutNotify ();
|
||||
bool searchMsg ( unsigned short retrySeqNumber, unsigned &retryNoForThisChannel );
|
||||
void resetChannelRetryCounts ();
|
||||
void attachChannel ( nciu &chan );
|
||||
void detachChannel ( epicsGuard < class callbackMutex > & cbLocker, nciu &chan );
|
||||
nciu * firstChannel ();
|
||||
int printf ( const char *pformat, ... );
|
||||
virtual void hostName (char *pBuf, unsigned bufLength) const;
|
||||
virtual const char * pHostName () const; // deprecated - please do not use
|
||||
virtual bool ca_v42_ok () const;
|
||||
virtual bool pushDatagramMsg ( const caHdr &hdr, const void *pExt, ca_uint16_t extsize);
|
||||
virtual void writeRequest ( nciu &, unsigned type, unsigned nElem, const void *pValue );
|
||||
virtual void writeNotifyRequest ( nciu &, netWriteNotifyIO &, unsigned type, unsigned nElem, const void *pValue );
|
||||
virtual void readNotifyRequest ( nciu &, netReadNotifyIO &, unsigned type, unsigned nElem );
|
||||
virtual void createChannelRequest ( nciu & );
|
||||
virtual void clearChannelRequest ( ca_uint32_t sid, ca_uint32_t cid );
|
||||
virtual void subscriptionRequest ( nciu &, netSubscription &subscr );
|
||||
virtual void subscriptionCancelRequest ( nciu & chan, netSubscription & subscr );
|
||||
virtual void flushRequest ();
|
||||
virtual bool flushBlockThreshold () const;
|
||||
virtual void flushRequestIfAboveEarlyThreshold ();
|
||||
virtual void hostName ( char *pBuf, unsigned bufLength ) const = 0;
|
||||
virtual const char * pHostName () const = 0; // deprecated - please do not use
|
||||
virtual bool ca_v42_ok () const = 0;
|
||||
virtual void writeRequest ( epicsGuard < cacMutex > &, nciu &,
|
||||
unsigned type, unsigned nElem, const void *pValue ) = 0;
|
||||
virtual void writeNotifyRequest ( epicsGuard < cacMutex > &,
|
||||
nciu &, netWriteNotifyIO &,
|
||||
unsigned type, unsigned nElem, const void *pValue ) = 0;
|
||||
virtual void readNotifyRequest ( epicsGuard < cacMutex > &, nciu &,
|
||||
netReadNotifyIO &, unsigned type, unsigned nElem ) = 0;
|
||||
virtual void clearChannelRequest ( epicsGuard < cacMutex > &,
|
||||
ca_uint32_t sid, ca_uint32_t cid ) = 0;
|
||||
virtual void subscriptionRequest ( epicsGuard < cacMutex > &,
|
||||
nciu &, netSubscription &subscr ) = 0;
|
||||
virtual void subscriptionCancelRequest ( epicsGuard < cacMutex > &,
|
||||
nciu & chan, netSubscription & subscr ) = 0;
|
||||
virtual void flushRequest () = 0;
|
||||
virtual bool flushBlockThreshold ( epicsGuard < cacMutex > & ) const = 0;
|
||||
virtual void flushRequestIfAboveEarlyThreshold ( epicsGuard < cacMutex > & ) = 0;
|
||||
virtual void blockUntilSendBacklogIsReasonable
|
||||
( epicsGuard < callbackMutex > *, epicsGuard < epicsMutex > & );
|
||||
virtual void requestRecvProcessPostponedFlush ();
|
||||
virtual osiSockAddr getNetworkAddress () const;
|
||||
protected:
|
||||
cac * pCAC () const;
|
||||
private:
|
||||
tsDLList < nciu > channelList;
|
||||
cac *pClientCtx;
|
||||
virtual void lastChannelDetachNotify ( epicsGuard < class callbackMutex > & cbLocker );
|
||||
netiiu ( const netiiu & );
|
||||
netiiu & operator = ( const netiiu & );
|
||||
( epicsGuard < callbackMutex > *, epicsGuard < cacMutex > & ) = 0;
|
||||
virtual void requestRecvProcessPostponedFlush () = 0;
|
||||
virtual osiSockAddr getNetworkAddress () const = 0;
|
||||
virtual void uninstallChannel ( epicsGuard < callbackMutex > &,
|
||||
epicsGuard < cacMutex > &, nciu & ) = 0;
|
||||
};
|
||||
|
||||
class limboiiu : public netiiu { // X aCC 655
|
||||
public:
|
||||
limboiiu ();
|
||||
private:
|
||||
void hostName ( char *pBuf, unsigned bufLength ) const;
|
||||
const char * pHostName () const; // deprecated - please do not use
|
||||
bool ca_v42_ok () const;
|
||||
void writeRequest ( epicsGuard < cacMutex > &, nciu &,
|
||||
unsigned type, unsigned nElem, const void *pValue );
|
||||
void writeNotifyRequest ( epicsGuard < cacMutex > &, nciu &, netWriteNotifyIO &,
|
||||
unsigned type, unsigned nElem, const void *pValue );
|
||||
void readNotifyRequest ( epicsGuard < cacMutex > &, nciu &, netReadNotifyIO &,
|
||||
unsigned type, unsigned nElem );
|
||||
void clearChannelRequest ( epicsGuard < cacMutex > &,
|
||||
ca_uint32_t sid, ca_uint32_t cid );
|
||||
void subscriptionRequest ( epicsGuard < cacMutex > &, nciu &,
|
||||
netSubscription &subscr );
|
||||
void subscriptionCancelRequest ( epicsGuard < cacMutex > &,
|
||||
nciu & chan, netSubscription & subscr );
|
||||
void flushRequest ();
|
||||
bool flushBlockThreshold ( epicsGuard < cacMutex > & ) const;
|
||||
void flushRequestIfAboveEarlyThreshold ( epicsGuard < cacMutex > & );
|
||||
void blockUntilSendBacklogIsReasonable
|
||||
( epicsGuard < callbackMutex > *, epicsGuard < cacMutex > & );
|
||||
void requestRecvProcessPostponedFlush ();
|
||||
osiSockAddr getNetworkAddress () const;
|
||||
void uninstallChannel ( epicsGuard < callbackMutex > &,
|
||||
epicsGuard < cacMutex > &, nciu & );
|
||||
limboiiu ( const limboiiu & );
|
||||
limboiiu & operator = ( const limboiiu & );
|
||||
};
|
||||
|
||||
extern limboiiu limboIIU;
|
||||
|
||||
inline cac * netiiu::pCAC () const
|
||||
{
|
||||
return this->pClientCtx;
|
||||
}
|
||||
|
||||
inline unsigned netiiu::channelCount () const
|
||||
{
|
||||
return this->channelList.count ();
|
||||
}
|
||||
|
||||
// cac lock must also be applied when calling this
|
||||
inline void netiiu::attachChannel ( class nciu &chan )
|
||||
{
|
||||
this->channelList.add ( chan );
|
||||
}
|
||||
|
||||
// cac lock must also be applied when calling this
|
||||
inline void netiiu::detachChannel (
|
||||
epicsGuard < callbackMutex > & cbLocker, class nciu & chan )
|
||||
{
|
||||
this->channelList.remove ( chan );
|
||||
if ( this->channelList.count () == 0u ) {
|
||||
this->lastChannelDetachNotify ( cbLocker );
|
||||
}
|
||||
}
|
||||
|
||||
inline nciu * netiiu::firstChannel ()
|
||||
{
|
||||
return this->channelList.first ();
|
||||
}
|
||||
|
||||
#endif // netiiuh
|
||||
|
||||
Reference in New Issue
Block a user