From 1e8abfda0414be62edf8aed5cceb3b2dfd16f741 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 5 Aug 1997 00:47:27 +0000 Subject: [PATCH] fixed warnings --- src/cas/build/singleThread/Makefile.Host | 4 + src/cas/example/simple/exPV.cc | 73 +++-- src/cas/example/simple/exServer.cc | 40 +-- src/cas/example/simple/exServer.h | 143 ++++----- src/cas/example/simple/exVectorPV.cc | 53 +++- src/cas/example/simple/main.cc | 13 +- src/cas/generic/caNetAddr.h | 7 +- src/cas/generic/caServer.cc | 24 +- src/cas/generic/caServerI.cc | 23 +- src/cas/generic/casAsyncExIOI.cc | 9 +- src/cas/generic/casAsyncIO.cc | 7 +- src/cas/generic/casAsyncIOI.cc | 7 +- src/cas/generic/casAsyncPVCIOI.cc | 7 +- src/cas/generic/casAsyncRdIOI.cc | 9 +- src/cas/generic/casAsyncWtIOI.cc | 7 +- src/cas/generic/casAsyncXXIO.cc | 22 +- src/cas/generic/casChannel.cc | 24 +- src/cas/generic/casClient.cc | 39 ++- src/cas/generic/casClientIL.h | 41 +-- src/cas/generic/casClientMon.cc | 23 +- src/cas/generic/casDGClient.cc | 6 +- src/cas/generic/casEventMask.cc | 5 +- src/cas/generic/casEventMask.h | 5 +- src/cas/generic/casEventSysIL.h | 5 +- src/cas/generic/casInternal.h | 192 ++++++------ src/cas/generic/casPV.cc | 35 ++- src/cas/generic/casPVI.cc | 5 +- src/cas/generic/casPVIIL.h | 36 +-- src/cas/generic/casStrmClient.cc | 47 ++- src/cas/generic/casdef.h | 214 ++++++------- src/cas/generic/server.h | 365 ++++++++++++----------- src/cas/generic/st/casDGOS.cc | 4 +- src/cas/generic/st/casOSD.h | 49 +-- src/cas/generic/st/casStreamOS.cc | 4 +- src/cas/io/bsdSocket/caServerIO.cc | 25 +- src/cas/io/bsdSocket/casDGIntfIO.cc | 10 +- src/cas/io/bsdSocket/casIOD.h | 75 ++--- src/cas/os/vxWorks/casDGOS.cc | 4 +- src/cas/os/vxWorks/casOSD.h | 8 +- src/cas/os/vxWorks/casStreamOS.cc | 4 +- 40 files changed, 921 insertions(+), 752 deletions(-) diff --git a/src/cas/build/singleThread/Makefile.Host b/src/cas/build/singleThread/Makefile.Host index cffaf1765..39a437149 100644 --- a/src/cas/build/singleThread/Makefile.Host +++ b/src/cas/build/singleThread/Makefile.Host @@ -60,6 +60,10 @@ LIBSRCS += casStreamIO.cc LIBRARY := cas +LIBTYPE := SHARED + +DLL_LIBS := ca gdd Com + include $(TOP)/config/RULES.Host clean:: diff --git a/src/cas/example/simple/exPV.cc b/src/cas/example/simple/exPV.cc index b1ba423e8..4d6dac4c9 100644 --- a/src/cas/example/simple/exPV.cc +++ b/src/cas/example/simple/exPV.cc @@ -10,12 +10,13 @@ osiTime exPV::currentTime; // // exPV::exPV() // -exPV::exPV (caServer &casIn, pvInfo &setup, aitBool preCreateFlag) : +exPV::exPV (caServer &casIn, pvInfo &setup, aitBool preCreateFlag, aitBool scanOnIn) : pValue(NULL), info(setup), casPV(casIn), interest(aitFalse), - preCreate(preCreateFlag) + preCreate(preCreateFlag), + scanOn(scanOnIn) { // // no dataless PV allowed @@ -27,8 +28,10 @@ exPV::exPV (caServer &casIn, pvInfo &setup, aitBool preCreateFlag) : // (we will speed this up to the normal rate when // someone is watching the PV) // - this->pScanTimer = - new exScanTimer (this->getScanPeriod(), *this); + if (this->scanOn) { + this->pScanTimer = + new exScanTimer (this->getScanPeriod(), *this); + } } // @@ -64,43 +67,43 @@ void exPV::destroy() // caStatus exPV::update(gdd &valueIn) { - caServer *pCAS = this->getCAS(); - // - // gettimeofday() is very slow under sunos4 - // - osiTime cur (this->currentTime); - struct timespec t; + caServer *pCAS = this->getCAS(); + // + // gettimeofday() is very slow under sunos4 + // + osiTime cur (this->currentTime); + struct timespec t; caStatus cas; - if (!pCAS) { - return S_casApp_noSupport; - } + if (!pCAS) { + return S_casApp_noSupport; + } -# if DEBUG - printf("Setting %s too:\n", this->info.getName().string()); - valueIn.dump(); -# endif +# if DEBUG + printf("Setting %s too:\n", this->info.getName().string()); + valueIn.dump(); +# endif cas = this->updateValue (valueIn); if (cas || !this->pValue) { return cas; } - t.tv_sec = (time_t) cur.getSecTruncToLong (); + t.tv_sec = (time_t) cur.getSecTruncToLong (); t.tv_nsec = cur.getNSecTruncToLong (); - this->pValue->setTimeStamp(&t); + this->pValue->setTimeStamp(&t); this->pValue->setStat (epicsAlarmNone); this->pValue->setSevr (epicsSevNone); - + // // post a value change event // - if (this->interest==aitTrue) { - casEventMask select(pCAS->valueEventMask|pCAS->logEventMask); - this->postEvent (select, *this->pValue); - } - - return S_casApp_success; + if (this->interest==aitTrue) { + casEventMask select(pCAS->valueEventMask|pCAS->logEventMask); + this->postEvent (select, *this->pValue); + } + + return S_casApp_success; } // @@ -108,7 +111,7 @@ caStatus exPV::update(gdd &valueIn) // void exScanTimer::expire () { - pv.scan(); + pv.scan(); } // @@ -156,16 +159,20 @@ caStatus exPV::interestRegister() this->interest = aitTrue; + if (!this->scanOn) { + return S_casApp_success; + } + // // If a slow scan is pending then reschedule it // with the specified scan period. // if (this->pScanTimer) { - this->pScanTimer->reschedule(this->info.getScanPeriod()); + this->pScanTimer->reschedule(this->getScanPeriod()); } else { this->pScanTimer = new exScanTimer - (this->info.getScanPeriod(), *this); + (this->getScanPeriod(), *this); if (!this->pScanTimer) { errPrintf (S_cas_noMemory, __FILE__, __LINE__, "Scan init for %s failed\n", @@ -183,7 +190,7 @@ caStatus exPV::interestRegister() void exPV::interestDelete() { this->interest = aitFalse; - if (this->pScanTimer) { + if (this->pScanTimer && this->scanOn) { this->pScanTimer->reschedule(this->getScanPeriod()); } } @@ -301,7 +308,7 @@ caStatus exPV::getLowLimit(gdd &value) // caStatus exPV::getUnits(gdd &units) { - static aitString str("furlongs"); + aitString str("furlongs", aitStrRefConstImortal); units.put(str); return S_cas_success; } @@ -345,7 +352,7 @@ caStatus exPV::getValue(gdd &value) // caStatus exPV::write (const casCtx &, gdd &valueIn) { - return this->update (valueIn); + return this->update (valueIn); } // @@ -354,6 +361,6 @@ caStatus exPV::write (const casCtx &, gdd &valueIn) // caStatus exPV::read (const casCtx &, gdd &protoIn) { - return exServer::read(*this, protoIn); + return exServer::read(*this, protoIn); } diff --git a/src/cas/example/simple/exServer.cc b/src/cas/example/simple/exServer.cc index e6ba77c79..021629c52 100644 --- a/src/cas/example/simple/exServer.cc +++ b/src/cas/example/simple/exServer.cc @@ -49,9 +49,10 @@ pvInfo exServer::billy (2.0, "billy", 10.0f, -10.0f, excasIoAsync, 1u); // // exServer::exServer() // -exServer::exServer(const char * const pvPrefix, unsigned aliasCount) : +exServer::exServer(const char * const pvPrefix, unsigned aliasCount, aitBool scanOnIn) : caServer(NELEMENTS(this->pvList)+2u), - simultAsychIOCount(0u) + simultAsychIOCount(0u), + scanOn(scanOnIn) { unsigned i; exPV *pPV; @@ -80,23 +81,23 @@ exServer::exServer(const char * const pvPrefix, unsigned aliasCount) : exServer::ft.installReadFunc ("value", &exPV::getValue); exServer::ft.installReadFunc ("enums", &exPV::getEnums); - // - // hash table size may need adjustment here? - // - resLibStatus = this->stringResTbl.init(NELEMENTS(this->pvList)*(aliasCount+1u)+2u); - if (resLibStatus) { - fprintf(stderr, "CAS: string resource id table init failed\n"); + // + // hash table size may need adjustment here? + // + resLibStatus = this->stringResTbl.init(NELEMENTS(this->pvList)*(aliasCount+1u)+2u); + if (resLibStatus) { + fprintf(stderr, "CAS: string resource id table init failed\n"); // // should throw an exception once this is portable // assert(resLibStatus==0); - } + } // // pre-create all of the simple PVs that this server will export // for (pPVI = exServer::pvList; pPVI < pPVAfter; pPVI++) { - pPV = pPVI->createPV (*this, aitTrue); + pPV = pPVI->createPV (*this, aitTrue, scanOnIn); if (!pPV) { fprintf(stderr, "Unable to create new PV \"%s\"\n", pPVI->getName()); @@ -229,14 +230,13 @@ pvCreateReturn exServer::createPV // If this is a synchronous PV create the PV now // if (pvi.getIOType() == excasIoSync) { - pPV = pvi.createPV(*this, aitFalse); + pPV = pvi.createPV(*this, aitFalse, this->scanOn); if (pPV) { return *pPV; } else { return S_casApp_noMemory; } - } // // Initiate async IO if this is an async PV @@ -249,7 +249,7 @@ pvCreateReturn exServer::createPV this->simultAsychIOCount++; exAsyncCreateIO *pIO = - new exAsyncCreateIO(pvi, *this, ctx); + new exAsyncCreateIO(pvi, *this, ctx, this->scanOn); if (pIO) { return S_casApp_asyncCompletion; } @@ -262,7 +262,7 @@ pvCreateReturn exServer::createPV // // pvInfo::createPV() // -exPV *pvInfo::createPV (exServer &exCAS, aitBool preCreateFlag) +exPV *pvInfo::createPV (exServer &exCAS, aitBool preCreateFlag, aitBool scanOn) { if (this->pPV) { return this->pPV; @@ -278,10 +278,10 @@ exPV *pvInfo::createPV (exServer &exCAS, aitBool preCreateFlag) if (this->elementCount==1u) { switch (this->ioType){ case excasIoSync: - pNewPV = new exScalarPV (exCAS, *this, preCreateFlag); + pNewPV = new exScalarPV (exCAS, *this, preCreateFlag, scanOn); break; case excasIoAsync: - pNewPV = new exAsyncPV (exCAS, *this, preCreateFlag); + pNewPV = new exAsyncPV (exCAS, *this, preCreateFlag, scanOn); break; default: pNewPV = NULL; @@ -290,7 +290,7 @@ exPV *pvInfo::createPV (exServer &exCAS, aitBool preCreateFlag) } else { if (this->ioType==excasIoSync) { - pNewPV = new exVectorPV (exCAS, *this, preCreateFlag); + pNewPV = new exVectorPV (exCAS, *this, preCreateFlag, scanOn); } else { pNewPV = NULL; @@ -302,6 +302,10 @@ exPV *pvInfo::createPV (exServer &exCAS, aitBool preCreateFlag) // the constructor because the base class's // pure virtual function would be called) // + // We always perform this step even if + // scanning is disable so that there will + // always be an initial value + // if (pNewPV) { this->pPV = pNewPV; pNewPV->scan(); @@ -364,7 +368,7 @@ void exAsyncCreateIO::expire() { exPV *pPV; - pPV = this->pvi.createPV(this->cas, aitFalse); + pPV = this->pvi.createPV(this->cas, aitFalse, this->scanOn); if (pPV) { this->postIOCompletion (pvCreateReturn(*pPV)); } diff --git a/src/cas/example/simple/exServer.h b/src/cas/example/simple/exServer.h index 84b6121b6..dc2125611 100644 --- a/src/cas/example/simple/exServer.h +++ b/src/cas/example/simple/exServer.h @@ -80,15 +80,15 @@ public: const excasIoType getIOType () const { return this->ioType; } const unsigned getElementCount() const { return this->elementCount; } - void destroyPV() { this->pPV=NULL; } - exPV *createPV (exServer &exCAS, aitBool preCreateFlag); + void destroyPV() { this->pPV=NULL; } + exPV *createPV (exServer &exCAS, aitBool preCreateFlag, aitBool scanOn); private: - const double scanPeriod; - const char *pName; - const double hopr; - const double lopr; + const double scanPeriod; + const char *pName; + const double hopr; + const double lopr; const excasIoType ioType; - const unsigned elementCount; + const unsigned elementCount; exPV *pPV; }; @@ -142,36 +142,36 @@ private: // class exPV : public casPV, public tsSLNode { public: - exPV (caServer &cas, pvInfo &setup, aitBool preCreateFlag); + exPV (caServer &cas, pvInfo &setup, aitBool preCreateFlag, aitBool scanOn); virtual ~exPV(); void show(unsigned level) const; - // - // Called by the server libary each time that it wishes to - // subscribe for PV the server tool via postEvent() below. - // - caStatus interestRegister(); + // + // Called by the server libary each time that it wishes to + // subscribe for PV the server tool via postEvent() below. + // + caStatus interestRegister(); - // - // called by the server library each time that it wishes to - // remove its subscription for PV value change events - // from the server tool via caServerPostEvents() - // - void interestDelete(); + // + // called by the server library each time that it wishes to + // remove its subscription for PV value change events + // from the server tool via caServerPostEvents() + // + void interestDelete(); aitEnum bestExternalType() const; - // - // chCreate() is called each time that a PV is attached to - // by a client. The server tool must create a casChannel object - // (or a derived class) each time that this routine is called - // - // If the operation must complete asynchronously then return - // the status code S_casApp_asyncCompletion and then - // create the casChannel object at some time in the future - // - //casChannel *createChannel (); + // + // chCreate() is called each time that a PV is attached to + // by a client. The server tool must create a casChannel object + // (or a derived class) each time that this routine is called + // + // If the operation must complete asynchronously then return + // the status code S_casApp_asyncCompletion and then + // create the casChannel object at some time in the future + // + //casChannel *createChannel (); // // This gets called when the pv gets a new value @@ -202,10 +202,10 @@ public: // aitTimeStamp getTS(); - // + // // If no one is watching scan the PV with 10.0 // times the specified period - // + // const float getScanPeriod() { double curPeriod; @@ -214,7 +214,7 @@ public: if (!this->interest) { curPeriod *= 10.0L; } - return curPeriod; + return (float) curPeriod; } caStatus read (const casCtx &, gdd &protoIn); @@ -237,9 +237,10 @@ protected: gdd *pValue; exScanTimer *pScanTimer; pvInfo & info; - aitBool interest; - aitBool preCreate; - static osiTime currentTime; + aitBool interest; + aitBool preCreate; + aitBool scanOn; + static osiTime currentTime; virtual caStatus updateValue (gdd &value) = 0; }; @@ -250,8 +251,8 @@ protected: class exScalarPV : public exPV { public: exScalarPV (caServer &cas, - pvInfo &setup, aitBool preCreateFlag) : - exPV (cas, setup, preCreateFlag) {} + pvInfo &setup, aitBool preCreateFlag, aitBool scanOnIn) : + exPV (cas, setup, preCreateFlag, scanOnIn) {} void scan(); private: caStatus updateValue (gdd &value); @@ -263,8 +264,8 @@ private: class exVectorPV : public exPV { public: exVectorPV (caServer &cas, pvInfo &setup, - aitBool preCreateFlag) : - exPV (cas, setup, preCreateFlag) {} + aitBool preCreateFlag, aitBool scanOnIn) : + exPV (cas, setup, preCreateFlag, scanOnIn) {} void scan(); unsigned maxDimension() const; @@ -279,7 +280,7 @@ private: // class exServer : public caServer { public: - exServer(const char * const pvPrefix, unsigned aliasCount); + exServer(const char * const pvPrefix, unsigned aliasCount, aitBool scanOn); ~exServer(); void show (unsigned level) const; pvExistReturn pvExistTest (const casCtx&, const char *pPVName); @@ -309,6 +310,7 @@ public: private: resTable stringResTbl; unsigned simultAsychIOCount; + aitBool scanOn; // // list of pre-created PVs @@ -332,19 +334,20 @@ public: // // exAsyncPV() // - exAsyncPV (caServer &cas, pvInfo &setup, aitBool preCreateFlag) : - exScalarPV (cas, setup, preCreateFlag), + exAsyncPV (caServer &cas, pvInfo &setup, + aitBool preCreateFlag, aitBool scanOnIn) : + exScalarPV (cas, setup, preCreateFlag, scanOnIn), simultAsychIOCount(0u) {} - // - // read - // - caStatus read(const casCtx &ctxIn, gdd &value); + // + // read + // + caStatus read(const casCtx &ctxIn, gdd &value); - // - // write - // - caStatus write(const casCtx &ctxIn, gdd &value); + // + // write + // + caStatus write(const casCtx &ctxIn, gdd &value); // // removeIO @@ -369,27 +372,27 @@ class exChannel : public casChannel{ public: exChannel(const casCtx &ctxIn) : casChannel(ctxIn) {} - //void setOwner(const char *pUserName, const char *pHostName){}; + //void setOwner(const char *pUserName, const char *pHostName){}; - // - // called when the first client begins to monitor the PV - // - caStatus interestRegister () + // + // called when the first client begins to monitor the PV + // + caStatus interestRegister () { - return S_cas_success; + return S_cas_success; } - // - // called when the last client stops monitoring the PV - // - void interestDelete () {} + // + // called when the last client stops monitoring the PV + // + void interestDelete () {} - // - // the following are encouraged to change during an channel's - // lifetime - // - aitBool readAccess () const {return aitTrue;}; - aitBool writeAccess () const {return aitTrue;}; + // + // the following are encouraged to change during an channel's + // lifetime + // + aitBool readAccess () const {return aitTrue;}; + aitBool writeAccess () const {return aitTrue;}; private: }; @@ -524,8 +527,9 @@ public: // exAsyncCreateIO() // exAsyncCreateIO(pvInfo &pviIn, exServer &casIn, - const casCtx &ctxIn) : - casAsyncPVCreateIO(ctxIn), pvi(pviIn), cas(casIn) {} + const casCtx &ctxIn, aitBool scanOnIn) : + casAsyncPVCreateIO(ctxIn), pvi(pviIn), + cas(casIn), scanOn(scanOnIn) {} ~exAsyncCreateIO() { @@ -541,8 +545,9 @@ public: const char *name() const; private: - pvInfo &pvi; + pvInfo &pvi; exServer &cas; + aitBool scanOn; }; // diff --git a/src/cas/example/simple/exVectorPV.cc b/src/cas/example/simple/exVectorPV.cc index 907608819..bd1e9e22a 100644 --- a/src/cas/example/simple/exVectorPV.cc +++ b/src/cas/example/simple/exVectorPV.cc @@ -18,6 +18,10 @@ #endif #endif +class exVecDestructor: public gddDestructor { + virtual void run (void *); +}; + // // exVectorPV::maxDimension() // @@ -44,20 +48,21 @@ aitIndex exVectorPV::maxBound (unsigned dimension) const // void exVectorPV::scan() { - caStatus status; - double radians; - gdd *pDD; - aitFloat32 *pF, *pFE, *pCF; - float newValue; - float limit; - - // - // update current time (so we are not required to do - // this every time that we write the PV which impacts - // throughput under sunos4 because gettimeofday() is - // slow) - // - this->currentTime = osiTime::getCurrent(); + caStatus status; + double radians; + gdd *pDD; + aitFloat32 *pF, *pFE, *pCF; + float newValue; + float limit; + exVecDestructor *pDest; + + // + // update current time (so we are not required to do + // this every time that we write the PV which impacts + // throughput under sunos4 because gettimeofday() is + // slow) + // + this->currentTime = osiTime::getCurrent(); pDD = new gddAtomic (gddAppType_value, aitEnumFloat32, 1u, this->info.getElementCount()); @@ -71,13 +76,21 @@ void exVectorPV::scan() pF = new aitFloat32 [this->info.getElementCount()]; if (!pF) { pDD->unreference(); + return; + } + + pDest = new exVecDestructor; + if (!pDest) { + delete [] pF; + pDD->unreference(); + return; } // // install the buffer into the DD // (do this before we increment pF) // - *pDD = pF; + pDD->putRef(pF, pDest); // // double check for reasonable bounds on the @@ -88,7 +101,7 @@ void exVectorPV::scan() if (this->pValue->dimension()==1u) { const gddBounds *pB = this->pValue->getBounds(); if (pB[0u].size()==this->info.getElementCount()) { - pCF = *pDD; + pCF = *this->pValue; } } } @@ -239,3 +252,11 @@ caStatus exVectorPV::updateValue(gdd &valueIn) return S_casApp_success; } +// +// exVecDestructor::run() +// +void exVecDestructor::run (void *pUntyped) +{ + aitFloat32 *pf = (aitFloat32 *) pUntyped; + delete [] pf; +} diff --git a/src/cas/example/simple/main.cc b/src/cas/example/simple/main.cc index 03370d83f..0d3bc4254 100644 --- a/src/cas/example/simple/main.cc +++ b/src/cas/example/simple/main.cc @@ -14,11 +14,12 @@ extern int main (int argc, const char **argv) float executionTime; char pvPrefix[128] = ""; unsigned aliasCount = 1u; - aitBool forever = aitTrue; + unsigned scanOn = 1u; + aitBool forever = aitTrue; int i; for (i=1; i -t -p -c]\n", +"usage: %s [-d -t -p -c] -s<1=scan on (default), 0=scan off]>\n", argv[0]); return (1); } - pCAS = new exServer(pvPrefix, aliasCount); + pCAS = new exServer(pvPrefix, aliasCount, (aitBool) scanOn); if (!pCAS) { return (-1); } diff --git a/src/cas/generic/caNetAddr.h b/src/cas/generic/caNetAddr.h index 640eb3c8a..741e141f9 100644 --- a/src/cas/generic/caNetAddr.h +++ b/src/cas/generic/caNetAddr.h @@ -15,10 +15,11 @@ #define caNetAddrH #ifdef caNetAddrSock -#include +#include "osiSock.h" #endif -#include +#include "epicsAssert.h" +#include "shareLib.h" class verifyCANetAddr { public: @@ -26,7 +27,7 @@ public: }; enum caNetAddrType {casnaUDF, casnaSock}; // only IP addresses (and undefined) supported at this time -class caNetAddr { +class epicsShareClass caNetAddr { friend class verifyCANetAddr; public: diff --git a/src/cas/generic/caServer.cc b/src/cas/generic/caServer.cc index 44a075700..8c09017f6 100644 --- a/src/cas/generic/caServer.cc +++ b/src/cas/generic/caServer.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.7 1997/06/25 05:09:00 jhill + * removed templInst.cc + * * Revision 1.6 1997/06/13 09:15:50 jhill * connect proto changes * @@ -50,10 +53,11 @@ * */ +#include "dbMapper.h" // ait to dbr types +#include "gddAppTable.h" // EPICS application type table + #include "server.h" #include "caServerIIL.h" // caServerI in line func -#include "dbMapper.h" // ait to dbr types -#include "gddAppTable.h" // EPICS application type table // // if the compiler supports explicit instantiation of @@ -75,7 +79,7 @@ // // caServer::caServer() // -caServer::caServer(unsigned pvCountEstimateIn) : +epicsShareFunc caServer::caServer(unsigned pvCountEstimateIn) : pCAS (new caServerI(*this, pvCountEstimateIn)), valueEventMask(this->registerEvent("value")), logEventMask(this->registerEvent("log")), @@ -103,7 +107,7 @@ caServer::caServer(unsigned pvCountEstimateIn) : // // caServer::~caServer() // -caServer::~caServer() +epicsShareFunc caServer::~caServer() { if (this->pCAS) { delete this->pCAS; @@ -113,7 +117,7 @@ caServer::~caServer() // // caServer::pvExistTest() // -pvExistReturn caServer::pvExistTest (const casCtx &, const char *) +epicsShareFunc pvExistReturn caServer::pvExistTest (const casCtx &, const char *) { return pverDoesNotExistHere; } @@ -121,7 +125,7 @@ pvExistReturn caServer::pvExistTest (const casCtx &, const char *) // // caServer::createPV() // -pvCreateReturn caServer::createPV (const casCtx &, const char *) +epicsShareFunc pvCreateReturn caServer::createPV (const casCtx &, const char *) { return S_casApp_pvNotFound; } @@ -129,7 +133,7 @@ pvCreateReturn caServer::createPV (const casCtx &, const char *) // // caServer::registerEvent() // -casEventMask caServer::registerEvent (const char *pName) +epicsShareFunc casEventMask caServer::registerEvent (const char *pName) { if (this->pCAS) { return this->pCAS->registerEvent(pName); @@ -144,7 +148,7 @@ casEventMask caServer::registerEvent (const char *pName) // // caServer::show() // -void caServer::show(unsigned level) const +epicsShareFunc void caServer::show(unsigned level) const { if (this->pCAS) { this->pCAS->show(level); @@ -157,7 +161,7 @@ void caServer::show(unsigned level) const // // caServer::setDebugLevel() // -void caServer::setDebugLevel (unsigned level) +epicsShareFunc void caServer::setDebugLevel (unsigned level) { if (pCAS) { this->pCAS->setDebugLevel(level); @@ -170,7 +174,7 @@ void caServer::setDebugLevel (unsigned level) // // caServer::getDebugLevel() // -unsigned caServer::getDebugLevel () +epicsShareFunc unsigned caServer::getDebugLevel () { if (pCAS) { return this->pCAS->getDebugLevel(); diff --git a/src/cas/generic/caServerI.cc b/src/cas/generic/caServerI.cc index e8970efd9..1a335cb20 100644 --- a/src/cas/generic/caServerI.cc +++ b/src/cas/generic/caServerI.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.8 1997/06/13 09:15:51 jhill + * connect proto changes + * * Revision 1.7 1997/04/10 19:33:53 jhill * API changes * @@ -295,12 +298,12 @@ void caServerI::connectCB(casIntfOS &intf) // void caServerI::advanceBeaconPeriod() { - // - // return if we are already at the plateau - // - if (this->beaconPeriod >= CAServerMaxBeaconPeriod) { - return; - } + // + // return if we are already at the plateau + // + if (this->beaconPeriod >= CAServerMaxBeaconPeriod) { + return; + } this->beaconPeriod += this->beaconPeriod; @@ -383,9 +386,9 @@ void caServerI::sendBeacon() } this->osiUnlock(); - // - // double the period between beacons (but dont exceed max) - // - this->advanceBeaconPeriod(); + // + // double the period between beacons (but dont exceed max) + // + this->advanceBeaconPeriod(); } diff --git a/src/cas/generic/casAsyncExIOI.cc b/src/cas/generic/casAsyncExIOI.cc index dbb035ba1..3ee210bff 100644 --- a/src/cas/generic/casAsyncExIOI.cc +++ b/src/cas/generic/casAsyncExIOI.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.4 1997/06/13 09:15:53 jhill + * connect proto changes + * * Revision 1.3 1997/04/10 19:33:54 jhill * API changes * @@ -52,7 +55,7 @@ // // casAsyncExIOI::casAsyncExIOI() // -casAsyncExIOI::casAsyncExIOI( +epicsShareFunc casAsyncExIOI::casAsyncExIOI( const casCtx &ctx, casAsyncPVExistIO &ioIn) : casAsyncIOI(*ctx.getClient(), ioIn), msg(*ctx.getMsg()), @@ -75,7 +78,7 @@ casAsyncExIOI::~casAsyncExIOI() // // casAsyncExIOI::postIOCompletion() // -caStatus casAsyncExIOI::postIOCompletion(const pvExistReturn retValIn) +epicsShareFunc caStatus casAsyncExIOI::postIOCompletion(const pvExistReturn retValIn) { this->retVal = retValIn; return this->postIOCompletionI(); @@ -86,7 +89,7 @@ caStatus casAsyncExIOI::postIOCompletion(const pvExistReturn retValIn) // casAsyncExIOI::cbFuncAsyncIO() // (called when IO completion event reaches top of event queue) // -caStatus casAsyncExIOI::cbFuncAsyncIO() +epicsShareFunc caStatus casAsyncExIOI::cbFuncAsyncIO() { caStatus status; diff --git a/src/cas/generic/casAsyncIO.cc b/src/cas/generic/casAsyncIO.cc index 21f41b00a..f18dcd1b1 100644 --- a/src/cas/generic/casAsyncIO.cc +++ b/src/cas/generic/casAsyncIO.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.3 1997/04/10 19:33:55 jhill + * API changes + * * Revision 1.2 1996/11/02 00:53:57 jhill * many improvements * @@ -44,7 +47,7 @@ // This must be virtual so that derived destructor will // be run indirectly. Therefore it cannot be inline. // -casAsyncIO::~casAsyncIO() +epicsShareFunc casAsyncIO::~casAsyncIO() { } @@ -52,7 +55,7 @@ casAsyncIO::~casAsyncIO() // casAsyncIO::destroy() // (default is a normal delete) // -void casAsyncIO::destroy() +epicsShareFunc void casAsyncIO::destroy() { delete this; } diff --git a/src/cas/generic/casAsyncIOI.cc b/src/cas/generic/casAsyncIOI.cc index 9a0facb1a..c5a060d7e 100644 --- a/src/cas/generic/casAsyncIOI.cc +++ b/src/cas/generic/casAsyncIOI.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.6 1997/04/10 19:33:56 jhill + * API changes + * * Revision 1.5 1996/12/13 00:08:35 jhill * dont unlock after destroy * @@ -131,7 +134,7 @@ casAsyncIOI::~casAsyncIOI() // casAsyncIOI::cbFunc() // (called when IO completion event reaches top of event queue) // -caStatus casAsyncIOI::cbFunc(class casEventSys &) +epicsShareFunc caStatus casAsyncIOI::cbFunc(class casEventSys &) { casCoreClient &theClient = this->client; caStatus status; @@ -230,7 +233,7 @@ caServer *casAsyncIOI::getCAS() const // // casAsyncIOI::readOP() // -int casAsyncIOI::readOP() +epicsShareFunc int casAsyncIOI::readOP() { // // not a read op diff --git a/src/cas/generic/casAsyncPVCIOI.cc b/src/cas/generic/casAsyncPVCIOI.cc index d443d6fbe..872af28fa 100644 --- a/src/cas/generic/casAsyncPVCIOI.cc +++ b/src/cas/generic/casAsyncPVCIOI.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.2 1997/06/13 09:15:54 jhill + * connect proto changes + * * Revision 1.1 1997/04/10 19:38:14 jhill * installed * @@ -52,7 +55,7 @@ // // casAsyncPVCIOI::casAsyncPVCIOI() // -casAsyncPVCIOI::casAsyncPVCIOI(const casCtx &ctx, +epicsShareFunc casAsyncPVCIOI::casAsyncPVCIOI(const casCtx &ctx, casAsyncPVCreateIO &ioIn) : casAsyncIOI(*ctx.getClient(), ioIn), msg(*ctx.getMsg()), @@ -73,7 +76,7 @@ casAsyncPVCIOI::~casAsyncPVCIOI() // // casAsyncPVCIOI::postIOCompletion() // -caStatus casAsyncPVCIOI::postIOCompletion(const pvCreateReturn &retValIn) +epicsShareFunc caStatus casAsyncPVCIOI::postIOCompletion(const pvCreateReturn &retValIn) { this->retVal = retValIn; return this->postIOCompletionI(); diff --git a/src/cas/generic/casAsyncRdIOI.cc b/src/cas/generic/casAsyncRdIOI.cc index d0b102cfd..bfb81a7c5 100644 --- a/src/cas/generic/casAsyncRdIOI.cc +++ b/src/cas/generic/casAsyncRdIOI.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.3 1997/04/10 19:33:56 jhill + * API changes + * * Revision 1.2 1996/11/06 22:15:54 jhill * allow monitor init read to using rd async io * @@ -56,7 +59,7 @@ // // casAsyncRdIOI::casAsyncRdIOI() // -casAsyncRdIOI::casAsyncRdIOI(const casCtx &ctx, casAsyncReadIO &ioIn) : +epicsShareFunc casAsyncRdIOI::casAsyncRdIOI(const casCtx &ctx, casAsyncReadIO &ioIn) : casAsyncIOI(*ctx.getClient(), ioIn), msg(*ctx.getMsg()), chan(*ctx.getChannel()), @@ -91,7 +94,7 @@ casAsyncRdIOI::~casAsyncRdIOI() // // casAsyncRdIOI::postIOCompletion() // -caStatus casAsyncRdIOI::postIOCompletion(caStatus completionStatusIn, +epicsShareFunc caStatus casAsyncRdIOI::postIOCompletion(caStatus completionStatusIn, gdd &valueRead) { int gddStatus; @@ -110,7 +113,7 @@ caStatus casAsyncRdIOI::postIOCompletion(caStatus completionStatusIn, // // casAsyncRdIOI::readOP() // -int casAsyncRdIOI::readOP() +epicsShareFunc int casAsyncRdIOI::readOP() { return TRUE; // it is a read op } diff --git a/src/cas/generic/casAsyncWtIOI.cc b/src/cas/generic/casAsyncWtIOI.cc index bacb2cefa..aa6acb7f8 100644 --- a/src/cas/generic/casAsyncWtIOI.cc +++ b/src/cas/generic/casAsyncWtIOI.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.3 1997/04/10 19:33:57 jhill + * API changes + * * Revision 1.2 1996/11/06 22:15:56 jhill * allow monitor init read to using rd async io * @@ -47,7 +50,7 @@ // // casAsyncWtIOI::casAsyncWtIOI() // -casAsyncWtIOI::casAsyncWtIOI(const casCtx &ctx, casAsyncWriteIO &ioIn) : +epicsShareFunc casAsyncWtIOI::casAsyncWtIOI(const casCtx &ctx, casAsyncWriteIO &ioIn) : casAsyncIOI(*ctx.getClient(), ioIn), msg(*ctx.getMsg()), chan(*ctx.getChannel()), @@ -72,7 +75,7 @@ casAsyncWtIOI::~casAsyncWtIOI() // // casAsyncWtIOI::postIOCompletion() // -caStatus casAsyncWtIOI::postIOCompletion(caStatus completionStatusIn) +epicsShareFunc caStatus casAsyncWtIOI::postIOCompletion(caStatus completionStatusIn) { this->completionStatus = completionStatusIn; return this->postIOCompletionI(); diff --git a/src/cas/generic/casAsyncXXIO.cc b/src/cas/generic/casAsyncXXIO.cc index 404195ef2..0ef62f6cc 100644 --- a/src/cas/generic/casAsyncXXIO.cc +++ b/src/cas/generic/casAsyncXXIO.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.2 1997/04/10 19:33:58 jhill + * API changes + * * Revision 1.1 1996/11/02 01:01:05 jhill * installed * @@ -36,13 +39,24 @@ * */ +// +// EPICS +// (some of these are included from casdef.h but +// are included first here so that they are included +// once only before epicsExportSharedSymbols is defined) +// +#include "alarm.h" // EPICS alarm severity/condition +#include "errMdef.h" // EPICS error codes +#include "gdd.h" // EPICS data descriptors + +#define epicsExportSharedSymbols #include "casdef.h" // // This must be virtual so that derived destructor will // be run indirectly. Therefore it cannot be inline. // -casAsyncReadIO::~casAsyncReadIO() +epicsShareFunc casAsyncReadIO::~casAsyncReadIO() { } @@ -50,7 +64,7 @@ casAsyncReadIO::~casAsyncReadIO() // This must be virtual so that derived destructor will // be run indirectly. Therefore it cannot be inline. // -casAsyncWriteIO::~casAsyncWriteIO() +epicsShareFunc casAsyncWriteIO::~casAsyncWriteIO() { } @@ -58,7 +72,7 @@ casAsyncWriteIO::~casAsyncWriteIO() // This must be virtual so that derived destructor will // be run indirectly. Therefore it cannot be inline. // -casAsyncPVExistIO::~casAsyncPVExistIO() +epicsShareFunc casAsyncPVExistIO::~casAsyncPVExistIO() { } @@ -66,7 +80,7 @@ casAsyncPVExistIO::~casAsyncPVExistIO() // This must be virtual so that derived destructor will // be run indirectly. Therefore it cannot be inline. // -casAsyncPVCreateIO::~casAsyncPVCreateIO() +epicsShareFunc casAsyncPVCreateIO::~casAsyncPVCreateIO() { } diff --git a/src/cas/generic/casChannel.cc b/src/cas/generic/casChannel.cc index 42f3a4328..c9d034d89 100644 --- a/src/cas/generic/casChannel.cc +++ b/src/cas/generic/casChannel.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.5 1997/04/10 19:33:59 jhill + * API changes + * * Revision 1.4 1996/09/04 20:17:34 jhill * use ptr not ref to satisfy MSVISC++ * @@ -44,7 +47,6 @@ * */ - #include "server.h" #include "casChannelIIL.h" // casChannelI inline func #include "casPVListChanIL.h" // casPVListChan inline func @@ -52,7 +54,7 @@ // // casChannel::casChannel() // -casChannel::casChannel(const casCtx &ctx) : +epicsShareFunc casChannel::casChannel(const casCtx &ctx) : casPVListChan (ctx, *this) { } @@ -60,11 +62,11 @@ casChannel::casChannel(const casCtx &ctx) : // // casChannel::~casChannel() // -casChannel::~casChannel() +epicsShareFunc casChannel::~casChannel() { } -casPV *casChannel::getPV() +epicsShareFunc casPV *casChannel::getPV() { casPVI *pPVI = &this->casChannelI::getPVI(); @@ -79,7 +81,7 @@ casPV *casChannel::getPV() // // casChannel::setOwner() // -void casChannel::setOwner(const char * const /* pUserName */, +epicsShareFunc void casChannel::setOwner(const char * const /* pUserName */, const char * const /* pHostName */) { // @@ -90,7 +92,7 @@ void casChannel::setOwner(const char * const /* pUserName */, // // casChannel::readAccess() // -aitBool casChannel::readAccess () const +epicsShareFunc aitBool casChannel::readAccess () const { return aitTrue; } @@ -98,7 +100,7 @@ aitBool casChannel::readAccess () const // // casChannel::writeAccess() // -aitBool casChannel::writeAccess() const +epicsShareFunc aitBool casChannel::writeAccess() const { return aitTrue; } @@ -107,7 +109,7 @@ aitBool casChannel::writeAccess() const // // casChannel::confirmationRequested() // -aitBool casChannel::confirmationRequested() const +epicsShareFunc aitBool casChannel::confirmationRequested() const { return aitFalse; } @@ -115,7 +117,7 @@ aitBool casChannel::confirmationRequested() const // // casChannel::show() // -void casChannel::show(unsigned level) const +epicsShareFunc void casChannel::show(unsigned level) const { if (level>2u) { printf("casChannel: read access = %d\n", @@ -130,7 +132,7 @@ void casChannel::show(unsigned level) const // // casChannel::destroy() // -void casChannel::destroy() +epicsShareFunc void casChannel::destroy() { delete this; } @@ -138,7 +140,7 @@ void casChannel::destroy() // // casChannel::postAccessRightsEvent() // -void casChannel::postAccessRightsEvent() +epicsShareFunc void casChannel::postAccessRightsEvent() { this->casChannelI::postAccessRightsEvent(); } diff --git a/src/cas/generic/casClient.cc b/src/cas/generic/casClient.cc index af1bdccfd..5dea6afcf 100644 --- a/src/cas/generic/casClient.cc +++ b/src/cas/generic/casClient.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.8 1997/06/30 22:54:25 jhill + * use %p with pointers + * * Revision 1.7 1997/04/10 19:34:01 jhill * API changes * @@ -56,7 +59,6 @@ #include #include "server.h" -#include "casClientIL.h" // inline func for casClient #include "casEventSysIL.h" // inline func for casEventSys #include "casCtxIL.h" // inline func for casCtx #include "inBufIL.h" // inline func for inBuf @@ -115,6 +117,41 @@ caStatus casClient::init() return S_cas_success; } +// +// find the channel associated with a resource id +// +casChannelI *casClient::resIdToChannel(const caResId &id) +{ + casChannelI *pChan; + + // + // look up the id in a hash table + // + pChan = this->ctx.getServer()->resIdToChannel(id); + + // + // update the context + // + this->ctx.setChannel(pChan); + if (!pChan) { + return NULL; + } + + // + // If the channel isnt attached to this client then + // something has gone wrong + // + if (&pChan->getClient()!=this) { + return NULL; + } + + // + // update the context + // + this->ctx.setPV(&pChan->getPVI()); + return pChan; +} + // // casClient::loadProtoJumpTable() diff --git a/src/cas/generic/casClientIL.h b/src/cas/generic/casClientIL.h index 0a5d5eb17..10f53affd 100644 --- a/src/cas/generic/casClientIL.h +++ b/src/cas/generic/casClientIL.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.4 1997/04/10 19:34:02 jhill + * API changes + * * Revision 1.3 1996/12/11 00:59:37 jhill * added bad chan attachment detection * @@ -45,44 +48,6 @@ #ifndef casClientIL_h #define casClientIL_h -#include "caServerIIL.h" // caServerI inline func -#include "casCtxIL.h" // caServerI inline func - -// -// find the channel associated with a resource id -// -inline casChannelI *casClient::resIdToChannel(const caResId &id) -{ - casChannelI *pChan; - - // - // look up the id in a hash table - // - pChan = this->ctx.getServer()->resIdToChannel(id); - - // - // update the context - // - this->ctx.setChannel(pChan); - if (!pChan) { - return NULL; - } - - // - // If the channel isnt attached to this client then - // something has gone wrong - // - if (&pChan->getClient()!=this) { - return NULL; - } - - // - // update the context - // - this->ctx.setPV(&pChan->getPVI()); - return pChan; -} - // // casClient::getDebugLevel() // diff --git a/src/cas/generic/casClientMon.cc b/src/cas/generic/casClientMon.cc index bc7ee8b57..f85420fbe 100644 --- a/src/cas/generic/casClientMon.cc +++ b/src/cas/generic/casClientMon.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.2 1997/04/10 19:34:03 jhill + * API changes + * * Revision 1.1.1.1 1996/06/20 00:28:15 jhill * ca server installation * @@ -65,22 +68,22 @@ casClientMon::~casClientMon() // caStatus casClientMon::callBack(gdd &value) { - casCoreClient &client = this->getChannel().getClient(); - caStatus status; - caHdr msg; + casCoreClient &client = this->getChannel().getClient(); + caStatus status; + caHdr msg; // // reconstruct the msg header // - msg.m_cmmd = CA_PROTO_EVENT_ADD; - msg.m_postsize = 0u; - msg.m_type = this->getType(); - msg.m_count = this->getCount(); - msg.m_cid = this->getChannel().getSID(); - msg.m_available = this->getClientId(); + msg.m_cmmd = CA_PROTO_EVENT_ADD; + msg.m_postsize = 0u; + msg.m_type = this->getType(); + msg.m_count = (ca_uint16_t) this->getCount(); + msg.m_cid = this->getChannel().getSID(); + msg.m_available = this->getClientId(); status = client.monitorResponse (&this->getChannel(), - msg, &value, S_cas_success); + msg, &value, S_cas_success); return status; } diff --git a/src/cas/generic/casDGClient.cc b/src/cas/generic/casDGClient.cc index 78b2d2fd6..32c4265ae 100644 --- a/src/cas/generic/casDGClient.cc +++ b/src/cas/generic/casDGClient.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.11 1997/06/30 22:54:27 jhill + * use %p with pointers + * * Revision 1.10 1997/06/13 09:15:56 jhill * connect proto changes * @@ -61,15 +64,14 @@ * * */ +#include "gddApps.h" #include "server.h" #include "caServerIIL.h" // caServerI inline func -#include "casClientIL.h" // casClient inline func #include "dgOutBufIL.h" // dgOutBuf inline func #include "dgInBufIL.h" // dgInBuf inline func #include "casCtxIL.h" // casCtx inline func #include "casCoreClientIL.h" // casCoreClient inline func -#include "gddApps.h" // // CA Server Datagram (DG) Client diff --git a/src/cas/generic/casEventMask.cc b/src/cas/generic/casEventMask.cc index cf9e51ce2..281751443 100644 --- a/src/cas/generic/casEventMask.cc +++ b/src/cas/generic/casEventMask.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.6 1997/04/10 19:34:07 jhill + * API changes + * * Revision 1.5 1996/12/11 01:01:56 jhill * casEventMaskEntry constr does res tbl add * @@ -47,8 +50,6 @@ * */ - -#include "epicsAssert.h" #include #include diff --git a/src/cas/generic/casEventMask.h b/src/cas/generic/casEventMask.h index c0f1fbc1c..e7517d8f1 100644 --- a/src/cas/generic/casEventMask.h +++ b/src/cas/generic/casEventMask.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.5 1997/04/10 19:34:08 jhill + * API changes + * * Revision 1.4 1996/12/11 01:02:35 jhill * removed casEventMaskEntry def * @@ -52,7 +55,7 @@ class casEventRegistry; -class casEventMask { +class epicsShareClass casEventMask { friend inline casEventMask operator| (const casEventMask &lhs, const casEventMask &rhs); friend inline casEventMask operator& (const casEventMask &lhs, diff --git a/src/cas/generic/casEventSysIL.h b/src/cas/generic/casEventSysIL.h index b1bde25d0..d51a8c64f 100644 --- a/src/cas/generic/casEventSysIL.h +++ b/src/cas/generic/casEventSysIL.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.4 1997/04/10 19:34:09 jhill + * API changes + * * Revision 1.3 1996/11/02 00:54:13 jhill * many improvements * @@ -67,7 +70,7 @@ inline casEventSys::casEventSys (casCoreClient &coreClientIn) : // inline caStatus casEventSys::init() { - if (mutex.init()) { + if (this->mutex.init()) { return S_cas_noMemory; } return S_cas_success; diff --git a/src/cas/generic/casInternal.h b/src/cas/generic/casInternal.h index 97ab03c21..218bceb21 100644 --- a/src/cas/generic/casInternal.h +++ b/src/cas/generic/casInternal.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.12 1997/06/13 09:15:58 jhill + * connect proto changes + * * Revision 1.11 1997/04/10 19:34:10 jhill * API changes * @@ -180,16 +183,16 @@ private: // class casMonitor : public tsDLNode, public casRes { public: - casMonitor(caResId clientIdIn, casChannelI &chan, - unsigned long nElem, unsigned dbrType, - const casEventMask &maskIn, osiMutex &mutexIn); - virtual ~casMonitor(); + casMonitor(caResId clientIdIn, casChannelI &chan, + unsigned long nElem, unsigned dbrType, + const casEventMask &maskIn, osiMutex &mutexIn); + virtual ~casMonitor(); caStatus executeEvent(casMonEvent *); - void post(const casEventMask &select, gdd &value); + inline void post(const casEventMask &select, gdd &value); - virtual void show (unsigned level) const; + virtual void show (unsigned level) const; virtual caStatus callBack(gdd &value)=0; caResId getClientId() const @@ -210,26 +213,26 @@ public: { return this->ciu; } - + void postIfModified(); -private: - casMonEvent overFlowEvent; - unsigned long const nElem; - osiMutex &mutex; - casChannelI &ciu; - const casEventMask mask; - gdd *pModifiedValue; - caResId const clientId; - unsigned char const dbrType; - unsigned char nPend; - unsigned ovf:1; - unsigned enabled:1; + private: + casMonEvent overFlowEvent; + unsigned long const nElem; + osiMutex &mutex; + casChannelI &ciu; + const casEventMask mask; + gdd *pModifiedValue; + caResId const clientId; + unsigned char const dbrType; + unsigned char nPend; + unsigned ovf:1; + unsigned enabled:1; void enable(); void disable(); - void push (gdd &value); + void push (gdd &value); }; // @@ -241,17 +244,11 @@ inline void casMonitor::post(const casEventMask &select, gdd &value) casEventMask result(select&this->mask); // // NOOP if this event isnt selected + // or if it is disabled // - if (result.noEventsSelected()) { - return; - } - - // - // NOOP if currently disabled - // - if (!this->enabled) { - return; - } + if (result.noEventsSelected() || !this->enabled) { + return; + } // // else push it on the queue @@ -259,7 +256,6 @@ inline void casMonitor::post(const casEventMask &select, gdd &value) this->push(value); } - class caServer; class casCoreClient; class casChannelI; @@ -276,16 +272,16 @@ public: casAsyncIOI (casCoreClient &client, casAsyncIO &ioExternal); virtual ~casAsyncIOI(); - // - // place notification of IO completion on the event queue - // + // + // place notification of IO completion on the event queue + // caStatus postIOCompletionI(); inline void lock(); inline void unlock(); virtual caStatus cbFuncAsyncIO()=0; - virtual int readOP(); + epicsShareFunc virtual int readOP(); void destroyIfReadOP(); @@ -296,7 +292,7 @@ public: void reportInvalidAsynchIO(unsigned); protected: - casCoreClient &client; + casCoreClient &client; casAsyncIO &ioExternal; private: @@ -305,11 +301,11 @@ private: unsigned ioComplete:1; unsigned serverDelete:1; unsigned duplicate:1; - // - // casEvent virtual call back function - // (called when IO completion event reaches top of event queue) - // - caStatus cbFunc(casEventSys &); + // + // casEvent virtual call back function + // (called when IO completion event reaches top of event queue) + // + epicsShareFunc caStatus cbFunc(casEventSys &); inline casAsyncIO * operator -> (); }; @@ -321,22 +317,22 @@ private: // class casAsyncRdIOI : public casAsyncIOI { public: - casAsyncRdIOI(const casCtx &ctx, casAsyncReadIO &ioIn); + epicsShareFunc casAsyncRdIOI(const casCtx &ctx, casAsyncReadIO &ioIn); virtual ~casAsyncRdIOI(); void destroyIfReadOP(); - caStatus cbFuncAsyncIO(); + epicsShareFunc caStatus cbFuncAsyncIO(); casAsyncIO &getAsyncIO(); - caStatus postIOCompletion(caStatus completionStatus, - gdd &valueRead); - int readOP(); + epicsShareFunc caStatus postIOCompletion(caStatus completionStatus, + gdd &valueRead); + epicsShareFunc int readOP(); private: - caHdr const msg; + caHdr const msg; casChannelI &chan; gdd *pDD; - caStatus completionStatus; + caStatus completionStatus; }; // @@ -346,20 +342,20 @@ private: // class casAsyncWtIOI : public casAsyncIOI { public: - casAsyncWtIOI(const casCtx &ctx, casAsyncWriteIO &ioIn); + epicsShareFunc casAsyncWtIOI(const casCtx &ctx, casAsyncWriteIO &ioIn); virtual ~casAsyncWtIOI(); - // - // place notification of IO completion on the event queue - // - caStatus postIOCompletion(caStatus completionStatus); + // + // place notification of IO completion on the event queue + // + epicsShareFunc caStatus postIOCompletion(caStatus completionStatus); - caStatus cbFuncAsyncIO(); + epicsShareFunc caStatus cbFuncAsyncIO(); casAsyncIO &getAsyncIO(); private: - caHdr const msg; + caHdr const msg; casChannelI &chan; - caStatus completionStatus; + caStatus completionStatus; }; class casDGIntfIO; @@ -371,18 +367,18 @@ class casDGIntfIO; // class casAsyncExIOI : public casAsyncIOI { public: - casAsyncExIOI(const casCtx &ctx, casAsyncPVExistIO &ioIn); + epicsShareFunc casAsyncExIOI(const casCtx &ctx, casAsyncPVExistIO &ioIn); virtual ~casAsyncExIOI(); - // - // place notification of IO completion on the event queue - // - caStatus postIOCompletion(const pvExistReturn retVal); + // + // place notification of IO completion on the event queue + // + epicsShareFunc caStatus postIOCompletion(const pvExistReturn retVal); - caStatus cbFuncAsyncIO(); + epicsShareFunc caStatus cbFuncAsyncIO(); casAsyncIO &getAsyncIO(); private: - caHdr const msg; + caHdr const msg; pvExistReturn retVal; casDGIntfIO * const pOutDGIntfIO; const caNetAddr dgOutAddr; @@ -395,18 +391,18 @@ private: // class casAsyncPVCIOI : public casAsyncIOI { public: - casAsyncPVCIOI(const casCtx &ctx, casAsyncPVCreateIO &ioIn); + epicsShareFunc casAsyncPVCIOI(const casCtx &ctx, casAsyncPVCreateIO &ioIn); virtual ~casAsyncPVCIOI(); - // - // place notification of IO completion on the event queue - // - caStatus postIOCompletion(const pvCreateReturn &retVal); + // + // place notification of IO completion on the event queue + // + epicsShareFunc caStatus postIOCompletion(const pvCreateReturn &retVal); - caStatus cbFuncAsyncIO(); + epicsShareFunc caStatus cbFuncAsyncIO(); casAsyncIO &getAsyncIO(); private: - caHdr const msg; + caHdr const msg; pvCreateReturn retVal; }; @@ -420,35 +416,35 @@ class casPVI; // events can be posted // class casChannelI : public tsDLNode, public casRes, - public casEvent { + public casEvent { public: casChannelI (const casCtx &ctx, casChannel &chanAdapter); virtual ~casChannelI(); - casCoreClient &getClient() const + casCoreClient &getClient() const { return this->client; } - const caResId getCID() + const caResId getCID() { return this->cid; } // // fetch the unsigned integer server id for this PV // - inline const caResId getSID(); + inline const caResId getSID(); - void postAllModifiedEvents(); + void postAllModifiedEvents(); // // addMonitor() // - inline void addMonitor(casMonitor &mon); + inline void addMonitor(casMonitor &mon); // // deleteMonitor() // - inline void deleteMonitor(casMonitor &mon); + inline void deleteMonitor(casMonitor &mon); // // findMonitor @@ -458,7 +454,7 @@ public: // inline casMonitor *findMonitor(const caResId clientIdIn); - casPVI &getPVI() const + casPVI &getPVI() const { return this->pv; } @@ -486,16 +482,16 @@ public: // // access rights event call back // - caStatus cbFunc(casEventSys &); + caStatus cbFunc(casEventSys &); inline void postAccessRightsEvent(); protected: - tsDLList monitorList; + tsDLList monitorList; tsDLList ioInProgList; - casCoreClient &client; - casPVI &pv; + casCoreClient &client; + casPVI &pv; casChannel &chan; - caResId const cid; // client id + caResId const cid; // client id unsigned clientDestroyPending:1; unsigned accessRightsEvPending:1; }; @@ -527,22 +523,22 @@ public: casPVI (caServer &cas, casPV &pvAdapter); virtual ~casPVI(); - // - // for use by the server library - // - inline caServerI &getCAS() const; + // + // for use by the server library + // + inline caServerI &getCAS() const; - // - // CA only does 1D arrays for now (and the new server - // temporarily does only scalers) - // - inline aitIndex nativeCount(); + // + // CA only does 1D arrays for now (and the new server + // temporarily does only scalers) + // + inline aitIndex nativeCount(); - // - // only for use by casMonitor - // - caStatus registerEvent (); - void unregisterEvent (); + // + // only for use by casMonitor + // + caStatus registerEvent (); + void unregisterEvent (); // // only for use by casAsyncIOI @@ -577,7 +573,7 @@ public: inline casPV * operator -> () const; - virtual casResType resourceType() const; + epicsShareFunc virtual casResType resourceType() const; virtual void show(unsigned level) const; diff --git a/src/cas/generic/casPV.cc b/src/cas/generic/casPV.cc index 2bdf78d6d..e6b00548c 100644 --- a/src/cas/generic/casPV.cc +++ b/src/cas/generic/casPV.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.6 1997/04/10 19:34:14 jhill + * API changes + * * Revision 1.5 1996/12/06 22:34:22 jhill * add maxDimension() and maxBound() * @@ -58,19 +61,19 @@ #include "casPVIIL.h" // casPVI inline func #include "casCtxIL.h" // casCtx inline func -casPV::casPV (caServer &casIn) : +epicsShareFunc casPV::casPV (caServer &casIn) : casPVI (casIn, *this) { } -casPV::~casPV() +epicsShareFunc casPV::~casPV() { } // // casPV::show() // -void casPV::show(unsigned level) const +epicsShareFunc void casPV::show(unsigned level) const { if (level>2u) { printf ("casPV: Best external type = %d\n", @@ -81,7 +84,7 @@ void casPV::show(unsigned level) const // // casPV::interestRegister() // -caStatus casPV::interestRegister() +epicsShareFunc caStatus casPV::interestRegister() { return S_casApp_success; } @@ -89,14 +92,14 @@ caStatus casPV::interestRegister() // // casPV::interestDelete() // -void casPV::interestDelete() +epicsShareFunc void casPV::interestDelete() { } // // casPV::beginTransaction() // -caStatus casPV::beginTransaction() +epicsShareFunc caStatus casPV::beginTransaction() { return S_casApp_success; } @@ -104,14 +107,14 @@ caStatus casPV::beginTransaction() // // casPV::endTransaction() // -void casPV::endTransaction() +epicsShareFunc void casPV::endTransaction() { } // // casPV::read() // -caStatus casPV::read(const casCtx &, gdd &) +epicsShareFunc caStatus casPV::read(const casCtx &, gdd &) { return S_casApp_noSupport; } @@ -119,7 +122,7 @@ caStatus casPV::read(const casCtx &, gdd &) // // casPV::write() // -caStatus casPV::write(const casCtx &, gdd &) +epicsShareFunc caStatus casPV::write(const casCtx &, gdd &) { return S_casApp_noSupport; } @@ -127,7 +130,7 @@ caStatus casPV::write(const casCtx &, gdd &) // // casPV::bestExternalType() // -aitEnum casPV::bestExternalType() const +epicsShareFunc aitEnum casPV::bestExternalType() const { return aitEnumString; } @@ -136,7 +139,7 @@ aitEnum casPV::bestExternalType() const // casPV::maxDimension() // (base returns zero - scaler) // -unsigned casPV::maxDimension() const +epicsShareFunc unsigned casPV::maxDimension() const { return 0u; } @@ -145,7 +148,7 @@ unsigned casPV::maxDimension() const // casPV::maxBound() // (base returns scaler bound independent of the dimension arg) // -aitIndex casPV::maxBound(unsigned /* dimension */) const +epicsShareFunc aitIndex casPV::maxBound(unsigned /* dimension */) const { return 1u; } @@ -153,7 +156,7 @@ aitIndex casPV::maxBound(unsigned /* dimension */) const // // casPV::createChannel() // -casChannel *casPV::createChannel (const casCtx &ctx, const char * const, +epicsShareFunc casChannel *casPV::createChannel (const casCtx &ctx, const char * const, const char * const) { return new casChannel (ctx); @@ -162,7 +165,7 @@ casChannel *casPV::createChannel (const casCtx &ctx, const char * const, // // casPV::destroy() // -void casPV::destroy() +epicsShareFunc void casPV::destroy() { delete this; } @@ -170,7 +173,7 @@ void casPV::destroy() // // Server tool calls this function to post a PV event. // -void casPV::postEvent (const casEventMask &select, gdd &event) +epicsShareFunc void casPV::postEvent (const casEventMask &select, gdd &event) { this->casPVI::postEvent (select, event); } @@ -184,7 +187,7 @@ void casPV::postEvent (const casEventMask &select, gdd &event) // for virtual casPV::destroy() // *************** // -caServer *casPV::getCAS() const +epicsShareFunc caServer *casPV::getCAS() const { return this->casPVI::getExtServer(); } diff --git a/src/cas/generic/casPVI.cc b/src/cas/generic/casPVI.cc index 289e83bf1..88c6219ad 100644 --- a/src/cas/generic/casPVI.cc +++ b/src/cas/generic/casPVI.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.8 1997/04/10 19:34:15 jhill + * API changes + * * Revision 1.7 1996/12/12 18:55:38 jhill * fixed client initiated pv delete calls interestDelete() VF bug * @@ -203,7 +206,7 @@ void casPVI::destroy() // casPVI::resourceType() // -casResType casPVI::resourceType() const +epicsShareFunc casResType casPVI::resourceType() const { return casPVT; } diff --git a/src/cas/generic/casPVIIL.h b/src/cas/generic/casPVIIL.h index 4545273f5..2e99bbacd 100644 --- a/src/cas/generic/casPVIIL.h +++ b/src/cas/generic/casPVIIL.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.10 1997/04/10 19:34:16 jhill + * API changes + * * Revision 1.9 1997/01/09 22:22:30 jhill * MSC cannot use the default constructor * @@ -182,8 +185,7 @@ inline void casPVI::deleteSignal() // inline caStatus casPVI::bestDBRType (unsigned &dbrType) { - int dbr; - dbr = gddAitToDbr[(*this)->bestExternalType()]; + int dbr = gddAitToDbr[(*this)->bestExternalType()]; if (INVALID_DB_FIELD(dbr)) { return S_cas_badType; } @@ -202,23 +204,23 @@ inline caStatus casPVI::bestDBRType (unsigned &dbrType) // inline void casPVI::postEvent (const casEventMask &select, gdd &event) { - if (this->nMonAttached==0u) { - return; - } - - // - // the event queue is looking at the DD - // now so it must not be changed - // - event.markConstant(); - + if (this->nMonAttached==0u) { + return; + } + + // + // the event queue is looking at the DD + // now so it must not be changed + // + event.markConstant(); + this->lock(); - tsDLIterBD iter(this->chanList.first()); - const tsDLIterBD eol; - while ( iter != eol ) { - iter->postEvent(select, event); + tsDLIterBD iter(this->chanList.first()); + const tsDLIterBD eol; + while ( iter != eol ) { + iter->postEvent(select, event); ++iter; - } + } this->unlock(); } diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index 265b42c32..5433dbd20 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.17 1997/06/30 22:54:28 jhill + * use %p with pointers + * * Revision 1.16 1997/06/13 09:16:00 jhill * connect proto changes * @@ -78,19 +81,19 @@ * */ -#include "server.h" #include "dbMapper.h" // ait to dbr types -#include "gddAppTable.h" // EPICS application type table +#include "gddAppTable.h" // EPICS application type table +#include "gddApps.h" // gdd predefined application type codes +#include "net_convert.h" // byte order conversion from libca + +#include "server.h" #include "caServerIIL.h" // caServerI inline functions -#include "casClientIL.h" // casClient inline functions #include "casChannelIIL.h" // casChannelI inline functions #include "casPVIIL.h" // casPVI inline functions #include "casCtxIL.h" // casCtx inline functions #include "casEventSysIL.h" // casEventSys inline functions #include "inBufIL.h" // inBuf inline functions #include "outBufIL.h" // outBuf inline functions -#include "gddApps.h" -#include "net_convert.h" // byte order conversion from libca static const caHdr nill_msg = {0u,0u,0u,0u,0u,0u}; @@ -317,7 +320,8 @@ caStatus casStrmClient::readResponse (casChannelI *pChan, const caHdr &msg, { caHdr *reply; unsigned size; - int localStatus; + caStatus localStatus; + int mapDBRStatus; int strcnt; if (status!=S_casApp_success) { @@ -352,8 +356,10 @@ caStatus casStrmClient::readResponse (casChannelI *pChan, const caHdr &msg, // convert gdd to db_access type // (places the data in network format) // - gddMapDbr[msg.m_type].conv_dbr((reply+1), pDesc); - + mapDBRStatus = gddMapDbr[msg.m_type].conv_dbr((reply+1), msg.m_count, pDesc); + if (mapDBRStatus<0) { + return this->sendErrWithEpicsStatus(&msg, S_cas_badBounds, ECA_GETFAIL); + } #ifdef CONVERSION_REQUIRED /* use type as index into conversion jumptable */ (* cac_dbr_cvrt[msg.m_type]) @@ -462,12 +468,19 @@ caStatus casStrmClient::readNotifyResponse (casChannelI *, // if (completionStatus == S_cas_success) { if (pDesc) { + int mapDBRStatus; // // convert gdd to db_access type // (places the data in network format) // - gddMapDbr[msg.m_type].conv_dbr((reply+1), pDesc); - reply->m_cid = ECA_NORMAL; + mapDBRStatus = gddMapDbr[msg.m_type].conv_dbr((reply+1), msg.m_count, pDesc); + if (mapDBRStatus<0) { + errMessage(S_cas_badBounds, "get notify request"); + reply->m_cid = ECA_GETFAIL; + } + else { + reply->m_cid = ECA_NORMAL; + } } else { errMessage(S_cas_badParameter, @@ -598,7 +611,7 @@ caStatus casStrmClient::monitorResponse (casChannelI *pChan, // there appears to be no success/fail // status from this routine // - gddMapDbr[msg.m_type].conv_dbr ((pReply+1), pDBRDD); + gddMapDbr[msg.m_type].conv_dbr ((pReply+1), msg.m_count, pDBRDD); #ifdef CONVERSION_REQUIRED /* use type as index into conversion jumptable */ @@ -1377,7 +1390,7 @@ caStatus casStrmClient::eventCancelAction() reply->m_cmmd = CA_PROTO_EVENT_ADD; reply->m_postsize = 0u; reply->m_type = pMon->getType(); - reply->m_count = pMon->getCount(); + reply->m_count = (unsigned short) pMon->getCount(); reply->m_cid = pciu->getCID(); reply->m_available = pMon->getClientId(); @@ -1862,8 +1875,10 @@ caStatus createDBRDD (unsigned dbrType, aitIndex dbrCount, gdd *&pDescRet) // // convert to atomic // - pVal->setDimension(1); - pVal->setBound(0, 0u, dbrCount); + gddBounds bds; + bds.setSize(dbrCount); + bds.setFirst(0u); + pVal->setDimension(1u, &bds); } else if (pVal->isAtomic()) { const gddBounds* pB = pVal->getBounds(); @@ -1879,7 +1894,7 @@ caStatus createDBRDD (unsigned dbrType, aitIndex dbrCount, gdd *&pDescRet) } for (dim=0u; dim<(unsigned)pVal->dimension(); dim++) { - if (pB->first()!=0u && pB->size()!=bound) { + if (pB[dim].first()!=0u && pB[dim].size()!=bound) { if (modAllowed) { pVal->setBound(dim, 0u, bound); } @@ -1889,7 +1904,7 @@ caStatus createDBRDD (unsigned dbrType, aitIndex dbrCount, gdd *&pDescRet) return S_cas_internal; } } - bound = 0u; + bound = 1u; } } else { diff --git a/src/cas/generic/casdef.h b/src/cas/generic/casdef.h index 7cd87356e..7aab4e8b7 100644 --- a/src/cas/generic/casdef.h +++ b/src/cas/generic/casdef.h @@ -30,6 +30,9 @@ * Modification Log: * ----------------- * $Log$ + * Revision 1.13 1997/06/13 09:16:01 jhill + * connect proto changes + * * Revision 1.12 1997/04/10 19:34:19 jhill * API changes * @@ -107,15 +110,16 @@ // // EPICS // -#include "alarm.h" // EPICS alarm severity/condition -#include "errMdef.h" // EPICS error codes +#include "alarm.h" // EPICS alarm severity/condition +#include "errMdef.h" // EPICS error codes #include "gdd.h" // EPICS data descriptors +#include "shareLib.h" // EPICS compiler specific sharable lib keywords // // This eliminates a warning resulting from passing *this // to a base class during derived class construction. // -#if defined(WIN32) +#if defined(_WIN32) # pragma warning (disable:4355) #endif @@ -125,7 +129,7 @@ typedef aitUint32 caStatus; /* * =========================================================== * for internal use by the server library - * (and potentially returned to the server application) + * (and potentially returned to the server tool) * =========================================================== */ #define S_cas_success 0 @@ -157,8 +161,7 @@ typedef aitUint32 caStatus; #define S_cas_validRequest (M_cas | 27) /*valid request*/ #define S_cas_tooManyEvents (M_cas | 28) /*maximum simult event types exceeded*/ #define S_cas_noInterface (M_cas | 29) /*server isnt attached to a network*/ - - +#define S_cas_badBounds (M_cas | 30) /*server tool changed bounds on request*/ /* * =========================================================== * returned by the application (to the server library) @@ -176,7 +179,7 @@ typedef aitUint32 caStatus; #define S_casApp_undefined (M_casApp | 9) /*undefined value*/ #define S_casApp_postponeAsyncIO (M_casApp | 10) /*postpone asynchronous IO*/ -#include +#include "caNetAddr.h" // // pv exist test return @@ -188,7 +191,8 @@ typedef aitUint32 caStatus; // enum pvExistReturnEnum {pverExistsHere, pverDoesNotExistHere, pverAsyncCompletion}; -class pvExistReturn { + +class epicsShareClass pvExistReturn { public: // // most server tools will use this @@ -226,7 +230,7 @@ private: class casPV; -class pvCreateReturn { +class epicsShareClass pvCreateReturn { public: pvCreateReturn(caStatus statIn) { this->pPV = NULL; this->stat = statIn; } @@ -287,30 +291,30 @@ private: // caServerI *pCAS; public: - caServer (unsigned pvCountEstimate=1024u); - virtual ~caServer(); + epicsShareFunc caServer (unsigned pvCountEstimate=1024u); + epicsShareFunc virtual ~caServer(); //caStatus enableClients (); //caStatus disableClients (); - void setDebugLevel (unsigned level); - unsigned getDebugLevel (); + epicsShareFunc void setDebugLevel (unsigned level); + epicsShareFunc unsigned getDebugLevel (); - casEventMask registerEvent (const char *pName); + epicsShareFunc casEventMask registerEvent (const char *pName); - // + // // show() - // - virtual void show (unsigned level) const; + // + epicsShareFunc virtual void show (unsigned level) const; - // + // // pvExistTest() // // The request is allowed to complete asynchronously // (see Asynchronous IO Classes below). // - // The server tool is encouraged to accept multiple PV name - // aliases for the same PV here. + // The server tool is encouraged to accept multiple PV name + // aliases for the same PV here. // // example return from this procedure: // return pverExistsHere; // server has PV @@ -322,12 +326,12 @@ public: // The client library will retry the request at some time // in the future. // - virtual pvExistReturn pvExistTest (const casCtx &ctx, - const char *pPVAliasName); + epicsShareFunc virtual pvExistReturn pvExistTest (const casCtx &ctx, + const char *pPVAliasName); - // - // createPV() is called _every_ time that a PV is attached to - // by a client. The name supplied here may be a PV canonical + // + // createPV() is called _every_ time that a PV is attached to + // by a client. The name supplied here may be a PV canonical // (base) name or it may instead be a PV alias name. // // The request is allowed to complete asynchronously @@ -356,8 +360,8 @@ public: // asynchronous IO operation (create or exist) completes // against the server. // - virtual pvCreateReturn createPV (const casCtx &ctx, - const char *pPVAliasName); + epicsShareFunc virtual pvCreateReturn createPV (const casCtx &ctx, + const char *pPVAliasName); // // common event masks @@ -398,47 +402,47 @@ public: // class casPV : private casPVI { public: - casPV (caServer &cas); + epicsShareFunc casPV (caServer &cas); - virtual ~casPV (); + epicsShareFunc virtual ~casPV (); // // This is called for each PV in the server if // caServer::show() is called and the level is high // enough // - virtual void show (unsigned level) const; + epicsShareFunc virtual void show (unsigned level) const; - // - // Called by the server libary each time that it wishes to - // subscribe for PV change notification from the server + // + // Called by the server libary each time that it wishes to + // subscribe for PV change notification from the server // tool via postEvent() below. // - virtual caStatus interestRegister (); + epicsShareFunc virtual caStatus interestRegister (); - // - // called by the server library each time that it wishes to - // remove its subscription for PV value change events - // from the server tool via caServerPostEvents() - // - virtual void interestDelete (); + // + // called by the server library each time that it wishes to + // remove its subscription for PV value change events + // from the server tool via caServerPostEvents() + // + epicsShareFunc virtual void interestDelete (); - // - // called by the server library immediately before initiating - // a transaction (PV state must not be modified during a - // transaction) - // + // + // called by the server library immediately before initiating + // a transaction (PV state must not be modified during a + // transaction) + // // HINT: their may be many read/write operations performed within // a single transaction if a large array is being transferred // - virtual caStatus beginTransaction (); + epicsShareFunc virtual caStatus beginTransaction (); - // - // called by the server library immediately after completing - // a tranaction (PV state modification may resume after the - // transaction completes) - // - virtual void endTransaction (); + // + // called by the server library immediately after completing + // a tranaction (PV state modification may resume after the + // transaction completes) + // + epicsShareFunc virtual void endTransaction (); // // read @@ -457,7 +461,7 @@ public: // asynchronous IO operation (read or write) completes // against the PV. // - virtual caStatus read (const casCtx &ctx, gdd &prototype); + epicsShareFunc virtual caStatus read (const casCtx &ctx, gdd &prototype); // // write @@ -471,35 +475,35 @@ public: // asynchronous IO operation (read or write) completes // against the PV. // - virtual caStatus write (const casCtx &ctx, gdd &value); + epicsShareFunc virtual caStatus write (const casCtx &ctx, gdd &value); - // - // chCreate() is called each time that a PV is attached to - // by a client. The server tool may choose not to + // + // chCreate() is called each time that a PV is attached to + // by a client. The server tool may choose not to // implement this routine (in which case the channel // will be created by the server). If the server tool // implements this function then it must create a casChannel object - // (or a derived class) each time that this routine is called - // - virtual casChannel *createChannel (const casCtx &ctx, + // (or a derived class) each time that this routine is called + // + epicsShareFunc virtual casChannel *createChannel (const casCtx &ctx, const char * const pUserName, const char * const pHostName); - // - // destroy() is called + // + // destroy() is called // 1) each time that a PV transitions from // a situation where clients are attached to a situation // where no clients are attached. // 2) once for all PVs that exist when the server is deleted // // the default (base) "destroy()" executes "delete this" - // - virtual void destroy (); + // + epicsShareFunc virtual void destroy (); // // tbe best type for clients to use when accessing the // value of the PV // - virtual aitEnum bestExternalType () const; + epicsShareFunc virtual aitEnum bestExternalType () const; // // Returns the maximum bounding box for all present and @@ -543,13 +547,13 @@ public: // set to one then the bound on the second dimension // are being fetched... // - virtual unsigned maxDimension() const; // return zero if scaler - virtual aitIndex maxBound (unsigned dimension) const; + epicsShareFunc virtual unsigned maxDimension() const; // return zero if scaler + epicsShareFunc virtual aitIndex maxBound (unsigned dimension) const; - // - // Server tool calls this function to post a PV event. - // - void postEvent (const casEventMask &select, gdd &event); + // + // Server tool calls this function to post a PV event. + // + epicsShareFunc void postEvent (const casEventMask &select, gdd &event); // // peek at the pv name @@ -558,7 +562,7 @@ public: // this routine should return the canonical (base) // name for the PV // - virtual const char *getName() const = 0; + epicsShareFunc virtual const char *getName() const = 0; // // Find the server associated with this PV @@ -569,7 +573,7 @@ public: // for virtual casPV::destroy() // *************** // - caServer *getCAS() const; + epicsShareFunc caServer *getCAS() const; // // only used when caStrmClient converts between @@ -596,48 +600,48 @@ public: // class casChannel : private casPVListChan { public: - casChannel(const casCtx &ctx); - virtual ~casChannel(); + epicsShareFunc casChannel(const casCtx &ctx); + epicsShareFunc virtual ~casChannel(); // // Called when the user name and the host name are changed // for a live connection. // - virtual void setOwner(const char * const pUserName, - const char * const pHostName); + epicsShareFunc virtual void setOwner(const char * const pUserName, + const char * const pHostName); // // the following are encouraged to change during an channel's // lifetime // - virtual aitBool readAccess () const; - virtual aitBool writeAccess () const; + epicsShareFunc virtual aitBool readAccess () const; + epicsShareFunc virtual aitBool writeAccess () const; // return true to hint that the opi should ask the operator // for confirmation prior writing to this PV - virtual aitBool confirmationRequested () const; + epicsShareFunc virtual aitBool confirmationRequested () const; // // This is called for each channel in the server if // caServer::show() is called and the level is high // enough // - virtual void show(unsigned level) const; + epicsShareFunc virtual void show(unsigned level) const; - // - // destroy() is called when + // + // destroy() is called when // 1) there is a client initiated channel delete // 2) there is a server tool initiaed PV delete // 3) there is a server tool initiated server delete - // + // // the casChannel::destroy() executes a "delete this" // - virtual void destroy(); + epicsShareFunc virtual void destroy(); // // server tool calls this to indicate change in access // rights has occurred // - void postAccessRightsEvent(); + epicsShareFunc void postAccessRightsEvent(); // // Find the PV associated with this channel @@ -648,7 +652,7 @@ public: // for virtual casChannel::destroy() // *************** // - casPV *getPV(); + epicsShareFunc casPV *getPV(); // // only used when casStrmClient converts between @@ -710,7 +714,7 @@ public: // // force virtual destructor // - virtual ~casAsyncIO(); + epicsShareFunc virtual ~casAsyncIO(); // // called by the server lib after the response message @@ -719,7 +723,7 @@ public: // // default destroy executes a "delete this". // - virtual void destroy(); + epicsShareFunc virtual void destroy(); }; // @@ -741,20 +745,20 @@ public: // // casAsyncReadIO() // - casAsyncReadIO(const casCtx &ctx) : + epicsShareFunc casAsyncReadIO(const casCtx &ctx) : casAsyncRdIOI(ctx, *this) {} // // force virtual destructor // - virtual ~casAsyncReadIO(); + epicsShareFunc virtual ~casAsyncReadIO(); // // place notification of IO completion on the event queue // (this function does not delete the casAsyncIO object). // Only the first call to this function has any effect. // - caStatus postIOCompletion(caStatus completionStatusIn, gdd &valueRead) + epicsShareFunc caStatus postIOCompletion(caStatus completionStatusIn, gdd &valueRead) { return this->casAsyncRdIOI::postIOCompletion ( completionStatusIn, valueRead); @@ -767,7 +771,7 @@ public: // into a server // *************** // - caServer *getCAS() const + epicsShareFunc caServer *getCAS() const { return this->casAsyncRdIOI::getCAS(); } @@ -793,20 +797,20 @@ public: // // casAsyncWriteIO() // - casAsyncWriteIO(const casCtx &ctx) : + epicsShareFunc casAsyncWriteIO(const casCtx &ctx) : casAsyncWtIOI(ctx, *this) {} // // force virtual destructor // - virtual ~casAsyncWriteIO(); + epicsShareFunc virtual ~casAsyncWriteIO(); // // place notification of IO completion on the event queue // (this function does not delete the casAsyncIO object). // Only the first call to this function has any effect. // - caStatus postIOCompletion(caStatus completionStatusIn) + epicsShareFunc caStatus postIOCompletion(caStatus completionStatusIn) { return this->casAsyncWtIOI::postIOCompletion (completionStatusIn); } @@ -818,7 +822,7 @@ public: // into a server // *************** // - caServer *getCAS() const + epicsShareFunc caServer *getCAS() const { return this->casAsyncWtIOI::getCAS(); } @@ -833,20 +837,20 @@ public: // // casAsyncPVExistIO() // - casAsyncPVExistIO(const casCtx &ctx) : + epicsShareFunc casAsyncPVExistIO(const casCtx &ctx) : casAsyncExIOI(ctx, *this) {} // // force virtual destructor // - virtual ~casAsyncPVExistIO(); + epicsShareFunc virtual ~casAsyncPVExistIO(); // // place notification of IO completion on the event queue // (this function does not delete the casAsyncIO object). // Only the first call to this function has any effect. // - caStatus postIOCompletion(const pvExistReturn retValIn) + epicsShareFunc caStatus postIOCompletion(const pvExistReturn retValIn) { return this->casAsyncExIOI::postIOCompletion (retValIn); } @@ -858,7 +862,7 @@ public: // into a server // *************** // - caServer *getCAS() const + epicsShareFunc caServer *getCAS() const { return this->casAsyncExIOI::getCAS(); } @@ -873,20 +877,20 @@ public: // // casAsyncPVCreateIO() // - casAsyncPVCreateIO(const casCtx &ctx) : + epicsShareFunc casAsyncPVCreateIO(const casCtx &ctx) : casAsyncPVCIOI(ctx, *this) {} // // force virtual destructor // - virtual ~casAsyncPVCreateIO(); + epicsShareFunc virtual ~casAsyncPVCreateIO(); // // place notification of IO completion on the event queue // (this function does not delete the casAsyncIO object). // Only the first call to this function has any effect. // - caStatus postIOCompletion(const pvCreateReturn &retValIn) + epicsShareFunc caStatus postIOCompletion(const pvCreateReturn &retValIn) { return this->casAsyncPVCIOI::postIOCompletion (retValIn); } @@ -898,7 +902,7 @@ public: // into a server // *************** // - caServer *getCAS() const + epicsShareFunc caServer *getCAS() const { return this->casAsyncPVCreateIO::getCAS(); } diff --git a/src/cas/generic/server.h b/src/cas/generic/server.h index 3f0d8b73f..cc8b29cdb 100644 --- a/src/cas/generic/server.h +++ b/src/cas/generic/server.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.18 1997/06/30 22:54:30 jhill + * use %p with pointers + * * Revision 1.17 1997/06/13 09:16:06 jhill * connect proto changes * @@ -88,23 +91,39 @@ // #include +#if defined(epicsExportSharedSymbols) +#error suspect that libCom, ca, and gdd were not imported +#endif + // // EPICS +// (some of these are included from casdef.h but +// are included first here so that they are included +// once only before epicsExportSharedSymbols is defined) // #define epicsAssertAuthor "Jeff Hill johill@lanl.gov" #include "epicsAssert.h" +#include "osiTime.h" +#include "alarm.h" // EPICS alarm severity/condition +#include "errMdef.h" // EPICS error codes +#include "gdd.h" // EPICS data descriptors +#include "resourceLib.h" // // CA // #include "caCommonDef.h" #include "caerr.h" -#include "casdef.h" -#include "osiTime.h" + +#if defined(epicsExportSharedSymbols) +#error suspect that libCom, ca, and gdd were not imported +#endif // // CAS // +#define epicsExportSharedSymbols +#include "casdef.h" // sets proper def for shareLib.h defines #include "osiMutexCAS.h" // NOOP on single threaded OS void casVerifyFunc(const char *pFile, unsigned line, const char *pExp); void serverToolDebugFunc(const char *pFile, unsigned line, const char *pComment); @@ -508,82 +527,82 @@ class casClient; typedef caStatus (casClient::*pCASMsgHandler) (); class casClient : public casCoreClient { public: - casClient (caServerI &, inBuf &, outBuf &); + casClient (caServerI &, inBuf &, outBuf &); caStatus init(); //constructor does not return status - virtual ~casClient (); + virtual ~casClient (); void show(unsigned level) const; - // - // send error response to a message - // - caStatus sendErr(const caHdr *, const int reportedStatus, - const char *pFormat, ...); + // + // send error response to a message + // + caStatus sendErr(const caHdr *, const int reportedStatus, + const char *pFormat, ...); unsigned getMinorVersion() const {return this->minor_version_number;} - // - // find the channel associated with a resource id - // - inline casChannelI *resIdToChannel(const caResId &id); + // + // find the channel associated with a resource id + // + casChannelI *resIdToChannel(const caResId &id); - virtual void clientHostName (char *pBuf, - unsigned bufSize) const = 0; + virtual void clientHostName (char *pBuf, + unsigned bufSize) const = 0; protected: - unsigned minor_version_number; + unsigned minor_version_number; osiTime elapsedAtLastSend; osiTime elapsedAtLastRecv; - caStatus processMsg(); + caStatus processMsg(); - // - // - // - caStatus sendErrWithEpicsStatus(const caHdr *pMsg, - caStatus epicsStatus, caStatus clientStatus); + // + // + // + caStatus sendErrWithEpicsStatus(const caHdr *pMsg, + caStatus epicsStatus, caStatus clientStatus); - // - // logBadIdWithFileAndLineno() - // + // + // logBadIdWithFileAndLineno() + // # define logBadId(MP, DP) \ this->logBadIdWithFileAndLineno(MP, DP, __FILE__, __LINE__) - caStatus logBadIdWithFileAndLineno(const caHdr *mp, - const void *dp, const char *pFileName, + caStatus logBadIdWithFileAndLineno(const caHdr *mp, + const void *dp, const char *pFileName, const unsigned lineno); private: inBuf &inBufRef; outBuf &outBufRef; - // - // dump message to stderr - // - void dumpMsg(const caHdr *mp, const void *dp); + // + // dump message to stderr + // + void dumpMsg(const caHdr *mp, const void *dp); - // - // one function for each CA request type - // - caStatus uknownMessageAction (); - caStatus ignoreMsgAction (); - caStatus noopAction (); - virtual caStatus eventAddAction (); - virtual caStatus eventCancelAction (); - virtual caStatus readAction (); - virtual caStatus readNotifyAction (); - virtual caStatus writeAction (); - virtual caStatus searchAction (); - virtual caStatus eventsOffAction (); - virtual caStatus eventsOnAction (); - virtual caStatus readSyncAction (); - virtual caStatus clearChannelAction (); - virtual caStatus claimChannelAction (); - virtual caStatus writeNotifyAction (); - virtual caStatus clientNameAction (); - virtual caStatus hostNameAction (); - virtual caStatus echoAction (); + // + // one function for each CA request type + // + caStatus uknownMessageAction (); + caStatus ignoreMsgAction (); + caStatus noopAction (); + virtual caStatus eventAddAction (); + virtual caStatus eventCancelAction (); + virtual caStatus readAction (); + virtual caStatus readNotifyAction (); + virtual caStatus writeAction (); + virtual caStatus searchAction (); + virtual caStatus eventsOffAction (); + virtual caStatus eventsOnAction (); + virtual caStatus readSyncAction (); + virtual caStatus clearChannelAction (); + virtual caStatus claimChannelAction (); + virtual caStatus writeNotifyAction (); + virtual caStatus clientNameAction (); + virtual caStatus hostNameAction (); + virtual caStatus echoAction (); // // obtain the user name and host from the derived class @@ -591,9 +610,9 @@ private: virtual const char *hostName() const; virtual const char *userName() const; - // - // static members - // + // + // static members + // static void loadProtoJumpTable(); static pCASMsgHandler msgHandlers[CA_PROTO_LAST_CMMD+1u]; static int msgHandlersInit; @@ -607,11 +626,11 @@ private: class casStrmClient : public inBuf, public outBuf, public casClient, public tsDLNode { public: - casStrmClient (caServerI &cas); + casStrmClient (caServerI &cas); caStatus init(); //constructor does not return status - ~casStrmClient(); + ~casStrmClient(); - void show (unsigned level) const; + void show (unsigned level) const; // // installChannel() @@ -623,26 +642,26 @@ public: // void removeChannel(casChannelI &chan); - // - // one function for each CA request type that has - // asynchronous completion - // - virtual caStatus createChanResponse(const caHdr &, const pvCreateReturn &); - caStatus readResponse(casChannelI *pChan, const caHdr &msg, - gdd *pDesc, const caStatus status); - caStatus readNotifyResponse(casChannelI *pChan, const caHdr &msg, - gdd *pDesc, const caStatus status); - caStatus writeResponse(casChannelI *pChan, const caHdr &msg, - const caStatus status); - caStatus writeNotifyResponse(casChannelI *pChan, const caHdr &msg, - const caStatus status); - caStatus monitorResponse(casChannelI *pChan, const caHdr &msg, + // + // one function for each CA request type that has + // asynchronous completion + // + virtual caStatus createChanResponse(const caHdr &, const pvCreateReturn &); + caStatus readResponse(casChannelI *pChan, const caHdr &msg, gdd *pDesc, const caStatus status); + caStatus readNotifyResponse(casChannelI *pChan, const caHdr &msg, + gdd *pDesc, const caStatus status); + caStatus writeResponse(casChannelI *pChan, const caHdr &msg, + const caStatus status); + caStatus writeNotifyResponse(casChannelI *pChan, const caHdr &msg, + const caStatus status); + caStatus monitorResponse(casChannelI *pChan, const caHdr &msg, + gdd *pDesc, const caStatus status); - // - // - // - caStatus noReadAccessEvent(casClientMon *); + // + // + // + caStatus noReadAccessEvent(casClientMon *); // // obtain the user name and host @@ -654,41 +673,41 @@ public: unsigned getDebugLevel() const; private: - tsDLList chanList; - char *pUserName; - char *pHostName; + tsDLList chanList; + char *pUserName; + char *pHostName; - // - // createChannel() - // - caStatus createChannel (const char *pName); + // + // createChannel() + // + caStatus createChannel (const char *pName); - // - // verify read/write requests - // - caStatus verifyRequest (casChannelI *&pChan); + // + // verify read/write requests + // + caStatus verifyRequest (casChannelI *&pChan); - // - // one function for each CA request type - // - caStatus eventAddAction (); - caStatus eventCancelAction (); - caStatus readAction (); - caStatus readNotifyAction (); - caStatus writeAction (); - caStatus eventsOffAction (); - caStatus eventsOnAction (); - caStatus readSyncAction (); - caStatus clearChannelAction (); - caStatus claimChannelAction (); - caStatus writeNotifyAction (); - caStatus clientNameAction (); - caStatus hostNameAction (); + // + // one function for each CA request type + // + caStatus eventAddAction (); + caStatus eventCancelAction (); + caStatus readAction (); + caStatus readNotifyAction (); + caStatus writeAction (); + caStatus eventsOffAction (); + caStatus eventsOnAction (); + caStatus readSyncAction (); + caStatus clearChannelAction (); + caStatus claimChannelAction (); + caStatus writeNotifyAction (); + caStatus clientNameAction (); + caStatus hostNameAction (); - // - // accessRightsResponse() - // - caStatus accessRightsResponse (casChannelI *pciu); + // + // accessRightsResponse() + // + caStatus accessRightsResponse (casChannelI *pciu); // // these prepare the gdd based on what is in the ca hdr @@ -696,22 +715,22 @@ private: caStatus read (gdd *&pDesc); caStatus write (); - // - // channelCreateFailed() - // - caStatus channelCreateFailed (const caHdr *mp, caStatus createStatus); + // + // channelCreateFailed() + // + caStatus channelCreateFailed (const caHdr *mp, caStatus createStatus); caStatus writeArrayData(); caStatus writeScalarData(); caStatus writeString(); - // - // io independent send/recv - // - xSendStatus xSend (char *pBuf, bufSizeT nBytesAvailableToSend, - bufSizeT nBytesNeedToBeSent, bufSizeT &nBytesSent); - xRecvStatus xRecv (char *pBuf, bufSizeT nBytesToRecv, - bufSizeT &nByesRecv); + // + // io independent send/recv + // + xSendStatus xSend (char *pBuf, bufSizeT nBytesAvailableToSend, + bufSizeT nBytesNeedToBeSent, bufSizeT &nBytesSent); + xRecvStatus xRecv (char *pBuf, bufSizeT nBytesToRecv, + bufSizeT &nByesRecv); virtual xBlockingStatus blockingState() const = 0; virtual xSendStatus osdSend (const char *pBuf, bufSizeT nBytesReq, bufSizeT &nBytesActual) = 0; @@ -727,11 +746,11 @@ class casDGIntfIO; // class casDGClient : public dgInBuf, public dgOutBuf, public casClient { public: - casDGClient (caServerI &serverIn); + casDGClient (caServerI &serverIn); caStatus init(); //constructor does not return status - void show (unsigned level) const; + void show (unsigned level) const; // // only for use with DG io @@ -757,17 +776,17 @@ private: void ioBlockedSignal(); // dummy - // - // one function for each CA request type - // - caStatus searchAction (); + // + // one function for each CA request type + // + caStatus searchAction (); - // - // searchFailResponse() - // - caStatus searchFailResponse(const caHdr *pMsg); + // + // searchFailResponse() + // + caStatus searchFailResponse(const caHdr *pMsg); - caStatus searchResponse(const caHdr &, const pvExistReturn &); + caStatus searchResponse(const caHdr &, const pvExistReturn &); caStatus asyncSearchResponse( casDGIntfIO &outMsgIO, const caNetAddr &outAddr, @@ -779,7 +798,7 @@ private: // // IO depen // - xRecvStatus xDGRecv (char *pBuf, bufSizeT nBytesToRecv, + xRecvStatus xDGRecv (char *pBuf, bufSizeT nBytesToRecv, bufSizeT &nByesRecv, caNetAddr &sender); xSendStatus xDGSend (char *pBuf, bufSizeT nBytesNeedToBeSent, bufSizeT &nBytesSent, const caNetAddr &recipient); @@ -790,16 +809,16 @@ private: // casEventMaskEntry // class casEventMaskEntry : public tsSLNode, - public casEventMask, public stringId { + public casEventMask, public stringId { public: - casEventMaskEntry (casEventRegistry ®In, - casEventMask maskIn, const char *pName); - virtual ~casEventMaskEntry(); - void show (unsigned level) const; + casEventMaskEntry (casEventRegistry ®In, + casEventMask maskIn, const char *pName); + virtual ~casEventMaskEntry(); + void show (unsigned level) const; virtual void destroy(); private: - casEventRegistry ® + casEventRegistry ® }; // @@ -808,26 +827,26 @@ private: class casEventRegistry : private resTable { friend class casEventMaskEntry; public: - casEventRegistry(osiMutex &mutexIn) : + casEventRegistry(osiMutex &mutexIn) : mutex(mutexIn), allocator(0), hasBeenInitialized(0) {} int init(); - ~casEventRegistry() - { - this->destroyAllEntries(); - } + ~casEventRegistry() + { + this->destroyAllEntries(); + } + + casEventMask registerEvent (const char *pName); + + void show (unsigned level) const; - casEventMask registerEvent (const char *pName); - - void show (unsigned level) const; - private: osiMutex &mutex; - unsigned allocator; - unsigned char hasBeenInitialized; - - casEventMask maskAllocator(); + unsigned allocator; + unsigned char hasBeenInitialized; + + casEventMask maskAllocator(); }; #include "casIOD.h" // IO dependent @@ -851,31 +870,31 @@ public: caStatus init(); //constructor does not return status ~caServerI(); - // - // find the channel associated with a resource id - // - inline casChannelI *resIdToChannel(const caResId &id); + // + // find the channel associated with a resource id + // + inline casChannelI *resIdToChannel(const caResId &id); - // - // find the PV associated with a resource id - // - casPVI *resIdToPV(const caResId &id); + // + // find the PV associated with a resource id + // + casPVI *resIdToPV(const caResId &id); - // - // find the client monitor associated with a resource id - // + // + // find the client monitor associated with a resource id + // casClientMon *resIdToClientMon(const caResId &idIn); - casDGClient &castClient() {return this->dgClient;} + casDGClient &castClient() {return this->dgClient;} void installClient(casStrmClient *pClient); void removeClient(casStrmClient *pClient); - // - // is there space for a new channel - // - aitBool roomForNewChannel() const; + // + // is there space for a new channel + // + aitBool roomForNewChannel() const; // // send beacon and advance beacon timer @@ -885,7 +904,7 @@ public: unsigned getDebugLevel() const { return debugLevel; } inline void setDebugLevel(unsigned debugLevelIn); - osiTime getBeaconPeriod() const { return this->beaconPeriod; } + osiTime getBeaconPeriod() const { return this->beaconPeriod; } void show(unsigned level) const; @@ -900,7 +919,7 @@ public: // // call virtual function in the interface class // - inline caServer * operator -> (); + inline caServer * operator -> (); void connectCB(casIntfOS &); @@ -909,18 +928,18 @@ public: caStatus addAddr(const caNetAddr &addr, int autoBeaconAddr, int addConfigAddr); private: - void advanceBeaconPeriod(); + void advanceBeaconPeriod(); - casDGOS dgClient; + casDGOS dgClient; //casCtx ctx; tsDLList clientList; tsDLList intfList; - osiTime beaconPeriod; + osiTime beaconPeriod; caServer &adapter; - unsigned debugLevel; + unsigned debugLevel; - // the estimated number of proces variables default = 1024u - const unsigned pvCountEstimate; + // the estimated number of proces variables default = 1024u + const unsigned pvCountEstimate; unsigned char haveBeenInitialized; }; diff --git a/src/cas/generic/st/casDGOS.cc b/src/cas/generic/st/casDGOS.cc index 52f0e45a6..96f0a72db 100644 --- a/src/cas/generic/st/casDGOS.cc +++ b/src/cas/generic/st/casDGOS.cc @@ -6,6 +6,9 @@ * * * $Log$ + * Revision 1.3 1997/06/30 22:54:33 jhill + * use %p with pointers + * * Revision 1.2 1997/04/10 19:34:30 jhill * API changes * @@ -28,7 +31,6 @@ // CA server // #include "server.h" -#include "casClientIL.h" class casDGEvWakeup : public osiTimer { public: diff --git a/src/cas/generic/st/casOSD.h b/src/cas/generic/st/casOSD.h index e69082c8f..39ae1081e 100644 --- a/src/cas/generic/st/casOSD.h +++ b/src/cas/generic/st/casOSD.h @@ -7,6 +7,9 @@ // Some BSD calls have crept in here // // $Log$ +// Revision 1.3 1997/06/13 09:16:10 jhill +// connect proto changes +// // Revision 1.2 1997/04/10 19:34:31 jhill // API changes // @@ -27,8 +30,12 @@ #ifndef includeCASOSDH #define includeCASOSDH +#undef epicsExportSharedSymbols #include "osiTimer.h" #include "fdManager.h" +#define epicsExportSharedSymbols + +#include "shareLib.h" // redefine share lib defines class caServerI; class caServerOS; @@ -113,18 +120,18 @@ class casStreamOS : public casStreamIO { friend class casStreamEvWakeup; friend class casStreamIOWakeup; public: - casStreamOS(caServerI &, const ioArgsToNewStreamIO &ioArgs); + casStreamOS(caServerI &, const ioArgsToNewStreamIO &ioArgs); caStatus init(); ~casStreamOS(); - // - // process any incomming messages - // - casProcCond processInput(); - caStatus start(); + // + // process any incomming messages + // + casProcCond processInput(); + caStatus start(); - void recvCB(); - void sendCB(); + void recvCB(); + void sendCB(); void sendBlockSignal(); @@ -140,13 +147,13 @@ private: casStreamEvWakeup *pEvWk; casStreamIOWakeup *pIOWk; unsigned sendBlocked:1; - // - // - // - inline void armSend (); - inline void armRecv (); - inline void disarmSend(); - inline void disarmRecv(); + // + // + // + inline void armSend (); + inline void armRecv (); + inline void disarmSend(); + inline void disarmRecv(); }; class casDGEvWakeup; @@ -157,13 +164,13 @@ class casDGEvWakeup; class casDGOS : public casDGIO { friend class casDGEvWakeup; public: - casDGOS(caServerI &cas); + casDGOS(caServerI &cas); ~casDGOS(); - // - // process any incomming messages - // - casProcCond processInput(); + // + // process any incomming messages + // + casProcCond processInput(); void sendBlockSignal() {} @@ -172,7 +179,7 @@ public: void show(unsigned level) const; - caStatus start(); + caStatus start(); private: casDGEvWakeup *pEvWk; }; diff --git a/src/cas/generic/st/casStreamOS.cc b/src/cas/generic/st/casStreamOS.cc index 19e4ce1a3..1002bf4d0 100644 --- a/src/cas/generic/st/casStreamOS.cc +++ b/src/cas/generic/st/casStreamOS.cc @@ -4,6 +4,9 @@ // // // $Log$ +// Revision 1.6 1997/06/30 22:54:34 jhill +// use %p with pointers +// // Revision 1.5 1997/04/10 19:34:32 jhill // API changes // @@ -33,7 +36,6 @@ // CA server // #include "server.h" -#include "casClientIL.h" // casClient inline func #include "inBufIL.h" // inBuf inline func #include "outBufIL.h" // outBuf inline func diff --git a/src/cas/io/bsdSocket/caServerIO.cc b/src/cas/io/bsdSocket/caServerIO.cc index 6c34ba17f..44065b03f 100644 --- a/src/cas/io/bsdSocket/caServerIO.cc +++ b/src/cas/io/bsdSocket/caServerIO.cc @@ -5,6 +5,9 @@ // // // $Log$ +// Revision 1.6 1997/06/30 23:40:48 jhill +// use %p for pointers +// // Revision 1.5 1997/06/13 09:16:12 jhill // connect proto changes // @@ -44,13 +47,13 @@ caServerIO::~caServerIO() // inline void caServerIO::staticInit() { - if (caServerIO::staticInitialized) { - return; - } - + if (caServerIO::staticInitialized) { + return; + } + installSigPipeIgnore(); - caServerIO::staticInitialized = TRUE; + caServerIO::staticInitialized = TRUE; } @@ -69,12 +72,12 @@ caStatus caServerIO::init(caServerI &cas) caServerIO::staticInit(); - // - // first try for the server's private port number env var. - // If this available use the CA server port number (used by - // clients to find the server). If this also isnt available - // then use a hard coded default - CA_SERVER_PORT. - // + // + // first try for the server's private port number env var. + // If this available use the CA server port number (used by + // clients to find the server). If this also isnt available + // then use a hard coded default - CA_SERVER_PORT. + // if (envGetConfigParamPtr(&EPICS_CAS_SERVER_PORT)) { port = caFetchPortConfig(&EPICS_CAS_SERVER_PORT, CA_SERVER_PORT); } diff --git a/src/cas/io/bsdSocket/casDGIntfIO.cc b/src/cas/io/bsdSocket/casDGIntfIO.cc index 931342ef9..5ef547567 100644 --- a/src/cas/io/bsdSocket/casDGIntfIO.cc +++ b/src/cas/io/bsdSocket/casDGIntfIO.cc @@ -59,11 +59,11 @@ caStatus casDGIntfIO::init(const caNetAddr &addr, unsigned connectWithThisPortIn int autoBeaconAddr, int addConfigBeaconAddr, int useBroadcastAddr, casDGIntfIO *pAltOutIn) { - int yes = TRUE; - struct sockaddr_in serverAddr; - int status; - aitInt16 beaconPort; - ELLLIST BCastAddrList; + int yes = TRUE; + struct sockaddr_in serverAddr; + int status; + unsigned short beaconPort; + ELLLIST BCastAddrList; if (pAltOutIn) { this->pAltOutIO = pAltOutIn; diff --git a/src/cas/io/bsdSocket/casIOD.h b/src/cas/io/bsdSocket/casIOD.h index 1c6be9794..1efa72e5b 100644 --- a/src/cas/io/bsdSocket/casIOD.h +++ b/src/cas/io/bsdSocket/casIOD.h @@ -7,6 +7,9 @@ // Some BSD calls have crept in here // // $Log$ +// Revision 1.8 1997/06/13 09:16:14 jhill +// connect proto changes +// // Revision 1.7 1997/01/10 21:18:55 jhill // code around gnu g++ inline bug when -O isnt used // @@ -33,7 +36,9 @@ #ifndef includeCASIODH #define includeCASIODH +#undef epicsExportSharedSymbols #include "envDefs.h" +#define epicsExportSharedSymbols void hostNameFromIPAddr (const caNetAddr *pAddr, char *pBuf, unsigned bufSize); @@ -76,13 +81,13 @@ public: void processDG(); private: - ELLLIST beaconAddrList; - casDGIntfIO *pAltOutIO; - casDGClient &client; - SOCKET sock; - casIOState sockState; - aitInt16 connectWithThisPort; - aitInt16 dgPort; + ELLLIST beaconAddrList; + casDGIntfIO *pAltOutIO; + casDGClient &client; + SOCKET sock; + casIOState sockState; + unsigned short connectWithThisPort; + unsigned short dgPort; }; struct ioArgsToNewStreamIO { @@ -143,10 +148,10 @@ public: return caNetAddr(this->addr); } private: - casIOState sockState; - SOCKET sock; - struct sockaddr_in addr; - xBlockingStatus blockingFlag; + casIOState sockState; + SOCKET sock; + struct sockaddr_in addr; + xBlockingStatus blockingFlag; }; class caServerIO; @@ -166,17 +171,17 @@ public: virtual ~casIntfIO(); void show(unsigned level) const; - unsigned portNumber() const; + unsigned portNumber() const; - int getFD() const; + int getFD() const; - void setNonBlocking(); + void setNonBlocking(); - // - // called when we expect that a virtual circuit for a - // client can be created - // - casStreamOS *newStreamClient(caServerI &cas) const; + // + // called when we expect that a virtual circuit for a + // client can be created + // + casStreamOS *newStreamClient(caServerI &cas) const; virtual casDGIntfIO *newDGIntfIO (casDGClient &dgClientIn) const = 0; @@ -185,7 +190,7 @@ private: casDGIntfIO *pNormalUDP; // attached to this intf's addr casDGIntfIO *pBCastUDP; // attached to this intf's broadcast addr SOCKET sock; - struct sockaddr_in addr; + struct sockaddr_in addr; }; // @@ -193,24 +198,24 @@ private: // class caServerIO { public: - caStatus init(caServerI &cas); //constructor does not return status + caStatus init(caServerI &cas); //constructor does not return status ~caServerIO(); - - // - // show status of IO subsystem - // - void show (unsigned level) const; - + + // + // show status of IO subsystem + // + void show (unsigned level) const; + private: - // - // static member data - // - static int staticInitialized; - // - // static member func - // - static inline void staticInit(); + // + // static member data + // + static int staticInitialized; + // + // static member func + // + static inline void staticInit(); }; diff --git a/src/cas/os/vxWorks/casDGOS.cc b/src/cas/os/vxWorks/casDGOS.cc index 79b05ee30..fa3eeb0de 100644 --- a/src/cas/os/vxWorks/casDGOS.cc +++ b/src/cas/os/vxWorks/casDGOS.cc @@ -6,6 +6,9 @@ * * * $Log$ + * Revision 1.3 1997/06/30 23:38:46 jhill + * use %p for pointers + * * Revision 1.2 1996/09/16 18:27:09 jhill * vxWorks port changes * @@ -24,7 +27,6 @@ #include // vxWorks #include -#include // casClient inline func #include // EPICS task priorities // diff --git a/src/cas/os/vxWorks/casOSD.h b/src/cas/os/vxWorks/casOSD.h index dd27dd30d..873f0afa7 100644 --- a/src/cas/os/vxWorks/casOSD.h +++ b/src/cas/os/vxWorks/casOSD.h @@ -7,6 +7,9 @@ // Some BSD calls have crept in here // // $Log$ +// Revision 1.4 1997/06/13 09:16:17 jhill +// connect proto changes +// // Revision 1.3 1996/11/02 00:55:00 jhill // many improvements // @@ -24,9 +27,8 @@ #ifndef includeCASOSDH #define includeCASOSDH - -#include -#include +#include "osiMutex.h" +#include "osiTimer.h" class caServerI; diff --git a/src/cas/os/vxWorks/casStreamOS.cc b/src/cas/os/vxWorks/casStreamOS.cc index a7f2f9b54..f02be0339 100644 --- a/src/cas/os/vxWorks/casStreamOS.cc +++ b/src/cas/os/vxWorks/casStreamOS.cc @@ -4,6 +4,9 @@ // // // $Log$ +// Revision 1.4 1997/06/30 23:38:47 jhill +// use %p for pointers +// // Revision 1.3 1996/11/02 00:55:01 jhill // many improvements // @@ -23,7 +26,6 @@ // CA server // #include -#include // casClient inline func #include // EPICS task priorities