diff --git a/src/ca/Makefile b/src/ca/Makefile index 38c164792..65f67963d 100644 --- a/src/ca/Makefile +++ b/src/ca/Makefile @@ -53,6 +53,7 @@ LIBSRCS += comQueSend.cpp LIBSRCS += cacPrivateListOfIO.cpp LIBSRCS += hostNameCache.cpp LIBSRCS += ioCounter.cpp +LIBSRCS += msgForMultiplyDefinedPV.cpp LIBRARY=ca diff --git a/src/ca/bhe_IL.h b/src/ca/bhe_IL.h index 0eaa2546d..64c5d71c6 100644 --- a/src/ca/bhe_IL.h +++ b/src/ca/bhe_IL.h @@ -31,7 +31,7 @@ inline bhe::bhe ( class cac &cacIn, const osiTime &initialTimeStamp, const inetA # ifdef DEBUG { char name[64]; - ipAddrToA (&addr, name, sizeof(name)); + ipAddrToDottedIP (&addr, name, sizeof(name)); printf ("created beacon entry for %s\n", name); } # endif diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index 77c4dba64..2a39c2492 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -505,7 +505,7 @@ void cac::beaconNotify ( const inetAddrID &addr ) # if DEBUG { char buf[64]; - ipAddrToA (pnet_addr, buf, sizeof ( buf ) ); + ipAddrToDottedIP (pnet_addr, buf, sizeof ( buf ) ); printf ("new server available: %s\n", buf); } # endif diff --git a/src/ca/cac_IL.h b/src/ca/cac_IL.h index 391a77224..ffcb8eef1 100644 --- a/src/ca/cac_IL.h +++ b/src/ca/cac_IL.h @@ -43,3 +43,9 @@ inline const char * cac::userNamePointer () { return this->pUserName; } + +inline void cac::ipAddrToAsciiAsynchronousRequestInstall ( ipAddrToAsciiAsynchronous & request ) +{ + request.ioInitiate ( this->ipToAEngine ); +} + diff --git a/src/ca/hostNameCache.cpp b/src/ca/hostNameCache.cpp index 65b81d40b..7468043b2 100644 --- a/src/ca/hostNameCache.cpp +++ b/src/ca/hostNameCache.cpp @@ -51,7 +51,7 @@ void hostNameCache::hostName ( char *pBuf, unsigned bufSize ) const } else { osiSockAddr tmpAddr = this->address (); - sockAddrToDottedA ( &tmpAddr.sa, pBuf, bufSize ); + sockAddrToDottedIP ( &tmpAddr.sa, pBuf, bufSize ); } pBuf [ bufSize - 1u ] = '\0'; } diff --git a/src/ca/iocinf.cpp b/src/ca/iocinf.cpp index 243e3911e..b1179bd01 100644 --- a/src/ca/iocinf.cpp +++ b/src/ca/iocinf.cpp @@ -114,7 +114,7 @@ epicsShareFunc void epicsShareAPI setPortAndRemoveDuplicates if (pNode->addr.ia.sin_addr.s_addr == pTmpNode->addr.ia.sin_addr.s_addr && pNode->addr.ia.sin_port == pTmpNode->addr.ia.sin_port) { char buf[64]; - ipAddrToA ( &pNode->addr.ia, buf, sizeof (buf) ); + ipAddrToDottedIP ( &pNode->addr.ia, buf, sizeof (buf) ); ca_printf ( "Warning: Duplicate EPICS CA Address list entry \"%s\" discarded\n", buf ); free (pNode); pNode = NULL; diff --git a/src/ca/iocinf.h b/src/ca/iocinf.h index 5550cc08b..d230c40fd 100644 --- a/src/ca/iocinf.h +++ b/src/ca/iocinf.h @@ -679,6 +679,23 @@ private: const double period; }; +class msgForMultiplyDefinedPV : public ipAddrToAsciiAsynchronous { +public: + msgForMultiplyDefinedPV ( + cac &cacRefIn, const char *pChannelName, const char *pAcc, + const osiSockAddr &rej ); + msgForMultiplyDefinedPV ( const osiSockAddr &addr, ipAddrToAsciiEngine &engine ); + void * operator new ( size_t size ); + void operator delete ( void *pCadaver, size_t size ); +private: + void ioCompletionNotify ( const char *pHostName ); + char acc[64]; + char channel[64]; + cac &cacRef; + + static tsFreeList < class msgForMultiplyDefinedPV, 16 > freeList; +}; + class hostNameCache : public ipAddrToAsciiAsynchronous { public: hostNameCache ( const osiSockAddr &addr, ipAddrToAsciiEngine &engine ); @@ -1066,6 +1083,7 @@ public: int printf ( const char *pformat, ... ); int vPrintf ( const char *pformat, va_list args ); void replaceErrLogHandler ( caPrintfFunc *ca_printf_func ); + void ipAddrToAsciiAsynchronousRequestInstall ( ipAddrToAsciiAsynchronous & request ); private: ipAddrToAsciiEngine ipToAEngine; diff --git a/src/ca/msgForMultiplyDefinedPV.cpp b/src/ca/msgForMultiplyDefinedPV.cpp new file mode 100644 index 000000000..9223fedf7 --- /dev/null +++ b/src/ca/msgForMultiplyDefinedPV.cpp @@ -0,0 +1,41 @@ + +/* + * $Id$ + * + * + * L O S A L A M O S + * Los Alamos National Laboratory + * Los Alamos, New Mexico 87545 + * + * Copyright, 1986, The Regents of the University of California. + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 + */ + +#include "iocinf.h" +#include "msgForMultiplyDefinedPV_IL.h" + +tsFreeList < class msgForMultiplyDefinedPV, 16 > msgForMultiplyDefinedPV::freeList; + +msgForMultiplyDefinedPV::msgForMultiplyDefinedPV ( + cac &cacRefIn, const char *pChannelName, const char *pAcc, + const osiSockAddr &rej ) : + ipAddrToAsciiAsynchronous ( rej ), + cacRef ( cacRefIn ) +{ + strncpy ( this->acc, pAcc, sizeof ( this->acc ) ); + this->acc[ sizeof ( this->acc ) - 1 ] = '\0'; + strncpy ( this->channel, pChannelName, sizeof ( this->channel ) ); + this->channel[ sizeof ( this->channel ) - 1 ] = '\0'; +} + +void msgForMultiplyDefinedPV::ioCompletionNotify ( const char *pHostNameRej ) +{ + char buf[256]; + sprintf ( buf, "Channel: \"%.64s\", Connecting to: %.64s, Ignored: %.64s", + this->channel, this->acc, pHostNameRej ); + genLocalExcep ( this->cacRef, ECA_DBLCHNL, buf ); +} diff --git a/src/ca/msgForMultiplyDefinedPV_IL.h b/src/ca/msgForMultiplyDefinedPV_IL.h new file mode 100644 index 000000000..e94e3364d --- /dev/null +++ b/src/ca/msgForMultiplyDefinedPV_IL.h @@ -0,0 +1,26 @@ + +/* + * $Id$ + * + * + * L O S A L A M O S + * Los Alamos National Laboratory + * Los Alamos, New Mexico 87545 + * + * Copyright, 1986, The Regents of the University of California. + * + * + * Author Jeffrey O. Hill + * johill@lanl.gov + * 505 665 1831 + */ + +void * msgForMultiplyDefinedPV::operator new ( size_t size ) +{ + return msgForMultiplyDefinedPV::freeList.allocate ( size ); +} + +void msgForMultiplyDefinedPV::operator delete ( void *pCadaver, size_t size ) +{ + msgForMultiplyDefinedPV::freeList.release ( pCadaver, size ); +} \ No newline at end of file diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index 80d8d48ea..c6d5b7298 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -703,14 +703,12 @@ bool tcpiiu::connectionInProgress ( const char *pChannelName, const osiSockAddr { if ( ! this->ipToA.identicalAddress ( addr ) ) { char acc[64]; - char rej[64]; - char buf[256]; - - this->ipToA.hostName ( acc, sizeof (acc) ); - sockAddrToA ( &addr.sa, rej, sizeof (rej) ); - sprintf ( buf, "Channel: \"%.64s\", Connecting to: %.64s, Ignored: %.64s", - pChannelName, acc, rej ); - genLocalExcep ( this->clientCtx (), ECA_DBLCHNL, buf ); + this->ipToA.hostName ( acc, sizeof ( acc ) ); + msgForMultiplyDefinedPV *pMsg = new msgForMultiplyDefinedPV ( + this->clientCtx (), pChannelName, acc, addr ); + if ( pMsg ) { + this->clientCtx ().ipAddrToAsciiAsynchronousRequestInstall ( *pMsg ); + } } return true; } diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index e9ea97a23..0edbdf17c 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -101,7 +101,7 @@ void udpiiu::recvMsg () if ( status != ECA_NORMAL ) { char buf[64]; - sockAddrToA ( &src.sa, buf, sizeof ( buf ) ); + sockAddrToDottedIP ( &src.sa, buf, sizeof ( buf ) ); ca_printf ( "%s: bad UDP msg from %s because \"%s\"\n", __FILE__, @@ -498,7 +498,7 @@ void udpiiu::shutdown () void udpiiu::badUDPRespAction ( const caHdr &msg, const osiSockAddr &netAddr ) { char buf[256]; - sockAddrToA ( &netAddr.sa, buf, sizeof ( buf ) ); + sockAddrToDottedIP ( &netAddr.sa, buf, sizeof ( buf ) ); ca_printf ( "CAC: Bad response code in UDP message from %s was %u\n", buf, msg.m_cmmd); } @@ -630,7 +630,7 @@ void udpiiu::exceptionRespAction ( const caHdr &msg, const osiSockAddr &net_addr const caHdr &reqMsg = * ( &msg + 1 ); char name[64]; - sockAddrToA ( &net_addr.sa, name, sizeof ( name ) ); + sockAddrToDottedIP ( &net_addr.sa, name, sizeof ( name ) ); if ( msg.m_postsize > sizeof ( caHdr ) ){ errlogPrintf ( "error condition \"%s\" detected by %s with context \"%s\"\n", @@ -812,7 +812,7 @@ void udpiiu::flush () else { char buf[64]; - sockAddrToA ( &pNode->addr.sa, buf, sizeof ( buf ) ); + sockAddrToDottedIP ( &pNode->addr.sa, buf, sizeof ( buf ) ); ca_printf ( "CAC: error = \"%s\" sending UDP msg to %s\n",