This is Unofficial EPICS BASE Doxygen Site
cac Class Reference

#include "cac.h"

+ Inheritance diagram for cac:
+ Collaboration diagram for cac:

Public Member Functions

 cac (epicsMutex &mutualExclusion, epicsMutex &callbackControl, cacContextNotify &)
 
virtual ~cac ()
 
void beaconNotify (const inetAddrID &addr, const epicsTime &currentTime, ca_uint32_t beaconNumber, unsigned protocolRevision)
 
unsigned beaconAnomaliesSinceProgramStart (epicsGuard< epicsMutex > &) const
 
void flush (epicsGuard< epicsMutex > &guard)
 
bool executeResponse (callbackManager &, tcpiiu &, const epicsTime &currentTime, caHdrLargeArray &, char *pMsgBody)
 
void transferChanToVirtCircuit (unsigned cid, unsigned sid, ca_uint16_t typeCode, arrayElementCount count, unsigned minorVersionNumber, const osiSockAddr &, const epicsTime &currentTime)
 
cacChannelcreateChannel (epicsGuard< epicsMutex > &guard, const char *pChannelName, cacChannelNotify &, cacChannel::priLev)
 
void destroyChannel (epicsGuard< epicsMutex > &, nciu &)
 
void initiateConnect (epicsGuard< epicsMutex > &, nciu &, netiiu *&)
 
nciulookupChannel (epicsGuard< epicsMutex > &, const cacChannel::ioid &)
 
netWriteNotifyIOwriteNotifyRequest (epicsGuard< epicsMutex > &, nciu &, privateInterfaceForIO &, unsigned type, arrayElementCount nElem, const void *pValue, cacWriteNotify &)
 
netReadNotifyIOreadNotifyRequest (epicsGuard< epicsMutex > &, nciu &, privateInterfaceForIO &, unsigned type, arrayElementCount nElem, cacReadNotify &)
 
netSubscriptionsubscriptionRequest (epicsGuard< epicsMutex > &, nciu &, privateInterfaceForIO &, unsigned type, arrayElementCount nElem, unsigned mask, cacStateNotify &, bool channelIsInstalled)
 
bool destroyIO (CallbackGuard &callbackGuard, epicsGuard< epicsMutex > &mutualExclusionGuard, const cacChannel::ioid &idIn, nciu &chan)
 
void disconnectAllIO (epicsGuard< epicsMutex > &cbGuard, epicsGuard< epicsMutex > &guard, nciu &, tsDLList< baseNMIU > &ioList)
 
void ioShow (epicsGuard< epicsMutex > &guard, const cacChannel::ioid &id, unsigned level) const
 
void registerSearchDest (epicsGuard< epicsMutex > &, SearchDest &req)
 
bool findOrCreateVirtCircuit (epicsGuard< epicsMutex > &, const osiSockAddr &, unsigned, tcpiiu *&, unsigned, SearchDestTCP *pSearchDest=NULL)
 
unsigned circuitCount (epicsGuard< epicsMutex > &) const
 
void show (epicsGuard< epicsMutex > &, unsigned level) const
 
int printFormated (epicsGuard< epicsMutex > &callbackControl, const char *pformat,...) const
 
int varArgsPrintFormated (epicsGuard< epicsMutex > &callbackControl, const char *pformat, va_list args) const
 
double connectionTimeout (epicsGuard< epicsMutex > &)
 
unsigned maxContiguousFrames (epicsGuard< epicsMutex > &) const
 
const char * userNamePointer () const
 
unsigned getInitializingThreadsPriority () const
 
epicsMutex & mutexRef ()
 
void attachToClientCtx ()
 
void selfTest (epicsGuard< epicsMutex > &) const
 
double beaconPeriod (epicsGuard< epicsMutex > &, const nciu &chan) const
 
void destroyIIU (tcpiiu &iiu)
 
const char * pLocalHostName ()
 
- Public Member Functions inherited from cacContext
virtual ~cacContext ()
 

Static Public Member Functions

static unsigned lowestPriorityLevelAbove (unsigned priority)
 
static unsigned highestPriorityLevelBelow (unsigned priority)
 

Public Attributes

void exception epicsGuard< epicsMutex > & cbGuard
 
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > & guard
 
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int status
 
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int const char * pContext
 
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int const char const char * pFileName
 
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int const char const char unsigned lineNo
 

Friends

class tcpiiu
 

Detailed Description

Definition at line 97 of file cac.h.

Constructor & Destructor Documentation

cac::cac ( epicsMutex &  mutualExclusion,
epicsMutex &  callbackControl,
cacContextNotify notifyIn 
)

Definition at line 127 of file cac.cpp.

