installed

This commit is contained in:
Jeff Hill
2003-02-12 19:11:43 +00:00
parent 644e6eb273
commit 96f1ac2d63
32 changed files with 2386 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef caHdrLargeArrayh
#define caHdrLargeArrayh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_caHdrLargeArrayh
# undef epicsExportSharedSymbols
#endif
// external headers included here
#include "caProto.h"
#ifdef epicsExportSharedSymbols_caHdrLargeArrayh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
static const unsigned char CA_MINOR_PROTOCOL_REVISION = 11;
typedef ca_uint32_t caResId;
/* a modified ca header with capacity for large arrays */
struct caHdrLargeArray {
ca_uint32_t m_postsize; /* size of message extension */
ca_uint32_t m_count; /* operation data count */
ca_uint32_t m_cid; /* channel identifier */
ca_uint32_t m_available; /* protocol stub dependent */
ca_uint16_t m_dataType; /* operation data type */
ca_uint16_t m_cmmd; /* operation to be performed */
};
#endif // caHdrLargeArrayh
+37
View File
@@ -0,0 +1,37 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef caServerDefsh
#define caServerDefsh
#ifndef NULL
# define NULL 0
#endif
#ifndef NELEMENTS
# define NELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
#endif
#define invalidResID ( static_cast < ca_uint32_t > ( ~0UL ) )
void casVerifyFunc ( const char * pFile,
unsigned line, const char * pExp );
void serverToolDebugFunc ( const char * pFile,
unsigned line, const char * pComment );
#define serverToolDebug(COMMENT) \
{ serverToolDebugFunc(__FILE__, __LINE__, COMMENT); }
#define casVerify(EXP) \
{ if ((EXP)==0) casVerifyFunc(__FILE__, __LINE__, #EXP); }
bool convertContainerMemberToAtomic ( class gdd & dd,
aitUint32 appType, aitUint32 elemCount );
#endif // caServerDefsh
+130
View File
@@ -0,0 +1,130 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef caServerIh
#define caServerIh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_caServerIh
# undef epicsExportSharedSymbols
#endif
// external headers included here
#include "tsFreeList.h"
#include "caProto.h"
#ifdef epicsExportSharedSymbols_caServerIh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "clientBufMemoryManager.h"
#include "casEventRegistry.h"
#include "caServerIO.h"
#include "ioBlocked.h"
#include "caServerDefs.h"
class beaconTimer;
class beaconAnomalyGovernor;
class casIntfOS;
class casMonitor;
class caServerI :
public caServerIO,
public ioBlockedList,
public casEventRegistry {
public:
caServerI ( caServer &tool );
~caServerI ();
bool roomForNewChannel() const;
unsigned getDebugLevel() const { return debugLevel; }
inline void setDebugLevel ( unsigned debugLevelIn );
void show ( unsigned level ) const;
void destroyMonitor ( casMonitor & );
caServer * getAdapter ();
caServer * operator -> ();
void connectCB ( casIntfOS & );
casEventMask valueEventMask () const; // DBE_VALUE registerEvent("value")
casEventMask logEventMask () const; // DBE_LOG registerEvent("log")
casEventMask alarmEventMask () const; // DBE_ALARM registerEvent("alarm")
unsigned subscriptionEventsProcessed () const;
void incrEventsProcessedCounter ();
unsigned subscriptionEventsPosted () const;
void updateEventsPostedCounter ( unsigned nNewPosts );
void generateBeaconAnomaly ();
casMonitor & casMonitorFactory ( casChannelI &,
caResId clientId, const unsigned long count,
const unsigned type, const casEventMask &,
class casMonitorCallbackInterface & );
void casMonitorDestroy ( casMonitor & );
void destroyClient ( casStrmClient & );
private:
clientBufMemoryManager clientBufMemMgr;
tsFreeList < casMonitor, 1024 > casMonitorFreeList;
tsDLList < casStrmClient > clientList;
tsDLList < casIntfOS > intfList;
mutable epicsMutex mutex;
mutable epicsMutex diagnosticCountersMutex;
caServer & adapter;
beaconTimer & beaconTmr;
beaconAnomalyGovernor & beaconAnomalyGov;
unsigned debugLevel;
unsigned nEventsProcessed;
unsigned nEventsPosted;
casEventMask valueEvent; // DBE_VALUE registerEvent("value")
casEventMask logEvent; // DBE_LOG registerEvent("log")
casEventMask alarmEvent; // DBE_ALARM registerEvent("alarm")
caStatus attachInterface (const caNetAddr &addr, bool autoBeaconAddr,
bool addConfigAddr);
void sendBeacon ( ca_uint32_t beaconNo );
caServerI ( const caServerI & );
caServerI & operator = ( const caServerI & );
friend class beaconAnomalyGovernor;
friend class beaconTimer;
};
inline caServer * caServerI::getAdapter()
{
return & this->adapter;
}
inline caServer * caServerI::operator -> ()
{
return this->getAdapter();
}
inline void caServerI::setDebugLevel(unsigned debugLevelIn)
{
this->debugLevel = debugLevelIn;
}
inline casEventMask caServerI::valueEventMask() const
{
return this->valueEvent;
}
inline casEventMask caServerI::logEventMask() const
{
return this->logEvent;
}
inline casEventMask caServerI::alarmEventMask() const
{
return this->alarmEvent;
}
#endif // caServerIh
+67
View File
@@ -0,0 +1,67 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casAsyncIOIh
#define casAsyncIOIh
#include "casEvent.h"
#include "caHdrLargeArray.h"
#include "casCoreClient.h"
class epicsMutex;
template < class MUTEX > class epicsGuard;
class casAsyncIOI :
public tsDLNode < casAsyncIOI >,
public casEvent {
public:
casAsyncIOI ( const casCtx & ctx );
epicsShareFunc virtual ~casAsyncIOI ();
caServer * getCAS () const;
virtual bool oneShotReadOP () const;
void removeFromEventQueue ();
protected:
caStatus insertEventQueue ();
casCoreClient & client;
private:
bool inTheEventQueue;
bool posted;
bool ioComplete;
//
// casEvent virtual call back function
// (called when IO completion event reaches top of event queue)
//
epicsShareFunc caStatus cbFunc ( casCoreClient &, epicsGuard < epicsMutex > & );
//
// derived class specific call back
// (called when IO completion event reaches top of event queue)
//
epicsShareFunc virtual caStatus cbFuncAsyncIO () = 0;
casAsyncIOI ( const casAsyncIOI & );
casAsyncIOI & operator = ( const casAsyncIOI & );
};
inline void casAsyncIOI::removeFromEventQueue ()
{
this->client.removeFromEventQueue ( *this, this->inTheEventQueue );
}
#endif // casAsyncIOIh
+59
View File
@@ -0,0 +1,59 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#define epicsExportSharedSymbols
#include "casAsyncPVAttachIOI.h"
casAsyncPVAttachIOI::casAsyncPVAttachIOI (
casAsyncPVAttachIO & intf, const casCtx & ctx ) :
casAsyncIOI ( ctx ), msg ( *ctx.getMsg() ),
asyncPVAttachIO ( intf ), retVal ( S_cas_badParameter )
{
ctx.getClient()->installAsynchIO ( *this );
}
caStatus casAsyncPVAttachIOI::postIOCompletion ( const pvAttachReturn & retValIn )
{
this->retVal = retValIn;
return this->insertEventQueue ();
}
caStatus casAsyncPVAttachIOI::cbFuncAsyncIO ()
{
caStatus status;
switch ( this->msg.m_cmmd ) {
case CA_PROTO_CLAIM_CIU:
status = this->client.createChanResponse ( this->msg, this->retVal );
if ( status == S_cas_sendBlocked ) {
return status;
}
break;
default:
errPrintf ( S_cas_invalidAsynchIO, __FILE__, __LINE__,
" - client request type = %u", this->msg.m_cmmd );
status = S_cas_invalidAsynchIO;
break;
}
this->client.uninstallAsynchIO ( *this );
return status;
}
+45
View File
@@ -0,0 +1,45 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casAsyncPVAttachIOIh
#define casAsyncPVAttachIOIh
#include "casAsyncIOI.h"
class casAsyncPVAttachIOI : public casAsyncIOI {
public:
casAsyncPVAttachIOI ( casAsyncPVAttachIO &, const casCtx & ctx );
~casAsyncPVAttachIOI ();
caStatus postIOCompletion ( const pvAttachReturn & retValIn );
caServer *getCAS () const;
private:
caHdrLargeArray const msg;
class casAsyncPVAttachIO & asyncPVAttachIO;
pvAttachReturn retVal;
caStatus cbFuncAsyncIO ();
casAsyncPVAttachIOI ( const casAsyncPVAttachIOI & );
casAsyncPVAttachIOI & operator = ( const casAsyncPVAttachIOI & );
};
inline casAsyncPVAttachIOI::~casAsyncPVAttachIOI ()
{
this->asyncPVAttachIO.serverInitiatedDestroy ();
}
#endif // casAsyncPVAttachIOIh
+69
View File
@@ -0,0 +1,69 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#define epicsExportSharedSymbols
#include "casAsyncPVExistIOI.h"
casAsyncPVExistIOI::casAsyncPVExistIOI (
casAsyncPVExistIO & intf, const casCtx & ctx ) :
casAsyncIOI ( ctx ),
msg ( *ctx.getMsg() ),
asyncPVExistIO ( intf ),
retVal ( pverDoesNotExistHere ),
dgOutAddr ( ctx.getClient()->fetchLastRecvAddr () ),
protocolRevision ( ctx.getClient()->protocolRevision () ),
sequenceNumber ( ctx.getClient()->datagramSequenceNumber () )
{
ctx.getClient()->installAsynchIO ( *this );
}
caStatus casAsyncPVExistIOI::postIOCompletion (
const pvExistReturn & retValIn )
{
this->retVal = retValIn;
return this->insertEventQueue ();
}
caStatus casAsyncPVExistIOI::cbFuncAsyncIO ()
{
caStatus status;
if ( this->msg.m_cmmd == CA_PROTO_SEARCH ) {
//
// pass output DG address parameters
//
status = this->client.asyncSearchResponse (
this->dgOutAddr, this->msg, this->retVal,
this->protocolRevision, this->sequenceNumber );
if ( status == S_cas_sendBlocked ) {
return status;
}
}
else {
errPrintf ( S_cas_invalidAsynchIO, __FILE__, __LINE__,
" - client request type = %u", this->msg.m_cmmd );
status = S_cas_invalidAsynchIO;
}
if ( status != S_cas_sendBlocked ) {
this->client.uninstallAsynchIO ( *this );
}
return status;
}
+48
View File
@@ -0,0 +1,48 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casAsyncPVExistIOIh
#define casAsyncPVExistIOIh
#include "casAsyncIOI.h"
class casAsyncPVExistIOI : public casAsyncIOI {
public:
casAsyncPVExistIOI ( casAsyncPVExistIO &, const casCtx & ctx );
~casAsyncPVExistIOI ();
caStatus postIOCompletion ( const pvExistReturn & retValIn );
caServer * getCAS() const;
private:
caHdrLargeArray const msg;
class casAsyncPVExistIO & asyncPVExistIO;
pvExistReturn retVal;
const caNetAddr dgOutAddr;
const ca_uint16_t protocolRevision;
const ca_uint32_t sequenceNumber;
caStatus cbFuncAsyncIO ();
casAsyncPVExistIOI ( const casAsyncPVExistIOI & );
casAsyncPVExistIOI & operator = ( const casAsyncPVExistIOI & );
};
inline casAsyncPVExistIOI::~casAsyncPVExistIOI ()
{
this->asyncPVExistIO.serverInitiatedDestroy ();
}
#endif // casAsyncPVExistIOIh
+118
View File
@@ -0,0 +1,118 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#define epicsExportSharedSymbols
#include "casAsyncReadIOI.h"
#include "casChannelI.h"
casAsyncReadIOI::casAsyncReadIOI (
casAsyncReadIO & intf, const casCtx & ctx ) :
casAsyncIOI ( ctx ), msg ( *ctx.getMsg() ),
asyncReadIO ( intf ), chan ( *ctx.getChannel () ),
pDD ( NULL ), completionStatus ( S_cas_internal ),
createChannelWasSuccessful ( false )
{
this->chan.installIO ( *this );
}
casAsyncReadIOI::~casAsyncReadIOI ()
{
this->asyncReadIO.serverInitiatedDestroy ();
if ( this->msg.m_cmmd == CA_PROTO_CLAIM_CIU &&
! this->createChannelWasSuccessful ) {
delete & this->chan;
}
}
caStatus casAsyncReadIOI::postIOCompletion (
caStatus completionStatusIn, const gdd & valueRead )
{
this->pDD = & valueRead;
this->completionStatus = completionStatusIn;
return this->insertEventQueue ();
}
bool casAsyncReadIOI::oneShotReadOP () const
{
return true; // it is a read op
}
caStatus casAsyncReadIOI::cbFuncAsyncIO ()
{
caStatus status;
switch ( this->msg.m_cmmd ) {
case CA_PROTO_READ:
status = client.readResponse ( &this->chan, this->msg,
*this->pDD, this->completionStatus);
break;
case CA_PROTO_READ_NOTIFY:
status = client.readNotifyResponse ( &this->chan,
this->msg, this->pDD,
this->completionStatus);
break;
case CA_PROTO_EVENT_ADD:
status = client.monitorResponse ( this->chan,
this->msg, this->pDD,
this->completionStatus);
break;
case CA_PROTO_CLAIM_CIU:
unsigned nativeTypeDBR;
status = this->chan.getPVI().bestDBRType ( nativeTypeDBR );
if ( status ) {
errMessage ( status, "best external dbr type fetch failed" );
status = client.channelCreateFailedResp ( this->msg, status );
if ( status != S_cas_sendBlocked ) {
delete & this->chan;
}
}
else {
// we end up here if the channel claim protocol response is delayed
// by an asynchronous enum string table fetch response
if ( this->completionStatus == S_cas_success && this->pDD.valid() ) {
this->chan.getPVI().updateEnumStringTableAsyncCompletion ( *this->pDD );
}
else {
errMessage ( this->completionStatus,
"unable to read application type \"enums\" string"
" conversion table for enumerated PV" );
}
status = client.enumPostponedCreateChanResponse ( this->chan,
this->msg, nativeTypeDBR );
this->createChannelWasSuccessful =
( status == S_cas_success );
}
break;
default:
errPrintf ( S_cas_invalidAsynchIO, __FILE__, __LINE__,
" - client request type = %u", this->msg.m_cmmd );
status = S_cas_invalidAsynchIO;
break;
}
if ( status != S_cas_sendBlocked ) {
this->chan.uninstallIO ( *this );
}
return status;
}
+47
View File
@@ -0,0 +1,47 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casAsyncReadIOIh
#define casAsyncReadIOIh
#include "casAsyncIOI.h"
#include "casdef.h"
class gdd;
class casAsyncReadIOI : public casAsyncIOI {
public:
casAsyncReadIOI ( casAsyncReadIO &, const casCtx & ctx );
~casAsyncReadIOI ();
caStatus postIOCompletion (
caStatus completionStatusIn, const gdd &valueRead );
caServer *getCAS () const;
private:
caHdrLargeArray const msg;
class casAsyncReadIO & asyncReadIO;
class casChannelI & chan;
smartConstGDDPointer pDD;
caStatus completionStatus;
bool createChannelWasSuccessful;
epicsShareFunc bool oneShotReadOP () const;
epicsShareFunc caStatus cbFuncAsyncIO ();
casAsyncReadIOI ( const casAsyncReadIOI & );
casAsyncReadIOI & operator = ( const casAsyncReadIOI & );
};
#endif // casAsyncReadIOIh
+69
View File
@@ -0,0 +1,69 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#define epicsExportSharedSymbols
#include "casAsyncWriteIOI.h"
#include "casChannelI.h"
casAsyncWriteIOI::casAsyncWriteIOI (
casAsyncWriteIO & intf, const casCtx & ctx ) :
casAsyncIOI ( ctx ),
msg ( *ctx.getMsg() ),
asyncWriteIO ( intf ),
chan ( *ctx.getChannel() ),
completionStatus ( S_cas_internal )
{
this->chan.installIO ( *this );
}
caStatus casAsyncWriteIOI::postIOCompletion ( caStatus completionStatusIn )
{
this->completionStatus = completionStatusIn;
return this->insertEventQueue ();
}
caStatus casAsyncWriteIOI::cbFuncAsyncIO ()
{
caStatus status;
switch ( this->msg.m_cmmd ) {
case CA_PROTO_WRITE:
status = client.writeResponse ( this->chan,
this->msg, this->completionStatus );
break;
case CA_PROTO_WRITE_NOTIFY:
status = client.writeNotifyResponse ( this->chan,
this->msg, this->completionStatus );
break;
default:
errPrintf ( S_cas_invalidAsynchIO, __FILE__, __LINE__,
" - client request type = %u", this->msg.m_cmmd );
status = S_cas_invalidAsynchIO;
break;
}
if ( status != S_cas_sendBlocked ) {
this->chan.uninstallIO ( *this );
}
return status;
}
+45
View File
@@ -0,0 +1,45 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casAsyncWriteIOIh
#define casAsyncWriteIOIh
#include "casAsyncIOI.h"
class casAsyncWriteIOI : public casAsyncIOI {
public:
casAsyncWriteIOI ( casAsyncWriteIO &, const casCtx & ctx );
virtual ~casAsyncWriteIOI ();
caStatus postIOCompletion ( caStatus completionStatusIn );
caServer * getCAS () const;
private:
caHdrLargeArray const msg;
class casAsyncWriteIO & asyncWriteIO;
class casChannelI & chan;
caStatus completionStatus;
caStatus cbFuncAsyncIO ();
casAsyncWriteIOI ( const casAsyncWriteIOI & );
casAsyncWriteIOI & operator = ( const casAsyncWriteIOI & );
};
inline casAsyncWriteIOI::~casAsyncWriteIOI ()
{
this->asyncWriteIO.serverInitiatedDestroy ();
}
#endif // casAsyncWriteIOIh
+143
View File
@@ -0,0 +1,143 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casChannelIh
#define casChannelIh
#include "casPVI.h"
#include "casEvent.h"
#include "chanIntfForPV.h"
#include "casCoreClient.h"
class casMonitor;
class casAsyncIOI;
class casChannelI : public tsDLNode < casChannelI >,
public chronIntIdRes < casChannelI >, public casEvent {
public:
casChannelI ( casChannel & chan, const casCtx & ctx );
epicsShareFunc virtual ~casChannelI ();
const caResId getCID ();
const caResId getSID ();
void uninstallFromPV ( casEventSys & eventSys );
void installIntoPV ();
void installMonitor ( casMonitor & mon );
casMonitor * removeMonitor ( ca_uint32_t monId );
void installIO ( casAsyncIOI & );
void uninstallIO ( casAsyncIOI & );
casPVI & getPVI () const;
void clearOutstandingReads ();
void postAccessRightsEvent ();
const gddEnumStringTable & enumStringTable () const;
void setOwner ( const char * const pUserName,
const char * const pHostName );
bool readAccess () const;
bool writeAccess () const;
bool confirmationRequested () const;
void show ( unsigned level ) const;
private:
tsDLList < casAsyncIOI > ioList;
chanIntfForPV chanForPV;
casPVI & pv;
casChannel & chan;
caResId cid; // client id
bool accessRightsEvPending;
epicsShareFunc virtual void destroy ();
epicsShareFunc caStatus cbFunc (
casCoreClient &, epicsGuard < epicsMutex > & guard );
casChannelI ( const casChannelI & );
casChannelI & operator = ( const casChannelI & );
};
inline casPVI & casChannelI::getPVI () const
{
return this->pv;
}
inline const caResId casChannelI::getCID ()
{
return this->cid;
}
inline const caResId casChannelI::getSID ()
{
return this->chronIntIdRes < casChannelI >::getId ();
}
inline void casChannelI::postAccessRightsEvent ()
{
this->chanForPV.client().addToEventQueue ( *this, this->accessRightsEvPending );
}
inline const gddEnumStringTable & casChannelI::enumStringTable () const
{
return this->pv.enumStringTable ();
}
inline void casChannelI::installIntoPV ()
{
this->pv.installChannel ( this->chanForPV );
}
inline void casChannelI::installMonitor ( casMonitor & mon )
{
this->chanForPV.installMonitor ( this->pv, mon );
}
inline void casChannelI::clearOutstandingReads ()
{
this->pv.clearOutstandingReads ( this->ioList );
}
inline void casChannelI::setOwner ( const char * const pUserName,
const char * const pHostName )
{
this->chan.setOwner ( pUserName, pHostName );
}
inline bool casChannelI::readAccess () const
{
return this->chan.readAccess ();
}
inline bool casChannelI::writeAccess () const
{
return this->chan.writeAccess ();
}
inline bool casChannelI::confirmationRequested () const
{
return this->chan.confirmationRequested ();
}
inline casMonitor * casChannelI::removeMonitor ( ca_uint32_t clientIdIn )
{
return this->chanForPV.removeMonitor ( this->pv, clientIdIn );
}
inline void casChannelI::installIO ( casAsyncIOI & io )
{
this->pv.installIO ( this->ioList, io );
}
inline void casChannelI::uninstallIO ( casAsyncIOI & io )
{
this->pv.uninstallIO ( this->ioList, io );
}
#endif // casChannelIh
+106
View File
@@ -0,0 +1,106 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casCtxh
#define casCtxh
#include "caHdrLargeArray.h"
class casCtx {
public:
casCtx();
const caHdrLargeArray * getMsg () const;
void * getData () const;
class caServerI * getServer () const;
class casCoreClient * getClient () const;
class casPVI * getPV () const;
class casChannelI * getChannel () const;
void setMsg ( const caHdrLargeArray &, void * pBody );
void setServer ( class caServerI * p );
void setClient ( class casCoreClient * p );
void setPV ( class casPVI * p );
void setChannel ( class casChannelI * p );
void show ( unsigned level ) const;
private:
caHdrLargeArray msg; // ca message header
void * pData; // pointer to data following header
caServerI * pCAS;
casCoreClient * pClient;
casChannelI * pChannel;
casPVI * pPV;
unsigned nAsyncIO; // checks for improper use of async io
};
inline const caHdrLargeArray * casCtx::getMsg() const
{
return & this->msg;
}
inline void * casCtx::getData() const
{
return this->pData;
}
inline caServerI * casCtx::getServer() const
{
return this->pCAS;
}
inline casCoreClient * casCtx::getClient() const
{
return this->pClient;
}
inline casPVI * casCtx::getPV() const
{
return this->pPV;
}
inline casChannelI * casCtx::getChannel() const
{
return this->pChannel;
}
inline void casCtx::setMsg ( const caHdrLargeArray & msgIn, void * pBody )
{
this->msg = msgIn;
this->pData = pBody;
}
inline void casCtx::setServer(caServerI *p)
{
this->pCAS = p;
}
inline void casCtx::setClient(casCoreClient *p)
{
this->pClient = p;
}
inline void casCtx::setPV(casPVI *p)
{
this->pPV = p;
}
inline void casCtx::setChannel(casChannelI *p)
{
this->pChannel = p;
}
#endif // casCtxh
+50
View File
@@ -0,0 +1,50 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casEventh
#define casEventh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_casEventh
# undef epicsExportSharedSymbols
#endif
// external headers included here
#include "tsDLList.h"
#ifdef epicsExportSharedSymbols_casEventh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "casdef.h"
class casCoreClient;
class epicsMutex;
template < class MUTEX > class epicsGuard;
class casEvent : public tsDLNode < casEvent > {
public:
virtual caStatus cbFunc ( casCoreClient &, epicsGuard < epicsMutex > & ) = 0;
protected:
epicsShareFunc virtual ~casEvent();
};
#endif // casEventh
+69
View File
@@ -0,0 +1,69 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casEventRegistryh
#define casEventRegistryh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_casEventRegistryh
# undef epicsExportSharedSymbols
#endif
#include "tsSLList.h"
#ifdef epicsExportSharedSymbols_casEventRegistryh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "casEventMask.h"
class casEventMaskEntry : public tsSLNode < casEventMaskEntry >,
public casEventMask, public stringId {
public:
casEventMaskEntry (casEventRegistry &regIn,
casEventMask maskIn, const char *pName);
virtual ~casEventMaskEntry();
void show (unsigned level) const;
virtual void destroy();
private:
casEventRegistry &reg;
casEventMaskEntry ( const casEventMaskEntry & );
casEventMaskEntry & operator = ( const casEventMaskEntry & );
};
class casEventRegistry :
private resTable < casEventMaskEntry, stringId > {
friend class casEventMaskEntry;
public:
casEventRegistry () : maskBitAllocator ( 0 ) {}
virtual ~casEventRegistry();
casEventMask registerEvent ( const char * pName );
void show ( unsigned level ) const;
private:
unsigned maskBitAllocator;
casEventMask maskAllocator();
casEventRegistry ( const casEventRegistry & );
casEventRegistry & operator = ( const casEventRegistry & );
};
#endif // casEventRegistryh
+150
View File
@@ -0,0 +1,150 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casEventSysh
#define casEventSysh
#if defined ( epicsExportSharedSymbols )
# undef epicsExportSharedSymbols
# define casEventSysh_restore_epicsExportSharedSymbols
#endif
#include "tsDLList.h"
#include "tsFreeList.h"
#include "epicsMutex.h"
#if defined ( casEventSysh_restore_epicsExportSharedSymbols )
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "casdef.h"
#include "casEvent.h"
/*
* maximum peak log entries for each event block (registartion)
* (events cached into the last queue entry if over flow occurs)
* (if this exceeds 256 then the casMonitor::nPend must
* be assigned a new data type)
*/
#define individualEventEntries 16u
/*
* maximum average log entries for each event block (registartion)
* (events cached into the last queue entry if over flow occurs)
* (if this exceeds 256 then the casMonitor::nPend must
* be assigned a new data type)
*/
#define averageEventEntries 4u
enum casProcCond { casProcOk, casProcDisconnect };
class casMonitor;
class casMonEvent;
class casCoreClient;
class casEventSys {
public:
casEventSys ( casCoreClient & );
~casEventSys ();
void show ( unsigned level ) const;
struct processStatus {
casProcCond cond;
unsigned nAccepted;
};
processStatus process ();
void installMonitor ();
void removeMonitor ();
void prepareMonitorForDestroy ( casMonitor & mon );
bool postEvent ( tsDLList < casMonitor > & monitorList,
const casEventMask & select, const gdd & event );
void removeFromEventQueue ( casMonEvent & );
void addToEventQueue ( casMonEvent & );
caStatus addToEventQueue ( class casAsyncIOI &,
bool & onTheQueue, bool & posted, bool & signalNeeded );
void removeFromEventQueue ( class casAsyncIOI &,
bool & onTheEventQueue );
bool addToEventQueue (
casChannelI &, bool & inTheEventQueue );
bool getNDuplicateEvents () const;
void setDestroyPending ();
void eventsOn ();
bool eventsOff ();
void casMonEventDestroy (
casMonEvent &, epicsGuard < epicsMutex > & );
private:
mutable epicsMutex mutex;
tsDLList < casEvent > eventLogQue;
tsFreeList < casMonEvent, 1024, epicsMutexNOOP > casMonEventFreeList;
casCoreClient & client;
class casEventPurgeEv * pPurgeEvent; // flow control purge complete event
unsigned numSubscriptions; // N subscriptions installed
unsigned maxLogEntries; // max log entries
bool destroyPending;
bool replaceEvents; // replace last existing event on queue
bool dontProcess; // flow ctl is on - dont process event queue
bool full () const;
casEventSys ( const casEventSys & );
casEventSys & operator = ( const casEventSys & );
friend class casEventPurgeEv;
};
/*
* when this event reaches the top of the queue we
* know that all duplicate events have been purged
* and that now no events should not be sent to the
* client until it exits flow control mode
*/
class casEventPurgeEv : public casEvent {
public:
casEventPurgeEv ( class casEventSys & );
private:
casEventSys & evSys;
caStatus cbFunc (
casCoreClient &, epicsGuard < epicsMutex > & guard );
};
//
// casEventSys::casEventSys ()
//
inline casEventSys::casEventSys ( casCoreClient & clientIn ) :
client ( clientIn ),
pPurgeEvent ( NULL ),
numSubscriptions ( 0u ),
maxLogEntries ( individualEventEntries ),
destroyPending ( false ),
replaceEvents ( false ),
dontProcess ( false )
{
}
#endif // casEventSysh
+80
View File
@@ -0,0 +1,80 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casMonEventh
#define casMonEventh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_casMonEventh
# undef epicsExportSharedSymbols
#endif
#include "tsFreeList.h"
#ifdef epicsExportSharedSymbols_casMonEventh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "casEvent.h"
class epicsMutex;
template < class MUTEX > class epicsGuard;
class casMonEvent : public casEvent {
public:
casMonEvent ( class casMonitor & monitor );
casMonEvent ( class casMonitor & monitor, const gdd & value );
~casMonEvent ();
void clear ();
void assign ( const gdd & value );
void swapValues ( casMonEvent & );
void * operator new ( size_t size,
tsFreeList < casMonEvent, 1024, epicsMutexNOOP > & );
epicsPlacementDeleteOperator (( void *,
tsFreeList < casMonEvent, 1024, epicsMutexNOOP > & ))
private:
class casMonitor & monitor;
smartConstGDDPointer pValue;
void * operator new ( size_t );
void operator delete ( void * );
caStatus cbFunc ( casCoreClient &, epicsGuard < epicsMutex > & guard );
casMonEvent ( const casMonEvent & );
casMonEvent & operator = ( const casMonEvent & );
};
inline casMonEvent::casMonEvent ( class casMonitor & monitorIn ) :
monitor ( monitorIn ) {}
inline casMonEvent::casMonEvent (
class casMonitor & monitorIn, const gdd & value ) :
monitor ( monitorIn ), pValue ( value ) {}
inline void casMonEvent::clear ()
{
this->pValue.set ( 0 );
}
inline void * casMonEvent::operator new ( size_t size,
tsFreeList < class casMonEvent, 1024, epicsMutexNOOP > & freeList )
{
return freeList.allocate ( size );
}
#endif // casMonEventh
+109
View File
@@ -0,0 +1,109 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casMonitorh
#define casMonitorh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_casMonitorh
# undef epicsExportSharedSymbols
#endif
#include "tsDLList.h"
#ifdef epicsExportSharedSymbols_casMonitorh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "caHdrLargeArray.h"
#include "casMonEvent.h"
class casMonitorCallbackInterface { // X aCC 655
public:
virtual caStatus casMonitorCallBack ( class casMonitor &,
const smartConstGDDPointer & pValue ) = 0;
};
class casEvent;
class casMonitor : public tsDLNode < casMonitor > {
public:
casMonitor ( caResId clientIdIn, casChannelI & chan,
ca_uint32_t nElem, unsigned dbrType,
const casEventMask & maskIn,
casMonitorCallbackInterface & );
virtual ~casMonitor();
void markDestroyPending ();
void installNewEventLog (
tsDLList < casEvent > & eventLogQue,
casMonEvent * pLog, const gdd & event );
caStatus response ( casCoreClient & client,
const smartConstGDDPointer & value );
void show ( unsigned level ) const;
bool selected ( const casEventMask & select ) const;
caStatus executeEvent ( casCoreClient &,
casMonEvent &, smartConstGDDPointer &,
epicsGuard < epicsMutex > & );
bool matchingClientId ( caResId clientIdIn ) const;
unsigned numEventsQueued () const;
void * operator new ( size_t size,
tsFreeList < casMonitor, 1024 > & );
epicsPlacementDeleteOperator (( void *,
tsFreeList < casMonitor, 1024 > & ))
private:
casMonEvent overFlowEvent;
ca_uint32_t const nElem;
casChannelI * pChannel;
casMonitorCallbackInterface & callBackIntf;
const casEventMask mask;
caResId const clientId;
unsigned char const dbrType;
unsigned char nPend;
bool destroyPending;
bool ovf;
void * operator new ( size_t );
void operator delete ( void * );
casMonitor ( const casMonitor & );
casMonitor & operator = ( const casMonitor & );
};
inline unsigned casMonitor::numEventsQueued () const
{
return this->nPend;
}
inline void casMonitor::markDestroyPending ()
{ this->pChannel = 0;
}
inline bool casMonitor::matchingClientId ( caResId clientIdIn ) const
{
return clientIdIn == this->clientId;
}
inline bool casMonitor::selected ( const casEventMask & select ) const
{
casEventMask result ( select & this->mask );
return result.eventsSelected () && this->pChannel;
}
#endif // casMonitorh
+170
View File
@@ -0,0 +1,170 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef casPVIh
#define casPVIh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_casPVIh
# undef epicsExportSharedSymbols
#endif
// external headers included here
#include "tsSLList.h"
#include "epicsMutex.h"
#include "caProto.h"
#ifdef epicsExportSharedSymbols_casPVIh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "casdef.h"
#include "ioBlocked.h"
class chanIntfForPV;
class caServerI;
class casMonitor;
class casPVI :
public tsSLNode < casPVI >, // server resource table installation
public ioBlockedList // list of clients io blocked on this pv
{
public:
casPVI ( casPV & );
caServerI * getPCAS () const;
caStatus attachToServer ( caServerI & cas );
aitIndex nativeCount ();
void clearOutstandingReads ( tsDLList < class casAsyncIOI > &);
void destroyAllIO (
tsDLList < casAsyncIOI > & );
void installIO (
tsDLList < casAsyncIOI > &, casAsyncIOI & );
void uninstallIO (
tsDLList < casAsyncIOI > &, casAsyncIOI & );
void installChannel ( chanIntfForPV & chan );
void removeChannel (
chanIntfForPV & chan, tsDLList < casMonitor > & src,
tsDLList < casMonitor > & dest );
caStatus installMonitor (
casMonitor & mon, tsDLList < casMonitor > & monitorList );
casMonitor * removeMonitor (
tsDLList < casMonitor > & list, ca_uint32_t clientIdIn );
void deleteSignal ();
void postEvent ( const casEventMask & select, const gdd & event );
caServer * getExtServer () const;
caStatus bestDBRType ( unsigned & dbrType );
const gddEnumStringTable & enumStringTable () const;
caStatus updateEnumStringTable ( casCtx & );
void updateEnumStringTableAsyncCompletion ( const gdd & resp );
casPV * apiPointer (); // retuns NULL if casPVI isnt a base of casPV
void show ( unsigned level ) const;
caStatus beginTransaction ();
void endTransaction ();
caStatus read ( const casCtx & ctx, gdd & prototype );
caStatus write ( const casCtx & ctx, const gdd & value );
casChannel * createChannel ( const casCtx & ctx,
const char * const pUserName, const char * const pHostName );
aitEnum bestExternalType () const;
unsigned maxDimension () const;
aitIndex maxBound ( unsigned dimension ) const;
const char * getName () const;
static casPVI * attachPV ( casPV & );
protected:
epicsShareFunc virtual ~casPVI ();
private:
mutable epicsMutex mutex;
tsDLList < chanIntfForPV > chanList;
gddEnumStringTable enumStrTbl;
caServerI * pCAS;
casPV & pv;
unsigned nMonAttached;
unsigned nIOAttached;
casPVI ( const casPVI & );
casPVI & operator = ( const casPVI & );
};
inline caServerI *casPVI::getPCAS() const
{
return this->pCAS;
}
// CA only does 1D arrays for now
inline aitIndex casPVI::nativeCount ()
{
if ( this->maxDimension() == 0u ) {
return 1u; // scalar
}
return this->maxBound(0u);
}
inline const gddEnumStringTable & casPVI::enumStringTable () const
{
return this->enumStrTbl;
}
inline caStatus casPVI::beginTransaction ()
{
return this->pv.beginTransaction ();
}
inline void casPVI::endTransaction ()
{
this->pv.endTransaction ();
}
inline caStatus casPVI::read ( const casCtx & ctx, gdd & prototype )
{
return this->pv.read ( ctx, prototype );
}
inline caStatus casPVI::write ( const casCtx & ctx, const gdd & value )
{
return this->pv.write ( ctx, value );
}
inline casChannel * casPVI::createChannel ( const casCtx & ctx,
const char * const pUserName, const char * const pHostName )
{
return this->pv.createChannel ( ctx, pUserName, pHostName );
}
inline aitEnum casPVI::bestExternalType () const
{
return this->pv.bestExternalType ();
}
inline unsigned casPVI::maxDimension () const
{
return this->pv.maxDimension ();
}
inline aitIndex casPVI::maxBound ( unsigned dimension ) const
{
return this->pv.maxBound ( dimension );
}
inline const char * casPVI::getName () const
{
return this->pv.getName ();
}
#endif // casPVIh
+65
View File
@@ -0,0 +1,65 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#define epicsExportSharedSymbols
#include "chanIntfForPV.h"
#include "casCoreClient.h"
#include "casPVI.h"
chanIntfForPV::chanIntfForPV ( class casCoreClient & clientIn ) :
clientRef ( clientIn )
{
}
chanIntfForPV::~chanIntfForPV ()
{
while ( casMonitor * pMon = this->monitorList.get () ) {
this->clientRef.destroyMonitor ( *pMon );
}
}
class casCoreClient & chanIntfForPV::client () const
{
return this->clientRef;
}
void chanIntfForPV::installMonitor ( casPVI & pv, casMonitor & mon )
{
caStatus status = pv.installMonitor (
mon, this->monitorList );
if ( status ) {
errMessage ( status,
"Server tool failed to register event\n" );
}
}
void chanIntfForPV::show ( unsigned level ) const
{
printf ( "chanIntfForPV\n" );
if ( level > 0 && this->monitorList.count() ) {
printf ( "List of subscriptions attached\n" );
tsDLIterConst < casMonitor > iter =
this->monitorList.firstIter ();
while ( iter.valid () ) {
iter->show ( level - 1 );
++iter;
}
}
}
+80
View File
@@ -0,0 +1,80 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*/
#ifndef chanIntfForPVh
#define chanIntfForPVh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_chanIntfForPVh
# undef epicsExportSharedSymbols
#endif
// external headers included here
#include "tsDLList.h"
#include "caProto.h"
#ifdef epicsExportSharedSymbols_chanIntfForPVh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "casCoreClient.h"
#include "casPVI.h"
class casMonitor;
class casPVI;
class casEventMask;
class gdd;
class chanIntfForPV : public tsDLNode < chanIntfForPV > {
public:
chanIntfForPV ( class casCoreClient & );
~chanIntfForPV ();
class casCoreClient & client () const;
void installMonitor ( casPVI & pv, casMonitor & mon );
casMonitor * removeMonitor ( casPVI &, ca_uint32_t monId );
void removeSelfFromPV ( casPVI &,
tsDLList < casMonitor > & dest );
void postEvent ( const casEventMask &, const gdd & );
void show ( unsigned level ) const;
private:
tsDLList < casMonitor > monitorList;
class casCoreClient & clientRef;
chanIntfForPV ( const chanIntfForPV & );
chanIntfForPV & operator = ( const chanIntfForPV & );
};
inline void chanIntfForPV::postEvent (
const casEventMask & select, const gdd & event )
{
this->clientRef.postEvent ( this->monitorList, select, event );
}
inline casMonitor * chanIntfForPV::removeMonitor (
casPVI & pv, ca_uint32_t clientIdIn )
{
return pv.removeMonitor ( this->monitorList, clientIdIn );
}
inline void chanIntfForPV::removeSelfFromPV (
casPVI & pv, tsDLList < casMonitor > & dest )
{
pv.removeChannel ( *this, this->monitorList, dest );
}
#endif // chanIntfForPVh
+33
View File
@@ -0,0 +1,33 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef casDGEvWakeuph
#define casDGEvWakeuph
class casDGEvWakeup : public epicsTimerNotify {
public:
casDGEvWakeup ();
virtual ~casDGEvWakeup();
void show ( unsigned level ) const;
void start ( class casDGIntfOS &osIn );
private:
epicsTimer &timer;
class casDGIntfOS *pOS;
expireStatus expire( const epicsTime & currentTime );
casDGEvWakeup ( const casDGEvWakeup & );
casDGEvWakeup & operator = ( const casDGEvWakeup & );
};
#endif // casDGEvWakeuph
+45
View File
@@ -0,0 +1,45 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef casDGIOWakeuph
#define casDGIOWakeuph
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_casDGIOWakeuph
# undef epicsExportSharedSymbols
#endif
// external headers included here
#include "epicsTimer.h"
#ifdef epicsExportSharedSymbols_casDGIOWakeuph
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
class casDGIOWakeup : public epicsTimerNotify {
public:
casDGIOWakeup ();
virtual ~casDGIOWakeup ();
void show ( unsigned level ) const;
void start ( class casDGIntfOS &osIn );
private:
epicsTimer &timer;
class casDGIntfOS *pOS;
expireStatus expire( const epicsTime & currentTime );
casDGIOWakeup ( const casDGIOWakeup & );
casDGIOWakeup & operator = ( const casDGIOWakeup & );
};
#endif // casDGIOWakeuph
+66
View File
@@ -0,0 +1,66 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef casDGIntfOSh
#define casDGIntfOSh
#include "casDGIntfIO.h"
#include "casDGIOWakeup.h"
#include "casDGEvWakeup.h"
class casDGIntfOS : public casDGIntfIO {
friend class casDGReadReg;
friend class casDGBCastReadReg;
friend class casDGWriteReg;
public:
casDGIntfOS ( caServerI &, clientBufMemoryManager &,
const caNetAddr & addr, bool autoBeaconAddr = true,
bool addConfigBeaconAddr = false);
virtual ~casDGIntfOS ();
virtual void show (unsigned level) const;
void processInput();
void eventFlush ();
private:
casDGIOWakeup ioWk;
casDGEvWakeup evWk;
casDGReadReg *pRdReg;
casDGBCastReadReg *pBCastRdReg; // fix for solaris bug
casDGWriteReg *pWtReg;
bool sendBlocked;
void armRecv ();
void armSend ();
void disarmRecv ();
void disarmSend ();
void recvCB ( inBufClient::fillParameter parm );
void sendCB ();
void sendBlockSignal ();
void ioBlockedSignal ();
void eventSignal ();
casDGIntfOS ( const casDGIntfOS & );
casDGIntfOS & operator = ( const casDGIntfOS & );
};
#endif // casDGIntfOSh
+46
View File
@@ -0,0 +1,46 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
// casOSD.h - Channel Access Server OS dependent wrapper
//
//
//
#ifndef casIntfOSh
#define casIntfOSh
#include "casIntfIO.h"
#include "casDGIntfOS.h"
//
// casIntfOS
//
class casIntfOS : public casIntfIO, public tsDLNode < casIntfOS >,
public casDGIntfOS
{
friend class casServerReg;
public:
casIntfOS ( caServerI &, clientBufMemoryManager &, const caNetAddr &,
bool autoBeaconAddr = true, bool addConfigBeaconAddr = false );
virtual ~casIntfOS();
void show ( unsigned level ) const;
caNetAddr serverAddress () const;
private:
caServerI & cas;
casServerReg * pRdReg;
casIntfOS ( const casIntfOS & );
casIntfOS & operator = ( const casIntfOS & );
};
#endif // casIntfOSh
+92
View File
@@ -0,0 +1,92 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef casStreamOSh
#define casStreamOSh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_casStreamOSh
# undef epicsExportSharedSymbols
#endif
#undef epicsAssertAuthor
#define epicsAssertAuthor "Jeff Hill johill@lanl.gov"
#include "epicsAssert.h"
#include "epicsTimer.h"
#ifdef epicsExportSharedSymbols_casStreamOSh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
#include "casStreamIO.h"
class casStreamIOWakeup : public epicsTimerNotify {
public:
casStreamIOWakeup ();
virtual ~casStreamIOWakeup ();
void show ( unsigned level ) const;
void start ( class casStreamOS & osIn );
private:
epicsTimer & timer;
casStreamOS * pOS;
expireStatus expire ( const epicsTime & currentTime );
casStreamIOWakeup ( const casStreamIOWakeup & );
casStreamIOWakeup & operator = ( const casStreamIOWakeup & );
};
class casStreamEvWakeup : public epicsTimerNotify {
public:
casStreamEvWakeup ();
virtual ~casStreamEvWakeup ();
void show ( unsigned level ) const;
void start ( class casStreamOS & osIn );
private:
epicsTimer & timer;
casStreamOS * pOS;
expireStatus expire ( const epicsTime & currentTime );
casStreamEvWakeup ( const casStreamEvWakeup & );
casStreamEvWakeup & operator = ( const casStreamEvWakeup & );
};
class casStreamOS : public casStreamIO {
public:
casStreamOS ( caServerI &, clientBufMemoryManager &,
const ioArgsToNewStreamIO & );
~casStreamOS ();
void show ( unsigned level ) const;
casProcCond processInput ();
void eventFlush ();
private:
casStreamEvWakeup evWk;
casStreamIOWakeup ioWk;
class casStreamWriteReg * pWtReg;
class casStreamReadReg * pRdReg;
bool sendBlocked;
void armSend ();
void armRecv ();
void disarmSend();
void disarmRecv();
void recvCB ();
void sendCB ();
void sendBlockSignal ();
void ioBlockedSignal ();
void eventSignal ();
casStreamOS ( const casStreamOS & );
casStreamOS & operator = ( const casStreamOS & );
friend class casStreamWriteReg;
friend class casStreamReadReg;
};
#endif // casStreamOSh
+52
View File
@@ -0,0 +1,52 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef caServerIOh
#define caServerIOh
#include "casdef.h"
//
// caServerIO
//
class caServerIO {
public:
caServerIO ();
virtual ~caServerIO();
//
// show status of IO subsystem
//
void show ( unsigned level ) const;
void locateInterfaces ();
private:
//
// static member data
//
static int staticInitialized;
//
// static member func
//
static inline void staticInit ();
virtual caStatus attachInterface (
const caNetAddr & addr, bool autoBeaconAddr,
bool addConfigAddr ) = 0;
};
#endif // caServerIOh
+71
View File
@@ -0,0 +1,71 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef casDGIntfIOh
#define casDGIntfIOh
#include "casDGClient.h"
class casDGIntfIO : public casDGClient {
public:
casDGIntfIO ( caServerI & serverIn, clientBufMemoryManager &,
const caNetAddr & addr, bool autoBeaconAddr = true,
bool addConfigBeaconAddr = false );
virtual ~casDGIntfIO();
int getFD () const;
int getBCastFD () const;
bool validBCastFD () const;
void xSetNonBlocking ();
void sendBeaconIO ( char & msg, bufSizeT length,
aitUint16 &portField, aitUint32 & addrField );
outBufClient::flushCondition osdSend ( const char * pBuf, bufSizeT nBytesReq,
const caNetAddr & addr);
inBufClient::fillCondition osdRecv ( char * pBuf, bufSizeT nBytesReq,
inBufClient::fillParameter parm, bufSizeT & nBytesActual, caNetAddr & addr );
virtual void show ( unsigned level ) const;
static bufSizeT optimumOutBufferSize ();
static bufSizeT optimumInBufferSize ();
bufSizeT incomingBytesPresent () const;
private:
tsFreeList < class ipIgnoreEntry, 128 > ipIgnoreEntryFreeList;
resTable < ipIgnoreEntry, ipIgnoreEntry > ignoreTable;
ELLLIST beaconAddrList;
SOCKET sock;
SOCKET bcastRecvSock; // fix for solaris bug
SOCKET beaconSock; // allow connect
unsigned short dgPort;
static SOCKET makeSockDG ();
casDGIntfIO ( const casDGIntfIO & );
casDGIntfIO & operator = ( const casDGIntfIO & );
};
inline int casDGIntfIO::getBCastFD() const
{
return this->bcastRecvSock;
}
inline bool casDGIntfIO::validBCastFD() const
{
return this->bcastRecvSock != INVALID_SOCKET;
}
#endif // casDGIntfIOh
+62
View File
@@ -0,0 +1,62 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef casIntfIOh
#define casIntfIOh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_casIntfIOh
# undef epicsExportSharedSymbols
#endif
// external headers included here
#include "osiSock.h"
#ifdef epicsExportSharedSymbols_casIntfIOh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
class caNetAddr;
class caServerI;
class clientBufMemoryManager;
//
// casIntfIO
//
class casIntfIO {
public:
casIntfIO ( const caNetAddr & addr );
virtual ~casIntfIO ();
void show ( unsigned level ) const;
int getFD () const;
void setNonBlocking ();
//
// called when we expect that a virtual circuit for a
// client can be created
//
class casStreamOS * newStreamClient ( caServerI & cas,
clientBufMemoryManager & ) const;
caNetAddr serverAddress () const;
private:
SOCKET sock;
struct sockaddr_in addr;
};
#endif // casIntfIOh
+62
View File
@@ -0,0 +1,62 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef casStreamIOh
#define casStreamIOh
#include "casStrmClient.h"
struct ioArgsToNewStreamIO {
caNetAddr addr;
SOCKET sock;
};
class casStreamIO : public casStrmClient {
public:
casStreamIO ( caServerI &, clientBufMemoryManager &,
const ioArgsToNewStreamIO & );
~casStreamIO ();
int getFD () const;
void xSetNonBlocking ();
void hostName ( char *pBuf, unsigned bufSize ) const;
outBufClient::flushCondition osdSend ( const char *pBuf, bufSizeT nBytesReq,
bufSizeT & nBytesActual );
inBufClient::fillCondition osdRecv ( char *pBuf, bufSizeT nBytesReq,
bufSizeT & nBytesActual );
xBlockingStatus blockingState() const;
bufSizeT incomingBytesPresent() const;
static bufSizeT optimumBufferSize ();
void osdShow ( unsigned level ) const;
const caNetAddr getAddr() const
{
return caNetAddr ( this->addr );
}
private:
SOCKET sock;
struct sockaddr_in addr;
xBlockingStatus blockingFlag;
casStreamIO ( const casStreamIO & );
casStreamIO & operator = ( const casStreamIO & );
};
#endif // casStreamIOh
+52
View File
@@ -0,0 +1,52 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
//
// $Id$
//
#ifndef ipIgnoreEntryh
#define ipIgnoreEntryh
#ifdef epicsExportSharedSymbols
# define epicsExportSharedSymbols_ipIgnoreEntryh
# undef epicsExportSharedSymbols
#endif
#include "tsSLList.h"
#include "tsFreeList.h"
#include "resourceLib.h"
#ifdef epicsExportSharedSymbols_ipIgnoreEntryh
# define epicsExportSharedSymbols
# include "shareLib.h"
#endif
class ipIgnoreEntry : public tsSLNode < ipIgnoreEntry > {
public:
ipIgnoreEntry ( unsigned ipAddr );
void show ( unsigned level ) const;
bool operator == ( const ipIgnoreEntry & ) const;
resTableIndex hash () const;
void * operator new ( size_t size,
tsFreeList < class ipIgnoreEntry, 128 > & );
epicsPlacementDeleteOperator (( void *,
tsFreeList < class ipIgnoreEntry, 128 > & ))
private:
unsigned ipAddr;
ipIgnoreEntry ( const ipIgnoreEntry & );
ipIgnoreEntry & operator = ( const ipIgnoreEntry & );
void * operator new ( size_t size );
void operator delete ( void * );
};
#endif // ipIgnoreEntryh