zeroc-ice 3.6b1 → 3.6.0

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.
Files changed (679) hide show
  1. checksums.yaml +4 -4
  2. data/{ext/ice/BZIP_LICENSE → BZIP2_LICENSE} +0 -0
  3. data/ICE_LICENSE +8 -14
  4. data/LICENSE +2 -1
  5. data/{ext/ice/MCPP_LICENSE → MCPP_LICENSE} +2 -9
  6. data/bin/slice2rb +1 -1
  7. data/ext/Communicator.cpp +1 -1
  8. data/ext/Communicator.h +1 -1
  9. data/ext/Config.h +1 -22
  10. data/ext/Connection.cpp +125 -13
  11. data/ext/Connection.h +1 -1
  12. data/ext/Endpoint.cpp +62 -3
  13. data/ext/Endpoint.h +1 -1
  14. data/ext/ImplicitContext.cpp +1 -1
  15. data/ext/ImplicitContext.h +1 -1
  16. data/ext/Init.cpp +8 -1
  17. data/ext/Logger.cpp +1 -1
  18. data/ext/Logger.h +1 -1
  19. data/ext/ObjectFactory.cpp +1 -1
  20. data/ext/ObjectFactory.h +1 -1
  21. data/ext/Operation.cpp +1 -1
  22. data/ext/Operation.h +1 -1
  23. data/ext/Properties.cpp +1 -1
  24. data/ext/Properties.h +1 -1
  25. data/ext/Proxy.cpp +1 -1
  26. data/ext/Proxy.h +1 -1
  27. data/ext/Slice.cpp +1 -1
  28. data/ext/Slice.h +1 -1
  29. data/ext/Types.cpp +65 -17
  30. data/ext/Types.h +4 -1
  31. data/ext/Util.cpp +49 -58
  32. data/ext/Util.h +1 -1
  33. data/ext/extconf.rb +17 -15
  34. data/ext/ice/cpp/include/Ice/ACMF.h +1 -1
  35. data/ext/ice/cpp/include/Ice/Application.h +1 -1
  36. data/ext/ice/cpp/include/Ice/AsyncResult.h +1 -1
  37. data/ext/ice/cpp/include/Ice/AsyncResultF.h +1 -1
  38. data/ext/ice/cpp/include/Ice/BasicStream.h +1 -1
  39. data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +52 -0
  40. data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +25 -0
  41. data/ext/ice/cpp/include/Ice/Buffer.h +1 -1
  42. data/ext/ice/cpp/include/Ice/BuiltinSequences.h +12 -4
  43. data/ext/ice/cpp/include/Ice/Communicator.h +12 -4
  44. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +1 -1
  45. data/ext/ice/cpp/include/Ice/CommunicatorF.h +12 -4
  46. data/ext/ice/cpp/include/Ice/Config.h +13 -8
  47. data/ext/ice/cpp/include/Ice/Connection.h +41 -16
  48. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +1 -1
  49. data/ext/ice/cpp/include/Ice/ConnectionF.h +12 -4
  50. data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +1 -1
  51. data/ext/ice/cpp/include/Ice/ConnectionIF.h +1 -1
  52. data/ext/ice/cpp/include/Ice/Current.h +12 -4
  53. data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +1 -1
  54. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +1 -1
  55. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +1 -1
  56. data/ext/ice/cpp/include/Ice/Dispatcher.h +1 -1
  57. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +1 -1
  58. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -1
  59. data/ext/ice/cpp/include/Ice/Endpoint.h +16 -6
  60. data/ext/ice/cpp/include/Ice/EndpointF.h +12 -4
  61. data/ext/ice/cpp/include/Ice/EndpointTypes.h +12 -4
  62. data/ext/ice/cpp/include/Ice/Exception.h +3 -3
  63. data/ext/ice/cpp/include/Ice/FacetMap.h +12 -4
  64. data/ext/ice/cpp/include/Ice/FactoryTable.h +1 -1
  65. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +1 -1
  66. data/ext/ice/cpp/include/Ice/Format.h +1 -1
  67. data/ext/ice/cpp/include/Ice/Functional.h +1 -1
  68. data/ext/ice/cpp/include/Ice/GCObject.h +5 -1
  69. data/ext/ice/cpp/include/Ice/Handle.h +1 -1
  70. data/ext/ice/cpp/include/Ice/Ice.h +4 -3
  71. data/ext/ice/cpp/include/Ice/Identity.h +13 -5
  72. data/ext/ice/cpp/include/Ice/ImplicitContext.h +12 -4
  73. data/ext/ice/cpp/include/Ice/ImplicitContextF.h +12 -4
  74. data/ext/ice/cpp/include/Ice/Incoming.h +1 -1
  75. data/ext/ice/cpp/include/Ice/IncomingAsync.h +1 -1
  76. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +1 -1
  77. data/ext/ice/cpp/include/Ice/Initialize.h +4 -2
  78. data/ext/ice/cpp/include/Ice/InstanceF.h +1 -1
  79. data/ext/ice/cpp/include/Ice/Instrumentation.h +12 -4
  80. data/ext/ice/cpp/include/Ice/InstrumentationF.h +12 -4
  81. data/ext/ice/cpp/include/Ice/LocalException.h +12 -4
  82. data/ext/ice/cpp/include/Ice/LocalObject.h +1 -1
  83. data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -1
  84. data/ext/ice/cpp/include/Ice/Locator.h +137 -129
  85. data/ext/ice/cpp/include/Ice/LocatorF.h +12 -4
  86. data/ext/ice/cpp/include/Ice/Logger.h +12 -4
  87. data/ext/ice/cpp/include/Ice/LoggerF.h +12 -4
  88. data/ext/ice/cpp/include/Ice/LoggerUtil.h +1 -1
  89. data/ext/ice/cpp/include/Ice/Metrics.h +144 -136
  90. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +1 -1
  91. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +1 -1
  92. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +35 -26
  93. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +1 -1
  94. data/ext/ice/cpp/include/Ice/Object.h +1 -1
  95. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +12 -4
  96. data/ext/ice/cpp/include/Ice/ObjectAdapterF.h +12 -4
  97. data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +1 -1
  98. data/ext/ice/cpp/include/Ice/ObjectF.h +1 -1
  99. data/ext/ice/cpp/include/Ice/ObjectFactory.h +12 -4
  100. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +12 -4
  101. data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +1 -1
  102. data/ext/ice/cpp/include/Ice/ObserverHelper.h +1 -1
  103. data/ext/ice/cpp/include/Ice/Outgoing.h +67 -39
  104. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +31 -34
  105. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +4 -4
  106. data/ext/ice/cpp/include/Ice/Plugin.h +12 -4
  107. data/ext/ice/cpp/include/Ice/PluginF.h +12 -4
  108. data/ext/ice/cpp/include/Ice/Process.h +36 -28
  109. data/ext/ice/cpp/include/Ice/ProcessF.h +12 -4
  110. data/ext/ice/cpp/include/Ice/Properties.h +12 -4
  111. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +86 -78
  112. data/ext/ice/cpp/include/Ice/PropertiesF.h +12 -4
  113. data/ext/ice/cpp/include/Ice/Protocol.h +1 -1
  114. data/ext/ice/cpp/include/Ice/Proxy.h +6 -2
  115. data/ext/ice/cpp/include/Ice/ProxyF.h +1 -1
  116. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -1
  117. data/ext/ice/cpp/include/Ice/ProxyHandle.h +1 -1
  118. data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -1
  119. data/ext/ice/cpp/include/Ice/RemoteLogger.h +137 -129
  120. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +1 -1
  121. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +1 -1
  122. data/ext/ice/cpp/include/Ice/Router.h +37 -29
  123. data/ext/ice/cpp/include/Ice/RouterF.h +12 -4
  124. data/ext/ice/cpp/include/Ice/ServantLocator.h +12 -4
  125. data/ext/ice/cpp/include/Ice/ServantLocatorF.h +12 -4
  126. data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -1
  127. data/ext/ice/cpp/include/Ice/Service.h +1 -1
  128. data/ext/ice/cpp/include/Ice/SliceChecksumDict.h +12 -4
  129. data/ext/ice/cpp/include/Ice/SliceChecksums.h +1 -1
  130. data/ext/ice/cpp/include/Ice/SlicedData.h +1 -6
  131. data/ext/ice/cpp/include/Ice/SlicedDataF.h +1 -1
  132. data/ext/ice/cpp/include/Ice/Stream.h +3 -5
  133. data/ext/ice/cpp/include/Ice/StreamF.h +1 -1
  134. data/ext/ice/cpp/include/Ice/StreamHelpers.h +1 -1
  135. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -1
  136. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +1 -1
  137. data/ext/ice/cpp/include/Ice/Version.h +14 -6
  138. data/ext/ice/cpp/include/IceSSL/Config.h +19 -1
  139. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +61 -7
  140. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +52 -5
  141. data/ext/ice/cpp/include/IceSSL/IceSSL.h +2 -2
  142. data/ext/ice/cpp/include/IceSSL/Plugin.h +32 -26
  143. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +1 -1
  144. data/ext/ice/cpp/include/IceUtil/Atomic.h +186 -0
  145. data/ext/ice/cpp/include/IceUtil/Cache.h +1 -1
  146. data/ext/ice/cpp/include/IceUtil/Cond.h +1 -1
  147. data/ext/ice/cpp/include/IceUtil/Config.h +31 -20
  148. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +1 -1
  149. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +1 -1
  150. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +9 -2
  151. data/ext/ice/cpp/include/IceUtil/Exception.h +4 -3
  152. data/ext/ice/cpp/include/IceUtil/Functional.h +1 -1
  153. data/ext/ice/cpp/include/IceUtil/Handle.h +1 -1
  154. data/ext/ice/cpp/include/IceUtil/IceUtil.h +2 -2
  155. data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +1 -1
  156. data/ext/ice/cpp/include/IceUtil/InputUtil.h +1 -1
  157. data/ext/ice/cpp/include/IceUtil/Iterator.h +1 -1
  158. data/ext/ice/cpp/include/IceUtil/Lock.h +1 -1
  159. data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -1
  160. data/ext/ice/cpp/include/IceUtil/Mutex.h +1 -1
  161. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +1 -1
  162. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +1 -1
  163. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +1 -1
  164. data/ext/ice/cpp/include/IceUtil/Optional.h +1 -1
  165. data/ext/ice/cpp/include/IceUtil/Options.h +1 -1
  166. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +8 -11
  167. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +1 -1
  168. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +5 -1
  169. data/ext/ice/cpp/include/IceUtil/Random.h +1 -1
  170. data/ext/ice/cpp/include/IceUtil/RecMutex.h +1 -1
  171. data/ext/ice/cpp/include/IceUtil/SHA1.h +8 -26
  172. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +5 -5
  173. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +1 -1
  174. data/ext/ice/cpp/include/IceUtil/Shared.h +3 -37
  175. data/ext/ice/cpp/include/IceUtil/StringUtil.h +1 -1
  176. data/ext/ice/cpp/include/IceUtil/Thread.h +1 -1
  177. data/ext/ice/cpp/include/IceUtil/ThreadException.h +1 -1
  178. data/ext/ice/cpp/include/IceUtil/Time.h +1 -1
  179. data/ext/ice/cpp/include/IceUtil/Timer.h +1 -1
  180. data/ext/ice/cpp/include/IceUtil/UUID.h +1 -1
  181. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -1
  182. data/ext/ice/cpp/include/IceUtil/UniquePtr.h +1 -1
  183. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +7 -6
  184. data/ext/ice/cpp/include/Slice/Checksum.h +1 -1
  185. data/ext/ice/cpp/include/Slice/CsUtil.h +1 -1
  186. data/ext/ice/cpp/include/Slice/DotNetNames.h +1 -1
  187. data/ext/ice/cpp/include/Slice/FileTracker.h +1 -1
  188. data/ext/ice/cpp/include/Slice/JavaUtil.h +3 -1
  189. data/ext/ice/cpp/include/Slice/ObjCUtil.h +127 -0
  190. data/ext/ice/cpp/include/Slice/PHPUtil.h +1 -1
  191. data/ext/ice/cpp/include/Slice/Parser.h +18 -12
  192. data/ext/ice/cpp/include/Slice/Preprocessor.h +6 -4
  193. data/ext/ice/cpp/include/Slice/PythonUtil.h +1 -1
  194. data/ext/ice/cpp/include/Slice/RubyUtil.h +1 -1
  195. data/ext/ice/cpp/include/Slice/Util.h +20 -2
  196. data/ext/ice/cpp/src/Ice/ACM.cpp +1 -1
  197. data/ext/ice/cpp/src/Ice/ACM.h +1 -1
  198. data/ext/ice/cpp/src/Ice/Acceptor.cpp +1 -1
  199. data/ext/ice/cpp/src/Ice/Acceptor.h +1 -1
  200. data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -1
  201. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +1 -1
  202. data/ext/ice/cpp/src/Ice/Base64.cpp +1 -1
  203. data/ext/ice/cpp/src/Ice/Base64.h +1 -1
  204. data/ext/ice/cpp/src/Ice/BasicStream.cpp +7 -5
  205. data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +227 -0
  206. data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +59 -0
  207. data/ext/ice/cpp/src/Ice/Buffer.cpp +3 -3
  208. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +10 -4
  209. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +82 -282
  210. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +8 -21
  211. data/ext/ice/cpp/src/Ice/Communicator.cpp +11 -5
  212. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +10 -4
  213. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +6 -6
  214. data/ext/ice/cpp/src/Ice/CommunicatorI.h +1 -1
  215. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +42 -180
  216. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +10 -19
  217. data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +25 -0
  218. data/ext/ice/cpp/src/Ice/Connection.cpp +17 -11
  219. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +10 -4
  220. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +137 -51
  221. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +18 -8
  222. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +105 -391
  223. data/ext/ice/cpp/src/Ice/ConnectionI.h +25 -23
  224. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +5 -29
  225. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +3 -8
  226. data/ext/ice/cpp/src/Ice/Connector.cpp +1 -1
  227. data/ext/ice/cpp/src/Ice/Connector.h +1 -1
  228. data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -1
  229. data/ext/ice/cpp/src/Ice/Current.cpp +10 -4
  230. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +1 -1
  231. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -1
  232. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -1
  233. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +1 -1
  234. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +1 -1
  235. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +1 -1
  236. data/ext/ice/cpp/src/Ice/Endpoint.cpp +17 -11
  237. data/ext/ice/cpp/src/Ice/EndpointF.cpp +10 -4
  238. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +19 -1
  239. data/ext/ice/cpp/src/Ice/EndpointFactory.h +13 -1
  240. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -1
  241. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +1 -1
  242. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +1 -1
  243. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -1
  244. data/ext/ice/cpp/src/Ice/EndpointI.cpp +1 -1
  245. data/ext/ice/cpp/src/Ice/EndpointI.h +33 -1
  246. data/ext/ice/cpp/src/Ice/EndpointIF.h +1 -1
  247. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +10 -4
  248. data/ext/ice/cpp/src/Ice/EventHandler.cpp +1 -1
  249. data/ext/ice/cpp/src/Ice/EventHandler.h +4 -1
  250. data/ext/ice/cpp/src/Ice/EventHandlerF.h +1 -1
  251. data/ext/ice/cpp/src/Ice/Exception.cpp +20 -11
  252. data/ext/ice/cpp/src/Ice/FacetMap.cpp +10 -4
  253. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +1 -1
  254. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -2
  255. data/ext/ice/cpp/src/Ice/GCObject.cpp +1 -1
  256. data/ext/ice/cpp/src/Ice/HashUtil.h +1 -1
  257. data/ext/ice/cpp/src/Ice/HttpParser.cpp +27 -15
  258. data/ext/ice/cpp/src/Ice/HttpParser.h +4 -6
  259. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +7 -1
  260. data/ext/ice/cpp/src/Ice/IPEndpointI.h +2 -1
  261. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +1 -1
  262. data/ext/ice/cpp/src/Ice/Identity.cpp +11 -5
  263. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +11 -5
  264. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +10 -4
  265. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +1 -1
  266. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +1 -1
  267. data/ext/ice/cpp/src/Ice/Incoming.cpp +22 -20
  268. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +1 -1
  269. data/ext/ice/cpp/src/Ice/IncomingRequest.h +1 -1
  270. data/ext/ice/cpp/src/Ice/Initialize.cpp +31 -5
  271. data/ext/ice/cpp/src/Ice/Instance.cpp +102 -59
  272. data/ext/ice/cpp/src/Ice/Instance.h +28 -2
  273. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +20 -14
  274. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +10 -4
  275. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +1 -1
  276. data/ext/ice/cpp/src/Ice/InstrumentationI.h +1 -1
  277. data/ext/ice/cpp/src/Ice/LocalException.cpp +10 -4
  278. data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -1
  279. data/ext/ice/cpp/src/Ice/Locator.cpp +83 -77
  280. data/ext/ice/cpp/src/Ice/LocatorF.cpp +10 -4
  281. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +77 -69
  282. data/ext/ice/cpp/src/Ice/LocatorInfo.h +1 -1
  283. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -1
  284. data/ext/ice/cpp/src/Ice/Logger.cpp +11 -5
  285. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +1 -1
  286. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +1 -1
  287. data/ext/ice/cpp/src/Ice/LoggerF.cpp +10 -4
  288. data/ext/ice/cpp/src/Ice/LoggerI.cpp +10 -8
  289. data/ext/ice/cpp/src/Ice/LoggerI.h +1 -1
  290. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +2 -2
  291. data/ext/ice/cpp/src/Ice/Metrics.cpp +122 -116
  292. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +1 -1
  293. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -1
  294. data/ext/ice/cpp/src/Ice/Network.cpp +63 -19
  295. data/ext/ice/cpp/src/Ice/Network.h +10 -3
  296. data/ext/ice/cpp/src/Ice/NetworkF.h +1 -1
  297. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +1 -1
  298. data/ext/ice/cpp/src/Ice/NetworkProxy.h +1 -1
  299. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -1
  300. data/ext/ice/cpp/src/Ice/Object.cpp +1 -1
  301. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +11 -5
  302. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +10 -4
  303. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +9 -9
  304. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +2 -2
  305. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +3 -3
  306. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +5 -5
  307. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +11 -5
  308. data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +10 -4
  309. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +9 -10
  310. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +1 -1
  311. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +1 -1
  312. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +6 -5
  313. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +1 -1
  314. data/ext/ice/cpp/src/Ice/Outgoing.cpp +209 -254
  315. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +120 -106
  316. data/ext/ice/cpp/src/Ice/Plugin.cpp +12 -6
  317. data/ext/ice/cpp/src/Ice/PluginF.cpp +10 -4
  318. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +21 -2
  319. data/ext/ice/cpp/src/Ice/Process.cpp +25 -19
  320. data/ext/ice/cpp/src/Ice/ProcessF.cpp +10 -4
  321. data/ext/ice/cpp/src/Ice/Properties.cpp +11 -5
  322. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +39 -33
  323. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +1 -1
  324. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +1 -1
  325. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +10 -4
  326. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +1 -1
  327. data/ext/ice/cpp/src/Ice/PropertiesI.h +1 -1
  328. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +12 -8
  329. data/ext/ice/cpp/src/Ice/PropertyNames.h +2 -2
  330. data/ext/ice/cpp/src/Ice/Protocol.cpp +7 -7
  331. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +9 -6
  332. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +25 -7
  333. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -1
  334. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +1 -1
  335. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +1 -1
  336. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -1
  337. data/ext/ice/cpp/src/Ice/Proxy.cpp +32 -13
  338. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +1 -1
  339. data/ext/ice/cpp/src/Ice/ProxyFactory.h +1 -1
  340. data/ext/ice/cpp/src/Ice/Reference.cpp +101 -86
  341. data/ext/ice/cpp/src/Ice/Reference.h +16 -9
  342. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +1 -1
  343. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +1 -1
  344. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -1
  345. data/ext/ice/cpp/src/Ice/RegisterPlugins.cpp +28 -0
  346. data/ext/ice/cpp/src/Ice/RegisterPlugins.h +25 -0
  347. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +92 -86
  348. data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -1
  349. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +1 -1
  350. data/ext/ice/cpp/src/Ice/RequestHandler.h +4 -8
  351. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +24 -16
  352. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +5 -4
  353. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +1 -1
  354. data/ext/ice/cpp/src/Ice/ResponseHandler.h +3 -3
  355. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +16 -5
  356. data/ext/ice/cpp/src/Ice/RetryQueue.h +3 -2
  357. data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -1
  358. data/ext/ice/cpp/src/Ice/Router.cpp +27 -21
  359. data/ext/ice/cpp/src/Ice/RouterF.cpp +10 -4
  360. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +1 -1
  361. data/ext/ice/cpp/src/Ice/RouterInfo.h +1 -1
  362. data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -1
  363. data/ext/ice/cpp/src/Ice/Selector.cpp +480 -1
  364. data/ext/ice/cpp/src/Ice/Selector.h +130 -1
  365. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +11 -5
  366. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +10 -4
  367. data/ext/ice/cpp/src/Ice/ServantManager.cpp +29 -23
  368. data/ext/ice/cpp/src/Ice/ServantManager.h +1 -1
  369. data/ext/ice/cpp/src/Ice/SharedContext.h +1 -1
  370. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +10 -4
  371. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +1 -1
  372. data/ext/ice/cpp/src/Ice/SlicedData.cpp +1 -1
  373. data/ext/ice/cpp/src/Ice/Stream.cpp +1 -1
  374. data/ext/ice/cpp/src/Ice/StreamI.cpp +1 -1
  375. data/ext/ice/cpp/src/Ice/StreamI.h +1 -1
  376. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +30 -22
  377. data/ext/ice/cpp/src/Ice/StreamSocket.h +7 -4
  378. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +1 -1
  379. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +1 -1
  380. data/ext/ice/cpp/src/Ice/SysLoggerI.h +1 -1
  381. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +8 -8
  382. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +1 -1
  383. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +1 -1
  384. data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -1
  385. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +21 -38
  386. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +5 -6
  387. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +29 -4
  388. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -2
  389. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +2 -2
  390. data/ext/ice/cpp/src/Ice/ThreadPool.h +1 -1
  391. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -2
  392. data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -1
  393. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +1 -1
  394. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +16 -7
  395. data/ext/ice/cpp/src/Ice/TraceUtil.h +1 -1
  396. data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -1
  397. data/ext/ice/cpp/src/Ice/Transceiver.h +2 -1
  398. data/ext/ice/cpp/src/Ice/TransceiverF.h +1 -1
  399. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +1 -1
  400. data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -1
  401. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +13 -39
  402. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +2 -5
  403. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +46 -10
  404. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +3 -2
  405. data/ext/ice/cpp/src/Ice/Version.cpp +12 -6
  406. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +1 -1
  407. data/ext/ice/cpp/src/Ice/WSAcceptor.h +1 -1
  408. data/ext/ice/cpp/src/Ice/WSConnector.cpp +1 -1
  409. data/ext/ice/cpp/src/Ice/WSConnector.h +1 -1
  410. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +6 -38
  411. data/ext/ice/cpp/src/Ice/WSEndpoint.h +12 -1
  412. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +31 -35
  413. data/ext/ice/cpp/src/Ice/WSTransceiver.h +13 -1
  414. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +66 -60
  415. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +106 -100
  416. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +1 -1
  417. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +1 -1
  418. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +76 -36
  419. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +1 -1
  420. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +19 -6
  421. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +1 -1
  422. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +452 -0
  423. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +732 -0
  424. data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +520 -0
  425. data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.h +36 -0
  426. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +8 -8
  427. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +1 -1
  428. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +49 -47
  429. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +13 -5
  430. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +1 -1
  431. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +1 -1
  432. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +10 -38
  433. data/ext/ice/cpp/src/IceSSL/EndpointI.h +4 -3
  434. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +13 -5
  435. data/ext/ice/cpp/src/IceSSL/Instance.cpp +2 -2
  436. data/ext/ice/cpp/src/IceSSL/Instance.h +1 -1
  437. data/ext/ice/cpp/src/IceSSL/InstanceF.h +1 -1
  438. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +107 -111
  439. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +130 -47
  440. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +11 -3
  441. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +8 -14
  442. data/ext/ice/cpp/src/IceSSL/PluginI.h +1 -1
  443. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +1 -1
  444. data/ext/ice/cpp/src/IceSSL/RFC2253.h +1 -1
  445. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +238 -156
  446. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +93 -66
  447. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +7 -3
  448. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +2 -2
  449. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +32 -35
  450. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +1 -1
  451. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +244 -360
  452. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +59 -29
  453. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +8 -4
  454. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +1 -1
  455. data/ext/ice/cpp/src/IceSSL/TrustManager.h +1 -1
  456. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +1 -1
  457. data/ext/ice/cpp/src/IceSSL/Util.cpp +427 -620
  458. data/ext/ice/cpp/src/IceSSL/Util.h +72 -15
  459. data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +1 -1
  460. data/ext/ice/cpp/src/IceUtil/ArgVector.h +1 -1
  461. data/ext/ice/cpp/src/IceUtil/Cond.cpp +1 -1
  462. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +1 -1
  463. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +1 -1
  464. data/ext/ice/cpp/src/IceUtil/CountDownLatch.cpp +1 -1
  465. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +1 -1
  466. data/ext/ice/cpp/src/IceUtil/Exception.cpp +105 -96
  467. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +2 -1
  468. data/ext/ice/cpp/src/IceUtil/FileUtil.h +9 -1
  469. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -1
  470. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -1
  471. data/ext/ice/cpp/src/IceUtil/Options.cpp +1 -1
  472. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +12 -25
  473. data/ext/ice/cpp/src/IceUtil/Random.cpp +1 -1
  474. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +1 -1
  475. data/ext/ice/cpp/src/IceUtil/SHA1.cpp +72 -10
  476. data/ext/ice/cpp/src/IceUtil/Shared.cpp +3 -132
  477. data/ext/ice/cpp/src/IceUtil/StopWatch.h +1 -1
  478. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +1 -1
  479. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +1 -1
  480. data/ext/ice/cpp/src/IceUtil/Thread.cpp +16 -1
  481. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +1 -1
  482. data/ext/ice/cpp/src/IceUtil/Time.cpp +1 -1
  483. data/ext/ice/cpp/src/IceUtil/Timer.cpp +1 -1
  484. data/ext/ice/cpp/src/IceUtil/UUID.cpp +1 -1
  485. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +1 -1
  486. data/ext/ice/cpp/src/IceUtil/Unicode.h +1 -1
  487. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +62 -55
  488. data/ext/ice/cpp/src/Slice/Checksum.cpp +1 -1
  489. data/ext/ice/cpp/src/Slice/CsUtil.cpp +8 -29
  490. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +1 -1
  491. data/ext/ice/cpp/src/Slice/FileTracker.cpp +1 -1
  492. data/ext/ice/cpp/src/Slice/Grammar.cpp +1 -1
  493. data/ext/ice/cpp/src/Slice/GrammarUtil.h +1 -1
  494. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +145 -172
  495. data/ext/ice/cpp/src/Slice/MD5.cpp +1 -1
  496. data/ext/ice/cpp/src/Slice/MD5.h +1 -1
  497. data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +1310 -0
  498. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +1 -1
  499. data/ext/ice/cpp/src/Slice/Parser.cpp +65 -187
  500. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +61 -9
  501. data/ext/ice/cpp/src/Slice/Python.cpp +36 -3
  502. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +10 -10
  503. data/ext/ice/cpp/src/Slice/Ruby.cpp +34 -3
  504. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +8 -7
  505. data/ext/ice/cpp/src/Slice/Scanner.cpp +1 -1
  506. data/ext/ice/cpp/src/Slice/Util.cpp +137 -30
  507. data/ext/ice/mcpp/LICENSE +29 -0
  508. data/ext/ice/mcpp/Makefile +60 -0
  509. data/ext/ice/mcpp/Makefile.mak +46 -0
  510. data/ext/ice/mcpp/README.md +30 -0
  511. data/ext/ice/mcpp/config.h +89 -0
  512. data/ext/ice/mcpp/configed.H +1 -146
  513. data/ext/ice/mcpp/directive.c +115 -410
  514. data/ext/ice/mcpp/eval.c +38 -377
  515. data/ext/ice/mcpp/expand.c +155 -852
  516. data/ext/ice/mcpp/internal.H +10 -44
  517. data/ext/ice/mcpp/main.c +6 -345
  518. data/ext/ice/mcpp/mbchar.c +17 -654
  519. data/ext/ice/mcpp/mcpp.gyp +62 -0
  520. data/ext/ice/mcpp/support.c +116 -943
  521. data/ext/ice/mcpp/system.H +0 -23
  522. data/ext/ice/mcpp/system.c +81 -2321
  523. data/ice.gemspec +3 -4
  524. data/lib/Glacier2.rb +1 -1
  525. data/lib/Glacier2/Metrics.rb +2 -2
  526. data/lib/Glacier2/PermissionsVerifier.rb +2 -2
  527. data/lib/Glacier2/PermissionsVerifierF.rb +2 -2
  528. data/lib/Glacier2/Router.rb +2 -2
  529. data/lib/Glacier2/RouterF.rb +2 -2
  530. data/lib/Glacier2/SSLInfo.rb +2 -2
  531. data/lib/Glacier2/Session.rb +2 -2
  532. data/lib/Ice.rb +1 -1
  533. data/lib/Ice/BuiltinSequences.rb +2 -2
  534. data/lib/Ice/Communicator.rb +2 -2
  535. data/lib/Ice/CommunicatorF.rb +2 -2
  536. data/lib/Ice/Connection.rb +26 -14
  537. data/lib/Ice/ConnectionF.rb +2 -2
  538. data/lib/Ice/Current.rb +2 -2
  539. data/lib/Ice/Endpoint.rb +4 -2
  540. data/lib/Ice/EndpointF.rb +2 -2
  541. data/lib/Ice/EndpointTypes.rb +2 -2
  542. data/lib/Ice/FacetMap.rb +2 -2
  543. data/lib/Ice/Identity.rb +2 -2
  544. data/lib/Ice/ImplicitContext.rb +2 -2
  545. data/lib/Ice/ImplicitContextF.rb +2 -2
  546. data/lib/Ice/Instrumentation.rb +2 -2
  547. data/lib/Ice/InstrumentationF.rb +2 -2
  548. data/lib/Ice/LocalException.rb +2 -2
  549. data/lib/Ice/Locator.rb +2 -2
  550. data/lib/Ice/LocatorF.rb +2 -2
  551. data/lib/Ice/Logger.rb +2 -2
  552. data/lib/Ice/LoggerF.rb +2 -2
  553. data/lib/Ice/Metrics.rb +2 -2
  554. data/lib/Ice/ObjectAdapterF.rb +2 -2
  555. data/lib/Ice/ObjectFactory.rb +2 -2
  556. data/lib/Ice/ObjectFactoryF.rb +2 -2
  557. data/lib/Ice/Plugin.rb +2 -2
  558. data/lib/Ice/PluginF.rb +2 -2
  559. data/lib/Ice/Process.rb +2 -2
  560. data/lib/Ice/ProcessF.rb +2 -2
  561. data/lib/Ice/Properties.rb +2 -2
  562. data/lib/Ice/PropertiesAdmin.rb +2 -2
  563. data/lib/Ice/PropertiesF.rb +2 -2
  564. data/lib/Ice/Router.rb +2 -2
  565. data/lib/Ice/RouterF.rb +2 -2
  566. data/lib/Ice/SliceChecksumDict.rb +2 -2
  567. data/lib/Ice/Version.rb +2 -2
  568. data/lib/IceBox.rb +1 -1
  569. data/lib/IceBox/IceBox.rb +2 -2
  570. data/lib/IceGrid.rb +1 -1
  571. data/lib/IceGrid/Admin.rb +2 -2
  572. data/lib/IceGrid/Descriptor.rb +2 -2
  573. data/lib/IceGrid/Exception.rb +2 -2
  574. data/lib/IceGrid/FileParser.rb +2 -2
  575. data/lib/IceGrid/Locator.rb +2 -2
  576. data/lib/IceGrid/Observer.rb +2 -2
  577. data/lib/IceGrid/Query.rb +2 -2
  578. data/lib/IceGrid/Registry.rb +2 -2
  579. data/lib/IceGrid/Session.rb +2 -2
  580. data/lib/IceGrid/UserAccountMapper.rb +2 -2
  581. data/lib/IcePatch2.rb +1 -1
  582. data/lib/IcePatch2/FileInfo.rb +52 -2
  583. data/lib/IcePatch2/FileServer.rb +33 -4
  584. data/lib/IceStorm.rb +1 -1
  585. data/lib/IceStorm/IceStorm.rb +2 -2
  586. data/lib/IceStorm/Metrics.rb +2 -2
  587. data/slice/Freeze/BackgroundSaveEvictor.ice +2 -2
  588. data/slice/Freeze/CatalogData.ice +2 -2
  589. data/slice/Freeze/Connection.ice +2 -2
  590. data/slice/Freeze/ConnectionF.ice +2 -2
  591. data/slice/Freeze/DB.ice +2 -2
  592. data/slice/Freeze/Evictor.ice +2 -2
  593. data/slice/Freeze/EvictorF.ice +2 -2
  594. data/slice/Freeze/EvictorStorage.ice +2 -2
  595. data/slice/Freeze/Exception.ice +2 -2
  596. data/slice/Freeze/Transaction.ice +2 -2
  597. data/slice/Freeze/TransactionalEvictor.ice +2 -2
  598. data/slice/Glacier2/Metrics.ice +7 -6
  599. data/slice/Glacier2/PermissionsVerifier.ice +4 -3
  600. data/slice/Glacier2/PermissionsVerifierF.ice +3 -2
  601. data/slice/Glacier2/Router.ice +4 -3
  602. data/slice/Glacier2/RouterF.ice +3 -2
  603. data/slice/Glacier2/SSLInfo.ice +3 -2
  604. data/slice/Glacier2/Session.ice +12 -11
  605. data/slice/Ice/BuiltinSequences.ice +4 -3
  606. data/slice/Ice/Communicator.ice +22 -25
  607. data/slice/Ice/CommunicatorF.ice +3 -2
  608. data/slice/Ice/Connection.ice +39 -11
  609. data/slice/Ice/ConnectionF.ice +3 -2
  610. data/slice/Ice/Current.ice +4 -3
  611. data/slice/Ice/Endpoint.ice +11 -3
  612. data/slice/Ice/EndpointF.ice +3 -2
  613. data/slice/Ice/EndpointTypes.ice +3 -2
  614. data/slice/Ice/FacetMap.ice +3 -2
  615. data/slice/Ice/Identity.ice +3 -2
  616. data/slice/Ice/ImplicitContext.ice +3 -2
  617. data/slice/Ice/ImplicitContextF.ice +3 -2
  618. data/slice/Ice/Instrumentation.ice +4 -2
  619. data/slice/Ice/InstrumentationF.ice +4 -2
  620. data/slice/Ice/LocalException.ice +29 -10
  621. data/slice/Ice/Locator.ice +5 -3
  622. data/slice/Ice/LocatorF.ice +3 -2
  623. data/slice/Ice/Logger.ice +3 -2
  624. data/slice/Ice/LoggerF.ice +3 -2
  625. data/slice/Ice/Metrics.ice +15 -14
  626. data/slice/Ice/ObjectAdapter.ice +5 -4
  627. data/slice/Ice/ObjectAdapterF.ice +3 -2
  628. data/slice/Ice/ObjectFactory.ice +3 -2
  629. data/slice/Ice/ObjectFactoryF.ice +3 -2
  630. data/slice/Ice/Plugin.ice +3 -2
  631. data/slice/Ice/PluginF.ice +3 -2
  632. data/slice/Ice/Process.ice +3 -2
  633. data/slice/Ice/ProcessF.ice +3 -2
  634. data/slice/Ice/Properties.ice +3 -2
  635. data/slice/Ice/PropertiesAdmin.ice +3 -2
  636. data/slice/Ice/PropertiesF.ice +3 -2
  637. data/slice/Ice/RemoteLogger.ice +3 -2
  638. data/slice/Ice/Router.ice +3 -2
  639. data/slice/Ice/RouterF.ice +3 -2
  640. data/slice/Ice/ServantLocator.ice +3 -2
  641. data/slice/Ice/ServantLocatorF.ice +3 -2
  642. data/slice/Ice/SliceChecksumDict.ice +3 -2
  643. data/slice/Ice/Version.ice +3 -2
  644. data/slice/IceBox/IceBox.ice +2 -2
  645. data/slice/IceDiscovery/IceDiscovery.ice +2 -2
  646. data/slice/IceGrid/Admin.ice +49 -48
  647. data/slice/IceGrid/Descriptor.ice +3 -2
  648. data/slice/IceGrid/Exception.ice +6 -5
  649. data/slice/IceGrid/FileParser.ice +4 -3
  650. data/slice/IceGrid/Locator.ice +4 -3
  651. data/slice/IceGrid/Observer.ice +28 -27
  652. data/slice/IceGrid/PluginFacade.ice +3 -2
  653. data/slice/IceGrid/Query.ice +3 -2
  654. data/slice/IceGrid/Registry.ice +4 -3
  655. data/slice/IceGrid/Session.ice +9 -8
  656. data/slice/IceGrid/UserAccountMapper.ice +4 -3
  657. data/slice/{IceGrid/Discovery.ice → IceLocatorDiscovery/IceLocatorDiscovery.ice} +12 -14
  658. data/slice/IcePatch2/FileInfo.ice +31 -2
  659. data/slice/IcePatch2/FileServer.ice +63 -5
  660. data/slice/IceSSL/ConnectionInfo.ice +17 -2
  661. data/slice/IceSSL/EndpointInfo.ice +21 -3
  662. data/slice/IceStorm/IceStorm.ice +3 -2
  663. data/slice/IceStorm/Metrics.ice +4 -3
  664. metadata +27 -23
  665. data/ext/ice/cpp/include/Ice/Makefile +0 -26
  666. data/ext/ice/cpp/include/IceSSL/Makefile +0 -26
  667. data/ext/ice/cpp/include/IceUtil/Makefile +0 -26
  668. data/ext/ice/cpp/include/Slice/Makefile +0 -26
  669. data/ext/ice/cpp/src/Ice/Application.cpp +0 -760
  670. data/ext/ice/cpp/src/Ice/EventLoggerMsg.h +0 -53
  671. data/ext/ice/cpp/src/Ice/Makefile +0 -190
  672. data/ext/ice/cpp/src/Ice/Service.cpp +0 -1897
  673. data/ext/ice/cpp/src/IceDiscovery/Makefile +0 -61
  674. data/ext/ice/cpp/src/IceSSL/Makefile +0 -82
  675. data/ext/ice/cpp/src/IceUtil/Makefile +0 -68
  676. data/ext/ice/cpp/src/Slice/Makefile +0 -65
  677. data/ext/ice/mcpp/config.h.Darwin +0 -227
  678. data/ext/ice/mcpp/config.h.Linux +0 -227
  679. data/ext/ice/mcpp/config.h.MINGW +0 -7