130  :
131  _refLocalHostName ( localHostNameCache.getReference () ),
132  programBeginTime ( epicsTime::getCurrent() ),
133  connTMO ( CA_CONN_VERIFY_PERIOD ),
134  mutex ( mutualExclusionIn ),
135  cbMutex ( callbackControlIn ),
136  ipToAEngine ( ipAddrToAsciiEngine::allocate () ),
139  pUserName ( 0 ),
140  pudpiiu ( 0 ),
141  tcpSmallRecvBufFreeList ( 0 ),
142  tcpLargeRecvBufFreeList ( 0 ),
143  notify ( notifyIn ),
144  initializingThreadsId ( epicsThreadGetIdSelf() ),
145  initializingThreadsPriority ( epicsThreadGetPrioritySelf() ),
146  maxRecvBytesTCP ( MAX_TCP ),
147  maxContigFrames ( contiguousMsgCountWhichTriggersFlowControl ),
148  beaconAnomalyCount ( 0u ),
149  iiuExistenceCount ( 0u ),
150  cacShutdownInProgress ( false )
151 {
152  if ( ! osiSockAttach () ) {
154  }
155 
156  try {
157  long status;
158 
159  /*
160  * Certain os, such as HPUX, do not unblock a socket system call
161  * when another thread asynchronously calls both shutdown() and
162  * close(). To solve this problem we need to employ OS specific
163  * mechanisms.
164  */
167 
168  {
169  char tmp[256];
170  size_t len;
171  osiGetUserNameReturn gunRet;
172 
173  gunRet = osiGetUserName ( tmp, sizeof (tmp) );
174  if ( gunRet != osiGetUserNameSuccess ) {
175  tmp[0] = '\0';
176  }
177  len = strlen ( tmp ) + 1;
178  this->pUserName = new char [ len ];
179  strncpy ( this->pUserName, tmp, len );
180  }
181 
182  this->_serverPort =
184  static_cast <unsigned short> (CA_SERVER_PORT) );
185 
186  status = envGetDoubleConfigParam ( &EPICS_CA_CONN_TMO, &this->connTMO );
187  if ( status ) {
188  this->connTMO = CA_CONN_VERIFY_PERIOD;
189  epicsGuard < epicsMutex > cbGuard ( this->cbMutex );
190  errlogPrintf ( "EPICS \"%s\" double fetch failed\n", EPICS_CA_CONN_TMO.name );
191  errlogPrintf ( "Defaulting \"%s\" = %f\n", EPICS_CA_CONN_TMO.name, this->connTMO );
192  }
193 
194  long maxBytesAsALong;
195  status = envGetLongConfigParam ( &EPICS_CA_MAX_ARRAY_BYTES, &maxBytesAsALong );
196  if ( status || maxBytesAsALong < 0 ) {
197  errlogPrintf ( "cac: EPICS_CA_MAX_ARRAY_BYTES was not a positive integer\n" );
198  }
199  else {
200  /* allow room for the protocol header so that they get the array size they requested */
201  static const unsigned headerSize = sizeof ( caHdr ) + 2 * sizeof ( ca_uint32_t );
202  ca_uint32_t maxBytes = ( unsigned ) maxBytesAsALong;
203  if ( maxBytes < 0xffffffff - headerSize ) {
204  maxBytes += headerSize;
205  }
206  else {
207  maxBytes = 0xffffffff;
208  }
209  if ( maxBytes < MAX_TCP ) {
210  errlogPrintf ( "cac: EPICS_CA_MAX_ARRAY_BYTES was rounded up to %u\n", MAX_TCP );
211  }
212  else {
213  this->maxRecvBytesTCP = maxBytes;
214  }
215  }
216  freeListInitPvt ( &this->tcpSmallRecvBufFreeList, MAX_TCP, 1 );
217  if ( ! this->tcpSmallRecvBufFreeList ) {
218  throw std::bad_alloc ();
219  }
220 
221  int autoMaxBytes;
223  autoMaxBytes = 1;
224 
225  if(!autoMaxBytes) {
226  freeListInitPvt ( &this->tcpLargeRecvBufFreeList, this->maxRecvBytesTCP, 1 );
227  if ( ! this->tcpLargeRecvBufFreeList ) {
228  throw std::bad_alloc ();
229  }
230  }
231  unsigned bufsPerArray = this->maxRecvBytesTCP / comBuf::capacityBytes ();
232  if ( bufsPerArray > 1u ) {
233  maxContigFrames = bufsPerArray *
234  contiguousMsgCountWhichTriggersFlowControl;
235  }
236  }
237  catch ( ... ) {
238  osiSockRelease ();
239  delete [] this->pUserName;
240  freeListCleanup ( this->tcpSmallRecvBufFreeList );
241  if ( this->tcpLargeRecvBufFreeList ) {
242  freeListCleanup ( this->tcpLargeRecvBufFreeList );
243  }
244  this->timerQueue.release ();
245  throw;
246  }
247 
248  /*
249  * load user configured tcp name server address list,
250  * create virtual circuits, and add them to server table
251  */
252  ELLLIST dest, tmpList;
253 
254  ellInit ( & dest );
255  ellInit ( & tmpList );
256 
257  addAddrToChannelAccessAddressList ( &tmpList, &EPICS_CA_NAME_SERVERS, this->_serverPort, false );
258  removeDuplicateAddresses ( &dest, &tmpList, 0 );
259 
260  epicsGuard < epicsMutex > guard ( this->mutex );
261 
262  while ( osiSockAddrNode *
263  pNode = reinterpret_cast < osiSockAddrNode * > ( ellGet ( & dest ) ) ) {
264  tcpiiu * piiu = NULL;
265  SearchDestTCP * pdst = new SearchDestTCP ( *this, pNode->addr );
266  this->registerSearchDest ( guard, * pdst );
267  /* Initially assume that servers listed in EPICS_CA_NAME_SERVERS support at least minor
268  * version 11. This causes tcpiiu to send the user and host name authentication
269  * messages. When the actual Version message is received from the server it will
270  * be overwrite this assumption.
271  */
272  bool newIIU = findOrCreateVirtCircuit (
273  guard, pNode->addr, cacChannel::priorityDefault,
274  piiu, 11, pdst );
275  free ( pNode );
276  if ( newIIU ) {
277  piiu->start ( guard );
278  }
279  }
280 }
epicsSingleton< localHostName > localHostNameCache
LIBCA_API void epicsStdCall removeDuplicateAddresses(struct ELLLIST *pDestList, ELLLIST *pSrcList, int silent)
Definition: iocinf.cpp:123
#define MAX_TCP
Definition: caProto.h:63
LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore(void)
Definition: osdSignal.cpp:17
char * name
Name of the parameter.
Definition: envDefs.h:42
void osiSockRelease()
Definition: osdSock.c:62
LIBCA_API int epicsStdCall addAddrToChannelAccessAddressList(struct ELLLIST *pList, const ENV_PARAM *pEnv, unsigned short port, int ignoreNonDefaultPort)
Definition: iocinf.cpp:74
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int status
Definition: cac.h:164
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > & guard
Definition: cac.h:164
unsigned int ca_uint32_t
Definition: caProto.h:76
ELLNODE * ellGet(ELLLIST *pList)
Deletes and returns the first node from a list.
Definition: ellLib.c:147
LIBCOM_API const ENV_PARAM EPICS_CA_MAX_ARRAY_BYTES
LIBCOM_API const ENV_PARAM EPICS_CA_NAME_SERVERS
#define NULL
Definition: catime.c:38
void start(epicsGuard< epicsMutex > &)
Definition: tcpiiu.cpp:819
reference getReference()
#define CA_SERVER_PORT
Definition: caProto.h:53
LIBCOM_API void epicsStdCall freeListInitPvt(void **ppvt, int size, int nmalloc)
Definition: freeListLib.c:44
LIBCOM_API void epicsStdCall freeListCleanup(void *pvt)
Definition: freeListLib.c:152
LIBCOM_API long epicsStdCall envGetDoubleConfigParam(const ENV_PARAM *pParam, double *pDouble)
Get value of a double configuration parameter.
Definition: envSubr.c:191
LIBCOM_API const ENV_PARAM EPICS_CA_SERVER_PORT
LIBCOM_API long epicsStdCall envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool)
Get value of a boolean configuration parameter.
Definition: envSubr.c:325
char * allocate(unsigned int n)
Definition: antelope.c:230
LIBCOM_API unsigned short epicsStdCall envGetInetPortConfigParam(const ENV_PARAM *pEnv, unsigned short defaultPort)
Get value of a port number configuration parameter.
Definition: envSubr.c:398
void registerSearchDest(epicsGuard< epicsMutex > &, SearchDest &req)
Definition: cac.cpp:1329
void exception epicsGuard< epicsMutex > & cbGuard
Definition: cac.h:164
LIBCOM_API void epicsStdCall epicsSignalInstallSigAlarmIgnore(void)
Definition: osdSignal.cpp:18
int errlogPrintf(const char *pFormat,...)
Definition: errlog.c:105
struct ca_hdr caHdr
LIBCOM_API unsigned int epicsStdCall epicsThreadGetPrioritySelf(void)
Definition: osdThread.c:707
bool findOrCreateVirtCircuit(epicsGuard< epicsMutex > &, const osiSockAddr &, unsigned, tcpiiu *&, unsigned, SearchDestTCP *pSearchDest=NULL)
Definition: cac.cpp:535
static ipAddrToAsciiEngine & allocate()
LIBCOM_API long epicsStdCall envGetLongConfigParam(const ENV_PARAM *pParam, long *pLong)
Get value of a long configuration parameter.
Definition: envSubr.c:303
LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName(char *pBuf, unsigned bufSizeIn)
Definition: osdProcess.c:33
#define ellInit(PLIST)
Initialize a list type.
Definition: ellLib.h:76
osiGetUserNameReturn
Definition: osiProcess.h:25
static unsigned capacityBytes()
Definition: comBuf.h:171
int osiSockAttach()
Definition: osdSock.c:54
static unsigned lowestPriorityLevelAbove(unsigned priority)
Definition: cac.cpp:362
LIBCOM_API const ENV_PARAM EPICS_CA_CONN_TMO
List header type.
Definition: ellLib.h:56
#define throwWithLocation(parm)
LIBCOM_API const ENV_PARAM EPICS_CA_AUTO_ARRAY_BYTES
static const priLev priorityDefault
Definition: cacIO.h:168
LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf(void)
Definition: osdThread.c:810
cac::~cac ( )
virtual

