From 74b5d6093fc85a0ee4662a8f86faac25c9acdb33 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 29 Aug 2001 17:48:02 +0000 Subject: [PATCH] changed noop request to version request --- src/ca/caProto.h | 5 ++++- src/ca/cac.cpp | 2 +- src/ca/repeater.cpp | 2 +- src/ca/tcpiiu.cpp | 24 ++++++++++++++---------- src/ca/udpiiu.cpp | 2 +- src/ca/virtualCircuit.h | 4 ++-- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/ca/caProto.h b/src/ca/caProto.h index b901cc289..5dfcac50a 100644 --- a/src/ca/caProto.h +++ b/src/ca/caProto.h @@ -93,6 +93,9 @@ #define MAX_TCP ( 1024 * 16u ) /* so waveforms fit */ #define MAX_MSG_SIZE ( MAX_TCP ) /* the larger of tcp and udp max */ +#define CA_PROTO_PRIORITY_MIN 0u +#define CA_PROTO_PRIORITY_MAX 99u + /* * architecture independent types * @@ -105,7 +108,7 @@ typedef float ca_float32_t; typedef ca_uint32_t caResId; /* values for m_cmmd */ -#define CA_PROTO_NOOP 0u /* do nothing, but verify TCP */ +#define CA_PROTO_VERSION 0u /* set minor version and priority (used to be NOOP cmd) */ #define CA_PROTO_EVENT_ADD 1u /* add an event */ #define CA_PROTO_EVENT_CANCEL 2u /* cancel an event */ #define CA_PROTO_READ 3u /* read and return a channel value*/ diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index 1770943a2..d30bda80b 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -70,7 +70,7 @@ const cac::pProtoStubTCP cac::tcpJumpTableCAC [] = // TCP exception dispatch table const cac::pExcepProtoStubTCP cac::tcpExcepJumpTableCAC [] = { - &cac::defaultExcep, // CA_PROTO_NOOP + &cac::defaultExcep, // CA_PROTO_VERSION &cac::eventAddExcep, // CA_PROTO_EVENT_ADD &cac::defaultExcep, // CA_PROTO_EVENT_CANCEL &cac::readExcep, // CA_PROTO_READ diff --git a/src/ca/repeater.cpp b/src/ca/repeater.cpp index 93b267710..905497943 100644 --- a/src/ca/repeater.cpp +++ b/src/ca/repeater.cpp @@ -457,7 +457,7 @@ LOCAL void register_new_client ( osiSockAddr &from ) */ caHdr noop; memset ( (char *) &noop, '\0', sizeof ( noop ) ); - noop.m_cmmd = htons ( CA_PROTO_NOOP ); + noop.m_cmmd = htons ( CA_PROTO_VERSION ); fanOut ( from, &noop, sizeof ( noop ) ); if ( newClient ) { diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index d00f4832c..4998315ab 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -78,7 +78,7 @@ extern "C" void cacSendThreadTCP ( void *pParam ) piiu->echoRequest (); } else { - piiu->noopRequest (); + piiu->versionMessage ( piiu->priority() ); } } @@ -217,6 +217,8 @@ extern "C" void cacRecvThreadTCP ( void *pParam ) piiu->connect (); + piiu->versionMessage ( piiu->priority() ); + { callbackAutoMutex autoMutex ( *piiu->pCAC() ); piiu->pCAC()->notifyNewFD ( piiu->sock ); @@ -373,10 +375,10 @@ extern "C" void cacRecvThreadTCP ( void *pParam ) // // tcpiiu::tcpiiu () // -tcpiiu::tcpiiu ( cac &cac, double connectionTimeout, +tcpiiu::tcpiiu ( cac & cac, double connectionTimeout, epicsTimerQueue & timerQueue, const osiSockAddr & addrIn, unsigned minorVersion, ipAddrToAsciiEngine & engineIn, - cacChannel::priLev priorityIn ) : + const cacChannel::priLev & priorityIn ) : netiiu ( &cac ), caServerID ( addrIn.ia, priorityIn ), recvDog ( *this, connectionTimeout, timerQueue ), @@ -989,20 +991,22 @@ void tcpiiu::enableFlowControlRequest () this->sendQue.pushUInt32 ( 0u ); // available } -void tcpiiu::noopRequest () +void tcpiiu::versionMessage ( const cacChannel::priLev & priority ) { + assert ( priority <= 0xffff ); + if ( this->sendQue.flushEarlyThreshold ( 16u ) ) { this->flushRequest (); } epicsAutoMutex locker ( this->pCAC()->mutexRef() ); - this->sendQue.pushUInt16 ( CA_PROTO_NOOP ); // cmd - this->sendQue.pushUInt16 ( 0u ); // postsize - this->sendQue.pushUInt16 ( 0u ); // dataType - this->sendQue.pushUInt16 ( 0u ); // count - this->sendQue.pushUInt32 ( 0u ); // cid - this->sendQue.pushUInt32 ( 0u ); // available + this->sendQue.pushUInt16 ( CA_PROTO_VERSION ); // cmd + this->sendQue.pushUInt16 ( 0u ); // postsize ( old possize field ) + this->sendQue.pushUInt16 ( priority ); // old dataType field + this->sendQue.pushUInt16 ( CA_MINOR_PROTOCOL_REVISION ); // old count field + this->sendQue.pushUInt32 ( 0u ); // ( old cid field ) + this->sendQue.pushUInt32 ( 0u ); // ( old available field ) } void tcpiiu::echoRequest () diff --git a/src/ca/udpiiu.cpp b/src/ca/udpiiu.cpp index 9f234b509..dec6407b2 100644 --- a/src/ca/udpiiu.cpp +++ b/src/ca/udpiiu.cpp @@ -489,7 +489,7 @@ void udpiiu::shutdown () this->shutdownCmd = true; caHdr msg; - msg.m_cmmd = htons ( CA_PROTO_NOOP ); + msg.m_cmmd = htons ( CA_PROTO_VERSION ); msg.m_available = htonl ( 0u ); msg.m_dataType = htons ( 0u ); msg.m_count = htons ( 0u ); diff --git a/src/ca/virtualCircuit.h b/src/ca/virtualCircuit.h index de005307a..323a49594 100644 --- a/src/ca/virtualCircuit.h +++ b/src/ca/virtualCircuit.h @@ -216,7 +216,7 @@ public: tcpiiu ( cac &cac, double connectionTimeout, epicsTimerQueue &timerQueue, const osiSockAddr &addrIn, unsigned minorVersion, ipAddrToAsciiEngine & engineIn, - cacChannel::priLev priorityIn ); + const cacChannel::priLev & priorityIn ); ~tcpiiu (); void connect (); void destroy (); @@ -286,7 +286,7 @@ private: // send protocol stubs void echoRequest (); - void noopRequest (); + void versionMessage ( const cacChannel::priLev & priority ); void disableFlowControlRequest (); void enableFlowControlRequest (); void hostNameSetRequest ();