From 64bc7eef5fc343c33acd6264ed26330de7d2e3a5 Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 14 Dec 2016 22:51:50 +0100 Subject: WinRT -> UWP renames --- cpp/src/Glacier2Lib/SessionHelper.cpp | 2 +- cpp/src/Ice/Acceptor.h | 2 +- cpp/src/Ice/ConnectionFactory.cpp | 4 +- cpp/src/Ice/ConnectionFactory.h | 2 +- cpp/src/Ice/ConnectionI.cpp | 10 +- cpp/src/Ice/ConnectionI.h | 10 +- cpp/src/Ice/CountDownLatch.cpp | 4 +- cpp/src/Ice/DefaultsAndOverrides.cpp | 2 +- cpp/src/Ice/DynamicLibrary.cpp | 4 +- cpp/src/Ice/EventHandler.cpp | 2 +- cpp/src/Ice/EventHandler.h | 4 +- cpp/src/Ice/Exception.cpp | 6 +- cpp/src/Ice/IPEndpointI.cpp | 6 +- cpp/src/Ice/IPEndpointI.h | 6 +- cpp/src/Ice/ImplicitContextI.cpp | 10 +- cpp/src/Ice/Instance.cpp | 8 +- cpp/src/Ice/LoggerI.cpp | 4 +- cpp/src/Ice/LoggerI.h | 2 +- cpp/src/Ice/Network.cpp | 86 ++--- cpp/src/Ice/Network.h | 24 +- cpp/src/Ice/NetworkF.h | 2 +- cpp/src/Ice/NetworkProxy.cpp | 10 +- cpp/src/Ice/PropertiesI.cpp | 6 +- cpp/src/Ice/SHA1.cpp | 6 +- cpp/src/Ice/Selector.cpp | 4 +- cpp/src/Ice/Selector.h | 6 +- cpp/src/Ice/StreamSocket.cpp | 22 +- cpp/src/Ice/StreamSocket.h | 10 +- cpp/src/Ice/TcpAcceptor.cpp | 10 +- cpp/src/Ice/TcpAcceptor.h | 8 +- cpp/src/Ice/TcpTransceiver.cpp | 2 +- cpp/src/Ice/TcpTransceiver.h | 2 +- cpp/src/Ice/Thread.cpp | 4 +- cpp/src/Ice/ThreadPool.cpp | 38 +- cpp/src/Ice/ThreadPool.h | 12 +- cpp/src/Ice/Transceiver.h | 2 +- cpp/src/Ice/UdpConnector.cpp | 2 +- cpp/src/Ice/UdpTransceiver.cpp | 42 +-- cpp/src/Ice/UdpTransceiver.h | 10 +- cpp/src/Ice/WSAcceptor.cpp | 4 +- cpp/src/Ice/WSAcceptor.h | 4 +- cpp/src/Ice/WSTransceiver.cpp | 6 +- cpp/src/Ice/WSTransceiver.h | 4 +- cpp/src/IceSSL/AcceptorI.cpp | 6 +- cpp/src/IceSSL/AcceptorI.h | 4 +- cpp/src/IceSSL/Certificate.cpp | 34 +- cpp/src/IceSSL/ConnectorI.cpp | 2 +- cpp/src/IceSSL/PluginI.cpp | 4 +- cpp/src/IceSSL/PluginI.h | 4 +- cpp/src/IceSSL/SSLEngine.h | 8 +- cpp/src/IceSSL/SSLEngineF.h | 8 +- cpp/src/IceSSL/UWPEngine.cpp | 107 ++++++ cpp/src/IceSSL/UWPTransceiverI.cpp | 388 +++++++++++++++++++++ cpp/src/IceSSL/UWPTransceiverI.h | 79 +++++ cpp/src/IceSSL/Util.cpp | 8 +- cpp/src/IceSSL/Util.h | 2 +- cpp/src/IceSSL/WinRTEngine.cpp | 107 ------ cpp/src/IceSSL/WinRTTransceiverI.cpp | 388 --------------------- cpp/src/IceSSL/WinRTTransceiverI.h | 79 ----- .../msbuild/icessluwp++11/icessluwp++11.vcxproj | 4 +- .../icessluwp++11/icessluwp++11.vcxproj.filters | 4 +- cpp/src/IceUtil/FileUtil.cpp | 8 +- cpp/src/IceUtil/RecMutex.cpp | 2 +- cpp/src/IceUtil/StringUtil.cpp | 4 +- cpp/src/IceUtil/UUID.cpp | 4 +- cpp/src/IceUtil/UtilException.cpp | 2 +- 66 files changed, 835 insertions(+), 835 deletions(-) create mode 100644 cpp/src/IceSSL/UWPEngine.cpp create mode 100644 cpp/src/IceSSL/UWPTransceiverI.cpp create mode 100644 cpp/src/IceSSL/UWPTransceiverI.h delete mode 100755 cpp/src/IceSSL/WinRTEngine.cpp delete mode 100755 cpp/src/IceSSL/WinRTTransceiverI.cpp delete mode 100755 cpp/src/IceSSL/WinRTTransceiverI.h (limited to 'cpp/src') diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 5a6c9354ae1..074f4d7a6ae 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -1185,7 +1185,7 @@ Glacier2::SessionFactoryHelper::createInitData() initData.properties->setProperty("Ice.Default.Router", createProxyStr(_identity)); } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP // // If using a secure connection setup the IceSSL plug-in, if IceSSL // plug-in has already been setup we don't want to override the diff --git a/cpp/src/Ice/Acceptor.h b/cpp/src/Ice/Acceptor.h index 269c8963226..fc5d06cc0ad 100644 --- a/cpp/src/Ice/Acceptor.h +++ b/cpp/src/Ice/Acceptor.h @@ -27,7 +27,7 @@ public: virtual NativeInfoPtr getNativeInfo() = 0; virtual void close() = 0; virtual EndpointIPtr listen() = 0; -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual void startAccept() = 0; virtual void finishAccept() = 0; #endif diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 87f6edee197..0aaa3b09bc1 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -1274,7 +1274,7 @@ IceInternal::IncomingConnectionFactory::flushAsyncBatchRequests(const Communicat } } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool IceInternal::IncomingConnectionFactory::startAsync(SocketOperation) { @@ -1797,7 +1797,7 @@ IceInternal::IncomingConnectionFactory::closeAcceptor() #if TARGET_OS_IPHONE != 0 // // Only clear the acceptor on iOS where it can be destroyed/re-created during the lifetime of the incoming - // connection factory. On other platforms, we keep it set. This is in particular import for IOCP/WinRT where + // connection factory. On other platforms, we keep it set. This is in particular import for IOCP/UWP where // finishAsync can be called after the acceptor is closed. // _acceptor = 0; diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h index f0c6ed69021..1fadf0c2b66 100644 --- a/cpp/src/Ice/ConnectionFactory.h +++ b/cpp/src/Ice/ConnectionFactory.h @@ -199,7 +199,7 @@ public: // Operations from EventHandler // -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual bool startAsync(SocketOperation); virtual bool finishAsync(SocketOperation); #endif diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 9e2c6042043..7845259855c 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -271,7 +271,7 @@ Ice::ConnectionI::OutgoingMessage::sent() if(outAsync) { -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) invokeSent = outAsync->sent(); return invokeSent || receivedReply; #else @@ -1197,7 +1197,7 @@ Ice::ConnectionI::createProxy(const Identity& ident) const _instance->referenceFactory()->create(ident, ICE_SHARED_FROM_CONST_THIS(ConnectionI))); } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool Ice::ConnectionI::startAsync(SocketOperation operation) { @@ -1599,7 +1599,7 @@ ConnectionI::dispatch(const StartCallbackPtr& startCB, const vector::const_iterator p = sentCBs.begin(); p != sentCBs.end(); ++p) { -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) if(p->invokeSent) { p->outAsync->invokeSent(); @@ -1797,7 +1797,7 @@ Ice::ConnectionI::finish(bool close) OutgoingMessage* message = &_sendStreams.front(); _writeStream.swap(*message->stream); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) // // The current message might be sent but not yet removed from _sendStreams. If // the response has been received in the meantime, we remove the message from @@ -3107,7 +3107,7 @@ Ice::ConnectionI::parseMessage(InputStream& stream, Int& invokeNum, Int& request stream.swap(*outAsync->getIs()); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) // // If we just received the reply of a request which isn't acknowledge as // sent yet, we queue the reply instead of processing it right away. It diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index 6c0f49f6c08..6bd7437c436 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -43,7 +43,7 @@ #include -#if !defined(ICE_OS_WINRT) +#if !defined(ICE_OS_UWP) # ifndef ICE_HAS_BZIP2 # define ICE_HAS_BZIP2 # endif @@ -94,7 +94,7 @@ public: { OutgoingMessage(Ice::OutputStream* str, bool comp) : stream(str), compress(comp), requestId(0), adopted(false) -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) , isSent(false), invokeSent(false), receivedReply(false) #endif { @@ -103,7 +103,7 @@ public: OutgoingMessage(const IceInternal::OutgoingAsyncBasePtr& o, Ice::OutputStream* str, bool comp, int rid) : stream(str), outAsync(o), compress(comp), requestId(rid), adopted(false) -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) , isSent(false), invokeSent(false), receivedReply(false) #endif { @@ -119,7 +119,7 @@ public: bool compress; int requestId; bool adopted; -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool isSent; bool invokeSent; bool receivedReply; @@ -216,7 +216,7 @@ public: // // Operations from EventHandler // -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool startAsync(IceInternal::SocketOperation); bool finishAsync(IceInternal::SocketOperation); #endif diff --git a/cpp/src/Ice/CountDownLatch.cpp b/cpp/src/Ice/CountDownLatch.cpp index eb0422ba7e9..565a2cc2e1d 100644 --- a/cpp/src/Ice/CountDownLatch.cpp +++ b/cpp/src/Ice/CountDownLatch.cpp @@ -19,7 +19,7 @@ IceUtilInternal::CountDownLatch::CountDownLatch(int count) : } #ifdef _WIN32 -# ifndef ICE_OS_WINRT +# ifndef ICE_OS_UWP _event = CreateEvent(0, TRUE, FALSE, 0); # else _event = CreateEventExW(0, 0, CREATE_EVENT_MANUAL_RESET, SEMAPHORE_ALL_ACCESS); @@ -66,7 +66,7 @@ IceUtilInternal::CountDownLatch::await() const #ifdef _WIN32 while(InterlockedExchangeAdd(&_count, 0) > 0) { -# ifndef ICE_OS_WINRT +# ifndef ICE_OS_UWP DWORD rc = WaitForSingleObject(_event, INFINITE); # else DWORD rc = WaitForSingleObjectEx(_event, INFINITE, false); diff --git a/cpp/src/Ice/DefaultsAndOverrides.cpp b/cpp/src/Ice/DefaultsAndOverrides.cpp index f4d961713bd..4c83a32799e 100644 --- a/cpp/src/Ice/DefaultsAndOverrides.cpp +++ b/cpp/src/Ice/DefaultsAndOverrides.cpp @@ -36,7 +36,7 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro string value; -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP value = properties->getProperty("Ice.Default.SourceAddress"); if(!value.empty()) { diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp index d70e14bd74a..00bfb97131e 100644 --- a/cpp/src/Ice/DynamicLibrary.cpp +++ b/cpp/src/Ice/DynamicLibrary.cpp @@ -133,7 +133,7 @@ IceInternal::DynamicLibrary::loadEntryPoint(const string& entryPoint, bool useIc #ifdef _WIN32 lib += libName; lib += version; -# ifdef ICE_OS_WINRT +# ifdef ICE_OS_UWP lib += "uwp"; # endif @@ -217,7 +217,7 @@ IceInternal::DynamicLibrary::load(const string& lib) // Don't need to use a wide string converter as the wide string is passed // to Windows API. // -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP _hnd = LoadPackagedLibrary(stringToWstring(lib, getProcessStringConverter()).c_str(), 0); #elif defined(_WIN32) _hnd = LoadLibraryW(stringToWstring(lib, getProcessStringConverter()).c_str()); diff --git a/cpp/src/Ice/EventHandler.cpp b/cpp/src/Ice/EventHandler.cpp index 78827685267..eb0ee89facc 100644 --- a/cpp/src/Ice/EventHandler.cpp +++ b/cpp/src/Ice/EventHandler.cpp @@ -19,7 +19,7 @@ IceUtil::Shared* IceInternal::upCast(EventHandler* p) { return p; } #endif IceInternal::EventHandler::EventHandler() : -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) _pending(SocketOperationNone), _started(SocketOperationNone), _completed(SocketOperationNone), diff --git a/cpp/src/Ice/EventHandler.h b/cpp/src/Ice/EventHandler.h index e7124182d76..21baae05edb 100644 --- a/cpp/src/Ice/EventHandler.h +++ b/cpp/src/Ice/EventHandler.h @@ -29,7 +29,7 @@ class ICE_API EventHandler : { public: -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) // // Called to start a new asynchronous read or write operation. // @@ -62,7 +62,7 @@ protected: EventHandler(); virtual ~EventHandler(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) SocketOperation _pending; SocketOperation _started; SocketOperation _completed; diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index 460ff4dd809..4ac7d66cdd3 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -16,7 +16,7 @@ #include #include #include -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP # include #endif #include @@ -35,7 +35,7 @@ socketErrorToString(int error) { return "unknown error"; } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP if(error == E_ACCESSDENIED) { ostringstream os; @@ -461,7 +461,7 @@ Ice::DNSException::ice_print(ostream& out) const { Exception::ice_print(out); out << ":\nDNS error: "; -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP out << socketErrorToString(error); #else out << errorToStringDNS(error); diff --git a/cpp/src/Ice/IPEndpointI.cpp b/cpp/src/Ice/IPEndpointI.cpp index a33405d8118..aca36399b13 100644 --- a/cpp/src/Ice/IPEndpointI.cpp +++ b/cpp/src/Ice/IPEndpointI.cpp @@ -442,7 +442,7 @@ IceInternal::IPEndpointI::checkOption(const string& option, const string& argume ex.str = "no argument provided for --sourceAddress option in endpoint " + endpoint; throw ex; } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP const_cast(_sourceAddr) = getNumericAddress(argument); if(!isAddressValid(_sourceAddr)) { @@ -486,7 +486,7 @@ IceInternal::IPEndpointI::IPEndpointI(const ProtocolInstancePtr& instance, Input s->read(const_cast(_port)); } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP IceInternal::EndpointHostResolver::EndpointHostResolver(const InstancePtr& instance) : IceUtil::Thread("Ice.HostResolver"), @@ -698,7 +698,7 @@ IceInternal::EndpointHostResolver::resolve(const string& host, const EndpointI_connectorsPtr& callback) { // - // No DNS lookup support with WinRT. + // No DNS lookup support with UWP. // callback->connectors(endpoint->connectors(getAddresses(host, port, _instance->protocolSupport(), diff --git a/cpp/src/Ice/IPEndpointI.h b/cpp/src/Ice/IPEndpointI.h index 7378792a7c7..dc89fa257b4 100644 --- a/cpp/src/Ice/IPEndpointI.h +++ b/cpp/src/Ice/IPEndpointI.h @@ -20,7 +20,7 @@ #include #include -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP # include #endif @@ -108,7 +108,7 @@ private: mutable Ice::Int _hashValue; }; -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP class ICE_API EndpointHostResolver : public IceUtil::Thread, public IceUtil::Monitor #else class ICE_API EndpointHostResolver : public IceUtil::Shared @@ -127,7 +127,7 @@ public: private: -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP struct ResolveEntry { std::string host; diff --git a/cpp/src/Ice/ImplicitContextI.cpp b/cpp/src/Ice/ImplicitContextI.cpp index fb9e578d6a1..a39d2a4c04a 100644 --- a/cpp/src/Ice/ImplicitContextI.cpp +++ b/cpp/src/Ice/ImplicitContextI.cpp @@ -39,7 +39,7 @@ private: IceUtil::Mutex _mutex; }; -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP class PerThreadImplicitContext : public ImplicitContextI { public: @@ -120,11 +120,11 @@ ImplicitContextI::create(const std::string& kind) } else if(kind == "PerThread") { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP return ICE_MAKE_SHARED(PerThreadImplicitContext); #else throw InitializationException(__FILE__, __LINE__, - "'PerThread' Ice.ImplicitContext isn't supported for WinRT."); + "'PerThread' Ice.ImplicitContext isn't supported for UWP."); return 0; // Keep the compiler happy. #endif } @@ -137,7 +137,7 @@ ImplicitContextI::create(const std::string& kind) } } -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) void ImplicitContextI::cleanupThread() { @@ -260,7 +260,7 @@ SharedImplicitContext::combine(const Context& proxyCtx, Context& ctx) const // // PerThreadImplicitContext implementation // -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP long PerThreadImplicitContext::_nextId; PerThreadImplicitContext::IndexInUse* PerThreadImplicitContext::_indexInUse; IceUtil::Mutex* PerThreadImplicitContext::_mutex = 0; diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 304036dec90..7fe278d78ad 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -1063,7 +1063,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi if(instanceCount() == 1) { -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) WORD version = MAKEWORD(1, 1); WSADATA data; if(WSAStartup(version, &data) != 0) @@ -1208,7 +1208,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi // // Client ACM enabled by default. Server ACM disabled by default. // -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP const_cast(_implicitContext) = ImplicitContextI::create(_initData.properties->getProperty("Ice.ImplicitContext")); #endif @@ -1304,7 +1304,7 @@ IceInternal::Instance::~Instance() } if(instanceCount() == 0) { -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) WSACleanup(); #endif @@ -1660,7 +1660,7 @@ IceInternal::Instance::destroy() { _serverThreadPool->joinWithAllThreads(); } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP if(_endpointHostResolver) { _endpointHostResolver->getThreadControl().join(); diff --git a/cpp/src/Ice/LoggerI.cpp b/cpp/src/Ice/LoggerI.cpp index 2396b4cf8c3..5ebf7c460cd 100644 --- a/cpp/src/Ice/LoggerI.cpp +++ b/cpp/src/Ice/LoggerI.cpp @@ -57,7 +57,7 @@ Ice::LoggerI::LoggerI(const string& prefix, const string& file, _convert(convert), _converter(getProcessStringConverter()), _sizeMax(sizeMax) -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) ,_consoleConverter(createWindowsStringConverter(GetConsoleOutputCP())) #endif { @@ -233,7 +233,7 @@ Ice::LoggerI::write(const string& message, bool indent) } else { -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) OutputDebugString(stringToWstring(s).c_str()); #elif defined(_WIN32) // diff --git a/cpp/src/Ice/LoggerI.h b/cpp/src/Ice/LoggerI.h index 5c75dbd12b8..577e868818d 100644 --- a/cpp/src/Ice/LoggerI.h +++ b/cpp/src/Ice/LoggerI.h @@ -49,7 +49,7 @@ private: // after which rename could be attempted again. Otherwise is set to zero. // IceUtil::Time _nextRetry; -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) const StringConverterPtr _consoleConverter; #endif diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 2620a8a34be..270249ed601 100755 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -30,7 +30,7 @@ #include #include -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) # include # include #elif defined(_WIN32) @@ -78,7 +78,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; @@ -105,7 +105,7 @@ IceInternal::getSystemErrno() namespace { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP struct AddressIsIPv6 : public unary_function { public: @@ -174,7 +174,7 @@ setKeepAlive(SOCKET fd) } #endif -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) void setTcpLoopbackFastPath(SOCKET fd) { @@ -198,7 +198,7 @@ setTcpLoopbackFastPath(SOCKET fd) } #endif -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP SOCKET createSocketImpl(bool udp, int) { @@ -244,7 +244,7 @@ createSocketImpl(bool udp, int family) setTcpNoDelay(fd); setKeepAlive(fd); -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) // // FIX: the fast path loopback appears to cause issues with // connection closure when it's enabled. Sometime, a peer @@ -261,7 +261,7 @@ createSocketImpl(bool udp, int family) } #endif -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP vector
getLocalAddresses(ProtocolSupport protocol, bool includeLoopback) { @@ -773,7 +773,7 @@ getAddressStorageSize(const Address& addr) return size; } -#endif // #ifndef ICE_OS_WINRT +#endif // #ifndef ICE_OS_UWP } @@ -819,7 +819,7 @@ IceInternal::NativeInfo::completed(SocketOperation operation) } } -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) void IceInternal::NativeInfo::queueAction(SocketOperation op, IAsyncAction^ action, bool connect) @@ -954,7 +954,7 @@ IceInternal::NativeInfo::newFd() bool IceInternal::noMoreFds(int error) { -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) return error == (int)SocketErrorStatus::TooManyOpenFiles; #elif defined(_WIN32) return error == WSAEMFILE; @@ -963,7 +963,7 @@ IceInternal::noMoreFds(int error) #endif } -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) string IceInternal::errorToStringDNS(int) { @@ -981,7 +981,7 @@ IceInternal::errorToStringDNS(int error) } #endif -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP vector
IceInternal::getAddresses(const string& host, int port, ProtocolSupport, Ice::EndpointSelectionType, bool, bool) { @@ -1145,11 +1145,11 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol } #endif -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP ProtocolSupport IceInternal::getProtocolSupport(const Address&) { - // For WinRT, there's no distinction between IPv4 and IPv6 adresses. + // For UWP, there's no distinction between IPv4 and IPv6 adresses. return EnableBoth; } #else @@ -1170,7 +1170,7 @@ IceInternal::getAddressForServer(const string& host, int port, ProtocolSupport p if(host.empty()) { Address addr; -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP ostringstream os; os << port; // @@ -1202,7 +1202,7 @@ IceInternal::getAddressForServer(const string& host, int port, ProtocolSupport p int IceInternal::compareAddress(const Address& addr1, const Address& addr2) { -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP int o = String::CompareOrdinal(addr1.port, addr2.port); if(o != 0) { @@ -1277,7 +1277,7 @@ IceInternal::compareAddress(const Address& addr1, const Address& addr2) #endif } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP bool IceInternal::isIPv6Supported() { @@ -1300,7 +1300,7 @@ IceInternal::isIPv6Supported() } #endif -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP SOCKET IceInternal::createSocket(bool udp, const Address&) { @@ -1314,7 +1314,7 @@ IceInternal::createSocket(bool udp, const Address& addr) } #endif -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP SOCKET IceInternal::createServerSocket(bool udp, const Address& addr, ProtocolSupport protocol) { @@ -1349,7 +1349,7 @@ IceInternal::createServerSocket(bool udp, const Address& addr, ProtocolSupport) void IceInternal::closeSocketNoThrow(SOCKET fd) { -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) // // NOTE: StreamSocket::Close or DatagramSocket::Close aren't // exposed in C++, you have to delete the socket to close @@ -1372,7 +1372,7 @@ IceInternal::closeSocketNoThrow(SOCKET fd) void IceInternal::closeSocket(SOCKET fd) { -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) // // NOTE: StreamSocket::Close or DatagramSocket::Close aren't // exposed in C++, you have to delete the socket to close @@ -1423,7 +1423,7 @@ IceInternal::addrToString(const Address& addr) void IceInternal::fdToLocalAddress(SOCKET fd, Address& addr) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP socklen_t len = static_cast(sizeof(sockaddr_storage)); if(getsockname(fd, &addr.sa, &len) == SOCKET_ERROR) { @@ -1450,7 +1450,7 @@ IceInternal::fdToLocalAddress(SOCKET fd, Address& addr) bool IceInternal::fdToRemoteAddress(SOCKET fd, Address& addr) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP socklen_t len = static_cast(sizeof(sockaddr_storage)); if(getpeername(fd, &addr.sa, &len) == SOCKET_ERROR) { @@ -1605,14 +1605,14 @@ IceInternal::addressesToString(const Address& localAddr, const Address& remoteAd bool IceInternal::isAddressValid(const Address& addr) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP return addr.saStorage.ss_family != AF_UNSPEC; #else return addr.host != nullptr || addr.port != nullptr; #endif } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP vector IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport protocolSupport, bool includeLoopback) { @@ -1671,7 +1671,7 @@ IceInternal::getHostsForEndpointExpand(const string& host, ProtocolSupport proto string IceInternal::inetAddrToString(const Address& ss) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP int size = getAddressStorageSize(ss); if(size == 0) { @@ -1701,7 +1701,7 @@ IceInternal::inetAddrToString(const Address& ss) int IceInternal::getPort(const Address& addr) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP if(addr.saStorage.ss_family == AF_INET) { return ntohs(addr.saIn.sin_port); @@ -1730,7 +1730,7 @@ IceInternal::getPort(const Address& addr) void IceInternal::setPort(Address& addr, int port) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP if(addr.saStorage.ss_family == AF_INET) { addr.saIn.sin_port = htons(port); @@ -1754,7 +1754,7 @@ IceInternal::setPort(Address& addr, int port) bool IceInternal::isMulticast(const Address& addr) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP if(addr.saStorage.ss_family == AF_INET) { return IN_MULTICAST(ntohl(addr.saIn.sin_addr.s_addr)); @@ -1867,7 +1867,7 @@ IceInternal::setTcpBufSize(SOCKET fd, int rcvSize, int sndSize, const ProtocolIn } } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP void IceInternal::setBlock(SOCKET fd, bool) { @@ -1931,7 +1931,7 @@ IceInternal::setBlock(SOCKET fd, bool block) void IceInternal::setSendBufferSize(SOCKET fd, int sz) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&sz), int(sizeof(int))) == SOCKET_ERROR) { closeSocketNoThrow(fd); @@ -1951,7 +1951,7 @@ IceInternal::setSendBufferSize(SOCKET fd, int sz) int IceInternal::getSendBufferSize(SOCKET fd) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP int sz; socklen_t len = sizeof(sz); if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast(&sz), &len) == SOCKET_ERROR || @@ -1973,7 +1973,7 @@ IceInternal::getSendBufferSize(SOCKET fd) #endif } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP void IceInternal::setRecvBufferSize(SOCKET, int) { @@ -1995,7 +1995,7 @@ IceInternal::setRecvBufferSize(SOCKET fd, int sz) int IceInternal::getRecvBufferSize(SOCKET fd) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP int sz; socklen_t len = sizeof(sz); if(getsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast(&sz), &len) == SOCKET_ERROR || @@ -2012,7 +2012,7 @@ IceInternal::getRecvBufferSize(SOCKET fd) #endif } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP void IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string& intf) { @@ -2046,7 +2046,7 @@ IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string&) try { // - // NOTE: WinRT doesn't allow specyfing the interface. + // NOTE: UWP doesn't allow specyfing the interface. // safe_cast(fd)->JoinMulticastGroup(group.host); } @@ -2057,7 +2057,7 @@ IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string&) } #endif -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP void IceInternal::setMcastInterface(SOCKET, const string&, const Address&) { @@ -2087,7 +2087,7 @@ IceInternal::setMcastInterface(SOCKET fd, const string& intf, const Address& add } #endif -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP void IceInternal::setMcastTtl(SOCKET, int, const Address&) { @@ -2115,7 +2115,7 @@ IceInternal::setMcastTtl(SOCKET fd, int ttl, const Address& addr) } #endif -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP void IceInternal::setReuseAddress(SOCKET, bool) { @@ -2136,7 +2136,7 @@ IceInternal::setReuseAddress(SOCKET fd, bool reuse) #endif -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP namespace { @@ -2174,7 +2174,7 @@ checkResultAndWait(IAsyncAction^ action) Address IceInternal::doBind(SOCKET fd, const Address& addr) { -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP Address local; try { @@ -2238,7 +2238,7 @@ IceInternal::doBind(SOCKET fd, const Address& addr) #endif } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP Address IceInternal::getNumericAddress(const std::string& address) @@ -2704,7 +2704,7 @@ IceInternal::createPipe(SOCKET fds[2]) #endif } -#else // ICE_OS_WINRT +#else // ICE_OS_UWP void IceInternal::checkConnectErrorCode(const char* file, int line, HRESULT herr) diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h index 8c130b5a4d6..441fa79b893 100755 --- a/cpp/src/Ice/Network.h +++ b/cpp/src/Ice/Network.h @@ -24,7 +24,7 @@ #include #include -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) // Nothing to include #elif defined(_WIN32) # include @@ -50,7 +50,7 @@ typedef int ssize_t; #elif defined(__APPLE__) && !defined(ICE_NO_CFSTREAM) # define ICE_USE_CFSTREAM 1 #elif defined(_WIN32) -# if defined(ICE_OS_WINRT) +# if defined(ICE_OS_UWP) # elif !defined(ICE_NO_IOCP) # define ICE_USE_IOCP 1 # else @@ -68,7 +68,7 @@ typedef int socklen_t; # define SOCKET int # define INVALID_SOCKET -1 # define SOCKET_ERROR -1 -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) typedef Platform::Object^ SOCKET; # define INVALID_SOCKET nullptr # define SOCKET_ERROR -1 @@ -115,7 +115,7 @@ namespace IceInternal // // Use Address struct or union depending on the platform // -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP struct ICE_API Address { Windows::Networking::HostName^ host; @@ -152,17 +152,17 @@ enum SocketOperation }; // -// On WinRT, wait only for read to return, on IOCP/Win32 wait for +// On UWP, wait only for read to return, on IOCP/Win32 wait for // both pending read and write operations to complete (#ICE-6695). // -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) const int SocketOperationWaitForClose = 1; #elif defined(ICE_USE_IOCP) const int SocketOperationWaitForClose = 3; #endif // -// AsyncInfo struct for Windows IOCP or WinRT holds the result of +// AsyncInfo struct for Windows IOCP or UWP holds the result of // asynchronous operations after it completed. // #if defined(ICE_USE_IOCP) @@ -176,7 +176,7 @@ struct ICE_API AsyncInfo : WSAOVERLAPPED DWORD count; int error; }; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) struct ICE_API AsyncInfo { Windows::Foundation::AsyncOperationCompletedHandler^ completedHandler; @@ -205,7 +205,7 @@ public: virtual ~NativeInfo(); NativeInfo(SOCKET socketFd = INVALID_SOCKET) : _fd(socketFd) -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) , _newFd(INVALID_SOCKET) #endif { @@ -231,7 +231,7 @@ public: virtual AsyncInfo* getAsyncInfo(SocketOperation) = 0; void initialize(HANDLE, ULONG_PTR); void completed(SocketOperation); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) virtual AsyncInfo* getAsyncInfo(SocketOperation) = 0; void queueAction(SocketOperation, Windows::Foundation::IAsyncAction^, bool = false); void queueOperation(SocketOperation, Windows::Foundation::IAsyncOperation^); @@ -250,7 +250,7 @@ protected: #if defined(ICE_USE_IOCP) HANDLE _handle; ULONG_PTR _key; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) bool checkIfErrorOrCompleted(SocketOperation, Windows::Foundation::IAsyncInfo^, bool = false); SocketOperationCompletedHandler^ _completedHandler; #else @@ -307,7 +307,7 @@ ICE_API void setReuseAddress(SOCKET, bool); ICE_API Address doBind(SOCKET, const Address&); ICE_API void doListen(SOCKET, int); -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP ICE_API bool interrupted(); ICE_API bool acceptInterrupted(); ICE_API bool noBuffers(); diff --git a/cpp/src/Ice/NetworkF.h b/cpp/src/Ice/NetworkF.h index 59548bc586d..9c7fc7f1cc6 100644 --- a/cpp/src/Ice/NetworkF.h +++ b/cpp/src/Ice/NetworkF.h @@ -17,7 +17,7 @@ namespace IceInternal { -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP struct ICE_API Address; #else union Address; diff --git a/cpp/src/Ice/NetworkProxy.cpp b/cpp/src/Ice/NetworkProxy.cpp index bdcf580b8d1..b4055bad7b9 100644 --- a/cpp/src/Ice/NetworkProxy.cpp +++ b/cpp/src/Ice/NetworkProxy.cpp @@ -22,7 +22,7 @@ NetworkProxy::~NetworkProxy() // Out of line to avoid weak vtable } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP namespace { @@ -304,8 +304,8 @@ IceInternal::createNetworkProxy(const Ice::PropertiesPtr& properties, ProtocolSu proxyHost = properties->getProperty("Ice.SOCKSProxyHost"); if(!proxyHost.empty()) { -#ifdef ICE_OS_WINRT - throw Ice::InitializationException(__FILE__, __LINE__, "SOCKS proxy not supported with WinRT"); +#ifdef ICE_OS_UWP + throw Ice::InitializationException(__FILE__, __LINE__, "SOCKS proxy not supported with UWP"); #else if(protocolSupport == EnableIPv6) { @@ -319,8 +319,8 @@ IceInternal::createNetworkProxy(const Ice::PropertiesPtr& properties, ProtocolSu proxyHost = properties->getProperty("Ice.HTTPProxyHost"); if(!proxyHost.empty()) { -#ifdef ICE_OS_WINRT - throw Ice::InitializationException(__FILE__, __LINE__, "HTTP proxy not supported with WinRT"); +#ifdef ICE_OS_UWP + throw Ice::InitializationException(__FILE__, __LINE__, "HTTP proxy not supported with UWP"); #else return new HTTPNetworkProxy(proxyHost, properties->getPropertyAsIntWithDefault("Ice.HTTPProxyPort", 1080)); #endif diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index f3461f47320..27de7af6881 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -301,7 +301,7 @@ Ice::PropertiesI::load(const std::string& file) // // Metro style applications cannot access Windows registry. // -#if defined (_WIN32) && !defined(ICE_OS_WINRT) +#if defined (_WIN32) && !defined(ICE_OS_UWP) if(file.find("HKLM\\") == 0) { HKEY iceKey; @@ -711,9 +711,9 @@ void Ice::PropertiesI::loadConfig() { string value = getProperty("Ice.Config"); -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP // - // WinRT cannot access environment variables + // UWP cannot access environment variables // if(value.empty() || value == "1") { diff --git a/cpp/src/Ice/SHA1.cpp b/cpp/src/Ice/SHA1.cpp index 4373afa15f8..141ffda9a6a 100644 --- a/cpp/src/Ice/SHA1.cpp +++ b/cpp/src/Ice/SHA1.cpp @@ -9,7 +9,7 @@ #include -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP # if defined(_WIN32) # include # include @@ -23,7 +23,7 @@ using namespace std; using namespace IceUtil; -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP namespace IceUtilInternal { @@ -163,7 +163,7 @@ IceUtilInternal::SHA1::finalize(std::vector& md) void IceUtilInternal::sha1(const unsigned char* data, size_t length, vector& md) { -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) auto dataA = ref new Platform::Array(const_cast(data), static_cast(length)); auto hasher = Windows::Security::Cryptography::Core::HashAlgorithmProvider::OpenAlgorithm("SHA1"); diff --git a/cpp/src/Ice/Selector.cpp b/cpp/src/Ice/Selector.cpp index 2bd129cc330..bf4f57abfbd 100644 --- a/cpp/src/Ice/Selector.cpp +++ b/cpp/src/Ice/Selector.cpp @@ -22,13 +22,13 @@ using namespace std; using namespace IceInternal; -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) using namespace Windows::Storage::Streams; using namespace Windows::Networking; using namespace Windows::Networking::Sockets; #endif -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) Selector::Selector(const InstancePtr& instance) : _instance(instance) { diff --git a/cpp/src/Ice/Selector.h b/cpp/src/Ice/Selector.h index 4f433c32aa4..7434a240763 100644 --- a/cpp/src/Ice/Selector.h +++ b/cpp/src/Ice/Selector.h @@ -43,7 +43,7 @@ struct __CFSocket; typedef struct __CFSocket * CFSocketRef; #endif -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) # include #endif @@ -58,11 +58,11 @@ class SelectorTimeoutException }; -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) class Selector { -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) struct SelectEvent { SelectEvent(const EventHandlerPtr& handler, SocketOperation status) : handler(handler), status(status) diff --git a/cpp/src/Ice/StreamSocket.cpp b/cpp/src/Ice/StreamSocket.cpp index 7a405c30a3d..5b6d6eb36d1 100755 --- a/cpp/src/Ice/StreamSocket.cpp +++ b/cpp/src/Ice/StreamSocket.cpp @@ -13,7 +13,7 @@ using namespace IceInternal; -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) #include using namespace Platform; @@ -36,7 +36,7 @@ StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, #endif { init(); -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) if(doConnect(_fd, _proxy ? _proxy->getAddress() : _addr, sourceAddr)) { _state = _proxy ? StateProxyWrite : StateConnected; @@ -92,7 +92,7 @@ StreamSocket::connect(Buffer& readBuffer, Buffer& writeBuffer) { #if defined(ICE_USE_IOCP) doFinishConnectAsync(_fd, _write); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) if(_write.count == SOCKET_ERROR) { try @@ -153,7 +153,7 @@ StreamSocket::isConnected() size_t StreamSocket::getSendPacketSize(size_t length) { -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) return _maxSendPacketSize > 0 ? std::min(length, _maxSendPacketSize) : length; #else return length; @@ -163,7 +163,7 @@ StreamSocket::getSendPacketSize(size_t length) size_t StreamSocket::getRecvPacketSize(size_t length) { -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) return _maxRecvPacketSize > 0 ? std::min(length, _maxRecvPacketSize) : length; #else return length; @@ -179,7 +179,7 @@ StreamSocket::setBufferSize(int rcvSize, int sndSize) SocketOperation StreamSocket::read(Buffer& buf) { -#if !defined(ICE_OS_WINRT) +#if !defined(ICE_OS_UWP) if(_state == StateProxyRead) { while(true) @@ -205,7 +205,7 @@ StreamSocket::read(Buffer& buf) SocketOperation StreamSocket::write(Buffer& buf) { -#if !defined(ICE_OS_WINRT) +#if !defined(ICE_OS_UWP) if(_state == StateProxyWrite) { while(true) @@ -228,7 +228,7 @@ StreamSocket::write(Buffer& buf) return buf.i != buf.b.end() ? SocketOperationWrite : SocketOperationNone; } -#if !defined(ICE_OS_WINRT) +#if !defined(ICE_OS_UWP) ssize_t StreamSocket::read(char* buf, size_t length) { @@ -368,7 +368,7 @@ StreamSocket::write(const char* buf, size_t length) } #endif -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) AsyncInfo* StreamSocket::getAsyncInfo(SocketOperation op) { @@ -526,7 +526,7 @@ StreamSocket::finishRead(Buffer& buf) } -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) bool StreamSocket::startWrite(Buffer& buf) @@ -679,7 +679,7 @@ StreamSocket::init() // _maxSendPacketSize = std::max(512, IceInternal::getSendBufferSize(_fd)); _maxRecvPacketSize = std::max(512, IceInternal::getRecvBufferSize(_fd)); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) Windows::Networking::Sockets::StreamSocket^ s = safe_cast(_fd); _writer = ref new Windows::Storage::Streams::DataWriter(s->OutputStream); _reader = ref new Windows::Storage::Streams::DataReader(s->InputStream); diff --git a/cpp/src/Ice/StreamSocket.h b/cpp/src/Ice/StreamSocket.h index 3d092d20ba2..b38c8f2ad88 100644 --- a/cpp/src/Ice/StreamSocket.h +++ b/cpp/src/Ice/StreamSocket.h @@ -36,16 +36,16 @@ public: SocketOperation read(Buffer&); SocketOperation write(Buffer&); -#if !defined(ICE_OS_WINRT) +#if !defined(ICE_OS_UWP) ssize_t read(char*, size_t); ssize_t write(const char*, size_t); #endif -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) AsyncInfo* getAsyncInfo(SocketOperation); #endif -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool startWrite(Buffer&); void finishWrite(Buffer&); void startRead(Buffer&); @@ -78,14 +78,14 @@ private: State _state; std::string _desc; -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) size_t _maxSendPacketSize; size_t _maxRecvPacketSize; AsyncInfo _read; AsyncInfo _write; #endif -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) Windows::Storage::Streams::DataReader^ _reader; Windows::Storage::Streams::DataWriter^ _writer; #endif diff --git a/cpp/src/Ice/TcpAcceptor.cpp b/cpp/src/Ice/TcpAcceptor.cpp index bf1fd17e410..e601c3418db 100755 --- a/cpp/src/Ice/TcpAcceptor.cpp +++ b/cpp/src/Ice/TcpAcceptor.cpp @@ -19,7 +19,7 @@ #if defined(ICE_USE_IOCP) # include -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Storage::Streams; @@ -49,7 +49,7 @@ IceInternal::TcpAcceptor::getNativeInfo() void IceInternal::TcpAcceptor::close() { -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) IceUtil::Mutex::Lock lock(_mutex); if(_acceptPending) { @@ -81,7 +81,7 @@ IceInternal::TcpAcceptor::listen() try { const_cast(_addr) = doBind(_fd, _addr); -#if !defined(ICE_OS_WINRT) +#if !defined(ICE_OS_UWP) doListen(_fd, _backlog); #endif } @@ -172,7 +172,7 @@ IceInternal::TcpAcceptor::accept() return new TcpTransceiver(_instance, new StreamSocket(_instance, fd)); } -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) AsyncInfo* IceInternal::TcpAcceptor::getAsyncInfo(SocketOperation) @@ -290,7 +290,7 @@ IceInternal::TcpAcceptor::TcpAcceptor(const TcpEndpointIPtr& endpoint, { _backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", SOMAXCONN); -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) _fd = ref new StreamSocketListener(); safe_cast(_fd)->ConnectionReceived += ref new TypedEventHandler( diff --git a/cpp/src/Ice/TcpAcceptor.h b/cpp/src/Ice/TcpAcceptor.h index 2d9fc24d72f..bb4b17ceb6f 100644 --- a/cpp/src/Ice/TcpAcceptor.h +++ b/cpp/src/Ice/TcpAcceptor.h @@ -15,7 +15,7 @@ #include #include -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) #include #endif @@ -29,13 +29,13 @@ class TcpAcceptor : public Acceptor, public NativeInfo public: virtual NativeInfoPtr getNativeInfo(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual AsyncInfo* getAsyncInfo(SocketOperation); #endif virtual void close(); virtual EndpointIPtr listen(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual void startAccept(); virtual void finishAccept(); #endif @@ -63,7 +63,7 @@ private: int _acceptError; std::vector _acceptBuf; AsyncInfo _info; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) IceUtil::Mutex _mutex; bool _acceptPending; std::deque _accepted; diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp index 808ac140443..759d6e08baa 100644 --- a/cpp/src/Ice/TcpTransceiver.cpp +++ b/cpp/src/Ice/TcpTransceiver.cpp @@ -56,7 +56,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf) return _stream->read(buf); } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool IceInternal::TcpTransceiver::startWrite(Buffer& buf) { diff --git a/cpp/src/Ice/TcpTransceiver.h b/cpp/src/Ice/TcpTransceiver.h index dc3d279d6dc..c892d683e79 100644 --- a/cpp/src/Ice/TcpTransceiver.h +++ b/cpp/src/Ice/TcpTransceiver.h @@ -33,7 +33,7 @@ public: virtual void close(); virtual SocketOperation write(Buffer&); virtual SocketOperation read(Buffer&); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual bool startWrite(Buffer&); virtual void finishWrite(Buffer&); virtual void startRead(Buffer&); diff --git a/cpp/src/Ice/Thread.cpp b/cpp/src/Ice/Thread.cpp index 7882a0a2948..80990aeb8ce 100644 --- a/cpp/src/Ice/Thread.cpp +++ b/cpp/src/Ice/Thread.cpp @@ -22,7 +22,7 @@ #include #include -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP # include #endif @@ -33,7 +33,7 @@ using namespace std; -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP IceUtil::ThreadControl::ThreadControl() : _id(this_thread::get_id()) diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 3769458371b..8294b7c272a 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -18,7 +18,7 @@ #include #include -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) # include #endif @@ -155,7 +155,7 @@ IceInternal::ThreadPoolWorkQueue::destroy() //Lock sync(*this); Called with the thread pool locked assert(!_destroyed); _destroyed = true; -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) _threadPool._selector.completed(this, SocketOperationRead); #else _threadPool._selector.ready(this, SocketOperationRead, true); @@ -167,7 +167,7 @@ IceInternal::ThreadPoolWorkQueue::queue(const ThreadPoolWorkItemPtr& item) { //Lock sync(*this); Called with the thread pool locked _workItems.push_back(item); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) _threadPool._selector.completed(this, SocketOperationRead); #else if(_workItems.size() == 1) @@ -177,7 +177,7 @@ IceInternal::ThreadPoolWorkQueue::queue(const ThreadPoolWorkItemPtr& item) #endif } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool IceInternal::ThreadPoolWorkQueue::startAsync(SocketOperation) { @@ -204,7 +204,7 @@ IceInternal::ThreadPoolWorkQueue::message(ThreadPoolCurrent& current) workItem = _workItems.front(); _workItems.pop_front(); } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) else { assert(_destroyed); @@ -266,14 +266,14 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p _threadIdleTime(0), _stackSize(0), _inUse(0), -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) _inUseIO(0), _nextHandler(_handlers.end()), #endif _promote(true) { PropertiesPtr properties = _instance->initializationData().properties; -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP # ifdef _WIN32 SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); @@ -297,7 +297,7 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p } int sizeMax = properties->getPropertyAsIntWithDefault(_prefix + ".SizeMax", size); -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP if(sizeMax == -1) { sizeMax = nProcessors; @@ -335,7 +335,7 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p const_cast(_size) = size; const_cast(_sizeMax) = sizeMax; const_cast(_sizeWarn) = sizeWarn; -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP const_cast(_sizeIO) = min(sizeMax, nProcessors); #else const_cast(_sizeIO) = sizeMax; @@ -492,7 +492,7 @@ IceInternal::ThreadPool::finish(const EventHandlerPtr& handler, bool closeNow) { Lock sync(*this); assert(!_destroyed); -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) closeNow = _selector.finish(handler.get(), closeNow); // This must be called before! _workQueue->queue(new FinishedWorkItem(handler, !closeNow)); return closeNow; @@ -600,7 +600,7 @@ IceInternal::ThreadPool::prefix() const void IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) { -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) ThreadPoolCurrent current(_instance, this, thread); bool select = false; while(true) @@ -751,7 +751,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) try { current._ioCompleted = false; -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, _threadIdleTime)); #else current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, current._count, current._error, @@ -770,7 +770,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) } else if(_inUse < static_cast(_threads.size() - 1)) // If not the last idle thread, we can exit. { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP BOOL hasIO = false; GetThreadIOPendingFlag(GetCurrentThread(), &hasIO); if(hasIO) @@ -801,7 +801,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) try { -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, _serverIdleTime)); #else @@ -839,7 +839,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) Error out(_instance->initializationData().logger); out << "exception in `" << _prefix << "':\n" << ex << "\nevent handler: " << current._handler->toString(); } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP catch(Platform::Exception^ ex) { // @@ -883,7 +883,7 @@ IceInternal::ThreadPool::ioCompleted(ThreadPoolCurrent& current) if(_sizeMax > 1) { -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) --_inUseIO; if(!_destroyed) @@ -953,7 +953,7 @@ IceInternal::ThreadPool::ioCompleted(ThreadPoolCurrent& current) return _serialize && current._handler.get() != _workQueue.get(); } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool IceInternal::ThreadPool::startMessage(ThreadPoolCurrent& current) { @@ -965,7 +965,7 @@ IceInternal::ThreadPool::startMessage(ThreadPoolCurrent& current) current._handler->_completed = static_cast(current._handler->_completed | current.operation); current._handler->_started = static_cast(current._handler->_started & ~current.operation); -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP AsyncInfo* info = current._handler->getNativeInfo()->getAsyncInfo(current.operation); info->count = current._count; info->error = current._error; @@ -1248,7 +1248,7 @@ ThreadPoolCurrent::ThreadPoolCurrent(const InstancePtr& instance, _threadPool(threadPool.get()), _thread(thread), _ioCompleted(false) -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) , _leader(false) #endif { diff --git a/cpp/src/Ice/ThreadPool.h b/cpp/src/Ice/ThreadPool.h index 6ff21fb606d..fbca641eb68 100644 --- a/cpp/src/Ice/ThreadPool.h +++ b/cpp/src/Ice/ThreadPool.h @@ -121,7 +121,7 @@ private: bool ioCompleted(ThreadPoolCurrent&); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool startMessage(ThreadPoolCurrent&); void finishMessage(ThreadPoolCurrent&); #else @@ -160,7 +160,7 @@ private: std::set _threads; // All threads, running or not. int _inUse; // Number of threads that are currently in use. -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) int _inUseIO; // Number of threads that are currently performing IO. std::vector > _handlers; std::vector >::const_iterator _nextHandler; @@ -183,7 +183,7 @@ public: return _threadPool->ioCompleted(const_cast(*this)); } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool startMessage() { return _threadPool->startMessage(const_cast(*this)); @@ -211,7 +211,7 @@ private: ThreadPool::EventHandlerThreadPtr _thread; EventHandlerPtr _handler; bool _ioCompleted; -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) bool _leader; #else DWORD _count; @@ -229,7 +229,7 @@ public: void destroy(); void queue(const ThreadPoolWorkItemPtr&); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool startAsync(SocketOperation); bool finishAsync(SocketOperation); #endif @@ -256,7 +256,7 @@ private: // the IOCP implementation and ensures that finishMessage isn't called multiple // times. // -#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_WINRT) +#if !defined(ICE_USE_IOCP) && !defined(ICE_OS_UWP) template class ThreadPoolMessage { public: diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h index f21e3a27aaf..4c5a02ba12a 100644 --- a/cpp/src/Ice/Transceiver.h +++ b/cpp/src/Ice/Transceiver.h @@ -34,7 +34,7 @@ public: virtual EndpointIPtr bind(); virtual SocketOperation write(Buffer&) = 0; virtual SocketOperation read(Buffer&) = 0; -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual bool startWrite(Buffer&) = 0; virtual void finishWrite(Buffer&) = 0; virtual void startRead(Buffer&) = 0; diff --git a/cpp/src/Ice/UdpConnector.cpp b/cpp/src/Ice/UdpConnector.cpp index ec98c4c0f76..ccf85403c35 100644 --- a/cpp/src/Ice/UdpConnector.cpp +++ b/cpp/src/Ice/UdpConnector.cpp @@ -124,7 +124,7 @@ IceInternal::UdpConnector::UdpConnector(const ProtocolInstancePtr& instance, con const std::string& connectionId) : _instance(instance), _addr(addr), -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP _sourceAddr(sourceAddr), #endif _mcastInterface(mcastInterface), diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index aac82cf874d..4621750689e 100755 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -17,14 +17,14 @@ #include #include -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP # include // For Concurrency::task #endif using namespace std; using namespace Ice; using namespace IceInternal; -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Storage::Streams; @@ -40,7 +40,7 @@ IceInternal::UdpTransceiver::getNativeInfo() return this; } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) AsyncInfo* IceInternal::UdpTransceiver::getAsyncInfo(SocketOperation status) { @@ -55,7 +55,7 @@ IceInternal::UdpTransceiver::getAsyncInfo(SocketOperation status) assert(false); return 0; } -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) return &_write; #endif } @@ -73,7 +73,7 @@ IceInternal::UdpTransceiver::initialize(Buffer& /*readBuffer*/, Buffer& /*writeB { #if defined(ICE_USE_IOCP) doFinishConnectAsync(_fd, _write); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) if(_write.count == SOCKET_ERROR) { try @@ -106,7 +106,7 @@ IceInternal::UdpTransceiver::closing(bool, const Ice::LocalException&) void IceInternal::UdpTransceiver::close() { -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP IceUtil::Mutex::Lock lock(_mutex); if(_readPending) { @@ -182,7 +182,7 @@ IceInternal::UdpTransceiver::write(Buffer& buf) { return SocketOperationNone; } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP return SocketOperationWrite; #else assert(buf.i == buf.b.begin()); @@ -260,7 +260,7 @@ IceInternal::UdpTransceiver::read(Buffer& buf) { return SocketOperationNone; } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP return SocketOperationRead; #else @@ -359,7 +359,7 @@ repeat: #endif } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool IceInternal::UdpTransceiver::startWrite(Buffer& buf) { @@ -369,7 +369,7 @@ IceInternal::UdpTransceiver::startWrite(Buffer& buf) assert(min(_maxPacketSize, _sndSize - _udpOverhead) >= static_cast(buf.b.size())); assert(_fd != INVALID_SOCKET); -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP if(_state < StateConnected) { try @@ -559,7 +559,7 @@ IceInternal::UdpTransceiver::finishWrite(Buffer& buf) if(static_cast(_write.count) == SOCKET_ERROR) { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP WSASetLastError(_write.error); if(connectionLost()) { @@ -589,7 +589,7 @@ IceInternal::UdpTransceiver::startRead(Buffer& buf) buf.b.resize(packetSize); buf.i = buf.b.begin(); assert(!buf.b.empty() && buf.i != buf.b.end()); -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP _read.buf.len = packetSize; _read.buf.buf = reinterpret_cast(&*buf.i); int err; @@ -645,7 +645,7 @@ IceInternal::UdpTransceiver::startRead(Buffer& buf) void IceInternal::UdpTransceiver::finishRead(Buffer& buf) { -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP IceUtil::Mutex::Lock lock(_mutex); assert(!_readPending && (!_received.empty() || _fd == INVALID_SOCKET)); if(_fd == INVALID_SOCKET) @@ -749,7 +749,7 @@ IceInternal::UdpTransceiver::toString() const } else { -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP s << fdToString(_fd); #else Address localAddr; @@ -784,7 +784,7 @@ Ice::ConnectionInfoPtr IceInternal::UdpTransceiver::getInfo() const { Ice::UDPConnectionInfoPtr info = ICE_MAKE_SHARED(Ice::UDPConnectionInfo); -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) if(isMulticast(_addr) || isAddressValid(_mcastAddr)) { info->remotePort = 0; @@ -859,7 +859,7 @@ IceInternal::UdpTransceiver::effectivePort() const IceInternal::UdpTransceiver::UdpTransceiver(const ProtocolInstancePtr& instance, const Address& addr, -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP const Address&, const string&, int @@ -877,7 +877,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const ProtocolInstancePtr& instance, #if defined(ICE_USE_IOCP) , _read(SocketOperationRead), _write(SocketOperationWrite) -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) , _readPending(false) #endif { @@ -885,7 +885,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const ProtocolInstancePtr& instance, setBufSize(-1, -1); setBlock(_fd, false); -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP _mcastAddr.saStorage.ss_family = AF_UNSPEC; _peerAddr.saStorage.ss_family = AF_UNSPEC; // Not initialized yet. @@ -956,7 +956,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const UdpEndpointIPtr& endpoint, con _mcastInterface(mcastInterface), _port(port), _state(connect ? StateNeedConnect : StateNotConnected) -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP , _readPending(false) #elif defined(ICE_USE_IOCP) , _read(SocketOperationRead), @@ -967,7 +967,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const UdpEndpointIPtr& endpoint, con setBufSize(-1, -1); setBlock(_fd, false); -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP memset(&_mcastAddr.saStorage, 0, sizeof(sockaddr_storage)); memset(&_peerAddr.saStorage, 0, sizeof(sockaddr_storage)); _peerAddr.saStorage.ss_family = AF_UNSPEC; @@ -1104,7 +1104,7 @@ IceInternal::UdpTransceiver::setBufSize(int rcvSize, int sndSize) } } -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP void IceInternal::UdpTransceiver::appendMessage(DatagramSocketMessageReceivedEventArgs^ args) { diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h index fa81553eb3c..c2c1ff0edc5 100644 --- a/cpp/src/Ice/UdpTransceiver.h +++ b/cpp/src/Ice/UdpTransceiver.h @@ -16,7 +16,7 @@ #include #include -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP # include #endif @@ -38,7 +38,7 @@ class UdpTransceiver : public Transceiver, public NativeInfo public: virtual NativeInfoPtr getNativeInfo(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual AsyncInfo* getAsyncInfo(SocketOperation); #endif @@ -48,7 +48,7 @@ public: virtual EndpointIPtr bind(); virtual SocketOperation write(Buffer&); virtual SocketOperation read(Buffer&); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual bool startWrite(Buffer&); virtual void finishWrite(Buffer&); virtual void startRead(Buffer&); @@ -73,7 +73,7 @@ private: void setBufSize(int, int); -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP void appendMessage(Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^); Windows::Networking::Sockets::DatagramSocketMessageReceivedEventArgs^ readMessage(); #endif @@ -103,7 +103,7 @@ private: AsyncInfo _write; Address _readAddr; socklen_t _readAddrLen; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) AsyncInfo _write; Windows::Storage::Streams::DataWriter^ _writer; IceUtil::Mutex _mutex; diff --git a/cpp/src/Ice/WSAcceptor.cpp b/cpp/src/Ice/WSAcceptor.cpp index d72414dae60..52a786674c0 100644 --- a/cpp/src/Ice/WSAcceptor.cpp +++ b/cpp/src/Ice/WSAcceptor.cpp @@ -21,7 +21,7 @@ IceInternal::WSAcceptor::getNativeInfo() return _delegate->getNativeInfo(); } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) IceInternal::AsyncInfo* IceInternal::WSAcceptor::getAsyncInfo(IceInternal::SocketOperation status) { @@ -42,7 +42,7 @@ IceInternal::WSAcceptor::listen() return _endpoint; } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) void IceInternal::WSAcceptor::startAccept() { diff --git a/cpp/src/Ice/WSAcceptor.h b/cpp/src/Ice/WSAcceptor.h index 0b389f6a210..251d0a8e528 100644 --- a/cpp/src/Ice/WSAcceptor.h +++ b/cpp/src/Ice/WSAcceptor.h @@ -26,13 +26,13 @@ class WSAcceptor : public Acceptor, public NativeInfo public: virtual NativeInfoPtr getNativeInfo(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual AsyncInfo* getAsyncInfo(SocketOperation); #endif virtual void close(); virtual EndpointIPtr listen(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual void startAccept(); virtual void finishAccept(); #endif diff --git a/cpp/src/Ice/WSTransceiver.cpp b/cpp/src/Ice/WSTransceiver.cpp index 0c33cfe8d8f..2c074c75974 100644 --- a/cpp/src/Ice/WSTransceiver.cpp +++ b/cpp/src/Ice/WSTransceiver.cpp @@ -133,7 +133,7 @@ Long ice_nlltoh(const Byte* src) return v; } -#if defined(ICE_OS_WINRT) +#if defined(ICE_OS_UWP) Short htons(Short v) { Short result; @@ -184,7 +184,7 @@ IceInternal::WSTransceiver::getNativeInfo() return _delegate->getNativeInfo(); } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) AsyncInfo* IceInternal::WSTransceiver::getAsyncInfo(SocketOperation status) { @@ -646,7 +646,7 @@ IceInternal::WSTransceiver::read(Buffer& buf) return s; } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) bool IceInternal::WSTransceiver::startWrite(Buffer& buf) { diff --git a/cpp/src/Ice/WSTransceiver.h b/cpp/src/Ice/WSTransceiver.h index c34a8438c7e..25cf1067163 100644 --- a/cpp/src/Ice/WSTransceiver.h +++ b/cpp/src/Ice/WSTransceiver.h @@ -29,7 +29,7 @@ class WSTransceiver : public Transceiver public: virtual NativeInfoPtr getNativeInfo(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual AsyncInfo* getAsyncInfo(SocketOperation); #endif @@ -38,7 +38,7 @@ public: virtual void close(); virtual SocketOperation write(Buffer&); virtual SocketOperation read(Buffer&); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual bool startWrite(Buffer&); virtual void finishWrite(Buffer&); virtual void startRead(Buffer&); diff --git a/cpp/src/IceSSL/AcceptorI.cpp b/cpp/src/IceSSL/AcceptorI.cpp index 8042fb8d195..ee8a05c4725 100644 --- a/cpp/src/IceSSL/AcceptorI.cpp +++ b/cpp/src/IceSSL/AcceptorI.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include @@ -34,7 +34,7 @@ IceSSL::AcceptorI::getNativeInfo() } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) IceInternal::AsyncInfo* IceSSL::AcceptorI::getAsyncInfo(IceInternal::SocketOperation status) { @@ -55,7 +55,7 @@ IceSSL::AcceptorI::listen() return _endpoint; } -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) void IceSSL::AcceptorI::startAccept() { diff --git a/cpp/src/IceSSL/AcceptorI.h b/cpp/src/IceSSL/AcceptorI.h index 3ee5d5d2d4c..b71ef8ee46c 100644 --- a/cpp/src/IceSSL/AcceptorI.h +++ b/cpp/src/IceSSL/AcceptorI.h @@ -25,13 +25,13 @@ class AcceptorI : public IceInternal::Acceptor, public IceInternal::NativeInfo public: virtual IceInternal::NativeInfoPtr getNativeInfo(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual IceInternal::AsyncInfo* getAsyncInfo(IceInternal::SocketOperation); #endif virtual void close(); virtual IceInternal::EndpointIPtr listen(); -#if defined(ICE_USE_IOCP) || defined(ICE_OS_WINRT) +#if defined(ICE_USE_IOCP) || defined(ICE_OS_UWP) virtual void startAccept(); virtual void finishAccept(); #endif diff --git a/cpp/src/IceSSL/Certificate.cpp b/cpp/src/IceSSL/Certificate.cpp index c0f7cb42589..97f2bd63365 100755 --- a/cpp/src/IceSSL/Certificate.cpp +++ b/cpp/src/IceSSL/Certificate.cpp @@ -28,7 +28,7 @@ # pragma GCC diagnostic ignored "-Wold-style-cast" #elif defined(ICE_USE_SECURE_TRANSPORT) # include -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) # include # include #endif @@ -52,7 +52,7 @@ using namespace std; using namespace Ice; using namespace IceSSL; -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP using namespace concurrency; using namespace Platform; using namespace Windows::Foundation; @@ -429,7 +429,7 @@ private: }; #endif -#elif defined(ICE_USE_SCHANNEL) || defined(ICE_OS_WINRT) +#elif defined(ICE_USE_SCHANNEL) || defined(ICE_OS_UWP) const Ice::Long TICKS_PER_MSECOND = 10000LL; const Ice::Long MSECS_TO_EPOCH = 11644473600000LL; @@ -1137,7 +1137,7 @@ Certificate::load(const string& file) } BIO_free(cert); return ICE_MAKE_SHARED(Certificate, x); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) promise> result; create_task(StorageFile::GetFileFromApplicationUriAsync( ref new Uri(ref new String(stringToWstring(file).c_str())))).then([](StorageFile^ file) @@ -1241,7 +1241,7 @@ Certificate::decode(const string& encoding) } BIO_free(cert); return ICE_MAKE_SHARED(Certificate, x); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) string::size_type size, startpos, endpos = 0; startpos = encoding.find("-----BEGIN CERTIFICATE-----", endpos); if (startpos != string::npos) @@ -1275,7 +1275,7 @@ Certificate::operator==(const Certificate& other) const return CertCompareCertificate(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, _certInfo, other._certInfo); #elif defined(ICE_USE_OPENSSL) return X509_cmp(_cert, other._cert) == 0; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) return CryptographicBuffer::Compare(_cert->GetCertificateBlob(), other._cert->GetCertificateBlob()); #else # error "Unknown platform" @@ -1305,7 +1305,7 @@ Certificate::getPublicKey() const return ICE_MAKE_SHARED(PublicKey, ICE_SHARED_FROM_CONST_THIS(Certificate), &_certInfo->SubjectPublicKeyInfo); #elif defined(ICE_USE_OPENSSL) return ICE_MAKE_SHARED(PublicKey, ICE_SHARED_FROM_CONST_THIS(Certificate), X509_get_pubkey(_cert)); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) return ICE_NULLPTR; // Not supported #else # error "Unknown platform" @@ -1433,7 +1433,7 @@ Certificate::verify(const CertificatePtr& cert) const return result; #elif defined(ICE_USE_OPENSSL) return X509_verify(_cert, cert->getPublicKey()->key()) > 0; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) return false; #else # error "Unknown platform" @@ -1519,7 +1519,7 @@ Certificate::encode() const string result = string(p->data, p->length); BIO_free(out); return result; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) auto reader = Windows::Storage::Streams::DataReader::FromBuffer(_cert->GetCertificateBlob()); std::vector data(reader->UnconsumedBufferLength); if(!data.empty()) @@ -1572,7 +1572,7 @@ Certificate::getNotAfter() const return filetimeToTime(_certInfo->NotAfter); #elif defined(ICE_USE_OPENSSL) return ASMUtcTimeToTime(X509_get_notAfter(_cert)); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) // Convert 100ns time from January 1, 1601 to ms from January 1, 1970 IceUtil::Time time = IceUtil::Time::milliSeconds(_cert->ValidTo.UniversalTime / TICKS_PER_MSECOND - MSECS_TO_EPOCH); # ifdef ICE_CPP11_MAPPING @@ -1599,7 +1599,7 @@ Certificate::getNotBefore() const return filetimeToTime(_certInfo->NotBefore); #elif defined(ICE_USE_OPENSSL) return ASMUtcTimeToTime(X509_get_notBefore(_cert)); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) // Convert 100ns time from January 1, 1601 to ms from January 1, 1970 IceUtil::Time time = IceUtil::Time::milliSeconds(_cert->ValidFrom.UniversalTime / TICKS_PER_MSECOND - MSECS_TO_EPOCH); # ifdef ICE_CPP11_MAPPING @@ -1645,7 +1645,7 @@ Certificate::getSerialNumber() const BN_free(bn); return result; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) ostringstream os; os.fill(0); os.width(2); @@ -1671,7 +1671,7 @@ Certificate::getIssuerDN() const return DistinguishedName(certNameToString(&_certInfo->Issuer)); #elif defined(ICE_USE_OPENSSL) return DistinguishedName(RFC2253::parseStrict(convertX509NameToString(X509_get_issuer_name(_cert)))); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) ostringstream os; os << "CN=" << wstringToString(_cert->Issuer->Data()); return DistinguishedName(os.str()); @@ -1690,7 +1690,7 @@ Certificate::getIssuerAlternativeNames() return certificateAltNames(_certInfo, szOID_ISSUER_ALT_NAME2); #elif defined(ICE_USE_OPENSSL) return convertGeneralNames(reinterpret_cast(X509_get_ext_d2i(_cert, NID_issuer_alt_name, 0, 0))); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) return vector >(); // Not supported #else # error "Unknown platform" @@ -1719,7 +1719,7 @@ Certificate::getSubjectDN() const return DistinguishedName(certNameToString(&_certInfo->Subject)); #elif defined(ICE_USE_OPENSSL) return DistinguishedName(RFC2253::parseStrict(convertX509NameToString(X509_get_subject_name(_cert)))); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) ostringstream os; os << "CN=" << wstringToString(_cert->Subject->Data()); return DistinguishedName(os.str()); @@ -1738,7 +1738,7 @@ Certificate::getSubjectAlternativeNames() return certificateAltNames(_certInfo, szOID_SUBJECT_ALT_NAME2); #elif defined(ICE_USE_OPENSSL) return convertGeneralNames(reinterpret_cast(X509_get_ext_d2i(_cert, NID_subject_alt_name, 0, 0))); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) return certificateAltNames(_cert->SubjectAlternativeName); #else # error "Unknown platform" @@ -1758,7 +1758,7 @@ Certificate::getVersion() const return _certInfo->dwVersion; #elif defined(ICE_USE_OPENSSL) return static_cast(X509_get_version(_cert)); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) return -1; // Not supported #else # error "Unknown platform" diff --git a/cpp/src/IceSSL/ConnectorI.cpp b/cpp/src/IceSSL/ConnectorI.cpp index 1d2ee15efd2..67f6f082e1c 100644 --- a/cpp/src/IceSSL/ConnectorI.cpp +++ b/cpp/src/IceSSL/ConnectorI.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/cpp/src/IceSSL/PluginI.cpp b/cpp/src/IceSSL/PluginI.cpp index b556be171c0..f4caa30fba0 100755 --- a/cpp/src/IceSSL/PluginI.cpp +++ b/cpp/src/IceSSL/PluginI.cpp @@ -82,8 +82,8 @@ IceSSL::PluginI::PluginI(const Ice::CommunicatorPtr& com) _engine = new SecureTransportEngine(com); #elif defined(ICE_USE_SCHANNEL) _engine = new SChannelEngine(com); -#elif defined(ICE_OS_WINRT) - _engine = new WinRTEngine(com); +#elif defined(ICE_OS_UWP) + _engine = new UWPEngine(com); #else _engine = new OpenSSLEngine(com); #endif diff --git a/cpp/src/IceSSL/PluginI.h b/cpp/src/IceSSL/PluginI.h index b0f61028c21..e896f52cc5a 100644 --- a/cpp/src/IceSSL/PluginI.h +++ b/cpp/src/IceSSL/PluginI.h @@ -51,8 +51,8 @@ private: SecureTransportEnginePtr _engine; #elif defined(ICE_USE_SCHANNEL) SChannelEnginePtr _engine; -#elif defined(ICE_OS_WINRT) - WinRTEnginePtr _engine; +#elif defined(ICE_OS_UWP) + UWPEnginePtr _engine; #else OpenSSLEnginePtr _engine; #endif diff --git a/cpp/src/IceSSL/SSLEngine.h b/cpp/src/IceSSL/SSLEngine.h index 1ceca9e7b16..d9f1a87ca81 100644 --- a/cpp/src/IceSSL/SSLEngine.h +++ b/cpp/src/IceSSL/SSLEngine.h @@ -40,7 +40,7 @@ # include # include # undef SECURITY_WIN32 -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) # include #endif @@ -225,13 +225,13 @@ private: std::vector _ciphers; }; -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) -class WinRTEngine : public SSLEngine +class UWPEngine : public SSLEngine { public: - WinRTEngine(const Ice::CommunicatorPtr&); + UWPEngine(const Ice::CommunicatorPtr&); virtual void initialize(); virtual bool initialized() const; diff --git a/cpp/src/IceSSL/SSLEngineF.h b/cpp/src/IceSSL/SSLEngineF.h index 1a5548aaf2b..70a75e74edb 100644 --- a/cpp/src/IceSSL/SSLEngineF.h +++ b/cpp/src/IceSSL/SSLEngineF.h @@ -30,10 +30,10 @@ typedef IceInternal::Handle SecureTransportEnginePtr; class SChannelEngine; ICESSL_API IceUtil::Shared* upCast(SChannelEngine*); typedef IceInternal::Handle SChannelEnginePtr; -#elif defined(ICE_OS_WINRT) -class WinRTEngine; -ICESSL_API IceUtil::Shared* upCast(WinRTEngine*); -typedef IceInternal::Handle WinRTEnginePtr; +#elif defined(ICE_OS_UWP) +class UWPEngine; +ICESSL_API IceUtil::Shared* upCast(UWPEngine*); +typedef IceInternal::Handle UWPEnginePtr; #else // OpenSSL class OpenSSLEngine; ICESSL_API IceUtil::Shared* upCast(OpenSSLEngine*); diff --git a/cpp/src/IceSSL/UWPEngine.cpp b/cpp/src/IceSSL/UWPEngine.cpp new file mode 100644 index 00000000000..1619fa68f21 --- /dev/null +++ b/cpp/src/IceSSL/UWPEngine.cpp @@ -0,0 +1,107 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 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 + +#ifdef ICE_OS_UWP + +#include +#include +#include +#include + +#include + +IceUtil::Shared* IceSSL::upCast(IceSSL::UWPEngine* p) { return p; } + +using namespace std; +using namespace IceSSL; + +UWPEngine::UWPEngine(const Ice::CommunicatorPtr& communicator) : SSLEngine(communicator) +{ +} + +void +UWPEngine::initialize() +{ + lock_guard lock(_mutex); + if(_initialized) + { + return; + } + + SSLEngine::initialize(); + + const auto properties = communicator()->getProperties(); + + // + // Load CAs + // + //string ca = properties->getProperty("IceSSL.CAs"); + //if(!ca.empty()) + //{ + // _ca = Certificate::load(ca); + //} + + // + // Load client certificate + // + const int passwordRetryMax = properties->getPropertyAsIntWithDefault("IceSSL.PasswordRetryMax", 3); + setPassword(properties->getProperty("IceSSL.Password")); + + string certFile = properties->getProperty("IceSSL.CertFile"); + string findCert = properties->getProperty("IceSSL.FindCert"); + if(!certFile.empty()) + { + _certificate = make_shared(importPersonalCertificate( + certFile, + [this]() + { + return password(false); + }, + getPasswordPrompt() != nullptr, + passwordRetryMax)); + } + else if(!findCert.empty()) + { + auto certs = findCertificates(properties->getPropertyWithDefault("IceSSL.CertStore", "My"), findCert); + if(certs->Size == 0) + { + throw Ice::PluginInitializationException(__FILE__, __LINE__, "IceSSL: no certificates found"); + } + _certificate = make_shared(certs->GetAt(0)); + } + _initialized = true; +} + +bool +UWPEngine::initialized() const +{ + return _initialized; +} + +//shared_ptr +//UWPEngine::ca() +//{ +// return _ca; +//} + +shared_ptr +UWPEngine::certificate() +{ + return _certificate; +} + +void +UWPEngine::destroy() +{ +} + +#endif + diff --git a/cpp/src/IceSSL/UWPTransceiverI.cpp b/cpp/src/IceSSL/UWPTransceiverI.cpp new file mode 100644 index 00000000000..bef7d0769b5 --- /dev/null +++ b/cpp/src/IceSSL/UWPTransceiverI.cpp @@ -0,0 +1,388 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 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 + +#ifdef ICE_OS_UWP + +#include +#include +#include +#include +#include + +using namespace std; +using namespace Ice; +using namespace IceSSL; + +using namespace concurrency; +using namespace Platform; +using namespace Windows::Networking; +using namespace Windows::Networking::Sockets; +using namespace Windows::Foundation::Collections; +using namespace Windows::Security::Cryptography::Certificates; + +namespace +{ + +std::string +validationResultToString(ChainValidationResult result) +{ + switch (result) + { + case ChainValidationResult::Success: + { + return "The certificate chain was verified."; + } + case ChainValidationResult::Untrusted: + { + return "A certificate in the chain is not trusted."; + } + case ChainValidationResult::Revoked: + { + return "A certificate in the chain has been revoked."; + } + case ChainValidationResult::Expired: + { + return "A certificate in the chain has expired."; + } + case ChainValidationResult::IncompleteChain: + { + return "The certificate chain is missing one or more certificates."; + } + case ChainValidationResult::InvalidSignature: + { + return "The signature of a certificate in the chain cannot be verified."; + } + case ChainValidationResult::WrongUsage: + { + return "A certificate in the chain is being used for a purpose other than one specified by its CA."; + } + case ChainValidationResult::InvalidName: + { + return "A certificate in the chain has a name that is not valid. The name is either not included in " + "the permitted list or is explicitly excluded."; + } + case ChainValidationResult::InvalidCertificateAuthorityPolicy: + { + return "A certificate in the chain has a policy that is not valid."; + } + case ChainValidationResult::BasicConstraintsError: + { + return "The basic constraint extension of a certificate in the chain has not been observed."; + } + case ChainValidationResult::UnknownCriticalExtension: + { + return "A certificate in the chain contains an unknown extension that is marked \"critical\"."; + } + case ChainValidationResult::RevocationInformationMissing: + { + return "No installed or registered DLL was found to verify revocation."; + } + case ChainValidationResult::RevocationFailure: + { + return "Unable to connect to the revocation server."; + } + case ChainValidationResult::OtherErrors: + { + return "An unexpected error occurred while validating the certificate chain."; + } + default: + { + assert(false); + return ""; + } + } +} + +} + +IceInternal::NativeInfoPtr +IceSSL::TransceiverI::getNativeInfo() +{ + return _delegate->getNativeInfo(); +} + +IceInternal::SocketOperation +IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& writeBuffer) +{ + if(!_connected) + { + IceInternal::SocketOperation status = _delegate->initialize(readBuffer, writeBuffer); + if(status != IceInternal::SocketOperationNone) + { + return status; + } + _connected = true; + + // + // Continue connecting, this will call startWrite/finishWrite to upgrade the stream + // to SSL. + // + return IceInternal::SocketOperationConnect; + } + else if(!_upgraded) + { + _upgraded = true; + try + { + auto fd = safe_cast(_delegate->getNativeInfo()->fd()); + if(fd->Information->ServerCertificate) + { + // + // Build the certificate chain + // + auto params = ref new ChainBuildingParameters(); + params->AuthorityInformationAccessEnabled = false; + params->CurrentTimeValidationEnabled = true; + params->NetworkRetrievalEnabled = false; + params->RevocationCheckEnabled = false; + + // + // BUGFIX: It is currently not possible to set ExclusiveTrustRoots programatically + // it is causing a read access exception see:https://goo.gl/B6OaNx + // + //if(_engine->ca()) + //{ + // params->ExclusiveTrustRoots->Append(_engine->ca()->getCert()); + //} + + promise p; + create_task(fd->Information->ServerCertificate->BuildChainAsync( + fd->Information->ServerIntermediateCertificates, params)).then( + [&](task previous) + { + try + { + p.set_value(previous.get()); + } + catch(Platform::Exception^ ex) + { + try + { + throw SyscallException(__FILE__, __LINE__, ex->HResult); + } + catch(...) + { + p.set_exception(current_exception()); + } + } + }); + + _chain = p.get_future().get(); + + ChainValidationResult result = _chain->Validate(); + // + // Ignore InvalidName errors here SSLEngine::verifyPeer already checks that + // using IceSSL.CheckCertName settings. + // + if(result != ChainValidationResult::InvalidName && result != ChainValidationResult::Success) + { + if(_engine->getVerifyPeer() == 0) + { + if(_instance->traceLevel() >= 1) + { + _instance->logger()->trace(_instance->traceCategory(), + "IceSSL: ignoring certificate verification failure\n" + + validationResultToString(result)); + } + } + else + { + throw SecurityException(__FILE__, __LINE__, + "IceSSL: certificate validation error:\n" + validationResultToString(result)); + } + } + else + { + _verified = true; + } + } + else if((!_incoming && _engine->getVerifyPeer() > 0) || (_incoming && _engine->getVerifyPeer() == 2)) + { + // + // Clients require server certificate if VerifyPeer > 0 and servers require client + // certificate if VerifyPeer == 2 + // + throw SecurityException(__FILE__, __LINE__, "IceSSL: certificate required"); + } + + _engine->verifyPeer(_host, dynamic_pointer_cast(getInfo()), toString()); + } + catch(Platform::Exception^ ex) + { + ostringstream os; + os << "IceSSL: certificate verification failure:\n" << wstringToString(ex->Message->Data()); + throw SecurityException(__FILE__, __LINE__, os.str()); + } + } + return IceInternal::SocketOperationNone; +} + +IceInternal::SocketOperation +IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException& ex) +{ + return _delegate->closing(initiator, ex); +} + +void +IceSSL::TransceiverI::close() +{ + _delegate->close(); +} + +IceInternal::SocketOperation +IceSSL::TransceiverI::write(IceInternal::Buffer& buf) +{ + return _delegate->write(buf); +} + +IceInternal::SocketOperation +IceSSL::TransceiverI::read(IceInternal::Buffer& buf) +{ + return _delegate->read(buf); +} + +bool +IceSSL::TransceiverI::startWrite(IceInternal::Buffer& buf) +{ + if(_connected && !_upgraded) + { + StreamSocket^ stream = safe_cast(_delegate->getNativeInfo()->fd()); + HostName^ host = ref new HostName(ref new String(IceUtil::stringToWstring(_host).c_str())); + + // + // We ignore SSL Certificate errors at this point, the certificate chain will be validated + // when the chain is constructed in IceSSL::Transceiver::initialize + // + stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::Expired); + stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::IncompleteChain); + stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::InvalidName); + stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::RevocationFailure); + stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::RevocationInformationMissing); + stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::Untrusted); + stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::WrongUsage); + + if(_engine->certificate()) + { + stream->Control->ClientCertificate = _engine->certificate()->getCert(); + } + + try + { + Windows::Foundation::IAsyncAction^ action = stream->UpgradeToSslAsync(SocketProtectionLevel::Tls12, host); + getNativeInfo()->queueAction(IceInternal::SocketOperationWrite, action); + } + catch(Platform::Exception^ ex) + { + IceInternal::checkErrorCode(__FILE__, __LINE__, ex->HResult); + } + return true; + } + return _delegate->startWrite(buf); +} + +void +IceSSL::TransceiverI::finishWrite(IceInternal::Buffer& buf) +{ + if(_connected && !_upgraded) + { + IceInternal::AsyncInfo* asyncInfo = getNativeInfo()->getAsyncInfo(IceInternal::SocketOperationWrite); + if(asyncInfo->count == SOCKET_ERROR) + { + IceInternal::checkErrorCode(__FILE__, __LINE__, asyncInfo->error); + } + return; + } + _delegate->finishWrite(buf); +} + +void +IceSSL::TransceiverI::startRead(IceInternal::Buffer& buf) +{ + _delegate->startRead(buf); +} + +void +IceSSL::TransceiverI::finishRead(IceInternal::Buffer& buf) +{ + _delegate->finishRead(buf); +} + +string +IceSSL::TransceiverI::protocol() const +{ + return _instance->protocol(); +} + +string +IceSSL::TransceiverI::toString() const +{ + return _delegate->toString(); +} + +string +IceSSL::TransceiverI::toDetailedString() const +{ + return toString(); +} + +Ice::ConnectionInfoPtr +IceSSL::TransceiverI::getInfo() const +{ + NativeConnectionInfoPtr info = ICE_MAKE_SHARED(NativeConnectionInfo); + StreamSocket^ stream = safe_cast(_delegate->getNativeInfo()->fd()); + if(_chain) + { + auto certs = _chain->GetCertificates(true); + for(auto iter = certs->First(); iter->HasCurrent; iter->MoveNext()) + { + info->nativeCerts.push_back(ICE_MAKE_SHARED(Certificate, iter->Current)); + info->certs.push_back(info->nativeCerts.back()->encode()); + } + } + info->verified = _verified; + info->adapterName = _adapterName; + info->incoming = _incoming; + info->underlying = _delegate->getInfo(); + return info; +} + +void +IceSSL::TransceiverI::checkSendSize(const IceInternal::Buffer&) +{ +} + +void +IceSSL::TransceiverI::setBufferSize(int rcvSize, int sndSize) +{ + _delegate->setBufferSize(rcvSize, sndSize); +} + +IceSSL::TransceiverI::TransceiverI(const InstancePtr& instance, + const IceInternal::TransceiverPtr& delegate, + const string& hostOrAdapterName, + bool incoming) : + _instance(instance), + _engine(UWPEnginePtr::dynamicCast(instance->engine())), + _host(incoming ? "" : hostOrAdapterName), + _adapterName(incoming ? hostOrAdapterName : ""), + _incoming(incoming), + _delegate(delegate), + _connected(false), + _upgraded(false), + _verified(false) +{ +} + +IceSSL::TransceiverI::~TransceiverI() +{ +} + +#endif diff --git a/cpp/src/IceSSL/UWPTransceiverI.h b/cpp/src/IceSSL/UWPTransceiverI.h new file mode 100644 index 00000000000..6f1e7ef41fc --- /dev/null +++ b/cpp/src/IceSSL/UWPTransceiverI.h @@ -0,0 +1,79 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 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. +// +// ********************************************************************** + +#ifndef ICE_SSL_UWP_TRANSCEIVER_I_H +#define ICE_SSL_UWP_TRANSCEIVER_I_H + +#include + +#ifdef ICE_OS_UWP + +#include +#include +#include + +#include +#include + +namespace IceSSL +{ + +class ConnectorI; +class AcceptorI; + +class TransceiverI : public IceInternal::Transceiver +{ +public: + + virtual IceInternal::NativeInfoPtr getNativeInfo(); + + virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); + virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); + virtual void close(); + virtual IceInternal::SocketOperation write(IceInternal::Buffer&); + virtual IceInternal::SocketOperation read(IceInternal::Buffer&); + virtual bool startWrite(IceInternal::Buffer&); + virtual void finishWrite(IceInternal::Buffer&); + virtual void startRead(IceInternal::Buffer&); + virtual void finishRead(IceInternal::Buffer&); + + virtual std::string protocol() const; + virtual std::string toString() const; + virtual std::string toDetailedString() const; + virtual Ice::ConnectionInfoPtr getInfo() const; + virtual void checkSendSize(const IceInternal::Buffer&); + virtual void setBufferSize(int rcvSize, int sndSize); + +private: + + TransceiverI(const InstancePtr&, const IceInternal::TransceiverPtr&, const std::string&, bool); + virtual ~TransceiverI(); + + friend class ConnectorI; + friend class AcceptorI; + + const InstancePtr _instance; + const UWPEnginePtr _engine; + const std::string _host; + const std::string _adapterName; + const bool _incoming; + const IceInternal::TransceiverPtr _delegate; + + bool _connected; + bool _upgraded; + bool _verified; + Windows::Security::Cryptography::Certificates::CertificateChain^ _chain; +}; +typedef IceUtil::Handle TransceiverIPtr; + +} + +#endif + +#endif diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp index f6fd6a92563..f262d09979f 100755 --- a/cpp/src/IceSSL/Util.cpp +++ b/cpp/src/IceSSL/Util.cpp @@ -8,7 +8,7 @@ // ********************************************************************** #include -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) # include #endif @@ -23,7 +23,7 @@ #include #include -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP # include #endif @@ -40,7 +40,7 @@ using namespace Ice; using namespace IceUtil; using namespace IceSSL; -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP using namespace concurrency; using namespace Platform; using namespace Windows::Foundation; @@ -1692,7 +1692,7 @@ IceSSL::findCertificates(const string& location, const string& name, const strin } return certs; } -#elif defined (ICE_OS_WINRT) +#elif defined (ICE_OS_UWP) namespace { diff --git a/cpp/src/IceSSL/Util.h b/cpp/src/IceSSL/Util.h index f10f5f25a72..fc6af1020cc 100644 --- a/cpp/src/IceSSL/Util.h +++ b/cpp/src/IceSSL/Util.h @@ -202,7 +202,7 @@ CFArrayRef findCertificateChain(const std::string&, const std::string&, const st #elif defined(ICE_USE_SCHANNEL) std::vector findCertificates(const std::string&, const std::string&, const std::string&, std::vector&); -#elif defined(ICE_OS_WINRT) +#elif defined(ICE_OS_UWP) Windows::Security::Cryptography::Certificates::Certificate^ importPersonalCertificate(const std::string&, std::function, bool, int); diff --git a/cpp/src/IceSSL/WinRTEngine.cpp b/cpp/src/IceSSL/WinRTEngine.cpp deleted file mode 100755 index 51cde970937..00000000000 --- a/cpp/src/IceSSL/WinRTEngine.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 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 - -#ifdef ICE_OS_WINRT - -#include -#include -#include -#include - -#include - -IceUtil::Shared* IceSSL::upCast(IceSSL::WinRTEngine* p) { return p; } - -using namespace std; -using namespace IceSSL; - -WinRTEngine::WinRTEngine(const Ice::CommunicatorPtr& communicator) : SSLEngine(communicator) -{ -} - -void -WinRTEngine::initialize() -{ - lock_guard lock(_mutex); - if(_initialized) - { - return; - } - - SSLEngine::initialize(); - - const auto properties = communicator()->getProperties(); - - // - // Load CAs - // - //string ca = properties->getProperty("IceSSL.CAs"); - //if(!ca.empty()) - //{ - // _ca = Certificate::load(ca); - //} - - // - // Load client certificate - // - const int passwordRetryMax = properties->getPropertyAsIntWithDefault("IceSSL.PasswordRetryMax", 3); - setPassword(properties->getProperty("IceSSL.Password")); - - string certFile = properties->getProperty("IceSSL.CertFile"); - string findCert = properties->getProperty("IceSSL.FindCert"); - if(!certFile.empty()) - { - _certificate = make_shared(importPersonalCertificate( - certFile, - [this]() - { - return password(false); - }, - getPasswordPrompt() != nullptr, - passwordRetryMax)); - } - else if(!findCert.empty()) - { - auto certs = findCertificates(properties->getPropertyWithDefault("IceSSL.CertStore", "My"), findCert); - if(certs->Size == 0) - { - throw Ice::PluginInitializationException(__FILE__, __LINE__, "IceSSL: no certificates found"); - } - _certificate = make_shared(certs->GetAt(0)); - } - _initialized = true; -} - -bool -WinRTEngine::initialized() const -{ - return _initialized; -} - -//shared_ptr -//WinRTEngine::ca() -//{ -// return _ca; -//} - -shared_ptr -WinRTEngine::certificate() -{ - return _certificate; -} - -void -WinRTEngine::destroy() -{ -} - -#endif - diff --git a/cpp/src/IceSSL/WinRTTransceiverI.cpp b/cpp/src/IceSSL/WinRTTransceiverI.cpp deleted file mode 100755 index 2e974c1725d..00000000000 --- a/cpp/src/IceSSL/WinRTTransceiverI.cpp +++ /dev/null @@ -1,388 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 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 - -#ifdef ICE_OS_WINRT - -#include -#include -#include -#include -#include - -using namespace std; -using namespace Ice; -using namespace IceSSL; - -using namespace concurrency; -using namespace Platform; -using namespace Windows::Networking; -using namespace Windows::Networking::Sockets; -using namespace Windows::Foundation::Collections; -using namespace Windows::Security::Cryptography::Certificates; - -namespace -{ - -std::string -validationResultToString(ChainValidationResult result) -{ - switch (result) - { - case ChainValidationResult::Success: - { - return "The certificate chain was verified."; - } - case ChainValidationResult::Untrusted: - { - return "A certificate in the chain is not trusted."; - } - case ChainValidationResult::Revoked: - { - return "A certificate in the chain has been revoked."; - } - case ChainValidationResult::Expired: - { - return "A certificate in the chain has expired."; - } - case ChainValidationResult::IncompleteChain: - { - return "The certificate chain is missing one or more certificates."; - } - case ChainValidationResult::InvalidSignature: - { - return "The signature of a certificate in the chain cannot be verified."; - } - case ChainValidationResult::WrongUsage: - { - return "A certificate in the chain is being used for a purpose other than one specified by its CA."; - } - case ChainValidationResult::InvalidName: - { - return "A certificate in the chain has a name that is not valid. The name is either not included in " - "the permitted list or is explicitly excluded."; - } - case ChainValidationResult::InvalidCertificateAuthorityPolicy: - { - return "A certificate in the chain has a policy that is not valid."; - } - case ChainValidationResult::BasicConstraintsError: - { - return "The basic constraint extension of a certificate in the chain has not been observed."; - } - case ChainValidationResult::UnknownCriticalExtension: - { - return "A certificate in the chain contains an unknown extension that is marked \"critical\"."; - } - case ChainValidationResult::RevocationInformationMissing: - { - return "No installed or registered DLL was found to verify revocation."; - } - case ChainValidationResult::RevocationFailure: - { - return "Unable to connect to the revocation server."; - } - case ChainValidationResult::OtherErrors: - { - return "An unexpected error occurred while validating the certificate chain."; - } - default: - { - assert(false); - return ""; - } - } -} - -} - -IceInternal::NativeInfoPtr -IceSSL::TransceiverI::getNativeInfo() -{ - return _delegate->getNativeInfo(); -} - -IceInternal::SocketOperation -IceSSL::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& writeBuffer) -{ - if(!_connected) - { - IceInternal::SocketOperation status = _delegate->initialize(readBuffer, writeBuffer); - if(status != IceInternal::SocketOperationNone) - { - return status; - } - _connected = true; - - // - // Continue connecting, this will call startWrite/finishWrite to upgrade the stream - // to SSL. - // - return IceInternal::SocketOperationConnect; - } - else if(!_upgraded) - { - _upgraded = true; - try - { - auto fd = safe_cast(_delegate->getNativeInfo()->fd()); - if(fd->Information->ServerCertificate) - { - // - // Build the certificate chain - // - auto params = ref new ChainBuildingParameters(); - params->AuthorityInformationAccessEnabled = false; - params->CurrentTimeValidationEnabled = true; - params->NetworkRetrievalEnabled = false; - params->RevocationCheckEnabled = false; - - // - // BUGFIX: It is currently not possible to set ExclusiveTrustRoots programatically - // it is causing a read access exception see:https://goo.gl/B6OaNx - // - //if(_engine->ca()) - //{ - // params->ExclusiveTrustRoots->Append(_engine->ca()->getCert()); - //} - - promise p; - create_task(fd->Information->ServerCertificate->BuildChainAsync( - fd->Information->ServerIntermediateCertificates, params)).then( - [&](task previous) - { - try - { - p.set_value(previous.get()); - } - catch(Platform::Exception^ ex) - { - try - { - throw SyscallException(__FILE__, __LINE__, ex->HResult); - } - catch(...) - { - p.set_exception(current_exception()); - } - } - }); - - _chain = p.get_future().get(); - - ChainValidationResult result = _chain->Validate(); - // - // Ignore InvalidName errors here SSLEngine::verifyPeer already checks that - // using IceSSL.CheckCertName settings. - // - if(result != ChainValidationResult::InvalidName && result != ChainValidationResult::Success) - { - if(_engine->getVerifyPeer() == 0) - { - if(_instance->traceLevel() >= 1) - { - _instance->logger()->trace(_instance->traceCategory(), - "IceSSL: ignoring certificate verification failure\n" + - validationResultToString(result)); - } - } - else - { - throw SecurityException(__FILE__, __LINE__, - "IceSSL: certificate validation error:\n" + validationResultToString(result)); - } - } - else - { - _verified = true; - } - } - else if((!_incoming && _engine->getVerifyPeer() > 0) || (_incoming && _engine->getVerifyPeer() == 2)) - { - // - // Clients require server certificate if VerifyPeer > 0 and servers require client - // certificate if VerifyPeer == 2 - // - throw SecurityException(__FILE__, __LINE__, "IceSSL: certificate required"); - } - - _engine->verifyPeer(_host, dynamic_pointer_cast(getInfo()), toString()); - } - catch(Platform::Exception^ ex) - { - ostringstream os; - os << "IceSSL: certificate verification failure:\n" << wstringToString(ex->Message->Data()); - throw SecurityException(__FILE__, __LINE__, os.str()); - } - } - return IceInternal::SocketOperationNone; -} - -IceInternal::SocketOperation -IceSSL::TransceiverI::closing(bool initiator, const Ice::LocalException& ex) -{ - return _delegate->closing(initiator, ex); -} - -void -IceSSL::TransceiverI::close() -{ - _delegate->close(); -} - -IceInternal::SocketOperation -IceSSL::TransceiverI::write(IceInternal::Buffer& buf) -{ - return _delegate->write(buf); -} - -IceInternal::SocketOperation -IceSSL::TransceiverI::read(IceInternal::Buffer& buf) -{ - return _delegate->read(buf); -} - -bool -IceSSL::TransceiverI::startWrite(IceInternal::Buffer& buf) -{ - if(_connected && !_upgraded) - { - StreamSocket^ stream = safe_cast(_delegate->getNativeInfo()->fd()); - HostName^ host = ref new HostName(ref new String(IceUtil::stringToWstring(_host).c_str())); - - // - // We ignore SSL Certificate errors at this point, the certificate chain will be validated - // when the chain is constructed in IceSSL::Transceiver::initialize - // - stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::Expired); - stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::IncompleteChain); - stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::InvalidName); - stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::RevocationFailure); - stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::RevocationInformationMissing); - stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::Untrusted); - stream->Control->IgnorableServerCertificateErrors->Append(ChainValidationResult::WrongUsage); - - if(_engine->certificate()) - { - stream->Control->ClientCertificate = _engine->certificate()->getCert(); - } - - try - { - Windows::Foundation::IAsyncAction^ action = stream->UpgradeToSslAsync(SocketProtectionLevel::Tls12, host); - getNativeInfo()->queueAction(IceInternal::SocketOperationWrite, action); - } - catch(Platform::Exception^ ex) - { - IceInternal::checkErrorCode(__FILE__, __LINE__, ex->HResult); - } - return true; - } - return _delegate->startWrite(buf); -} - -void -IceSSL::TransceiverI::finishWrite(IceInternal::Buffer& buf) -{ - if(_connected && !_upgraded) - { - IceInternal::AsyncInfo* asyncInfo = getNativeInfo()->getAsyncInfo(IceInternal::SocketOperationWrite); - if(asyncInfo->count == SOCKET_ERROR) - { - IceInternal::checkErrorCode(__FILE__, __LINE__, asyncInfo->error); - } - return; - } - _delegate->finishWrite(buf); -} - -void -IceSSL::TransceiverI::startRead(IceInternal::Buffer& buf) -{ - _delegate->startRead(buf); -} - -void -IceSSL::TransceiverI::finishRead(IceInternal::Buffer& buf) -{ - _delegate->finishRead(buf); -} - -string -IceSSL::TransceiverI::protocol() const -{ - return _instance->protocol(); -} - -string -IceSSL::TransceiverI::toString() const -{ - return _delegate->toString(); -} - -string -IceSSL::TransceiverI::toDetailedString() const -{ - return toString(); -} - -Ice::ConnectionInfoPtr -IceSSL::TransceiverI::getInfo() const -{ - NativeConnectionInfoPtr info = ICE_MAKE_SHARED(NativeConnectionInfo); - StreamSocket^ stream = safe_cast(_delegate->getNativeInfo()->fd()); - if(_chain) - { - auto certs = _chain->GetCertificates(true); - for(auto iter = certs->First(); iter->HasCurrent; iter->MoveNext()) - { - info->nativeCerts.push_back(ICE_MAKE_SHARED(Certificate, iter->Current)); - info->certs.push_back(info->nativeCerts.back()->encode()); - } - } - info->verified = _verified; - info->adapterName = _adapterName; - info->incoming = _incoming; - info->underlying = _delegate->getInfo(); - return info; -} - -void -IceSSL::TransceiverI::checkSendSize(const IceInternal::Buffer&) -{ -} - -void -IceSSL::TransceiverI::setBufferSize(int rcvSize, int sndSize) -{ - _delegate->setBufferSize(rcvSize, sndSize); -} - -IceSSL::TransceiverI::TransceiverI(const InstancePtr& instance, - const IceInternal::TransceiverPtr& delegate, - const string& hostOrAdapterName, - bool incoming) : - _instance(instance), - _engine(WinRTEnginePtr::dynamicCast(instance->engine())), - _host(incoming ? "" : hostOrAdapterName), - _adapterName(incoming ? hostOrAdapterName : ""), - _incoming(incoming), - _delegate(delegate), - _connected(false), - _upgraded(false), - _verified(false) -{ -} - -IceSSL::TransceiverI::~TransceiverI() -{ -} - -#endif diff --git a/cpp/src/IceSSL/WinRTTransceiverI.h b/cpp/src/IceSSL/WinRTTransceiverI.h deleted file mode 100755 index 71429198022..00000000000 --- a/cpp/src/IceSSL/WinRTTransceiverI.h +++ /dev/null @@ -1,79 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 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. -// -// ********************************************************************** - -#ifndef ICE_SSL_WINRT_TRANSCEIVER_I_H -#define ICE_SSL_WINRT_TRANSCEIVER_I_H - -#include - -#ifdef ICE_OS_WINRT - -#include -#include -#include - -#include -#include - -namespace IceSSL -{ - -class ConnectorI; -class AcceptorI; - -class TransceiverI : public IceInternal::Transceiver -{ -public: - - virtual IceInternal::NativeInfoPtr getNativeInfo(); - - virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); - virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); - virtual void close(); - virtual IceInternal::SocketOperation write(IceInternal::Buffer&); - virtual IceInternal::SocketOperation read(IceInternal::Buffer&); - virtual bool startWrite(IceInternal::Buffer&); - virtual void finishWrite(IceInternal::Buffer&); - virtual void startRead(IceInternal::Buffer&); - virtual void finishRead(IceInternal::Buffer&); - - virtual std::string protocol() const; - virtual std::string toString() const; - virtual std::string toDetailedString() const; - virtual Ice::ConnectionInfoPtr getInfo() const; - virtual void checkSendSize(const IceInternal::Buffer&); - virtual void setBufferSize(int rcvSize, int sndSize); - -private: - - TransceiverI(const InstancePtr&, const IceInternal::TransceiverPtr&, const std::string&, bool); - virtual ~TransceiverI(); - - friend class ConnectorI; - friend class AcceptorI; - - const InstancePtr _instance; - const WinRTEnginePtr _engine; - const std::string _host; - const std::string _adapterName; - const bool _incoming; - const IceInternal::TransceiverPtr _delegate; - - bool _connected; - bool _upgraded; - bool _verified; - Windows::Security::Cryptography::Certificates::CertificateChain^ _chain; -}; -typedef IceUtil::Handle TransceiverIPtr; - -} - -#endif - -#endif diff --git a/cpp/src/IceSSL/msbuild/icessluwp++11/icessluwp++11.vcxproj b/cpp/src/IceSSL/msbuild/icessluwp++11/icessluwp++11.vcxproj index 2387a31de6f..318e38a3785 100644 --- a/cpp/src/IceSSL/msbuild/icessluwp++11/icessluwp++11.vcxproj +++ b/cpp/src/IceSSL/msbuild/icessluwp++11/icessluwp++11.vcxproj @@ -147,8 +147,8 @@ - - + + true true diff --git a/cpp/src/IceSSL/msbuild/icessluwp++11/icessluwp++11.vcxproj.filters b/cpp/src/IceSSL/msbuild/icessluwp++11/icessluwp++11.vcxproj.filters index e3eed3add57..2540bd3e82d 100644 --- a/cpp/src/IceSSL/msbuild/icessluwp++11/icessluwp++11.vcxproj.filters +++ b/cpp/src/IceSSL/msbuild/icessluwp++11/icessluwp++11.vcxproj.filters @@ -129,7 +129,7 @@ Source Files - + Source Files @@ -141,7 +141,7 @@ Source Files - + Source Files diff --git a/cpp/src/IceUtil/FileUtil.cpp b/cpp/src/IceUtil/FileUtil.cpp index 9da2b9bd3c5..6c7203d7c87 100644 --- a/cpp/src/IceUtil/FileUtil.cpp +++ b/cpp/src/IceUtil/FileUtil.cpp @@ -17,7 +17,7 @@ #ifdef _WIN32 # include # include -# ifndef ICE_OS_WINRT +# ifndef ICE_OS_UWP # include # endif #else @@ -96,7 +96,7 @@ IceUtilInternal::directoryExists(const string& path) // // Determine if a directory exists and is empty. // -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP bool IceUtilInternal::isEmptyDirectory(const string& path) { @@ -245,7 +245,7 @@ IceUtilInternal::open(const string& path, int flags) } } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP int IceUtilInternal::getcwd(string& cwd) { @@ -291,7 +291,7 @@ IceUtilInternal::FileLock::FileLock(const std::string& path) : // Don't need to use a wide string converter, the wide string is directly passed // to Windows API. // -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP _fd = ::CreateFileW(stringToWstring(path, IceUtil::getProcessStringConverter()).c_str(), GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); #else diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp index f2f973d1f02..768c09471f0 100644 --- a/cpp/src/IceUtil/RecMutex.cpp +++ b/cpp/src/IceUtil/RecMutex.cpp @@ -33,7 +33,7 @@ IceUtil::RecMutex::RecMutex(const IceUtil::MutexProtocol protocol) : void IceUtil::RecMutex::init(const MutexProtocol) { -# ifdef ICE_OS_WINRT +# ifdef ICE_OS_UWP InitializeCriticalSectionEx(&_mutex, 0, 0); # else InitializeCriticalSection(&_mutex); diff --git a/cpp/src/IceUtil/StringUtil.cpp b/cpp/src/IceUtil/StringUtil.cpp index c59eebecbab..6c87d8d7148 100644 --- a/cpp/src/IceUtil/StringUtil.cpp +++ b/cpp/src/IceUtil/StringUtil.cpp @@ -816,7 +816,7 @@ IceUtilInternal::errorToString(int error, LPCVOID source) { if(error < WSABASEERR) { -#ifdef ICE_OS_WINRT +#ifdef ICE_OS_UWP wstring lpMsgBuf(256, wchar_t()); DWORD stored = 0; @@ -881,7 +881,7 @@ IceUtilInternal::errorToString(int error, LPCVOID source) { result = result.substr(0, result.length() - 2); } -#ifndef ICE_OS_WINRT +#ifndef ICE_OS_UWP if(msg) { LocalFree(msg); diff --git a/cpp/src/IceUtil/UUID.cpp b/cpp/src/IceUtil/UUID.cpp index 0df6a54238d..d01ddbb99b3 100644 --- a/cpp/src/IceUtil/UUID.cpp +++ b/cpp/src/IceUtil/UUID.cpp @@ -25,7 +25,7 @@ using namespace std; -#if defined(ICE_OS_WINRT) || !defined(_WIN32) +#if defined(ICE_OS_UWP) || !defined(_WIN32) namespace { @@ -92,7 +92,7 @@ inline void bytesToHex(unsigned char* bytes, size_t len, char*& hexBuffer) string IceUtil::generateUUID() { -#if defined(_WIN32) && !defined(ICE_OS_WINRT) +#if defined(_WIN32) && !defined(ICE_OS_UWP) UUID uuid; RPC_STATUS ret = UuidCreate(&uuid); diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp index 46873339daa..eb416b268ac 100644 --- a/cpp/src/IceUtil/UtilException.cpp +++ b/cpp/src/IceUtil/UtilException.cpp @@ -56,7 +56,7 @@ # endif #endif -#if defined(_WIN32) && !defined(ICE_OS_WINRT) && !defined(__MINGW32__) +#if defined(_WIN32) && !defined(ICE_OS_UWP) && !defined(__MINGW32__) # define ICE_DBGHELP # if defined(_MSC_VER) && (_MSC_VER >= 1700) # define DBGHELP_TRANSLATE_TCHAR -- cgit v1.2.3