Definition at line 282 of file cac.cpp.

283 {
284  // this blocks until the UDP thread exits so that
285  // it will not sneak in any new clients
286  //
287  // lock intentionally not held here so that we dont deadlock
288  // waiting for the UDP thread to exit while it is waiting to
289  // get the lock.
290  {
291  epicsGuard < epicsMutex > cbGuard ( this->cbMutex );
292  epicsGuard < epicsMutex > guard ( this->mutex );
293  if ( this->pudpiiu ) {
294  this->pudpiiu->shutdown ( cbGuard, guard );
295 
296  // make sure no new tcp circuits are created
297  this->cacShutdownInProgress = true;
298 
299  //
300  // shutdown all tcp circuits
301  //
302  tsDLIter < tcpiiu > iter = this->circuitList.firstIter ();
303  while ( iter.valid() ) {
304  // this causes a clean shutdown to occur
305  iter->unlinkAllChannels ( cbGuard, guard );
306  iter++;
307  }
308  }
309  }
310 
311  //
312  // wait for all tcp threads to exit
313  //
314  // this will block for oustanding sends to go out so dont
315  // hold a lock while waiting
316  //
317  {
318  epicsGuard < epicsMutex > guard ( this->mutex );
319  while ( this->iiuExistenceCount > 0 ) {
321  this->iiuUninstall.wait ();
322  }
323  }
324 
325  if ( this->pudpiiu ) {
326  delete this->pudpiiu;
327  }
328 
329  freeListCleanup ( this->tcpSmallRecvBufFreeList );
330  if ( this->tcpLargeRecvBufFreeList ) {
331  freeListCleanup ( this->tcpLargeRecvBufFreeList );
332  }
333 
334  delete [] this->pUserName;
335 
336  tsSLList < bhe > tmpBeaconList;
337  this->beaconTable.removeAll ( tmpBeaconList );
338  while ( bhe * pBHE = tmpBeaconList.get() ) {
339  pBHE->~bhe ();
340  this->bheFreeList.release ( pBHE );
341  }
342 
343  this->timerQueue.release ();
344 
345  this->ipToAEngine.release ();
346 
347  // clean-up the list of un-notified msg objects
348  while ( msgForMultiplyDefinedPV * msg = this->msgMultiPVList.get() ) {
349  msg->~msgForMultiplyDefinedPV ();
350  this->mdpvFreeList.release ( msg );
351  }
352 
353  errlogFlush ();
354 
355  osiSockRelease ();
356 
357  // its ok for channels and subscriptions to still
358  // exist at this point. The user created them and
359  // its his responsibility to clean them up.
360 }
void errlogFlush(void)
Definition: errlog.c:529
void osiSockRelease()
Definition: osdSock.c:62
tsDLIterConst< T > firstIter() const
Definition: tsDLList.h:459
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > & guard
Definition: cac.h:164
void unlinkAllChannels(epicsGuard< epicsMutex > &cbGuard, epicsGuard< epicsMutex > &guard)
Definition: tcpiiu.cpp:1869
bool valid() const
Definition: tsDLList.h:607
virtual void release()=0
LIBCOM_API void epicsStdCall freeListCleanup(void *pvt)
Definition: freeListLib.c:152
void release(void *)
Definition: bhe.cpp:349
void removeAll(tsSLList< T > &destination)
Definition: resourceLib.h:327
void shutdown(epicsGuard< epicsMutex > &cbGuard, epicsGuard< epicsMutex > &guard)
Definition: udpiiu.cpp:332
Definition: bhe.h:45
void exception epicsGuard< epicsMutex > & cbGuard
Definition: cac.h:164
T * get()
Definition: tsSLList.h:220
T * get()
Definition: tsDLList.h:261
void release(void *p)
Definition: tsFreeList.h:176

Member Function Documentation

void cac::attachToClientCtx ( )
inline

Definition at line 371 of file cac.h.

372 {
373  this->notify.attachToClientCtx ();
374 }
virtual void attachToClientCtx()=0
unsigned cac::beaconAnomaliesSinceProgramStart ( epicsGuard< epicsMutex > &  guard) const
inlinevirtual

Implements cacContext.

Definition at line 376 of file cac.h.

378 {
379  guard.assertIdenticalMutex ( this->mutex );
380  return this->beaconAnomalyCount;
381 }
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
void cac::beaconNotify ( const inetAddrID addr,
const epicsTime &  currentTime,
ca_uint32_t  beaconNumber,
unsigned  protocolRevision 
)

Definition at line 454 of file cac.cpp.

