zeroc-ice 3.7.11 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/dist/IceRuby/Communicator.cpp +159 -376
- data/dist/IceRuby/Communicator.h +8 -9
- data/dist/IceRuby/Config.h +23 -89
- data/dist/IceRuby/Connection.cpp +111 -219
- data/dist/IceRuby/Connection.h +8 -12
- data/dist/IceRuby/DefaultSliceLoader.cpp +45 -0
- data/dist/IceRuby/DefaultSliceLoader.h +25 -0
- data/dist/IceRuby/Endpoint.cpp +63 -65
- data/dist/IceRuby/Endpoint.h +7 -11
- data/dist/IceRuby/ImplicitContext.cpp +26 -31
- data/dist/IceRuby/ImplicitContext.h +6 -10
- data/dist/IceRuby/Init.cpp +27 -40
- data/dist/IceRuby/Logger.cpp +23 -28
- data/dist/IceRuby/Logger.h +8 -12
- data/dist/IceRuby/Operation.cpp +177 -219
- data/dist/IceRuby/Operation.h +15 -18
- data/dist/IceRuby/Properties.cpp +133 -89
- data/dist/IceRuby/Properties.h +6 -10
- data/dist/IceRuby/Proxy.cpp +179 -649
- data/dist/IceRuby/Proxy.h +11 -12
- data/dist/IceRuby/RubySliceLoader.cpp +39 -0
- data/dist/IceRuby/RubySliceLoader.h +27 -0
- data/dist/IceRuby/Slice.cpp +88 -94
- data/dist/IceRuby/Slice.h +3 -7
- data/dist/IceRuby/Types.cpp +987 -1190
- data/dist/IceRuby/Types.h +390 -461
- data/dist/IceRuby/Util.cpp +214 -473
- data/dist/IceRuby/Util.h +378 -479
- data/dist/ice/cpp/include/Ice/AsyncResponseHandler.h +85 -0
- data/dist/ice/cpp/include/Ice/BatchRequest.h +39 -0
- data/dist/ice/cpp/include/Ice/BatchRequestQueueF.h +4 -10
- data/dist/ice/cpp/include/Ice/Buffer.h +116 -111
- data/dist/ice/cpp/include/Ice/Communicator.h +411 -0
- data/dist/ice/cpp/include/Ice/CommunicatorF.h +16 -0
- data/dist/ice/cpp/include/Ice/Config.h +46 -62
- data/dist/ice/cpp/include/Ice/Connection.h +410 -0
- data/dist/ice/cpp/include/Ice/ConnectionF.h +36 -0
- data/dist/ice/cpp/include/Ice/ConnectionIF.h +6 -28
- data/dist/ice/cpp/include/Ice/CtrlCHandler.h +56 -0
- data/dist/ice/cpp/include/Ice/Current.h +60 -0
- data/dist/ice/cpp/include/Ice/DefaultSliceLoader.h +160 -0
- data/dist/ice/cpp/include/Ice/Demangle.h +17 -0
- data/dist/ice/cpp/include/Ice/Endpoint.h +298 -0
- data/dist/ice/cpp/include/Ice/EndpointF.h +44 -0
- data/dist/ice/cpp/include/Ice/EndpointSelectionType.h +21 -0
- data/dist/ice/cpp/include/Ice/Exception.h +46 -151
- data/dist/ice/cpp/include/Ice/FacetMap.h +16 -0
- data/dist/ice/cpp/include/Ice/Format.h +11 -27
- data/dist/ice/cpp/include/Ice/Ice.h +53 -48
- data/dist/ice/cpp/include/Ice/IconvStringConverter.h +165 -326
- data/dist/ice/cpp/include/Ice/ImplicitContext.h +76 -0
- data/dist/ice/cpp/include/Ice/IncomingRequest.h +75 -0
- data/dist/ice/cpp/include/Ice/Initialize.h +113 -927
- data/dist/ice/cpp/include/Ice/InputStream.h +748 -1320
- data/dist/ice/cpp/include/Ice/InstanceF.h +4 -10
- data/dist/ice/cpp/include/Ice/Instrumentation.h +319 -0
- data/dist/ice/cpp/include/Ice/LocalException.h +58 -0
- data/dist/ice/cpp/include/Ice/LocalExceptions.h +870 -0
- data/dist/ice/cpp/include/Ice/Logger.h +62 -0
- data/dist/ice/cpp/include/Ice/LoggerUtil.h +124 -147
- data/dist/ice/cpp/include/Ice/MarshaledResult.h +50 -0
- data/dist/ice/cpp/include/Ice/NativePropertiesAdmin.h +41 -71
- data/dist/ice/cpp/include/Ice/Object.h +151 -490
- data/dist/ice/cpp/include/Ice/ObjectAdapter.h +324 -0
- data/dist/ice/cpp/include/Ice/ObjectAdapterF.h +16 -0
- data/dist/ice/cpp/include/Ice/ObjectF.h +5 -19
- data/dist/ice/cpp/include/Ice/ObserverHelper.h +115 -132
- data/dist/ice/cpp/include/Ice/OutgoingAsync.h +392 -748
- data/dist/ice/cpp/include/Ice/OutgoingResponse.h +129 -0
- data/dist/ice/cpp/include/Ice/OutputStream.h +756 -956
- data/dist/ice/cpp/include/Ice/Plugin.h +73 -0
- data/dist/ice/cpp/include/Ice/PluginFactory.h +77 -0
- data/dist/ice/cpp/include/{IceUtil → Ice}/PopDisableWarnings.h +8 -6
- data/dist/ice/cpp/include/Ice/Properties.h +307 -0
- data/dist/ice/cpp/include/Ice/PropertiesF.h +19 -0
- data/dist/ice/cpp/include/Ice/Proxy.h +665 -5094
- data/dist/ice/cpp/include/Ice/ProxyF.h +2 -44
- data/dist/ice/cpp/include/Ice/ProxyFunctions.h +209 -0
- data/dist/ice/cpp/include/Ice/PushDisableWarnings.h +29 -0
- data/dist/ice/cpp/include/Ice/ReferenceF.h +4 -19
- data/dist/ice/cpp/include/Ice/RequestHandlerF.h +8 -18
- data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +276 -0
- data/dist/ice/cpp/include/Ice/SSL/Config.h +54 -0
- data/dist/ice/cpp/include/Ice/SSL/ConnectionInfo.h +107 -0
- data/dist/ice/cpp/include/Ice/SSL/ConnectionInfoF.h +39 -0
- data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +40 -0
- data/dist/ice/cpp/include/Ice/SSL/SSLException.h +32 -0
- data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +286 -0
- data/dist/ice/cpp/include/Ice/ServantLocator.h +51 -0
- data/dist/ice/cpp/include/Ice/Service.h +182 -342
- data/dist/ice/cpp/include/Ice/SliceLoader.h +67 -0
- data/dist/ice/cpp/include/Ice/SlicedData.h +113 -160
- data/dist/ice/cpp/include/Ice/SlicedDataF.h +17 -27
- data/dist/ice/cpp/include/Ice/StreamHelpers.h +532 -1070
- data/dist/ice/cpp/include/Ice/StreamableTraits.h +291 -0
- data/dist/ice/cpp/include/Ice/StringConverter.h +152 -63
- data/dist/ice/cpp/include/Ice/StringUtil.h +114 -0
- data/dist/ice/cpp/include/Ice/TimerTask.h +24 -0
- data/dist/ice/cpp/include/Ice/TupleCompare.h +103 -0
- data/dist/ice/cpp/include/Ice/UUID.h +6 -9
- data/dist/ice/cpp/include/Ice/UserException.h +46 -0
- data/dist/ice/cpp/include/Ice/UserExceptionFactory.h +4 -79
- data/dist/ice/cpp/include/Ice/Value.h +103 -115
- data/dist/ice/cpp/include/Ice/ValueF.h +6 -11
- data/dist/ice/cpp/include/IceDiscovery/IceDiscovery.h +16 -1877
- data/dist/ice/cpp/include/IceLocatorDiscovery/IceLocatorDiscovery.h +16 -1185
- data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +46 -146
- data/dist/ice/cpp/include/generated/Ice/Context.h +40 -0
- data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +49 -93
- data/dist/ice/cpp/include/generated/Ice/Identity.h +70 -226
- data/dist/ice/cpp/include/generated/Ice/Locator.h +494 -3850
- data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +443 -0
- data/dist/ice/cpp/include/generated/Ice/Metrics.h +937 -4603
- data/dist/ice/cpp/include/generated/Ice/OperationMode.h +73 -0
- data/dist/ice/cpp/include/generated/Ice/Process.h +197 -929
- data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +249 -1301
- data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +39 -0
- data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +637 -2620
- data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +94 -0
- data/dist/ice/cpp/include/generated/Ice/Router.h +429 -1783
- data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +18 -65
- data/dist/ice/cpp/include/generated/Ice/Version.h +73 -318
- data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +498 -0
- data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +387 -0
- data/dist/ice/cpp/src/Ice/Acceptor.h +28 -24
- data/dist/ice/cpp/src/Ice/AcceptorF.h +6 -14
- data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories.h +16 -0
- data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +43 -0
- data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_min.cpp +17 -0
- data/dist/ice/cpp/src/Ice/ArgVector.cpp +17 -18
- data/dist/ice/cpp/src/Ice/ArgVector.h +19 -25
- data/dist/ice/cpp/src/Ice/Base64.cpp +66 -66
- data/dist/ice/cpp/src/Ice/Base64.h +14 -19
- data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +70 -121
- data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +37 -47
- data/dist/ice/cpp/src/Ice/Buffer.cpp +73 -41
- data/dist/ice/cpp/src/Ice/CheckIdentity.h +21 -0
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +215 -249
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +38 -60
- data/dist/ice/cpp/src/Ice/Communicator.cpp +399 -0
- data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +140 -0
- data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.h +39 -0
- data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +63 -184
- data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +30 -51
- data/dist/ice/cpp/src/Ice/ConnectRequestHandlerF.h +4 -14
- data/dist/ice/cpp/src/Ice/Connection.cpp +44 -0
- data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +578 -792
- data/dist/ice/cpp/src/Ice/ConnectionFactory.h +200 -200
- data/dist/ice/cpp/src/Ice/ConnectionFactoryF.h +6 -19
- data/dist/ice/cpp/src/Ice/ConnectionI.cpp +1674 -1782
- data/dist/ice/cpp/src/Ice/ConnectionI.h +333 -293
- data/dist/ice/cpp/src/Ice/ConnectionOptions.h +22 -0
- data/dist/ice/cpp/src/Ice/Connector.h +25 -19
- data/dist/ice/cpp/src/Ice/ConnectorF.h +4 -11
- data/dist/ice/cpp/src/{IceUtil → Ice}/ConsoleUtil.cpp +32 -53
- data/dist/ice/cpp/src/Ice/ConsoleUtil.h +79 -0
- data/dist/ice/cpp/src/Ice/CtrlCHandler.cpp +189 -0
- data/dist/ice/cpp/src/Ice/Current.cpp +29 -0
- data/dist/ice/cpp/src/Ice/DLLMain.cpp +25 -35
- data/dist/ice/cpp/src/Ice/DefaultSliceLoader.cpp +39 -0
- data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +41 -119
- data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.h +27 -41
- data/dist/ice/cpp/src/Ice/DefaultsAndOverridesF.h +4 -11
- data/dist/ice/cpp/src/Ice/Demangle.cpp +26 -0
- data/dist/ice/cpp/src/Ice/DisableWarnings.h +31 -0
- data/dist/ice/cpp/src/Ice/DynamicLibrary.cpp +44 -112
- data/dist/ice/cpp/src/Ice/DynamicLibrary.h +91 -0
- data/dist/ice/cpp/src/Ice/Endian.h +40 -0
- data/dist/ice/cpp/src/Ice/EndpointFactory.cpp +35 -59
- data/dist/ice/cpp/src/Ice/EndpointFactory.h +82 -103
- data/dist/ice/cpp/src/Ice/EndpointFactoryF.h +4 -11
- data/dist/ice/cpp/src/Ice/EndpointFactoryManager.cpp +54 -87
- data/dist/ice/cpp/src/Ice/EndpointFactoryManager.h +28 -33
- data/dist/ice/cpp/src/Ice/EndpointFactoryManagerF.h +4 -11
- data/dist/ice/cpp/src/Ice/EndpointI.cpp +53 -23
- data/dist/ice/cpp/src/Ice/EndpointI.h +132 -200
- data/dist/ice/cpp/src/Ice/EndpointIF.h +11 -39
- data/dist/ice/cpp/src/Ice/EventHandler.cpp +3 -26
- data/dist/ice/cpp/src/Ice/EventHandler.h +46 -56
- data/dist/ice/cpp/src/Ice/EventHandlerF.h +4 -14
- data/dist/ice/cpp/src/Ice/Exception.cpp +3 -816
- data/dist/ice/cpp/src/Ice/FileUtil.cpp +476 -0
- data/dist/ice/cpp/src/Ice/FileUtil.h +152 -0
- data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +34 -0
- data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +29 -0
- data/dist/ice/cpp/src/Ice/HashUtil.h +46 -32
- data/dist/ice/cpp/src/Ice/HttpParser.cpp +431 -431
- data/dist/ice/cpp/src/Ice/HttpParser.h +95 -100
- data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +207 -324
- data/dist/ice/cpp/src/Ice/IPEndpointI.h +80 -126
- data/dist/ice/cpp/src/Ice/IPEndpointIF.h +6 -17
- data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +172 -0
- data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.h +89 -0
- data/dist/ice/cpp/src/Ice/ImplicitContext.cpp +109 -0
- data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +66 -0
- data/dist/ice/cpp/src/Ice/Initialize.cpp +48 -542
- data/dist/ice/cpp/src/Ice/InputStream.cpp +848 -1385
- data/dist/ice/cpp/src/Ice/Instance.cpp +816 -827
- data/dist/ice/cpp/src/Ice/Instance.h +202 -212
- data/dist/ice/cpp/src/Ice/InstrumentationI.cpp +526 -661
- data/dist/ice/cpp/src/Ice/InstrumentationI.h +171 -192
- data/dist/ice/cpp/src/Ice/LocalException.cpp +518 -0
- data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +577 -0
- data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +291 -329
- data/dist/ice/cpp/src/Ice/LocatorInfo.h +144 -157
- data/dist/ice/cpp/src/Ice/LocatorInfoF.h +8 -17
- data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +561 -743
- data/dist/ice/cpp/src/Ice/LoggerAdminI.h +18 -28
- data/dist/ice/cpp/src/Ice/LoggerI.cpp +66 -91
- data/dist/ice/cpp/src/Ice/LoggerI.h +36 -41
- data/dist/ice/cpp/src/Ice/LoggerMiddleware.cpp +176 -0
- data/dist/ice/cpp/src/Ice/LoggerMiddleware.h +42 -0
- data/dist/ice/cpp/src/Ice/LoggerUtil.cpp +14 -38
- data/dist/ice/cpp/src/Ice/MarshaledResult.cpp +20 -0
- data/dist/ice/cpp/src/Ice/MetricsAdminI.cpp +194 -280
- data/dist/ice/cpp/src/Ice/MetricsAdminI.h +600 -0
- data/dist/ice/cpp/src/Ice/MetricsFunctional.h +92 -0
- data/dist/ice/cpp/src/Ice/MetricsObserverI.h +587 -0
- data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +185 -0
- data/dist/ice/cpp/src/Ice/Network.cpp +595 -917
- data/dist/ice/cpp/src/Ice/Network.h +189 -213
- data/dist/ice/cpp/src/Ice/NetworkF.h +2 -10
- data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +99 -104
- data/dist/ice/cpp/src/Ice/NetworkProxy.h +49 -54
- data/dist/ice/cpp/src/Ice/NetworkProxyF.h +4 -11
- data/dist/ice/cpp/src/Ice/OSLogLoggerI.cpp +16 -18
- data/dist/ice/cpp/src/Ice/OSLogLoggerI.h +22 -27
- data/dist/ice/cpp/src/Ice/Object.cpp +152 -338
- data/dist/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +170 -113
- data/dist/ice/cpp/src/Ice/ObjectAdapterFactory.h +41 -41
- data/dist/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +4 -15
- data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +580 -727
- data/dist/ice/cpp/src/Ice/ObjectAdapterI.h +149 -145
- data/dist/ice/cpp/src/Ice/ObserverHelper.cpp +36 -17
- data/dist/ice/cpp/src/Ice/ObserverMiddleware.cpp +96 -0
- data/dist/ice/cpp/src/Ice/ObserverMiddleware.h +25 -0
- data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +147 -187
- data/dist/ice/cpp/src/Ice/OpaqueEndpointI.h +56 -64
- data/dist/ice/cpp/src/{IceUtil → Ice}/Options.cpp +187 -258
- data/dist/ice/cpp/src/Ice/Options.h +119 -0
- data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +516 -732
- data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +276 -0
- data/dist/ice/cpp/src/Ice/OutputStream.cpp +610 -543
- data/dist/ice/cpp/src/Ice/OutputUtil.cpp +344 -0
- data/dist/ice/cpp/src/Ice/OutputUtil.h +173 -0
- data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +118 -277
- data/dist/ice/cpp/src/Ice/PluginManagerI.h +41 -48
- data/dist/ice/cpp/src/Ice/Properties.cpp +931 -0
- data/dist/ice/cpp/src/Ice/PropertyNames.cpp +519 -1341
- data/dist/ice/cpp/src/Ice/PropertyNames.h +49 -64
- data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +103 -0
- data/dist/ice/cpp/src/Ice/PropertyUtil.h +31 -0
- data/dist/ice/cpp/src/Ice/Protocol.cpp +129 -94
- data/dist/ice/cpp/src/Ice/Protocol.h +116 -0
- data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +117 -62
- data/dist/ice/cpp/src/Ice/ProtocolInstance.h +63 -82
- data/dist/ice/cpp/src/Ice/ProtocolInstanceF.h +4 -11
- data/dist/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +10 -32
- data/dist/ice/cpp/src/Ice/ProtocolPluginFacade.h +25 -54
- data/dist/ice/cpp/src/Ice/Proxy.cpp +294 -1357
- data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +684 -0
- data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +90 -0
- data/dist/ice/cpp/src/Ice/PushDisableDeprecatedWarnings.h +15 -0
- data/dist/ice/cpp/src/Ice/Random.cpp +29 -0
- data/dist/ice/cpp/src/Ice/Random.h +23 -0
- data/dist/ice/cpp/src/Ice/Reference.cpp +635 -1097
- data/dist/ice/cpp/src/Ice/Reference.h +314 -298
- data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +320 -378
- data/dist/ice/cpp/src/Ice/ReferenceFactory.h +48 -66
- data/dist/ice/cpp/src/Ice/ReferenceFactoryF.h +4 -9
- data/dist/ice/cpp/src/Ice/RequestHandler.cpp +15 -24
- data/dist/ice/cpp/src/Ice/RequestHandler.h +43 -68
- data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +76 -0
- data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +33 -0
- data/dist/ice/cpp/src/Ice/ResourceConfig.h +27 -0
- data/dist/ice/cpp/src/Ice/RetryQueue.cpp +51 -57
- data/dist/ice/cpp/src/Ice/RetryQueue.h +39 -46
- data/dist/ice/cpp/src/Ice/RetryQueueF.h +4 -9
- data/dist/ice/cpp/src/Ice/RouterInfo.cpp +97 -201
- data/dist/ice/cpp/src/Ice/RouterInfo.h +61 -118
- data/dist/ice/cpp/src/Ice/RouterInfoF.h +6 -14
- data/dist/ice/cpp/src/Ice/SHA1.cpp +86 -60
- data/dist/ice/cpp/src/Ice/SHA1.h +35 -0
- data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +89 -0
- data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +87 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +521 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +40 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngineF.h +13 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +646 -0
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +80 -0
- data/dist/ice/cpp/src/{IceSSL → Ice/SSL}/RFC2253.cpp +85 -88
- data/dist/ice/cpp/src/Ice/SSL/RFC2253.h +58 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLAcceptorI.cpp +124 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLAcceptorI.h +52 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLConnectorI.cpp +92 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLConnectorI.h +38 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +377 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.h +84 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEngine.cpp +115 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +69 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLEngineF.h +14 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLException.cpp +18 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLInstance.cpp +27 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLInstance.h +26 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLInstanceF.h +19 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +673 -0
- data/dist/ice/cpp/src/Ice/SSL/SSLUtil.h +118 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +1449 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +58 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngineF.h +18 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +1088 -0
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +118 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +825 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +44 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngineF.h +18 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +621 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.h +91 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +1048 -0
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +40 -0
- data/dist/ice/cpp/src/Ice/SSL/TrustManager.cpp +233 -0
- data/dist/ice/cpp/src/Ice/SSL/TrustManager.h +42 -0
- data/dist/ice/cpp/src/Ice/SSL/TrustManagerF.h +14 -0
- data/dist/ice/cpp/src/Ice/ScannerConfig.h +35 -0
- data/dist/ice/cpp/src/Ice/Selector.cpp +341 -606
- data/dist/ice/cpp/src/Ice/Selector.h +167 -224
- data/dist/ice/cpp/src/Ice/ServantManager.cpp +195 -128
- data/dist/ice/cpp/src/Ice/ServantManager.h +52 -55
- data/dist/ice/cpp/src/Ice/ServantManagerF.h +14 -0
- data/dist/ice/cpp/src/Ice/Service.cpp +548 -641
- data/dist/ice/cpp/src/Ice/SharedContext.h +13 -26
- data/dist/ice/cpp/src/Ice/SliceLoader.cpp +53 -0
- data/dist/ice/cpp/src/Ice/SlicedData.cpp +17 -96
- data/dist/ice/cpp/src/Ice/StreamSocket.cpp +104 -151
- data/dist/ice/cpp/src/Ice/StreamSocket.h +48 -60
- data/dist/ice/cpp/src/Ice/StringConverter.cpp +586 -0
- data/dist/ice/cpp/src/Ice/StringUtil.cpp +1137 -0
- data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +41 -47
- data/dist/ice/cpp/src/Ice/SysLoggerI.h +24 -27
- data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +16 -17
- data/dist/ice/cpp/src/Ice/SystemdJournalI.h +19 -25
- data/dist/ice/cpp/src/Ice/TargetCompare.h +96 -0
- data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +67 -88
- data/dist/ice/cpp/src/Ice/TcpAcceptor.h +34 -40
- data/dist/ice/cpp/src/Ice/TcpConnector.cpp +42 -41
- data/dist/ice/cpp/src/Ice/TcpConnector.h +26 -35
- data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +172 -146
- data/dist/ice/cpp/src/Ice/TcpEndpointI.h +76 -80
- data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +38 -26
- data/dist/ice/cpp/src/Ice/TcpTransceiver.h +40 -45
- data/dist/ice/cpp/src/Ice/ThreadPool.cpp +333 -515
- data/dist/ice/cpp/src/Ice/ThreadPool.h +202 -290
- data/dist/ice/cpp/src/Ice/ThreadPoolF.h +14 -0
- data/dist/ice/cpp/src/Ice/TimeUtil.cpp +47 -0
- data/dist/ice/cpp/src/Ice/TimeUtil.h +21 -0
- data/dist/ice/cpp/src/Ice/Timer.cpp +73 -167
- data/dist/ice/cpp/src/Ice/Timer.h +212 -0
- data/dist/ice/cpp/src/Ice/TraceLevels.cpp +11 -29
- data/dist/ice/cpp/src/Ice/TraceLevels.h +22 -28
- data/dist/ice/cpp/src/Ice/TraceLevelsF.h +4 -11
- data/dist/ice/cpp/src/Ice/TraceUtil.cpp +136 -215
- data/dist/ice/cpp/src/Ice/TraceUtil.h +27 -16
- data/dist/ice/cpp/src/Ice/Transceiver.cpp +3 -7
- data/dist/ice/cpp/src/Ice/Transceiver.h +35 -32
- data/dist/ice/cpp/src/Ice/TransceiverF.h +10 -20
- data/dist/ice/cpp/src/Ice/UUID.cpp +79 -0
- data/dist/ice/cpp/src/Ice/UdpConnector.cpp +39 -39
- data/dist/ice/cpp/src/Ice/UdpConnector.h +27 -36
- data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +178 -213
- data/dist/ice/cpp/src/Ice/UdpEndpointI.h +82 -85
- data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +201 -221
- data/dist/ice/cpp/src/Ice/UdpTransceiver.h +68 -74
- data/dist/ice/cpp/{include/IceUtil → src/Ice}/UndefSysMacros.h +12 -12
- data/dist/ice/cpp/src/Ice/UniqueRef.h +77 -0
- data/dist/ice/cpp/src/Ice/UserException.cpp +58 -0
- data/dist/ice/cpp/src/Ice/Value.cpp +107 -38
- data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +10 -15
- data/dist/ice/cpp/src/Ice/WSAcceptor.h +31 -37
- data/dist/ice/cpp/src/Ice/WSConnector.cpp +25 -40
- data/dist/ice/cpp/src/Ice/WSConnector.h +26 -33
- data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +164 -217
- data/dist/ice/cpp/src/Ice/WSEndpoint.h +72 -83
- data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +469 -458
- data/dist/ice/cpp/src/Ice/WSTransceiver.h +117 -123
- data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +20 -29
- data/dist/ice/cpp/src/Ice/generated/Context.cpp +40 -0
- data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +20 -31
- data/dist/ice/cpp/src/Ice/generated/Identity.cpp +24 -34
- data/dist/ice/cpp/src/Ice/generated/Locator.cpp +454 -1744
- data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +577 -0
- data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +824 -1971
- data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +56 -0
- data/dist/ice/cpp/src/Ice/generated/Process.cpp +190 -331
- data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +289 -449
- data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +40 -0
- data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +547 -867
- data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +70 -0
- data/dist/ice/cpp/src/Ice/generated/Router.cpp +406 -723
- data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +19 -29
- data/dist/ice/cpp/src/Ice/generated/Version.cpp +28 -31
- data/dist/ice/cpp/src/IceDiscovery/LocatorI.cpp +76 -139
- data/dist/ice/cpp/src/IceDiscovery/LocatorI.h +55 -96
- data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +190 -303
- data/dist/ice/cpp/src/IceDiscovery/LookupI.h +126 -185
- data/dist/ice/cpp/src/IceDiscovery/PluginI.cpp +56 -77
- data/dist/ice/cpp/src/IceDiscovery/PluginI.h +20 -25
- data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +638 -0
- data/dist/ice/cpp/src/IceLocatorDiscovery/Plugin.h +14 -37
- data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +411 -649
- data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +468 -0
- data/dist/ice/cpp/src/Slice/DeprecationReporter.cpp +172 -0
- data/dist/ice/cpp/src/Slice/DeprecationReporter.h +14 -0
- data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +736 -0
- data/dist/ice/cpp/src/Slice/DocCommentParser.h +61 -0
- data/dist/ice/cpp/src/Slice/FileTracker.cpp +25 -75
- data/dist/ice/cpp/src/Slice/FileTracker.h +35 -56
- data/dist/ice/cpp/src/Slice/Grammar.cpp +2711 -3382
- data/dist/ice/cpp/src/Slice/Grammar.h +95 -75
- data/dist/ice/cpp/src/Slice/GrammarUtil.h +117 -217
- data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +486 -0
- data/dist/ice/cpp/src/Slice/MetadataValidation.h +106 -0
- data/dist/ice/cpp/src/Slice/Parser.cpp +3068 -5223
- data/dist/ice/cpp/src/Slice/Parser.h +1086 -1065
- data/dist/ice/cpp/src/Slice/Preprocessor.cpp +97 -599
- data/dist/ice/cpp/src/Slice/Preprocessor.h +26 -42
- data/dist/ice/cpp/src/Slice/Scanner.cpp +1562 -924
- data/dist/ice/cpp/src/Slice/SliceUtil.cpp +517 -113
- data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +254 -269
- data/dist/ice/cpp/src/Slice/Util.h +126 -35
- data/dist/ice/cpp/src/slice2rb/Main.cpp +13 -15
- data/dist/ice/cpp/src/slice2rb/Ruby.cpp +250 -0
- data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +1197 -0
- data/dist/ice/cpp/src/slice2rb/RubyUtil.h +56 -0
- data/dist/ice/slice/Glacier2/Metrics.ice +34 -75
- data/dist/ice/slice/Glacier2/PermissionsVerifier.ice +42 -98
- data/dist/ice/slice/Glacier2/Router.ice +80 -173
- data/dist/ice/slice/Glacier2/SSLInfo.ice +23 -40
- data/dist/ice/slice/Glacier2/Session.ice +120 -261
- data/dist/ice/slice/Ice/BuiltinSequences.ice +33 -38
- data/dist/ice/slice/Ice/Context.ice +24 -0
- data/dist/ice/slice/Ice/EndpointTypes.ice +35 -33
- data/dist/ice/slice/Ice/Identity.ice +24 -63
- data/dist/ice/slice/Ice/Locator.ice +61 -226
- data/dist/ice/slice/Ice/LocatorRegistry.ice +77 -0
- data/dist/ice/slice/Ice/Metrics.ice +189 -424
- data/dist/ice/slice/Ice/OperationMode.ice +38 -0
- data/dist/ice/slice/Ice/Process.ice +16 -52
- data/dist/ice/slice/Ice/PropertiesAdmin.ice +25 -75
- data/dist/ice/slice/Ice/PropertyDict.ice +23 -0
- data/dist/ice/slice/Ice/RemoteLogger.ice +113 -213
- data/dist/ice/slice/Ice/ReplyStatus.ice +65 -0
- data/dist/ice/slice/Ice/Router.ice +42 -91
- data/dist/ice/slice/Ice/SliceChecksumDict.ice +7 -25
- data/dist/ice/slice/Ice/Version.ice +31 -39
- data/dist/ice/slice/IceBox/ServiceManager.ice +79 -0
- data/dist/ice/slice/IceGrid/Admin.ice +942 -1918
- data/dist/ice/slice/IceGrid/Descriptor.ice +476 -1051
- data/dist/ice/slice/IceGrid/Exception.ice +86 -384
- data/dist/ice/slice/IceGrid/FileParser.ice +23 -59
- data/dist/ice/slice/IceGrid/Registry.ice +117 -256
- data/dist/ice/slice/IceGrid/Session.ice +46 -110
- data/dist/ice/slice/IceGrid/UserAccountMapper.ice +22 -57
- data/dist/ice/slice/IceStorm/IceStorm.ice +173 -401
- data/dist/ice/slice/IceStorm/Metrics.ice +28 -70
- data/dist/lib/Glacier2/Metrics.rb +16 -31
- data/dist/lib/Glacier2/PermissionsVerifier.rb +18 -50
- data/dist/lib/Glacier2/Router.rb +20 -42
- data/dist/lib/Glacier2/SSLInfo.rb +14 -22
- data/dist/lib/Glacier2/Session.rb +53 -113
- data/dist/lib/Glacier2.rb +6 -6
- data/dist/lib/Ice/BuiltinSequences.rb +14 -26
- data/dist/lib/Ice/CompressBatch.rb +50 -0
- data/dist/lib/Ice/Context.rb +12 -0
- data/dist/lib/Ice/EndpointSelectionType.rb +49 -0
- data/dist/lib/Ice/EndpointTypes.rb +14 -55
- data/dist/lib/Ice/Exception.rb +20 -0
- data/dist/lib/Ice/Identity.rb +10 -26
- data/dist/lib/Ice/IdentitySpaceship.rb +16 -0
- data/dist/lib/Ice/InitializationData.rb +12 -0
- data/dist/lib/Ice/LocalExceptions.rb +168 -0
- data/dist/lib/Ice/Locator.rb +21 -134
- data/dist/lib/Ice/LocatorRegistry.rb +73 -0
- data/dist/lib/Ice/Metrics.rb +85 -132
- data/dist/lib/Ice/OperationMode.rb +58 -0
- data/dist/lib/Ice/Process.rb +12 -31
- data/dist/lib/Ice/PropertiesAdmin.rb +12 -36
- data/dist/lib/Ice/PropertyDict.rb +12 -0
- data/dist/lib/Ice/Proxy.rb +85 -0
- data/dist/lib/Ice/ProxyFunctions.rb +69 -0
- data/dist/lib/Ice/RemoteLogger.rb +29 -60
- data/dist/lib/Ice/ReplyStatus.rb +65 -0
- data/dist/lib/Ice/Router.rb +19 -47
- data/dist/lib/Ice/SliceChecksumDict.rb +5 -17
- data/dist/lib/Ice/SliceUtil.rb +41 -0
- data/dist/lib/Ice/Struct.rb +11 -0
- data/dist/lib/Ice/ToStringMode.rb +50 -0
- data/dist/lib/Ice/Value.rb +93 -0
- data/dist/lib/Ice/Version.rb +12 -24
- data/dist/lib/Ice.rb +29 -665
- data/dist/lib/IceBox/ServiceManager.rb +104 -0
- data/dist/lib/IceBox.rb +2 -4
- data/dist/lib/IceGrid/Admin.rb +303 -291
- data/dist/lib/IceGrid/Descriptor.rb +147 -192
- data/dist/lib/IceGrid/Exception.rb +26 -257
- data/dist/lib/IceGrid/FileParser.rb +12 -36
- data/dist/lib/IceGrid/Registry.rb +35 -76
- data/dist/lib/IceGrid/Session.rb +19 -34
- data/dist/lib/IceGrid/UserAccountMapper.rb +11 -34
- data/dist/lib/IceGrid.rb +3 -3
- data/dist/lib/IceStorm/IceStorm.rb +51 -132
- data/dist/lib/IceStorm/Metrics.rb +19 -37
- data/dist/lib/IceStorm.rb +3 -5
- data/extconf.rb +6 -8
- data/ice.gemspec +3 -3
- data/scripts/slice2rb +1 -3
- metadata +206 -386
- data/dist/IceRuby/ValueFactoryManager.cpp +0 -445
- data/dist/IceRuby/ValueFactoryManager.h +0 -95
- data/dist/ice/cpp/include/Ice/Application.h +0 -326
- data/dist/ice/cpp/include/Ice/AsyncResult.h +0 -155
- data/dist/ice/cpp/include/Ice/AsyncResultF.h +0 -23
- data/dist/ice/cpp/include/Ice/BatchRequestInterceptor.h +0 -75
- data/dist/ice/cpp/include/Ice/CommunicatorAsync.h +0 -154
- data/dist/ice/cpp/include/Ice/Comparable.h +0 -205
- data/dist/ice/cpp/include/Ice/ConnectionAsync.h +0 -302
- data/dist/ice/cpp/include/Ice/ConsoleUtil.h +0 -23
- data/dist/ice/cpp/include/Ice/DefaultValueFactory.h +0 -57
- data/dist/ice/cpp/include/Ice/DispatchInterceptor.h +0 -41
- data/dist/ice/cpp/include/Ice/Dispatcher.h +0 -67
- data/dist/ice/cpp/include/Ice/DynamicLibrary.h +0 -102
- data/dist/ice/cpp/include/Ice/DynamicLibraryF.h +0 -24
- data/dist/ice/cpp/include/Ice/ExceptionHelpers.h +0 -74
- data/dist/ice/cpp/include/Ice/FactoryTable.h +0 -73
- data/dist/ice/cpp/include/Ice/FactoryTableInit.h +0 -84
- data/dist/ice/cpp/include/Ice/Functional.h +0 -140
- data/dist/ice/cpp/include/Ice/GCObject.h +0 -76
- data/dist/ice/cpp/include/Ice/Handle.h +0 -182
- data/dist/ice/cpp/include/Ice/Incoming.h +0 -225
- data/dist/ice/cpp/include/Ice/IncomingAsync.h +0 -186
- data/dist/ice/cpp/include/Ice/IncomingAsyncF.h +0 -36
- data/dist/ice/cpp/include/Ice/InterfaceByValue.h +0 -57
- data/dist/ice/cpp/include/Ice/LocalObject.h +0 -35
- data/dist/ice/cpp/include/Ice/LocalObjectF.h +0 -21
- data/dist/ice/cpp/include/Ice/MetricsAdminI.h +0 -715
- data/dist/ice/cpp/include/Ice/MetricsFunctional.h +0 -159
- data/dist/ice/cpp/include/Ice/MetricsObserverI.h +0 -669
- data/dist/ice/cpp/include/Ice/Optional.h +0 -1114
- data/dist/ice/cpp/include/Ice/OutgoingAsyncF.h +0 -39
- data/dist/ice/cpp/include/Ice/Protocol.h +0 -274
- data/dist/ice/cpp/include/Ice/ProxyFactoryF.h +0 -21
- data/dist/ice/cpp/include/Ice/ProxyHandle.h +0 -318
- data/dist/ice/cpp/include/Ice/RegisterPlugins.h +0 -127
- data/dist/ice/cpp/include/Ice/ResponseHandlerF.h +0 -25
- data/dist/ice/cpp/include/Ice/SHA1.h +0 -40
- data/dist/ice/cpp/include/Ice/ServantManagerF.h +0 -21
- data/dist/ice/cpp/include/Ice/SliceChecksums.h +0 -33
- data/dist/ice/cpp/include/Ice/ThreadPoolF.h +0 -23
- data/dist/ice/cpp/include/Ice/UniquePtr.h +0 -95
- data/dist/ice/cpp/include/Ice/UniqueRef.h +0 -97
- data/dist/ice/cpp/include/IceSSL/Config.h +0 -21
- data/dist/ice/cpp/include/IceSSL/IceSSL.h +0 -24
- data/dist/ice/cpp/include/IceSSL/OpenSSL.h +0 -147
- data/dist/ice/cpp/include/IceSSL/Plugin.h +0 -712
- data/dist/ice/cpp/include/IceSSL/SChannel.h +0 -72
- data/dist/ice/cpp/include/IceSSL/SecureTransport.h +0 -72
- data/dist/ice/cpp/include/IceUtil/Atomic.h +0 -179
- data/dist/ice/cpp/include/IceUtil/Cond.h +0 -317
- data/dist/ice/cpp/include/IceUtil/Config.h +0 -392
- data/dist/ice/cpp/include/IceUtil/ConsoleUtil.h +0 -92
- data/dist/ice/cpp/include/IceUtil/CountDownLatch.h +0 -45
- data/dist/ice/cpp/include/IceUtil/CtrlCHandler.h +0 -96
- data/dist/ice/cpp/include/IceUtil/DisableWarnings.h +0 -44
- data/dist/ice/cpp/include/IceUtil/Exception.h +0 -394
- data/dist/ice/cpp/include/IceUtil/FileUtil.h +0 -140
- data/dist/ice/cpp/include/IceUtil/Functional.h +0 -389
- data/dist/ice/cpp/include/IceUtil/Handle.h +0 -261
- data/dist/ice/cpp/include/IceUtil/IceUtil.h +0 -40
- data/dist/ice/cpp/include/IceUtil/InputUtil.h +0 -42
- data/dist/ice/cpp/include/IceUtil/Iterator.h +0 -31
- data/dist/ice/cpp/include/IceUtil/Lock.h +0 -128
- data/dist/ice/cpp/include/IceUtil/Monitor.h +0 -243
- data/dist/ice/cpp/include/IceUtil/Mutex.h +0 -349
- data/dist/ice/cpp/include/IceUtil/MutexProtocol.h +0 -23
- data/dist/ice/cpp/include/IceUtil/MutexPtrLock.h +0 -78
- data/dist/ice/cpp/include/IceUtil/MutexPtrTryLock.h +0 -77
- data/dist/ice/cpp/include/IceUtil/Optional.h +0 -433
- data/dist/ice/cpp/include/IceUtil/Options.h +0 -135
- data/dist/ice/cpp/include/IceUtil/OutputUtil.h +0 -383
- data/dist/ice/cpp/include/IceUtil/PushDisableWarnings.h +0 -33
- data/dist/ice/cpp/include/IceUtil/Random.h +0 -55
- data/dist/ice/cpp/include/IceUtil/RecMutex.h +0 -107
- data/dist/ice/cpp/include/IceUtil/ResourceConfig.h +0 -37
- data/dist/ice/cpp/include/IceUtil/ScannerConfig.h +0 -40
- data/dist/ice/cpp/include/IceUtil/ScopedArray.h +0 -98
- data/dist/ice/cpp/include/IceUtil/Shared.h +0 -127
- data/dist/ice/cpp/include/IceUtil/StopWatch.h +0 -49
- data/dist/ice/cpp/include/IceUtil/StringConverter.h +0 -195
- data/dist/ice/cpp/include/IceUtil/StringUtil.h +0 -97
- data/dist/ice/cpp/include/IceUtil/Thread.h +0 -160
- data/dist/ice/cpp/include/IceUtil/ThreadException.h +0 -94
- data/dist/ice/cpp/include/IceUtil/Time.h +0 -205
- data/dist/ice/cpp/include/IceUtil/Timer.h +0 -153
- data/dist/ice/cpp/include/IceUtil/UUID.h +0 -21
- data/dist/ice/cpp/include/generated/Glacier2/Metrics.h +0 -475
- data/dist/ice/cpp/include/generated/Glacier2/PermissionsVerifier.h +0 -1430
- data/dist/ice/cpp/include/generated/Glacier2/PermissionsVerifierF.h +0 -147
- data/dist/ice/cpp/include/generated/Glacier2/Router.h +0 -3260
- data/dist/ice/cpp/include/generated/Glacier2/RouterF.h +0 -125
- data/dist/ice/cpp/include/generated/Glacier2/SSLInfo.h +0 -223
- data/dist/ice/cpp/include/generated/Glacier2/Session.h +0 -5894
- data/dist/ice/cpp/include/generated/Ice/Communicator.h +0 -1162
- data/dist/ice/cpp/include/generated/Ice/CommunicatorF.h +0 -101
- data/dist/ice/cpp/include/generated/Ice/Connection.h +0 -1703
- data/dist/ice/cpp/include/generated/Ice/ConnectionF.h +0 -119
- data/dist/ice/cpp/include/generated/Ice/Current.h +0 -322
- data/dist/ice/cpp/include/generated/Ice/Endpoint.h +0 -979
- data/dist/ice/cpp/include/generated/Ice/EndpointF.h +0 -166
- data/dist/ice/cpp/include/generated/Ice/FacetMap.h +0 -80
- data/dist/ice/cpp/include/generated/Ice/ImplicitContext.h +0 -284
- data/dist/ice/cpp/include/generated/Ice/ImplicitContextF.h +0 -101
- data/dist/ice/cpp/include/generated/Ice/Instrumentation.h +0 -1203
- data/dist/ice/cpp/include/generated/Ice/InstrumentationF.h +0 -128
- data/dist/ice/cpp/include/generated/Ice/LocalException.h +0 -7437
- data/dist/ice/cpp/include/generated/Ice/LocatorF.h +0 -147
- data/dist/ice/cpp/include/generated/Ice/Logger.h +0 -237
- data/dist/ice/cpp/include/generated/Ice/LoggerF.h +0 -101
- data/dist/ice/cpp/include/generated/Ice/ObjectAdapter.h +0 -1181
- data/dist/ice/cpp/include/generated/Ice/ObjectAdapterF.h +0 -101
- data/dist/ice/cpp/include/generated/Ice/ObjectFactory.h +0 -203
- data/dist/ice/cpp/include/generated/Ice/Plugin.h +0 -318
- data/dist/ice/cpp/include/generated/Ice/PluginF.h +0 -110
- data/dist/ice/cpp/include/generated/Ice/ProcessF.h +0 -125
- data/dist/ice/cpp/include/generated/Ice/Properties.h +0 -452
- data/dist/ice/cpp/include/generated/Ice/PropertiesF.h +0 -134
- data/dist/ice/cpp/include/generated/Ice/RouterF.h +0 -125
- data/dist/ice/cpp/include/generated/Ice/ServantLocator.h +0 -305
- data/dist/ice/cpp/include/generated/Ice/ServantLocatorF.h +0 -101
- data/dist/ice/cpp/include/generated/Ice/ValueFactory.h +0 -330
- data/dist/ice/cpp/include/generated/IceBox/IceBox.h +0 -3269
- data/dist/ice/cpp/include/generated/IceGrid/Admin.h +0 -33773
- data/dist/ice/cpp/include/generated/IceGrid/Descriptor.h +0 -5254
- data/dist/ice/cpp/include/generated/IceGrid/Exception.h +0 -2834
- data/dist/ice/cpp/include/generated/IceGrid/FileParser.h +0 -824
- data/dist/ice/cpp/include/generated/IceGrid/PluginFacade.h +0 -635
- data/dist/ice/cpp/include/generated/IceGrid/Registry.h +0 -5089
- data/dist/ice/cpp/include/generated/IceGrid/Session.h +0 -2240
- data/dist/ice/cpp/include/generated/IceGrid/UserAccountMapper.h +0 -800
- data/dist/ice/cpp/include/generated/IcePatch2/FileInfo.h +0 -325
- data/dist/ice/cpp/include/generated/IcePatch2/FileServer.h +0 -2891
- data/dist/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +0 -228
- data/dist/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +0 -101
- data/dist/ice/cpp/include/generated/IceSSL/EndpointInfo.h +0 -186
- data/dist/ice/cpp/include/generated/IceStorm/IceStorm.h +0 -6627
- data/dist/ice/cpp/include/generated/IceStorm/Metrics.h +0 -665
- data/dist/ice/cpp/src/Ice/ACM.cpp +0 -380
- data/dist/ice/cpp/src/Ice/ACM.h +0 -119
- data/dist/ice/cpp/src/Ice/ACMF.h +0 -30
- data/dist/ice/cpp/src/Ice/Acceptor.cpp +0 -16
- data/dist/ice/cpp/src/Ice/Application.cpp +0 -661
- data/dist/ice/cpp/src/Ice/AsyncResult.cpp +0 -70
- data/dist/ice/cpp/src/Ice/CommunicatorI.cpp +0 -586
- data/dist/ice/cpp/src/Ice/CommunicatorI.h +0 -167
- data/dist/ice/cpp/src/Ice/Cond.cpp +0 -381
- data/dist/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +0 -73
- data/dist/ice/cpp/src/Ice/ConnectionRequestHandler.h +0 -41
- data/dist/ice/cpp/src/Ice/Connector.cpp +0 -16
- data/dist/ice/cpp/src/Ice/CountDownLatch.cpp +0 -171
- data/dist/ice/cpp/src/Ice/DispatchInterceptor.cpp +0 -37
- data/dist/ice/cpp/src/Ice/FactoryTable.cpp +0 -162
- data/dist/ice/cpp/src/Ice/FactoryTableInit.cpp +0 -88
- data/dist/ice/cpp/src/Ice/GCObject.cpp +0 -442
- data/dist/ice/cpp/src/Ice/IconvStringConverter.cpp +0 -51
- data/dist/ice/cpp/src/Ice/ImplicitContextI.cpp +0 -655
- data/dist/ice/cpp/src/Ice/ImplicitContextI.h +0 -48
- data/dist/ice/cpp/src/Ice/Incoming.cpp +0 -795
- data/dist/ice/cpp/src/Ice/IncomingAsync.cpp +0 -230
- data/dist/ice/cpp/src/Ice/IncomingRequest.h +0 -33
- data/dist/ice/cpp/src/Ice/LocalObject.cpp +0 -23
- data/dist/ice/cpp/src/Ice/MetricsObserverI.cpp +0 -8
- data/dist/ice/cpp/src/Ice/PropertiesAdminI.cpp +0 -265
- data/dist/ice/cpp/src/Ice/PropertiesAdminI.h +0 -64
- data/dist/ice/cpp/src/Ice/PropertiesI.cpp +0 -739
- data/dist/ice/cpp/src/Ice/PropertiesI.h +0 -70
- data/dist/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +0 -21
- data/dist/ice/cpp/src/Ice/ProxyFactory.cpp +0 -300
- data/dist/ice/cpp/src/Ice/ProxyFactory.h +0 -57
- data/dist/ice/cpp/src/Ice/RegisterPluginsInit.cpp +0 -38
- data/dist/ice/cpp/src/Ice/RegisterPluginsInit.h +0 -20
- data/dist/ice/cpp/src/Ice/ReplyStatus.h +0 -24
- data/dist/ice/cpp/src/Ice/RequestHandlerFactory.cpp +0 -77
- data/dist/ice/cpp/src/Ice/RequestHandlerFactory.h +0 -37
- data/dist/ice/cpp/src/Ice/ResponseHandler.cpp +0 -12
- data/dist/ice/cpp/src/Ice/ResponseHandler.h +0 -43
- data/dist/ice/cpp/src/Ice/SliceChecksums.cpp +0 -75
- data/dist/ice/cpp/src/Ice/StringConverterPlugin.cpp +0 -192
- data/dist/ice/cpp/src/Ice/StringUtil.h +0 -30
- data/dist/ice/cpp/src/Ice/Thread.cpp +0 -569
- data/dist/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +0 -61
- data/dist/ice/cpp/src/Ice/ValueFactoryManagerI.h +0 -37
- data/dist/ice/cpp/src/Ice/VirtualShared.h +0 -38
- data/dist/ice/cpp/src/Ice/generated/Communicator.cpp +0 -79
- data/dist/ice/cpp/src/Ice/generated/CommunicatorF.cpp +0 -61
- data/dist/ice/cpp/src/Ice/generated/Connection.cpp +0 -155
- data/dist/ice/cpp/src/Ice/generated/ConnectionF.cpp +0 -61
- data/dist/ice/cpp/src/Ice/generated/Current.cpp +0 -62
- data/dist/ice/cpp/src/Ice/generated/Endpoint.cpp +0 -147
- data/dist/ice/cpp/src/Ice/generated/EndpointF.cpp +0 -61
- data/dist/ice/cpp/src/Ice/generated/FacetMap.cpp +0 -49
- data/dist/ice/cpp/src/Ice/generated/ImplicitContext.cpp +0 -75
- data/dist/ice/cpp/src/Ice/generated/ImplicitContextF.cpp +0 -61
- data/dist/ice/cpp/src/Ice/generated/Instrumentation.cpp +0 -188
- data/dist/ice/cpp/src/Ice/generated/InstrumentationF.cpp +0 -66
- data/dist/ice/cpp/src/Ice/generated/LocalException.cpp +0 -3262
- data/dist/ice/cpp/src/Ice/generated/LocatorF.cpp +0 -63
- data/dist/ice/cpp/src/Ice/generated/Logger.cpp +0 -73
- data/dist/ice/cpp/src/Ice/generated/LoggerF.cpp +0 -61
- data/dist/ice/cpp/src/Ice/generated/ObjectAdapter.cpp +0 -79
- data/dist/ice/cpp/src/Ice/generated/ObjectAdapterF.cpp +0 -61
- data/dist/ice/cpp/src/Ice/generated/ObjectFactory.cpp +0 -75
- data/dist/ice/cpp/src/Ice/generated/Plugin.cpp +0 -87
- data/dist/ice/cpp/src/Ice/generated/PluginF.cpp +0 -61
- data/dist/ice/cpp/src/Ice/generated/ProcessF.cpp +0 -63
- data/dist/ice/cpp/src/Ice/generated/Properties.cpp +0 -78
- data/dist/ice/cpp/src/Ice/generated/PropertiesF.cpp +0 -63
- data/dist/ice/cpp/src/Ice/generated/RouterF.cpp +0 -63
- data/dist/ice/cpp/src/Ice/generated/ServantLocator.cpp +0 -75
- data/dist/ice/cpp/src/Ice/generated/ServantLocatorF.cpp +0 -61
- data/dist/ice/cpp/src/Ice/generated/ValueFactory.cpp +0 -83
- data/dist/ice/cpp/src/Ice/ios/StreamAcceptor.cpp +0 -154
- data/dist/ice/cpp/src/Ice/ios/StreamAcceptor.h +0 -49
- data/dist/ice/cpp/src/Ice/ios/StreamConnector.cpp +0 -146
- data/dist/ice/cpp/src/Ice/ios/StreamConnector.h +0 -52
- data/dist/ice/cpp/src/Ice/ios/StreamEndpointI.cpp +0 -477
- data/dist/ice/cpp/src/Ice/ios/StreamEndpointI.h +0 -156
- data/dist/ice/cpp/src/Ice/ios/StreamTransceiver.cpp +0 -570
- data/dist/ice/cpp/src/Ice/ios/StreamTransceiver.h +0 -93
- data/dist/ice/cpp/src/IceDiscovery/generated/IceDiscovery/IceDiscovery.h +0 -1889
- data/dist/ice/cpp/src/IceDiscovery/generated/IceDiscovery.cpp +0 -915
- data/dist/ice/cpp/src/IceLocatorDiscovery/generated/IceLocatorDiscovery/IceLocatorDiscovery.h +0 -1197
- data/dist/ice/cpp/src/IceLocatorDiscovery/generated/IceLocatorDiscovery.cpp +0 -730
- data/dist/ice/cpp/src/IceSSL/AcceptorI.cpp +0 -105
- data/dist/ice/cpp/src/IceSSL/AcceptorI.h +0 -52
- data/dist/ice/cpp/src/IceSSL/CertificateI.cpp +0 -301
- data/dist/ice/cpp/src/IceSSL/CertificateI.h +0 -64
- data/dist/ice/cpp/src/IceSSL/ConnectorI.cpp +0 -102
- data/dist/ice/cpp/src/IceSSL/ConnectorI.h +0 -44
- data/dist/ice/cpp/src/IceSSL/EndpointI.cpp +0 -372
- data/dist/ice/cpp/src/IceSSL/EndpointI.h +0 -100
- data/dist/ice/cpp/src/IceSSL/Instance.cpp +0 -28
- data/dist/ice/cpp/src/IceSSL/Instance.h +0 -37
- data/dist/ice/cpp/src/IceSSL/InstanceF.h +0 -33
- data/dist/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +0 -688
- data/dist/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +0 -1147
- data/dist/ice/cpp/src/IceSSL/OpenSSLEngine.h +0 -59
- data/dist/ice/cpp/src/IceSSL/OpenSSLEngineF.h +0 -27
- data/dist/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +0 -127
- data/dist/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +0 -1092
- data/dist/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +0 -90
- data/dist/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +0 -288
- data/dist/ice/cpp/src/IceSSL/OpenSSLUtil.h +0 -58
- data/dist/ice/cpp/src/IceSSL/PluginI.cpp +0 -246
- data/dist/ice/cpp/src/IceSSL/PluginI.h +0 -67
- data/dist/ice/cpp/src/IceSSL/RFC2253.h +0 -62
- data/dist/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +0 -721
- data/dist/ice/cpp/src/IceSSL/SChannelEngine.cpp +0 -1283
- data/dist/ice/cpp/src/IceSSL/SChannelEngine.h +0 -123
- data/dist/ice/cpp/src/IceSSL/SChannelEngineF.h +0 -31
- data/dist/ice/cpp/src/IceSSL/SChannelPluginI.cpp +0 -73
- data/dist/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +0 -1174
- data/dist/ice/cpp/src/IceSSL/SChannelTransceiverI.h +0 -133
- data/dist/ice/cpp/src/IceSSL/SSLEngine.cpp +0 -313
- data/dist/ice/cpp/src/IceSSL/SSLEngine.h +0 -100
- data/dist/ice/cpp/src/IceSSL/SSLEngineF.h +0 -21
- data/dist/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +0 -999
- data/dist/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +0 -1308
- data/dist/ice/cpp/src/IceSSL/SecureTransportEngine.h +0 -59
- data/dist/ice/cpp/src/IceSSL/SecureTransportEngineF.h +0 -29
- data/dist/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +0 -75
- data/dist/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +0 -719
- data/dist/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +0 -92
- data/dist/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +0 -868
- data/dist/ice/cpp/src/IceSSL/SecureTransportUtil.h +0 -45
- data/dist/ice/cpp/src/IceSSL/TrustManager.cpp +0 -236
- data/dist/ice/cpp/src/IceSSL/TrustManager.h +0 -46
- data/dist/ice/cpp/src/IceSSL/TrustManagerF.h +0 -21
- data/dist/ice/cpp/src/IceSSL/Util.cpp +0 -192
- data/dist/ice/cpp/src/IceSSL/Util.h +0 -99
- data/dist/ice/cpp/src/IceSSL/generated/ConnectionInfo.cpp +0 -75
- data/dist/ice/cpp/src/IceSSL/generated/ConnectionInfoF.cpp +0 -61
- data/dist/ice/cpp/src/IceSSL/generated/EndpointInfo.cpp +0 -75
- data/dist/ice/cpp/src/IceUtil/ConvertUTF.cpp +0 -472
- data/dist/ice/cpp/src/IceUtil/ConvertUTF.h +0 -147
- data/dist/ice/cpp/src/IceUtil/CtrlCHandler.cpp +0 -259
- data/dist/ice/cpp/src/IceUtil/FileUtil.cpp +0 -471
- data/dist/ice/cpp/src/IceUtil/InputUtil.cpp +0 -36
- data/dist/ice/cpp/src/IceUtil/MutexProtocol.cpp +0 -19
- data/dist/ice/cpp/src/IceUtil/OutputUtil.cpp +0 -609
- data/dist/ice/cpp/src/IceUtil/Random.cpp +0 -180
- data/dist/ice/cpp/src/IceUtil/RecMutex.cpp +0 -238
- data/dist/ice/cpp/src/IceUtil/Shared.cpp +0 -71
- data/dist/ice/cpp/src/IceUtil/StringConverter.cpp +0 -690
- data/dist/ice/cpp/src/IceUtil/StringUtil.cpp +0 -1135
- data/dist/ice/cpp/src/IceUtil/ThreadException.cpp +0 -130
- data/dist/ice/cpp/src/IceUtil/Time.cpp +0 -307
- data/dist/ice/cpp/src/IceUtil/UUID.cpp +0 -165
- data/dist/ice/cpp/src/IceUtil/Unicode.cpp +0 -183
- data/dist/ice/cpp/src/IceUtil/Unicode.h +0 -43
- data/dist/ice/cpp/src/IceUtil/UtilException.cpp +0 -839
- data/dist/ice/cpp/src/Slice/CPlusPlusUtil.cpp +0 -1810
- data/dist/ice/cpp/src/Slice/CPlusPlusUtil.h +0 -72
- data/dist/ice/cpp/src/Slice/Checksum.cpp +0 -447
- data/dist/ice/cpp/src/Slice/Checksum.h +0 -21
- data/dist/ice/cpp/src/Slice/JavaUtil.cpp +0 -5183
- data/dist/ice/cpp/src/Slice/JavaUtil.h +0 -407
- data/dist/ice/cpp/src/Slice/MD5.cpp +0 -52
- data/dist/ice/cpp/src/Slice/MD5.h +0 -39
- data/dist/ice/cpp/src/Slice/MD5I.cpp +0 -393
- data/dist/ice/cpp/src/Slice/MD5I.h +0 -91
- data/dist/ice/cpp/src/Slice/PHPUtil.cpp +0 -157
- data/dist/ice/cpp/src/Slice/PHPUtil.h +0 -36
- data/dist/ice/cpp/src/Slice/Python.cpp +0 -830
- data/dist/ice/cpp/src/Slice/PythonUtil.cpp +0 -3439
- data/dist/ice/cpp/src/Slice/PythonUtil.h +0 -70
- data/dist/ice/cpp/src/Slice/Ruby.cpp +0 -350
- data/dist/ice/cpp/src/Slice/RubyUtil.cpp +0 -1571
- data/dist/ice/cpp/src/Slice/RubyUtil.h +0 -49
- data/dist/ice/slice/Glacier2/PermissionsVerifierF.ice +0 -30
- data/dist/ice/slice/Glacier2/RouterF.ice +0 -29
- data/dist/ice/slice/Ice/Communicator.ice +0 -676
- data/dist/ice/slice/Ice/CommunicatorF.ice +0 -31
- data/dist/ice/slice/Ice/Connection.ice +0 -516
- data/dist/ice/slice/Ice/ConnectionF.ice +0 -33
- data/dist/ice/slice/Ice/Current.ice +0 -170
- data/dist/ice/slice/Ice/Endpoint.ice +0 -291
- data/dist/ice/slice/Ice/EndpointF.ice +0 -43
- data/dist/ice/slice/Ice/FacetMap.ice +0 -36
- data/dist/ice/slice/Ice/ImplicitContext.ice +0 -119
- data/dist/ice/slice/Ice/ImplicitContextF.ice +0 -30
- data/dist/ice/slice/Ice/Instrumentation.ice +0 -509
- data/dist/ice/slice/Ice/InstrumentationF.ice +0 -38
- data/dist/ice/slice/Ice/LocalException.ice +0 -1040
- data/dist/ice/slice/Ice/LocatorF.ice +0 -32
- data/dist/ice/slice/Ice/Logger.ice +0 -99
- data/dist/ice/slice/Ice/LoggerF.ice +0 -31
- data/dist/ice/slice/Ice/ObjectAdapter.ice +0 -710
- data/dist/ice/slice/Ice/ObjectAdapterF.ice +0 -31
- data/dist/ice/slice/Ice/ObjectFactory.ice +0 -71
- data/dist/ice/slice/Ice/Plugin.ice +0 -131
- data/dist/ice/slice/Ice/PluginF.ice +0 -36
- data/dist/ice/slice/Ice/ProcessF.ice +0 -31
- data/dist/ice/slice/Ice/Properties.ice +0 -244
- data/dist/ice/slice/Ice/PropertiesF.ice +0 -32
- data/dist/ice/slice/Ice/RouterF.ice +0 -31
- data/dist/ice/slice/Ice/ServantLocator.ice +0 -136
- data/dist/ice/slice/Ice/ServantLocatorF.ice +0 -31
- data/dist/ice/slice/Ice/ValueFactory.ice +0 -133
- data/dist/ice/slice/IceBox/IceBox.ice +0 -216
- data/dist/ice/slice/IceGrid/PluginFacade.ice +0 -329
- data/dist/ice/slice/IcePatch2/FileInfo.ice +0 -85
- data/dist/ice/slice/IcePatch2/FileServer.ice +0 -191
- data/dist/lib/Glacier2/PermissionsVerifierF.rb +0 -30
- data/dist/lib/Glacier2/RouterF.rb +0 -25
- data/dist/lib/Ice/Communicator.rb +0 -87
- data/dist/lib/Ice/CommunicatorF.rb +0 -24
- data/dist/lib/Ice/Connection.rb +0 -413
- data/dist/lib/Ice/ConnectionF.rb +0 -32
- data/dist/lib/Ice/Current.rb +0 -141
- data/dist/lib/Ice/Endpoint.rb +0 -187
- data/dist/lib/Ice/EndpointF.rb +0 -48
- data/dist/lib/Ice/FacetMap.rb +0 -24
- data/dist/lib/Ice/ImplicitContext.rb +0 -26
- data/dist/lib/Ice/ImplicitContextF.rb +0 -24
- data/dist/lib/Ice/Instrumentation.rb +0 -169
- data/dist/lib/Ice/InstrumentationF.rb +0 -31
- data/dist/lib/Ice/LocalException.rb +0 -1031
- data/dist/lib/Ice/LocatorF.rb +0 -30
- data/dist/lib/Ice/Logger.rb +0 -24
- data/dist/lib/Ice/LoggerF.rb +0 -24
- data/dist/lib/Ice/ObjectAdapter.rb +0 -29
- data/dist/lib/Ice/ObjectAdapterF.rb +0 -24
- data/dist/lib/Ice/ObjectFactory.rb +0 -24
- data/dist/lib/Ice/Plugin.rb +0 -30
- data/dist/lib/Ice/PluginF.rb +0 -28
- data/dist/lib/Ice/ProcessF.rb +0 -25
- data/dist/lib/Ice/Properties.rb +0 -25
- data/dist/lib/Ice/PropertiesF.rb +0 -29
- data/dist/lib/Ice/RouterF.rb +0 -25
- data/dist/lib/Ice/ServantLocator.rb +0 -26
- data/dist/lib/Ice/ServantLocatorF.rb +0 -24
- data/dist/lib/Ice/ValueFactory.rb +0 -28
- data/dist/lib/IceBox/IceBox.rb +0 -164
- data/dist/lib/IceGrid/PluginFacade.rb +0 -35
- data/dist/lib/IcePatch2/FileInfo.rb +0 -115
- data/dist/lib/IcePatch2/FileServer.rb +0 -123
- data/dist/lib/IcePatch2.rb +0 -5
|
@@ -1,793 +1,473 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
# define _XOPEN_SOURCE
|
|
12
|
-
# include <netinet/in.h>
|
|
13
|
-
#endif
|
|
1
|
+
// Copyright (c) ZeroC, Inc.
|
|
2
|
+
|
|
3
|
+
#include "Network.h"
|
|
4
|
+
#include "Ice/LocalExceptions.h"
|
|
5
|
+
#include "Ice/LoggerUtil.h" // For setTcpBufSize
|
|
6
|
+
#include "Ice/Properties.h" // For setTcpBufSize
|
|
7
|
+
#include "Ice/StringUtil.h"
|
|
8
|
+
#include "NetworkProxy.h"
|
|
9
|
+
#include "ProtocolInstance.h" // For setTcpBufSize
|
|
10
|
+
#include "Random.h"
|
|
14
11
|
|
|
15
|
-
#include
|
|
16
|
-
|
|
17
|
-
#include <
|
|
18
|
-
#include <IceUtil/StringUtil.h>
|
|
19
|
-
#include <Ice/StringConverter.h>
|
|
20
|
-
#include <Ice/LocalException.h>
|
|
21
|
-
#include <Ice/ProtocolInstance.h> // For setTcpBufSize
|
|
22
|
-
#include <Ice/Properties.h> // For setTcpBufSize
|
|
23
|
-
#include <Ice/LoggerUtil.h> // For setTcpBufSize
|
|
24
|
-
#include <Ice/Buffer.h>
|
|
25
|
-
#include <IceUtil/Random.h>
|
|
26
|
-
#include <functional>
|
|
12
|
+
#include "DisableWarnings.h"
|
|
13
|
+
|
|
14
|
+
#include <cassert>
|
|
27
15
|
|
|
28
16
|
// TODO: fix this warning
|
|
29
17
|
#if defined(_MSC_VER)
|
|
30
|
-
#
|
|
18
|
+
# pragma warning(disable : 4244) // 'argument': conversion from 'int' to 'u_short', possible loss of data
|
|
31
19
|
#endif
|
|
32
20
|
|
|
33
21
|
#if defined(_WIN32)
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
# include <iphlpapi.h>
|
|
40
|
-
# include <Mswsock.h>
|
|
41
|
-
# include <mstcpip.h>
|
|
22
|
+
# include <Mswsock.h>
|
|
23
|
+
# include <iphlpapi.h>
|
|
24
|
+
# include <mstcpip.h>
|
|
25
|
+
# include <winsock2.h>
|
|
26
|
+
# include <ws2tcpip.h>
|
|
42
27
|
#else
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
|
|
47
|
-
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
|
48
|
-
# include <ifaddrs.h>
|
|
49
|
-
#elif defined(__sun)
|
|
50
|
-
# include <sys/sockio.h>
|
|
51
|
-
#endif
|
|
52
|
-
|
|
53
|
-
#if defined(__GNUC__) && (__GNUC__ < 5)
|
|
54
|
-
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
|
55
|
-
#endif
|
|
56
|
-
|
|
57
|
-
#if defined(__MINGW32__)
|
|
58
|
-
//
|
|
59
|
-
// Work-around for missing definitions in MinGW Windows headers
|
|
60
|
-
//
|
|
61
|
-
# ifndef IPV6_V6ONLY
|
|
62
|
-
# define IPV6_V6ONLY 27
|
|
63
|
-
# endif
|
|
64
|
-
|
|
65
|
-
extern "C"
|
|
66
|
-
{
|
|
67
|
-
WINSOCK_API_LINKAGE int WSAAPI inet_pton(INT, PCTSTR, PVOID);
|
|
68
|
-
}
|
|
28
|
+
# include <ifaddrs.h>
|
|
29
|
+
# include <net/if.h>
|
|
30
|
+
# include <sys/ioctl.h>
|
|
69
31
|
#endif
|
|
70
32
|
|
|
71
33
|
using namespace std;
|
|
72
34
|
using namespace Ice;
|
|
73
35
|
using namespace IceInternal;
|
|
74
36
|
|
|
75
|
-
#ifdef _WIN32
|
|
76
|
-
int
|
|
77
|
-
IceInternal::getSystemErrno()
|
|
78
|
-
{
|
|
79
|
-
return GetLastError();
|
|
80
|
-
}
|
|
81
|
-
#else
|
|
82
|
-
int
|
|
83
|
-
IceInternal::getSystemErrno()
|
|
84
|
-
{
|
|
85
|
-
return errno;
|
|
86
|
-
}
|
|
87
|
-
#endif
|
|
88
|
-
|
|
89
37
|
namespace
|
|
90
38
|
{
|
|
91
|
-
|
|
92
|
-
struct AddressCompare
|
|
93
|
-
{
|
|
94
|
-
public:
|
|
95
|
-
|
|
96
|
-
bool
|
|
97
|
-
operator()(const Address& lhs, const Address& rhs) const
|
|
39
|
+
void sortAddresses(vector<Address>& addrs, ProtocolSupport protocol, bool preferIPv6)
|
|
98
40
|
{
|
|
99
|
-
|
|
41
|
+
if (protocol == EnableBoth)
|
|
42
|
+
{
|
|
43
|
+
if (preferIPv6)
|
|
44
|
+
{
|
|
45
|
+
stable_partition(
|
|
46
|
+
addrs.begin(),
|
|
47
|
+
addrs.end(),
|
|
48
|
+
[](const Address& ss) { return ss.saStorage.ss_family == AF_INET6; });
|
|
49
|
+
}
|
|
50
|
+
else
|
|
51
|
+
{
|
|
52
|
+
stable_partition(
|
|
53
|
+
addrs.begin(),
|
|
54
|
+
addrs.end(),
|
|
55
|
+
[](const Address& ss) { return ss.saStorage.ss_family != AF_INET6; });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
100
58
|
}
|
|
101
|
-
};
|
|
102
59
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
struct AddressIsIPv6 : public unary_function<Address, bool>
|
|
106
|
-
{
|
|
107
|
-
public:
|
|
108
|
-
|
|
109
|
-
bool
|
|
110
|
-
operator()(const Address& ss) const
|
|
60
|
+
void setTcpNoDelay(SOCKET fd)
|
|
111
61
|
{
|
|
112
|
-
|
|
62
|
+
int flag = 1;
|
|
63
|
+
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&flag), int(sizeof(int))) == SOCKET_ERROR)
|
|
64
|
+
{
|
|
65
|
+
closeSocketNoThrow(fd);
|
|
66
|
+
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
67
|
+
}
|
|
113
68
|
}
|
|
114
|
-
};
|
|
115
|
-
#endif
|
|
116
69
|
|
|
117
|
-
void
|
|
118
|
-
sortAddresses(vector<Address>& addrs, ProtocolSupport protocol, Ice::EndpointSelectionType selType, bool preferIPv6)
|
|
119
|
-
{
|
|
120
|
-
if(selType == Ice::ICE_ENUM(EndpointSelectionType, Random))
|
|
70
|
+
void setKeepAlive(SOCKET fd)
|
|
121
71
|
{
|
|
122
|
-
|
|
72
|
+
int flag = 1;
|
|
73
|
+
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast<char*>(&flag), int(sizeof(int))) == SOCKET_ERROR)
|
|
74
|
+
{
|
|
75
|
+
closeSocketNoThrow(fd);
|
|
76
|
+
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
77
|
+
}
|
|
123
78
|
}
|
|
124
79
|
|
|
125
|
-
|
|
80
|
+
SOCKET
|
|
81
|
+
createSocketImpl(bool udp, int family)
|
|
126
82
|
{
|
|
127
|
-
|
|
128
|
-
if(
|
|
83
|
+
SOCKET fd;
|
|
84
|
+
if (udp)
|
|
129
85
|
{
|
|
130
|
-
|
|
131
|
-
[](const Address& ss)
|
|
132
|
-
{
|
|
133
|
-
return ss.saStorage.ss_family == AF_INET6;
|
|
134
|
-
});
|
|
86
|
+
fd = socket(family, SOCK_DGRAM, IPPROTO_UDP);
|
|
135
87
|
}
|
|
136
88
|
else
|
|
137
89
|
{
|
|
138
|
-
|
|
139
|
-
[](const Address& ss)
|
|
140
|
-
{
|
|
141
|
-
return ss.saStorage.ss_family != AF_INET6;
|
|
142
|
-
});
|
|
90
|
+
fd = socket(family, SOCK_STREAM, IPPROTO_TCP);
|
|
143
91
|
}
|
|
144
|
-
|
|
145
|
-
if(
|
|
92
|
+
|
|
93
|
+
if (fd == INVALID_SOCKET)
|
|
146
94
|
{
|
|
147
|
-
|
|
95
|
+
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
148
96
|
}
|
|
149
|
-
|
|
97
|
+
|
|
98
|
+
if (!udp)
|
|
150
99
|
{
|
|
151
|
-
|
|
100
|
+
setTcpNoDelay(fd);
|
|
101
|
+
setKeepAlive(fd);
|
|
152
102
|
}
|
|
153
|
-
#endif
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
103
|
|
|
157
|
-
|
|
158
|
-
setTcpNoDelay(SOCKET fd)
|
|
159
|
-
{
|
|
160
|
-
int flag = 1;
|
|
161
|
-
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&flag), int(sizeof(int))) == SOCKET_ERROR)
|
|
162
|
-
{
|
|
163
|
-
closeSocketNoThrow(fd);
|
|
164
|
-
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
void
|
|
169
|
-
setKeepAlive(SOCKET fd)
|
|
170
|
-
{
|
|
171
|
-
int flag = 1;
|
|
172
|
-
if(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, reinterpret_cast<char*>(&flag), int(sizeof(int))) == SOCKET_ERROR)
|
|
173
|
-
{
|
|
174
|
-
closeSocketNoThrow(fd);
|
|
175
|
-
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
104
|
+
return fd;
|
|
176
105
|
}
|
|
177
|
-
}
|
|
178
106
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
SOCKET fd;
|
|
183
|
-
if(udp)
|
|
107
|
+
// Only used for multicast.
|
|
108
|
+
vector<Address> getLocalAddresses(ProtocolSupport protocol)
|
|
184
109
|
{
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
else
|
|
188
|
-
{
|
|
189
|
-
fd = socket(family, SOCK_STREAM, IPPROTO_TCP);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if(fd == INVALID_SOCKET)
|
|
193
|
-
{
|
|
194
|
-
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if(!udp)
|
|
198
|
-
{
|
|
199
|
-
setTcpNoDelay(fd);
|
|
200
|
-
setKeepAlive(fd);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return fd;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
vector<Address>
|
|
207
|
-
getLocalAddresses(ProtocolSupport protocol, bool includeLoopback, bool singleAddressPerInterface)
|
|
208
|
-
{
|
|
209
|
-
vector<Address> result;
|
|
110
|
+
vector<Address> result;
|
|
210
111
|
|
|
211
112
|
#if defined(_WIN32)
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
113
|
+
DWORD family;
|
|
114
|
+
switch (protocol)
|
|
115
|
+
{
|
|
116
|
+
case EnableIPv4:
|
|
117
|
+
family = AF_INET;
|
|
118
|
+
break;
|
|
119
|
+
case EnableIPv6:
|
|
120
|
+
family = AF_INET6;
|
|
121
|
+
break;
|
|
122
|
+
default:
|
|
123
|
+
family = AF_UNSPEC;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
225
126
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
{
|
|
230
|
-
PIP_ADAPTER_ADDRESSES adapter_addresses = (PIP_ADAPTER_ADDRESSES) malloc(size);
|
|
231
|
-
rv = GetAdaptersAddresses(family, 0, ICE_NULLPTR, adapter_addresses, &size);
|
|
232
|
-
if(rv == ERROR_SUCCESS)
|
|
127
|
+
DWORD size = 0;
|
|
128
|
+
DWORD rv = GetAdaptersAddresses(family, 0, nullptr, nullptr, &size);
|
|
129
|
+
if (rv == ERROR_BUFFER_OVERFLOW)
|
|
233
130
|
{
|
|
234
|
-
|
|
131
|
+
PIP_ADAPTER_ADDRESSES adapter_addresses = (PIP_ADAPTER_ADDRESSES)malloc(size);
|
|
132
|
+
rv = GetAdaptersAddresses(family, 0, nullptr, adapter_addresses, &size);
|
|
133
|
+
if (rv == ERROR_SUCCESS)
|
|
235
134
|
{
|
|
236
|
-
|
|
135
|
+
for (PIP_ADAPTER_ADDRESSES aa = adapter_addresses; aa != nullptr; aa = aa->Next)
|
|
237
136
|
{
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
for(PIP_ADAPTER_UNICAST_ADDRESS ua = aa->FirstUnicastAddress; ua != ICE_NULLPTR; ua = ua->Next)
|
|
241
|
-
{
|
|
242
|
-
Address addr;
|
|
243
|
-
memcpy(&addr.saStorage, ua->Address.lpSockaddr, ua->Address.iSockaddrLength);
|
|
244
|
-
if(addr.saStorage.ss_family == AF_INET && protocol != EnableIPv6)
|
|
137
|
+
if (aa->OperStatus == IfOperStatusUp && (aa->Flags & IP_ADAPTER_NO_MULTICAST) == 0)
|
|
245
138
|
{
|
|
246
|
-
|
|
247
|
-
(includeLoopback || addr.saIn.sin_addr.s_addr != htonl(INADDR_LOOPBACK)))
|
|
139
|
+
for (PIP_ADAPTER_UNICAST_ADDRESS ua = aa->FirstUnicastAddress; ua != nullptr; ua = ua->Next)
|
|
248
140
|
{
|
|
249
|
-
|
|
250
|
-
|
|
141
|
+
Address addr;
|
|
142
|
+
memcpy(&addr.saStorage, ua->Address.lpSockaddr, ua->Address.iSockaddrLength);
|
|
143
|
+
if (addr.saStorage.ss_family == AF_INET && protocol != EnableIPv6)
|
|
251
144
|
{
|
|
252
|
-
|
|
145
|
+
if (addr.saIn.sin_addr.s_addr != INADDR_ANY)
|
|
146
|
+
{
|
|
147
|
+
result.push_back(addr);
|
|
148
|
+
break; // We return at most one address per interface.
|
|
149
|
+
}
|
|
253
150
|
}
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
else if(addr.saStorage.ss_family == AF_INET6 && protocol != EnableIPv4)
|
|
257
|
-
{
|
|
258
|
-
if(!IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr) &&
|
|
259
|
-
(includeLoopback || !IN6_IS_ADDR_LOOPBACK(&addr.saIn6.sin6_addr)))
|
|
260
|
-
{
|
|
261
|
-
result.push_back(addr);
|
|
262
|
-
if(singleAddressPerInterface)
|
|
151
|
+
else if (addr.saStorage.ss_family == AF_INET6 && protocol != EnableIPv4)
|
|
263
152
|
{
|
|
264
|
-
|
|
153
|
+
if (!IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr))
|
|
154
|
+
{
|
|
155
|
+
result.push_back(addr);
|
|
156
|
+
break; // We return at most one address per interface.
|
|
157
|
+
}
|
|
265
158
|
}
|
|
266
159
|
}
|
|
267
160
|
}
|
|
268
161
|
}
|
|
269
162
|
}
|
|
270
|
-
}
|
|
271
163
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
#
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
164
|
+
free(adapter_addresses);
|
|
165
|
+
}
|
|
166
|
+
#else
|
|
167
|
+
struct ifaddrs* ifap;
|
|
168
|
+
if (::getifaddrs(&ifap) == SOCKET_ERROR)
|
|
169
|
+
{
|
|
170
|
+
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
171
|
+
}
|
|
280
172
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
{
|
|
285
|
-
if(curr->ifa_addr && (includeLoopback || !(curr->ifa_flags & IFF_LOOPBACK)))
|
|
173
|
+
struct ifaddrs* curr = ifap;
|
|
174
|
+
set<string> interfaces;
|
|
175
|
+
while (curr != nullptr)
|
|
286
176
|
{
|
|
287
|
-
|
|
177
|
+
unsigned int flags = curr->ifa_flags;
|
|
178
|
+
if ((flags & IFF_UP) != 0 && (flags & IFF_MULTICAST) != 0 && curr->ifa_addr)
|
|
288
179
|
{
|
|
289
|
-
|
|
290
|
-
memcpy(&addr.saStorage, curr->ifa_addr, sizeof(sockaddr_in));
|
|
291
|
-
if(addr.saIn.sin_addr.s_addr != 0)
|
|
180
|
+
if (curr->ifa_addr->sa_family == AF_INET && protocol != EnableIPv6)
|
|
292
181
|
{
|
|
293
|
-
|
|
182
|
+
Address addr;
|
|
183
|
+
memcpy(&addr.saStorage, curr->ifa_addr, sizeof(sockaddr_in));
|
|
184
|
+
// one address per interface name
|
|
185
|
+
if (addr.saIn.sin_addr.s_addr != INADDR_ANY && interfaces.insert(curr->ifa_name).second)
|
|
294
186
|
{
|
|
295
187
|
result.push_back(addr);
|
|
296
|
-
interfaces.insert(curr->ifa_name);
|
|
297
188
|
}
|
|
298
189
|
}
|
|
299
|
-
|
|
300
|
-
else if(curr->ifa_addr->sa_family == AF_INET6 && protocol != EnableIPv4)
|
|
301
|
-
{
|
|
302
|
-
Address addr;
|
|
303
|
-
memcpy(&addr.saStorage, curr->ifa_addr, sizeof(sockaddr_in6));
|
|
304
|
-
if(!IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr))
|
|
190
|
+
else if (curr->ifa_addr->sa_family == AF_INET6 && protocol != EnableIPv4)
|
|
305
191
|
{
|
|
306
|
-
|
|
192
|
+
Address addr;
|
|
193
|
+
memcpy(&addr.saStorage, curr->ifa_addr, sizeof(sockaddr_in6));
|
|
194
|
+
// one address per interface name
|
|
195
|
+
if (!IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr) && interfaces.insert(curr->ifa_name).second)
|
|
307
196
|
{
|
|
308
197
|
result.push_back(addr);
|
|
309
|
-
interfaces.insert(curr->ifa_name);
|
|
310
198
|
}
|
|
311
199
|
}
|
|
312
200
|
}
|
|
201
|
+
curr = curr->ifa_next;
|
|
313
202
|
}
|
|
314
203
|
|
|
315
|
-
|
|
204
|
+
::freeifaddrs(ifap);
|
|
205
|
+
#endif
|
|
206
|
+
return result;
|
|
316
207
|
}
|
|
317
208
|
|
|
318
|
-
|
|
319
|
-
#else
|
|
320
|
-
for(int i = 0; i < 2; i++)
|
|
209
|
+
bool isWildcard(const string& host, ProtocolSupport protocol, bool& ipv4)
|
|
321
210
|
{
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
continue;
|
|
325
|
-
}
|
|
326
|
-
SOCKET fd = createSocketImpl(false, i == 0 ? AF_INET : AF_INET6);
|
|
327
|
-
|
|
328
|
-
#ifdef _AIX
|
|
329
|
-
int cmd = CSIOCGIFCONF;
|
|
330
|
-
#else
|
|
331
|
-
int cmd = SIOCGIFCONF;
|
|
332
|
-
#endif
|
|
333
|
-
struct ifconf ifc;
|
|
334
|
-
int numaddrs = 10;
|
|
335
|
-
int old_ifc_len = 0;
|
|
336
|
-
|
|
337
|
-
//
|
|
338
|
-
// Need to call ioctl multiple times since we do not know up front
|
|
339
|
-
// how many addresses there will be, and thus how large a buffer we need.
|
|
340
|
-
// We keep increasing the buffer size until subsequent calls return
|
|
341
|
-
// the same length, meaning we have all the addresses.
|
|
342
|
-
//
|
|
343
|
-
while(true)
|
|
211
|
+
Address addr = getAddressForServer(host, 0, protocol, true, false);
|
|
212
|
+
if (addr.saStorage.ss_family == AF_INET)
|
|
344
213
|
{
|
|
345
|
-
|
|
346
|
-
ifc.ifc_len = bufsize;
|
|
347
|
-
ifc.ifc_buf = (char*)malloc(bufsize);
|
|
348
|
-
|
|
349
|
-
int rs = ioctl(fd, cmd, &ifc);
|
|
350
|
-
if(rs == SOCKET_ERROR)
|
|
214
|
+
if (addr.saIn.sin_addr.s_addr == INADDR_ANY)
|
|
351
215
|
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
216
|
+
ipv4 = true;
|
|
217
|
+
return true;
|
|
355
218
|
}
|
|
356
|
-
else if(ifc.ifc_len == old_ifc_len)
|
|
357
|
-
{
|
|
358
|
-
//
|
|
359
|
-
// Returned same length twice in a row, finished.
|
|
360
|
-
//
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
else
|
|
364
|
-
{
|
|
365
|
-
old_ifc_len = ifc.ifc_len;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
numaddrs += 10;
|
|
369
|
-
free(ifc.ifc_buf);
|
|
370
219
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
numaddrs = ifc.ifc_len / static_cast<int>(sizeof(struct ifreq));
|
|
374
|
-
struct ifreq* ifr = ifc.ifc_req;
|
|
375
|
-
set<string> interfaces;
|
|
376
|
-
for(int j = 0; j < numaddrs; ++j)
|
|
220
|
+
else if (addr.saStorage.ss_family == AF_INET6)
|
|
377
221
|
{
|
|
378
|
-
if(
|
|
222
|
+
if (IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr))
|
|
379
223
|
{
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
// check the address below. Solaris also returns duplicate entries that need
|
|
383
|
-
// to be filtered out.
|
|
384
|
-
//
|
|
385
|
-
if(ifr[j].ifr_addr.sa_family == AF_INET && protocol != EnableIPv6)
|
|
386
|
-
{
|
|
387
|
-
Address addr;
|
|
388
|
-
memcpy(&addr.saStorage, &ifr[j].ifr_addr, sizeof(sockaddr_in));
|
|
389
|
-
if(addr.saIn.sin_addr.s_addr != 0 &&
|
|
390
|
-
(includeLoopback || addr.saIn.sin_addr.s_addr != htonl(INADDR_LOOPBACK)))
|
|
391
|
-
{
|
|
392
|
-
if(!singleAddressPerInterface || interfaces.find(ifr[j].ifr_name) == interfaces.end())
|
|
393
|
-
{
|
|
394
|
-
result.push_back(addr);
|
|
395
|
-
interfaces.insert(ifr[j].ifr_name);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
else if(ifr[j].ifr_addr.sa_family == AF_INET6 && protocol != EnableIPv4)
|
|
400
|
-
{
|
|
401
|
-
Address addr;
|
|
402
|
-
memcpy(&addr.saStorage, &ifr[j].ifr_addr, sizeof(sockaddr_in6));
|
|
403
|
-
if(!IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr) &&
|
|
404
|
-
(includeLoopback || !IN6_IS_ADDR_LOOPBACK(&addr.saIn6.sin6_addr)))
|
|
405
|
-
{
|
|
406
|
-
if(!singleAddressPerInterface || interfaces.find(ifr[j].ifr_name) == interfaces.end())
|
|
407
|
-
{
|
|
408
|
-
result.push_back(addr);
|
|
409
|
-
interfaces.insert(ifr[j].ifr_name);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
224
|
+
ipv4 = false;
|
|
225
|
+
return true;
|
|
413
226
|
}
|
|
414
227
|
}
|
|
415
|
-
|
|
228
|
+
return false;
|
|
416
229
|
}
|
|
417
|
-
#endif
|
|
418
230
|
|
|
419
|
-
|
|
420
|
-
// Remove potential duplicates from the result.
|
|
421
|
-
//
|
|
422
|
-
set<Address, AddressCompare> seen;
|
|
423
|
-
vector<Address> tmp;
|
|
424
|
-
tmp.swap(result);
|
|
425
|
-
for(vector<Address>::const_iterator p = tmp.begin(); p != tmp.end(); ++p)
|
|
231
|
+
int getInterfaceIndex(const string& intf)
|
|
426
232
|
{
|
|
427
|
-
if(
|
|
233
|
+
if (intf.empty())
|
|
428
234
|
{
|
|
429
|
-
|
|
430
|
-
seen.insert(*p);
|
|
235
|
+
return 0;
|
|
431
236
|
}
|
|
432
|
-
}
|
|
433
|
-
return result;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
bool
|
|
437
|
-
isLinklocal(const Address& addr)
|
|
438
|
-
{
|
|
439
|
-
if(addr.saStorage.ss_family == AF_INET6)
|
|
440
|
-
{
|
|
441
|
-
return IN6_IS_ADDR_LINKLOCAL(&addr.saIn6.sin6_addr);
|
|
442
|
-
}
|
|
443
|
-
else if(addr.saStorage.ss_family == AF_INET)
|
|
444
|
-
{
|
|
445
|
-
// Check for 169.254.X.X in network order
|
|
446
|
-
return (addr.saIn.sin_addr.s_addr & 0xFF) == 169 && ((addr.saIn.sin_addr.s_addr & 0xFF00)>>8) == 254;
|
|
447
|
-
}
|
|
448
|
-
return false;
|
|
449
|
-
}
|
|
450
237
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
{
|
|
457
|
-
if(addr.saIn.sin_addr.s_addr == INADDR_ANY)
|
|
238
|
+
string name;
|
|
239
|
+
bool isAddr;
|
|
240
|
+
in6_addr addr;
|
|
241
|
+
string::size_type pos = intf.find('%');
|
|
242
|
+
if (pos != string::npos)
|
|
458
243
|
{
|
|
459
|
-
|
|
460
|
-
|
|
244
|
+
//
|
|
245
|
+
// If it's a link-local address, use the zone indice.
|
|
246
|
+
//
|
|
247
|
+
isAddr = false;
|
|
248
|
+
name = intf.substr(pos + 1);
|
|
461
249
|
}
|
|
462
|
-
|
|
463
|
-
else if(addr.saStorage.ss_family == AF_INET6)
|
|
464
|
-
{
|
|
465
|
-
if(IN6_IS_ADDR_UNSPECIFIED(&addr.saIn6.sin6_addr))
|
|
250
|
+
else
|
|
466
251
|
{
|
|
467
|
-
|
|
468
|
-
|
|
252
|
+
//
|
|
253
|
+
// Then check if it's an IPv6 address. If it's an address we'll
|
|
254
|
+
// look for the interface index by address.
|
|
255
|
+
//
|
|
256
|
+
isAddr = inet_pton(AF_INET6, intf.c_str(), &addr) > 0;
|
|
257
|
+
name = intf;
|
|
469
258
|
}
|
|
470
|
-
}
|
|
471
|
-
return false;
|
|
472
|
-
}
|
|
473
259
|
|
|
474
|
-
int
|
|
475
|
-
getInterfaceIndex(const string& intf)
|
|
476
|
-
{
|
|
477
|
-
if(intf.empty())
|
|
478
|
-
{
|
|
479
|
-
return 0;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
string name;
|
|
483
|
-
bool isAddr;
|
|
484
|
-
in6_addr addr;
|
|
485
|
-
string::size_type pos = intf.find("%");
|
|
486
|
-
if(pos != string::npos)
|
|
487
|
-
{
|
|
488
260
|
//
|
|
489
|
-
//
|
|
261
|
+
// Check if index
|
|
490
262
|
//
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
// Then check if it's an IPv6 address. If it's an address we'll
|
|
498
|
-
// look for the interface index by address.
|
|
499
|
-
//
|
|
500
|
-
isAddr = inet_pton(AF_INET6, intf.c_str(), &addr) > 0;
|
|
501
|
-
name = intf;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
//
|
|
505
|
-
// Check if index
|
|
506
|
-
//
|
|
507
|
-
int index = -1;
|
|
508
|
-
istringstream p(name);
|
|
509
|
-
if((p >> index) && p.eof())
|
|
510
|
-
{
|
|
511
|
-
return index;
|
|
512
|
-
}
|
|
263
|
+
int index = -1;
|
|
264
|
+
istringstream p(name);
|
|
265
|
+
if ((p >> index) && p.eof())
|
|
266
|
+
{
|
|
267
|
+
return index;
|
|
268
|
+
}
|
|
513
269
|
|
|
514
270
|
#ifdef _WIN32
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
{
|
|
524
|
-
while(paddrs)
|
|
271
|
+
IP_ADAPTER_ADDRESSES addrs;
|
|
272
|
+
ULONG buflen = 0;
|
|
273
|
+
if (::GetAdaptersAddresses(AF_INET6, 0, 0, &addrs, &buflen) == ERROR_BUFFER_OVERFLOW)
|
|
274
|
+
{
|
|
275
|
+
PIP_ADAPTER_ADDRESSES paddrs;
|
|
276
|
+
char* buf = new char[buflen];
|
|
277
|
+
paddrs = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(buf);
|
|
278
|
+
if (::GetAdaptersAddresses(AF_INET6, 0, 0, paddrs, &buflen) == NO_ERROR)
|
|
525
279
|
{
|
|
526
|
-
|
|
280
|
+
while (paddrs)
|
|
527
281
|
{
|
|
528
|
-
|
|
529
|
-
while(ipAddr)
|
|
282
|
+
if (isAddr)
|
|
530
283
|
{
|
|
531
|
-
|
|
284
|
+
PIP_ADAPTER_UNICAST_ADDRESS ipAddr = paddrs->FirstUnicastAddress;
|
|
285
|
+
while (ipAddr)
|
|
532
286
|
{
|
|
533
|
-
|
|
534
|
-
reinterpret_cast<struct sockaddr_in6*>(ipAddr->Address.lpSockaddr);
|
|
535
|
-
if(memcmp(&addr, &ipv6Addr->sin6_addr, sizeof(in6_addr)) == 0)
|
|
287
|
+
if (ipAddr->Address.lpSockaddr->sa_family == AF_INET6)
|
|
536
288
|
{
|
|
537
|
-
|
|
289
|
+
struct sockaddr_in6* ipv6Addr =
|
|
290
|
+
reinterpret_cast<struct sockaddr_in6*>(ipAddr->Address.lpSockaddr);
|
|
291
|
+
if (memcmp(&addr, &ipv6Addr->sin6_addr, sizeof(in6_addr)) == 0)
|
|
292
|
+
{
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
538
295
|
}
|
|
296
|
+
ipAddr = ipAddr->Next;
|
|
297
|
+
}
|
|
298
|
+
if (ipAddr)
|
|
299
|
+
{
|
|
300
|
+
index = paddrs->Ipv6IfIndex;
|
|
301
|
+
break;
|
|
539
302
|
}
|
|
540
|
-
ipAddr = ipAddr->Next;
|
|
541
303
|
}
|
|
542
|
-
|
|
304
|
+
else
|
|
543
305
|
{
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
//
|
|
554
|
-
if(wstringToString(paddrs->FriendlyName, getProcessStringConverter()) == name)
|
|
555
|
-
{
|
|
556
|
-
index = paddrs->Ipv6IfIndex;
|
|
557
|
-
break;
|
|
306
|
+
//
|
|
307
|
+
// Don't need to pass a wide string converter as the wide string
|
|
308
|
+
// come from Windows API.
|
|
309
|
+
//
|
|
310
|
+
if (wstringToString(paddrs->FriendlyName, getProcessStringConverter()) == name)
|
|
311
|
+
{
|
|
312
|
+
index = paddrs->Ipv6IfIndex;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
558
315
|
}
|
|
316
|
+
paddrs = paddrs->Next;
|
|
559
317
|
}
|
|
560
|
-
paddrs = paddrs->Next;
|
|
561
318
|
}
|
|
319
|
+
delete[] buf;
|
|
562
320
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
//
|
|
572
|
-
// Look for an interface with a matching IP address
|
|
573
|
-
//
|
|
574
|
-
if(isAddr)
|
|
575
|
-
{
|
|
576
|
-
# if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
|
577
|
-
struct ifaddrs* ifap;
|
|
578
|
-
if(::getifaddrs(&ifap) != SOCKET_ERROR)
|
|
321
|
+
if (index < 0) // interface not found
|
|
322
|
+
{
|
|
323
|
+
throw Ice::SocketException(__FILE__, __LINE__, WSAEINVAL);
|
|
324
|
+
}
|
|
325
|
+
#else
|
|
326
|
+
// Look for an interface with a matching IP address
|
|
327
|
+
if (isAddr)
|
|
579
328
|
{
|
|
580
|
-
struct ifaddrs*
|
|
581
|
-
|
|
329
|
+
struct ifaddrs* ifap;
|
|
330
|
+
if (::getifaddrs(&ifap) != SOCKET_ERROR)
|
|
582
331
|
{
|
|
583
|
-
|
|
332
|
+
struct ifaddrs* curr = ifap;
|
|
333
|
+
while (curr != nullptr)
|
|
584
334
|
{
|
|
585
|
-
|
|
586
|
-
if(memcmp(&addr, &ipv6Addr->sin6_addr, sizeof(in6_addr)) == 0)
|
|
335
|
+
if (curr->ifa_addr && curr->ifa_addr->sa_family == AF_INET6)
|
|
587
336
|
{
|
|
588
|
-
|
|
589
|
-
|
|
337
|
+
auto* ipv6Addr = reinterpret_cast<struct sockaddr_in6*>(curr->ifa_addr);
|
|
338
|
+
if (memcmp(&addr, &ipv6Addr->sin6_addr, sizeof(in6_addr)) == 0)
|
|
339
|
+
{
|
|
340
|
+
index = static_cast<int>(if_nametoindex(curr->ifa_name));
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
590
343
|
}
|
|
344
|
+
curr = curr->ifa_next;
|
|
591
345
|
}
|
|
592
|
-
|
|
346
|
+
::freeifaddrs(ifap);
|
|
593
347
|
}
|
|
594
|
-
::freeifaddrs(ifap);
|
|
595
348
|
}
|
|
596
|
-
|
|
597
|
-
SOCKET fd = createSocketImpl(false, AF_INET6);
|
|
598
|
-
# ifdef _AIX
|
|
599
|
-
int cmd = CSIOCGIFCONF;
|
|
600
|
-
# else
|
|
601
|
-
int cmd = SIOCGIFCONF;
|
|
602
|
-
# endif
|
|
603
|
-
struct ifconf ifc;
|
|
604
|
-
int numaddrs = 10;
|
|
605
|
-
int old_ifc_len = 0;
|
|
606
|
-
|
|
607
|
-
//
|
|
608
|
-
// Need to call ioctl multiple times since we do not know up front
|
|
609
|
-
// how many addresses there will be, and thus how large a buffer we need.
|
|
610
|
-
// We keep increasing the buffer size until subsequent calls return
|
|
611
|
-
// the same length, meaning we have all the addresses.
|
|
612
|
-
//
|
|
613
|
-
while(true)
|
|
349
|
+
else // Look for an interface with the given name.
|
|
614
350
|
{
|
|
615
|
-
|
|
616
|
-
ifc.ifc_len = bufsize;
|
|
617
|
-
ifc.ifc_buf = (char*)malloc(bufsize);
|
|
618
|
-
|
|
619
|
-
int rs = ioctl(fd, cmd, &ifc);
|
|
620
|
-
if(rs == SOCKET_ERROR)
|
|
621
|
-
{
|
|
622
|
-
free(ifc.ifc_buf);
|
|
623
|
-
ifc.ifc_buf = 0;
|
|
624
|
-
break;
|
|
625
|
-
}
|
|
626
|
-
else if(ifc.ifc_len == old_ifc_len)
|
|
627
|
-
{
|
|
628
|
-
//
|
|
629
|
-
// Returned same length twice in a row, finished.
|
|
630
|
-
//
|
|
631
|
-
break;
|
|
632
|
-
}
|
|
633
|
-
else
|
|
634
|
-
{
|
|
635
|
-
old_ifc_len = ifc.ifc_len;
|
|
636
|
-
}
|
|
637
|
-
numaddrs += 10;
|
|
638
|
-
free(ifc.ifc_buf);
|
|
351
|
+
index = static_cast<int>(if_nametoindex(name.c_str()));
|
|
639
352
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
if(ifc.ifc_buf)
|
|
353
|
+
if (index <= 0)
|
|
643
354
|
{
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
for(int i = 0; i < numaddrs; ++i)
|
|
647
|
-
{
|
|
648
|
-
if(ifr[i].ifr_addr.sa_family == AF_INET6)
|
|
649
|
-
{
|
|
650
|
-
struct sockaddr_in6* ipv6Addr = reinterpret_cast<struct sockaddr_in6*>(&ifr[i].ifr_addr);
|
|
651
|
-
if(memcmp(&addr, &ipv6Addr->sin6_addr, sizeof(in6_addr)) == 0)
|
|
652
|
-
{
|
|
653
|
-
index = static_cast<int>(if_nametoindex(ifr[i].ifr_name));
|
|
654
|
-
break;
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
free(ifc.ifc_buf);
|
|
355
|
+
// index == 0 if if_nametoindex returned 0, < 0 if name wasn't found
|
|
356
|
+
throw Ice::SocketException(__FILE__, __LINE__, index == 0 ? getSocketErrno() : ENXIO);
|
|
659
357
|
}
|
|
660
|
-
# endif
|
|
661
|
-
}
|
|
662
|
-
else // Look for an interface with the given name.
|
|
663
|
-
{
|
|
664
|
-
index = static_cast<int>(if_nametoindex(name.c_str()));
|
|
665
|
-
}
|
|
666
|
-
if(index <= 0)
|
|
667
|
-
{
|
|
668
|
-
// index == 0 if if_nametoindex returned 0, < 0 if name wasn't found
|
|
669
|
-
throw Ice::SocketException(__FILE__, __LINE__, index == 0 ? getSocketErrno() : ENXIO);
|
|
670
|
-
}
|
|
671
358
|
#endif
|
|
672
359
|
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
struct in_addr
|
|
677
|
-
getInterfaceAddress(const string& name)
|
|
678
|
-
{
|
|
679
|
-
struct in_addr addr;
|
|
680
|
-
addr.s_addr = INADDR_ANY;
|
|
681
|
-
if(name.empty())
|
|
682
|
-
{
|
|
683
|
-
return addr;
|
|
360
|
+
return index;
|
|
684
361
|
}
|
|
685
362
|
|
|
686
|
-
|
|
363
|
+
struct in_addr getInterfaceAddress(const string& name)
|
|
687
364
|
{
|
|
688
|
-
|
|
689
|
-
|
|
365
|
+
struct in_addr addr;
|
|
366
|
+
addr.s_addr = INADDR_ANY;
|
|
367
|
+
if (name.empty())
|
|
368
|
+
{
|
|
369
|
+
return addr;
|
|
370
|
+
}
|
|
690
371
|
|
|
691
|
-
|
|
692
|
-
IP_ADAPTER_ADDRESSES addrs;
|
|
693
|
-
ULONG buflen = 0;
|
|
694
|
-
if(::GetAdaptersAddresses(AF_INET, 0, 0, &addrs, &buflen) == ERROR_BUFFER_OVERFLOW)
|
|
695
|
-
{
|
|
696
|
-
PIP_ADAPTER_ADDRESSES paddrs;
|
|
697
|
-
char* buf = new char[buflen];
|
|
698
|
-
paddrs = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(buf);
|
|
699
|
-
if(::GetAdaptersAddresses(AF_INET, 0, 0, paddrs, &buflen) == NO_ERROR)
|
|
372
|
+
if (inet_pton(AF_INET, name.c_str(), &addr) > 0)
|
|
700
373
|
{
|
|
701
|
-
|
|
374
|
+
return addr;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
#ifdef _WIN32
|
|
378
|
+
IP_ADAPTER_ADDRESSES addrs;
|
|
379
|
+
ULONG buflen = 0;
|
|
380
|
+
if (::GetAdaptersAddresses(AF_INET, 0, 0, &addrs, &buflen) == ERROR_BUFFER_OVERFLOW)
|
|
381
|
+
{
|
|
382
|
+
PIP_ADAPTER_ADDRESSES paddrs;
|
|
383
|
+
char* buf = new char[buflen];
|
|
384
|
+
paddrs = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(buf);
|
|
385
|
+
if (::GetAdaptersAddresses(AF_INET, 0, 0, paddrs, &buflen) == NO_ERROR)
|
|
702
386
|
{
|
|
703
|
-
|
|
704
|
-
// Don't need to pass a wide string converter as the wide string come
|
|
705
|
-
// from Windows API.
|
|
706
|
-
//
|
|
707
|
-
if(wstringToString(paddrs->FriendlyName, getProcessStringConverter()) == name)
|
|
387
|
+
while (paddrs)
|
|
708
388
|
{
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
389
|
+
//
|
|
390
|
+
// Don't need to pass a wide string converter as the wide string come
|
|
391
|
+
// from Windows API.
|
|
392
|
+
//
|
|
393
|
+
if (wstringToString(paddrs->FriendlyName, getProcessStringConverter()) == name)
|
|
394
|
+
{
|
|
395
|
+
struct sockaddr_in addrin;
|
|
396
|
+
memcpy(
|
|
397
|
+
&addrin,
|
|
398
|
+
paddrs->FirstUnicastAddress->Address.lpSockaddr,
|
|
399
|
+
paddrs->FirstUnicastAddress->Address.iSockaddrLength);
|
|
400
|
+
delete[] buf;
|
|
401
|
+
return addrin.sin_addr;
|
|
402
|
+
}
|
|
403
|
+
paddrs = paddrs->Next;
|
|
714
404
|
}
|
|
715
|
-
paddrs = paddrs->Next;
|
|
716
405
|
}
|
|
406
|
+
delete[] buf;
|
|
717
407
|
}
|
|
718
|
-
|
|
719
|
-
}
|
|
720
|
-
throw Ice::SocketException(__FILE__, __LINE__, WSAEINVAL);
|
|
408
|
+
throw Ice::SocketException(__FILE__, __LINE__, WSAEINVAL);
|
|
721
409
|
#else
|
|
722
|
-
|
|
723
|
-
|
|
410
|
+
ifreq if_address;
|
|
411
|
+
strncpy(if_address.ifr_name, name.c_str(), IFNAMSIZ - 1);
|
|
412
|
+
if_address.ifr_name[IFNAMSIZ - 1] = '\0';
|
|
724
413
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
414
|
+
SOCKET fd = createSocketImpl(false, AF_INET);
|
|
415
|
+
int rc = ioctl(fd, SIOCGIFADDR, &if_address);
|
|
416
|
+
closeSocketNoThrow(fd);
|
|
417
|
+
if (rc == SOCKET_ERROR)
|
|
418
|
+
{
|
|
419
|
+
throw Ice::SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
420
|
+
}
|
|
421
|
+
return reinterpret_cast<struct sockaddr_in*>(&if_address.ifr_addr)->sin_addr;
|
|
733
422
|
#endif
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
int
|
|
737
|
-
getAddressStorageSize(const Address& addr)
|
|
738
|
-
{
|
|
739
|
-
int size = 0;
|
|
740
|
-
if(addr.saStorage.ss_family == AF_INET)
|
|
741
|
-
{
|
|
742
|
-
size = sizeof(sockaddr_in);
|
|
743
423
|
}
|
|
744
|
-
|
|
424
|
+
|
|
425
|
+
int getAddressStorageSize(const Address& addr)
|
|
745
426
|
{
|
|
746
|
-
size =
|
|
427
|
+
int size = 0;
|
|
428
|
+
if (addr.saStorage.ss_family == AF_INET)
|
|
429
|
+
{
|
|
430
|
+
size = sizeof(sockaddr_in);
|
|
431
|
+
}
|
|
432
|
+
else if (addr.saStorage.ss_family == AF_INET6)
|
|
433
|
+
{
|
|
434
|
+
size = sizeof(sockaddr_in6);
|
|
435
|
+
}
|
|
436
|
+
return size;
|
|
747
437
|
}
|
|
748
|
-
return size;
|
|
749
|
-
}
|
|
750
438
|
|
|
751
|
-
vector<Address>
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
vector<Address> result;
|
|
439
|
+
vector<Address> getLoopbackAddresses(ProtocolSupport protocol, int port = 0)
|
|
440
|
+
{
|
|
441
|
+
vector<Address> result;
|
|
755
442
|
|
|
756
|
-
|
|
757
|
-
|
|
443
|
+
Address addr;
|
|
444
|
+
memset(&addr.saStorage, 0, sizeof(sockaddr_storage));
|
|
758
445
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
446
|
+
//
|
|
447
|
+
// We don't use getaddrinfo when host is empty as it's not portable (some old Linux
|
|
448
|
+
// versions don't support it).
|
|
449
|
+
//
|
|
450
|
+
if (protocol != EnableIPv4)
|
|
451
|
+
{
|
|
452
|
+
addr.saIn6.sin6_family = AF_INET6;
|
|
453
|
+
addr.saIn6.sin6_port = htons(port);
|
|
454
|
+
addr.saIn6.sin6_addr = in6addr_loopback;
|
|
455
|
+
result.push_back(addr);
|
|
456
|
+
}
|
|
457
|
+
if (protocol != EnableIPv6)
|
|
458
|
+
{
|
|
459
|
+
addr.saIn.sin_family = AF_INET;
|
|
460
|
+
addr.saIn.sin_port = htons(port);
|
|
461
|
+
addr.saIn.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
|
462
|
+
result.push_back(addr);
|
|
463
|
+
}
|
|
464
|
+
return result;
|
|
776
465
|
}
|
|
777
|
-
return result;
|
|
778
466
|
}
|
|
779
467
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
ReadyCallback::~ReadyCallback()
|
|
783
|
-
{
|
|
784
|
-
// Out of line to avoid weak vtable
|
|
785
|
-
}
|
|
468
|
+
ReadyCallback::~ReadyCallback() = default; // Out of line to avoid weak vtable
|
|
786
469
|
|
|
787
|
-
NativeInfo::~NativeInfo()
|
|
788
|
-
{
|
|
789
|
-
// Out of line to avoid weak vtable
|
|
790
|
-
}
|
|
470
|
+
NativeInfo::~NativeInfo() = default; // Out of line to avoid weak vtable
|
|
791
471
|
|
|
792
472
|
void
|
|
793
473
|
NativeInfo::setReadyCallback(const ReadyCallbackPtr& callback)
|
|
@@ -813,7 +493,7 @@ IceInternal::NativeInfo::initialize(HANDLE handle, ULONG_PTR key)
|
|
|
813
493
|
void
|
|
814
494
|
IceInternal::NativeInfo::completed(SocketOperation operation)
|
|
815
495
|
{
|
|
816
|
-
if(!PostQueuedCompletionStatus(_handle, 0, _key, getAsyncInfo(operation)))
|
|
496
|
+
if (!PostQueuedCompletionStatus(_handle, 0, _key, getAsyncInfo(operation)))
|
|
817
497
|
{
|
|
818
498
|
throw Ice::SocketException(__FILE__, __LINE__, GetLastError());
|
|
819
499
|
}
|
|
@@ -831,7 +511,7 @@ IceInternal::NativeInfo::setNewFd(SOCKET fd)
|
|
|
831
511
|
bool
|
|
832
512
|
IceInternal::NativeInfo::newFd()
|
|
833
513
|
{
|
|
834
|
-
if(_newFd == INVALID_SOCKET)
|
|
514
|
+
if (_newFd == INVALID_SOCKET)
|
|
835
515
|
{
|
|
836
516
|
return false;
|
|
837
517
|
}
|
|
@@ -842,29 +522,18 @@ IceInternal::NativeInfo::newFd()
|
|
|
842
522
|
|
|
843
523
|
#endif
|
|
844
524
|
|
|
845
|
-
bool
|
|
846
|
-
IceInternal::noMoreFds(int error)
|
|
847
|
-
{
|
|
848
|
-
#if defined(_WIN32)
|
|
849
|
-
return error == WSAEMFILE;
|
|
850
|
-
#else
|
|
851
|
-
return error == EMFILE || error == ENFILE;
|
|
852
|
-
#endif
|
|
853
|
-
}
|
|
854
|
-
|
|
855
525
|
string
|
|
856
|
-
IceInternal::errorToStringDNS(
|
|
526
|
+
IceInternal::errorToStringDNS(ErrorCode error)
|
|
857
527
|
{
|
|
858
528
|
#if defined(_WIN32)
|
|
859
|
-
return
|
|
529
|
+
return IceInternal::errorToString(error);
|
|
860
530
|
#else
|
|
861
531
|
return gai_strerror(error);
|
|
862
532
|
#endif
|
|
863
533
|
}
|
|
864
534
|
|
|
865
535
|
vector<Address>
|
|
866
|
-
IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol,
|
|
867
|
-
bool preferIPv6, bool canBlock)
|
|
536
|
+
IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol, bool preferIPv6, bool canBlock)
|
|
868
537
|
{
|
|
869
538
|
vector<Address> result;
|
|
870
539
|
|
|
@@ -872,25 +541,25 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
|
|
|
872
541
|
// We don't use getaddrinfo when host is empty as it's not portable (some old Linux
|
|
873
542
|
// versions don't support it).
|
|
874
543
|
//
|
|
875
|
-
if(host.empty())
|
|
544
|
+
if (host.empty())
|
|
876
545
|
{
|
|
877
546
|
result = getLoopbackAddresses(protocol, port);
|
|
878
|
-
sortAddresses(result, protocol,
|
|
547
|
+
sortAddresses(result, protocol, preferIPv6);
|
|
879
548
|
return result;
|
|
880
549
|
}
|
|
881
550
|
|
|
882
551
|
Address addr;
|
|
883
552
|
memset(&addr.saStorage, 0, sizeof(sockaddr_storage));
|
|
884
553
|
|
|
885
|
-
struct addrinfo* info =
|
|
554
|
+
struct addrinfo* info = nullptr;
|
|
886
555
|
int retry = 5;
|
|
887
556
|
|
|
888
557
|
struct addrinfo hints = {};
|
|
889
|
-
if(protocol == EnableIPv4)
|
|
558
|
+
if (protocol == EnableIPv4)
|
|
890
559
|
{
|
|
891
560
|
hints.ai_family = PF_INET;
|
|
892
561
|
}
|
|
893
|
-
else if(protocol == EnableIPv6)
|
|
562
|
+
else if (protocol == EnableIPv6)
|
|
894
563
|
{
|
|
895
564
|
hints.ai_family = PF_INET6;
|
|
896
565
|
}
|
|
@@ -899,7 +568,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
|
|
|
899
568
|
hints.ai_family = PF_UNSPEC;
|
|
900
569
|
}
|
|
901
570
|
|
|
902
|
-
if(!canBlock)
|
|
571
|
+
if (!canBlock)
|
|
903
572
|
{
|
|
904
573
|
hints.ai_flags = AI_NUMERICHOST;
|
|
905
574
|
}
|
|
@@ -907,49 +576,48 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
|
|
|
907
576
|
int rs = 0;
|
|
908
577
|
do
|
|
909
578
|
{
|
|
910
|
-
rs = getaddrinfo(host.c_str(),
|
|
911
|
-
}
|
|
912
|
-
while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
|
|
579
|
+
rs = getaddrinfo(host.c_str(), nullptr, &hints, &info);
|
|
580
|
+
} while (info == nullptr && rs == EAI_AGAIN && --retry >= 0);
|
|
913
581
|
|
|
914
582
|
// In theory, getaddrinfo should only return EAI_NONAME if
|
|
915
583
|
// AI_NUMERICHOST is specified and the host name is not a IP
|
|
916
584
|
// address. However on some platforms (e.g. macOS 10.4.x)
|
|
917
585
|
// EAI_NODATA is also returned so we also check for it.
|
|
918
586
|
#ifdef EAI_NODATA
|
|
919
|
-
if(!canBlock && (rs == EAI_NONAME || rs == EAI_NODATA))
|
|
587
|
+
if (!canBlock && (rs == EAI_NONAME || rs == EAI_NODATA))
|
|
920
588
|
#else
|
|
921
|
-
if(!canBlock && rs == EAI_NONAME)
|
|
589
|
+
if (!canBlock && rs == EAI_NONAME)
|
|
922
590
|
#endif
|
|
923
591
|
{
|
|
924
592
|
return result; // Empty result indicates that a canBlock lookup is necessary.
|
|
925
593
|
}
|
|
926
|
-
else if(rs != 0)
|
|
594
|
+
else if (rs != 0)
|
|
927
595
|
{
|
|
928
596
|
throw DNSException(__FILE__, __LINE__, rs, host);
|
|
929
597
|
}
|
|
930
598
|
|
|
931
|
-
for(struct addrinfo* p = info; p !=
|
|
599
|
+
for (struct addrinfo* p = info; p != nullptr; p = p->ai_next)
|
|
932
600
|
{
|
|
933
601
|
memcpy(&addr.saStorage, p->ai_addr, p->ai_addrlen);
|
|
934
|
-
if(p->ai_family == PF_INET)
|
|
602
|
+
if (p->ai_family == PF_INET)
|
|
935
603
|
{
|
|
936
604
|
addr.saIn.sin_port = htons(port);
|
|
937
605
|
}
|
|
938
|
-
else if(p->ai_family == PF_INET6)
|
|
606
|
+
else if (p->ai_family == PF_INET6)
|
|
939
607
|
{
|
|
940
608
|
addr.saIn6.sin6_port = htons(port);
|
|
941
609
|
}
|
|
942
610
|
|
|
943
611
|
bool found = false;
|
|
944
|
-
for(
|
|
612
|
+
for (const auto& i : result)
|
|
945
613
|
{
|
|
946
|
-
if(compareAddress(
|
|
614
|
+
if (compareAddress(i, addr) == 0)
|
|
947
615
|
{
|
|
948
616
|
found = true;
|
|
949
617
|
break;
|
|
950
618
|
}
|
|
951
619
|
}
|
|
952
|
-
if(!found)
|
|
620
|
+
if (!found)
|
|
953
621
|
{
|
|
954
622
|
result.push_back(addr);
|
|
955
623
|
}
|
|
@@ -957,11 +625,11 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol
|
|
|
957
625
|
|
|
958
626
|
freeaddrinfo(info);
|
|
959
627
|
|
|
960
|
-
if(result.empty())
|
|
628
|
+
if (result.empty())
|
|
961
629
|
{
|
|
962
630
|
throw DNSException(__FILE__, __LINE__, 0, host);
|
|
963
631
|
}
|
|
964
|
-
sortAddresses(result, protocol,
|
|
632
|
+
sortAddresses(result, protocol, preferIPv6);
|
|
965
633
|
return result;
|
|
966
634
|
}
|
|
967
635
|
|
|
@@ -978,11 +646,11 @@ IceInternal::getAddressForServer(const string& host, int port, ProtocolSupport p
|
|
|
978
646
|
// We don't use getaddrinfo when host is empty as it's not portable (some old Linux
|
|
979
647
|
// versions don't support it).
|
|
980
648
|
//
|
|
981
|
-
if(host.empty())
|
|
649
|
+
if (host.empty())
|
|
982
650
|
{
|
|
983
651
|
Address addr;
|
|
984
652
|
memset(&addr.saStorage, 0, sizeof(sockaddr_storage));
|
|
985
|
-
if(protocol != EnableIPv4)
|
|
653
|
+
if (protocol != EnableIPv4)
|
|
986
654
|
{
|
|
987
655
|
addr.saIn6.sin6_family = AF_INET6;
|
|
988
656
|
addr.saIn6.sin6_port = htons(port);
|
|
@@ -996,60 +664,59 @@ IceInternal::getAddressForServer(const string& host, int port, ProtocolSupport p
|
|
|
996
664
|
}
|
|
997
665
|
return addr;
|
|
998
666
|
}
|
|
999
|
-
vector<Address> addrs = getAddresses(host, port, protocol,
|
|
1000
|
-
preferIPv6, canBlock);
|
|
667
|
+
vector<Address> addrs = getAddresses(host, port, protocol, preferIPv6, canBlock);
|
|
1001
668
|
return addrs.empty() ? Address() : addrs[0];
|
|
1002
669
|
}
|
|
1003
670
|
|
|
1004
671
|
int
|
|
1005
672
|
IceInternal::compareAddress(const Address& addr1, const Address& addr2)
|
|
1006
673
|
{
|
|
1007
|
-
if(addr1.saStorage.ss_family < addr2.saStorage.ss_family)
|
|
674
|
+
if (addr1.saStorage.ss_family < addr2.saStorage.ss_family)
|
|
1008
675
|
{
|
|
1009
676
|
return -1;
|
|
1010
677
|
}
|
|
1011
|
-
else if(addr2.saStorage.ss_family < addr1.saStorage.ss_family)
|
|
678
|
+
else if (addr2.saStorage.ss_family < addr1.saStorage.ss_family)
|
|
1012
679
|
{
|
|
1013
680
|
return 1;
|
|
1014
681
|
}
|
|
1015
682
|
|
|
1016
|
-
if(addr1.saStorage.ss_family == AF_INET)
|
|
683
|
+
if (addr1.saStorage.ss_family == AF_INET)
|
|
1017
684
|
{
|
|
1018
|
-
if(addr1.saIn.sin_port < addr2.saIn.sin_port)
|
|
685
|
+
if (addr1.saIn.sin_port < addr2.saIn.sin_port)
|
|
1019
686
|
{
|
|
1020
687
|
return -1;
|
|
1021
688
|
}
|
|
1022
|
-
else if(addr2.saIn.sin_port < addr1.saIn.sin_port)
|
|
689
|
+
else if (addr2.saIn.sin_port < addr1.saIn.sin_port)
|
|
1023
690
|
{
|
|
1024
691
|
return 1;
|
|
1025
692
|
}
|
|
1026
693
|
|
|
1027
|
-
if(addr1.saIn.sin_addr.s_addr < addr2.saIn.sin_addr.s_addr)
|
|
694
|
+
if (addr1.saIn.sin_addr.s_addr < addr2.saIn.sin_addr.s_addr)
|
|
1028
695
|
{
|
|
1029
696
|
return -1;
|
|
1030
697
|
}
|
|
1031
|
-
else if(addr2.saIn.sin_addr.s_addr < addr1.saIn.sin_addr.s_addr)
|
|
698
|
+
else if (addr2.saIn.sin_addr.s_addr < addr1.saIn.sin_addr.s_addr)
|
|
1032
699
|
{
|
|
1033
700
|
return 1;
|
|
1034
701
|
}
|
|
1035
702
|
}
|
|
1036
703
|
else
|
|
1037
704
|
{
|
|
1038
|
-
if(addr1.saIn6.sin6_port < addr2.saIn6.sin6_port)
|
|
705
|
+
if (addr1.saIn6.sin6_port < addr2.saIn6.sin6_port)
|
|
1039
706
|
{
|
|
1040
707
|
return -1;
|
|
1041
708
|
}
|
|
1042
|
-
else if(addr2.saIn6.sin6_port < addr1.saIn6.sin6_port)
|
|
709
|
+
else if (addr2.saIn6.sin6_port < addr1.saIn6.sin6_port)
|
|
1043
710
|
{
|
|
1044
711
|
return 1;
|
|
1045
712
|
}
|
|
1046
713
|
|
|
1047
714
|
int res = memcmp(&addr1.saIn6.sin6_addr, &addr2.saIn6.sin6_addr, sizeof(in6_addr));
|
|
1048
|
-
if(res < 0)
|
|
715
|
+
if (res < 0)
|
|
1049
716
|
{
|
|
1050
717
|
return -1;
|
|
1051
718
|
}
|
|
1052
|
-
else if(res > 0)
|
|
719
|
+
else if (res > 0)
|
|
1053
720
|
{
|
|
1054
721
|
return 1;
|
|
1055
722
|
}
|
|
@@ -1062,7 +729,7 @@ bool
|
|
|
1062
729
|
IceInternal::isIPv6Supported()
|
|
1063
730
|
{
|
|
1064
731
|
SOCKET fd = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
|
|
1065
|
-
if(fd == INVALID_SOCKET)
|
|
732
|
+
if (fd == INVALID_SOCKET)
|
|
1066
733
|
{
|
|
1067
734
|
return false;
|
|
1068
735
|
}
|
|
@@ -1074,21 +741,18 @@ IceInternal::isIPv6Supported()
|
|
|
1074
741
|
}
|
|
1075
742
|
|
|
1076
743
|
SOCKET
|
|
1077
|
-
IceInternal::createSocket(bool udp, const Address& addr)
|
|
1078
|
-
{
|
|
1079
|
-
return createSocketImpl(udp, addr.saStorage.ss_family);
|
|
1080
|
-
}
|
|
744
|
+
IceInternal::createSocket(bool udp, const Address& addr) { return createSocketImpl(udp, addr.saStorage.ss_family); }
|
|
1081
745
|
SOCKET
|
|
1082
746
|
IceInternal::createServerSocket(bool udp, const Address& addr, ProtocolSupport protocol)
|
|
1083
747
|
{
|
|
1084
748
|
SOCKET fd = createSocket(udp, addr);
|
|
1085
|
-
if(addr.saStorage.ss_family == AF_INET6 && protocol != EnableIPv4)
|
|
749
|
+
if (addr.saStorage.ss_family == AF_INET6 && protocol != EnableIPv4)
|
|
1086
750
|
{
|
|
1087
751
|
int flag = protocol == EnableIPv6 ? 1 : 0;
|
|
1088
|
-
if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast<char*>(&flag), int(sizeof(int))) == SOCKET_ERROR)
|
|
752
|
+
if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast<char*>(&flag), int(sizeof(int))) == SOCKET_ERROR)
|
|
1089
753
|
{
|
|
1090
754
|
#ifdef _WIN32
|
|
1091
|
-
if(getSocketErrno() == WSAENOPROTOOPT)
|
|
755
|
+
if (getSocketErrno() == WSAENOPROTOOPT)
|
|
1092
756
|
{
|
|
1093
757
|
return fd; // Windows XP doesn't support IPV6_V6ONLY
|
|
1094
758
|
}
|
|
@@ -1119,7 +783,7 @@ IceInternal::closeSocket(SOCKET fd)
|
|
|
1119
783
|
{
|
|
1120
784
|
#if defined(_WIN32)
|
|
1121
785
|
int error = WSAGetLastError();
|
|
1122
|
-
if(closesocket(fd) == SOCKET_ERROR)
|
|
786
|
+
if (closesocket(fd) == SOCKET_ERROR)
|
|
1123
787
|
{
|
|
1124
788
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
1125
789
|
}
|
|
@@ -1127,16 +791,16 @@ IceInternal::closeSocket(SOCKET fd)
|
|
|
1127
791
|
#else
|
|
1128
792
|
int error = errno;
|
|
1129
793
|
|
|
1130
|
-
#
|
|
794
|
+
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
|
1131
795
|
//
|
|
1132
796
|
// FreeBSD returns ECONNRESET if the underlying object was
|
|
1133
797
|
// a stream socket that was shut down by the peer before all
|
|
1134
798
|
// pending data was delivered.
|
|
1135
799
|
//
|
|
1136
|
-
if(close(fd) == SOCKET_ERROR && getSocketErrno() != ECONNRESET)
|
|
1137
|
-
#
|
|
1138
|
-
if(close(fd) == SOCKET_ERROR)
|
|
1139
|
-
#
|
|
800
|
+
if (close(fd) == SOCKET_ERROR && getSocketErrno() != ECONNRESET)
|
|
801
|
+
# else
|
|
802
|
+
if (close(fd) == SOCKET_ERROR)
|
|
803
|
+
# endif
|
|
1140
804
|
{
|
|
1141
805
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
1142
806
|
}
|
|
@@ -1147,16 +811,23 @@ IceInternal::closeSocket(SOCKET fd)
|
|
|
1147
811
|
string
|
|
1148
812
|
IceInternal::addrToString(const Address& addr)
|
|
1149
813
|
{
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
814
|
+
if (isAddressValid(addr))
|
|
815
|
+
{
|
|
816
|
+
ostringstream s;
|
|
817
|
+
s << inetAddrToString(addr) << ':' << getPort(addr);
|
|
818
|
+
return s.str();
|
|
819
|
+
}
|
|
820
|
+
else
|
|
821
|
+
{
|
|
822
|
+
return "";
|
|
823
|
+
}
|
|
1153
824
|
}
|
|
1154
825
|
|
|
1155
826
|
void
|
|
1156
827
|
IceInternal::fdToLocalAddress(SOCKET fd, Address& addr)
|
|
1157
828
|
{
|
|
1158
|
-
|
|
1159
|
-
if(getsockname(fd, &addr.sa, &len) == SOCKET_ERROR)
|
|
829
|
+
auto len = static_cast<socklen_t>(sizeof(sockaddr_storage));
|
|
830
|
+
if (getsockname(fd, &addr.sa, &len) == SOCKET_ERROR)
|
|
1160
831
|
{
|
|
1161
832
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
1162
833
|
}
|
|
@@ -1165,10 +836,10 @@ IceInternal::fdToLocalAddress(SOCKET fd, Address& addr)
|
|
|
1165
836
|
bool
|
|
1166
837
|
IceInternal::fdToRemoteAddress(SOCKET fd, Address& addr)
|
|
1167
838
|
{
|
|
1168
|
-
|
|
1169
|
-
if(getpeername(fd, &addr.sa, &len) == SOCKET_ERROR)
|
|
839
|
+
auto len = static_cast<socklen_t>(sizeof(sockaddr_storage));
|
|
840
|
+
if (getpeername(fd, &addr.sa, &len) == SOCKET_ERROR)
|
|
1170
841
|
{
|
|
1171
|
-
if(notConnected())
|
|
842
|
+
if (notConnected())
|
|
1172
843
|
{
|
|
1173
844
|
return false;
|
|
1174
845
|
}
|
|
@@ -1183,7 +854,7 @@ IceInternal::fdToRemoteAddress(SOCKET fd, Address& addr)
|
|
|
1183
854
|
std::string
|
|
1184
855
|
IceInternal::fdToString(SOCKET fd, const NetworkProxyPtr& proxy, const Address& target)
|
|
1185
856
|
{
|
|
1186
|
-
if(fd == INVALID_SOCKET)
|
|
857
|
+
if (fd == INVALID_SOCKET)
|
|
1187
858
|
{
|
|
1188
859
|
return "<closed>";
|
|
1189
860
|
}
|
|
@@ -1194,7 +865,7 @@ IceInternal::fdToString(SOCKET fd, const NetworkProxyPtr& proxy, const Address&
|
|
|
1194
865
|
bool peerConnected = fdToRemoteAddress(fd, remoteAddr);
|
|
1195
866
|
|
|
1196
867
|
#ifdef _WIN32
|
|
1197
|
-
if(!peerConnected)
|
|
868
|
+
if (!peerConnected)
|
|
1198
869
|
{
|
|
1199
870
|
//
|
|
1200
871
|
// The local address is only accessible with connected sockets on Windows.
|
|
@@ -1209,9 +880,9 @@ IceInternal::fdToString(SOCKET fd, const NetworkProxyPtr& proxy, const Address&
|
|
|
1209
880
|
s << "local address = " << addrToString(localAddr);
|
|
1210
881
|
}
|
|
1211
882
|
|
|
1212
|
-
if(proxy)
|
|
883
|
+
if (proxy)
|
|
1213
884
|
{
|
|
1214
|
-
if(!peerConnected)
|
|
885
|
+
if (!peerConnected)
|
|
1215
886
|
{
|
|
1216
887
|
remoteAddr = proxy->getAddress();
|
|
1217
888
|
}
|
|
@@ -1220,7 +891,7 @@ IceInternal::fdToString(SOCKET fd, const NetworkProxyPtr& proxy, const Address&
|
|
|
1220
891
|
}
|
|
1221
892
|
else
|
|
1222
893
|
{
|
|
1223
|
-
if(!peerConnected)
|
|
894
|
+
if (!peerConnected)
|
|
1224
895
|
{
|
|
1225
896
|
remoteAddr = target;
|
|
1226
897
|
}
|
|
@@ -1233,7 +904,7 @@ IceInternal::fdToString(SOCKET fd, const NetworkProxyPtr& proxy, const Address&
|
|
|
1233
904
|
std::string
|
|
1234
905
|
IceInternal::fdToString(SOCKET fd)
|
|
1235
906
|
{
|
|
1236
|
-
if(fd == INVALID_SOCKET)
|
|
907
|
+
if (fd == INVALID_SOCKET)
|
|
1237
908
|
{
|
|
1238
909
|
return "<closed>";
|
|
1239
910
|
}
|
|
@@ -1250,7 +921,7 @@ IceInternal::fdToString(SOCKET fd)
|
|
|
1250
921
|
void
|
|
1251
922
|
IceInternal::fdToAddressAndPort(SOCKET fd, string& localAddress, int& localPort, string& remoteAddress, int& remotePort)
|
|
1252
923
|
{
|
|
1253
|
-
if(fd == INVALID_SOCKET)
|
|
924
|
+
if (fd == INVALID_SOCKET)
|
|
1254
925
|
{
|
|
1255
926
|
localAddress.clear();
|
|
1256
927
|
remoteAddress.clear();
|
|
@@ -1264,7 +935,7 @@ IceInternal::fdToAddressAndPort(SOCKET fd, string& localAddress, int& localPort,
|
|
|
1264
935
|
addrToAddressAndPort(localAddr, localAddress, localPort);
|
|
1265
936
|
|
|
1266
937
|
Address remoteAddr;
|
|
1267
|
-
if(fdToRemoteAddress(fd, remoteAddr))
|
|
938
|
+
if (fdToRemoteAddress(fd, remoteAddr))
|
|
1268
939
|
{
|
|
1269
940
|
addrToAddressAndPort(remoteAddr, remoteAddress, remotePort);
|
|
1270
941
|
}
|
|
@@ -1287,7 +958,7 @@ IceInternal::addressesToString(const Address& localAddr, const Address& remoteAd
|
|
|
1287
958
|
{
|
|
1288
959
|
ostringstream s;
|
|
1289
960
|
s << "local address = " << addrToString(localAddr);
|
|
1290
|
-
if(peerConnected)
|
|
961
|
+
if (peerConnected)
|
|
1291
962
|
{
|
|
1292
963
|
s << "\nremote address = " << addrToString(remoteAddr);
|
|
1293
964
|
}
|
|
@@ -1305,82 +976,61 @@ IceInternal::isAddressValid(const Address& addr)
|
|
|
1305
976
|
}
|
|
1306
977
|
|
|
1307
978
|
vector<string>
|
|
1308
|
-
IceInternal::
|
|
979
|
+
IceInternal::getInterfacesForMulticast(const string& intf, ProtocolSupport protocolSupport)
|
|
1309
980
|
{
|
|
1310
|
-
vector<string> hosts;
|
|
1311
981
|
bool ipv4Wildcard = false;
|
|
1312
|
-
if(isWildcard(
|
|
982
|
+
if (isWildcard(intf, protocolSupport, ipv4Wildcard))
|
|
1313
983
|
{
|
|
1314
|
-
vector<
|
|
1315
|
-
|
|
984
|
+
vector<string> interfaces;
|
|
985
|
+
vector<Address> addrs = getLocalAddresses(ipv4Wildcard ? EnableIPv4 : protocolSupport);
|
|
986
|
+
for (const auto& addr : addrs)
|
|
1316
987
|
{
|
|
1317
|
-
|
|
1318
|
-
//
|
|
1319
|
-
|
|
1320
|
-
// will not work without extra configuration.
|
|
1321
|
-
//
|
|
1322
|
-
if(!isLinklocal(*p))
|
|
988
|
+
string addrStr = inetAddrToString(addr);
|
|
989
|
+
// Suppress duplicates.
|
|
990
|
+
if (find(interfaces.begin(), interfaces.end(), addrStr) == interfaces.end())
|
|
1323
991
|
{
|
|
1324
|
-
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
if(hosts.empty())
|
|
1328
|
-
{
|
|
1329
|
-
// Return loopback if no other local addresses are available.
|
|
1330
|
-
addrs = getLoopbackAddresses(protocolSupport);
|
|
1331
|
-
for(vector<Address>::const_iterator p = addrs.begin(); p != addrs.end(); ++p)
|
|
1332
|
-
{
|
|
1333
|
-
hosts.push_back(inetAddrToString(*p));
|
|
992
|
+
interfaces.push_back(addrStr);
|
|
1334
993
|
}
|
|
1335
994
|
}
|
|
995
|
+
return interfaces;
|
|
1336
996
|
}
|
|
1337
|
-
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
vector<string>
|
|
1341
|
-
IceInternal::getInterfacesForMulticast(const string& intf, ProtocolSupport protocolSupport)
|
|
1342
|
-
{
|
|
1343
|
-
vector<string> interfaces;
|
|
1344
|
-
bool ipv4Wildcard = false;
|
|
1345
|
-
if(isWildcard(intf, protocolSupport, ipv4Wildcard))
|
|
1346
|
-
{
|
|
1347
|
-
vector<Address> addrs = getLocalAddresses(ipv4Wildcard ? EnableIPv4 : protocolSupport, true, true);
|
|
1348
|
-
for(vector<Address>::const_iterator p = addrs.begin(); p != addrs.end(); ++p)
|
|
1349
|
-
{
|
|
1350
|
-
interfaces.push_back(inetAddrToString(*p)); // We keep link local addresses for multicast
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
if(interfaces.empty())
|
|
997
|
+
else
|
|
1354
998
|
{
|
|
1355
|
-
|
|
999
|
+
// If the interface is not a wildcard, we just return it as is.
|
|
1000
|
+
return vector<string>{intf};
|
|
1356
1001
|
}
|
|
1357
|
-
return interfaces;
|
|
1358
1002
|
}
|
|
1359
1003
|
|
|
1360
1004
|
string
|
|
1361
1005
|
IceInternal::inetAddrToString(const Address& ss)
|
|
1362
1006
|
{
|
|
1363
1007
|
int size = getAddressStorageSize(ss);
|
|
1364
|
-
if(size == 0)
|
|
1008
|
+
if (size == 0)
|
|
1365
1009
|
{
|
|
1366
1010
|
return "";
|
|
1367
1011
|
}
|
|
1368
1012
|
|
|
1369
1013
|
char namebuf[1024];
|
|
1370
1014
|
namebuf[0] = '\0';
|
|
1371
|
-
getnameinfo(
|
|
1372
|
-
|
|
1373
|
-
|
|
1015
|
+
getnameinfo(
|
|
1016
|
+
&ss.sa,
|
|
1017
|
+
static_cast<socklen_t>(size),
|
|
1018
|
+
namebuf,
|
|
1019
|
+
static_cast<socklen_t>(sizeof(namebuf)),
|
|
1020
|
+
nullptr,
|
|
1021
|
+
0,
|
|
1022
|
+
NI_NUMERICHOST);
|
|
1023
|
+
return {namebuf};
|
|
1374
1024
|
}
|
|
1375
1025
|
|
|
1376
1026
|
int
|
|
1377
1027
|
IceInternal::getPort(const Address& addr)
|
|
1378
1028
|
{
|
|
1379
|
-
if(addr.saStorage.ss_family == AF_INET)
|
|
1029
|
+
if (addr.saStorage.ss_family == AF_INET)
|
|
1380
1030
|
{
|
|
1381
1031
|
return ntohs(addr.saIn.sin_port);
|
|
1382
1032
|
}
|
|
1383
|
-
else if(addr.saStorage.ss_family == AF_INET6)
|
|
1033
|
+
else if (addr.saStorage.ss_family == AF_INET6)
|
|
1384
1034
|
{
|
|
1385
1035
|
return ntohs(addr.saIn6.sin6_port);
|
|
1386
1036
|
}
|
|
@@ -1393,7 +1043,7 @@ IceInternal::getPort(const Address& addr)
|
|
|
1393
1043
|
void
|
|
1394
1044
|
IceInternal::setPort(Address& addr, int port)
|
|
1395
1045
|
{
|
|
1396
|
-
if(addr.saStorage.ss_family == AF_INET)
|
|
1046
|
+
if (addr.saStorage.ss_family == AF_INET)
|
|
1397
1047
|
{
|
|
1398
1048
|
addr.saIn.sin_port = htons(port);
|
|
1399
1049
|
}
|
|
@@ -1407,11 +1057,11 @@ IceInternal::setPort(Address& addr, int port)
|
|
|
1407
1057
|
bool
|
|
1408
1058
|
IceInternal::isMulticast(const Address& addr)
|
|
1409
1059
|
{
|
|
1410
|
-
if(addr.saStorage.ss_family == AF_INET)
|
|
1060
|
+
if (addr.saStorage.ss_family == AF_INET)
|
|
1411
1061
|
{
|
|
1412
1062
|
return IN_MULTICAST(ntohl(addr.saIn.sin_addr.s_addr));
|
|
1413
1063
|
}
|
|
1414
|
-
else if(addr.saStorage.ss_family == AF_INET6)
|
|
1064
|
+
else if (addr.saStorage.ss_family == AF_INET6)
|
|
1415
1065
|
{
|
|
1416
1066
|
return IN6_IS_ADDR_MULTICAST(&addr.saIn6.sin6_addr);
|
|
1417
1067
|
}
|
|
@@ -1432,8 +1082,8 @@ IceInternal::setTcpBufSize(SOCKET fd, const ProtocolInstancePtr& instance)
|
|
|
1432
1082
|
#else
|
|
1433
1083
|
const int dfltBufSize = 0;
|
|
1434
1084
|
#endif
|
|
1435
|
-
|
|
1436
|
-
|
|
1085
|
+
int32_t rcvSize = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize);
|
|
1086
|
+
int32_t sndSize = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize);
|
|
1437
1087
|
|
|
1438
1088
|
setTcpBufSize(fd, rcvSize, sndSize, instance);
|
|
1439
1089
|
}
|
|
@@ -1443,7 +1093,7 @@ IceInternal::setTcpBufSize(SOCKET fd, int rcvSize, int sndSize, const ProtocolIn
|
|
|
1443
1093
|
{
|
|
1444
1094
|
assert(fd != INVALID_SOCKET);
|
|
1445
1095
|
|
|
1446
|
-
if(rcvSize > 0)
|
|
1096
|
+
if (rcvSize > 0)
|
|
1447
1097
|
{
|
|
1448
1098
|
//
|
|
1449
1099
|
// Try to set the buffer size. The kernel will silently adjust
|
|
@@ -1452,12 +1102,12 @@ IceInternal::setTcpBufSize(SOCKET fd, int rcvSize, int sndSize, const ProtocolIn
|
|
|
1452
1102
|
//
|
|
1453
1103
|
setRecvBufferSize(fd, rcvSize);
|
|
1454
1104
|
int size = getRecvBufferSize(fd);
|
|
1455
|
-
if(size > 0 && size < rcvSize)
|
|
1105
|
+
if (size > 0 && size < rcvSize)
|
|
1456
1106
|
{
|
|
1457
1107
|
// Warn if the size that was set is less than the requested size and
|
|
1458
1108
|
// we have not already warned.
|
|
1459
1109
|
BufSizeWarnInfo winfo = instance->getBufSizeWarn(TCPEndpointType);
|
|
1460
|
-
if(!winfo.rcvWarn || rcvSize != winfo.rcvSize)
|
|
1110
|
+
if (!winfo.rcvWarn || rcvSize != winfo.rcvSize)
|
|
1461
1111
|
{
|
|
1462
1112
|
Ice::Warning out(instance->logger());
|
|
1463
1113
|
out << "TCP receive buffer size: requested size of " << rcvSize << " adjusted to " << size;
|
|
@@ -1466,7 +1116,7 @@ IceInternal::setTcpBufSize(SOCKET fd, int rcvSize, int sndSize, const ProtocolIn
|
|
|
1466
1116
|
}
|
|
1467
1117
|
}
|
|
1468
1118
|
|
|
1469
|
-
if(sndSize > 0)
|
|
1119
|
+
if (sndSize > 0)
|
|
1470
1120
|
{
|
|
1471
1121
|
//
|
|
1472
1122
|
// Try to set the buffer size. The kernel will silently adjust
|
|
@@ -1475,12 +1125,12 @@ IceInternal::setTcpBufSize(SOCKET fd, int rcvSize, int sndSize, const ProtocolIn
|
|
|
1475
1125
|
//
|
|
1476
1126
|
setSendBufferSize(fd, sndSize);
|
|
1477
1127
|
int size = getSendBufferSize(fd);
|
|
1478
|
-
if(size > 0 && size < sndSize)
|
|
1128
|
+
if (size > 0 && size < sndSize)
|
|
1479
1129
|
{
|
|
1480
1130
|
// Warn if the size that was set is less than the requested size and
|
|
1481
1131
|
// we have not already warned.
|
|
1482
1132
|
BufSizeWarnInfo winfo = instance->getBufSizeWarn(TCPEndpointType);
|
|
1483
|
-
if(!winfo.sndWarn || sndSize != winfo.sndSize)
|
|
1133
|
+
if (!winfo.sndWarn || sndSize != winfo.sndSize)
|
|
1484
1134
|
{
|
|
1485
1135
|
Ice::Warning out(instance->logger());
|
|
1486
1136
|
out << "TCP send buffer size: requested size of " << sndSize << " adjusted to " << size;
|
|
@@ -1494,10 +1144,10 @@ void
|
|
|
1494
1144
|
IceInternal::setBlock(SOCKET fd, bool block)
|
|
1495
1145
|
{
|
|
1496
1146
|
#ifdef _WIN32
|
|
1497
|
-
if(block)
|
|
1147
|
+
if (block)
|
|
1498
1148
|
{
|
|
1499
1149
|
unsigned long arg = 0;
|
|
1500
|
-
if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
|
|
1150
|
+
if (ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
|
|
1501
1151
|
{
|
|
1502
1152
|
closeSocketNoThrow(fd);
|
|
1503
1153
|
throw SocketException(__FILE__, __LINE__, WSAGetLastError());
|
|
@@ -1506,18 +1156,18 @@ IceInternal::setBlock(SOCKET fd, bool block)
|
|
|
1506
1156
|
else
|
|
1507
1157
|
{
|
|
1508
1158
|
unsigned long arg = 1;
|
|
1509
|
-
if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
|
|
1159
|
+
if (ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
|
|
1510
1160
|
{
|
|
1511
1161
|
closeSocketNoThrow(fd);
|
|
1512
1162
|
throw SocketException(__FILE__, __LINE__, WSAGetLastError());
|
|
1513
1163
|
}
|
|
1514
1164
|
}
|
|
1515
1165
|
#else
|
|
1516
|
-
if(block)
|
|
1166
|
+
if (block)
|
|
1517
1167
|
{
|
|
1518
1168
|
int flags = fcntl(fd, F_GETFL);
|
|
1519
1169
|
flags &= ~O_NONBLOCK;
|
|
1520
|
-
if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
|
|
1170
|
+
if (fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
|
|
1521
1171
|
{
|
|
1522
1172
|
closeSocketNoThrow(fd);
|
|
1523
1173
|
throw SocketException(__FILE__, __LINE__, errno);
|
|
@@ -1527,7 +1177,7 @@ IceInternal::setBlock(SOCKET fd, bool block)
|
|
|
1527
1177
|
{
|
|
1528
1178
|
int flags = fcntl(fd, F_GETFL);
|
|
1529
1179
|
flags |= O_NONBLOCK;
|
|
1530
|
-
if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
|
|
1180
|
+
if (fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
|
|
1531
1181
|
{
|
|
1532
1182
|
closeSocketNoThrow(fd);
|
|
1533
1183
|
throw SocketException(__FILE__, __LINE__, errno);
|
|
@@ -1539,7 +1189,7 @@ IceInternal::setBlock(SOCKET fd, bool block)
|
|
|
1539
1189
|
void
|
|
1540
1190
|
IceInternal::setSendBufferSize(SOCKET fd, int sz)
|
|
1541
1191
|
{
|
|
1542
|
-
if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&sz), int(sizeof(int))) == SOCKET_ERROR)
|
|
1192
|
+
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&sz), int(sizeof(int))) == SOCKET_ERROR)
|
|
1543
1193
|
{
|
|
1544
1194
|
closeSocketNoThrow(fd);
|
|
1545
1195
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
@@ -1551,8 +1201,8 @@ IceInternal::getSendBufferSize(SOCKET fd)
|
|
|
1551
1201
|
{
|
|
1552
1202
|
int sz;
|
|
1553
1203
|
socklen_t len = sizeof(sz);
|
|
1554
|
-
if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&sz), &len) == SOCKET_ERROR ||
|
|
1555
|
-
|
|
1204
|
+
if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&sz), &len) == SOCKET_ERROR ||
|
|
1205
|
+
static_cast<unsigned int>(len) != sizeof(sz))
|
|
1556
1206
|
{
|
|
1557
1207
|
closeSocketNoThrow(fd);
|
|
1558
1208
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
@@ -1563,7 +1213,7 @@ IceInternal::getSendBufferSize(SOCKET fd)
|
|
|
1563
1213
|
void
|
|
1564
1214
|
IceInternal::setRecvBufferSize(SOCKET fd, int sz)
|
|
1565
1215
|
{
|
|
1566
|
-
if(setsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<char*>(&sz), int(sizeof(int))) == SOCKET_ERROR)
|
|
1216
|
+
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<char*>(&sz), int(sizeof(int))) == SOCKET_ERROR)
|
|
1567
1217
|
{
|
|
1568
1218
|
closeSocketNoThrow(fd);
|
|
1569
1219
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
@@ -1575,8 +1225,8 @@ IceInternal::getRecvBufferSize(SOCKET fd)
|
|
|
1575
1225
|
{
|
|
1576
1226
|
int sz;
|
|
1577
1227
|
socklen_t len = sizeof(sz);
|
|
1578
|
-
if(getsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<char*>(&sz), &len) == SOCKET_ERROR ||
|
|
1579
|
-
|
|
1228
|
+
if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, reinterpret_cast<char*>(&sz), &len) == SOCKET_ERROR ||
|
|
1229
|
+
static_cast<unsigned int>(len) != sizeof(sz))
|
|
1580
1230
|
{
|
|
1581
1231
|
closeSocketNoThrow(fd);
|
|
1582
1232
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
@@ -1589,20 +1239,20 @@ IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string& intf)
|
|
|
1589
1239
|
{
|
|
1590
1240
|
vector<string> interfaces = getInterfacesForMulticast(intf, getProtocolSupport(group));
|
|
1591
1241
|
set<int> indexes;
|
|
1592
|
-
for(
|
|
1242
|
+
for (const auto& interface : interfaces)
|
|
1593
1243
|
{
|
|
1594
1244
|
int rc = 0;
|
|
1595
|
-
if(group.saStorage.ss_family == AF_INET)
|
|
1245
|
+
if (group.saStorage.ss_family == AF_INET)
|
|
1596
1246
|
{
|
|
1597
1247
|
struct ip_mreq mreq;
|
|
1598
1248
|
mreq.imr_multiaddr = group.saIn.sin_addr;
|
|
1599
|
-
mreq.imr_interface = getInterfaceAddress(
|
|
1249
|
+
mreq.imr_interface = getInterfaceAddress(interface);
|
|
1600
1250
|
rc = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast<char*>(&mreq), int(sizeof(mreq)));
|
|
1601
1251
|
}
|
|
1602
1252
|
else
|
|
1603
1253
|
{
|
|
1604
|
-
int index = getInterfaceIndex(
|
|
1605
|
-
if(indexes.find(index) == indexes.end()) // Don't join twice the same interface (if it has multiple IPs)
|
|
1254
|
+
int index = getInterfaceIndex(interface);
|
|
1255
|
+
if (indexes.find(index) == indexes.end()) // Don't join twice the same interface (if it has multiple IPs)
|
|
1606
1256
|
{
|
|
1607
1257
|
indexes.insert(index);
|
|
1608
1258
|
struct ipv6_mreq mreq;
|
|
@@ -1611,7 +1261,7 @@ IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string& intf)
|
|
|
1611
1261
|
rc = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, reinterpret_cast<char*>(&mreq), int(sizeof(mreq)));
|
|
1612
1262
|
}
|
|
1613
1263
|
}
|
|
1614
|
-
if(rc == SOCKET_ERROR)
|
|
1264
|
+
if (rc == SOCKET_ERROR)
|
|
1615
1265
|
{
|
|
1616
1266
|
closeSocketNoThrow(fd);
|
|
1617
1267
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
@@ -1623,7 +1273,7 @@ void
|
|
|
1623
1273
|
IceInternal::setMcastInterface(SOCKET fd, const string& intf, const Address& addr)
|
|
1624
1274
|
{
|
|
1625
1275
|
int rc;
|
|
1626
|
-
if(addr.saStorage.ss_family == AF_INET)
|
|
1276
|
+
if (addr.saStorage.ss_family == AF_INET)
|
|
1627
1277
|
{
|
|
1628
1278
|
struct in_addr iface = getInterfaceAddress(intf);
|
|
1629
1279
|
rc = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, reinterpret_cast<char*>(&iface), int(sizeof(iface)));
|
|
@@ -1633,7 +1283,7 @@ IceInternal::setMcastInterface(SOCKET fd, const string& intf, const Address& add
|
|
|
1633
1283
|
int interfaceNum = getInterfaceIndex(intf);
|
|
1634
1284
|
rc = setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, reinterpret_cast<char*>(&interfaceNum), int(sizeof(int)));
|
|
1635
1285
|
}
|
|
1636
|
-
if(rc == SOCKET_ERROR)
|
|
1286
|
+
if (rc == SOCKET_ERROR)
|
|
1637
1287
|
{
|
|
1638
1288
|
closeSocketNoThrow(fd);
|
|
1639
1289
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
@@ -1644,7 +1294,7 @@ void
|
|
|
1644
1294
|
IceInternal::setMcastTtl(SOCKET fd, int ttl, const Address& addr)
|
|
1645
1295
|
{
|
|
1646
1296
|
int rc;
|
|
1647
|
-
if(addr.saStorage.ss_family == AF_INET)
|
|
1297
|
+
if (addr.saStorage.ss_family == AF_INET)
|
|
1648
1298
|
{
|
|
1649
1299
|
rc = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, reinterpret_cast<char*>(&ttl), int(sizeof(int)));
|
|
1650
1300
|
}
|
|
@@ -1652,7 +1302,7 @@ IceInternal::setMcastTtl(SOCKET fd, int ttl, const Address& addr)
|
|
|
1652
1302
|
{
|
|
1653
1303
|
rc = setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, reinterpret_cast<char*>(&ttl), int(sizeof(int)));
|
|
1654
1304
|
}
|
|
1655
|
-
if(rc == SOCKET_ERROR)
|
|
1305
|
+
if (rc == SOCKET_ERROR)
|
|
1656
1306
|
{
|
|
1657
1307
|
closeSocketNoThrow(fd);
|
|
1658
1308
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
@@ -1663,7 +1313,7 @@ void
|
|
|
1663
1313
|
IceInternal::setReuseAddress(SOCKET fd, bool reuse)
|
|
1664
1314
|
{
|
|
1665
1315
|
int flag = reuse ? 1 : 0;
|
|
1666
|
-
if(setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&flag), int(sizeof(int))) == SOCKET_ERROR)
|
|
1316
|
+
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&flag), int(sizeof(int))) == SOCKET_ERROR)
|
|
1667
1317
|
{
|
|
1668
1318
|
closeSocketNoThrow(fd);
|
|
1669
1319
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
@@ -1676,31 +1326,26 @@ IceInternal::doBind(SOCKET fd, const Address& addr, const string&)
|
|
|
1676
1326
|
int size = getAddressStorageSize(addr);
|
|
1677
1327
|
assert(size != 0);
|
|
1678
1328
|
|
|
1679
|
-
if(::bind(fd, &addr.sa, static_cast<socklen_t>(size)) == SOCKET_ERROR)
|
|
1329
|
+
if (::bind(fd, &addr.sa, static_cast<socklen_t>(size)) == SOCKET_ERROR)
|
|
1680
1330
|
{
|
|
1681
1331
|
closeSocketNoThrow(fd);
|
|
1682
1332
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
1683
1333
|
}
|
|
1684
1334
|
|
|
1685
1335
|
Address local;
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
getsockname(fd, &local.sa, &len);
|
|
1689
|
-
#else
|
|
1690
|
-
int ret = getsockname(fd, &local.sa, &len);
|
|
1336
|
+
auto len = static_cast<socklen_t>(sizeof(sockaddr_storage));
|
|
1337
|
+
[[maybe_unused]] int ret = getsockname(fd, &local.sa, &len);
|
|
1691
1338
|
assert(ret != SOCKET_ERROR);
|
|
1692
|
-
#endif
|
|
1693
1339
|
return local;
|
|
1694
1340
|
}
|
|
1695
1341
|
|
|
1696
1342
|
Address
|
|
1697
1343
|
IceInternal::getNumericAddress(const std::string& address)
|
|
1698
1344
|
{
|
|
1699
|
-
vector<Address> addrs = getAddresses(address, 0, EnableBoth,
|
|
1700
|
-
|
|
1701
|
-
if(addrs.empty())
|
|
1345
|
+
vector<Address> addrs = getAddresses(address, 0, EnableBoth, false, false);
|
|
1346
|
+
if (addrs.empty())
|
|
1702
1347
|
{
|
|
1703
|
-
return
|
|
1348
|
+
return {};
|
|
1704
1349
|
}
|
|
1705
1350
|
else
|
|
1706
1351
|
{
|
|
@@ -1708,11 +1353,33 @@ IceInternal::getNumericAddress(const std::string& address)
|
|
|
1708
1353
|
}
|
|
1709
1354
|
}
|
|
1710
1355
|
|
|
1711
|
-
|
|
1356
|
+
string
|
|
1357
|
+
IceInternal::normalizeIPv6Address(const string& host)
|
|
1358
|
+
{
|
|
1359
|
+
if (host.find(':') != string::npos)
|
|
1360
|
+
{
|
|
1361
|
+
struct in6_addr result;
|
|
1362
|
+
if (inet_pton(AF_INET6, host.c_str(), &result) == 1)
|
|
1363
|
+
{
|
|
1364
|
+
// Normalize the address
|
|
1365
|
+
char buf[INET6_ADDRSTRLEN];
|
|
1366
|
+
if (inet_ntop(AF_INET6, &result, buf, sizeof(buf)) != nullptr)
|
|
1367
|
+
{
|
|
1368
|
+
return string{buf};
|
|
1369
|
+
}
|
|
1370
|
+
// else conversion to string failed, keep host as is
|
|
1371
|
+
}
|
|
1372
|
+
// else it's not a valid IPv6 address keep host as is
|
|
1373
|
+
}
|
|
1374
|
+
return host;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
SyscallException::ErrorCode
|
|
1712
1378
|
IceInternal::getSocketErrno()
|
|
1713
1379
|
{
|
|
1714
1380
|
#if defined(_WIN32)
|
|
1715
|
-
|
|
1381
|
+
// We standardize on DWORD aka unsigned long for all system error codes on Windows.
|
|
1382
|
+
return static_cast<SyscallException::ErrorCode>(WSAGetLastError());
|
|
1716
1383
|
#else
|
|
1717
1384
|
return errno;
|
|
1718
1385
|
#endif
|
|
@@ -1724,31 +1391,27 @@ IceInternal::interrupted()
|
|
|
1724
1391
|
#ifdef _WIN32
|
|
1725
1392
|
return WSAGetLastError() == WSAEINTR;
|
|
1726
1393
|
#else
|
|
1727
|
-
#
|
|
1394
|
+
# ifdef EPROTO
|
|
1728
1395
|
return errno == EINTR || errno == EPROTO;
|
|
1729
|
-
#
|
|
1396
|
+
# else
|
|
1730
1397
|
return errno == EINTR;
|
|
1731
|
-
#
|
|
1398
|
+
# endif
|
|
1732
1399
|
#endif
|
|
1733
1400
|
}
|
|
1734
1401
|
|
|
1735
1402
|
bool
|
|
1736
1403
|
IceInternal::acceptInterrupted()
|
|
1737
1404
|
{
|
|
1738
|
-
if(interrupted())
|
|
1405
|
+
if (interrupted())
|
|
1739
1406
|
{
|
|
1740
1407
|
return true;
|
|
1741
1408
|
}
|
|
1742
1409
|
|
|
1743
1410
|
#ifdef _WIN32
|
|
1744
1411
|
int error = WSAGetLastError();
|
|
1745
|
-
return error == WSAECONNABORTED ||
|
|
1746
|
-
error == WSAECONNRESET ||
|
|
1747
|
-
error == WSAETIMEDOUT;
|
|
1412
|
+
return error == WSAECONNABORTED || error == WSAECONNRESET || error == WSAETIMEDOUT;
|
|
1748
1413
|
#else
|
|
1749
|
-
return errno == ECONNABORTED ||
|
|
1750
|
-
errno == ECONNRESET ||
|
|
1751
|
-
errno == ETIMEDOUT;
|
|
1414
|
+
return errno == ECONNABORTED || errno == ECONNRESET || errno == ETIMEDOUT;
|
|
1752
1415
|
#endif
|
|
1753
1416
|
}
|
|
1754
1417
|
|
|
@@ -1757,8 +1420,7 @@ IceInternal::noBuffers()
|
|
|
1757
1420
|
{
|
|
1758
1421
|
#ifdef _WIN32
|
|
1759
1422
|
int error = WSAGetLastError();
|
|
1760
|
-
return error == WSAENOBUFS ||
|
|
1761
|
-
error == WSAEFAULT;
|
|
1423
|
+
return error == WSAENOBUFS || error == WSAEFAULT;
|
|
1762
1424
|
#else
|
|
1763
1425
|
return errno == ENOBUFS;
|
|
1764
1426
|
#endif
|
|
@@ -1780,23 +1442,12 @@ IceInternal::connectFailed()
|
|
|
1780
1442
|
{
|
|
1781
1443
|
#if defined(_WIN32)
|
|
1782
1444
|
int error = WSAGetLastError();
|
|
1783
|
-
return error == WSAECONNREFUSED ||
|
|
1784
|
-
error ==
|
|
1785
|
-
error == WSAENETUNREACH ||
|
|
1786
|
-
error == WSAEHOSTUNREACH ||
|
|
1787
|
-
error == WSAECONNRESET ||
|
|
1788
|
-
error == WSAESHUTDOWN ||
|
|
1789
|
-
error == WSAECONNABORTED ||
|
|
1790
|
-
error == ERROR_SEM_TIMEOUT ||
|
|
1445
|
+
return error == WSAECONNREFUSED || error == WSAETIMEDOUT || error == WSAENETUNREACH || error == WSAEHOSTUNREACH ||
|
|
1446
|
+
error == WSAECONNRESET || error == WSAESHUTDOWN || error == WSAECONNABORTED || error == ERROR_SEM_TIMEOUT ||
|
|
1791
1447
|
error == ERROR_NETNAME_DELETED;
|
|
1792
1448
|
#else
|
|
1793
|
-
return errno == ECONNREFUSED ||
|
|
1794
|
-
errno ==
|
|
1795
|
-
errno == ENETUNREACH ||
|
|
1796
|
-
errno == EHOSTUNREACH ||
|
|
1797
|
-
errno == ECONNRESET ||
|
|
1798
|
-
errno == ESHUTDOWN ||
|
|
1799
|
-
errno == ECONNABORTED;
|
|
1449
|
+
return errno == ECONNREFUSED || errno == ETIMEDOUT || errno == ENETUNREACH || errno == EHOSTUNREACH ||
|
|
1450
|
+
errno == ECONNRESET || errno == ESHUTDOWN || errno == ECONNABORTED;
|
|
1800
1451
|
#endif
|
|
1801
1452
|
}
|
|
1802
1453
|
|
|
@@ -1816,19 +1467,13 @@ IceInternal::connectionLost()
|
|
|
1816
1467
|
{
|
|
1817
1468
|
#ifdef _WIN32
|
|
1818
1469
|
int error = WSAGetLastError();
|
|
1819
|
-
return error == WSAECONNRESET ||
|
|
1820
|
-
|
|
1821
|
-
error == WSAENOTCONN ||
|
|
1822
|
-
# ifdef ICE_USE_IOCP
|
|
1470
|
+
return error == WSAECONNRESET || error == WSAESHUTDOWN || error == WSAENOTCONN ||
|
|
1471
|
+
# ifdef ICE_USE_IOCP
|
|
1823
1472
|
error == ERROR_NETNAME_DELETED ||
|
|
1824
|
-
#
|
|
1473
|
+
# endif
|
|
1825
1474
|
error == WSAECONNABORTED;
|
|
1826
1475
|
#else
|
|
1827
|
-
return errno == ECONNRESET ||
|
|
1828
|
-
errno == ENOTCONN ||
|
|
1829
|
-
errno == ESHUTDOWN ||
|
|
1830
|
-
errno == ECONNABORTED ||
|
|
1831
|
-
errno == EPIPE;
|
|
1476
|
+
return errno == ECONNRESET || errno == ENOTCONN || errno == ESHUTDOWN || errno == ECONNABORTED || errno == EPIPE;
|
|
1832
1477
|
#endif
|
|
1833
1478
|
}
|
|
1834
1479
|
|
|
@@ -1871,9 +1516,9 @@ void
|
|
|
1871
1516
|
IceInternal::doListen(SOCKET fd, int backlog)
|
|
1872
1517
|
{
|
|
1873
1518
|
repeatListen:
|
|
1874
|
-
if(::listen(fd, backlog) == SOCKET_ERROR)
|
|
1519
|
+
if (::listen(fd, backlog) == SOCKET_ERROR)
|
|
1875
1520
|
{
|
|
1876
|
-
if(interrupted())
|
|
1521
|
+
if (interrupted())
|
|
1877
1522
|
{
|
|
1878
1523
|
goto repeatListen;
|
|
1879
1524
|
}
|
|
@@ -1886,7 +1531,7 @@ repeatListen:
|
|
|
1886
1531
|
bool
|
|
1887
1532
|
IceInternal::doConnect(SOCKET fd, const Address& addr, const Address& sourceAddr)
|
|
1888
1533
|
{
|
|
1889
|
-
if(isAddressValid(sourceAddr))
|
|
1534
|
+
if (isAddressValid(sourceAddr))
|
|
1890
1535
|
{
|
|
1891
1536
|
doBind(fd, sourceAddr);
|
|
1892
1537
|
}
|
|
@@ -1895,26 +1540,26 @@ repeatConnect:
|
|
|
1895
1540
|
int size = getAddressStorageSize(addr);
|
|
1896
1541
|
assert(size != 0);
|
|
1897
1542
|
|
|
1898
|
-
if(::connect(fd, &addr.sa, static_cast<socklen_t>(size)) == SOCKET_ERROR)
|
|
1543
|
+
if (::connect(fd, &addr.sa, static_cast<socklen_t>(size)) == SOCKET_ERROR)
|
|
1899
1544
|
{
|
|
1900
|
-
if(interrupted())
|
|
1545
|
+
if (interrupted())
|
|
1901
1546
|
{
|
|
1902
1547
|
goto repeatConnect;
|
|
1903
1548
|
}
|
|
1904
1549
|
|
|
1905
|
-
if(connectInProgress())
|
|
1550
|
+
if (connectInProgress())
|
|
1906
1551
|
{
|
|
1907
1552
|
return false;
|
|
1908
1553
|
}
|
|
1909
1554
|
|
|
1910
1555
|
closeSocketNoThrow(fd);
|
|
1911
|
-
if(connectionRefused())
|
|
1556
|
+
if (connectionRefused())
|
|
1912
1557
|
{
|
|
1913
|
-
throw ConnectionRefusedException
|
|
1558
|
+
throw ConnectionRefusedException{__FILE__, __LINE__, addrToString(addr)};
|
|
1914
1559
|
}
|
|
1915
|
-
else if(connectFailed())
|
|
1560
|
+
else if (connectFailed())
|
|
1916
1561
|
{
|
|
1917
|
-
throw ConnectFailedException(__FILE__, __LINE__, getSocketErrno());
|
|
1562
|
+
throw ConnectFailedException(__FILE__, __LINE__, getSocketErrno(), addrToString(addr));
|
|
1918
1563
|
}
|
|
1919
1564
|
else
|
|
1920
1565
|
{
|
|
@@ -1932,12 +1577,12 @@ repeatConnect:
|
|
|
1932
1577
|
try
|
|
1933
1578
|
{
|
|
1934
1579
|
fdToLocalAddress(fd, localAddr);
|
|
1935
|
-
if(compareAddress(addr, localAddr) == 0)
|
|
1580
|
+
if (compareAddress(addr, localAddr) == 0)
|
|
1936
1581
|
{
|
|
1937
|
-
throw ConnectionRefusedException
|
|
1582
|
+
throw ConnectionRefusedException{__FILE__, __LINE__, addrToString(addr)};
|
|
1938
1583
|
}
|
|
1939
1584
|
}
|
|
1940
|
-
catch(const LocalException&)
|
|
1585
|
+
catch (const LocalException&)
|
|
1941
1586
|
{
|
|
1942
1587
|
closeSocketNoThrow(fd);
|
|
1943
1588
|
throw;
|
|
@@ -1950,7 +1595,7 @@ void
|
|
|
1950
1595
|
IceInternal::doFinishConnect(SOCKET fd)
|
|
1951
1596
|
{
|
|
1952
1597
|
//
|
|
1953
|
-
// Note: we don't close the socket if there's an exception. It's the
|
|
1598
|
+
// Note: we don't close the socket if there's an exception. It's the responsibility
|
|
1954
1599
|
// of the caller to do so.
|
|
1955
1600
|
//
|
|
1956
1601
|
|
|
@@ -1964,24 +1609,24 @@ IceInternal::doFinishConnect(SOCKET fd)
|
|
|
1964
1609
|
#endif
|
|
1965
1610
|
|
|
1966
1611
|
int val;
|
|
1967
|
-
|
|
1968
|
-
if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
|
|
1612
|
+
auto len = static_cast<socklen_t>(sizeof(int));
|
|
1613
|
+
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
|
|
1969
1614
|
{
|
|
1970
1615
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
1971
1616
|
}
|
|
1972
1617
|
|
|
1973
|
-
if(val > 0)
|
|
1618
|
+
if (val > 0)
|
|
1974
1619
|
{
|
|
1975
1620
|
#if defined(_WIN32)
|
|
1976
1621
|
WSASetLastError(val);
|
|
1977
1622
|
#else
|
|
1978
1623
|
errno = val;
|
|
1979
1624
|
#endif
|
|
1980
|
-
if(connectionRefused())
|
|
1625
|
+
if (connectionRefused())
|
|
1981
1626
|
{
|
|
1982
|
-
throw ConnectionRefusedException
|
|
1627
|
+
throw ConnectionRefusedException{__FILE__, __LINE__};
|
|
1983
1628
|
}
|
|
1984
|
-
else if(connectFailed())
|
|
1629
|
+
else if (connectFailed())
|
|
1985
1630
|
{
|
|
1986
1631
|
throw ConnectFailedException(__FILE__, __LINE__, getSocketErrno());
|
|
1987
1632
|
}
|
|
@@ -2000,9 +1645,9 @@ IceInternal::doFinishConnect(SOCKET fd)
|
|
|
2000
1645
|
Address localAddr;
|
|
2001
1646
|
fdToLocalAddress(fd, localAddr);
|
|
2002
1647
|
Address remoteAddr;
|
|
2003
|
-
if(fdToRemoteAddress(fd, remoteAddr) && compareAddress(remoteAddr, localAddr) == 0)
|
|
1648
|
+
if (fdToRemoteAddress(fd, remoteAddr) && compareAddress(remoteAddr, localAddr) == 0)
|
|
2004
1649
|
{
|
|
2005
|
-
throw ConnectionRefusedException
|
|
1650
|
+
throw ConnectionRefusedException{__FILE__, __LINE__, addrToString(remoteAddr)};
|
|
2006
1651
|
}
|
|
2007
1652
|
#endif
|
|
2008
1653
|
}
|
|
@@ -2017,9 +1662,9 @@ IceInternal::doAccept(SOCKET fd)
|
|
|
2017
1662
|
#endif
|
|
2018
1663
|
|
|
2019
1664
|
repeatAccept:
|
|
2020
|
-
if((ret = ::accept(fd,
|
|
1665
|
+
if ((ret = ::accept(fd, nullptr, nullptr)) == INVALID_SOCKET)
|
|
2021
1666
|
{
|
|
2022
|
-
if(acceptInterrupted())
|
|
1667
|
+
if (acceptInterrupted())
|
|
2023
1668
|
{
|
|
2024
1669
|
goto repeatAccept;
|
|
2025
1670
|
}
|
|
@@ -2054,7 +1699,7 @@ IceInternal::createPipe(SOCKET fds[2])
|
|
|
2054
1699
|
{
|
|
2055
1700
|
fds[0] = createSocketImpl(false, AF_INET);
|
|
2056
1701
|
}
|
|
2057
|
-
catch(...)
|
|
1702
|
+
catch (...)
|
|
2058
1703
|
{
|
|
2059
1704
|
::closesocket(fd);
|
|
2060
1705
|
throw;
|
|
@@ -2063,14 +1708,10 @@ IceInternal::createPipe(SOCKET fds[2])
|
|
|
2063
1708
|
try
|
|
2064
1709
|
{
|
|
2065
1710
|
setBlock(fds[0], true);
|
|
2066
|
-
|
|
2067
|
-
bool connected = doConnect(fds[0], addr, Address());
|
|
1711
|
+
[[maybe_unused]] bool connected = doConnect(fds[0], addr, Address());
|
|
2068
1712
|
assert(connected);
|
|
2069
|
-
# else
|
|
2070
|
-
doConnect(fds[0], addr, Address());
|
|
2071
|
-
# endif
|
|
2072
1713
|
}
|
|
2073
|
-
catch(...)
|
|
1714
|
+
catch (...)
|
|
2074
1715
|
{
|
|
2075
1716
|
// fds[0] is closed by doConnect
|
|
2076
1717
|
::closesocket(fd);
|
|
@@ -2081,7 +1722,7 @@ IceInternal::createPipe(SOCKET fds[2])
|
|
|
2081
1722
|
{
|
|
2082
1723
|
fds[1] = doAccept(fd);
|
|
2083
1724
|
}
|
|
2084
|
-
catch(...)
|
|
1725
|
+
catch (...)
|
|
2085
1726
|
{
|
|
2086
1727
|
::closesocket(fds[0]);
|
|
2087
1728
|
::closesocket(fd);
|
|
@@ -2094,7 +1735,7 @@ IceInternal::createPipe(SOCKET fds[2])
|
|
|
2094
1735
|
{
|
|
2095
1736
|
setBlock(fds[1], true);
|
|
2096
1737
|
}
|
|
2097
|
-
catch(...)
|
|
1738
|
+
catch (...)
|
|
2098
1739
|
{
|
|
2099
1740
|
::closesocket(fds[0]);
|
|
2100
1741
|
// fds[1] is closed by setBlock
|
|
@@ -2103,16 +1744,16 @@ IceInternal::createPipe(SOCKET fds[2])
|
|
|
2103
1744
|
|
|
2104
1745
|
#else
|
|
2105
1746
|
|
|
2106
|
-
if(::pipe(fds) != 0)
|
|
1747
|
+
if (::pipe(fds) != 0)
|
|
2107
1748
|
{
|
|
2108
|
-
throw SyscallException
|
|
1749
|
+
throw SyscallException{__FILE__, __LINE__, "pipe failed", errno};
|
|
2109
1750
|
}
|
|
2110
1751
|
|
|
2111
1752
|
try
|
|
2112
1753
|
{
|
|
2113
1754
|
setBlock(fds[0], true);
|
|
2114
1755
|
}
|
|
2115
|
-
catch(...)
|
|
1756
|
+
catch (...)
|
|
2116
1757
|
{
|
|
2117
1758
|
// fds[0] is closed by setBlock
|
|
2118
1759
|
closeSocketNoThrow(fds[1]);
|
|
@@ -2123,7 +1764,7 @@ IceInternal::createPipe(SOCKET fds[2])
|
|
|
2123
1764
|
{
|
|
2124
1765
|
setBlock(fds[1], true);
|
|
2125
1766
|
}
|
|
2126
|
-
catch(...)
|
|
1767
|
+
catch (...)
|
|
2127
1768
|
{
|
|
2128
1769
|
closeSocketNoThrow(fds[0]);
|
|
2129
1770
|
// fds[1] is closed by setBlock
|
|
@@ -2142,20 +1783,20 @@ IceInternal::doConnectAsync(SOCKET fd, const Address& addr, const Address& sourc
|
|
|
2142
1783
|
// failure to connect. The socket isn't closed by this method.
|
|
2143
1784
|
//
|
|
2144
1785
|
Address bindAddr;
|
|
2145
|
-
if(isAddressValid(sourceAddr))
|
|
1786
|
+
if (isAddressValid(sourceAddr))
|
|
2146
1787
|
{
|
|
2147
1788
|
bindAddr = sourceAddr;
|
|
2148
1789
|
}
|
|
2149
1790
|
else
|
|
2150
1791
|
{
|
|
2151
1792
|
memset(&bindAddr.saStorage, 0, sizeof(sockaddr_storage));
|
|
2152
|
-
if(addr.saStorage.ss_family == AF_INET)
|
|
1793
|
+
if (addr.saStorage.ss_family == AF_INET)
|
|
2153
1794
|
{
|
|
2154
1795
|
bindAddr.saIn.sin_family = AF_INET;
|
|
2155
1796
|
bindAddr.saIn.sin_port = htons(0);
|
|
2156
1797
|
bindAddr.saIn.sin_addr.s_addr = htonl(INADDR_ANY);
|
|
2157
1798
|
}
|
|
2158
|
-
else if(addr.saStorage.ss_family == AF_INET6)
|
|
1799
|
+
else if (addr.saStorage.ss_family == AF_INET6)
|
|
2159
1800
|
{
|
|
2160
1801
|
bindAddr.saIn6.sin6_family = AF_INET6;
|
|
2161
1802
|
bindAddr.saIn6.sin6_port = htons(0);
|
|
@@ -2166,38 +1807,39 @@ IceInternal::doConnectAsync(SOCKET fd, const Address& addr, const Address& sourc
|
|
|
2166
1807
|
int size = getAddressStorageSize(bindAddr);
|
|
2167
1808
|
assert(size != 0);
|
|
2168
1809
|
|
|
2169
|
-
if(::bind(fd, &bindAddr.sa, size) == SOCKET_ERROR)
|
|
1810
|
+
if (::bind(fd, &bindAddr.sa, size) == SOCKET_ERROR)
|
|
2170
1811
|
{
|
|
2171
1812
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
2172
1813
|
}
|
|
2173
1814
|
|
|
2174
|
-
LPFN_CONNECTEX ConnectEx =
|
|
1815
|
+
LPFN_CONNECTEX ConnectEx = nullptr; // a pointer to the 'ConnectEx()' function
|
|
2175
1816
|
GUID GuidConnectEx = WSAID_CONNECTEX; // The Guid
|
|
2176
1817
|
DWORD dwBytes;
|
|
2177
|
-
if(WSAIoctl(
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
1818
|
+
if (WSAIoctl(
|
|
1819
|
+
fd,
|
|
1820
|
+
SIO_GET_EXTENSION_FUNCTION_POINTER,
|
|
1821
|
+
&GuidConnectEx,
|
|
1822
|
+
sizeof(GuidConnectEx),
|
|
1823
|
+
&ConnectEx,
|
|
1824
|
+
sizeof(ConnectEx),
|
|
1825
|
+
&dwBytes,
|
|
1826
|
+
nullptr,
|
|
1827
|
+
nullptr) == SOCKET_ERROR)
|
|
2186
1828
|
{
|
|
2187
1829
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
2188
1830
|
}
|
|
2189
1831
|
|
|
2190
|
-
if(!ConnectEx(fd, &addr.sa, size, 0, 0, 0, &info))
|
|
1832
|
+
if (!ConnectEx(fd, &addr.sa, size, 0, 0, 0, &info))
|
|
2191
1833
|
{
|
|
2192
|
-
if(!connectInProgress())
|
|
1834
|
+
if (!connectInProgress())
|
|
2193
1835
|
{
|
|
2194
|
-
if(connectionRefused())
|
|
1836
|
+
if (connectionRefused())
|
|
2195
1837
|
{
|
|
2196
|
-
throw ConnectionRefusedException
|
|
1838
|
+
throw ConnectionRefusedException{__FILE__, __LINE__, addrToString(addr)};
|
|
2197
1839
|
}
|
|
2198
|
-
else if(connectFailed())
|
|
1840
|
+
else if (connectFailed())
|
|
2199
1841
|
{
|
|
2200
|
-
throw ConnectFailedException(__FILE__, __LINE__, getSocketErrno());
|
|
1842
|
+
throw ConnectFailedException(__FILE__, __LINE__, getSocketErrno(), addrToString(addr));
|
|
2201
1843
|
}
|
|
2202
1844
|
else
|
|
2203
1845
|
{
|
|
@@ -2211,18 +1853,18 @@ void
|
|
|
2211
1853
|
IceInternal::doFinishConnectAsync(SOCKET fd, AsyncInfo& info)
|
|
2212
1854
|
{
|
|
2213
1855
|
//
|
|
2214
|
-
// NOTE: It's the caller's
|
|
1856
|
+
// NOTE: It's the caller's responsibility to close the socket upon
|
|
2215
1857
|
// failure to connect. The socket isn't closed by this method.
|
|
2216
1858
|
//
|
|
2217
1859
|
|
|
2218
|
-
if(info.error != ERROR_SUCCESS)
|
|
1860
|
+
if (info.error != ERROR_SUCCESS)
|
|
2219
1861
|
{
|
|
2220
1862
|
WSASetLastError(info.error);
|
|
2221
|
-
if(connectionRefused())
|
|
1863
|
+
if (connectionRefused())
|
|
2222
1864
|
{
|
|
2223
|
-
throw ConnectionRefusedException
|
|
1865
|
+
throw ConnectionRefusedException{__FILE__, __LINE__};
|
|
2224
1866
|
}
|
|
2225
|
-
else if(connectFailed())
|
|
1867
|
+
else if (connectFailed())
|
|
2226
1868
|
{
|
|
2227
1869
|
throw ConnectFailedException(__FILE__, __LINE__, getSocketErrno());
|
|
2228
1870
|
}
|
|
@@ -2232,7 +1874,7 @@ IceInternal::doFinishConnectAsync(SOCKET fd, AsyncInfo& info)
|
|
|
2232
1874
|
}
|
|
2233
1875
|
}
|
|
2234
1876
|
|
|
2235
|
-
if(setsockopt(fd, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT,
|
|
1877
|
+
if (setsockopt(fd, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, nullptr, 0) == SOCKET_ERROR)
|
|
2236
1878
|
{
|
|
2237
1879
|
throw SocketException(__FILE__, __LINE__, getSocketErrno());
|
|
2238
1880
|
}
|
|
@@ -2247,3 +1889,39 @@ IceInternal::isIpAddress(const string& name)
|
|
|
2247
1889
|
|
|
2248
1890
|
return inet_pton(AF_INET, name.c_str(), &addr) > 0 || inet_pton(AF_INET6, name.c_str(), &addr6) > 0;
|
|
2249
1891
|
}
|
|
1892
|
+
|
|
1893
|
+
bool
|
|
1894
|
+
IceInternal::isLoopbackOrMulticastAddress(const string& name)
|
|
1895
|
+
{
|
|
1896
|
+
if (name.empty())
|
|
1897
|
+
{
|
|
1898
|
+
return false;
|
|
1899
|
+
}
|
|
1900
|
+
else
|
|
1901
|
+
{
|
|
1902
|
+
in_addr addr;
|
|
1903
|
+
in6_addr addr6;
|
|
1904
|
+
if (inet_pton(AF_INET, name.c_str(), &addr) > 0)
|
|
1905
|
+
{
|
|
1906
|
+
// It's an IPv4 address
|
|
1907
|
+
return addr.s_addr == htonl(INADDR_LOOPBACK) || IN_MULTICAST(ntohl(addr.s_addr));
|
|
1908
|
+
}
|
|
1909
|
+
else if (inet_pton(AF_INET6, name.c_str(), &addr6) > 0)
|
|
1910
|
+
{
|
|
1911
|
+
// It's an IPv6 address
|
|
1912
|
+
return IN6_IS_ADDR_LOOPBACK(&addr6) || IN6_IS_ADDR_MULTICAST(&addr6);
|
|
1913
|
+
}
|
|
1914
|
+
return false;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
string
|
|
1919
|
+
IceInternal::getHostName()
|
|
1920
|
+
{
|
|
1921
|
+
char name[256];
|
|
1922
|
+
if (gethostname(name, sizeof(name)) != 0)
|
|
1923
|
+
{
|
|
1924
|
+
throw SocketException{__FILE__, __LINE__, getSocketErrno()};
|
|
1925
|
+
}
|
|
1926
|
+
return name;
|
|
1927
|
+
}
|