diff options
Diffstat (limited to 'cppe/src')
-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 |
5 files changed, 69 insertions, 47 deletions
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 \ |