456 {
457  epicsGuard < epicsMutex > guard ( this->mutex );
458 
459  if ( ! this->pudpiiu ) {
460  return;
461  }
462 
463  /*
464  * look for it in the hash table
465  */
466  bhe *pBHE = this->beaconTable.lookup ( addr );
467  if ( pBHE ) {
468  /*
469  * return if the beacon period has not changed significantly
470  */
471  if ( ! pBHE->updatePeriod ( guard, this->programBeginTime,
472  currentTime, beaconNumber, protocolRevision ) ) {
473  return;
474  }
475  }
476  else {
477  /*
478  * This is the first beacon seen from this server.
479  * Wait until 2nd beacon is seen before deciding
480  * if it is a new server (or just the first
481  * time that we have seen a server's beacon
482  * shortly after the program started up)
483  */
484  pBHE = new ( this->bheFreeList )
485  bhe ( this->mutex, currentTime, beaconNumber, addr );
486  if ( pBHE ) {
487  if ( this->beaconTable.add ( *pBHE ) < 0 ) {
488  pBHE->~bhe ();
489  this->bheFreeList.release ( pBHE );
490  }
491  }
492  return;
493  }
494 
495  this->beaconAnomalyCount++;
496 
497  this->pudpiiu->beaconAnomalyNotify ( guard );
498 
499 # ifdef DEBUG
500  {
501  char buf[128];
502  addr.name ( buf, sizeof ( buf ) );
503  ::printf ( "New server available: %s\n", buf );
504  }
505 # endif
506 }
void beaconAnomalyNotify(epicsGuard< epicsMutex > &guard)
Definition: udpiiu.cpp:1200
int add(T &res)
Definition: resourceLib.h:643
#define printf
Definition: epicsStdio.h:41
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > & guard
Definition: cac.h:164
LIBCA_API bool updatePeriod(epicsGuard< epicsMutex > &, const epicsTime &programBeginTime, const epicsTime &currentTime, ca_uint32_t beaconNumber, unsigned protocolRevision)
Definition: bhe.cpp:124
T * lookup(const ID &idIn) const
Definition: resourceLib.h:342
LIBCA_API ~bhe()
Definition: bhe.cpp:62
void release(void *)
Definition: bhe.cpp:349
Definition: bhe.h:45
void name(char *pBuf, unsigned bufSize) const
Definition: inetAddrID.h:64
double cac::beaconPeriod ( epicsGuard< epicsMutex > &  guard,
const nciu chan 
) const

Definition at line 1273 of file cac.cpp.

1276 {
1277  const netiiu * pIIU = chan.getConstPIIU ( guard );
1278  if ( pIIU ) {
1279  osiSockAddr addr = pIIU->getNetworkAddress ( guard );
1280  if ( addr.sa.sa_family == AF_INET ) {
1281  inetAddrID tmp ( addr.ia );
1282  bhe *pBHE = this->beaconTable.lookup ( tmp );
1283  if ( pBHE ) {
1284  return pBHE->period ( guard );
1285  }
1286  }
1287  }
1288  return - DBL_MAX;
1289 }
struct sockaddr sa
Definition: osiSock.h:158
struct sockaddr_in ia
Definition: osiSock.h:157
virtual osiSockAddr getNetworkAddress(epicsGuard< epicsMutex > &) const =0
Definition: netiiu.cpp:118
T * lookup(const ID &idIn) const
Definition: resourceLib.h:342
const netiiu * getConstPIIU(epicsGuard< epicsMutex > &) const
Definition: nciu.h:337
Definition: bhe.h:45
LIBCA_API double period(epicsGuard< epicsMutex > &) const
Definition: bhe.cpp:302
Definition: netiiu.h:37
unsigned cac::circuitCount ( epicsGuard< epicsMutex > &  guard) const
virtual

Implements cacContext.

Definition at line 399 of file cac.cpp.

401 {
402  guard.assertIdenticalMutex ( this->mutex );
403  return this->circuitList.count ();
404 }
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
unsigned count() const
Definition: tsDLList.h:181
double cac::connectionTimeout ( epicsGuard< epicsMutex > &  guard)
inline

Definition at line 420 of file cac.h.

421 {
422  guard.assertIdenticalMutex ( this->mutex );
423  return this->connTMO;
424 }
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
cacChannel & cac::createChannel ( epicsGuard< epicsMutex > &  guard,
const char *  pChannelName,
cacChannelNotify chan,
cacChannel::priLev  pri 
)
virtual

Implements cacContext.

Definition at line 508 of file cac.cpp.

511 {
512  guard.assertIdenticalMutex ( this->mutex );
513 
514  if ( pri > cacChannel::priorityMax ) {
515  throw cacChannel::badPriority ();
516  }
517 
518  if ( pName == 0 || pName[0] == '\0' ) {
519  throw cacChannel::badString ();
520  }
521 
522  if ( ! this->pudpiiu ) {
523  this->pudpiiu = new udpiiu (
524  guard, this->timerQueue, this->cbMutex,
525  this->mutex, this->notify, *this, this->_serverPort,
526  this->searchDestList );
527  }
528 
529  nciu * pNetChan = new ( this->channelFreeList )
530  nciu ( *this, noopIIU, chan, pName, pri );
531  this->chanTable.idAssignAdd ( *pNetChan );
532  return *pNetChan;
533 }
static const priLev priorityMax
Definition: cacIO.h:166
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
void idAssignAdd(ITEM &item)
Definition: resourceLib.h:964
Definition: udpiiu.h:79
noopiiu noopIIU
Definition: noopiiu.cpp:28
Definition: nciu.h:127
void cac::destroyChannel ( epicsGuard< epicsMutex > &  guard,
nciu chan 
)

Definition at line 659 of file cac.cpp.

662 {
663  guard.assertIdenticalMutex ( this->mutex );
664 
665  // uninstall channel so that recv threads
666  // will not start a new callback for this channel's IO.
667  if ( this->chanTable.remove ( chan ) != & chan ) {
668  throw std::logic_error ( "Invalid channel identifier" );
669  }
670  chan.~nciu ();
671  this->channelFreeList.release ( & chan );
672 }
~nciu()
Definition: nciu.cpp:69
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
T * remove(const ID &idIn)
Definition: resourceLib.h:297
void release(void *p)
Definition: tsFreeList.h:176
void cac::destroyIIU ( tcpiiu iiu)

Definition at line 1227 of file cac.cpp.

