diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-06-27 17:54:30 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-06-27 17:54:30 +0200 |
commit | c56f8ab6ca6ca0bdb9536fcce1ef24f1ef40ddc7 (patch) | |
tree | 5cb64dfe155e5d2349efb6c7dc4b0f5b5284d44a /cpp/src/IceBT | |
parent | Fix Windows php build to restore nuget packages (diff) | |
download | ice-c56f8ab6ca6ca0bdb9536fcce1ef24f1ef40ddc7.tar.bz2 ice-c56f8ab6ca6ca0bdb9536fcce1ef24f1ef40ddc7.tar.xz ice-c56f8ab6ca6ca0bdb9536fcce1ef24f1ef40ddc7.zip |
Refactored SSL and iAP transports, support for running SSL on top
of TCP/iAP/Bluetooth.
Diffstat (limited to 'cpp/src/IceBT')
-rw-r--r-- | cpp/src/IceBT/EndpointI.cpp | 7 | ||||
-rw-r--r-- | cpp/src/IceBT/EndpointI.h | 7 | ||||
-rw-r--r-- | cpp/src/IceBT/PluginI.cpp | 12 | ||||
-rw-r--r-- | cpp/src/IceBT/StreamSocket.cpp | 8 | ||||
-rw-r--r-- | cpp/src/IceBT/TransceiverI.cpp | 5 |
5 files changed, 26 insertions, 13 deletions
diff --git a/cpp/src/IceBT/EndpointI.cpp b/cpp/src/IceBT/EndpointI.cpp index 1f4ab9a99da..5c0d31cc8ef 100644 --- a/cpp/src/IceBT/EndpointI.cpp +++ b/cpp/src/IceBT/EndpointI.cpp @@ -92,17 +92,15 @@ IceBT::EndpointI::EndpointI(const InstancePtr& instance, InputStream* s) : } void -IceBT::EndpointI::streamWrite(OutputStream* s) const +IceBT::EndpointI::streamWriteImpl(OutputStream* s) const { // // _name and _channel are not marshaled. // - s->startEncapsulation(); s->write(_addr, false); s->write(_uuid, false); s->write(_timeout); s->write(_compress); - s->endEncapsulation(); } Ice::Short @@ -758,7 +756,8 @@ IceBT::EndpointFactoryI::destroy() } IceInternal::EndpointFactoryPtr -IceBT::EndpointFactoryI::clone(const IceInternal::ProtocolInstancePtr& instance) const +IceBT::EndpointFactoryI::clone(const IceInternal::ProtocolInstancePtr& instance, + const IceInternal::EndpointFactoryPtr&) const { return new EndpointFactoryI(new Instance(_instance->engine(), instance->type(), instance->protocol())); } diff --git a/cpp/src/IceBT/EndpointI.h b/cpp/src/IceBT/EndpointI.h index d3034413567..f0d2433d122 100644 --- a/cpp/src/IceBT/EndpointI.h +++ b/cpp/src/IceBT/EndpointI.h @@ -30,7 +30,7 @@ public: EndpointI(const InstancePtr&); EndpointI(const InstancePtr&, Ice::InputStream*); - virtual void streamWrite(Ice::OutputStream*) const; + virtual void streamWriteImpl(Ice::OutputStream*) const; virtual Ice::Short type() const; virtual const std::string& protocol() const; virtual Ice::Int timeout() const; @@ -49,7 +49,7 @@ public: #ifdef ICE_CPP11_MAPPING virtual bool operator==(const Ice::Endpoint&) const; - virtual bool operator<(const Ice::Endpoint&) const; + virtual bool operator<(const Ice::Endpoint&) const; #else virtual bool operator==(const Ice::LocalObject&) const; virtual bool operator<(const Ice::LocalObject&) const; @@ -140,7 +140,8 @@ public: virtual IceInternal::EndpointIPtr read(Ice::InputStream*) const; virtual void destroy(); - virtual IceInternal::EndpointFactoryPtr clone(const IceInternal::ProtocolInstancePtr&) const; + virtual IceInternal::EndpointFactoryPtr clone(const IceInternal::ProtocolInstancePtr&, + const IceInternal::EndpointFactoryPtr&) const; private: diff --git a/cpp/src/IceBT/PluginI.cpp b/cpp/src/IceBT/PluginI.cpp index 07a6fb67c42..c8f2882bbfb 100644 --- a/cpp/src/IceBT/PluginI.cpp +++ b/cpp/src/IceBT/PluginI.cpp @@ -59,13 +59,21 @@ registerIceBT(bool loadOnInitialize) IceBT::PluginI::PluginI(const Ice::CommunicatorPtr& com) : _engine(new Engine(com)) { + IceInternal::ProtocolPluginFacadePtr pluginFacade = IceInternal::getProtocolPluginFacade(com); + // // Register the endpoint factory. We have to do this now, rather // than in initialize, because the communicator may need to // interpret proxies before the plug-in is fully initialized. // - IceInternal::EndpointFactoryPtr btFactory = new EndpointFactoryI(new Instance(_engine, EndpointType, "bt")); - IceInternal::getProtocolPluginFacade(com)->addEndpointFactory(btFactory); + pluginFacade->addEndpointFactory(new EndpointFactoryI(new Instance(_engine, BTEndpointType, "bt"))); + + IceInternal::EndpointFactoryPtr sslFactory = pluginFacade->getEndpointFactory(SSLEndpointType); + if(sslFactory) + { + InstancePtr instance = new Instance(_engine, BTSEndpointType, "bts"); + pluginFacade->addEndpointFactory(sslFactory->clone(instance, new EndpointFactoryI(instance))); + } } void diff --git a/cpp/src/IceBT/StreamSocket.cpp b/cpp/src/IceBT/StreamSocket.cpp index 7c398fbed6f..ba4b27ca57f 100644 --- a/cpp/src/IceBT/StreamSocket.cpp +++ b/cpp/src/IceBT/StreamSocket.cpp @@ -104,12 +104,12 @@ IceBT::StreamSocket::setBufferSize(int rcvSize, int sndSize) // Warn if the size that was set is less than the requested size and // we have not already warned. // - IceInternal::BufSizeWarnInfo winfo = _instance->getBufSizeWarn(EndpointType); + IceInternal::BufSizeWarnInfo winfo = _instance->getBufSizeWarn(BTEndpointType); if(!winfo.rcvWarn || rcvSize != winfo.rcvSize) { Ice::Warning out(_instance->logger()); out << "BT receive buffer size: requested size of " << rcvSize << " adjusted to " << size; - _instance->setRcvBufSizeWarn(EndpointType, rcvSize); + _instance->setRcvBufSizeWarn(BTEndpointType, rcvSize); } } } @@ -127,12 +127,12 @@ IceBT::StreamSocket::setBufferSize(int rcvSize, int sndSize) { // Warn if the size that was set is less than the requested size and // we have not already warned. - IceInternal::BufSizeWarnInfo winfo = _instance->getBufSizeWarn(EndpointType); + IceInternal::BufSizeWarnInfo winfo = _instance->getBufSizeWarn(BTEndpointType); if(!winfo.sndWarn || sndSize != winfo.sndSize) { Ice::Warning out(_instance->logger()); out << "BT send buffer size: requested size of " << sndSize << " adjusted to " << size; - _instance->setSndBufSizeWarn(EndpointType, sndSize); + _instance->setSndBufSizeWarn(BTEndpointType, sndSize); } } } diff --git a/cpp/src/IceBT/TransceiverI.cpp b/cpp/src/IceBT/TransceiverI.cpp index fc4c878f35a..4a3f4005803 100644 --- a/cpp/src/IceBT/TransceiverI.cpp +++ b/cpp/src/IceBT/TransceiverI.cpp @@ -90,6 +90,11 @@ IceBT::TransceiverI::getInfo() const IceBT::ConnectionInfoPtr info = ICE_MAKE_SHARED(IceBT::ConnectionInfo); fdToAddressAndChannel(_stream->fd(), info->localAddress, info->localChannel, info->remoteAddress, info->remoteChannel); + if(_stream->fd() != INVALID_SOCKET) + { + info->rcvSize = IceInternal::getRecvBufferSize(_stream->fd()); + info->sndSize = IceInternal::getSendBufferSize(_stream->fd()); + } info->uuid = _uuid; return info; } |