diff --git a/src/ca/nciu.cpp b/src/ca/nciu.cpp index bc7bc1b3c..a582cdd37 100644 --- a/src/ca/nciu.cpp +++ b/src/ca/nciu.cpp @@ -35,8 +35,8 @@ tsFreeList < class nciu, 1024 > nciu::freeList; epicsMutex nciu::freeListMutex; -nciu::nciu ( cac &cacIn, netiiu &iiuIn, cacChannelNotify &chanIn, - const char *pNameIn ) : +nciu::nciu ( cac & cacIn, netiiu & iiuIn, cacChannelNotify & chanIn, + const char *pNameIn, cacChannel::priLev pri ) : cacChannel ( chanIn ), cacCtx ( cacIn ), piiu ( &iiuIn ), @@ -46,6 +46,7 @@ nciu::nciu ( cac &cacIn, netiiu &iiuIn, cacChannelNotify &chanIn, retrySeqNo ( 0u ), nameLength ( strlen ( pNameIn ) + 1 ), typeCode ( USHRT_MAX ), + priority ( pri ), f_connected ( false ), f_previousConn ( false ), f_claimSent ( false ), @@ -54,7 +55,7 @@ nciu::nciu ( cac &cacIn, netiiu &iiuIn, cacChannelNotify &chanIn, { // second constraint is imposed by size field in protocol header if ( this->nameLength > MAX_UDP_SEND - sizeof ( caHdr ) || this->nameLength > 0xffff ) { - throwWithLocation ( caErrorCode ( ECA_BADSTR ) ); + throw cacChannel::badString (); } this->pNameStr = new char [ this->nameLength ]; @@ -368,8 +369,7 @@ unsigned nciu::searchAttempts () const double nciu::beaconPeriod () const { - epicsAutoMutex locker ( this->cacCtx.mutexRef() ); - return this->piiu->beaconPeriod (); + return this->cacCtx.beaconPeriod ( *this ); } void nciu::notifyStateChangeFirstConnectInCountOfOutstandingIO () @@ -441,8 +441,3 @@ int nciu::printf ( const char *pFormat, ... ) return status; } - - - - - diff --git a/src/ca/nciu.h b/src/ca/nciu.h index 2ef98a056..faa6de12d 100644 --- a/src/ca/nciu.h +++ b/src/ca/nciu.h @@ -42,8 +42,8 @@ private: class nciu : public cacChannel, public tsDLNode < nciu >, public chronIntIdRes < nciu >, public cacPrivateListOfIO { public: - nciu ( cac &, netiiu &, - cacChannelNotify &, const char *pNameIn ); + nciu ( cac &, netiiu &, cacChannelNotify &, + const char *pNameIn, cacChannel::priLev ); void connect ( unsigned nativeType, unsigned nativeCount, unsigned sid, bool v41Ok ); void connect (); @@ -62,6 +62,7 @@ public: ca_uint32_t getSID () const; ca_uint32_t getCID () const; netiiu * getPIIU (); + const netiiu * getConstPIIU () const; cac & getClient (); int printf ( const char *pFormat, ... ); void searchReplySetUp ( netiiu &iiu, unsigned sidIn, @@ -75,6 +76,7 @@ public: bool connected () const; bool previouslyConnected () const; void writeException ( int status, const char *pContext, unsigned type, arrayElementCount count ); + cacChannel::priLev getPriority () const; protected: ~nciu (); // force pool allocation private: @@ -88,6 +90,7 @@ private: ca_uint16_t retrySeqNo; // search retry seq number ca_uint16_t nameLength; // channel name length ca_uint16_t typeCode; + ca_uint8_t priority; unsigned f_connected:1; unsigned f_previousConn:1; // T if connected in the past unsigned f_claimSent:1; @@ -188,6 +191,11 @@ inline netiiu * nciu::getPIIU () return this->piiu; } +inline const netiiu * nciu::getConstPIIU () const +{ + return this->piiu; +} + inline cac & nciu::getClient () { return this->cacCtx; @@ -219,4 +227,9 @@ inline void nciu::accessRightsNotify () const this->notify().accessRightsNotify ( this->accessRightState ); } +inline cacChannel::priLev nciu::getPriority () const +{ + return this->priority; +} + #endif // ifdef nciuh diff --git a/src/ca/oldAccess.h b/src/ca/oldAccess.h index b0b48075f..f57e7172f 100644 --- a/src/ca/oldAccess.h +++ b/src/ca/oldAccess.h @@ -29,9 +29,9 @@ struct oldChannelNotify : public cacChannelNotify { public: - oldChannelNotify ( class oldCAC &, const char *pName, caCh *pConnCallBackIn, void *pPrivateIn ); + oldChannelNotify ( class oldCAC &, const char *pName, + caCh *pConnCallBackIn, void *pPrivateIn, capri priority ); void destroy (); - bool ioAttachOK (); void setPrivatePointer ( void * ); void * privatePointer () const; int changeConnCallBack ( caCh *pfunc ); @@ -73,11 +73,11 @@ public: protected: ~oldChannelNotify (); // must allocate from pool private: - cacChannel &io; - oldCAC &cacCtx; - caCh *pConnCallBack; - void *pPrivate; - caArh *pAccessRightsFunc; + cacChannel & io; + oldCAC & cacCtx; + caCh * pConnCallBack; + void * pPrivate; + caArh * pAccessRightsFunc; void connectNotify (); void disconnectNotify (); void accessRightsNotify ( const caAccessRights & ); @@ -127,9 +127,9 @@ public: protected: ~getCallback (); // allocate only out of pool private: - oldChannelNotify &chan; - caEventCallBackFunc *pFunc; - void *pPrivate; + oldChannelNotify & chan; + caEventCallBackFunc * pFunc; + void * pPrivate; void completion ( unsigned type, arrayElementCount count, const void *pData); void exception ( int status, @@ -164,18 +164,17 @@ public: oldChannelNotify &, unsigned type, arrayElementCount nElem, unsigned mask, caEventCallBackFunc *pFunc, void *pPrivate ); - bool ioAttachOK (); void destroy (); void * operator new ( size_t size ); void operator delete ( void *pCadaver, size_t size ); - oldChannelNotify &channel () const; + oldChannelNotify & channel () const; protected: ~oldSubscription (); // must allocate from pool private: - oldChannelNotify &chan; + oldChannelNotify & chan; cacChannel::ioid id; - caEventCallBackFunc *pFunc; - void *pPrivate; + caEventCallBackFunc * pFunc; + void * pPrivate; bool subscribed; void current ( unsigned type, arrayElementCount count, const void *pData ); @@ -194,7 +193,8 @@ public: void registerForFileDescriptorCallBack ( CAFDHANDLER *pFunc, void *pArg ); void replaceErrLogHandler ( caPrintfFunc *ca_printf_func ); void registerService ( cacService &service ); - cacChannel & createChannel ( const char *name_str, oldChannelNotify &chan ); + cacChannel & createChannel ( const char * name_str, + oldChannelNotify & chan, cacChannel::priLev pri ); void flushRequest (); int pendIO ( const double &timeout ); int pendEvent ( const double &timeout ); @@ -235,11 +235,6 @@ private: int fetchClientContext ( oldCAC **ppcac ); -inline bool oldChannelNotify::ioAttachOK () -{ - return &this->io ? true : false; -} - inline void oldChannelNotify::destroy () { delete this; @@ -432,9 +427,10 @@ inline void oldCAC::registerService ( cacService &service ) this->clientCtx.registerService ( service ); } -inline cacChannel & oldCAC::createChannel ( const char *name_str, oldChannelNotify &chan ) +inline cacChannel & oldCAC::createChannel ( const char * name_str, + oldChannelNotify & chan, cacChannel::priLev pri ) { - return this->clientCtx.createChannel ( name_str, chan ); + return this->clientCtx.createChannel ( name_str, chan, pri ); } inline int oldCAC::pendIO ( const double &timeout )