1228 {
1229  {
1230  callbackManager mgr ( this->notify, this->cbMutex );
1231  epicsGuard < epicsMutex > guard ( this->mutex );
1232 
1233  if ( iiu.channelCount ( guard ) ) {
1234  char hostNameTmp[64];
1235  iiu.getHostName ( guard, hostNameTmp, sizeof ( hostNameTmp ) );
1236  genLocalExcep ( mgr.cbGuard, guard, *this, ECA_DISCONN, hostNameTmp );
1237  }
1238  osiSockAddr addr = iiu.getNetworkAddress ( guard );
1239  if ( addr.sa.sa_family == AF_INET ) {
1240  inetAddrID tmp ( addr.ia );
1241  bhe * pBHE = this->beaconTable.lookup ( tmp );
1242  if ( pBHE ) {
1243  pBHE->unregisterIIU ( guard, iiu );
1244  }
1245  }
1246 
1247  assert ( this->pudpiiu );
1248  iiu.disconnectAllChannels ( mgr.cbGuard, guard, *this->pudpiiu );
1249 
1250  this->serverTable.remove ( iiu );
1251  this->circuitList.remove ( iiu );
1252  }
1253 
1254  // this destroys a timer that takes the primary mutex
1255  // so we must not hold the primary mutex here
1256  //
1257  // this waits for send/recv threads to exit
1258  // this also uses the cac free lists so cac must wait
1259  // for this to finish before it shuts down
1260 
1261  iiu.~tcpiiu ();
1262 
1263  {
1264  epicsGuard < epicsMutex > guard ( this->mutex );
1265  this->freeListVirtualCircuit.release ( & iiu );
1266  this->iiuExistenceCount--;
1267  // signal iiu uninstall event so that cac can properly shut down
1268  this->iiuUninstall.signal();
1269  }
1270  // do not touch "this" after lock is released above
1271 }
void disconnectAllChannels(epicsGuard< epicsMutex > &cbGuard, epicsGuard< epicsMutex > &guard, class udpiiu &)
Definition: tcpiiu.cpp:1806
#define assert(exp)
Declare that a condition should be true.
Definition: epicsAssert.h:70
osiSockAddr getNetworkAddress(epicsGuard< epicsMutex > &) const
Definition: tcpiiu.cpp:1769
struct sockaddr sa
Definition: osiSock.h:158
struct sockaddr_in ia
Definition: osiSock.h:157
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > & guard
Definition: cac.h:164
T * lookup(const ID &idIn) const
Definition: resourceLib.h:342
#define ECA_DISCONN
Definition: caerr.h:101
Definition: bhe.h:45
~tcpiiu()
Definition: tcpiiu.cpp:1014
LIBCA_API void unregisterIIU(epicsGuard< epicsMutex > &, tcpiiu &)
Definition: bhe.cpp:321
T * remove(const ID &idIn)
Definition: resourceLib.h:297
#define genLocalExcep(CBGUARD, GUARD, CAC, STAT, PCTX)
Definition: iocinf.h:66
void release(void *p)
Definition: tsFreeList.h:176
void remove(T &item)
Definition: tsDLList.h:219
unsigned channelCount(epicsGuard< epicsMutex > &)
Definition: tcpiiu.cpp:2113
unsigned getHostName(epicsGuard< epicsMutex > &, char *pBuf, unsigned bufLength) const
Definition: tcpiiu.cpp:1791
bool cac::destroyIO ( CallbackGuard callbackGuard,
epicsGuard< epicsMutex > &  mutualExclusionGuard,
const cacChannel::ioid idIn,
nciu chan 
)

Definition at line 734 of file cac.cpp.

738 {
739  guard.assertIdenticalMutex ( this->mutex );
740 
741  baseNMIU * pIO = this->ioTable.remove ( idIn );
742  if ( pIO ) {
743  class netSubscription * pSubscr = pIO->isSubscription ();
744  if ( pSubscr ) {
745  pSubscr->unsubscribeIfRequired ( guard, chan );
746  }
747 
748  // this uninstalls from the list and destroys the IO
749  pIO->exception ( guard, *this,
750  ECA_CHANDESTROY, chan.pName ( guard ) );
751  return true;
752  }
753  return false;
754 }
Definition: netIO.h:44
const char * pName(epicsGuard< epicsMutex > &) const
Definition: nciu.cpp:226
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > & guard
Definition: cac.h:164
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
virtual class netSubscription * isSubscription()=0
T * remove(const ID &idIn)
Definition: resourceLib.h:297
void unsubscribeIfRequired(epicsGuard< epicsMutex > &guard, nciu &chan)
#define ECA_CHANDESTROY
Definition: caerr.h:132
void cac::disconnectAllIO ( epicsGuard< epicsMutex > &  cbGuard,
epicsGuard< epicsMutex > &  guard,
nciu chan,
tsDLList< baseNMIU > &  ioList 
)

Definition at line 674 of file cac.cpp.

678 {
679  cbGuard.assertIdenticalMutex ( this->cbMutex );
680  guard.assertIdenticalMutex ( this->mutex );
681  char buf[128];
682  chan.getHostName ( guard, buf, sizeof ( buf ) );
683 
684  tsDLIter < baseNMIU > pNetIO = ioList.firstIter();
685  while ( pNetIO.valid () ) {
686  tsDLIter < baseNMIU > pNext = pNetIO;
687  pNext++;
688  if ( ! pNetIO->isSubscription() ) {
689  this->ioTable.remove ( pNetIO->getId () );
690  }
691  pNetIO->exception ( guard, *this, ECA_DISCONN, buf );
692  pNetIO = pNext;
693  }
694 }
unsigned getHostName(epicsGuard< epicsMutex > &, char *pBuf, unsigned bufLen) const
Definition: nciu.cpp:398
tsDLIterConst< T > firstIter() const
Definition: tsDLList.h:459
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
const T getId() const
Definition: resourceLib.h:1021
bool valid() const
Definition: tsDLList.h:607
#define ECA_DISCONN
Definition: caerr.h:101
virtual class netSubscription * isSubscription()=0
T * remove(const ID &idIn)
Definition: resourceLib.h:297
bool cac::executeResponse ( callbackManager mgr,
tcpiiu iiu,
const epicsTime &  currentTime,
caHdrLargeArray hdr,
char *  pMsgBody 
)

Definition at line 1204 of file cac.cpp.