@@ -1,53 +0,0 @@
1
- // **********************************************************************
2
- //
3
- // Copyright (c) 2003-2015 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
- // Values are 32 bit values laid out as follows:
11
- //
12
- // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
13
- // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
14
- // +---+-+-+-----------------------+-------------------------------+
15
- // |Sev|C|R| Facility | Code |
16
- // +---+-+-+-----------------------+-------------------------------+
17
- //
18
- // where
19
- //
20
- // Sev - is the severity code
21
- //
22
- // 00 - Success
23
- // 01 - Informational
24
- // 10 - Warning
25
- // 11 - Error
26
- //
27
- // C - is the Customer code flag
28
- //
29
- // R - is a reserved bit
30
- //
31
- // Facility - is the facility code
32
- //
33
- // Code - is the facility's status code
34
- //
35
- //
36
- // Define the facility codes
37
- //
38
-
39
-
40
- //
41
- // Define the severity codes
42
- //
43
-
44
-
45
- //
46
- // MessageId: EVENT_LOGGER_MSG
47
- //
48
- // MessageText:
49
- //
50
- // %1
51
- //
52
- #define EVENT_LOGGER_MSG 0x00000000L
53
-
@@ -1,190 +0,0 @@
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
- top_srcdir = ../..
11
-
12
- LIBFILENAME = $(call mklibfilename,Ice,$(VERSION))
13
- SONAME = $(call mksoname,Ice,$(SOVERSION))
14
- LIBNAME = $(call mklibname,Ice)
15
- TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)$(cpp11libdirsuffix)/$(LIBNAME))
16
-
17
- SLICE_OBJS = BuiltinSequences.o \
18
- Communicator.o \
19
- CommunicatorF.o \
20
- Connection.o \
21
- ConnectionF.o \
22
- Current.o \
23
- Endpoint.o \
24
- EndpointF.o \
25
- EndpointTypes.o \
26
- FacetMap.o \
27
- Identity.o \
28
- ImplicitContext.o \
29
- ImplicitContextF.o \
30
- Instrumentation.o \
31
- InstrumentationF.o \
32
- LocalException.o \
33
- Locator.o \
34
- LocatorF.o \
35
- Logger.o \
36
- LoggerF.o \
37
- Metrics.o \
38
- ObjectAdapter.o \
39
- ObjectAdapterF.o \
40
- ObjectFactory.o \
41
- ObjectFactoryF.o \
42
- Plugin.o \
43
- PluginF.o \
44
- Process.o \
45
- ProcessF.o \
46
- Properties.o \
47
- PropertiesAdmin.o \
48
- PropertiesF.o \
49
- RemoteLogger.o \
50
- Router.o \
51
- RouterF.o \
52
- ServantLocator.o \
53
- ServantLocatorF.o \
54
- SliceChecksumDict.o \
55
- Version.o
56
-
57
- OBJS = Acceptor.o \
58
- ACM.o \
59
- Application.o \
60
- AsyncResult.o \
61
- Base64.o \
62
- BasicStream.o \
63
- Buffer.o \
64
- CollocatedRequestHandler.o \
65
- CommunicatorI.o \
66
- ConnectionFactory.o \
67
- ConnectionI.o \
68
- ConnectionRequestHandler.o \
69
- Connector.o \
70
- ConnectRequestHandler.o \
71
- DefaultsAndOverrides.o \
72
- DeprecatedStringConverter.o \
73
- DispatchInterceptor.o \
74
- DynamicLibrary.o \
75
- EndpointFactory.o \
76
- EndpointFactoryManager.o \
77
- EndpointI.o \
78
- EventHandler.o \
79
- Exception.o \
80
- FactoryTable.o \
81
- FactoryTableInit.o \
82
- GCObject.o \
83
- HttpParser.o \
84
- ImplicitContextI.o \
85
- Incoming.o \
86
- IncomingAsync.o \
87
- Initialize.o \
88
- Instance.o \
89
- InstrumentationI.o \
90
- IPEndpointI.o \
91
- LocalObject.o \
92
- LocatorInfo.o \
93
- LoggerAdminI.o \
94
- LoggerI.o \
95
- LoggerUtil.o \
96
- MetricsAdminI.o \
97
- MetricsObserverI.o \
98
- Network.o \
99
- NetworkProxy.o \
100
- Object.o \
101
- ObjectAdapterFactory.o \
102
- ObjectAdapterI.o \
103
- ObjectFactoryManager.o \
104
- ObserverHelper.o \
105
- OpaqueEndpointI.o \
106
- Outgoing.o \
107
- OutgoingAsync.o \
108
- PluginManagerI.o \
109
- PropertiesAdminI.o \
110
- PropertiesI.o \
111
- PropertyNames.o \
112
- Protocol.o \
113
- ProtocolInstance.o \
114
- ProtocolPluginFacade.o \
115
- Proxy.o \
116
- ProxyFactory.o \
117
- Reference.o \
118
- ReferenceFactory.o \
119
- RequestHandler.o \
120
- RequestHandlerFactory.o \
121
- ResponseHandler.o \
122
- RetryQueue.o \
123
- RouterInfo.o \
124
- Selector.o \
125
- ServantManager.o \
126
- SliceChecksums.o \
127
- SlicedData.o \
128
- Stream.o \
129
- StreamI.o \
130
- StreamSocket.o \
131
- StringConverterPlugin.o \
132
- TcpAcceptor.o \
133
- TcpConnector.o \
134
- TcpEndpointI.o \
135
- TcpTransceiver.o \
136
- ThreadPool.o \
137
- TraceLevels.o \
138
- TraceUtil.o \
139
- Transceiver.o \
140
- UdpConnector.o \
141
- UdpEndpointI.o \
142
- UdpTransceiver.o \
143
- WSAcceptor.o \
144
- WSConnector.o \
145
- WSEndpoint.o \
146
- WSTransceiver.o \
147
- $(SLICE_OBJS)
148
-
149
- ifeq ($(findstring MINGW,$(shell uname)),)
150
- OBJS := $(OBJS) \
151
- Service.o \
152
- SysLoggerI.o
153
- endif
154
-
155
- HDIR = $(headerdir)/Ice
156
- SDIR = $(slicedir)/Ice
157
-
158
- include $(top_srcdir)/config/Make.rules
159
-
160
- CPPFLAGS := -I.. $(CPPFLAGS) -DICE_API_EXPORTS $(BZIP2_FLAGS)
161
- ifneq ($(COMPSUFFIX),)
162
- CPPFLAGS := $(CPPFLAGS) -DCOMPSUFFIX=\"$(COMPSUFFIX)\"
163
- endif
164
- SLICE2CPPFLAGS := --ice --include-dir Ice --dll-export ICE_API $(SLICE2CPPFLAGS)
165
-
166
- LINKWITH := -lIceUtil $(BZIP2_LIBS) $(ICE_OS_LIBS) $(ICONV_LIBS)
167
-
168
- ifeq ($(STATICLIBS),yes)
169
- $(libdir)/$(LIBNAME): $(OBJS)
170
- @mkdir -p $(dir $@)
171
- rm -f $@
172
- $(call mklib,$@,$(OBJS))
173
- else
174
- $(libdir)/$(LIBFILENAME): $(OBJS)
175
- @mkdir -p $(dir $@)
176
- rm -f $@
177
- $(call mkshlib,$@,$(SONAME),$(OBJS),$(LINKWITH))
178
-
179
- $(libdir)/$(SONAME): $(libdir)/$(LIBFILENAME)
180
- rm -f $@
181
- ln -s $(LIBFILENAME) $@
182
-
183
- $(libdir)$(cpp11libdirsuffix)/$(LIBNAME): $(libdir)/$(SONAME)
184
- @mkdir -p $(libdir)$(cpp11libdirsuffix)
185
- rm -f $@
186
- ln -s $(cpp11sonamedir)$(SONAME) $@
187
- endif
188
-
189
- install:: all
190
- $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME))
@@ -1,1897 +0,0 @@
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