zeroc-ice 3.6b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ICE_LICENSE +54 -0
- data/LICENSE +339 -0
- data/bin/slice2rb +17 -0
- data/ext/Communicator.cpp +596 -0
- data/ext/Communicator.h +25 -0
- data/ext/Config.h +111 -0
- data/ext/Connection.cpp +381 -0
- data/ext/Connection.h +26 -0
- data/ext/Endpoint.cpp +311 -0
- data/ext/Endpoint.h +27 -0
- data/ext/ImplicitContext.cpp +152 -0
- data/ext/ImplicitContext.h +25 -0
- data/ext/Init.cpp +52 -0
- data/ext/Logger.cpp +151 -0
- data/ext/Logger.h +28 -0
- data/ext/ObjectFactory.cpp +140 -0
- data/ext/ObjectFactory.h +50 -0
- data/ext/Operation.cpp +676 -0
- data/ext/Operation.h +36 -0
- data/ext/Properties.cpp +369 -0
- data/ext/Properties.h +25 -0
- data/ext/Proxy.cpp +1354 -0
- data/ext/Proxy.h +27 -0
- data/ext/Slice.cpp +223 -0
- data/ext/Slice.h +22 -0
- data/ext/Types.cpp +3160 -0
- data/ext/Types.h +545 -0
- data/ext/Util.cpp +792 -0
- data/ext/Util.h +511 -0
- data/ext/extconf.rb +118 -0
- data/ext/ice/BZIP_LICENSE +42 -0
- data/ext/ice/MCPP_LICENSE +36 -0
- data/ext/ice/bzip2/blocksort.c +1094 -0
- data/ext/ice/bzip2/bzlib.c +1572 -0
- data/ext/ice/bzip2/bzlib.h +282 -0
- data/ext/ice/bzip2/bzlib_private.h +509 -0
- data/ext/ice/bzip2/compress.c +672 -0
- data/ext/ice/bzip2/crctable.c +104 -0
- data/ext/ice/bzip2/decompress.c +646 -0
- data/ext/ice/bzip2/huffman.c +205 -0
- data/ext/ice/bzip2/randtable.c +84 -0
- data/ext/ice/cpp/include/Ice/ACMF.h +30 -0
- data/ext/ice/cpp/include/Ice/Application.h +156 -0
- data/ext/ice/cpp/include/Ice/AsyncResult.h +363 -0
- data/ext/ice/cpp/include/Ice/AsyncResultF.h +26 -0
- data/ext/ice/cpp/include/Ice/BasicStream.h +1315 -0
- data/ext/ice/cpp/include/Ice/Buffer.h +159 -0
- data/ext/ice/cpp/include/Ice/BuiltinSequences.h +74 -0
- data/ext/ice/cpp/include/Ice/Communicator.h +194 -0
- data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +115 -0
- data/ext/ice/cpp/include/Ice/CommunicatorF.h +60 -0
- data/ext/ice/cpp/include/Ice/Config.h +97 -0
- data/ext/ice/cpp/include/Ice/Connection.h +495 -0
- data/ext/ice/cpp/include/Ice/ConnectionAsync.h +115 -0
- data/ext/ice/cpp/include/Ice/ConnectionF.h +72 -0
- data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +30 -0
- data/ext/ice/cpp/include/Ice/ConnectionIF.h +37 -0
- data/ext/ice/cpp/include/Ice/Current.h +94 -0
- data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +48 -0
- data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +62 -0
- data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +33 -0
- data/ext/ice/cpp/include/Ice/Dispatcher.h +51 -0
- data/ext/ice/cpp/include/Ice/DynamicLibrary.h +105 -0
- data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +29 -0
- data/ext/ice/cpp/include/Ice/Endpoint.h +350 -0
- data/ext/ice/cpp/include/Ice/EndpointF.h +97 -0
- data/ext/ice/cpp/include/Ice/EndpointTypes.h +74 -0
- data/ext/ice/cpp/include/Ice/Exception.h +114 -0
- data/ext/ice/cpp/include/Ice/FacetMap.h +56 -0
- data/ext/ice/cpp/include/Ice/FactoryTable.h +69 -0
- data/ext/ice/cpp/include/Ice/FactoryTableInit.h +87 -0
- data/ext/ice/cpp/include/Ice/Format.h +39 -0
- data/ext/ice/cpp/include/Ice/Functional.h +138 -0
- data/ext/ice/cpp/include/Ice/GCObject.h +73 -0
- data/ext/ice/cpp/include/Ice/Handle.h +192 -0
- data/ext/ice/cpp/include/Ice/Ice.h +54 -0
- data/ext/ice/cpp/include/Ice/Identity.h +160 -0
- data/ext/ice/cpp/include/Ice/ImplicitContext.h +96 -0
- data/ext/ice/cpp/include/Ice/ImplicitContextF.h +60 -0
- data/ext/ice/cpp/include/Ice/Incoming.h +131 -0
- data/ext/ice/cpp/include/Ice/IncomingAsync.h +108 -0
- data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +35 -0
- data/ext/ice/cpp/include/Ice/Initialize.h +141 -0
- data/ext/ice/cpp/include/Ice/InstanceF.h +26 -0
- data/ext/ice/cpp/include/Ice/Instrumentation.h +377 -0
- data/ext/ice/cpp/include/Ice/InstrumentationF.h +71 -0
- data/ext/ice/cpp/include/Ice/LocalException.h +1022 -0
- data/ext/ice/cpp/include/Ice/LocalObject.h +36 -0
- data/ext/ice/cpp/include/Ice/LocalObjectF.h +26 -0
- data/ext/ice/cpp/include/Ice/Locator.h +2191 -0
- data/ext/ice/cpp/include/Ice/LocatorF.h +89 -0
- data/ext/ice/cpp/include/Ice/Logger.h +94 -0
- data/ext/ice/cpp/include/Ice/LoggerF.h +60 -0
- data/ext/ice/cpp/include/Ice/LoggerUtil.h +153 -0
- data/ext/ice/cpp/include/Ice/Makefile +26 -0
- data/ext/ice/cpp/include/Ice/Metrics.h +2989 -0
- data/ext/ice/cpp/include/Ice/MetricsAdminI.h +662 -0
- data/ext/ice/cpp/include/Ice/MetricsFunctional.h +144 -0
- data/ext/ice/cpp/include/Ice/MetricsObserverI.h +576 -0
- data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +55 -0
- data/ext/ice/cpp/include/Ice/Object.h +165 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapter.h +162 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapterF.h +60 -0
- data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObjectF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObjectFactory.h +86 -0
- data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +60 -0
- data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +26 -0
- data/ext/ice/cpp/include/Ice/ObserverHelper.h +177 -0
- data/ext/ice/cpp/include/Ice/Outgoing.h +197 -0
- data/ext/ice/cpp/include/Ice/OutgoingAsync.h +264 -0
- data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +38 -0
- data/ext/ice/cpp/include/Ice/Plugin.h +121 -0
- data/ext/ice/cpp/include/Ice/PluginF.h +66 -0
- data/ext/ice/cpp/include/Ice/Process.h +568 -0
- data/ext/ice/cpp/include/Ice/ProcessF.h +77 -0
- data/ext/ice/cpp/include/Ice/Properties.h +130 -0
- data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +824 -0
- data/ext/ice/cpp/include/Ice/PropertiesF.h +83 -0
- data/ext/ice/cpp/include/Ice/Protocol.h +242 -0
- data/ext/ice/cpp/include/Ice/Proxy.h +2448 -0
- data/ext/ice/cpp/include/Ice/ProxyF.h +78 -0
- data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +26 -0
- data/ext/ice/cpp/include/Ice/ProxyHandle.h +330 -0
- data/ext/ice/cpp/include/Ice/ReferenceF.h +34 -0
- data/ext/ice/cpp/include/Ice/RemoteLogger.h +1496 -0
- data/ext/ice/cpp/include/Ice/RequestHandlerF.h +29 -0
- data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +25 -0
- data/ext/ice/cpp/include/Ice/Router.h +1155 -0
- data/ext/ice/cpp/include/Ice/RouterF.h +77 -0
- data/ext/ice/cpp/include/Ice/ServantLocator.h +90 -0
- data/ext/ice/cpp/include/Ice/ServantLocatorF.h +60 -0
- data/ext/ice/cpp/include/Ice/ServantManagerF.h +26 -0
- data/ext/ice/cpp/include/Ice/Service.h +260 -0
- data/ext/ice/cpp/include/Ice/SliceChecksumDict.h +56 -0
- data/ext/ice/cpp/include/Ice/SliceChecksums.h +34 -0
- data/ext/ice/cpp/include/Ice/SlicedData.h +103 -0
- data/ext/ice/cpp/include/Ice/SlicedDataF.h +34 -0
- data/ext/ice/cpp/include/Ice/Stream.h +449 -0
- data/ext/ice/cpp/include/Ice/StreamF.h +30 -0
- data/ext/ice/cpp/include/Ice/StreamHelpers.h +877 -0
- data/ext/ice/cpp/include/Ice/ThreadPoolF.h +28 -0
- data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +56 -0
- data/ext/ice/cpp/include/Ice/Version.h +254 -0
- data/ext/ice/cpp/include/IceSSL/Config.h +23 -0
- data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +119 -0
- data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +101 -0
- data/ext/ice/cpp/include/IceSSL/IceSSL.h +22 -0
- data/ext/ice/cpp/include/IceSSL/Makefile +26 -0
- data/ext/ice/cpp/include/IceSSL/Plugin.h +558 -0
- data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +119 -0
- data/ext/ice/cpp/include/IceUtil/Cache.h +362 -0
- data/ext/ice/cpp/include/IceUtil/Cond.h +323 -0
- data/ext/ice/cpp/include/IceUtil/Config.h +234 -0
- data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +50 -0
- data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +70 -0
- data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +45 -0
- data/ext/ice/cpp/include/IceUtil/Exception.h +184 -0
- data/ext/ice/cpp/include/IceUtil/Functional.h +389 -0
- data/ext/ice/cpp/include/IceUtil/Handle.h +266 -0
- data/ext/ice/cpp/include/IceUtil/IceUtil.h +51 -0
- data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +302 -0
- data/ext/ice/cpp/include/IceUtil/InputUtil.h +47 -0
- data/ext/ice/cpp/include/IceUtil/Iterator.h +36 -0
- data/ext/ice/cpp/include/IceUtil/Lock.h +135 -0
- data/ext/ice/cpp/include/IceUtil/Makefile +26 -0
- data/ext/ice/cpp/include/IceUtil/Monitor.h +249 -0
- data/ext/ice/cpp/include/IceUtil/Mutex.h +357 -0
- data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +28 -0
- data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +83 -0
- data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +82 -0
- data/ext/ice/cpp/include/IceUtil/Optional.h +322 -0
- data/ext/ice/cpp/include/IceUtil/Options.h +141 -0
- data/ext/ice/cpp/include/IceUtil/OutputUtil.h +362 -0
- data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +19 -0
- data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +26 -0
- data/ext/ice/cpp/include/IceUtil/Random.h +24 -0
- data/ext/ice/cpp/include/IceUtil/RecMutex.h +113 -0
- data/ext/ice/cpp/include/IceUtil/SHA1.h +65 -0
- data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +44 -0
- data/ext/ice/cpp/include/IceUtil/ScopedArray.h +97 -0
- data/ext/ice/cpp/include/IceUtil/Shared.h +168 -0
- data/ext/ice/cpp/include/IceUtil/StringConverter.h +175 -0
- data/ext/ice/cpp/include/IceUtil/StringUtil.h +91 -0
- data/ext/ice/cpp/include/IceUtil/Thread.h +181 -0
- data/ext/ice/cpp/include/IceUtil/ThreadException.h +108 -0
- data/ext/ice/cpp/include/IceUtil/Time.h +209 -0
- data/ext/ice/cpp/include/IceUtil/Timer.h +143 -0
- data/ext/ice/cpp/include/IceUtil/UUID.h +22 -0
- data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +42 -0
- data/ext/ice/cpp/include/IceUtil/UniquePtr.h +101 -0
- data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +64 -0
- data/ext/ice/cpp/include/Slice/Checksum.h +26 -0
- data/ext/ice/cpp/include/Slice/CsUtil.h +92 -0
- data/ext/ice/cpp/include/Slice/DotNetNames.h +34 -0
- data/ext/ice/cpp/include/Slice/FileTracker.h +71 -0
- data/ext/ice/cpp/include/Slice/JavaUtil.h +277 -0
- data/ext/ice/cpp/include/Slice/Makefile +26 -0
- data/ext/ice/cpp/include/Slice/PHPUtil.h +50 -0
- data/ext/ice/cpp/include/Slice/Parser.h +1116 -0
- data/ext/ice/cpp/include/Slice/Preprocessor.h +68 -0
- data/ext/ice/cpp/include/Slice/PythonUtil.h +64 -0
- data/ext/ice/cpp/include/Slice/RubyUtil.h +54 -0
- data/ext/ice/cpp/include/Slice/Util.h +33 -0
- data/ext/ice/cpp/src/Ice/ACM.cpp +343 -0
- data/ext/ice/cpp/src/Ice/ACM.h +117 -0
- data/ext/ice/cpp/src/Ice/Acceptor.cpp +16 -0
- data/ext/ice/cpp/src/Ice/Acceptor.h +41 -0
- data/ext/ice/cpp/src/Ice/AcceptorF.h +30 -0
- data/ext/ice/cpp/src/Ice/Application.cpp +760 -0
- data/ext/ice/cpp/src/Ice/AsyncResult.cpp +599 -0
- data/ext/ice/cpp/src/Ice/Base64.cpp +269 -0
- data/ext/ice/cpp/src/Ice/Base64.h +36 -0
- data/ext/ice/cpp/src/Ice/BasicStream.cpp +3393 -0
- data/ext/ice/cpp/src/Ice/Buffer.cpp +98 -0
- data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +34 -0
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +718 -0
- data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +106 -0
- data/ext/ice/cpp/src/Ice/Communicator.cpp +45 -0
- data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +386 -0
- data/ext/ice/cpp/src/Ice/CommunicatorI.h +112 -0
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +546 -0
- data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +97 -0
- data/ext/ice/cpp/src/Ice/Connection.cpp +58 -0
- data/ext/ice/cpp/src/Ice/ConnectionF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +1639 -0
- data/ext/ice/cpp/src/Ice/ConnectionFactory.h +236 -0
- data/ext/ice/cpp/src/Ice/ConnectionI.cpp +3876 -0
- data/ext/ice/cpp/src/Ice/ConnectionI.h +364 -0
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +115 -0
- data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +50 -0
- data/ext/ice/cpp/src/Ice/Connector.cpp +16 -0
- data/ext/ice/cpp/src/Ice/Connector.h +36 -0
- data/ext/ice/cpp/src/Ice/ConnectorF.h +26 -0
- data/ext/ice/cpp/src/Ice/Current.cpp +38 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +168 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +57 -0
- data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +26 -0
- data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +60 -0
- data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +49 -0
- data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +281 -0
- data/ext/ice/cpp/src/Ice/Endpoint.cpp +53 -0
- data/ext/ice/cpp/src/Ice/EndpointF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +25 -0
- data/ext/ice/cpp/src/Ice/EndpointFactory.h +44 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +26 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +208 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +46 -0
- data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +26 -0
- data/ext/ice/cpp/src/Ice/EndpointI.cpp +87 -0
- data/ext/ice/cpp/src/Ice/EndpointI.h +165 -0
- data/ext/ice/cpp/src/Ice/EndpointIF.h +41 -0
- data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +38 -0
- data/ext/ice/cpp/src/Ice/EventHandler.cpp +35 -0
- data/ext/ice/cpp/src/Ice/EventHandler.h +78 -0
- data/ext/ice/cpp/src/Ice/EventHandlerF.h +26 -0
- data/ext/ice/cpp/src/Ice/EventLoggerMsg.h +53 -0
- data/ext/ice/cpp/src/Ice/Exception.cpp +832 -0
- data/ext/ice/cpp/src/Ice/FacetMap.cpp +34 -0
- data/ext/ice/cpp/src/Ice/FactoryTable.cpp +158 -0
- data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +95 -0
- data/ext/ice/cpp/src/Ice/GCObject.cpp +444 -0
- data/ext/ice/cpp/src/Ice/HashUtil.h +59 -0
- data/ext/ice/cpp/src/Ice/HttpParser.cpp +680 -0
- data/ext/ice/cpp/src/Ice/HttpParser.h +124 -0
- data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +733 -0
- data/ext/ice/cpp/src/Ice/IPEndpointI.h +157 -0
- data/ext/ice/cpp/src/Ice/IPEndpointIF.h +29 -0
- data/ext/ice/cpp/src/Ice/Identity.cpp +42 -0
- data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +639 -0
- data/ext/ice/cpp/src/Ice/ImplicitContextI.h +51 -0
- data/ext/ice/cpp/src/Ice/Incoming.cpp +757 -0
- data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +340 -0
- data/ext/ice/cpp/src/Ice/IncomingRequest.h +37 -0
- data/ext/ice/cpp/src/Ice/Initialize.cpp +401 -0
- data/ext/ice/cpp/src/Ice/Instance.cpp +1928 -0
- data/ext/ice/cpp/src/Ice/Instance.h +198 -0
- data/ext/ice/cpp/src/Ice/Instrumentation.cpp +68 -0
- data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +43 -0
- data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +1083 -0
- data/ext/ice/cpp/src/Ice/InstrumentationI.h +262 -0
- data/ext/ice/cpp/src/Ice/LocalException.cpp +2091 -0
- data/ext/ice/cpp/src/Ice/LocalObject.cpp +29 -0
- data/ext/ice/cpp/src/Ice/Locator.cpp +1946 -0
- data/ext/ice/cpp/src/Ice/LocatorF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +917 -0
- data/ext/ice/cpp/src/Ice/LocatorInfo.h +193 -0
- data/ext/ice/cpp/src/Ice/LocatorInfoF.h +34 -0
- data/ext/ice/cpp/src/Ice/Logger.cpp +40 -0
- data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +862 -0
- data/ext/ice/cpp/src/Ice/LoggerAdminI.h +46 -0
- data/ext/ice/cpp/src/Ice/LoggerF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/LoggerI.cpp +199 -0
- data/ext/ice/cpp/src/Ice/LoggerI.h +57 -0
- data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +107 -0
- data/ext/ice/cpp/src/Ice/Makefile +190 -0
- data/ext/ice/cpp/src/Ice/Metrics.cpp +2159 -0
- data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +669 -0
- data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +14 -0
- data/ext/ice/cpp/src/Ice/Network.cpp +2694 -0
- data/ext/ice/cpp/src/Ice/Network.h +291 -0
- data/ext/ice/cpp/src/Ice/NetworkF.h +28 -0
- data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +325 -0
- data/ext/ice/cpp/src/Ice/NetworkProxy.h +74 -0
- data/ext/ice/cpp/src/Ice/NetworkProxyF.h +26 -0
- data/ext/ice/cpp/src/Ice/Object.cpp +440 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +241 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +52 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +1498 -0
- data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +155 -0
- data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +140 -0
- data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +43 -0
- data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +84 -0
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +407 -0
- data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +70 -0
- data/ext/ice/cpp/src/Ice/Outgoing.cpp +737 -0
- data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +874 -0
- data/ext/ice/cpp/src/Ice/Plugin.cpp +43 -0
- data/ext/ice/cpp/src/Ice/PluginF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +503 -0
- data/ext/ice/cpp/src/Ice/PluginManagerI.h +67 -0
- data/ext/ice/cpp/src/Ice/Process.cpp +299 -0
- data/ext/ice/cpp/src/Ice/ProcessF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/Properties.cpp +45 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +555 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +207 -0
- data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +45 -0
- data/ext/ice/cpp/src/Ice/PropertiesF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/PropertiesI.cpp +759 -0
- data/ext/ice/cpp/src/Ice/PropertiesI.h +78 -0
- data/ext/ice/cpp/src/Ice/PropertyNames.cpp +1293 -0
- data/ext/ice/cpp/src/Ice/PropertyNames.h +81 -0
- data/ext/ice/cpp/src/Ice/Protocol.cpp +137 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +98 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstance.h +91 -0
- data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +26 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +51 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +67 -0
- data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +26 -0
- data/ext/ice/cpp/src/Ice/Proxy.cpp +1810 -0
- data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +305 -0
- data/ext/ice/cpp/src/Ice/ProxyFactory.h +57 -0
- data/ext/ice/cpp/src/Ice/Reference.cpp +1947 -0
- data/ext/ice/cpp/src/Ice/Reference.h +305 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +937 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactory.h +81 -0
- data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +24 -0
- data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +958 -0
- data/ext/ice/cpp/src/Ice/ReplyStatus.h +29 -0
- data/ext/ice/cpp/src/Ice/RequestHandler.cpp +40 -0
- data/ext/ice/cpp/src/Ice/RequestHandler.h +90 -0
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +70 -0
- data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +41 -0
- data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +20 -0
- data/ext/ice/cpp/src/Ice/ResponseHandler.h +39 -0
- data/ext/ice/cpp/src/Ice/RetryQueue.cpp +154 -0
- data/ext/ice/cpp/src/Ice/RetryQueue.h +69 -0
- data/ext/ice/cpp/src/Ice/RetryQueueF.h +24 -0
- data/ext/ice/cpp/src/Ice/Router.cpp +849 -0
- data/ext/ice/cpp/src/Ice/RouterF.cpp +39 -0
- data/ext/ice/cpp/src/Ice/RouterInfo.cpp +381 -0
- data/ext/ice/cpp/src/Ice/RouterInfo.h +148 -0
- data/ext/ice/cpp/src/Ice/RouterInfoF.h +30 -0
- data/ext/ice/cpp/src/Ice/Selector.cpp +926 -0
- data/ext/ice/cpp/src/Ice/Selector.h +231 -0
- data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -0
- data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +38 -0
- data/ext/ice/cpp/src/Ice/ServantManager.cpp +495 -0
- data/ext/ice/cpp/src/Ice/ServantManager.h +74 -0
- data/ext/ice/cpp/src/Ice/Service.cpp +1897 -0
- data/ext/ice/cpp/src/Ice/SharedContext.h +51 -0
- data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +34 -0
- data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +80 -0
- data/ext/ice/cpp/src/Ice/SlicedData.cpp +80 -0
- data/ext/ice/cpp/src/Ice/Stream.cpp +53 -0
- data/ext/ice/cpp/src/Ice/StreamI.cpp +832 -0
- data/ext/ice/cpp/src/Ice/StreamI.h +198 -0
- data/ext/ice/cpp/src/Ice/StreamSocket.cpp +521 -0
- data/ext/ice/cpp/src/Ice/StreamSocket.h +85 -0
- data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +145 -0
- data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +167 -0
- data/ext/ice/cpp/src/Ice/SysLoggerI.h +43 -0
- data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +235 -0
- data/ext/ice/cpp/src/Ice/TcpAcceptor.h +67 -0
- data/ext/ice/cpp/src/Ice/TcpConnector.cpp +133 -0
- data/ext/ice/cpp/src/Ice/TcpConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +397 -0
- data/ext/ice/cpp/src/Ice/TcpEndpointI.h +93 -0
- data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +127 -0
- data/ext/ice/cpp/src/Ice/TcpTransceiver.h +61 -0
- data/ext/ice/cpp/src/Ice/ThreadPool.cpp +1357 -0
- data/ext/ice/cpp/src/Ice/ThreadPool.h +399 -0
- data/ext/ice/cpp/src/Ice/TraceLevels.cpp +43 -0
- data/ext/ice/cpp/src/Ice/TraceLevels.h +50 -0
- data/ext/ice/cpp/src/Ice/TraceLevelsF.h +26 -0
- data/ext/ice/cpp/src/Ice/TraceUtil.cpp +452 -0
- data/ext/ice/cpp/src/Ice/TraceUtil.h +28 -0
- data/ext/ice/cpp/src/Ice/Transceiver.cpp +24 -0
- data/ext/ice/cpp/src/Ice/Transceiver.h +52 -0
- data/ext/ice/cpp/src/Ice/TransceiverF.h +38 -0
- data/ext/ice/cpp/src/Ice/UdpConnector.cpp +144 -0
- data/ext/ice/cpp/src/Ice/UdpConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +483 -0
- data/ext/ice/cpp/src/Ice/UdpEndpointI.h +95 -0
- data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +1156 -0
- data/ext/ice/cpp/src/Ice/UdpTransceiver.h +123 -0
- data/ext/ice/cpp/src/Ice/Version.cpp +46 -0
- data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +103 -0
- data/ext/ice/cpp/src/Ice/WSAcceptor.h +61 -0
- data/ext/ice/cpp/src/Ice/WSConnector.cpp +113 -0
- data/ext/ice/cpp/src/Ice/WSConnector.h +51 -0
- data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +441 -0
- data/ext/ice/cpp/src/Ice/WSEndpoint.h +97 -0
- data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +1728 -0
- data/ext/ice/cpp/src/Ice/WSTransceiver.h +149 -0
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +594 -0
- data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1035 -0
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +208 -0
- data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +78 -0
- data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +308 -0
- data/ext/ice/cpp/src/IceDiscovery/LookupI.h +183 -0
- data/ext/ice/cpp/src/IceDiscovery/Makefile +61 -0
- data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +148 -0
- data/ext/ice/cpp/src/IceDiscovery/PluginI.h +39 -0
- data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +258 -0
- data/ext/ice/cpp/src/IceSSL/AcceptorI.h +66 -0
- data/ext/ice/cpp/src/IceSSL/Certificate.cpp +1334 -0
- data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -0
- data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +151 -0
- data/ext/ice/cpp/src/IceSSL/ConnectorI.h +56 -0
- data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +397 -0
- data/ext/ice/cpp/src/IceSSL/EndpointI.h +96 -0
- data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +41 -0
- data/ext/ice/cpp/src/IceSSL/Instance.cpp +38 -0
- data/ext/ice/cpp/src/IceSSL/Instance.h +42 -0
- data/ext/ice/cpp/src/IceSSL/InstanceF.h +34 -0
- data/ext/ice/cpp/src/IceSSL/Makefile +82 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +1001 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +607 -0
- data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +75 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.cpp +102 -0
- data/ext/ice/cpp/src/IceSSL/PluginI.h +56 -0
- data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +541 -0
- data/ext/ice/cpp/src/IceSSL/RFC2253.h +67 -0
- data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +729 -0
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +1062 -0
- data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +130 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +291 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngine.h +264 -0
- data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +41 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +1514 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +609 -0
- data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +91 -0
- data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +246 -0
- data/ext/ice/cpp/src/IceSSL/TrustManager.h +51 -0
- data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +26 -0
- data/ext/ice/cpp/src/IceSSL/Util.cpp +1423 -0
- data/ext/ice/cpp/src/IceSSL/Util.h +136 -0
- data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +65 -0
- data/ext/ice/cpp/src/IceUtil/ArgVector.h +41 -0
- data/ext/ice/cpp/src/IceUtil/Cond.cpp +386 -0
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +477 -0
- data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +144 -0
- data/ext/ice/cpp/src/IceUtil/CountDownLatch.cpp +184 -0
- data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +273 -0
- data/ext/ice/cpp/src/IceUtil/Exception.cpp +782 -0
- data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +532 -0
- data/ext/ice/cpp/src/IceUtil/FileUtil.h +159 -0
- data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +41 -0
- data/ext/ice/cpp/src/IceUtil/Makefile +68 -0
- data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +24 -0
- data/ext/ice/cpp/src/IceUtil/Options.cpp +1049 -0
- data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +591 -0
- data/ext/ice/cpp/src/IceUtil/Random.cpp +185 -0
- data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +257 -0
- data/ext/ice/cpp/src/IceUtil/SHA1.cpp +126 -0
- data/ext/ice/cpp/src/IceUtil/Shared.cpp +200 -0
- data/ext/ice/cpp/src/IceUtil/StopWatch.h +54 -0
- data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +450 -0
- data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +842 -0
- data/ext/ice/cpp/src/IceUtil/Thread.cpp +809 -0
- data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +172 -0
- data/ext/ice/cpp/src/IceUtil/Time.cpp +306 -0
- data/ext/ice/cpp/src/IceUtil/Timer.cpp +251 -0
- data/ext/ice/cpp/src/IceUtil/UUID.cpp +174 -0
- data/ext/ice/cpp/src/IceUtil/Unicode.cpp +131 -0
- data/ext/ice/cpp/src/IceUtil/Unicode.h +49 -0
- data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +1139 -0
- data/ext/ice/cpp/src/Slice/Checksum.cpp +452 -0
- data/ext/ice/cpp/src/Slice/CsUtil.cpp +2650 -0
- data/ext/ice/cpp/src/Slice/DotNetNames.cpp +146 -0
- data/ext/ice/cpp/src/Slice/FileTracker.cpp +203 -0
- data/ext/ice/cpp/src/Slice/Grammar.cpp +4755 -0
- data/ext/ice/cpp/src/Slice/Grammar.h +98 -0
- data/ext/ice/cpp/src/Slice/GrammarUtil.h +234 -0
- data/ext/ice/cpp/src/Slice/JavaUtil.cpp +4376 -0
- data/ext/ice/cpp/src/Slice/MD5.cpp +57 -0
- data/ext/ice/cpp/src/Slice/MD5.h +44 -0
- data/ext/ice/cpp/src/Slice/MD5I.cpp +385 -0
- data/ext/ice/cpp/src/Slice/MD5I.h +91 -0
- data/ext/ice/cpp/src/Slice/Makefile +65 -0
- data/ext/ice/cpp/src/Slice/PHPUtil.cpp +156 -0
- data/ext/ice/cpp/src/Slice/Parser.cpp +6386 -0
- data/ext/ice/cpp/src/Slice/Preprocessor.cpp +686 -0
- data/ext/ice/cpp/src/Slice/Python.cpp +675 -0
- data/ext/ice/cpp/src/Slice/PythonUtil.cpp +2614 -0
- data/ext/ice/cpp/src/Slice/Ruby.cpp +317 -0
- data/ext/ice/cpp/src/Slice/RubyUtil.cpp +1774 -0
- data/ext/ice/cpp/src/Slice/Scanner.cpp +2426 -0
- data/ext/ice/cpp/src/Slice/Util.cpp +325 -0
- data/ext/ice/mcpp/config.h.Darwin +227 -0
- data/ext/ice/mcpp/config.h.Linux +227 -0
- data/ext/ice/mcpp/config.h.MINGW +7 -0
- data/ext/ice/mcpp/configed.H +382 -0
- data/ext/ice/mcpp/directive.c +1699 -0
- data/ext/ice/mcpp/eval.c +1673 -0
- data/ext/ice/mcpp/expand.c +2980 -0
- data/ext/ice/mcpp/internal.H +564 -0
- data/ext/ice/mcpp/main.c +1131 -0
- data/ext/ice/mcpp/mbchar.c +869 -0
- data/ext/ice/mcpp/mcpp_lib.h +31 -0
- data/ext/ice/mcpp/mcpp_out.h +13 -0
- data/ext/ice/mcpp/support.c +2811 -0
- data/ext/ice/mcpp/system.H +396 -0
- data/ext/ice/mcpp/system.c +4940 -0
- data/ice.gemspec +41 -0
- data/lib/Glacier2.rb +12 -0
- data/lib/Glacier2/Metrics.rb +99 -0
- data/lib/Glacier2/PermissionsVerifier.rb +168 -0
- data/lib/Glacier2/PermissionsVerifierF.rb +34 -0
- data/lib/Glacier2/Router.rb +141 -0
- data/lib/Glacier2/RouterF.rb +29 -0
- data/lib/Glacier2/SSLInfo.rb +79 -0
- data/lib/Glacier2/Session.rb +470 -0
- data/lib/Ice.rb +659 -0
- data/lib/Ice/BuiltinSequences.rb +64 -0
- data/lib/Ice/Communicator.rb +93 -0
- data/lib/Ice/CommunicatorF.rb +28 -0
- data/lib/Ice/Connection.rb +414 -0
- data/lib/Ice/ConnectionF.rb +36 -0
- data/lib/Ice/Current.rb +152 -0
- data/lib/Ice/Endpoint.rb +265 -0
- data/lib/Ice/EndpointF.rb +52 -0
- data/lib/Ice/EndpointTypes.rb +77 -0
- data/lib/Ice/FacetMap.rb +28 -0
- data/lib/Ice/Identity.rb +70 -0
- data/lib/Ice/ImplicitContext.rb +59 -0
- data/lib/Ice/ImplicitContextF.rb +28 -0
- data/lib/Ice/Instrumentation.rb +425 -0
- data/lib/Ice/InstrumentationF.rb +35 -0
- data/lib/Ice/LocalException.rb +1081 -0
- data/lib/Ice/Locator.rb +314 -0
- data/lib/Ice/LocatorF.rb +34 -0
- data/lib/Ice/Logger.rb +57 -0
- data/lib/Ice/LoggerF.rb +28 -0
- data/lib/Ice/Metrics.rb +696 -0
- data/lib/Ice/ObjectAdapterF.rb +28 -0
- data/lib/Ice/ObjectFactory.rb +53 -0
- data/lib/Ice/ObjectFactoryF.rb +28 -0
- data/lib/Ice/Plugin.rb +87 -0
- data/lib/Ice/PluginF.rb +32 -0
- data/lib/Ice/Process.rb +93 -0
- data/lib/Ice/ProcessF.rb +29 -0
- data/lib/Ice/Properties.rb +65 -0
- data/lib/Ice/PropertiesAdmin.rb +104 -0
- data/lib/Ice/PropertiesF.rb +33 -0
- data/lib/Ice/Router.rb +163 -0
- data/lib/Ice/RouterF.rb +29 -0
- data/lib/Ice/SliceChecksumDict.rb +28 -0
- data/lib/Ice/Version.rb +100 -0
- data/lib/IceBox.rb +10 -0
- data/lib/IceBox/IceBox.rb +272 -0
- data/lib/IceGrid.rb +17 -0
- data/lib/IceGrid/Admin.rb +1076 -0
- data/lib/IceGrid/Descriptor.rb +1505 -0
- data/lib/IceGrid/Exception.rb +401 -0
- data/lib/IceGrid/FileParser.rb +105 -0
- data/lib/IceGrid/Locator.rb +105 -0
- data/lib/IceGrid/Observer.rb +571 -0
- data/lib/IceGrid/Query.rb +168 -0
- data/lib/IceGrid/Registry.rb +120 -0
- data/lib/IceGrid/Session.rb +114 -0
- data/lib/IceGrid/UserAccountMapper.rb +101 -0
- data/lib/IcePatch2.rb +10 -0
- data/lib/IcePatch2/FileInfo.rb +75 -0
- data/lib/IcePatch2/FileServer.rb +141 -0
- data/lib/IceStorm.rb +11 -0
- data/lib/IceStorm/IceStorm.rb +463 -0
- data/lib/IceStorm/Metrics.rb +155 -0
- data/slice/Freeze/BackgroundSaveEvictor.ice +111 -0
- data/slice/Freeze/CatalogData.ice +49 -0
- data/slice/Freeze/Connection.ice +111 -0
- data/slice/Freeze/ConnectionF.ice +20 -0
- data/slice/Freeze/DB.ice +37 -0
- data/slice/Freeze/Evictor.ice +339 -0
- data/slice/Freeze/EvictorF.ice +22 -0
- data/slice/Freeze/EvictorStorage.ice +72 -0
- data/slice/Freeze/Exception.ice +100 -0
- data/slice/Freeze/Transaction.ice +57 -0
- data/slice/Freeze/TransactionalEvictor.ice +50 -0
- data/slice/Glacier2/Metrics.ice +77 -0
- data/slice/Glacier2/PermissionsVerifier.ice +105 -0
- data/slice/Glacier2/PermissionsVerifierF.ice +21 -0
- data/slice/Glacier2/Router.ice +178 -0
- data/slice/Glacier2/RouterF.ice +20 -0
- data/slice/Glacier2/SSLInfo.ice +50 -0
- data/slice/Glacier2/Session.ice +273 -0
- data/slice/Ice/BuiltinSequences.ice +48 -0
- data/slice/Ice/Communicator.ice +567 -0
- data/slice/Ice/CommunicatorF.ice +20 -0
- data/slice/Ice/Connection.ice +323 -0
- data/slice/Ice/ConnectionF.ice +22 -0
- data/slice/Ice/Current.ice +160 -0
- data/slice/Ice/Endpoint.ice +227 -0
- data/slice/Ice/EndpointF.ice +32 -0
- data/slice/Ice/EndpointTypes.ice +38 -0
- data/slice/Ice/FacetMap.ice +25 -0
- data/slice/Ice/Identity.ice +59 -0
- data/slice/Ice/ImplicitContext.ice +109 -0
- data/slice/Ice/ImplicitContextF.ice +20 -0
- data/slice/Ice/Instrumentation.ice +499 -0
- data/slice/Ice/InstrumentationF.ice +26 -0
- data/slice/Ice/LocalException.ice +1015 -0
- data/slice/Ice/Locator.ice +227 -0
- data/slice/Ice/LocatorF.ice +21 -0
- data/slice/Ice/Logger.ice +86 -0
- data/slice/Ice/LoggerF.ice +20 -0
- data/slice/Ice/Metrics.ice +422 -0
- data/slice/Ice/ObjectAdapter.ice +673 -0
- data/slice/Ice/ObjectAdapterF.ice +20 -0
- data/slice/Ice/ObjectFactory.ice +60 -0
- data/slice/Ice/ObjectFactoryF.ice +20 -0
- data/slice/Ice/Plugin.ice +117 -0
- data/slice/Ice/PluginF.ice +21 -0
- data/slice/Ice/Process.ice +54 -0
- data/slice/Ice/ProcessF.ice +20 -0
- data/slice/Ice/Properties.ice +228 -0
- data/slice/Ice/PropertiesAdmin.ice +75 -0
- data/slice/Ice/PropertiesF.ice +21 -0
- data/slice/Ice/RemoteLogger.ice +232 -0
- data/slice/Ice/Router.ice +83 -0
- data/slice/Ice/RouterF.ice +20 -0
- data/slice/Ice/ServantLocator.ice +117 -0
- data/slice/Ice/ServantLocatorF.ice +20 -0
- data/slice/Ice/SliceChecksumDict.ice +25 -0
- data/slice/Ice/Version.ice +39 -0
- data/slice/IceBox/IceBox.ice +194 -0
- data/slice/IceDiscovery/IceDiscovery.ice +32 -0
- data/slice/IceGrid/Admin.ice +1578 -0
- data/slice/IceGrid/Descriptor.ice +1079 -0
- data/slice/IceGrid/Discovery.ice +73 -0
- data/slice/IceGrid/Exception.ice +383 -0
- data/slice/IceGrid/FileParser.ice +61 -0
- data/slice/IceGrid/Locator.ice +56 -0
- data/slice/IceGrid/Observer.ice +394 -0
- data/slice/IceGrid/PluginFacade.ice +316 -0
- data/slice/IceGrid/Query.ice +130 -0
- data/slice/IceGrid/Registry.ice +138 -0
- data/slice/IceGrid/Session.ice +124 -0
- data/slice/IceGrid/UserAccountMapper.ice +58 -0
- data/slice/IcePatch2/FileInfo.ice +49 -0
- data/slice/IcePatch2/FileServer.ice +129 -0
- data/slice/IceSSL/ConnectionInfo.ice +34 -0
- data/slice/IceSSL/EndpointInfo.ice +41 -0
- data/slice/IceStorm/IceStorm.ice +405 -0
- data/slice/IceStorm/Metrics.ice +71 -0
- metadata +737 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
// **********************************************************************
|
2
|
+
//
|
3
|
+
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
|
4
|
+
//
|
5
|
+
// This copy of Ice is licensed to you under the terms described in the
|
6
|
+
// ICE_LICENSE file included in this distribution.
|
7
|
+
//
|
8
|
+
// **********************************************************************
|
9
|
+
|
10
|
+
#ifndef ICE_SERVANT_MANAGER_H
|
11
|
+
#define ICE_SERVANT_MANAGER_H
|
12
|
+
|
13
|
+
#include <IceUtil/Shared.h>
|
14
|
+
#include <IceUtil/Mutex.h>
|
15
|
+
#include <Ice/ServantManagerF.h>
|
16
|
+
#include <Ice/InstanceF.h>
|
17
|
+
#include <Ice/ServantLocatorF.h>
|
18
|
+
#include <Ice/Identity.h>
|
19
|
+
#include <Ice/FacetMap.h>
|
20
|
+
|
21
|
+
namespace Ice
|
22
|
+
{
|
23
|
+
|
24
|
+
class ObjectAdapterI;
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
namespace IceInternal
|
29
|
+
{
|
30
|
+
|
31
|
+
class ServantManager : public IceUtil::Shared, public IceUtil::Mutex
|
32
|
+
{
|
33
|
+
public:
|
34
|
+
|
35
|
+
void addServant(const Ice::ObjectPtr&, const Ice::Identity&, const std::string&);
|
36
|
+
void addDefaultServant(const Ice::ObjectPtr&, const std::string&);
|
37
|
+
Ice::ObjectPtr removeServant(const Ice::Identity&, const std::string&);
|
38
|
+
Ice::ObjectPtr removeDefaultServant(const std::string&);
|
39
|
+
Ice::FacetMap removeAllFacets(const Ice::Identity&);
|
40
|
+
Ice::ObjectPtr findServant(const Ice::Identity&, const std::string&) const;
|
41
|
+
Ice::ObjectPtr findDefaultServant(const std::string&) const;
|
42
|
+
Ice::FacetMap findAllFacets(const Ice::Identity&) const;
|
43
|
+
bool hasServant(const Ice::Identity&) const;
|
44
|
+
|
45
|
+
void addServantLocator(const Ice::ServantLocatorPtr& locator, const std::string&);
|
46
|
+
Ice::ServantLocatorPtr removeServantLocator(const std::string&);
|
47
|
+
Ice::ServantLocatorPtr findServantLocator(const std::string&) const;
|
48
|
+
|
49
|
+
private:
|
50
|
+
|
51
|
+
ServantManager(const InstancePtr&, const std::string&);
|
52
|
+
~ServantManager();
|
53
|
+
void destroy();
|
54
|
+
friend class Ice::ObjectAdapterI;
|
55
|
+
|
56
|
+
InstancePtr _instance;
|
57
|
+
|
58
|
+
const std::string _adapterName;
|
59
|
+
|
60
|
+
typedef std::map<Ice::Identity, Ice::FacetMap> ServantMapMap;
|
61
|
+
typedef std::map<std::string, Ice::ObjectPtr> DefaultServantMap;
|
62
|
+
|
63
|
+
ServantMapMap _servantMapMap;
|
64
|
+
mutable ServantMapMap::iterator _servantMapMapHint;
|
65
|
+
|
66
|
+
DefaultServantMap _defaultServantMap;
|
67
|
+
|
68
|
+
std::map<std::string, Ice::ServantLocatorPtr> _locatorMap;
|
69
|
+
mutable std::map<std::string, Ice::ServantLocatorPtr>::iterator _locatorMapHint;
|
70
|
+
};
|
71
|
+
|
72
|
+
}
|
73
|
+
|
74
|
+
#endif
|
@@ -0,0 +1,1897 @@
|
|
1
|
+
// **********************************************************************
|
2
|
+
//
|
3
|
+
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
|
4
|
+
//
|
5
|
+
// This copy of Ice is licensed to you under the terms described in the
|
6
|
+
// ICE_LICENSE file included in this distribution.
|
7
|
+
//
|
8
|
+
// **********************************************************************
|
9
|
+
|
10
|
+
#include <IceUtil/CtrlCHandler.h>
|
11
|
+
#include <IceUtil/StringUtil.h>
|
12
|
+
#include <IceUtil/Thread.h>
|
13
|
+
#include <IceUtil/Monitor.h>
|
14
|
+
#include <IceUtil/Mutex.h>
|
15
|
+
#include <IceUtil/ArgVector.h>
|
16
|
+
#include <IceUtil/FileUtil.h>
|
17
|
+
#include <IceUtil/StringConverter.h>
|
18
|
+
#include <Ice/Service.h>
|
19
|
+
#include <Ice/LoggerI.h>
|
20
|
+
#include <Ice/Initialize.h>
|
21
|
+
#include <Ice/Communicator.h>
|
22
|
+
#include <Ice/LocalException.h>
|
23
|
+
#include <Ice/Properties.h>
|
24
|
+
#include <Ice/Instance.h>
|
25
|
+
#include <Ice/LoggerUtil.h>
|
26
|
+
|
27
|
+
#ifdef _WIN32
|
28
|
+
# include <winsock2.h>
|
29
|
+
# include <Ice/EventLoggerMsg.h>
|
30
|
+
#else
|
31
|
+
# include <Ice/Logger.h>
|
32
|
+
# include <Ice/Network.h>
|
33
|
+
# include <sys/types.h>
|
34
|
+
# include <sys/stat.h>
|
35
|
+
# include <csignal>
|
36
|
+
#endif
|
37
|
+
|
38
|
+
using namespace std;
|
39
|
+
using namespace Ice;
|
40
|
+
|
41
|
+
Ice::Service* Ice::Service::_instance = 0;
|
42
|
+
static IceUtil::CtrlCHandler* _ctrlCHandler = 0;
|
43
|
+
|
44
|
+
//
|
45
|
+
// Callback for IceUtil::CtrlCHandler.
|
46
|
+
//
|
47
|
+
static void
|
48
|
+
ctrlCHandlerCallback(int sig)
|
49
|
+
{
|
50
|
+
Ice::Service* service = Ice::Service::instance();
|
51
|
+
assert(service != 0);
|
52
|
+
service->handleInterrupt(sig);
|
53
|
+
}
|
54
|
+
|
55
|
+
#ifdef _WIN32
|
56
|
+
|
57
|
+
//
|
58
|
+
// Main function for Win32 service.
|
59
|
+
//
|
60
|
+
void WINAPI
|
61
|
+
Ice_Service_ServiceMain(DWORD argc, LPWSTR* argv)
|
62
|
+
{
|
63
|
+
Ice::Service* service = Ice::Service::instance();
|
64
|
+
assert(service != 0);
|
65
|
+
service->serviceMain(argc, argv);
|
66
|
+
}
|
67
|
+
|
68
|
+
//
|
69
|
+
// Win32 service control handler.
|
70
|
+
//
|
71
|
+
void WINAPI
|
72
|
+
Ice_Service_CtrlHandler(DWORD ctrl)
|
73
|
+
{
|
74
|
+
Ice::Service* service = Ice::Service::instance();
|
75
|
+
assert(service != 0);
|
76
|
+
service->control(ctrl);
|
77
|
+
}
|
78
|
+
|
79
|
+
namespace
|
80
|
+
{
|
81
|
+
|
82
|
+
class ServiceStatusManager : public IceUtil::Monitor<IceUtil::Mutex>
|
83
|
+
{
|
84
|
+
public:
|
85
|
+
|
86
|
+
ServiceStatusManager(SERVICE_STATUS_HANDLE);
|
87
|
+
|
88
|
+
//
|
89
|
+
// Start a thread to provide regular status updates to the SCM.
|
90
|
+
//
|
91
|
+
void startUpdate(DWORD);
|
92
|
+
|
93
|
+
//
|
94
|
+
// Stop the update thread.
|
95
|
+
//
|
96
|
+
void stopUpdate();
|
97
|
+
|
98
|
+
//
|
99
|
+
// Change the service status and report it (once).
|
100
|
+
//
|
101
|
+
void changeStatus(DWORD, DWORD);
|
102
|
+
|
103
|
+
//
|
104
|
+
// Report the current status.
|
105
|
+
//
|
106
|
+
void reportStatus();
|
107
|
+
|
108
|
+
private:
|
109
|
+
|
110
|
+
void run();
|
111
|
+
|
112
|
+
class StatusThread : public IceUtil::Thread
|
113
|
+
{
|
114
|
+
public:
|
115
|
+
|
116
|
+
StatusThread(ServiceStatusManager* manager) :
|
117
|
+
IceUtil::Thread("Ice service status manager thread"),
|
118
|
+
_manager(manager)
|
119
|
+
{
|
120
|
+
}
|
121
|
+
|
122
|
+
virtual void run()
|
123
|
+
{
|
124
|
+
_manager->run();
|
125
|
+
}
|
126
|
+
|
127
|
+
private:
|
128
|
+
|
129
|
+
ServiceStatusManager* _manager;
|
130
|
+
};
|
131
|
+
friend class StatusThread;
|
132
|
+
|
133
|
+
SERVICE_STATUS_HANDLE _handle;
|
134
|
+
SERVICE_STATUS _status;
|
135
|
+
IceUtil::ThreadPtr _thread;
|
136
|
+
bool _stopped;
|
137
|
+
};
|
138
|
+
|
139
|
+
static ServiceStatusManager* serviceStatusManager;
|
140
|
+
|
141
|
+
//
|
142
|
+
// Interface implemented by SMEventLoggerI and called from
|
143
|
+
// SMEventLoggerIWrapper.
|
144
|
+
//
|
145
|
+
class SMEventLogger : public IceUtil::Shared
|
146
|
+
{
|
147
|
+
public:
|
148
|
+
virtual void print(const string&, const string&) = 0;
|
149
|
+
virtual void trace(const string&, const string&, const string&) = 0;
|
150
|
+
virtual void warning(const string&, const string&) = 0;
|
151
|
+
virtual void error(const string&, const string&) = 0;
|
152
|
+
};
|
153
|
+
typedef IceUtil::Handle<SMEventLogger> SMEventLoggerPtr;
|
154
|
+
|
155
|
+
class SMEventLoggerIWrapper : public Ice::Logger
|
156
|
+
{
|
157
|
+
public:
|
158
|
+
|
159
|
+
SMEventLoggerIWrapper(const SMEventLoggerPtr& logger, const string& prefix) :
|
160
|
+
_logger(logger),
|
161
|
+
_prefix(prefix)
|
162
|
+
{
|
163
|
+
assert(_logger);
|
164
|
+
}
|
165
|
+
|
166
|
+
virtual void
|
167
|
+
print(const string& message)
|
168
|
+
{
|
169
|
+
_logger->print(_prefix, message);
|
170
|
+
}
|
171
|
+
|
172
|
+
void
|
173
|
+
trace(const string& category, const string& message)
|
174
|
+
{
|
175
|
+
_logger->trace(_prefix, category, message);
|
176
|
+
}
|
177
|
+
|
178
|
+
virtual void
|
179
|
+
warning(const string& message)
|
180
|
+
{
|
181
|
+
_logger->warning(_prefix, message);
|
182
|
+
}
|
183
|
+
|
184
|
+
virtual void
|
185
|
+
error(const string& message)
|
186
|
+
{
|
187
|
+
_logger->error(_prefix, message);
|
188
|
+
}
|
189
|
+
|
190
|
+
virtual string
|
191
|
+
getPrefix()
|
192
|
+
{
|
193
|
+
return _prefix;
|
194
|
+
}
|
195
|
+
|
196
|
+
virtual Ice::LoggerPtr
|
197
|
+
cloneWithPrefix(const string& prefix)
|
198
|
+
{
|
199
|
+
return new SMEventLoggerIWrapper(_logger, prefix);
|
200
|
+
}
|
201
|
+
|
202
|
+
private:
|
203
|
+
|
204
|
+
SMEventLoggerPtr _logger;
|
205
|
+
const string _prefix;
|
206
|
+
};
|
207
|
+
|
208
|
+
class SMEventLoggerI : public SMEventLogger
|
209
|
+
{
|
210
|
+
public:
|
211
|
+
|
212
|
+
SMEventLoggerI(const string& source, const IceUtil::StringConverterPtr& stringConverter) :
|
213
|
+
_stringConverter(stringConverter)
|
214
|
+
{
|
215
|
+
//
|
216
|
+
// Don't need to use a wide string converter as the wide string is passed
|
217
|
+
// to Windows API.
|
218
|
+
//
|
219
|
+
_source = RegisterEventSourceW(0, IceUtil::stringToWstring(mangleSource(source), _stringConverter).c_str());
|
220
|
+
if(_source == 0)
|
221
|
+
{
|
222
|
+
SyscallException ex(__FILE__, __LINE__);
|
223
|
+
ex.error = GetLastError();
|
224
|
+
throw ex;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
~SMEventLoggerI()
|
229
|
+
{
|
230
|
+
assert(_source != 0);
|
231
|
+
DeregisterEventSource(_source);
|
232
|
+
}
|
233
|
+
|
234
|
+
static void
|
235
|
+
addKeys(const string& source, const IceUtil::StringConverterPtr& stringConverter)
|
236
|
+
{
|
237
|
+
HKEY hKey;
|
238
|
+
DWORD d;
|
239
|
+
//
|
240
|
+
// Don't need to use a wide string converter as the wide string is passed
|
241
|
+
// to Windows API.
|
242
|
+
//
|
243
|
+
LONG err = RegCreateKeyExW(HKEY_LOCAL_MACHINE,
|
244
|
+
IceUtil::stringToWstring(createKey(source), stringConverter).c_str(),
|
245
|
+
0, const_cast<wchar_t*>(L"REG_SZ"), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, &d);
|
246
|
+
|
247
|
+
if(err != ERROR_SUCCESS)
|
248
|
+
{
|
249
|
+
SyscallException ex(__FILE__, __LINE__);
|
250
|
+
ex.error = err;
|
251
|
+
throw ex;
|
252
|
+
}
|
253
|
+
|
254
|
+
//
|
255
|
+
// Get the filename of this DLL.
|
256
|
+
//
|
257
|
+
wchar_t path[_MAX_PATH];
|
258
|
+
assert(_module != 0);
|
259
|
+
if(!GetModuleFileNameW(_module, path, _MAX_PATH))
|
260
|
+
{
|
261
|
+
RegCloseKey(hKey);
|
262
|
+
SyscallException ex(__FILE__, __LINE__);
|
263
|
+
ex.error = GetLastError();
|
264
|
+
throw ex;
|
265
|
+
}
|
266
|
+
|
267
|
+
//
|
268
|
+
// The event resources are bundled into this DLL, therefore
|
269
|
+
// the "EventMessageFile" key should contain the path to this
|
270
|
+
// DLL.
|
271
|
+
//
|
272
|
+
err = RegSetValueExW(hKey, L"EventMessageFile", 0, REG_EXPAND_SZ, reinterpret_cast<unsigned char*>(path),
|
273
|
+
static_cast<DWORD>((wcslen(path) * sizeof(wchar_t)) + 1));
|
274
|
+
|
275
|
+
if(err == ERROR_SUCCESS)
|
276
|
+
{
|
277
|
+
//
|
278
|
+
// The "TypesSupported" key indicates the supported event
|
279
|
+
// types.
|
280
|
+
//
|
281
|
+
DWORD typesSupported = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
|
282
|
+
err = RegSetValueExW(hKey, L"TypesSupported", 0, REG_DWORD,
|
283
|
+
reinterpret_cast<unsigned char*>(&typesSupported), sizeof(typesSupported));
|
284
|
+
}
|
285
|
+
if(err != ERROR_SUCCESS)
|
286
|
+
{
|
287
|
+
RegCloseKey(hKey);
|
288
|
+
SyscallException ex(__FILE__, __LINE__);
|
289
|
+
ex.error = err;
|
290
|
+
throw ex;
|
291
|
+
}
|
292
|
+
|
293
|
+
RegCloseKey(hKey);
|
294
|
+
}
|
295
|
+
|
296
|
+
static void
|
297
|
+
removeKeys(const string& source, const IceUtil::StringConverterPtr& stringConverter)
|
298
|
+
{
|
299
|
+
//
|
300
|
+
// Don't need to use a wide string converter as the wide string is passed
|
301
|
+
// to Windows API.
|
302
|
+
//
|
303
|
+
LONG err = RegDeleteKeyW(HKEY_LOCAL_MACHINE,
|
304
|
+
IceUtil::stringToWstring(createKey(source), stringConverter).c_str());
|
305
|
+
if(err != ERROR_SUCCESS)
|
306
|
+
{
|
307
|
+
SyscallException ex(__FILE__, __LINE__);
|
308
|
+
ex.error = err;
|
309
|
+
throw ex;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
virtual void
|
314
|
+
print(const string& prefix, const string& message)
|
315
|
+
{
|
316
|
+
string s;
|
317
|
+
if(!prefix.empty())
|
318
|
+
{
|
319
|
+
s = prefix;
|
320
|
+
s.append(": ");
|
321
|
+
}
|
322
|
+
s.append(message);
|
323
|
+
print(s);
|
324
|
+
}
|
325
|
+
|
326
|
+
void
|
327
|
+
print(const string& message)
|
328
|
+
{
|
329
|
+
//
|
330
|
+
// Don't need to use a wide string converter as the wide string is passed
|
331
|
+
// to Windows API.
|
332
|
+
//
|
333
|
+
wstring msg = IceUtil::stringToWstring(message, _stringConverter);
|
334
|
+
const wchar_t* messages[1];
|
335
|
+
messages[0] = msg.c_str();
|
336
|
+
//
|
337
|
+
// We ignore any failures from ReportEvent since there isn't
|
338
|
+
// anything we can do about it.
|
339
|
+
//
|
340
|
+
ReportEventW(_source, EVENTLOG_INFORMATION_TYPE, 0, EVENT_LOGGER_MSG, 0, 1, 0, messages, 0);
|
341
|
+
}
|
342
|
+
|
343
|
+
virtual void
|
344
|
+
trace(const string& prefix, const string& category, const string& message)
|
345
|
+
{
|
346
|
+
string s;
|
347
|
+
if(!category.empty())
|
348
|
+
{
|
349
|
+
s = category;
|
350
|
+
s.append(": ");
|
351
|
+
}
|
352
|
+
s.append(message);
|
353
|
+
trace(prefix, s);
|
354
|
+
}
|
355
|
+
|
356
|
+
void
|
357
|
+
trace(const string& category, const string& message)
|
358
|
+
{
|
359
|
+
string s;
|
360
|
+
if(!category.empty())
|
361
|
+
{
|
362
|
+
s = category;
|
363
|
+
s.append(": ");
|
364
|
+
}
|
365
|
+
s.append(message);
|
366
|
+
|
367
|
+
//
|
368
|
+
// Don't need to use a wide string converter as the wide string is passed
|
369
|
+
// to Windows API.
|
370
|
+
//
|
371
|
+
wstring msg = IceUtil::stringToWstring(s, _stringConverter);
|
372
|
+
const wchar_t* messages[1];
|
373
|
+
messages[0] = msg.c_str();
|
374
|
+
//
|
375
|
+
// We ignore any failures from ReportEvent since there isn't
|
376
|
+
// anything we can do about it.
|
377
|
+
//
|
378
|
+
ReportEventW(_source, EVENTLOG_INFORMATION_TYPE, 0, EVENT_LOGGER_MSG, 0, 1, 0, messages, 0);
|
379
|
+
}
|
380
|
+
|
381
|
+
virtual void
|
382
|
+
warning(const string& prefix, const string& message)
|
383
|
+
{
|
384
|
+
string s;
|
385
|
+
if(!prefix.empty())
|
386
|
+
{
|
387
|
+
s = prefix;
|
388
|
+
s.append(": ");
|
389
|
+
}
|
390
|
+
s.append(message);
|
391
|
+
warning(s);
|
392
|
+
}
|
393
|
+
|
394
|
+
void
|
395
|
+
warning(const string& message)
|
396
|
+
{
|
397
|
+
//
|
398
|
+
// Don't need to use a wide string converter as the wide string is passed
|
399
|
+
// to Windows API.
|
400
|
+
//
|
401
|
+
wstring msg = IceUtil::stringToWstring(message, _stringConverter);
|
402
|
+
const wchar_t* messages[1];
|
403
|
+
messages[0] = msg.c_str();
|
404
|
+
//
|
405
|
+
// We ignore any failures from ReportEvent since there isn't
|
406
|
+
// anything we can do about it.
|
407
|
+
//
|
408
|
+
ReportEventW(_source, EVENTLOG_WARNING_TYPE, 0, EVENT_LOGGER_MSG, 0, 1, 0, messages, 0);
|
409
|
+
}
|
410
|
+
|
411
|
+
virtual void
|
412
|
+
error(const string& prefix, const string& message)
|
413
|
+
{
|
414
|
+
string s;
|
415
|
+
if(!prefix.empty())
|
416
|
+
{
|
417
|
+
s = prefix;
|
418
|
+
s.append(": ");
|
419
|
+
}
|
420
|
+
s.append(message);
|
421
|
+
error(s);
|
422
|
+
}
|
423
|
+
|
424
|
+
void
|
425
|
+
error(const string& message)
|
426
|
+
{
|
427
|
+
//
|
428
|
+
// Don't need to use a wide string converter as the wide string is passed
|
429
|
+
// to Windows API.
|
430
|
+
//
|
431
|
+
wstring msg = IceUtil::stringToWstring(message, _stringConverter);
|
432
|
+
const wchar_t* messages[1];
|
433
|
+
messages[0] = msg.c_str();
|
434
|
+
//
|
435
|
+
// We ignore any failures from ReportEvent since there isn't
|
436
|
+
// anything we can do about it.
|
437
|
+
//
|
438
|
+
ReportEventW(_source, EVENTLOG_ERROR_TYPE, 0, EVENT_LOGGER_MSG, 0, 1, 0, messages, 0);
|
439
|
+
}
|
440
|
+
|
441
|
+
static void
|
442
|
+
setModuleHandle(HMODULE module)
|
443
|
+
{
|
444
|
+
_module = module;
|
445
|
+
}
|
446
|
+
|
447
|
+
private:
|
448
|
+
|
449
|
+
static string
|
450
|
+
mangleSource(string name)
|
451
|
+
{
|
452
|
+
//
|
453
|
+
// The source name cannot contain backslashes.
|
454
|
+
//
|
455
|
+
string::size_type pos = 0;
|
456
|
+
while((pos = name.find('\\', pos)) != string::npos)
|
457
|
+
{
|
458
|
+
name[pos] = '/';
|
459
|
+
}
|
460
|
+
return name;
|
461
|
+
}
|
462
|
+
|
463
|
+
static string
|
464
|
+
createKey(string name)
|
465
|
+
{
|
466
|
+
//
|
467
|
+
// The registry key is:
|
468
|
+
//
|
469
|
+
// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application.
|
470
|
+
//
|
471
|
+
return "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\" + mangleSource(name);
|
472
|
+
}
|
473
|
+
|
474
|
+
IceUtil::StringConverterPtr _stringConverter;
|
475
|
+
HANDLE _source;
|
476
|
+
static HMODULE _module;
|
477
|
+
};
|
478
|
+
|
479
|
+
HMODULE SMEventLoggerI::_module = 0;
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
#endif
|
484
|
+
|
485
|
+
Ice::Service::Service()
|
486
|
+
{
|
487
|
+
assert(_instance == 0);
|
488
|
+
_nohup = true;
|
489
|
+
_service = false;
|
490
|
+
_instance = this;
|
491
|
+
#ifndef _WIN32
|
492
|
+
_changeDirectory = true;
|
493
|
+
_closeFiles = true;
|
494
|
+
#endif
|
495
|
+
}
|
496
|
+
|
497
|
+
Ice::Service::~Service()
|
498
|
+
{
|
499
|
+
_instance = 0;
|
500
|
+
delete _ctrlCHandler;
|
501
|
+
}
|
502
|
+
|
503
|
+
bool
|
504
|
+
Ice::Service::shutdown()
|
505
|
+
{
|
506
|
+
if(_communicator)
|
507
|
+
{
|
508
|
+
try
|
509
|
+
{
|
510
|
+
_communicator->shutdown();
|
511
|
+
}
|
512
|
+
catch(const CommunicatorDestroyedException&)
|
513
|
+
{
|
514
|
+
//
|
515
|
+
// Expected if the service communicator is being destroyed.
|
516
|
+
//
|
517
|
+
}
|
518
|
+
catch(const std::exception& ex)
|
519
|
+
{
|
520
|
+
ServiceWarning warn(this);
|
521
|
+
warn << "exception during shutdown:\n" << ex;
|
522
|
+
}
|
523
|
+
catch(...)
|
524
|
+
{
|
525
|
+
warning("unknown exception during shutdown");
|
526
|
+
}
|
527
|
+
}
|
528
|
+
return true;
|
529
|
+
}
|
530
|
+
|
531
|
+
void
|
532
|
+
Ice::Service::interrupt()
|
533
|
+
{
|
534
|
+
shutdown();
|
535
|
+
}
|
536
|
+
|
537
|
+
int
|
538
|
+
Ice::Service::main(int& argc, char* argv[], const InitializationData& initializationData)
|
539
|
+
{
|
540
|
+
_name = "";
|
541
|
+
if(argc > 0)
|
542
|
+
{
|
543
|
+
_name = argv[0];
|
544
|
+
}
|
545
|
+
|
546
|
+
//
|
547
|
+
// We parse the properties here to extract Ice.ProgramName and
|
548
|
+
// Ice.EventLog.Source on Windows.
|
549
|
+
//
|
550
|
+
InitializationData initData = initializationData;
|
551
|
+
try
|
552
|
+
{
|
553
|
+
initData.properties = createProperties(argc, argv, initData.properties);
|
554
|
+
}
|
555
|
+
catch(const Ice::Exception& ex)
|
556
|
+
{
|
557
|
+
ServiceError err(this);
|
558
|
+
err << "createProperties failed: " << ex;
|
559
|
+
return EXIT_FAILURE;
|
560
|
+
}
|
561
|
+
|
562
|
+
#ifdef _WIN32
|
563
|
+
|
564
|
+
//
|
565
|
+
// First check for the --service option.
|
566
|
+
//
|
567
|
+
string name;
|
568
|
+
string eventLogSource;
|
569
|
+
int idx = 1;
|
570
|
+
const IceUtil::StringConverterPtr stringConverter = IceUtil::getProcessStringConverter();
|
571
|
+
while(idx < argc)
|
572
|
+
{
|
573
|
+
if(strcmp(argv[idx], "--service") == 0)
|
574
|
+
{
|
575
|
+
if(idx + 1 >= argc)
|
576
|
+
{
|
577
|
+
error("service name argument expected for `" + string(argv[idx]) + "'");
|
578
|
+
return EXIT_FAILURE;
|
579
|
+
}
|
580
|
+
|
581
|
+
name = argv[idx + 1];
|
582
|
+
|
583
|
+
//
|
584
|
+
// If the process logger is the default logger then we use
|
585
|
+
// our own logger.
|
586
|
+
//
|
587
|
+
_logger = getProcessLogger();
|
588
|
+
if(LoggerIPtr::dynamicCast(_logger))
|
589
|
+
{
|
590
|
+
string eventLogSource = initData.properties->getPropertyWithDefault("Ice.EventLog.Source", name);
|
591
|
+
_logger = new SMEventLoggerIWrapper(new SMEventLoggerI(eventLogSource, stringConverter), "");
|
592
|
+
setProcessLogger(_logger);
|
593
|
+
}
|
594
|
+
|
595
|
+
for(int i = idx; i + 2 < argc; ++i)
|
596
|
+
{
|
597
|
+
argv[i] = argv[i + 2];
|
598
|
+
}
|
599
|
+
argc -= 2;
|
600
|
+
}
|
601
|
+
else
|
602
|
+
{
|
603
|
+
++idx;
|
604
|
+
}
|
605
|
+
}
|
606
|
+
|
607
|
+
if(!name.empty())
|
608
|
+
{
|
609
|
+
configureService(name);
|
610
|
+
}
|
611
|
+
#else
|
612
|
+
//
|
613
|
+
// Check for --daemon, --noclose, --nochdir and --pidfile.
|
614
|
+
//
|
615
|
+
|
616
|
+
bool daemonize = false;
|
617
|
+
bool closeFiles = true;
|
618
|
+
bool changeDirectory = true;
|
619
|
+
string pidFile;
|
620
|
+
int idx = 1;
|
621
|
+
while(idx < argc)
|
622
|
+
{
|
623
|
+
if(strcmp(argv[idx], "--daemon") == 0)
|
624
|
+
{
|
625
|
+
for(int i = idx; i + 1 < argc; ++i)
|
626
|
+
{
|
627
|
+
argv[i] = argv[i + 1];
|
628
|
+
}
|
629
|
+
argc -= 1;
|
630
|
+
|
631
|
+
daemonize = true;
|
632
|
+
}
|
633
|
+
else if(strcmp(argv[idx], "--noclose") == 0)
|
634
|
+
{
|
635
|
+
for(int i = idx; i + 1 < argc; ++i)
|
636
|
+
{
|
637
|
+
argv[i] = argv[i + 1];
|
638
|
+
}
|
639
|
+
argc -= 1;
|
640
|
+
|
641
|
+
closeFiles = false;
|
642
|
+
}
|
643
|
+
else if(strcmp(argv[idx], "--nochdir") == 0)
|
644
|
+
{
|
645
|
+
for(int i = idx; i + 1 < argc; ++i)
|
646
|
+
{
|
647
|
+
argv[i] = argv[i + 1];
|
648
|
+
}
|
649
|
+
argc -= 1;
|
650
|
+
|
651
|
+
changeDirectory = false;
|
652
|
+
}
|
653
|
+
else if(strcmp(argv[idx], "--pidfile") == 0)
|
654
|
+
{
|
655
|
+
if(idx + 1 < argc)
|
656
|
+
{
|
657
|
+
pidFile = argv[idx + 1];
|
658
|
+
}
|
659
|
+
else
|
660
|
+
{
|
661
|
+
if(argv[0])
|
662
|
+
{
|
663
|
+
cerr << argv[0] << ": ";
|
664
|
+
}
|
665
|
+
cerr << "--pidfile must be followed by an argument" << endl;
|
666
|
+
return EXIT_FAILURE;
|
667
|
+
}
|
668
|
+
|
669
|
+
for(int i = idx; i + 2 < argc; ++i)
|
670
|
+
{
|
671
|
+
argv[i] = argv[i + 2];
|
672
|
+
}
|
673
|
+
argc -= 2;
|
674
|
+
}
|
675
|
+
else
|
676
|
+
{
|
677
|
+
++idx;
|
678
|
+
}
|
679
|
+
}
|
680
|
+
|
681
|
+
if(!closeFiles && !daemonize)
|
682
|
+
{
|
683
|
+
if(argv[0])
|
684
|
+
{
|
685
|
+
cerr << argv[0] << ": ";
|
686
|
+
}
|
687
|
+
cerr << "--noclose must be used with --daemon" << endl;
|
688
|
+
return EXIT_FAILURE;
|
689
|
+
}
|
690
|
+
|
691
|
+
if(pidFile.size() > 0 && !daemonize)
|
692
|
+
{
|
693
|
+
if(argv[0])
|
694
|
+
{
|
695
|
+
cerr << argv[0] << ": ";
|
696
|
+
}
|
697
|
+
cerr << "--pidfile <file> must be used with --daemon" << endl;
|
698
|
+
return EXIT_FAILURE;
|
699
|
+
}
|
700
|
+
|
701
|
+
if(daemonize)
|
702
|
+
{
|
703
|
+
configureDaemon(changeDirectory, closeFiles, pidFile);
|
704
|
+
}
|
705
|
+
#endif
|
706
|
+
|
707
|
+
//
|
708
|
+
// If no logger has been set yet, we set it to the process logger. If the
|
709
|
+
// process logger is the default logger, we change it to a logger which is
|
710
|
+
// using the program name for the prefix.
|
711
|
+
//
|
712
|
+
if(!_logger)
|
713
|
+
{
|
714
|
+
_logger = getProcessLogger();
|
715
|
+
if(LoggerIPtr::dynamicCast(_logger))
|
716
|
+
{
|
717
|
+
const bool convert =
|
718
|
+
initData.properties->getPropertyAsIntWithDefault("Ice.LogStdErr.Convert", 1) > 0 &&
|
719
|
+
initData.properties->getProperty("Ice.StdErr").empty();
|
720
|
+
|
721
|
+
_logger = new LoggerI(initData.properties->getProperty("Ice.ProgramName"), "", convert,
|
722
|
+
IceUtil::getProcessStringConverter());
|
723
|
+
setProcessLogger(_logger);
|
724
|
+
}
|
725
|
+
}
|
726
|
+
|
727
|
+
return run(argc, argv, initData);
|
728
|
+
}
|
729
|
+
|
730
|
+
int
|
731
|
+
Ice::Service::main(int argc, char* const argv[], const InitializationData& initializationData)
|
732
|
+
{
|
733
|
+
IceUtilInternal::ArgVector av(argc, argv);
|
734
|
+
return main(av.argc, av.argv, initializationData);
|
735
|
+
}
|
736
|
+
|
737
|
+
#ifdef _WIN32
|
738
|
+
|
739
|
+
int
|
740
|
+
Ice::Service::main(int& argc, wchar_t* argv[], const InitializationData& initializationData)
|
741
|
+
{
|
742
|
+
|
743
|
+
# ifdef __MINGW32__ // COMPILER FIX
|
744
|
+
//
|
745
|
+
// MinGW doesn't see the main overload if we don't create the temp args object here.
|
746
|
+
//
|
747
|
+
Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
|
748
|
+
return main(args, initializationData);
|
749
|
+
# else
|
750
|
+
return main(Ice::argsToStringSeq(argc, argv), initializationData);
|
751
|
+
# endif
|
752
|
+
}
|
753
|
+
|
754
|
+
#endif
|
755
|
+
|
756
|
+
int
|
757
|
+
Ice::Service::main(StringSeq& args, const InitializationData& initData)
|
758
|
+
{
|
759
|
+
IceUtilInternal::ArgVector av(args);
|
760
|
+
return main(av.argc, av.argv, initData);
|
761
|
+
}
|
762
|
+
|
763
|
+
Ice::CommunicatorPtr
|
764
|
+
Ice::Service::communicator() const
|
765
|
+
{
|
766
|
+
return _communicator;
|
767
|
+
}
|
768
|
+
|
769
|
+
Ice::Service*
|
770
|
+
Ice::Service::instance()
|
771
|
+
{
|
772
|
+
return _instance;
|
773
|
+
}
|
774
|
+
|
775
|
+
bool
|
776
|
+
Ice::Service::service() const
|
777
|
+
{
|
778
|
+
return _service;
|
779
|
+
}
|
780
|
+
|
781
|
+
string
|
782
|
+
Ice::Service::name() const
|
783
|
+
{
|
784
|
+
return _name;
|
785
|
+
}
|
786
|
+
|
787
|
+
bool
|
788
|
+
Ice::Service::checkSystem() const
|
789
|
+
{
|
790
|
+
return true;
|
791
|
+
}
|
792
|
+
|
793
|
+
#ifdef _WIN32
|
794
|
+
int
|
795
|
+
Ice::Service::run(int& argc, wchar_t* argv[], const InitializationData& initData)
|
796
|
+
{
|
797
|
+
StringSeq args = Ice::argsToStringSeq(argc, argv);
|
798
|
+
IceUtilInternal::ArgVector av(args);
|
799
|
+
return run(av.argc, av.argv, initData);
|
800
|
+
}
|
801
|
+
#endif
|
802
|
+
|
803
|
+
int
|
804
|
+
Ice::Service::run(int& argc, char* argv[], const InitializationData& initData)
|
805
|
+
{
|
806
|
+
if(_service)
|
807
|
+
{
|
808
|
+
#ifdef _WIN32
|
809
|
+
return runService(argc, argv, initData);
|
810
|
+
#else
|
811
|
+
return runDaemon(argc, argv, initData);
|
812
|
+
#endif
|
813
|
+
}
|
814
|
+
|
815
|
+
//
|
816
|
+
// Run as a foreground process.
|
817
|
+
//
|
818
|
+
int status = EXIT_FAILURE;
|
819
|
+
try
|
820
|
+
{
|
821
|
+
//
|
822
|
+
// Create the CtrlCHandler after any potential forking so that signals
|
823
|
+
// are initialized properly. We do this before initializing the
|
824
|
+
// communicator because we need to ensure that this is done before any
|
825
|
+
// additional threads are created.
|
826
|
+
//
|
827
|
+
_ctrlCHandler = new IceUtil::CtrlCHandler;
|
828
|
+
|
829
|
+
//
|
830
|
+
// Initialize the communicator.
|
831
|
+
//
|
832
|
+
_communicator = initializeCommunicator(argc, argv, initData);
|
833
|
+
|
834
|
+
//
|
835
|
+
// Use the configured logger.
|
836
|
+
//
|
837
|
+
_logger = _communicator->getLogger();
|
838
|
+
|
839
|
+
//
|
840
|
+
// Determines whether we ignore SIGHUP/CTRL_LOGOFF_EVENT.
|
841
|
+
//
|
842
|
+
_nohup = _communicator->getProperties()->getPropertyAsIntWithDefault("Ice.Nohup", 1) > 0;
|
843
|
+
|
844
|
+
//
|
845
|
+
// Start the service.
|
846
|
+
//
|
847
|
+
if(start(argc, argv, status))
|
848
|
+
{
|
849
|
+
//
|
850
|
+
// Wait for service shutdown.
|
851
|
+
//
|
852
|
+
waitForShutdown();
|
853
|
+
|
854
|
+
//
|
855
|
+
// Stop the service.
|
856
|
+
//
|
857
|
+
if(stop())
|
858
|
+
{
|
859
|
+
status = EXIT_SUCCESS;
|
860
|
+
}
|
861
|
+
}
|
862
|
+
}
|
863
|
+
catch(const std::exception& ex)
|
864
|
+
{
|
865
|
+
ServiceError err(this);
|
866
|
+
err << "service caught unhandled exception:\n" << ex;
|
867
|
+
}
|
868
|
+
catch(const std::string& msg)
|
869
|
+
{
|
870
|
+
ServiceError err(this);
|
871
|
+
err << "service caught unhandled exception:\n" << msg;
|
872
|
+
}
|
873
|
+
catch(const char* msg)
|
874
|
+
{
|
875
|
+
ServiceError err(this);
|
876
|
+
err << "service caught unhandled exception:\n" << msg;
|
877
|
+
}
|
878
|
+
catch(...)
|
879
|
+
{
|
880
|
+
error("service caught unhandled C++ exception");
|
881
|
+
}
|
882
|
+
|
883
|
+
if(_communicator)
|
884
|
+
{
|
885
|
+
try
|
886
|
+
{
|
887
|
+
_communicator->destroy();
|
888
|
+
}
|
889
|
+
catch(...)
|
890
|
+
{
|
891
|
+
}
|
892
|
+
}
|
893
|
+
|
894
|
+
return status;
|
895
|
+
}
|
896
|
+
|
897
|
+
#ifdef _WIN32
|
898
|
+
|
899
|
+
void
|
900
|
+
Ice::Service::configureService(const string& name)
|
901
|
+
{
|
902
|
+
_service = true;
|
903
|
+
_name = name;
|
904
|
+
}
|
905
|
+
|
906
|
+
void
|
907
|
+
Ice::Service::setModuleHandle(HMODULE module)
|
908
|
+
{
|
909
|
+
SMEventLoggerI::setModuleHandle(module);
|
910
|
+
}
|
911
|
+
|
912
|
+
#else
|
913
|
+
|
914
|
+
void
|
915
|
+
Ice::Service::configureDaemon(bool changeDirectory, bool closeFiles, const string& pidFile)
|
916
|
+
{
|
917
|
+
_service = true;
|
918
|
+
_changeDirectory = changeDirectory;
|
919
|
+
_closeFiles = closeFiles;
|
920
|
+
_pidFile = pidFile;
|
921
|
+
}
|
922
|
+
|
923
|
+
#endif
|
924
|
+
|
925
|
+
void
|
926
|
+
Ice::Service::handleInterrupt(int sig)
|
927
|
+
{
|
928
|
+
#ifdef _WIN32
|
929
|
+
if(_nohup && sig == CTRL_LOGOFF_EVENT)
|
930
|
+
{
|
931
|
+
return;
|
932
|
+
}
|
933
|
+
#else
|
934
|
+
if(_nohup && sig == SIGHUP)
|
935
|
+
{
|
936
|
+
return;
|
937
|
+
}
|
938
|
+
#endif
|
939
|
+
|
940
|
+
interrupt();
|
941
|
+
}
|
942
|
+
|
943
|
+
void
|
944
|
+
Ice::Service::waitForShutdown()
|
945
|
+
{
|
946
|
+
if(_communicator)
|
947
|
+
{
|
948
|
+
enableInterrupt();
|
949
|
+
_communicator->waitForShutdown();
|
950
|
+
disableInterrupt();
|
951
|
+
}
|
952
|
+
}
|
953
|
+
|
954
|
+
bool
|
955
|
+
Ice::Service::stop()
|
956
|
+
{
|
957
|
+
return true;
|
958
|
+
}
|
959
|
+
|
960
|
+
Ice::CommunicatorPtr
|
961
|
+
Ice::Service::initializeCommunicator(int& argc, char* argv[], const InitializationData& initData)
|
962
|
+
{
|
963
|
+
return Ice::initialize(argc, argv, initData);
|
964
|
+
}
|
965
|
+
|
966
|
+
void
|
967
|
+
Ice::Service::syserror(const string& msg)
|
968
|
+
{
|
969
|
+
string errmsg = IceUtilInternal::lastErrorToString();
|
970
|
+
if(_logger)
|
971
|
+
{
|
972
|
+
ostringstream ostr;
|
973
|
+
if(!msg.empty())
|
974
|
+
{
|
975
|
+
ostr << msg << endl;
|
976
|
+
}
|
977
|
+
if(!errmsg.empty())
|
978
|
+
{
|
979
|
+
ostr << errmsg;
|
980
|
+
}
|
981
|
+
_logger->error(ostr.str());
|
982
|
+
}
|
983
|
+
else
|
984
|
+
{
|
985
|
+
if(!_name.empty())
|
986
|
+
{
|
987
|
+
cerr << _name << ": ";
|
988
|
+
}
|
989
|
+
if(!msg.empty())
|
990
|
+
{
|
991
|
+
cerr << msg << endl;
|
992
|
+
}
|
993
|
+
if(!errmsg.empty())
|
994
|
+
{
|
995
|
+
cerr << errmsg;
|
996
|
+
}
|
997
|
+
}
|
998
|
+
}
|
999
|
+
|
1000
|
+
void
|
1001
|
+
Ice::Service::error(const string& msg)
|
1002
|
+
{
|
1003
|
+
if(_logger)
|
1004
|
+
{
|
1005
|
+
_logger->error(msg);
|
1006
|
+
}
|
1007
|
+
else
|
1008
|
+
{
|
1009
|
+
if(!_name.empty())
|
1010
|
+
{
|
1011
|
+
cerr << _name << ": ";
|
1012
|
+
}
|
1013
|
+
cerr << "error: " << msg << endl;
|
1014
|
+
}
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
void
|
1018
|
+
Ice::Service::warning(const string& msg)
|
1019
|
+
{
|
1020
|
+
if(_logger)
|
1021
|
+
{
|
1022
|
+
_logger->warning(msg);
|
1023
|
+
}
|
1024
|
+
else
|
1025
|
+
{
|
1026
|
+
if(!_name.empty())
|
1027
|
+
{
|
1028
|
+
cerr << _name << ": ";
|
1029
|
+
}
|
1030
|
+
cerr << "warning: " << msg << endl;
|
1031
|
+
}
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
void
|
1035
|
+
Ice::Service::trace(const string& msg)
|
1036
|
+
{
|
1037
|
+
if(_logger)
|
1038
|
+
{
|
1039
|
+
_logger->trace("", msg);
|
1040
|
+
}
|
1041
|
+
else
|
1042
|
+
{
|
1043
|
+
cerr << msg << endl;
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
void
|
1048
|
+
Ice::Service::print(const string& msg)
|
1049
|
+
{
|
1050
|
+
if(_logger)
|
1051
|
+
{
|
1052
|
+
_logger->print(msg);
|
1053
|
+
}
|
1054
|
+
else
|
1055
|
+
{
|
1056
|
+
cerr << msg << endl;
|
1057
|
+
}
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
void
|
1061
|
+
Ice::Service::enableInterrupt()
|
1062
|
+
{
|
1063
|
+
_ctrlCHandler->setCallback(ctrlCHandlerCallback);
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
void
|
1067
|
+
Ice::Service::disableInterrupt()
|
1068
|
+
{
|
1069
|
+
_ctrlCHandler->setCallback(0);
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
#ifdef _WIN32
|
1073
|
+
|
1074
|
+
int
|
1075
|
+
Ice::Service::runService(int argc, char* argv[], const InitializationData& initData)
|
1076
|
+
{
|
1077
|
+
assert(_service);
|
1078
|
+
|
1079
|
+
if(!checkSystem())
|
1080
|
+
{
|
1081
|
+
error("Win32 service not supported on Windows 9x/ME");
|
1082
|
+
return EXIT_FAILURE;
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
if(_name.empty())
|
1086
|
+
{
|
1087
|
+
error("invalid name for Win32 service");
|
1088
|
+
return EXIT_FAILURE;
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
//
|
1092
|
+
// Arguments passed to the executable are not passed to the service's main function,
|
1093
|
+
// so save them now and serviceMain will merge them later.
|
1094
|
+
//
|
1095
|
+
for(int idx = 1; idx < argc; ++idx)
|
1096
|
+
{
|
1097
|
+
_serviceArgs.push_back(argv[idx]);
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
_initData = initData;
|
1101
|
+
|
1102
|
+
//
|
1103
|
+
// Don't need to use a wide string converter as the wide string is passed
|
1104
|
+
// to Windows API.
|
1105
|
+
//
|
1106
|
+
SERVICE_TABLE_ENTRYW ste[] =
|
1107
|
+
{
|
1108
|
+
{ const_cast<wchar_t*>(
|
1109
|
+
IceUtil::stringToWstring(_name, IceUtil::getProcessStringConverter()).c_str()),
|
1110
|
+
Ice_Service_ServiceMain },
|
1111
|
+
{ 0, 0 },
|
1112
|
+
};
|
1113
|
+
|
1114
|
+
//
|
1115
|
+
// Start the service.
|
1116
|
+
//
|
1117
|
+
if(!StartServiceCtrlDispatcherW(ste))
|
1118
|
+
{
|
1119
|
+
syserror("unable to start service control dispatcher");
|
1120
|
+
return EXIT_FAILURE;
|
1121
|
+
}
|
1122
|
+
|
1123
|
+
return EXIT_SUCCESS;
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
void
|
1127
|
+
Ice::Service::terminateService(DWORD exitCode)
|
1128
|
+
{
|
1129
|
+
serviceStatusManager->stopUpdate();
|
1130
|
+
delete serviceStatusManager;
|
1131
|
+
serviceStatusManager = 0;
|
1132
|
+
|
1133
|
+
SERVICE_STATUS status;
|
1134
|
+
|
1135
|
+
status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
1136
|
+
status.dwCurrentState = SERVICE_STOPPED;
|
1137
|
+
status.dwControlsAccepted = 0;
|
1138
|
+
if(exitCode != 0)
|
1139
|
+
{
|
1140
|
+
status.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
|
1141
|
+
}
|
1142
|
+
else
|
1143
|
+
{
|
1144
|
+
status.dwWin32ExitCode = 0;
|
1145
|
+
}
|
1146
|
+
status.dwServiceSpecificExitCode = exitCode;
|
1147
|
+
status.dwCheckPoint = 0;
|
1148
|
+
status.dwWaitHint = 0;
|
1149
|
+
|
1150
|
+
SetServiceStatus(_statusHandle, &status);
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
bool
|
1154
|
+
Ice::Service::waitForServiceState(SC_HANDLE hService, DWORD pendingState, SERVICE_STATUS& status)
|
1155
|
+
{
|
1156
|
+
if(!QueryServiceStatus(hService, &status))
|
1157
|
+
{
|
1158
|
+
return false;
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
//
|
1162
|
+
// Save the tick count and initial checkpoint.
|
1163
|
+
//
|
1164
|
+
DWORD startTickCount = GetTickCount();
|
1165
|
+
DWORD oldCheckPoint = status.dwCheckPoint;
|
1166
|
+
|
1167
|
+
//
|
1168
|
+
// Loop while the service is in the pending state.
|
1169
|
+
//
|
1170
|
+
while(status.dwCurrentState == pendingState)
|
1171
|
+
{
|
1172
|
+
//
|
1173
|
+
// Do not wait longer than the wait hint. A good interval is
|
1174
|
+
// one tenth the wait hint, but no less than 1 second and no
|
1175
|
+
// more than 10 seconds.
|
1176
|
+
//
|
1177
|
+
|
1178
|
+
DWORD waitTime = status.dwWaitHint / 10;
|
1179
|
+
|
1180
|
+
if(waitTime < 1000)
|
1181
|
+
{
|
1182
|
+
waitTime = 1000;
|
1183
|
+
}
|
1184
|
+
else if(waitTime > 10000)
|
1185
|
+
{
|
1186
|
+
waitTime = 10000;
|
1187
|
+
}
|
1188
|
+
|
1189
|
+
Sleep(waitTime);
|
1190
|
+
|
1191
|
+
//
|
1192
|
+
// Check the status again.
|
1193
|
+
//
|
1194
|
+
if(!QueryServiceStatus(hService, &status))
|
1195
|
+
{
|
1196
|
+
return false;
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
if(status.dwCheckPoint > oldCheckPoint)
|
1200
|
+
{
|
1201
|
+
//
|
1202
|
+
// The service is making progress.
|
1203
|
+
//
|
1204
|
+
startTickCount = GetTickCount();
|
1205
|
+
oldCheckPoint = status.dwCheckPoint;
|
1206
|
+
}
|
1207
|
+
else
|
1208
|
+
{
|
1209
|
+
if(GetTickCount() - startTickCount > status.dwWaitHint)
|
1210
|
+
{
|
1211
|
+
//
|
1212
|
+
// No progress made within the wait hint.
|
1213
|
+
//
|
1214
|
+
break;
|
1215
|
+
}
|
1216
|
+
}
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
return true;
|
1220
|
+
}
|
1221
|
+
|
1222
|
+
void
|
1223
|
+
Ice::Service::showServiceStatus(const string& msg, SERVICE_STATUS& status)
|
1224
|
+
{
|
1225
|
+
string state;
|
1226
|
+
switch(status.dwCurrentState)
|
1227
|
+
{
|
1228
|
+
case SERVICE_STOPPED:
|
1229
|
+
state = "STOPPED";
|
1230
|
+
break;
|
1231
|
+
case SERVICE_START_PENDING:
|
1232
|
+
state = "START PENDING";
|
1233
|
+
break;
|
1234
|
+
case SERVICE_STOP_PENDING:
|
1235
|
+
state = "STOP PENDING";
|
1236
|
+
break;
|
1237
|
+
case SERVICE_RUNNING:
|
1238
|
+
state = "RUNNING";
|
1239
|
+
break;
|
1240
|
+
case SERVICE_CONTINUE_PENDING:
|
1241
|
+
state = "CONTINUE PENDING";
|
1242
|
+
break;
|
1243
|
+
case SERVICE_PAUSE_PENDING:
|
1244
|
+
state = "PAUSE PENDING";
|
1245
|
+
break;
|
1246
|
+
case SERVICE_PAUSED:
|
1247
|
+
state = "PAUSED";
|
1248
|
+
break;
|
1249
|
+
default:
|
1250
|
+
state = "UNKNOWN";
|
1251
|
+
break;
|
1252
|
+
}
|
1253
|
+
|
1254
|
+
ServiceTrace tr(this);
|
1255
|
+
tr << msg
|
1256
|
+
<< "\n Current state: " << state
|
1257
|
+
<< "\n Exit code: " << status.dwWin32ExitCode
|
1258
|
+
<< "\n Service specific exit code: " << status.dwServiceSpecificExitCode
|
1259
|
+
<< "\n Check point: " << status.dwCheckPoint
|
1260
|
+
<< "\n Wait hint: " << status.dwWaitHint;
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
void
|
1264
|
+
Ice::Service::serviceMain(int argc, wchar_t* argv[])
|
1265
|
+
{
|
1266
|
+
_ctrlCHandler = new IceUtil::CtrlCHandler;
|
1267
|
+
|
1268
|
+
//
|
1269
|
+
// Register the control handler function.
|
1270
|
+
//
|
1271
|
+
_statusHandle = RegisterServiceCtrlHandlerW(argv[0], Ice_Service_CtrlHandler);
|
1272
|
+
if(_statusHandle == (SERVICE_STATUS_HANDLE)0)
|
1273
|
+
{
|
1274
|
+
syserror("unable to register service control handler");
|
1275
|
+
return;
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
//
|
1279
|
+
// Create the service status manager and start a thread to periodically
|
1280
|
+
// update the service's status with the service control manager (SCM).
|
1281
|
+
// The SCM must receive periodic updates otherwise it assumes that
|
1282
|
+
// initialization failed and terminates the service.
|
1283
|
+
//
|
1284
|
+
serviceStatusManager = new ServiceStatusManager(_statusHandle);
|
1285
|
+
serviceStatusManager->startUpdate(SERVICE_START_PENDING);
|
1286
|
+
|
1287
|
+
//
|
1288
|
+
// Merge the executable's arguments with the service's arguments.
|
1289
|
+
//
|
1290
|
+
const IceUtil::StringConverterPtr converter(IceUtil::getProcessStringConverter());
|
1291
|
+
|
1292
|
+
//
|
1293
|
+
// Don't need to pass a wide string converter in the bellow argv conversions
|
1294
|
+
// as argv come from Windows API.
|
1295
|
+
//
|
1296
|
+
char** args = new char*[_serviceArgs.size() + argc];
|
1297
|
+
args[0] = const_cast<char*>(IceUtil::wstringToString(argv[0], converter).c_str());
|
1298
|
+
int i = 1;
|
1299
|
+
for(vector<string>::iterator p = _serviceArgs.begin(); p != _serviceArgs.end(); ++p)
|
1300
|
+
{
|
1301
|
+
args[i++] = const_cast<char*>(p->c_str());
|
1302
|
+
}
|
1303
|
+
for(int j = 1; j < argc; ++j)
|
1304
|
+
{
|
1305
|
+
args[i++] = const_cast<char*>(IceUtil::wstringToString(argv[j], converter).c_str());
|
1306
|
+
}
|
1307
|
+
argc += static_cast<int>(_serviceArgs.size());
|
1308
|
+
|
1309
|
+
//
|
1310
|
+
// If we can't initialize a communicator, then stop immediately.
|
1311
|
+
//
|
1312
|
+
try
|
1313
|
+
{
|
1314
|
+
_communicator = initializeCommunicator(argc, args, _initData);
|
1315
|
+
}
|
1316
|
+
catch(const Ice::Exception& ex)
|
1317
|
+
{
|
1318
|
+
delete[] args;
|
1319
|
+
{
|
1320
|
+
ServiceError err(this);
|
1321
|
+
err << "exception occurred while initializing a communicator:\n" << ex;
|
1322
|
+
}
|
1323
|
+
terminateService(EXIT_FAILURE);
|
1324
|
+
return;
|
1325
|
+
}
|
1326
|
+
catch(...)
|
1327
|
+
{
|
1328
|
+
delete[] args;
|
1329
|
+
error("unknown exception occurred while initializing a communicator");
|
1330
|
+
terminateService(EXIT_FAILURE);
|
1331
|
+
return;
|
1332
|
+
}
|
1333
|
+
|
1334
|
+
//
|
1335
|
+
// Use the configured logger.
|
1336
|
+
//
|
1337
|
+
_logger = _communicator->getLogger();
|
1338
|
+
|
1339
|
+
//
|
1340
|
+
// Determines whether we ignore SIGHUP/CTRL_LOGOFF_EVENT.
|
1341
|
+
//
|
1342
|
+
_nohup = _communicator->getProperties()->getPropertyAsIntWithDefault("Ice.Nohup", 1) > 0;
|
1343
|
+
|
1344
|
+
DWORD status = EXIT_FAILURE;
|
1345
|
+
try
|
1346
|
+
{
|
1347
|
+
int tmpStatus = EXIT_FAILURE;
|
1348
|
+
if(start(argc, args, tmpStatus))
|
1349
|
+
{
|
1350
|
+
trace("Service started successfully.");
|
1351
|
+
|
1352
|
+
//
|
1353
|
+
// Change the current status from START_PENDING to RUNNING.
|
1354
|
+
//
|
1355
|
+
serviceStatusManager->stopUpdate();
|
1356
|
+
serviceStatusManager->changeStatus(SERVICE_RUNNING, SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN);
|
1357
|
+
|
1358
|
+
//
|
1359
|
+
// Wait for the service to be shut down.
|
1360
|
+
//
|
1361
|
+
waitForShutdown();
|
1362
|
+
|
1363
|
+
//
|
1364
|
+
// Give the service a chance to clean up.
|
1365
|
+
//
|
1366
|
+
if(stop())
|
1367
|
+
{
|
1368
|
+
status = EXIT_SUCCESS;
|
1369
|
+
}
|
1370
|
+
}
|
1371
|
+
else
|
1372
|
+
{
|
1373
|
+
status = tmpStatus;
|
1374
|
+
}
|
1375
|
+
}
|
1376
|
+
catch(const std::exception& ex)
|
1377
|
+
{
|
1378
|
+
ServiceError err(this);
|
1379
|
+
err << "service caught unhandled std::exception:\n" << ex;
|
1380
|
+
}
|
1381
|
+
catch(...)
|
1382
|
+
{
|
1383
|
+
error("service caught unhandled C++ exception");
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
delete[] args;
|
1387
|
+
|
1388
|
+
try
|
1389
|
+
{
|
1390
|
+
assert(_communicator);
|
1391
|
+
_communicator->destroy();
|
1392
|
+
}
|
1393
|
+
catch(...)
|
1394
|
+
{
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
terminateService(status);
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
void
|
1401
|
+
Ice::Service::control(int ctrl)
|
1402
|
+
{
|
1403
|
+
assert(serviceStatusManager);
|
1404
|
+
|
1405
|
+
switch(ctrl)
|
1406
|
+
{
|
1407
|
+
case SERVICE_CONTROL_SHUTDOWN:
|
1408
|
+
case SERVICE_CONTROL_STOP:
|
1409
|
+
{
|
1410
|
+
serviceStatusManager->startUpdate(SERVICE_STOP_PENDING);
|
1411
|
+
shutdown();
|
1412
|
+
break;
|
1413
|
+
}
|
1414
|
+
default:
|
1415
|
+
{
|
1416
|
+
if(ctrl != SERVICE_CONTROL_INTERROGATE)
|
1417
|
+
{
|
1418
|
+
ServiceError err(this);
|
1419
|
+
err << "unrecognized service control code " << ctrl;
|
1420
|
+
}
|
1421
|
+
|
1422
|
+
serviceStatusManager->reportStatus();
|
1423
|
+
break;
|
1424
|
+
}
|
1425
|
+
}
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
ServiceStatusManager::ServiceStatusManager(SERVICE_STATUS_HANDLE handle) :
|
1429
|
+
_handle(handle), _stopped(false)
|
1430
|
+
{
|
1431
|
+
_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
1432
|
+
_status.dwControlsAccepted = 0;
|
1433
|
+
_status.dwWin32ExitCode = 0;
|
1434
|
+
_status.dwServiceSpecificExitCode = 0;
|
1435
|
+
_status.dwCheckPoint = 0;
|
1436
|
+
_status.dwWaitHint = 0;
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
void
|
1440
|
+
ServiceStatusManager::startUpdate(DWORD state)
|
1441
|
+
{
|
1442
|
+
Lock sync(*this);
|
1443
|
+
|
1444
|
+
assert(state == SERVICE_START_PENDING || state == SERVICE_STOP_PENDING);
|
1445
|
+
assert(!_thread);
|
1446
|
+
|
1447
|
+
_status.dwCurrentState = state;
|
1448
|
+
_status.dwControlsAccepted = 0; // Don't accept any other control messages while pending.
|
1449
|
+
|
1450
|
+
_stopped = false;
|
1451
|
+
|
1452
|
+
_thread = new StatusThread(this);
|
1453
|
+
_thread->start();
|
1454
|
+
}
|
1455
|
+
|
1456
|
+
void
|
1457
|
+
ServiceStatusManager::stopUpdate()
|
1458
|
+
{
|
1459
|
+
IceUtil::ThreadPtr thread;
|
1460
|
+
|
1461
|
+
{
|
1462
|
+
Lock sync(*this);
|
1463
|
+
|
1464
|
+
if(_thread)
|
1465
|
+
{
|
1466
|
+
_stopped = true;
|
1467
|
+
notify();
|
1468
|
+
thread = _thread;
|
1469
|
+
_thread = 0;
|
1470
|
+
}
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
if(thread)
|
1474
|
+
{
|
1475
|
+
thread->getThreadControl().join();
|
1476
|
+
}
|
1477
|
+
}
|
1478
|
+
|
1479
|
+
void
|
1480
|
+
ServiceStatusManager::changeStatus(DWORD state, DWORD controlsAccepted)
|
1481
|
+
{
|
1482
|
+
Lock sync(*this);
|
1483
|
+
|
1484
|
+
_status.dwCurrentState = state;
|
1485
|
+
_status.dwControlsAccepted = controlsAccepted;
|
1486
|
+
|
1487
|
+
SetServiceStatus(_handle, &_status);
|
1488
|
+
}
|
1489
|
+
|
1490
|
+
void
|
1491
|
+
ServiceStatusManager::reportStatus()
|
1492
|
+
{
|
1493
|
+
Lock sync(*this);
|
1494
|
+
|
1495
|
+
SetServiceStatus(_handle, &_status);
|
1496
|
+
}
|
1497
|
+
|
1498
|
+
void
|
1499
|
+
ServiceStatusManager::run()
|
1500
|
+
{
|
1501
|
+
Lock sync(*this);
|
1502
|
+
|
1503
|
+
IceUtil::Time delay = IceUtil::Time::milliSeconds(1000);
|
1504
|
+
_status.dwWaitHint = 2000;
|
1505
|
+
_status.dwCheckPoint = 0;
|
1506
|
+
|
1507
|
+
while(!_stopped)
|
1508
|
+
{
|
1509
|
+
_status.dwCheckPoint++;
|
1510
|
+
SetServiceStatus(_handle, &_status);
|
1511
|
+
timedWait(delay);
|
1512
|
+
}
|
1513
|
+
}
|
1514
|
+
|
1515
|
+
#else
|
1516
|
+
|
1517
|
+
int
|
1518
|
+
Ice::Service::runDaemon(int argc, char* argv[], const InitializationData& initData)
|
1519
|
+
{
|
1520
|
+
assert(_service);
|
1521
|
+
|
1522
|
+
//
|
1523
|
+
// Create a pipe that is used to notify the parent when the child is ready.
|
1524
|
+
//
|
1525
|
+
SOCKET fds[2];
|
1526
|
+
IceInternal::createPipe(fds);
|
1527
|
+
|
1528
|
+
//
|
1529
|
+
// Fork the child.
|
1530
|
+
//
|
1531
|
+
pid_t pid = fork();
|
1532
|
+
if(pid < 0)
|
1533
|
+
{
|
1534
|
+
if(argv[0])
|
1535
|
+
{
|
1536
|
+
cerr << argv[0] << ": ";
|
1537
|
+
}
|
1538
|
+
cerr << strerror(errno) << endl;
|
1539
|
+
return EXIT_FAILURE;
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
if(pid != 0)
|
1543
|
+
{
|
1544
|
+
//
|
1545
|
+
// Parent process.
|
1546
|
+
//
|
1547
|
+
|
1548
|
+
//
|
1549
|
+
// Close an unused end of the pipe.
|
1550
|
+
//
|
1551
|
+
close(fds[1]);
|
1552
|
+
|
1553
|
+
//
|
1554
|
+
// Wait for the child to write a byte to the pipe to indicate that it
|
1555
|
+
// is ready to receive requests, or that an error occurred.
|
1556
|
+
//
|
1557
|
+
char c = 0;
|
1558
|
+
while(true)
|
1559
|
+
{
|
1560
|
+
if(read(fds[0], &c, 1) == -1)
|
1561
|
+
{
|
1562
|
+
if(IceInternal::interrupted())
|
1563
|
+
{
|
1564
|
+
continue;
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
if(argv[0])
|
1568
|
+
{
|
1569
|
+
cerr << argv[0] << ": ";
|
1570
|
+
}
|
1571
|
+
cerr << strerror(errno) << endl;
|
1572
|
+
_exit(EXIT_FAILURE);
|
1573
|
+
}
|
1574
|
+
break;
|
1575
|
+
}
|
1576
|
+
|
1577
|
+
if(c != 0)
|
1578
|
+
{
|
1579
|
+
//
|
1580
|
+
// Read an error message.
|
1581
|
+
//
|
1582
|
+
char msg[1024];
|
1583
|
+
size_t pos = 0;
|
1584
|
+
while(pos < sizeof(msg))
|
1585
|
+
{
|
1586
|
+
ssize_t n = read(fds[0], &msg[pos], sizeof(msg) - pos);
|
1587
|
+
if(n == -1)
|
1588
|
+
{
|
1589
|
+
if(IceInternal::interrupted())
|
1590
|
+
{
|
1591
|
+
continue;
|
1592
|
+
}
|
1593
|
+
|
1594
|
+
if(argv[0])
|
1595
|
+
{
|
1596
|
+
cerr << ": ";
|
1597
|
+
}
|
1598
|
+
cerr << "I/O error while reading error message from child:\n" << strerror(errno) << endl;
|
1599
|
+
_exit(EXIT_FAILURE);
|
1600
|
+
}
|
1601
|
+
pos += n;
|
1602
|
+
break;
|
1603
|
+
}
|
1604
|
+
if(argv[0])
|
1605
|
+
{
|
1606
|
+
cerr << argv[0] << ": ";
|
1607
|
+
}
|
1608
|
+
cerr << "failure occurred in daemon";
|
1609
|
+
if(strlen(msg) > 0)
|
1610
|
+
{
|
1611
|
+
cerr << ':' << endl << msg;
|
1612
|
+
}
|
1613
|
+
cerr << endl;
|
1614
|
+
_exit(EXIT_FAILURE);
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
_exit(EXIT_SUCCESS);
|
1618
|
+
}
|
1619
|
+
|
1620
|
+
//
|
1621
|
+
// Child process.
|
1622
|
+
//
|
1623
|
+
|
1624
|
+
string errMsg;
|
1625
|
+
int status = EXIT_FAILURE;
|
1626
|
+
try
|
1627
|
+
{
|
1628
|
+
//
|
1629
|
+
// Become a session and process group leader.
|
1630
|
+
//
|
1631
|
+
if(setsid() == -1)
|
1632
|
+
{
|
1633
|
+
SyscallException ex(__FILE__, __LINE__);
|
1634
|
+
ex.error = IceInternal::getSystemErrno();
|
1635
|
+
throw ex;
|
1636
|
+
}
|
1637
|
+
|
1638
|
+
//
|
1639
|
+
// Ignore SIGHUP so that the grandchild process is not sent SIGHUP when this
|
1640
|
+
// process exits.
|
1641
|
+
//
|
1642
|
+
signal(SIGHUP, SIG_IGN);
|
1643
|
+
|
1644
|
+
//
|
1645
|
+
// Fork again to eliminate the possibility of acquiring a controlling terminal.
|
1646
|
+
//
|
1647
|
+
pid = fork();
|
1648
|
+
if(pid < 0)
|
1649
|
+
{
|
1650
|
+
SyscallException ex(__FILE__, __LINE__);
|
1651
|
+
ex.error = IceInternal::getSystemErrno();
|
1652
|
+
throw ex;
|
1653
|
+
}
|
1654
|
+
if(pid != 0)
|
1655
|
+
{
|
1656
|
+
exit(0);
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
if(_changeDirectory)
|
1660
|
+
{
|
1661
|
+
//
|
1662
|
+
// Change the working directory.
|
1663
|
+
//
|
1664
|
+
if(chdir("/") != 0)
|
1665
|
+
{
|
1666
|
+
SyscallException ex(__FILE__, __LINE__);
|
1667
|
+
ex.error = IceInternal::getSystemErrno();
|
1668
|
+
throw ex;
|
1669
|
+
}
|
1670
|
+
}
|
1671
|
+
|
1672
|
+
vector<int> fdsToClose;
|
1673
|
+
if(_closeFiles)
|
1674
|
+
{
|
1675
|
+
//
|
1676
|
+
// Take a snapshot of the open file descriptors. We don't actually close these
|
1677
|
+
// descriptors until after the communicator is initialized, so that plug-ins
|
1678
|
+
// have an opportunity to use stdin/stdout/stderr if necessary. This also
|
1679
|
+
// conveniently allows the Ice.PrintProcessId property to work as expected.
|
1680
|
+
//
|
1681
|
+
int fdMax = static_cast<int>(sysconf(_SC_OPEN_MAX));
|
1682
|
+
if(fdMax <= 0)
|
1683
|
+
{
|
1684
|
+
SyscallException ex(__FILE__, __LINE__);
|
1685
|
+
ex.error = IceInternal::getSystemErrno();
|
1686
|
+
throw ex;
|
1687
|
+
}
|
1688
|
+
|
1689
|
+
for(int i = 0; i < fdMax; ++i)
|
1690
|
+
{
|
1691
|
+
if(fcntl(i, F_GETFL) != -1)
|
1692
|
+
{
|
1693
|
+
//
|
1694
|
+
// Don't close the write end of the pipe.
|
1695
|
+
//
|
1696
|
+
if(i != fds[1])
|
1697
|
+
{
|
1698
|
+
fdsToClose.push_back(i);
|
1699
|
+
}
|
1700
|
+
}
|
1701
|
+
}
|
1702
|
+
}
|
1703
|
+
|
1704
|
+
//
|
1705
|
+
// Create the CtrlCHandler after forking the child so that signals are initialized
|
1706
|
+
// properly. We do this before initializing the communicator because we need to
|
1707
|
+
// ensure that signals are initialized before additional threads are created. The
|
1708
|
+
// communicator thread pools currently use lazy initialization, but a thread can
|
1709
|
+
// be created to monitor connections.
|
1710
|
+
//
|
1711
|
+
_ctrlCHandler = new IceUtil::CtrlCHandler;
|
1712
|
+
|
1713
|
+
//
|
1714
|
+
// Initialize the communicator.
|
1715
|
+
//
|
1716
|
+
_communicator = initializeCommunicator(argc, argv, initData);
|
1717
|
+
|
1718
|
+
if(_closeFiles)
|
1719
|
+
{
|
1720
|
+
//
|
1721
|
+
// Close unnecessary file descriptors.
|
1722
|
+
//
|
1723
|
+
PropertiesPtr properties = _communicator->getProperties();
|
1724
|
+
string stdOut = properties->getProperty("Ice.StdOut");
|
1725
|
+
string stdErr = properties->getProperty("Ice.StdErr");
|
1726
|
+
|
1727
|
+
for(vector<int>::const_iterator p = fdsToClose.begin(); p != fdsToClose.end(); ++p)
|
1728
|
+
{
|
1729
|
+
//
|
1730
|
+
// NOTE: Do not close stdout if Ice.StdOut is defined. Likewise for Ice.StdErr.
|
1731
|
+
//
|
1732
|
+
if((*p == 1 && !stdOut.empty()) || (*p == 2 && !stdErr.empty()))
|
1733
|
+
{
|
1734
|
+
continue;
|
1735
|
+
}
|
1736
|
+
close(*p);
|
1737
|
+
}
|
1738
|
+
|
1739
|
+
//
|
1740
|
+
// Associate stdin, stdout and stderr with /dev/null.
|
1741
|
+
//
|
1742
|
+
int fd = open("/dev/null", O_RDWR);
|
1743
|
+
assert(fd == 0);
|
1744
|
+
if(fd != 0)
|
1745
|
+
{
|
1746
|
+
SyscallException ex(__FILE__, __LINE__);
|
1747
|
+
ex.error = IceInternal::getSystemErrno();
|
1748
|
+
throw ex;
|
1749
|
+
}
|
1750
|
+
if(stdOut.empty())
|
1751
|
+
{
|
1752
|
+
fd = dup2(0, 1);
|
1753
|
+
assert(fd == 1);
|
1754
|
+
if(fd != 1)
|
1755
|
+
{
|
1756
|
+
SyscallException ex(__FILE__, __LINE__);
|
1757
|
+
ex.error = IceInternal::getSystemErrno();
|
1758
|
+
throw ex;
|
1759
|
+
}
|
1760
|
+
}
|
1761
|
+
if(stdErr.empty())
|
1762
|
+
{
|
1763
|
+
fd = dup2(1, 2);
|
1764
|
+
assert(fd == 2);
|
1765
|
+
if(fd != 2)
|
1766
|
+
{
|
1767
|
+
SyscallException ex(__FILE__, __LINE__);
|
1768
|
+
ex.error = IceInternal::getSystemErrno();
|
1769
|
+
throw ex;
|
1770
|
+
}
|
1771
|
+
}
|
1772
|
+
}
|
1773
|
+
|
1774
|
+
//
|
1775
|
+
// Write PID
|
1776
|
+
//
|
1777
|
+
if(_pidFile.size() > 0)
|
1778
|
+
{
|
1779
|
+
IceUtilInternal::ofstream of(_pidFile);
|
1780
|
+
of << getpid() << endl;
|
1781
|
+
|
1782
|
+
if(!of)
|
1783
|
+
{
|
1784
|
+
warning("Could not write PID file " + _pidFile);
|
1785
|
+
}
|
1786
|
+
}
|
1787
|
+
|
1788
|
+
//
|
1789
|
+
// Use the configured logger.
|
1790
|
+
//
|
1791
|
+
_logger = _communicator->getLogger();
|
1792
|
+
|
1793
|
+
//
|
1794
|
+
// Start the service.
|
1795
|
+
//
|
1796
|
+
if(start(argc, argv, status))
|
1797
|
+
{
|
1798
|
+
//
|
1799
|
+
// Notify the parent that the child is ready.
|
1800
|
+
//
|
1801
|
+
char c = 0;
|
1802
|
+
while(true)
|
1803
|
+
{
|
1804
|
+
if(write(fds[1], &c, 1) == -1)
|
1805
|
+
{
|
1806
|
+
if(IceInternal::interrupted())
|
1807
|
+
{
|
1808
|
+
continue;
|
1809
|
+
}
|
1810
|
+
}
|
1811
|
+
break;
|
1812
|
+
}
|
1813
|
+
close(fds[1]);
|
1814
|
+
fds[1] = -1;
|
1815
|
+
|
1816
|
+
//
|
1817
|
+
// Wait for service shutdown.
|
1818
|
+
//
|
1819
|
+
waitForShutdown();
|
1820
|
+
|
1821
|
+
//
|
1822
|
+
// Stop the service.
|
1823
|
+
//
|
1824
|
+
if(stop())
|
1825
|
+
{
|
1826
|
+
status = EXIT_SUCCESS;
|
1827
|
+
}
|
1828
|
+
}
|
1829
|
+
}
|
1830
|
+
catch(const std::exception& ex)
|
1831
|
+
{
|
1832
|
+
ServiceError err(this);
|
1833
|
+
err << "service caught unhandled std::exception:\n" << ex;
|
1834
|
+
errMsg = err.str();
|
1835
|
+
}
|
1836
|
+
catch(...)
|
1837
|
+
{
|
1838
|
+
errMsg = "service caught unhandled C++ exception";
|
1839
|
+
error(errMsg);
|
1840
|
+
}
|
1841
|
+
|
1842
|
+
//
|
1843
|
+
// If the service failed and the pipe to the parent is still open,
|
1844
|
+
// then send an error notification to the parent.
|
1845
|
+
//
|
1846
|
+
if(status != EXIT_SUCCESS && fds[1] != -1)
|
1847
|
+
{
|
1848
|
+
char c = 1;
|
1849
|
+
while(true)
|
1850
|
+
{
|
1851
|
+
if(write(fds[1], &c, 1) == -1)
|
1852
|
+
{
|
1853
|
+
if(IceInternal::interrupted())
|
1854
|
+
{
|
1855
|
+
continue;
|
1856
|
+
}
|
1857
|
+
}
|
1858
|
+
break;
|
1859
|
+
}
|
1860
|
+
const char* msg = errMsg.c_str();
|
1861
|
+
size_t len = strlen(msg) + 1; // Include null byte
|
1862
|
+
size_t pos = 0;
|
1863
|
+
while(len > 0)
|
1864
|
+
{
|
1865
|
+
ssize_t n = write(fds[1], &msg[pos], len);
|
1866
|
+
if(n == -1)
|
1867
|
+
{
|
1868
|
+
if(IceInternal::interrupted())
|
1869
|
+
{
|
1870
|
+
continue;
|
1871
|
+
}
|
1872
|
+
else
|
1873
|
+
{
|
1874
|
+
break;
|
1875
|
+
}
|
1876
|
+
}
|
1877
|
+
len -= n;
|
1878
|
+
pos += n;
|
1879
|
+
}
|
1880
|
+
close(fds[1]);
|
1881
|
+
}
|
1882
|
+
|
1883
|
+
if(_communicator)
|
1884
|
+
{
|
1885
|
+
try
|
1886
|
+
{
|
1887
|
+
_communicator->destroy();
|
1888
|
+
}
|
1889
|
+
catch(...)
|
1890
|
+
{
|
1891
|
+
}
|
1892
|
+
}
|
1893
|
+
|
1894
|
+
return status;
|
1895
|
+
}
|
1896
|
+
|
1897
|
+
#endif
|