1206 {
1207  // execute the response message
1208  pProtoStubTCP pStub;
1209  if ( hdr.m_cmmd >= NELEMENTS ( cac::tcpJumpTableCAC ) ) {
1210  pStub = &cac::badTCPRespAction;
1211  }
1212  else {
1213  pStub = cac::tcpJumpTableCAC [hdr.m_cmmd];
1214  }
1215  return ( this->*pStub ) ( mgr, iiu, currentTime, hdr, pMshBody );
1216 }
#define NELEMENTS(A)
Definition: aToIPAddr.c:21
int(* pProtoStubTCP)(caHdrLargeArray *mp, void *pPayload, struct client *client)
Definition: camessage.c:2315
ca_uint16_t m_cmmd
bool cac::findOrCreateVirtCircuit ( epicsGuard< epicsMutex > &  guard,
const osiSockAddr addr,
unsigned  priority,
tcpiiu *&  piiu,
unsigned  minorVersionNumber,
SearchDestTCP pSearchDest = NULL 
)

Definition at line 535 of file cac.cpp.

539 {
540  guard.assertIdenticalMutex ( this->mutex );
541  bool newIIU = false;
542 
543  if ( piiu ) {
544  if ( ! piiu->alive ( guard ) ) {
545  return newIIU;
546  }
547  }
548  else {
549  try {
551  this->freeListVirtualCircuit,
552  new ( this->freeListVirtualCircuit ) tcpiiu (
553  *this, this->mutex, this->cbMutex, this->notify, this->connTMO,
554  this->timerQueue, addr, this->comBufMemMgr, minorVersionNumber,
555  this->ipToAEngine, priority, pSearchDest ) );
556 
557  bhe * pBHE = this->beaconTable.lookup ( addr.ia );
558  if ( ! pBHE ) {
559  pBHE = new ( this->bheFreeList )
560  bhe ( this->mutex, epicsTime (), 0u, addr.ia );
561  if ( this->beaconTable.add ( *pBHE ) < 0 ) {
562  return newIIU;
563  }
564  }
565  this->serverTable.add ( *pnewiiu );
566  this->circuitList.add ( *pnewiiu );
567  this->iiuExistenceCount++;
568  pBHE->registerIIU ( guard, *pnewiiu );
569  piiu = pnewiiu.release ();
570  newIIU = true;
571  }
572  catch ( std :: exception & except ) {
573  errlogPrintf (
574  "CAC: exception during virtual circuit creation \"%s\"\n",
575  except.what () );
576  return newIIU;
577  }
578  catch ( ... ) {
579  errlogPrintf (
580  "CAC: Nonstandard exception during virtual circuit creation\n" );
581  return newIIU;
582  }
583  }
584  return newIIU;
585 }
void add(T &item)
Definition: tsDLList.h:313
int add(T &res)
Definition: resourceLib.h:643
struct sockaddr_in ia
Definition: osiSock.h:157
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
T * lookup(const ID &idIn) const
Definition: resourceLib.h:342
LIBCA_API void registerIIU(epicsGuard< epicsMutex > &, tcpiiu &)
Definition: bhe.cpp:314
bool alive(epicsGuard< epicsMutex > &) const
Definition: bhe.h:45
int errlogPrintf(const char *pFormat,...)
Definition: errlog.c:105
void cac::flush ( epicsGuard< epicsMutex > &  guard)
virtual

Implements cacContext.

Definition at line 389 of file cac.cpp.

390 {
391  guard.assertIdenticalMutex ( this->mutex );
392  tsDLIter < tcpiiu > iter = this->circuitList.firstIter ();
393  while ( iter.valid () ) {
394  iter->flushRequest ( guard );
395  iter++;
396  }
397 }
void flushRequest(epicsGuard< epicsMutex > &)
Definition: tcpiiu.cpp:2038
tsDLIterConst< T > firstIter() const
Definition: tsDLList.h:459
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
bool valid() const
Definition: tsDLList.h:607
unsigned cac::getInitializingThreadsPriority ( ) const
inline

Definition at line 353 of file cac.h.

354 {
355  return this->initializingThreadsPriority;
356 }
unsigned cac::highestPriorityLevelBelow ( unsigned  priority)
static

Definition at line 374 of file cac.cpp.

375 {
376  unsigned belowPriority;
379  priority, & belowPriority );
380  if ( tbs != epicsThreadBooleanStatusSuccess ) {
381  belowPriority = priority;
382  }
383  return belowPriority;
384 }
epicsThreadBooleanStatus
Definition: epicsThread.h:93
LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadHighestPriorityLevelBelow(unsigned int priority, unsigned *pPriorityJustBelow)
Definition: osdThread.c:740
void cac::initiateConnect ( epicsGuard< epicsMutex > &  guard,
nciu chan,
netiiu *&  piiu 
)

Definition at line 1291 of file cac.cpp.

1294 {
1295  guard.assertIdenticalMutex ( this->mutex );
1296  assert ( this->pudpiiu );
1297  this->pudpiiu->installNewChannel ( guard, chan, piiu );
1298 }
#define assert(exp)
Declare that a condition should be true.
Definition: epicsAssert.h:70
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
void installNewChannel(epicsGuard< epicsMutex > &, nciu &, netiiu *&)
Definition: udpiiu.cpp:1255
void cac::ioShow ( epicsGuard< epicsMutex > &  guard,
const cacChannel::ioid id,
unsigned  level 
) const

Definition at line 756 of file cac.cpp.

759 {
760  baseNMIU * pmiu = this->ioTable.lookup ( idIn );
761  if ( pmiu ) {
762  pmiu->show ( guard, level );
763  }
764 }
virtual void show(unsigned level) const =0
Definition: netIO.h:44
T * lookup(const ID &idIn) const
Definition: resourceLib.h:342
nciu * cac::lookupChannel ( epicsGuard< epicsMutex > &  guard,
const cacChannel::ioid idIn 
)
inline

Definition at line 400 of file cac.h.

403 {
404  guard.assertIdenticalMutex ( this->mutex );
405  return this->chanTable.lookup ( idIn );
406 }
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
T * lookup(const ID &idIn) const
Definition: resourceLib.h:342
unsigned cac::lowestPriorityLevelAbove ( unsigned  priority)
static

Definition at line 362 of file cac.cpp.

363 {
364  unsigned abovePriority;
367  priority, & abovePriority );
368  if ( tbs != epicsThreadBooleanStatusSuccess ) {
369  abovePriority = priority;
370  }
371  return abovePriority;
372 }
epicsThreadBooleanStatus
Definition: epicsThread.h:93
LIBCOM_API epicsThreadBooleanStatus epicsStdCall epicsThreadLowestPriorityLevelAbove(unsigned int priority, unsigned *pPriorityJustAbove)
Definition: osdThread.c:757
unsigned cac::maxContiguousFrames ( epicsGuard< epicsMutex > &  ) const
inline

Definition at line 414 of file cac.h.

