Allow CA clients to determine the server protocol version (#711)
* Allow CA clients to determine the server protocol version Adds a call to the CA client API that allows a client to determine the server's protocol minor version number. This is needed to allow the ca-nameserver to report a server's protocol version correctly to a client. * ca_host_minor_protocol return for disconnected channels ca_host_minor_protocol now explicitly returns CA_UKN_MINOR_VERSION for a disconnected channel.
This commit is contained in:
@@ -203,6 +203,7 @@ public:
|
||||
void destroyIIU ( tcpiiu & iiu );
|
||||
|
||||
const char * pLocalHostName ();
|
||||
const resTable < tcpiiu, caServerID > & getServerTable();
|
||||
|
||||
private:
|
||||
epicsSingleton < localHostName > :: reference _refLocalHostName;
|
||||
@@ -424,4 +425,10 @@ inline double cac ::
|
||||
return this->connTMO;
|
||||
}
|
||||
|
||||
inline const resTable < tcpiiu, caServerID > & cac ::
|
||||
getServerTable()
|
||||
{
|
||||
return this->serverTable;
|
||||
}
|
||||
|
||||
#endif // ifndef INC_cac_H
|
||||
|
||||
@@ -129,6 +129,13 @@ unsigned cacChannel::getHostName (
|
||||
return 0u;
|
||||
}
|
||||
|
||||
unsigned cacChannel::getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > &) const throw ()
|
||||
{
|
||||
epicsThreadOnce ( & cacChannelIdOnce, cacChannelSetup, 0);
|
||||
return 0u;
|
||||
}
|
||||
|
||||
// the default is to assume that it is a locally hosted channel
|
||||
const char * cacChannel::pHostName (
|
||||
epicsGuard < epicsMutex > & ) const throw ()
|
||||
|
||||
@@ -246,7 +246,8 @@ public:
|
||||
// !! deprecated, avoid use !!
|
||||
virtual const char * pHostName (
|
||||
epicsGuard < epicsMutex > & guard ) const throw ();
|
||||
|
||||
virtual unsigned getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > &) const throw () ;
|
||||
// exceptions
|
||||
class badString {};
|
||||
class badType {};
|
||||
|
||||
@@ -1460,6 +1460,17 @@ LIBCA_API const char * epicsStdCall ca_host_name (chid channel);
|
||||
LIBCA_API unsigned epicsStdCall ca_get_host_name ( chid pChan,
|
||||
char *pBuf, unsigned bufLength );
|
||||
|
||||
/** \brief Return the minor protocol version number used by the host to
|
||||
* which a channel is cuurently connected.
|
||||
*
|
||||
* \param[in] pChan channel identifier
|
||||
* \returns The minor protocol version number.
|
||||
* If the channel is disconnected CA_UKN_MINOR_VERSION is returned.
|
||||
*/
|
||||
LIBCA_API unsigned epicsStdCall ca_host_minor_protocol (chid pChan);
|
||||
|
||||
#define HAS_CA_HOST_MINOR_PROTOCOL
|
||||
|
||||
/** \brief Call their function with their argument whenever
|
||||
* a new fd is added or removed.
|
||||
*
|
||||
|
||||
@@ -410,6 +410,13 @@ const char * nciu::pHostName (
|
||||
return this->piiu->pHostName ( guard );
|
||||
}
|
||||
|
||||
unsigned nciu::getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > & guard) const throw ()
|
||||
{
|
||||
return this->piiu->getHostMinorProtocol (
|
||||
guard );
|
||||
}
|
||||
|
||||
bool nciu::ca_v42_ok (
|
||||
epicsGuard < epicsMutex > & guard ) const
|
||||
{
|
||||
|
||||
@@ -183,6 +183,8 @@ public:
|
||||
unsigned getHostName (
|
||||
epicsGuard < epicsMutex > &,
|
||||
char * pBuf, unsigned bufLen ) const throw ();
|
||||
unsigned getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > &) const throw ();
|
||||
void writeException (
|
||||
epicsGuard < epicsMutex > &, epicsGuard < epicsMutex > &,
|
||||
int status, const char *pContext, unsigned type, arrayElementCount count );
|
||||
|
||||
@@ -116,6 +116,12 @@ const char * netiiu::pHostName (
|
||||
return pHostNameNetIIU;
|
||||
}
|
||||
|
||||
unsigned netiiu::getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > & ) const throw ()
|
||||
{
|
||||
return CA_UKN_MINOR_VERSION;
|
||||
}
|
||||
|
||||
osiSockAddr netiiu::getNetworkAddress (
|
||||
epicsGuard < epicsMutex > & ) const
|
||||
{
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
unsigned bufLength ) const throw () = 0;
|
||||
virtual const char * pHostName (
|
||||
epicsGuard < epicsMutex > & ) const throw () = 0;
|
||||
virtual unsigned getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > & ) const throw ();
|
||||
virtual bool ca_v41_ok (
|
||||
epicsGuard < epicsMutex > & ) const = 0;
|
||||
virtual bool ca_v42_ok (
|
||||
|
||||
@@ -64,6 +64,8 @@ public:
|
||||
chid pChan, char * pBuf, unsigned bufLength );
|
||||
friend const char * epicsStdCall ca_host_name (
|
||||
chid pChan );
|
||||
friend unsigned epicsStdCall ca_host_minor_protocol (
|
||||
chid pChan );
|
||||
friend const char * epicsStdCall ca_name (
|
||||
chid pChan );
|
||||
friend void epicsStdCall ca_set_puser (
|
||||
|
||||
@@ -193,6 +193,16 @@ const char * epicsStdCall ca_host_name (
|
||||
return pChan->io.pHostName ( guard );
|
||||
}
|
||||
|
||||
/*
|
||||
* ca_host_minorProtocol ()
|
||||
*/
|
||||
unsigned epicsStdCall ca_host_minor_protocol (
|
||||
chid pChan )
|
||||
{
|
||||
epicsGuard < epicsMutex > guard ( pChan->cacCtx.mutexRef () );
|
||||
return pChan->io.getHostMinorProtocol( guard );
|
||||
}
|
||||
|
||||
/*
|
||||
* ca_set_puser ()
|
||||
*/
|
||||
|
||||
@@ -1804,6 +1804,13 @@ const char * tcpiiu::pHostName (
|
||||
return this->hostNameCacheInstance.pointer ();
|
||||
}
|
||||
|
||||
unsigned tcpiiu::getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > & guard) const throw ()
|
||||
{
|
||||
guard.assertIdenticalMutex ( this->mutex );
|
||||
return this->minorProtocolVersion;
|
||||
}
|
||||
|
||||
void tcpiiu::disconnectAllChannels (
|
||||
epicsGuard < epicsMutex > & cbGuard,
|
||||
epicsGuard < epicsMutex > & guard,
|
||||
|
||||
@@ -1342,6 +1342,12 @@ const char * udpiiu::pHostName (
|
||||
return netiiu::pHostName ( cacGuard );
|
||||
}
|
||||
|
||||
unsigned udpiiu::getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > & cacGuard ) const throw ()
|
||||
{
|
||||
return netiiu::getHostMinorProtocol ( cacGuard );
|
||||
}
|
||||
|
||||
bool udpiiu::ca_v42_ok (
|
||||
epicsGuard < epicsMutex > & cacGuard ) const
|
||||
{
|
||||
|
||||
@@ -239,7 +239,9 @@ private:
|
||||
unsigned bufLength ) const throw ();
|
||||
const char * pHostName (
|
||||
epicsGuard < epicsMutex > & ) const throw ();
|
||||
bool ca_v41_ok (
|
||||
unsigned getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > & ) const throw ();
|
||||
bool ca_v41_ok (
|
||||
epicsGuard < epicsMutex > & ) const;
|
||||
bool ca_v42_ok (
|
||||
epicsGuard < epicsMutex > & ) const;
|
||||
|
||||
@@ -168,6 +168,8 @@ public:
|
||||
unsigned getHostName (
|
||||
epicsGuard < epicsMutex > &,
|
||||
char *pBuf, unsigned bufLength ) const throw ();
|
||||
unsigned getHostMinorProtocol (
|
||||
epicsGuard < epicsMutex > &) const throw ();
|
||||
bool alive (
|
||||
epicsGuard < epicsMutex > & ) const;
|
||||
bool connecting (
|
||||
|
||||
Reference in New Issue
Block a user