diff --git a/TODO b/TODO new file mode 100644 index 0000000..0726a7b --- /dev/null +++ b/TODO @@ -0,0 +1,7 @@ +redefine size encoding to be able to carry negative values (to handle negative offsets), i.e. -128 means take larger integer size (same pattern for 32-bit integer). This also bings symmetric integer range (-value ... value). + +opt) connection validation message sends max paylaod size +readSize checks if size is in limits of size_t? + + + diff --git a/pvAccessApp/ca/caConstants.h b/pvAccessApp/ca/caConstants.h index 97edede..9c05795 100644 --- a/pvAccessApp/ca/caConstants.h +++ b/pvAccessApp/ca/caConstants.h @@ -15,26 +15,17 @@ namespace pvAccess { /** CA protocol magic number */ const epics::pvData::int8 CA_MAGIC = 0xCA; - /** CA protocol major revision (implemented by this library). */ - const epics::pvData::int8 CA_MAJOR_PROTOCOL_REVISION = 5; - - /** CA protocol minor revision (implemented by this library). */ - const epics::pvData::int8 CA_MINOR_PROTOCOL_REVISION = 0; - - /** Unknown CA protocol minor revision. */ - const epics::pvData::int8 CA_UNKNOWN_MINOR_PROTOCOL_REVISION = 0; - - /** CA version signature (e.g. 0x50). */ - const epics::pvData::int8 CA_VERSION = ((uint8_t)CA_MAJOR_PROTOCOL_REVISION<<4)|CA_MINOR_PROTOCOL_REVISION; - - /** CA protocol port base. */ - const epics::pvData::int32 CA_PORT_BASE = 5056; + /** CA protocol revision (implemented by this library). */ + const epics::pvData::int8 CA_PROTOCOL_REVISION = 0; + /** CA version signature used to report this implementation version in header. */ + const epics::pvData::int8 CA_VERSION = CA_PROTOCOL_REVISION; + /** Default CA server port. */ - const epics::pvData::int32 CA_SERVER_PORT = CA_PORT_BASE+2*CA_MAJOR_PROTOCOL_REVISION; + const epics::pvData::int32 CA_SERVER_PORT = 5075; /** Default CA beacon port. */ - const epics::pvData::int32 CA_BROADCAST_PORT = CA_SERVER_PORT+1; + const epics::pvData::int32 CA_BROADCAST_PORT = 5076; /** CA protocol message header size. */ const epics::pvData::int16 CA_MESSAGE_HEADER_SIZE = 8; diff --git a/pvAccessApp/remote/blockingTCPTransport.cpp b/pvAccessApp/remote/blockingTCPTransport.cpp index 1bec0f1..34799f2 100644 --- a/pvAccessApp/remote/blockingTCPTransport.cpp +++ b/pvAccessApp/remote/blockingTCPTransport.cpp @@ -580,7 +580,7 @@ namespace pvAccess { // second byte version - major/minor nibble int8 magic = _socketBuffer->getByte(); _version = _socketBuffer->getByte(); - if(unlikely((magic != CA_MAGIC) || (((uint8_t)_version) >> 4)!=CA_MAJOR_PROTOCOL_REVISION)) + if(unlikely(magic != CA_MAGIC)) { // error... disconnect LOG( diff --git a/pvAccessApp/remote/blockingUDPTransport.cpp b/pvAccessApp/remote/blockingUDPTransport.cpp index 4b724e3..b5934b2 100644 --- a/pvAccessApp/remote/blockingUDPTransport.cpp +++ b/pvAccessApp/remote/blockingUDPTransport.cpp @@ -259,7 +259,7 @@ namespace epics { // second byte version - major/minor nibble int8 magic = receiveBuffer->getByte(); int8 version = receiveBuffer->getByte(); - if(unlikely((magic != CA_MAGIC) || (((uint8_t)version) >> 4)!=CA_MAJOR_PROTOCOL_REVISION)) + if(unlikely(magic != CA_MAGIC)) return false; // only data for UDP diff --git a/pvAccessApp/remote/remote.h b/pvAccessApp/remote/remote.h index e0df5a2..59b6535 100644 --- a/pvAccessApp/remote/remote.h +++ b/pvAccessApp/remote/remote.h @@ -164,20 +164,12 @@ namespace epics { */ virtual const epics::pvData::String getType() const = 0; - /** - * Transport protocol major revision. - * @return protocol major revision. - */ - virtual epics::pvData::int8 getMajorRevision() const { - return CA_MAJOR_PROTOCOL_REVISION; - } - /** * Transport protocol minor revision. * @return protocol minor revision. */ - virtual epics::pvData::int8 getMinorRevision() const { - return CA_MINOR_PROTOCOL_REVISION; + virtual epics::pvData::int8 getRevision() const { + return CA_PROTOCOL_REVISION; } /** diff --git a/pvAccessApp/remoteClient/clientContextImpl.cpp b/pvAccessApp/remoteClient/clientContextImpl.cpp index a464732..f1ab61a 100644 --- a/pvAccessApp/remoteClient/clientContextImpl.cpp +++ b/pvAccessApp/remoteClient/clientContextImpl.cpp @@ -3943,7 +3943,7 @@ TODO auto_ptr broadcastConnector(new BlockingUDPConnector(true, true)); m_broadcastTransport = static_pointer_cast(broadcastConnector->connect( nullTransportClient, clientResponseHandler, - listenLocalAddress, CA_MINOR_PROTOCOL_REVISION, + listenLocalAddress, CA_PROTOCOL_REVISION, CA_DEFAULT_PRIORITY)); if (!m_broadcastTransport.get()) return false; @@ -3959,7 +3959,7 @@ TODO auto_ptr searchConnector(new BlockingUDPConnector(false, true)); m_searchTransport = static_pointer_cast(searchConnector->connect( nullTransportClient, clientResponseHandler, - undefinedAddress, CA_MINOR_PROTOCOL_REVISION, + undefinedAddress, CA_PROTOCOL_REVISION, CA_DEFAULT_PRIORITY)); if (!m_searchTransport.get()) return false; diff --git a/pvAccessApp/server/serverContext.cpp b/pvAccessApp/server/serverContext.cpp index 29ba985..b1762c0 100644 --- a/pvAccessApp/server/serverContext.cpp +++ b/pvAccessApp/server/serverContext.cpp @@ -218,7 +218,7 @@ void ServerContextImpl::initializeBroadcastTransport() auto_ptr responseHandler = createResponseHandler(); _broadcastTransport = static_pointer_cast(broadcastConnector->connect( nullTransportClient, responseHandler, - listenLocalAddress, CA_MINOR_PROTOCOL_REVISION, + listenLocalAddress, CA_PROTOCOL_REVISION, CA_DEFAULT_PRIORITY)); _broadcastTransport->setBroadcastAddresses(broadcastAddresses.get()); diff --git a/testApp/remote/pvget.cpp b/testApp/remote/pvget.cpp index 6ab0990..def072b 100644 --- a/testApp/remote/pvget.cpp +++ b/testApp/remote/pvget.cpp @@ -419,6 +419,8 @@ class ChannelGetRequesterImpl : public ChannelGetRequester } String str; + + str.reserve(16*1024*1024); // access smart pointers {