415 {
416  return maxContigFrames;
417 }
epicsMutex & cac::mutexRef ( )
inline

Definition at line 358 of file cac.h.

359 {
360  return this->mutex;
361 }
const char * cac::pLocalHostName ( )
inline

Definition at line 408 of file cac.h.

409 {
410  return _refLocalHostName->pointer ();
411 }
int cac::printFormated ( epicsGuard< epicsMutex > &  callbackControl,
const char *  pformat,
  ... 
) const

Definition at line 696 of file cac.cpp.

699 {
700  va_list theArgs;
701  va_start ( theArgs, pformat );
702  int status = this->varArgsPrintFormated ( callbackControl, pformat, theArgs );
703  va_end ( theArgs );
704  return status;
705 }
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int status
Definition: cac.h:164
int varArgsPrintFormated(epicsGuard< epicsMutex > &callbackControl, const char *pformat, va_list args) const
Definition: cac.h:363
netReadNotifyIO & cac::readNotifyRequest ( epicsGuard< epicsMutex > &  guard,
nciu chan,
privateInterfaceForIO icni,
unsigned  type,
arrayElementCount  nElem,
cacReadNotify notifyIn 
)

Definition at line 721 of file cac.cpp.

724 {
725  guard.assertIdenticalMutex ( this->mutex );
727  guard, this->ioTable, *this,
728  netReadNotifyIO::factory ( this->freeListReadNotifyIO, icni, notifyIn ) );
729  this->ioTable.idAssignAdd ( *pIO );
730  chan.getPIIU(guard)->readNotifyRequest ( guard, chan, *pIO, type, nElem );
731  return *pIO.release();
732 }
pvd::StructureConstPtr type
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
virtual void readNotifyRequest(epicsGuard< epicsMutex > &, nciu &, netReadNotifyIO &, unsigned type, arrayElementCount nElem)=0
Definition: netiiu.cpp:64
netiiu * getPIIU(epicsGuard< epicsMutex > &)
Definition: nciu.h:321
void idAssignAdd(ITEM &item)
Definition: resourceLib.h:964
static netReadNotifyIO * factory(tsFreeList< class netReadNotifyIO, 1024, epicsMutexNOOP > &, privateInterfaceForIO &, cacReadNotify &)
Definition: netIO.h:263
void cac::registerSearchDest ( epicsGuard< epicsMutex > &  guard,
SearchDest req 
)

Definition at line 1329 of file cac.cpp.

1332 {
1333  guard.assertIdenticalMutex ( this->mutex );
1334  this->searchDestList.add ( req );
1335 }
void add(T &item)
Definition: tsDLList.h:313
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
void cac::selfTest ( epicsGuard< epicsMutex > &  guard) const
virtual

Implements cacContext.

Definition at line 1218 of file cac.cpp.

1220 {
1221  guard.assertIdenticalMutex ( this->mutex );
1222  this->chanTable.verify ();
1223  this->ioTable.verify ();
1224  this->beaconTable.verify ();
1225 }
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
void verify() const
Definition: resourceLib.h:432
void cac::show ( epicsGuard< epicsMutex > &  guard,
unsigned  level 
) const
virtual

Implements cacContext.

Definition at line 406 of file cac.cpp.

408 {
409  guard.assertIdenticalMutex ( this->mutex );
410 
411  ::printf ( "Channel Access Client Context at %p for user %s\n",
412  static_cast <const void *> ( this ), this->pUserName );
413  // this also supresses the "defined, but not used"
414  // warning message
415  ::printf ( "\trevision \"%s\"\n", pVersionCAC );
416 
417  if ( level > 0u ) {
418  this->serverTable.show ( level - 1u );
419  ::printf ( "\tconnection time out watchdog period %f\n", this->connTMO );
420  }
421 
422  if ( level > 1u ) {
423  if ( this->pudpiiu ) {
424  this->pudpiiu->show ( level - 2u );
425  }
426  }
427 
428  if ( level > 2u ) {
429  ::printf ( "Program begin time:\n");
430  this->programBeginTime.show ( level - 3u );
431  ::printf ( "Channel identifier hash table:\n" );
432  this->chanTable.show ( level - 3u );
433  ::printf ( "IO identifier hash table:\n" );
434  this->ioTable.show ( level - 3u );
435  ::printf ( "Beacon source identifier hash table:\n" );
436  this->beaconTable.show ( level - 3u );
437  ::printf ( "Timer queue:\n" );
438  this->timerQueue.show ( level - 3u );
439  ::printf ( "IP address to name conversion engine:\n" );
440  this->ipToAEngine.show ( level - 3u );
441  }
442 
443  if ( level > 3u ) {
444  ::printf ( "Default mutex:\n");
445  this->mutex.show ( level - 4u );
446  ::printf ( "mutex:\n" );
447  this->mutex.show ( level - 4u );
448  }
449 }
void show(unsigned int level) const
Definition: timerQueue.cpp:214
#define printf
Definition: epicsStdio.h:41
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
void show(unsigned level) const
Definition: udpiiu.cpp:1143
void show(unsigned level) const
Definition: resourceLib.h:371
virtual void show(unsigned level) const =0
netSubscription & cac::subscriptionRequest ( epicsGuard< epicsMutex > &  guard,
nciu chan,
privateInterfaceForIO privChan,
unsigned  type,
arrayElementCount  nElem,
unsigned  mask,
cacStateNotify notifyIn,
bool  channelIsInstalled 
)

Definition at line 809 of file cac.cpp.

816 {
817  guard.assertIdenticalMutex ( this->mutex );
819  guard, this->ioTable, *this,
820  netSubscription::factory ( this->freeListSubscription,
821  privChan, type, nElem, mask, notifyIn ) );
822  this->ioTable.idAssignAdd ( *pIO );
823  if ( chanIsInstalled ) {
824  pIO->subscribeIfRequired ( guard, chan );
825  }
826  return *pIO.release ();
827 }
static netSubscription * factory(tsFreeList< class netSubscription, 1024, epicsMutexNOOP > &, class privateInterfaceForIO &, unsigned type, arrayElementCount count, unsigned mask, cacStateNotify &)
Definition: netIO.h:231
pvd::StructureConstPtr type
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
void idAssignAdd(ITEM &item)
Definition: resourceLib.h:964
void cac::transferChanToVirtCircuit ( unsigned  cid,
unsigned  sid,
ca_uint16_t  typeCode,
arrayElementCount  count,
unsigned  minorVersionNumber,
const osiSockAddr addr,
const epicsTime &  currentTime 
)

Definition at line 587 of file cac.cpp.

