diff options
Diffstat (limited to 'cppe')
-rwxr-xr-x | cppe/include/IceE/Connection.h | 5 | ||||
-rw-r--r-- | cppe/include/IceE/Protocol.h | 9 | ||||
-rwxr-xr-x | cppe/src/IceE/Connection.cpp | 48 | ||||
-rw-r--r-- | cppe/src/IceE/Makefile | 1 | ||||
-rw-r--r-- | cppe/src/IceE/Outgoing.cpp | 2 | ||||
-rw-r--r-- | cppe/src/IceE/Protocol.cpp | 64 | ||||
-rw-r--r-- | cppe/src/IceEC/Makefile | 1 |
7 files changed, 77 insertions, 53 deletions
diff --git a/cppe/include/IceE/Connection.h b/cppe/include/IceE/Connection.h index e9872c39ab0..20be329ff48 100755 --- a/cppe/include/IceE/Connection.h +++ b/cppe/include/IceE/Connection.h @@ -74,8 +74,6 @@ public: #endif void waitUntilFinished(); // Not const, as this might close the connection upon timeout. - const std::vector<Byte>& getRequestHeader() { return _requestHdr; } // Inlined for performance reasons. - void sendRequest(IceInternal::BasicStream*, IceInternal::Outgoing*); #ifdef ICEE_HAS_BATCH @@ -173,16 +171,13 @@ private: const bool _warn; - const std::vector<Byte> _requestHdr; #ifndef ICEE_PURE_CLIENT - const std::vector<Byte> _replyHdr; IceInternal::Incoming _in; #endif #ifndef ICEE_PURE_BLOCKING_CLIENT IceInternal::BasicStream _stream; #endif #ifdef ICEE_HAS_BATCH - const std::vector<Byte> _requestBatchHdr; IceInternal::BasicStream _batchStream; bool _batchStreamInUse; int _batchRequestNum; diff --git a/cppe/include/IceE/Protocol.h b/cppe/include/IceE/Protocol.h index ce3685478cb..4ae9797bfc6 100644 --- a/cppe/include/IceE/Protocol.h +++ b/cppe/include/IceE/Protocol.h @@ -32,7 +32,7 @@ const ::Ice::Int headerSize = 14; // // The magic number at the front of each message // -const ::Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' +extern const ::Ice::Byte magic[4]; // // The current Ice protocol and encoding version @@ -51,6 +51,13 @@ const ::Ice::Byte replyMsg = 2; const ::Ice::Byte validateConnectionMsg = 3; const ::Ice::Byte closeConnectionMsg = 4; +// +// The request header, batch request header and reply header. +// +extern const ::Ice::Byte requestHdr[headerSize + sizeof(Ice::Int)]; +extern const ::Ice::Byte requestBatchHdr[headerSize + sizeof(Ice::Int)]; +extern const ::Ice::Byte replyHdr[headerSize]; + } #endif diff --git a/cppe/src/IceE/Connection.cpp b/cppe/src/IceE/Connection.cpp index 84f87a030cc..6e15315278b 100755 --- a/cppe/src/IceE/Connection.cpp +++ b/cppe/src/IceE/Connection.cpp @@ -530,7 +530,7 @@ Ice::Connection::prepareBatchRequest(BasicStream* os) { try { - _batchStream.writeBlob(&_requestBatchHdr[0], headerSize + sizeof(Int)); + _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr)); } catch(const LocalException& ex) { @@ -908,16 +908,13 @@ Ice::Connection::Connection(const InstancePtr& instance, _logger(_instance->logger()), // Cached for better performance. _traceLevels(_instance->traceLevels()), // Cached for better performance. _warn(_instance->properties()->getPropertyAsInt("Ice.Warn.Connections") > 0), - _requestHdr(headerSize + sizeof(Int), 0), #ifndef ICEE_PURE_CLIENT - _replyHdr(headerSize, 0), _in(_instance.get(), this, _stream, adapter), #endif #ifndef ICEE_PURE_BLOCKING_CLIENT _stream(_instance.get(), _instance->messageSizeMax()), #endif #ifdef ICEE_HAS_BATCH - _requestBatchHdr(headerSize + sizeof(Int), 0), _batchStream(_instance.get(), _instance->messageSizeMax()), _batchStreamInUse(false), _batchRequestNum(0), @@ -956,47 +953,6 @@ Ice::Connection::Connection(const InstancePtr& instance, _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout()); #endif - vector<Byte>& requestHdr = const_cast<vector<Byte>&>(_requestHdr); - requestHdr[0] = magic[0]; - requestHdr[1] = magic[1]; - requestHdr[2] = magic[2]; - requestHdr[3] = magic[3]; - requestHdr[4] = protocolMajor; - requestHdr[5] = protocolMinor; - requestHdr[6] = encodingMajor; - requestHdr[7] = encodingMinor; - requestHdr[8] = requestMsg; - requestHdr[9] = 0; - -#ifdef ICEE_HAS_BATCH - vector<Byte>& requestBatchHdr = const_cast<vector<Byte>&>(_requestBatchHdr); - requestBatchHdr[0] = magic[0]; - requestBatchHdr[1] = magic[1]; - requestBatchHdr[2] = magic[2]; - requestBatchHdr[3] = magic[3]; - requestBatchHdr[4] = protocolMajor; - requestBatchHdr[5] = protocolMinor; - requestBatchHdr[6] = encodingMajor; - requestBatchHdr[7] = encodingMinor; - requestBatchHdr[8] = requestBatchMsg; - requestBatchHdr[9] = 0; -#endif - -#ifndef ICEE_PURE_CLIENT - vector<Byte>& replyHdr = const_cast<vector<Byte>&>(_replyHdr); - replyHdr[0] = magic[0]; - replyHdr[1] = magic[1]; - replyHdr[2] = magic[2]; - replyHdr[3] = magic[3]; - replyHdr[4] = protocolMajor; - replyHdr[5] = protocolMinor; - replyHdr[6] = encodingMajor; - replyHdr[7] = encodingMinor; - replyHdr[8] = replyMsg; - replyHdr[9] = 0; - -#endif - #ifdef ICEE_PURE_BLOCKING_CLIENT validate(); #else @@ -1795,7 +1751,7 @@ Ice::Connection::run() // Add the reply header and request id. // BasicStream* os = _in.os(); - os->writeBlob(&_replyHdr[0], headerSize); + os->writeBlob(replyHdr, sizeof(replyHdr)); os->write(requestId); } diff --git a/cppe/src/IceE/Makefile b/cppe/src/IceE/Makefile index 6d4158564b4..69cf9ec7e5a 100644 --- a/cppe/src/IceE/Makefile +++ b/cppe/src/IceE/Makefile @@ -62,6 +62,7 @@ LOCAL_OBJS = BasicStream.o \ Outgoing.o \ OutgoingConnectionFactory.o \ Properties.o \ + Protocol.o \ Proxy.o \ ProxyFactory.o \ RecMutex.o \ diff --git a/cppe/src/IceE/Outgoing.cpp b/cppe/src/IceE/Outgoing.cpp index 1588adf048e..0da4ad89209 100644 --- a/cppe/src/IceE/Outgoing.cpp +++ b/cppe/src/IceE/Outgoing.cpp @@ -56,7 +56,7 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st case Reference::ModeTwoway: case Reference::ModeOneway: { - _stream.writeBlob(&(_connection->getRequestHeader()[0]), headerSize + sizeof(Int)); + _stream.writeBlob(requestHdr, sizeof(requestHdr)); break; } diff --git a/cppe/src/IceE/Protocol.cpp b/cppe/src/IceE/Protocol.cpp new file mode 100644 index 00000000000..0d8331f4cea --- /dev/null +++ b/cppe/src/IceE/Protocol.cpp @@ -0,0 +1,64 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <IceE/Protocol.h> + +namespace IceInternal +{ + +const Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P' + +const Ice::Byte requestHdr[] = +{ + magic[0], + magic[1], + magic[2], + magic[3], + protocolMajor, + protocolMinor, + encodingMajor, + encodingMinor, + requestMsg, + 0, // Compression status + 0, 0, 0, 0, // Message size (placeholder) + 0, 0, 0, 0 // Request id (placeholder) +}; + +const Ice::Byte requestBatchHdr[] = +{ + magic[0], + magic[1], + magic[2], + magic[3], + protocolMajor, + protocolMinor, + encodingMajor, + encodingMinor, + requestBatchMsg, + 0, // Compression status + 0, 0, 0, 0, // Message size (place holder) + 0, 0, 0, 0 // Number of requests in batch (placeholder) +}; + +const Ice::Byte replyHdr[] = +{ + magic[0], + magic[1], + magic[2], + magic[3], + protocolMajor, + protocolMinor, + encodingMajor, + encodingMinor, + replyMsg, + 0, // Compression status + 0, 0, 0, 0 // Message size (placeholder) +}; + +} diff --git a/cppe/src/IceEC/Makefile b/cppe/src/IceEC/Makefile index 89a3a37db5b..3c2ca431119 100644 --- a/cppe/src/IceEC/Makefile +++ b/cppe/src/IceEC/Makefile @@ -47,6 +47,7 @@ ICE_OBJS = BasicStream.o \ Outgoing.o \ OutgoingConnectionFactory.o \ Properties.o \ + Protocol.o \ Proxy.o \ ProxyFactory.o \ RecMutex.o \ |