diff --git a/src/ca/cac.h b/src/ca/cac.h index d16fbc793..a1e7c46e2 100644 --- a/src/ca/cac.h +++ b/src/ca/cac.h @@ -47,6 +47,7 @@ public: struct CASG; class inetAddrID; +class caServerID; struct caHdrLargeArray; extern epicsThreadPrivateId caClientCallbackThreadId; @@ -58,8 +59,8 @@ public: virtual ~cac (); // beacon management - void beaconNotify ( const inetAddrID &addr, - const epicsTime ¤tTime ); + void beaconNotify ( const inetAddrID & addr, + const epicsTime & currentTime ); void repeaterSubscribeConfirmNotify (); // outstanding IO count management routines @@ -81,10 +82,12 @@ public: // channel routines void installNetworkChannel ( nciu &, netiiu *&piiu ); bool lookupChannelAndTransferToTCP ( unsigned cid, unsigned sid, - ca_uint16_t typeCode, arrayElementCount count, unsigned minorVersionNumber, - const osiSockAddr &, const epicsTime & currentTime ); + ca_uint16_t typeCode, arrayElementCount count, + unsigned minorVersionNumber, const osiSockAddr &, + const epicsTime & currentTime ); void uninstallChannel ( nciu & ); - cacChannel & createChannel ( const char *name_str, cacChannelNotify &chan ); + cacChannel & createChannel ( const char *name_str, + cacChannelNotify &chan, cacChannel::priLev pri ); void registerService ( cacService &service ); // IO request stubs @@ -137,52 +140,54 @@ public: void notifyDestroyFD ( SOCKET ) const; void uninstallIIU ( tcpiiu &iiu ); bool preemptiveCallbackEnable () const; + double beaconPeriod ( const nciu & chan ) const; private: - ipAddrToAsciiEngine ipToAEngine; - cacServiceList services; - tsDLList < tcpiiu > iiuList; + ipAddrToAsciiEngine ipToAEngine; + cacServiceList services; chronIntIdResTable - < nciu > chanTable; + < nciu > chanTable; chronIntIdResTable - < baseNMIU > ioTable; + < baseNMIU > ioTable; chronIntIdResTable - < CASG > sgTable; + < CASG > sgTable; resTable - < bhe, inetAddrID > beaconTable; + < bhe, inetAddrID > beaconTable; + resTable + < tcpiiu, caServerID > serverTable; tsFreeList < class netReadNotifyIO, 1024 > - freeListReadNotifyIO; + freeListReadNotifyIO; tsFreeList < class netWriteNotifyIO, 1024 > - freeListWriteNotifyIO; + freeListWriteNotifyIO; tsFreeList < class netSubscription, 1024 > - freeListSubscription; - epicsTime programBeginTime; - double connTMO; - mutable epicsMutex mutex; - epicsMutex callbackMutex; - epicsMutex serializePendIO; - epicsMutex serializePendEvent; - epicsEvent ioDone; - epicsEvent noRecvThreadsPending; - epicsEvent iiuUninstal; - epicsTimerQueueActive *pTimerQueue; - char *pUserName; - class udpiiu *pudpiiu; - class searchTimer *pSearchTmr; + freeListSubscription; + epicsTime programBeginTime; + double connTMO; + mutable epicsMutex mutex; + epicsMutex callbackMutex; + epicsMutex serializePendIO; + epicsMutex serializePendEvent; + epicsEvent ioDone; + epicsEvent noRecvThreadsPending; + epicsEvent iiuUninstal; + epicsTimerQueueActive *pTimerQueue; + char *pUserName; + class udpiiu *pudpiiu; + class searchTimer *pSearchTmr; class repeaterSubscribeTimer - *pRepeaterSubscribeTmr; - void *tcpSmallRecvBufFreeList; - void *tcpLargeRecvBufFreeList; - cacNotify & notify; - unsigned initializingThreadsPriority; - unsigned maxRecvBytesTCP; - unsigned pndRecvCnt; - unsigned readSeq; - unsigned recvThreadsPendingCount; - bool enablePreemptiveCallback; + *pRepeaterSubscribeTmr; + void *tcpSmallRecvBufFreeList; + void *tcpLargeRecvBufFreeList; + cacNotify & notify; + unsigned initializingThreadsPriority; + unsigned maxRecvBytesTCP; + unsigned pndRecvCnt; + unsigned readSeq; + unsigned recvThreadsPendingCount; + bool enablePreemptiveCallback; void flushRequestPrivate (); void run (); diff --git a/src/ca/cacChannel.cpp b/src/ca/cacChannel.cpp index 88ea8b915..223a7da03 100644 --- a/src/ca/cacChannel.cpp +++ b/src/ca/cacChannel.cpp @@ -22,6 +22,13 @@ #include "cacIO.h" #undef epicsExportSharedSymbols +const cacChannel::priLev cacChannel::priorityMax = 100u; +const cacChannel::priLev cacChannel::priorityMin = 0u; +const cacChannel::priLev cacChannel::priorityDefault = priorityMin; +const cacChannel::priLev cacChannel::priorityLinksDB = priorityMax; +const cacChannel::priLev cacChannel::priorityArchive = ( priorityMax - priorityMin ) / 2; +const cacChannel::priLev cacChannel::priorityOPI = priorityMin; + cacChannel::~cacChannel () { } diff --git a/src/ca/cacIO.h b/src/ca/cacIO.h index d88dd40f6..8e7a4e76d 100644 --- a/src/ca/cacIO.h +++ b/src/ca/cacIO.h @@ -124,6 +124,14 @@ public: // class epicsShareClass cacChannel { public: + typedef unsigned priLev; + static const priLev priorityMax; + static const priLev priorityMin; + static const priLev priorityDefault; + static const priLev priorityLinksDB; + static const priLev priorityArchive; + static const priLev priorityOPI; + typedef unsigned ioid; enum ioStatus { iosSynch, iosAsynch }; @@ -159,6 +167,7 @@ public: // exceptions class badString {}; class badType {}; + class badPriority {}; class outOfBounds {}; class badEventSelection {}; class noWriteAccess {}; @@ -188,7 +197,8 @@ public: struct cacService : public tsDLNode < cacService > { public: virtual cacChannel * createChannel ( - const char *pName, cacChannelNotify & ) = 0; + const char *pName, cacChannelNotify &, + cacChannel::priLev = cacChannel::priorityDefault ) = 0; virtual void show ( unsigned level ) const = 0; }; @@ -196,7 +206,8 @@ class cacServiceList { public: epicsShareFunc void registerService ( cacService &service ); epicsShareFunc cacChannel * createChannel ( - const char *pName, cacChannelNotify & ); + const char *pName, cacChannelNotify &, + cacChannel::priLev = cacChannel::priorityDefault ); epicsShareFunc void show ( unsigned level ) const; private: tsDLList < cacService > services; @@ -207,7 +218,7 @@ epicsShareExtern cacServiceList cacGlobalServiceList; epicsShareFunc int epicsShareAPI ca_register_service ( struct cacService *pService ); -inline cacChannel::cacChannel ( cacChannelNotify ¬ify ) : +inline cacChannel::cacChannel ( cacChannelNotify & notify ) : callback ( notify ) { } diff --git a/src/ca/cacServiceList.cpp b/src/ca/cacServiceList.cpp index 174045ab7..71ac62e81 100644 --- a/src/ca/cacServiceList.cpp +++ b/src/ca/cacServiceList.cpp @@ -30,14 +30,14 @@ void cacServiceList::registerService ( cacService &service ) } cacChannel * cacServiceList::createChannel ( - const char *pName, cacChannelNotify &chan ) + const char * pName, cacChannelNotify & chan, cacChannel::priLev pri ) { cacChannel *pChanIO = 0; epicsAutoMutex locker ( this->mutex ); tsDLIterBD < cacService > iter = this->services.firstIter (); while ( iter.valid () ) { - pChanIO = iter->createChannel ( pName, chan ); + pChanIO = iter->createChannel ( pName, chan, pri ); if ( pChanIO ) { break; }