592 {
593  if ( addr.sa.sa_family != AF_INET ) {
594  return;
595  }
596 
597  epicsGuard < epicsMutex > guard ( this->mutex );
598 
599  /*
600  * Do not open new circuits while the cac is shutting down
601  */
602  if ( this->cacShutdownInProgress ) {
603  return;
604  }
605 
606  /*
607  * ignore search replies for deleted channels
608  */
609  nciu * pChan = this->chanTable.lookup ( cid );
610  if ( ! pChan ) {
611  return;
612  }
613 
614  /*
615  * Ignore duplicate search replies
616  */
617  osiSockAddr chanAddr = pChan->getPIIU(guard)->getNetworkAddress (guard);
618 
619  if ( chanAddr.sa.sa_family != AF_UNSPEC ) {
620  if ( ! sockAddrAreIdentical ( &addr, &chanAddr ) ) {
621  char acc[64];
622  pChan->getPIIU(guard)->getHostName ( guard, acc, sizeof ( acc ) );
623  msgForMultiplyDefinedPV * pMsg = new ( this->mdpvFreeList )
624  msgForMultiplyDefinedPV ( this->ipToAEngine,
625  *this, pChan->pName ( guard ), acc );
626  // cac keeps a list of these objects for proper clean-up in ~cac
627  this->msgMultiPVList.add ( *pMsg );
628  // It is possible for the ioInitiate call below to
629  // call the callback directly if queue quota is exceeded.
630  // This callback takes the callback lock and therefore we
631  // must release the primary mutex here to avoid a lock
632  // hierarchy inversion.
634  pMsg->ioInitiate ( addr );
635  }
636  return;
637  }
638 
639  caServerID servID ( addr.ia, pChan->getPriority(guard) );
640  tcpiiu * piiu = this->serverTable.lookup ( servID );
641 
642  bool newIIU = findOrCreateVirtCircuit (
643  guard, addr,
644  pChan->getPriority(guard), piiu, minorVersionNumber );
645 
646  // must occur before moving to new iiu
648  guard, *pChan, currentTime );
649  if ( piiu ) {
650  piiu->installChannel (
651  guard, *pChan, sid, typeCode, count );
652 
653  if ( newIIU ) {
654  piiu->start ( guard );
655  }
656  }
657 }
void add(T &item)
Definition: tsDLList.h:313
struct sockaddr sa
Definition: osiSock.h:158
struct sockaddr_in ia
Definition: osiSock.h:157
const char * pName(epicsGuard< epicsMutex > &) const
Definition: nciu.cpp:226
void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > & guard
Definition: cac.h:164
virtual osiSockAddr getNetworkAddress(epicsGuard< epicsMutex > &) const =0
Definition: netiiu.cpp:118
T * lookup(const ID &idIn) const
Definition: resourceLib.h:342
virtual unsigned getHostName(epicsGuard< epicsMutex > &, char *pBuf, unsigned bufLength) const =0
Definition: netiiu.cpp:93
netiiu * getPIIU(epicsGuard< epicsMutex > &)
Definition: nciu.h:321
cacChannel::priLev getPriority(epicsGuard< epicsMutex > &) const
Definition: nciu.h:348
virtual void uninstallChanDueToSuccessfulSearchResponse(epicsGuard< epicsMutex > &, nciu &, const class epicsTime &currentTime)=0
Definition: netiiu.cpp:159
void ioInitiate(const osiSockAddr &rej)
bool findOrCreateVirtCircuit(epicsGuard< epicsMutex > &, const osiSockAddr &, unsigned, tcpiiu *&, unsigned, SearchDestTCP *pSearchDest=NULL)
Definition: cac.cpp:535
int epicsStdCall sockAddrAreIdentical(const osiSockAddr *plhs, const osiSockAddr *prhs)
Definition: osiSock.c:35
Definition: nciu.h:127
const char * cac::userNamePointer ( ) const
inline

Definition at line 348 of file cac.h.

349 {
350  return this->pUserName;
351 }
int cac::varArgsPrintFormated ( epicsGuard< epicsMutex > &  callbackControl,
const char *  pformat,
va_list  args 
) const
inline

Definition at line 363 of file cac.h.

366 {
367  callbackControl.assertIdenticalMutex ( this->cbMutex );
368  return this->notify.varArgsPrintFormated ( pformat, args );
369 }
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
virtual int varArgsPrintFormated(const char *pformat, va_list args) const =0
netWriteNotifyIO & cac::writeNotifyRequest ( epicsGuard< epicsMutex > &  guard,
nciu chan,
privateInterfaceForIO icni,
unsigned  type,
arrayElementCount  nElem,
const void *  pValue,
cacWriteNotify notifyIn 
)

Definition at line 707 of file cac.cpp.

710 {
711  guard.assertIdenticalMutex ( this->mutex );
713  guard, this->ioTable, *this,
714  netWriteNotifyIO::factory ( this->freeListWriteNotifyIO, icni, notifyIn ) );
715  this->ioTable.idAssignAdd ( *pIO );
716  chan.getPIIU(guard)->writeNotifyRequest (
717  guard, chan, *pIO, type, nElem, pValue );
718  return *pIO.release();
719 }
static netWriteNotifyIO * factory(tsFreeList< class netWriteNotifyIO, 1024, epicsMutexNOOP > &, privateInterfaceForIO &, cacWriteNotify &)
Definition: netIO.h:284
pvd::StructureConstPtr type
void assertIdenticalMutex(const T &) const
Definition: epicsGuard.h:80
netiiu * getPIIU(epicsGuard< epicsMutex > &)
Definition: nciu.h:321
void idAssignAdd(ITEM &item)
Definition: resourceLib.h:964
virtual void writeNotifyRequest(epicsGuard< epicsMutex > &, nciu &, netWriteNotifyIO &, unsigned type, arrayElementCount nElem, const void *pValue)=0
Definition: netiiu.cpp:56

Friends And Related Function Documentation

friend class tcpiiu
friend

Definition at line 345 of file cac.h.

Member Data Documentation

void exception epicsGuard< epicsMutex >& cac::cbGuard

Definition at line 164 of file cac.h.

void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex >& cac::guard

Definition at line 164 of file cac.h.

void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int const char const char unsigned cac::lineNo

Definition at line 164 of file cac.h.

void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int const char* cac::pContext

Definition at line 164 of file cac.h.

void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int const char const char* cac::pFileName

Definition at line 164 of file cac.h.

void exception epicsGuard< epicsMutex > epicsGuard< epicsMutex > int cac::status

Definition at line 164 of file cac.h.


The documentation for this class was generated from the following files: