zeroc-ice 3.6b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (675) hide show
  1. checksums.yaml +7 -0
  2. data/ICE_LICENSE +54 -0
  3. data/LICENSE +339 -0
  4. data/bin/slice2rb +17 -0
  5. data/ext/Communicator.cpp +596 -0
  6. data/ext/Communicator.h +25 -0
  7. data/ext/Config.h +111 -0
  8. data/ext/Connection.cpp +381 -0
  9. data/ext/Connection.h +26 -0
  10. data/ext/Endpoint.cpp +311 -0
  11. data/ext/Endpoint.h +27 -0
  12. data/ext/ImplicitContext.cpp +152 -0
  13. data/ext/ImplicitContext.h +25 -0
  14. data/ext/Init.cpp +52 -0
  15. data/ext/Logger.cpp +151 -0
  16. data/ext/Logger.h +28 -0
  17. data/ext/ObjectFactory.cpp +140 -0
  18. data/ext/ObjectFactory.h +50 -0
  19. data/ext/Operation.cpp +676 -0
  20. data/ext/Operation.h +36 -0
  21. data/ext/Properties.cpp +369 -0
  22. data/ext/Properties.h +25 -0
  23. data/ext/Proxy.cpp +1354 -0
  24. data/ext/Proxy.h +27 -0
  25. data/ext/Slice.cpp +223 -0
  26. data/ext/Slice.h +22 -0
  27. data/ext/Types.cpp +3160 -0
  28. data/ext/Types.h +545 -0
  29. data/ext/Util.cpp +792 -0
  30. data/ext/Util.h +511 -0
  31. data/ext/extconf.rb +118 -0
  32. data/ext/ice/BZIP_LICENSE +42 -0
  33. data/ext/ice/MCPP_LICENSE +36 -0
  34. data/ext/ice/bzip2/blocksort.c +1094 -0
  35. data/ext/ice/bzip2/bzlib.c +1572 -0
  36. data/ext/ice/bzip2/bzlib.h +282 -0
  37. data/ext/ice/bzip2/bzlib_private.h +509 -0
  38. data/ext/ice/bzip2/compress.c +672 -0
  39. data/ext/ice/bzip2/crctable.c +104 -0
  40. data/ext/ice/bzip2/decompress.c +646 -0
  41. data/ext/ice/bzip2/huffman.c +205 -0
  42. data/ext/ice/bzip2/randtable.c +84 -0
  43. data/ext/ice/cpp/include/Ice/ACMF.h +30 -0
  44. data/ext/ice/cpp/include/Ice/Application.h +156 -0
  45. data/ext/ice/cpp/include/Ice/AsyncResult.h +363 -0
  46. data/ext/ice/cpp/include/Ice/AsyncResultF.h +26 -0
  47. data/ext/ice/cpp/include/Ice/BasicStream.h +1315 -0
  48. data/ext/ice/cpp/include/Ice/Buffer.h +159 -0
  49. data/ext/ice/cpp/include/Ice/BuiltinSequences.h +74 -0
  50. data/ext/ice/cpp/include/Ice/Communicator.h +194 -0
  51. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +115 -0
  52. data/ext/ice/cpp/include/Ice/CommunicatorF.h +60 -0
  53. data/ext/ice/cpp/include/Ice/Config.h +97 -0
  54. data/ext/ice/cpp/include/Ice/Connection.h +495 -0
  55. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +115 -0
  56. data/ext/ice/cpp/include/Ice/ConnectionF.h +72 -0
  57. data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +30 -0
  58. data/ext/ice/cpp/include/Ice/ConnectionIF.h +37 -0
  59. data/ext/ice/cpp/include/Ice/Current.h +94 -0
  60. data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +48 -0
  61. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +62 -0
  62. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +33 -0
  63. data/ext/ice/cpp/include/Ice/Dispatcher.h +51 -0
  64. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +105 -0
  65. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +29 -0
  66. data/ext/ice/cpp/include/Ice/Endpoint.h +350 -0
  67. data/ext/ice/cpp/include/Ice/EndpointF.h +97 -0
  68. data/ext/ice/cpp/include/Ice/EndpointTypes.h +74 -0
  69. data/ext/ice/cpp/include/Ice/Exception.h +114 -0
  70. data/ext/ice/cpp/include/Ice/FacetMap.h +56 -0
  71. data/ext/ice/cpp/include/Ice/FactoryTable.h +69 -0
  72. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +87 -0
  73. data/ext/ice/cpp/include/Ice/Format.h +39 -0
  74. data/ext/ice/cpp/include/Ice/Functional.h +138 -0
  75. data/ext/ice/cpp/include/Ice/GCObject.h +73 -0
  76. data/ext/ice/cpp/include/Ice/Handle.h +192 -0
  77. data/ext/ice/cpp/include/Ice/Ice.h +54 -0
  78. data/ext/ice/cpp/include/Ice/Identity.h +160 -0
  79. data/ext/ice/cpp/include/Ice/ImplicitContext.h +96 -0
  80. data/ext/ice/cpp/include/Ice/ImplicitContextF.h +60 -0
  81. data/ext/ice/cpp/include/Ice/Incoming.h +131 -0
  82. data/ext/ice/cpp/include/Ice/IncomingAsync.h +108 -0
  83. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +35 -0
  84. data/ext/ice/cpp/include/Ice/Initialize.h +141 -0
  85. data/ext/ice/cpp/include/Ice/InstanceF.h +26 -0
  86. data/ext/ice/cpp/include/Ice/Instrumentation.h +377 -0
  87. data/ext/ice/cpp/include/Ice/InstrumentationF.h +71 -0
  88. data/ext/ice/cpp/include/Ice/LocalException.h +1022 -0
  89. data/ext/ice/cpp/include/Ice/LocalObject.h +36 -0
  90. data/ext/ice/cpp/include/Ice/LocalObjectF.h +26 -0
  91. data/ext/ice/cpp/include/Ice/Locator.h +2191 -0
  92. data/ext/ice/cpp/include/Ice/LocatorF.h +89 -0
  93. data/ext/ice/cpp/include/Ice/Logger.h +94 -0
  94. data/ext/ice/cpp/include/Ice/LoggerF.h +60 -0
  95. data/ext/ice/cpp/include/Ice/LoggerUtil.h +153 -0
  96. data/ext/ice/cpp/include/Ice/Makefile +26 -0
  97. data/ext/ice/cpp/include/Ice/Metrics.h +2989 -0
  98. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +662 -0
  99. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +144 -0
  100. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +576 -0
  101. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +55 -0
  102. data/ext/ice/cpp/include/Ice/Object.h +165 -0
  103. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +162 -0
  104. data/ext/ice/cpp/include/Ice/ObjectAdapterF.h +60 -0
  105. data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +26 -0
  106. data/ext/ice/cpp/include/Ice/ObjectF.h +26 -0
  107. data/ext/ice/cpp/include/Ice/ObjectFactory.h +86 -0
  108. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +60 -0
  109. data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +26 -0
  110. data/ext/ice/cpp/include/Ice/ObserverHelper.h +177 -0
  111. data/ext/ice/cpp/include/Ice/Outgoing.h +197 -0
  112. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +264 -0
  113. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +38 -0
  114. data/ext/ice/cpp/include/Ice/Plugin.h +121 -0
  115. data/ext/ice/cpp/include/Ice/PluginF.h +66 -0
  116. data/ext/ice/cpp/include/Ice/Process.h +568 -0
  117. data/ext/ice/cpp/include/Ice/ProcessF.h +77 -0
  118. data/ext/ice/cpp/include/Ice/Properties.h +130 -0
  119. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +824 -0
  120. data/ext/ice/cpp/include/Ice/PropertiesF.h +83 -0
  121. data/ext/ice/cpp/include/Ice/Protocol.h +242 -0
  122. data/ext/ice/cpp/include/Ice/Proxy.h +2448 -0
  123. data/ext/ice/cpp/include/Ice/ProxyF.h +78 -0
  124. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +26 -0
  125. data/ext/ice/cpp/include/Ice/ProxyHandle.h +330 -0
  126. data/ext/ice/cpp/include/Ice/ReferenceF.h +34 -0
  127. data/ext/ice/cpp/include/Ice/RemoteLogger.h +1496 -0
  128. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +29 -0
  129. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +25 -0
  130. data/ext/ice/cpp/include/Ice/Router.h +1155 -0
  131. data/ext/ice/cpp/include/Ice/RouterF.h +77 -0
  132. data/ext/ice/cpp/include/Ice/ServantLocator.h +90 -0
  133. data/ext/ice/cpp/include/Ice/ServantLocatorF.h +60 -0
  134. data/ext/ice/cpp/include/Ice/ServantManagerF.h +26 -0
  135. data/ext/ice/cpp/include/Ice/Service.h +260 -0
  136. data/ext/ice/cpp/include/Ice/SliceChecksumDict.h +56 -0
  137. data/ext/ice/cpp/include/Ice/SliceChecksums.h +34 -0
  138. data/ext/ice/cpp/include/Ice/SlicedData.h +103 -0
  139. data/ext/ice/cpp/include/Ice/SlicedDataF.h +34 -0
  140. data/ext/ice/cpp/include/Ice/Stream.h +449 -0
  141. data/ext/ice/cpp/include/Ice/StreamF.h +30 -0
  142. data/ext/ice/cpp/include/Ice/StreamHelpers.h +877 -0
  143. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +28 -0
  144. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +56 -0
  145. data/ext/ice/cpp/include/Ice/Version.h +254 -0
  146. data/ext/ice/cpp/include/IceSSL/Config.h +23 -0
  147. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +119 -0
  148. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +101 -0
  149. data/ext/ice/cpp/include/IceSSL/IceSSL.h +22 -0
  150. data/ext/ice/cpp/include/IceSSL/Makefile +26 -0
  151. data/ext/ice/cpp/include/IceSSL/Plugin.h +558 -0
  152. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +119 -0
  153. data/ext/ice/cpp/include/IceUtil/Cache.h +362 -0
  154. data/ext/ice/cpp/include/IceUtil/Cond.h +323 -0
  155. data/ext/ice/cpp/include/IceUtil/Config.h +234 -0
  156. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +50 -0
  157. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +70 -0
  158. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +45 -0
  159. data/ext/ice/cpp/include/IceUtil/Exception.h +184 -0
  160. data/ext/ice/cpp/include/IceUtil/Functional.h +389 -0
  161. data/ext/ice/cpp/include/IceUtil/Handle.h +266 -0
  162. data/ext/ice/cpp/include/IceUtil/IceUtil.h +51 -0
  163. data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +302 -0
  164. data/ext/ice/cpp/include/IceUtil/InputUtil.h +47 -0
  165. data/ext/ice/cpp/include/IceUtil/Iterator.h +36 -0
  166. data/ext/ice/cpp/include/IceUtil/Lock.h +135 -0
  167. data/ext/ice/cpp/include/IceUtil/Makefile +26 -0
  168. data/ext/ice/cpp/include/IceUtil/Monitor.h +249 -0
  169. data/ext/ice/cpp/include/IceUtil/Mutex.h +357 -0
  170. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +28 -0
  171. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +83 -0
  172. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +82 -0
  173. data/ext/ice/cpp/include/IceUtil/Optional.h +322 -0
  174. data/ext/ice/cpp/include/IceUtil/Options.h +141 -0
  175. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +362 -0
  176. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +19 -0
  177. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +26 -0
  178. data/ext/ice/cpp/include/IceUtil/Random.h +24 -0
  179. data/ext/ice/cpp/include/IceUtil/RecMutex.h +113 -0
  180. data/ext/ice/cpp/include/IceUtil/SHA1.h +65 -0
  181. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +44 -0
  182. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +97 -0
  183. data/ext/ice/cpp/include/IceUtil/Shared.h +168 -0
  184. data/ext/ice/cpp/include/IceUtil/StringConverter.h +175 -0
  185. data/ext/ice/cpp/include/IceUtil/StringUtil.h +91 -0
  186. data/ext/ice/cpp/include/IceUtil/Thread.h +181 -0
  187. data/ext/ice/cpp/include/IceUtil/ThreadException.h +108 -0
  188. data/ext/ice/cpp/include/IceUtil/Time.h +209 -0
  189. data/ext/ice/cpp/include/IceUtil/Timer.h +143 -0
  190. data/ext/ice/cpp/include/IceUtil/UUID.h +22 -0
  191. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +42 -0
  192. data/ext/ice/cpp/include/IceUtil/UniquePtr.h +101 -0
  193. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +64 -0
  194. data/ext/ice/cpp/include/Slice/Checksum.h +26 -0
  195. data/ext/ice/cpp/include/Slice/CsUtil.h +92 -0
  196. data/ext/ice/cpp/include/Slice/DotNetNames.h +34 -0
  197. data/ext/ice/cpp/include/Slice/FileTracker.h +71 -0
  198. data/ext/ice/cpp/include/Slice/JavaUtil.h +277 -0
  199. data/ext/ice/cpp/include/Slice/Makefile +26 -0
  200. data/ext/ice/cpp/include/Slice/PHPUtil.h +50 -0
  201. data/ext/ice/cpp/include/Slice/Parser.h +1116 -0
  202. data/ext/ice/cpp/include/Slice/Preprocessor.h +68 -0
  203. data/ext/ice/cpp/include/Slice/PythonUtil.h +64 -0
  204. data/ext/ice/cpp/include/Slice/RubyUtil.h +54 -0
  205. data/ext/ice/cpp/include/Slice/Util.h +33 -0
  206. data/ext/ice/cpp/src/Ice/ACM.cpp +343 -0
  207. data/ext/ice/cpp/src/Ice/ACM.h +117 -0
  208. data/ext/ice/cpp/src/Ice/Acceptor.cpp +16 -0
  209. data/ext/ice/cpp/src/Ice/Acceptor.h +41 -0
  210. data/ext/ice/cpp/src/Ice/AcceptorF.h +30 -0
  211. data/ext/ice/cpp/src/Ice/Application.cpp +760 -0
  212. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +599 -0
  213. data/ext/ice/cpp/src/Ice/Base64.cpp +269 -0
  214. data/ext/ice/cpp/src/Ice/Base64.h +36 -0
  215. data/ext/ice/cpp/src/Ice/BasicStream.cpp +3393 -0
  216. data/ext/ice/cpp/src/Ice/Buffer.cpp +98 -0
  217. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +34 -0
  218. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +718 -0
  219. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +106 -0
  220. data/ext/ice/cpp/src/Ice/Communicator.cpp +45 -0
  221. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +38 -0
  222. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +386 -0
  223. data/ext/ice/cpp/src/Ice/CommunicatorI.h +112 -0
  224. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +546 -0
  225. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +97 -0
  226. data/ext/ice/cpp/src/Ice/Connection.cpp +58 -0
  227. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +38 -0
  228. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +1639 -0
  229. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +236 -0
  230. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +3876 -0
  231. data/ext/ice/cpp/src/Ice/ConnectionI.h +364 -0
  232. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +115 -0
  233. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +50 -0
  234. data/ext/ice/cpp/src/Ice/Connector.cpp +16 -0
  235. data/ext/ice/cpp/src/Ice/Connector.h +36 -0
  236. data/ext/ice/cpp/src/Ice/ConnectorF.h +26 -0
  237. data/ext/ice/cpp/src/Ice/Current.cpp +38 -0
  238. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +168 -0
  239. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +57 -0
  240. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +26 -0
  241. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +60 -0
  242. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +49 -0
  243. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +281 -0
  244. data/ext/ice/cpp/src/Ice/Endpoint.cpp +53 -0
  245. data/ext/ice/cpp/src/Ice/EndpointF.cpp +38 -0
  246. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +25 -0
  247. data/ext/ice/cpp/src/Ice/EndpointFactory.h +44 -0
  248. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +26 -0
  249. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +208 -0
  250. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +46 -0
  251. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +26 -0
  252. data/ext/ice/cpp/src/Ice/EndpointI.cpp +87 -0
  253. data/ext/ice/cpp/src/Ice/EndpointI.h +165 -0
  254. data/ext/ice/cpp/src/Ice/EndpointIF.h +41 -0
  255. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +38 -0
  256. data/ext/ice/cpp/src/Ice/EventHandler.cpp +35 -0
  257. data/ext/ice/cpp/src/Ice/EventHandler.h +78 -0
  258. data/ext/ice/cpp/src/Ice/EventHandlerF.h +26 -0
  259. data/ext/ice/cpp/src/Ice/EventLoggerMsg.h +53 -0
  260. data/ext/ice/cpp/src/Ice/Exception.cpp +832 -0
  261. data/ext/ice/cpp/src/Ice/FacetMap.cpp +34 -0
  262. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +158 -0
  263. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +95 -0
  264. data/ext/ice/cpp/src/Ice/GCObject.cpp +444 -0
  265. data/ext/ice/cpp/src/Ice/HashUtil.h +59 -0
  266. data/ext/ice/cpp/src/Ice/HttpParser.cpp +680 -0
  267. data/ext/ice/cpp/src/Ice/HttpParser.h +124 -0
  268. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +733 -0
  269. data/ext/ice/cpp/src/Ice/IPEndpointI.h +157 -0
  270. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +29 -0
  271. data/ext/ice/cpp/src/Ice/Identity.cpp +42 -0
  272. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -0
  273. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +38 -0
  274. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +639 -0
  275. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +51 -0
  276. data/ext/ice/cpp/src/Ice/Incoming.cpp +757 -0
  277. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +340 -0
  278. data/ext/ice/cpp/src/Ice/IncomingRequest.h +37 -0
  279. data/ext/ice/cpp/src/Ice/Initialize.cpp +401 -0
  280. data/ext/ice/cpp/src/Ice/Instance.cpp +1928 -0
  281. data/ext/ice/cpp/src/Ice/Instance.h +198 -0
  282. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +68 -0
  283. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +43 -0
  284. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +1083 -0
  285. data/ext/ice/cpp/src/Ice/InstrumentationI.h +262 -0
  286. data/ext/ice/cpp/src/Ice/LocalException.cpp +2091 -0
  287. data/ext/ice/cpp/src/Ice/LocalObject.cpp +29 -0
  288. data/ext/ice/cpp/src/Ice/Locator.cpp +1946 -0
  289. data/ext/ice/cpp/src/Ice/LocatorF.cpp +39 -0
  290. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +917 -0
  291. data/ext/ice/cpp/src/Ice/LocatorInfo.h +193 -0
  292. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +34 -0
  293. data/ext/ice/cpp/src/Ice/Logger.cpp +40 -0
  294. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +862 -0
  295. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +46 -0
  296. data/ext/ice/cpp/src/Ice/LoggerF.cpp +38 -0
  297. data/ext/ice/cpp/src/Ice/LoggerI.cpp +199 -0
  298. data/ext/ice/cpp/src/Ice/LoggerI.h +57 -0
  299. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +107 -0
  300. data/ext/ice/cpp/src/Ice/Makefile +190 -0
  301. data/ext/ice/cpp/src/Ice/Metrics.cpp +2159 -0
  302. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +669 -0
  303. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +14 -0
  304. data/ext/ice/cpp/src/Ice/Network.cpp +2694 -0
  305. data/ext/ice/cpp/src/Ice/Network.h +291 -0
  306. data/ext/ice/cpp/src/Ice/NetworkF.h +28 -0
  307. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +325 -0
  308. data/ext/ice/cpp/src/Ice/NetworkProxy.h +74 -0
  309. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +26 -0
  310. data/ext/ice/cpp/src/Ice/Object.cpp +440 -0
  311. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +41 -0
  312. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +38 -0
  313. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +241 -0
  314. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +52 -0
  315. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +1498 -0
  316. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +155 -0
  317. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -0
  318. data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +38 -0
  319. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +140 -0
  320. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +43 -0
  321. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +84 -0
  322. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +407 -0
  323. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +70 -0
  324. data/ext/ice/cpp/src/Ice/Outgoing.cpp +737 -0
  325. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +874 -0
  326. data/ext/ice/cpp/src/Ice/Plugin.cpp +43 -0
  327. data/ext/ice/cpp/src/Ice/PluginF.cpp +38 -0
  328. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +503 -0
  329. data/ext/ice/cpp/src/Ice/PluginManagerI.h +67 -0
  330. data/ext/ice/cpp/src/Ice/Process.cpp +299 -0
  331. data/ext/ice/cpp/src/Ice/ProcessF.cpp +39 -0
  332. data/ext/ice/cpp/src/Ice/Properties.cpp +45 -0
  333. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +555 -0
  334. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +207 -0
  335. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +45 -0
  336. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +39 -0
  337. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +759 -0
  338. data/ext/ice/cpp/src/Ice/PropertiesI.h +78 -0
  339. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +1293 -0
  340. data/ext/ice/cpp/src/Ice/PropertyNames.h +81 -0
  341. data/ext/ice/cpp/src/Ice/Protocol.cpp +137 -0
  342. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +98 -0
  343. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +91 -0
  344. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +26 -0
  345. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +51 -0
  346. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +67 -0
  347. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +26 -0
  348. data/ext/ice/cpp/src/Ice/Proxy.cpp +1810 -0
  349. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +305 -0
  350. data/ext/ice/cpp/src/Ice/ProxyFactory.h +57 -0
  351. data/ext/ice/cpp/src/Ice/Reference.cpp +1947 -0
  352. data/ext/ice/cpp/src/Ice/Reference.h +305 -0
  353. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +937 -0
  354. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +81 -0
  355. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +24 -0
  356. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +958 -0
  357. data/ext/ice/cpp/src/Ice/ReplyStatus.h +29 -0
  358. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +40 -0
  359. data/ext/ice/cpp/src/Ice/RequestHandler.h +90 -0
  360. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +70 -0
  361. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +41 -0
  362. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +20 -0
  363. data/ext/ice/cpp/src/Ice/ResponseHandler.h +39 -0
  364. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +154 -0
  365. data/ext/ice/cpp/src/Ice/RetryQueue.h +69 -0
  366. data/ext/ice/cpp/src/Ice/RetryQueueF.h +24 -0
  367. data/ext/ice/cpp/src/Ice/Router.cpp +849 -0
  368. data/ext/ice/cpp/src/Ice/RouterF.cpp +39 -0
  369. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +381 -0
  370. data/ext/ice/cpp/src/Ice/RouterInfo.h +148 -0
  371. data/ext/ice/cpp/src/Ice/RouterInfoF.h +30 -0
  372. data/ext/ice/cpp/src/Ice/Selector.cpp +926 -0
  373. data/ext/ice/cpp/src/Ice/Selector.h +231 -0
  374. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -0
  375. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +38 -0
  376. data/ext/ice/cpp/src/Ice/ServantManager.cpp +495 -0
  377. data/ext/ice/cpp/src/Ice/ServantManager.h +74 -0
  378. data/ext/ice/cpp/src/Ice/Service.cpp +1897 -0
  379. data/ext/ice/cpp/src/Ice/SharedContext.h +51 -0
  380. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +34 -0
  381. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +80 -0
  382. data/ext/ice/cpp/src/Ice/SlicedData.cpp +80 -0
  383. data/ext/ice/cpp/src/Ice/Stream.cpp +53 -0
  384. data/ext/ice/cpp/src/Ice/StreamI.cpp +832 -0
  385. data/ext/ice/cpp/src/Ice/StreamI.h +198 -0
  386. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +521 -0
  387. data/ext/ice/cpp/src/Ice/StreamSocket.h +85 -0
  388. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +145 -0
  389. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +167 -0
  390. data/ext/ice/cpp/src/Ice/SysLoggerI.h +43 -0
  391. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +235 -0
  392. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +67 -0
  393. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +133 -0
  394. data/ext/ice/cpp/src/Ice/TcpConnector.h +51 -0
  395. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +397 -0
  396. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +93 -0
  397. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +127 -0
  398. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +61 -0
  399. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +1357 -0
  400. data/ext/ice/cpp/src/Ice/ThreadPool.h +399 -0
  401. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +43 -0
  402. data/ext/ice/cpp/src/Ice/TraceLevels.h +50 -0
  403. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +26 -0
  404. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +452 -0
  405. data/ext/ice/cpp/src/Ice/TraceUtil.h +28 -0
  406. data/ext/ice/cpp/src/Ice/Transceiver.cpp +24 -0
  407. data/ext/ice/cpp/src/Ice/Transceiver.h +52 -0
  408. data/ext/ice/cpp/src/Ice/TransceiverF.h +38 -0
  409. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +144 -0
  410. data/ext/ice/cpp/src/Ice/UdpConnector.h +51 -0
  411. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +483 -0
  412. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +95 -0
  413. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +1156 -0
  414. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +123 -0
  415. data/ext/ice/cpp/src/Ice/Version.cpp +46 -0
  416. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +103 -0
  417. data/ext/ice/cpp/src/Ice/WSAcceptor.h +61 -0
  418. data/ext/ice/cpp/src/Ice/WSConnector.cpp +113 -0
  419. data/ext/ice/cpp/src/Ice/WSConnector.h +51 -0
  420. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +441 -0
  421. data/ext/ice/cpp/src/Ice/WSEndpoint.h +97 -0
  422. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +1728 -0
  423. data/ext/ice/cpp/src/Ice/WSTransceiver.h +149 -0
  424. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +594 -0
  425. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1035 -0
  426. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +208 -0
  427. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +78 -0
  428. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +308 -0
  429. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +183 -0
  430. data/ext/ice/cpp/src/IceDiscovery/Makefile +61 -0
  431. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +148 -0
  432. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +39 -0
  433. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +258 -0
  434. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +66 -0
  435. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +1334 -0
  436. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -0
  437. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +151 -0
  438. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +56 -0
  439. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +397 -0
  440. data/ext/ice/cpp/src/IceSSL/EndpointI.h +96 -0
  441. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +41 -0
  442. data/ext/ice/cpp/src/IceSSL/Instance.cpp +38 -0
  443. data/ext/ice/cpp/src/IceSSL/Instance.h +42 -0
  444. data/ext/ice/cpp/src/IceSSL/InstanceF.h +34 -0
  445. data/ext/ice/cpp/src/IceSSL/Makefile +82 -0
  446. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +1001 -0
  447. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +607 -0
  448. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +75 -0
  449. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +102 -0
  450. data/ext/ice/cpp/src/IceSSL/PluginI.h +56 -0
  451. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +541 -0
  452. data/ext/ice/cpp/src/IceSSL/RFC2253.h +67 -0
  453. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +729 -0
  454. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +1062 -0
  455. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +130 -0
  456. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +291 -0
  457. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +264 -0
  458. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +41 -0
  459. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +1514 -0
  460. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +609 -0
  461. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +91 -0
  462. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +246 -0
  463. data/ext/ice/cpp/src/IceSSL/TrustManager.h +51 -0
  464. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +26 -0
  465. data/ext/ice/cpp/src/IceSSL/Util.cpp +1423 -0
  466. data/ext/ice/cpp/src/IceSSL/Util.h +136 -0
  467. data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +65 -0
  468. data/ext/ice/cpp/src/IceUtil/ArgVector.h +41 -0
  469. data/ext/ice/cpp/src/IceUtil/Cond.cpp +386 -0
  470. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +477 -0
  471. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +144 -0
  472. data/ext/ice/cpp/src/IceUtil/CountDownLatch.cpp +184 -0
  473. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +273 -0
  474. data/ext/ice/cpp/src/IceUtil/Exception.cpp +782 -0
  475. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +532 -0
  476. data/ext/ice/cpp/src/IceUtil/FileUtil.h +159 -0
  477. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +41 -0
  478. data/ext/ice/cpp/src/IceUtil/Makefile +68 -0
  479. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +24 -0
  480. data/ext/ice/cpp/src/IceUtil/Options.cpp +1049 -0
  481. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +591 -0
  482. data/ext/ice/cpp/src/IceUtil/Random.cpp +185 -0
  483. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +257 -0
  484. data/ext/ice/cpp/src/IceUtil/SHA1.cpp +126 -0
  485. data/ext/ice/cpp/src/IceUtil/Shared.cpp +200 -0
  486. data/ext/ice/cpp/src/IceUtil/StopWatch.h +54 -0
  487. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +450 -0
  488. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +842 -0
  489. data/ext/ice/cpp/src/IceUtil/Thread.cpp +809 -0
  490. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +172 -0
  491. data/ext/ice/cpp/src/IceUtil/Time.cpp +306 -0
  492. data/ext/ice/cpp/src/IceUtil/Timer.cpp +251 -0
  493. data/ext/ice/cpp/src/IceUtil/UUID.cpp +174 -0
  494. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +131 -0
  495. data/ext/ice/cpp/src/IceUtil/Unicode.h +49 -0
  496. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +1139 -0
  497. data/ext/ice/cpp/src/Slice/Checksum.cpp +452 -0
  498. data/ext/ice/cpp/src/Slice/CsUtil.cpp +2650 -0
  499. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +146 -0
  500. data/ext/ice/cpp/src/Slice/FileTracker.cpp +203 -0
  501. data/ext/ice/cpp/src/Slice/Grammar.cpp +4755 -0
  502. data/ext/ice/cpp/src/Slice/Grammar.h +98 -0
  503. data/ext/ice/cpp/src/Slice/GrammarUtil.h +234 -0
  504. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +4376 -0
  505. data/ext/ice/cpp/src/Slice/MD5.cpp +57 -0
  506. data/ext/ice/cpp/src/Slice/MD5.h +44 -0
  507. data/ext/ice/cpp/src/Slice/MD5I.cpp +385 -0
  508. data/ext/ice/cpp/src/Slice/MD5I.h +91 -0
  509. data/ext/ice/cpp/src/Slice/Makefile +65 -0
  510. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +156 -0
  511. data/ext/ice/cpp/src/Slice/Parser.cpp +6386 -0
  512. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +686 -0
  513. data/ext/ice/cpp/src/Slice/Python.cpp +675 -0
  514. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +2614 -0
  515. data/ext/ice/cpp/src/Slice/Ruby.cpp +317 -0
  516. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +1774 -0
  517. data/ext/ice/cpp/src/Slice/Scanner.cpp +2426 -0
  518. data/ext/ice/cpp/src/Slice/Util.cpp +325 -0
  519. data/ext/ice/mcpp/config.h.Darwin +227 -0
  520. data/ext/ice/mcpp/config.h.Linux +227 -0
  521. data/ext/ice/mcpp/config.h.MINGW +7 -0
  522. data/ext/ice/mcpp/configed.H +382 -0
  523. data/ext/ice/mcpp/directive.c +1699 -0
  524. data/ext/ice/mcpp/eval.c +1673 -0
  525. data/ext/ice/mcpp/expand.c +2980 -0
  526. data/ext/ice/mcpp/internal.H +564 -0
  527. data/ext/ice/mcpp/main.c +1131 -0
  528. data/ext/ice/mcpp/mbchar.c +869 -0
  529. data/ext/ice/mcpp/mcpp_lib.h +31 -0
  530. data/ext/ice/mcpp/mcpp_out.h +13 -0
  531. data/ext/ice/mcpp/support.c +2811 -0
  532. data/ext/ice/mcpp/system.H +396 -0
  533. data/ext/ice/mcpp/system.c +4940 -0
  534. data/ice.gemspec +41 -0
  535. data/lib/Glacier2.rb +12 -0
  536. data/lib/Glacier2/Metrics.rb +99 -0
  537. data/lib/Glacier2/PermissionsVerifier.rb +168 -0
  538. data/lib/Glacier2/PermissionsVerifierF.rb +34 -0
  539. data/lib/Glacier2/Router.rb +141 -0
  540. data/lib/Glacier2/RouterF.rb +29 -0
  541. data/lib/Glacier2/SSLInfo.rb +79 -0
  542. data/lib/Glacier2/Session.rb +470 -0
  543. data/lib/Ice.rb +659 -0
  544. data/lib/Ice/BuiltinSequences.rb +64 -0
  545. data/lib/Ice/Communicator.rb +93 -0
  546. data/lib/Ice/CommunicatorF.rb +28 -0
  547. data/lib/Ice/Connection.rb +414 -0
  548. data/lib/Ice/ConnectionF.rb +36 -0
  549. data/lib/Ice/Current.rb +152 -0
  550. data/lib/Ice/Endpoint.rb +265 -0
  551. data/lib/Ice/EndpointF.rb +52 -0
  552. data/lib/Ice/EndpointTypes.rb +77 -0
  553. data/lib/Ice/FacetMap.rb +28 -0
  554. data/lib/Ice/Identity.rb +70 -0
  555. data/lib/Ice/ImplicitContext.rb +59 -0
  556. data/lib/Ice/ImplicitContextF.rb +28 -0
  557. data/lib/Ice/Instrumentation.rb +425 -0
  558. data/lib/Ice/InstrumentationF.rb +35 -0
  559. data/lib/Ice/LocalException.rb +1081 -0
  560. data/lib/Ice/Locator.rb +314 -0
  561. data/lib/Ice/LocatorF.rb +34 -0
  562. data/lib/Ice/Logger.rb +57 -0
  563. data/lib/Ice/LoggerF.rb +28 -0
  564. data/lib/Ice/Metrics.rb +696 -0
  565. data/lib/Ice/ObjectAdapterF.rb +28 -0
  566. data/lib/Ice/ObjectFactory.rb +53 -0
  567. data/lib/Ice/ObjectFactoryF.rb +28 -0
  568. data/lib/Ice/Plugin.rb +87 -0
  569. data/lib/Ice/PluginF.rb +32 -0
  570. data/lib/Ice/Process.rb +93 -0
  571. data/lib/Ice/ProcessF.rb +29 -0
  572. data/lib/Ice/Properties.rb +65 -0
  573. data/lib/Ice/PropertiesAdmin.rb +104 -0
  574. data/lib/Ice/PropertiesF.rb +33 -0
  575. data/lib/Ice/Router.rb +163 -0
  576. data/lib/Ice/RouterF.rb +29 -0
  577. data/lib/Ice/SliceChecksumDict.rb +28 -0
  578. data/lib/Ice/Version.rb +100 -0
  579. data/lib/IceBox.rb +10 -0
  580. data/lib/IceBox/IceBox.rb +272 -0
  581. data/lib/IceGrid.rb +17 -0
  582. data/lib/IceGrid/Admin.rb +1076 -0
  583. data/lib/IceGrid/Descriptor.rb +1505 -0
  584. data/lib/IceGrid/Exception.rb +401 -0
  585. data/lib/IceGrid/FileParser.rb +105 -0
  586. data/lib/IceGrid/Locator.rb +105 -0
  587. data/lib/IceGrid/Observer.rb +571 -0
  588. data/lib/IceGrid/Query.rb +168 -0
  589. data/lib/IceGrid/Registry.rb +120 -0
  590. data/lib/IceGrid/Session.rb +114 -0
  591. data/lib/IceGrid/UserAccountMapper.rb +101 -0
  592. data/lib/IcePatch2.rb +10 -0
  593. data/lib/IcePatch2/FileInfo.rb +75 -0
  594. data/lib/IcePatch2/FileServer.rb +141 -0
  595. data/lib/IceStorm.rb +11 -0
  596. data/lib/IceStorm/IceStorm.rb +463 -0
  597. data/lib/IceStorm/Metrics.rb +155 -0
  598. data/slice/Freeze/BackgroundSaveEvictor.ice +111 -0
  599. data/slice/Freeze/CatalogData.ice +49 -0
  600. data/slice/Freeze/Connection.ice +111 -0
  601. data/slice/Freeze/ConnectionF.ice +20 -0
  602. data/slice/Freeze/DB.ice +37 -0
  603. data/slice/Freeze/Evictor.ice +339 -0
  604. data/slice/Freeze/EvictorF.ice +22 -0
  605. data/slice/Freeze/EvictorStorage.ice +72 -0
  606. data/slice/Freeze/Exception.ice +100 -0
  607. data/slice/Freeze/Transaction.ice +57 -0
  608. data/slice/Freeze/TransactionalEvictor.ice +50 -0
  609. data/slice/Glacier2/Metrics.ice +77 -0
  610. data/slice/Glacier2/PermissionsVerifier.ice +105 -0
  611. data/slice/Glacier2/PermissionsVerifierF.ice +21 -0
  612. data/slice/Glacier2/Router.ice +178 -0
  613. data/slice/Glacier2/RouterF.ice +20 -0
  614. data/slice/Glacier2/SSLInfo.ice +50 -0
  615. data/slice/Glacier2/Session.ice +273 -0
  616. data/slice/Ice/BuiltinSequences.ice +48 -0
  617. data/slice/Ice/Communicator.ice +567 -0
  618. data/slice/Ice/CommunicatorF.ice +20 -0
  619. data/slice/Ice/Connection.ice +323 -0
  620. data/slice/Ice/ConnectionF.ice +22 -0
  621. data/slice/Ice/Current.ice +160 -0
  622. data/slice/Ice/Endpoint.ice +227 -0
  623. data/slice/Ice/EndpointF.ice +32 -0
  624. data/slice/Ice/EndpointTypes.ice +38 -0
  625. data/slice/Ice/FacetMap.ice +25 -0
  626. data/slice/Ice/Identity.ice +59 -0
  627. data/slice/Ice/ImplicitContext.ice +109 -0
  628. data/slice/Ice/ImplicitContextF.ice +20 -0
  629. data/slice/Ice/Instrumentation.ice +499 -0
  630. data/slice/Ice/InstrumentationF.ice +26 -0
  631. data/slice/Ice/LocalException.ice +1015 -0
  632. data/slice/Ice/Locator.ice +227 -0
  633. data/slice/Ice/LocatorF.ice +21 -0
  634. data/slice/Ice/Logger.ice +86 -0
  635. data/slice/Ice/LoggerF.ice +20 -0
  636. data/slice/Ice/Metrics.ice +422 -0
  637. data/slice/Ice/ObjectAdapter.ice +673 -0
  638. data/slice/Ice/ObjectAdapterF.ice +20 -0
  639. data/slice/Ice/ObjectFactory.ice +60 -0
  640. data/slice/Ice/ObjectFactoryF.ice +20 -0
  641. data/slice/Ice/Plugin.ice +117 -0
  642. data/slice/Ice/PluginF.ice +21 -0
  643. data/slice/Ice/Process.ice +54 -0
  644. data/slice/Ice/ProcessF.ice +20 -0
  645. data/slice/Ice/Properties.ice +228 -0
  646. data/slice/Ice/PropertiesAdmin.ice +75 -0
  647. data/slice/Ice/PropertiesF.ice +21 -0
  648. data/slice/Ice/RemoteLogger.ice +232 -0
  649. data/slice/Ice/Router.ice +83 -0
  650. data/slice/Ice/RouterF.ice +20 -0
  651. data/slice/Ice/ServantLocator.ice +117 -0
  652. data/slice/Ice/ServantLocatorF.ice +20 -0
  653. data/slice/Ice/SliceChecksumDict.ice +25 -0
  654. data/slice/Ice/Version.ice +39 -0
  655. data/slice/IceBox/IceBox.ice +194 -0
  656. data/slice/IceDiscovery/IceDiscovery.ice +32 -0
  657. data/slice/IceGrid/Admin.ice +1578 -0
  658. data/slice/IceGrid/Descriptor.ice +1079 -0
  659. data/slice/IceGrid/Discovery.ice +73 -0
  660. data/slice/IceGrid/Exception.ice +383 -0
  661. data/slice/IceGrid/FileParser.ice +61 -0
  662. data/slice/IceGrid/Locator.ice +56 -0
  663. data/slice/IceGrid/Observer.ice +394 -0
  664. data/slice/IceGrid/PluginFacade.ice +316 -0
  665. data/slice/IceGrid/Query.ice +130 -0
  666. data/slice/IceGrid/Registry.ice +138 -0
  667. data/slice/IceGrid/Session.ice +124 -0
  668. data/slice/IceGrid/UserAccountMapper.ice +58 -0
  669. data/slice/IcePatch2/FileInfo.ice +49 -0
  670. data/slice/IcePatch2/FileServer.ice +129 -0
  671. data/slice/IceSSL/ConnectionInfo.ice +34 -0
  672. data/slice/IceSSL/EndpointInfo.ice +41 -0
  673. data/slice/IceStorm/IceStorm.ice +405 -0
  674. data/slice/IceStorm/Metrics.ice +71 -0
  675. metadata +737 -0
@@ -0,0 +1,305 @@
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/Thread.h>
11
+ #include <IceUtil/Time.h>
12
+ #include <Ice/ProxyFactory.h>
13
+ #include <Ice/Instance.h>
14
+ #include <Ice/Proxy.h>
15
+ #include <Ice/ReferenceFactory.h>
16
+ #include <Ice/LocatorInfo.h>
17
+ #include <Ice/RouterInfo.h>
18
+ #include <Ice/BasicStream.h>
19
+ #include <Ice/Properties.h>
20
+ #include <Ice/LoggerUtil.h>
21
+ #include <Ice/TraceLevels.h>
22
+ #include <Ice/LocalException.h>
23
+ #include <Ice/OutgoingAsync.h>
24
+
25
+ using namespace std;
26
+ using namespace Ice;
27
+ using namespace IceInternal;
28
+
29
+ IceUtil::Shared* IceInternal::upCast(ProxyFactory* p) { return p; }
30
+
31
+ ObjectPrx
32
+ IceInternal::ProxyFactory::stringToProxy(const string& str) const
33
+ {
34
+ ReferencePtr ref = _instance->referenceFactory()->create(str, "");
35
+ return referenceToProxy(ref);
36
+ }
37
+
38
+ string
39
+ IceInternal::ProxyFactory::proxyToString(const ObjectPrx& proxy) const
40
+ {
41
+ if(proxy)
42
+ {
43
+ return proxy->__reference()->toString();
44
+ }
45
+ else
46
+ {
47
+ return "";
48
+ }
49
+ }
50
+
51
+ ObjectPrx
52
+ IceInternal::ProxyFactory::propertyToProxy(const string& prefix) const
53
+ {
54
+ string proxy = _instance->initializationData().properties->getProperty(prefix);
55
+ ReferencePtr ref = _instance->referenceFactory()->create(proxy, prefix);
56
+ return referenceToProxy(ref);
57
+ }
58
+
59
+ PropertyDict
60
+ IceInternal::ProxyFactory::proxyToProperty(const ObjectPrx& proxy, const string& prefix) const
61
+ {
62
+ if(proxy)
63
+ {
64
+ return proxy->__reference()->toProperty(prefix);
65
+ }
66
+ else
67
+ {
68
+ return PropertyDict();
69
+ }
70
+ }
71
+
72
+ ObjectPrx
73
+ IceInternal::ProxyFactory::streamToProxy(BasicStream* s) const
74
+ {
75
+ Identity ident;
76
+ s->read(ident);
77
+
78
+ ReferencePtr ref = _instance->referenceFactory()->create(ident, s);
79
+ return referenceToProxy(ref);
80
+ }
81
+
82
+ void
83
+ IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, BasicStream* s) const
84
+ {
85
+ if(proxy)
86
+ {
87
+ s->write(proxy->__reference()->getIdentity());
88
+ proxy->__reference()->streamWrite(s);
89
+ }
90
+ else
91
+ {
92
+ Identity ident;
93
+ s->write(ident);
94
+ }
95
+ }
96
+
97
+ ObjectPrx
98
+ IceInternal::ProxyFactory::referenceToProxy(const ReferencePtr& ref) const
99
+ {
100
+ if(ref)
101
+ {
102
+ ObjectPrx proxy = new ::IceProxy::Ice::Object;
103
+ proxy->setup(ref);
104
+ return proxy;
105
+ }
106
+ else
107
+ {
108
+ return 0;
109
+ }
110
+ }
111
+
112
+ int
113
+ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, const ReferencePtr& ref, int& cnt) const
114
+ {
115
+ TraceLevelsPtr traceLevels = _instance->traceLevels();
116
+ LoggerPtr logger = _instance->initializationData().logger;
117
+
118
+ //
119
+ // We don't retry batch requests because the exception might have
120
+ // caused all the requests batched with the connection to be
121
+ // aborted and we want the application to be notified.
122
+ //
123
+ if(ref->getMode() == Reference::ModeBatchOneway || ref->getMode() == Reference::ModeBatchDatagram)
124
+ {
125
+ ex.ice_throw();
126
+ }
127
+
128
+ const ObjectNotExistException* one = dynamic_cast<const ObjectNotExistException*>(&ex);
129
+ if(one)
130
+ {
131
+ if(ref->getRouterInfo() && one->operation == "ice_add_proxy")
132
+ {
133
+ //
134
+ // If we have a router, an ObjectNotExistException with an
135
+ // operation name "ice_add_proxy" indicates to the client
136
+ // that the router isn't aware of the proxy (for example,
137
+ // because it was evicted by the router). In this case, we
138
+ // must *always* retry, so that the missing proxy is added
139
+ // to the router.
140
+ //
141
+
142
+ ref->getRouterInfo()->clearCache(ref);
143
+
144
+ if(traceLevels->retry >= 1)
145
+ {
146
+ Trace out(logger, traceLevels->retryCat);
147
+ out << "retrying operation call to add proxy to router\n" << ex;
148
+ }
149
+
150
+ return 0; // We must always retry, so we don't look at the retry count.
151
+ }
152
+ else if(ref->isIndirect())
153
+ {
154
+ //
155
+ // We retry ObjectNotExistException if the reference is
156
+ // indirect.
157
+ //
158
+
159
+ if(ref->isWellKnown())
160
+ {
161
+ LocatorInfoPtr li = ref->getLocatorInfo();
162
+ if(li)
163
+ {
164
+ li->clearCache(ref);
165
+ }
166
+ }
167
+ }
168
+ else
169
+ {
170
+ //
171
+ // For all other cases, we don't retry
172
+ // ObjectNotExistException.
173
+ //
174
+ ex.ice_throw();
175
+ }
176
+ }
177
+ else if(dynamic_cast<const RequestFailedException*>(&ex))
178
+ {
179
+ //
180
+ // We don't retry other *NotExistException, which are all
181
+ // derived from RequestFailedException.
182
+ //
183
+ ex.ice_throw();
184
+ }
185
+
186
+ //
187
+ // There is no point in retrying an operation that resulted in a
188
+ // MarshalException. This must have been raised locally (because
189
+ // if it happened in a server it would result in an
190
+ // UnknownLocalException instead), which means there was a problem
191
+ // in this process that will not change if we try again.
192
+ //
193
+ // The most likely cause for a MarshalException is exceeding the
194
+ // maximum message size, which is represented by the subclass
195
+ // MemoryLimitException. For example, a client can attempt to send
196
+ // a message that exceeds the maximum memory size, or accumulate
197
+ // enough batch requests without flushing that the maximum size is
198
+ // reached.
199
+ //
200
+ // This latter case is especially problematic, because if we were
201
+ // to retry a batch request after a MarshalException, we would in
202
+ // fact silently discard the accumulated requests and allow new
203
+ // batch requests to accumulate. If the subsequent batched
204
+ // requests do not exceed the maximum message size, it appears to
205
+ // the client that all of the batched requests were accepted, when
206
+ // in reality only the last few are actually sent.
207
+ //
208
+ if(dynamic_cast<const MarshalException*>(&ex))
209
+ {
210
+ ex.ice_throw();
211
+ }
212
+
213
+ //
214
+ // Don't retry if the communicator is destroyed or object adapter
215
+ // deactivated.
216
+ //
217
+ if(dynamic_cast<const CommunicatorDestroyedException*>(&ex) ||
218
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex))
219
+ {
220
+ ex.ice_throw();
221
+ }
222
+
223
+ //
224
+ // Don't retry invocation timeouts.
225
+ //
226
+ if(dynamic_cast<const InvocationTimeoutException*>(&ex) || dynamic_cast<const InvocationCanceledException*>(&ex))
227
+ {
228
+ ex.ice_throw();
229
+ }
230
+
231
+ ++cnt;
232
+ assert(cnt > 0);
233
+
234
+ int interval = -1;
235
+ if(cnt == static_cast<int>(_retryIntervals.size() + 1) && dynamic_cast<const CloseConnectionException*>(&ex))
236
+ {
237
+ //
238
+ // A close connection exception is always retried at least once, even if the retry
239
+ // limit is reached.
240
+ //
241
+ interval = 0;
242
+ }
243
+ else if(cnt > static_cast<int>(_retryIntervals.size()))
244
+ {
245
+ if(traceLevels->retry >= 1)
246
+ {
247
+ Trace out(logger, traceLevels->retryCat);
248
+ out << "cannot retry operation call because retry limit has been exceeded\n" << ex;
249
+ }
250
+ ex.ice_throw();
251
+ }
252
+ else
253
+ {
254
+ interval = _retryIntervals[cnt - 1];
255
+ }
256
+
257
+ if(traceLevels->retry >= 1)
258
+ {
259
+ Trace out(logger, traceLevels->retryCat);
260
+ out << "retrying operation call";
261
+ if(interval > 0)
262
+ {
263
+ out << " in " << interval << "ms";
264
+ }
265
+ out << " because of exception\n" << ex;
266
+ }
267
+ return interval;
268
+ }
269
+
270
+ IceInternal::ProxyFactory::ProxyFactory(const InstancePtr& instance) :
271
+ _instance(instance)
272
+ {
273
+ StringSeq retryValues = _instance->initializationData().properties->getPropertyAsList("Ice.RetryIntervals");
274
+ if(retryValues.size() == 0)
275
+ {
276
+ _retryIntervals.push_back(0);
277
+ }
278
+ else
279
+ {
280
+ for(StringSeq::const_iterator p = retryValues.begin(); p != retryValues.end(); ++p)
281
+ {
282
+ istringstream value(*p);
283
+
284
+ int v;
285
+ if(!(value >> v) || !value.eof())
286
+ {
287
+ v = 0;
288
+ }
289
+
290
+ //
291
+ // If -1 is the first value, no retry and wait intervals.
292
+ //
293
+ if(v == -1 && _retryIntervals.empty())
294
+ {
295
+ break;
296
+ }
297
+
298
+ _retryIntervals.push_back(v > 0 ? v : 0);
299
+ }
300
+ }
301
+ }
302
+
303
+ IceInternal::ProxyFactory::~ProxyFactory()
304
+ {
305
+ }
@@ -0,0 +1,57 @@
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_PROXY_FACTORY_H
11
+ #define ICE_PROXY_FACTORY_H
12
+
13
+ #include <IceUtil/Shared.h>
14
+ #include <IceUtil/Mutex.h>
15
+ #include <Ice/ProxyFactoryF.h>
16
+ #include <Ice/InstanceF.h>
17
+ #include <Ice/ReferenceF.h>
18
+ #include <Ice/ProxyF.h>
19
+ #include <Ice/Exception.h>
20
+ #include <Ice/OutgoingAsyncF.h>
21
+ #include <Ice/Properties.h>
22
+
23
+ namespace IceInternal
24
+ {
25
+
26
+ class BasicStream;
27
+
28
+ class ProxyFactory : public IceUtil::Shared
29
+ {
30
+ public:
31
+
32
+ Ice::ObjectPrx stringToProxy(const std::string&) const;
33
+ std::string proxyToString(const Ice::ObjectPrx&) const;
34
+
35
+ Ice::ObjectPrx propertyToProxy(const std::string&) const;
36
+ Ice::PropertyDict proxyToProperty(const Ice::ObjectPrx&, const std::string&) const;
37
+
38
+ Ice::ObjectPrx streamToProxy(BasicStream*) const;
39
+ void proxyToStream(const Ice::ObjectPrx&, BasicStream*) const;
40
+
41
+ Ice::ObjectPrx referenceToProxy(const ReferencePtr&) const;
42
+
43
+ int checkRetryAfterException(const Ice::LocalException&, const ReferencePtr&, int&) const;
44
+
45
+ private:
46
+
47
+ ProxyFactory(const InstancePtr&);
48
+ virtual ~ProxyFactory();
49
+ friend class Instance;
50
+
51
+ InstancePtr _instance;
52
+ std::vector<int> _retryIntervals;
53
+ };
54
+
55
+ }
56
+
57
+ #endif
@@ -0,0 +1,1947 @@
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 <Ice/Reference.h>
11
+ #include <Ice/ReferenceFactory.h>
12
+ #include <Ice/LocalException.h>
13
+ #include <Ice/Instance.h>
14
+ #include <Ice/EndpointI.h>
15
+ #include <Ice/OpaqueEndpointI.h>
16
+ #include <Ice/BasicStream.h>
17
+ #include <Ice/RouterInfo.h>
18
+ #include <Ice/Router.h>
19
+ #include <Ice/LocatorInfo.h>
20
+ #include <Ice/Locator.h>
21
+ #include <Ice/Functional.h>
22
+ #include <Ice/ConnectionI.h>
23
+ #include <Ice/ConnectionFactory.h>
24
+ #include <Ice/LoggerUtil.h>
25
+ #include <Ice/TraceLevels.h>
26
+ #include <Ice/HashUtil.h>
27
+ #include <Ice/DefaultsAndOverrides.h>
28
+ #include <IceUtil/StringUtil.h>
29
+ #include <IceUtil/Random.h>
30
+ #include <IceUtil/MutexPtrLock.h>
31
+
32
+ #include <functional>
33
+
34
+ using namespace std;
35
+ using namespace Ice;
36
+ using namespace IceInternal;
37
+
38
+ IceUtil::Shared* IceInternal::upCast(IceInternal::Reference* p) { return p; }
39
+
40
+ namespace
41
+ {
42
+
43
+ IceUtil::Mutex* hashMutex = 0;
44
+
45
+ class Init
46
+ {
47
+ public:
48
+
49
+ Init()
50
+ {
51
+ hashMutex = new IceUtil::Mutex;
52
+ }
53
+
54
+ ~Init()
55
+ {
56
+ delete hashMutex;
57
+ hashMutex = 0;
58
+ }
59
+ };
60
+
61
+ Init init;
62
+
63
+ struct RandomNumberGenerator : public std::unary_function<ptrdiff_t, ptrdiff_t>
64
+ {
65
+ ptrdiff_t operator()(ptrdiff_t d)
66
+ {
67
+ return IceUtilInternal::random(static_cast<int>(d));
68
+ }
69
+ };
70
+
71
+ }
72
+
73
+ CommunicatorPtr
74
+ IceInternal::Reference::getCommunicator() const
75
+ {
76
+ return _communicator;
77
+ }
78
+
79
+ ReferencePtr
80
+ IceInternal::Reference::changeContext(const Context& newContext) const
81
+ {
82
+ ReferencePtr r = _instance->referenceFactory()->copy(this);
83
+ r->_context = new SharedContext(newContext);
84
+ return r;
85
+ }
86
+
87
+ ReferencePtr
88
+ IceInternal::Reference::changeMode(Mode newMode) const
89
+ {
90
+ if(newMode == _mode)
91
+ {
92
+ return ReferencePtr(const_cast<Reference*>(this));
93
+ }
94
+ ReferencePtr r = _instance->referenceFactory()->copy(this);
95
+ r->_mode = newMode;
96
+ return r;
97
+ }
98
+
99
+ ReferencePtr
100
+ IceInternal::Reference::changeSecure(bool newSecure) const
101
+ {
102
+ if(newSecure == _secure)
103
+ {
104
+ return ReferencePtr(const_cast<Reference*>(this));
105
+ }
106
+ ReferencePtr r = _instance->referenceFactory()->copy(this);
107
+ r->_secure = newSecure;
108
+ return r;
109
+ }
110
+
111
+ ReferencePtr
112
+ IceInternal::Reference::changeIdentity(const Identity& newIdentity) const
113
+ {
114
+ if(newIdentity == _identity)
115
+ {
116
+ return ReferencePtr(const_cast<Reference*>(this));
117
+ }
118
+ ReferencePtr r = _instance->referenceFactory()->copy(this);
119
+ r->_identity = newIdentity;
120
+ return r;
121
+ }
122
+
123
+ ReferencePtr
124
+ IceInternal::Reference::changeFacet(const string& newFacet) const
125
+ {
126
+ if(newFacet == _facet)
127
+ {
128
+ return ReferencePtr(const_cast<Reference*>(this));
129
+ }
130
+ ReferencePtr r = _instance->referenceFactory()->copy(this);
131
+ r->_facet = newFacet;
132
+ return r;
133
+ }
134
+
135
+ ReferencePtr
136
+ IceInternal::Reference::changeInvocationTimeout(int invocationTimeout) const
137
+ {
138
+ if(_invocationTimeout == invocationTimeout)
139
+ {
140
+ return ReferencePtr(const_cast<Reference*>(this));
141
+ }
142
+ ReferencePtr r = _instance->referenceFactory()->copy(this);
143
+ r->_invocationTimeout = invocationTimeout;
144
+ return r;
145
+ }
146
+
147
+ ReferencePtr
148
+ IceInternal::Reference::changeEncoding(const Ice::EncodingVersion& encoding) const
149
+ {
150
+ if(_encoding == encoding)
151
+ {
152
+ return ReferencePtr(const_cast<Reference*>(this));
153
+ }
154
+ ReferencePtr r = _instance->referenceFactory()->copy(this);
155
+ r->_encoding = encoding;
156
+ return r;
157
+ }
158
+
159
+ ReferencePtr
160
+ IceInternal::Reference::changeCompress(bool newCompress) const
161
+ {
162
+ if(_overrideCompress && newCompress == _compress)
163
+ {
164
+ return ReferencePtr(const_cast<Reference*>(this));
165
+ }
166
+ ReferencePtr r = _instance->referenceFactory()->copy(this);
167
+ r->_compress = newCompress;
168
+ r->_overrideCompress = true;
169
+ return r;
170
+ }
171
+
172
+ Int
173
+ Reference::hash() const
174
+ {
175
+ IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(hashMutex);
176
+ if(!_hashInitialized)
177
+ {
178
+ _hashValue = hashInit();
179
+ _hashInitialized = true;
180
+ }
181
+ return _hashValue;
182
+ }
183
+
184
+ void
185
+ IceInternal::Reference::streamWrite(BasicStream* s) const
186
+ {
187
+ //
188
+ // Don't write the identity here. Operations calling streamWrite
189
+ // write the identity.
190
+ //
191
+
192
+ //
193
+ // For compatibility with the old FacetPath.
194
+ //
195
+ if(_facet.empty())
196
+ {
197
+ s->write(static_cast<string*>(0), static_cast<string*>(0));
198
+ }
199
+ else
200
+ {
201
+ s->write(&_facet, &_facet + 1);
202
+ }
203
+
204
+ s->write(static_cast<Byte>(_mode));
205
+
206
+ s->write(_secure);
207
+
208
+ if(s->getWriteEncoding() != Ice::Encoding_1_0)
209
+ {
210
+ s->write(_protocol);
211
+ s->write(_encoding);
212
+ }
213
+
214
+ // Derived class writes the remainder of the reference.
215
+ }
216
+
217
+ string
218
+ IceInternal::Reference::toString() const
219
+ {
220
+ //
221
+ // WARNING: Certain features, such as proxy validation in Glacier2,
222
+ // depend on the format of proxy strings. Changes to toString() and
223
+ // methods called to generate parts of the reference string could break
224
+ // these features. Please review for all features that depend on the
225
+ // format of proxyToString() before changing this and related code.
226
+ //
227
+ ostringstream s;
228
+
229
+ //
230
+ // If the encoded identity string contains characters which
231
+ // the reference parser uses as separators, then we enclose
232
+ // the identity string in quotes.
233
+ //
234
+ string id = _instance->identityToString(_identity);
235
+ if(id.find_first_of(" :@") != string::npos)
236
+ {
237
+ s << '"' << id << '"';
238
+ }
239
+ else
240
+ {
241
+ s << id;
242
+ }
243
+
244
+ if(!_facet.empty())
245
+ {
246
+ s << " -f ";
247
+
248
+ //
249
+ // If the encoded facet string contains characters which
250
+ // the reference parser uses as separators, then we enclose
251
+ // the facet string in quotes.
252
+ //
253
+ string fs = nativeToUTF8(_facet, _instance->getStringConverter());
254
+ fs = IceUtilInternal::escapeString(fs, "");
255
+ if(fs.find_first_of(" :@") != string::npos)
256
+ {
257
+ s << '"' << fs << '"';
258
+ }
259
+ else
260
+ {
261
+ s << fs;
262
+ }
263
+ }
264
+
265
+ switch(_mode)
266
+ {
267
+ case ModeTwoway:
268
+ {
269
+ s << " -t";
270
+ break;
271
+ }
272
+
273
+ case ModeOneway:
274
+ {
275
+ s << " -o";
276
+ break;
277
+ }
278
+
279
+ case ModeBatchOneway:
280
+ {
281
+ s << " -O";
282
+ break;
283
+ }
284
+
285
+ case ModeDatagram:
286
+ {
287
+ s << " -d";
288
+ break;
289
+ }
290
+
291
+ case ModeBatchDatagram:
292
+ {
293
+ s << " -D";
294
+ break;
295
+ }
296
+ }
297
+
298
+ if(_secure)
299
+ {
300
+ s << " -s";
301
+ }
302
+
303
+ if(_protocol != Ice::Protocol_1_0)
304
+ {
305
+ //
306
+ // We only print the protocol if it's not 1.0. It's fine as
307
+ // long as we don't add Ice.Default.ProtocolVersion, a
308
+ // stringified proxy will convert back to the same proxy with
309
+ // stringToProxy.
310
+ //
311
+ s << " -p " << _protocol;
312
+ }
313
+
314
+ //
315
+ // Always print the encoding version to ensure a stringified proxy
316
+ // will convert back to a proxy with the same encoding with
317
+ // stringToProxy (and won't use Ice.Default.EncodingVersion).
318
+ //
319
+ s << " -e " << _encoding;
320
+
321
+ return s.str();
322
+
323
+ // Derived class writes the remainder of the string.
324
+ }
325
+
326
+ bool
327
+ IceInternal::Reference::operator==(const Reference& r) const
328
+ {
329
+ //
330
+ // Note: if(this == &r) test is performed by each non-abstract derived class.
331
+ //
332
+
333
+ if(_mode != r._mode)
334
+ {
335
+ return false;
336
+ }
337
+
338
+ if(_secure != r._secure)
339
+ {
340
+ return false;
341
+ }
342
+
343
+ if(_identity != r._identity)
344
+ {
345
+ return false;
346
+ }
347
+
348
+ if(_context->getValue() != r._context->getValue())
349
+ {
350
+ return false;
351
+ }
352
+
353
+ if(_facet != r._facet)
354
+ {
355
+ return false;
356
+ }
357
+
358
+ if((_overrideCompress != r._overrideCompress) || (_overrideCompress && _compress != r._compress))
359
+ {
360
+ return false;
361
+ }
362
+
363
+ if(_protocol != r._protocol)
364
+ {
365
+ return false;
366
+ }
367
+
368
+ if(_encoding != r._encoding)
369
+ {
370
+ return false;
371
+ }
372
+
373
+ if(_invocationTimeout != r._invocationTimeout)
374
+ {
375
+ return false;
376
+ }
377
+
378
+ return true;
379
+ }
380
+
381
+ bool
382
+ IceInternal::Reference::operator!=(const Reference& r) const
383
+ {
384
+ return !operator==(r);
385
+ }
386
+
387
+ bool
388
+ IceInternal::Reference::operator<(const Reference& r) const
389
+ {
390
+ //
391
+ // Note: if(this == &r) test is performed by each non-abstract derived class.
392
+ //
393
+
394
+ if(_mode < r._mode)
395
+ {
396
+ return true;
397
+ }
398
+ else if(r._mode < _mode)
399
+ {
400
+ return false;
401
+ }
402
+
403
+ if(_identity < r._identity)
404
+ {
405
+ return true;
406
+ }
407
+ else if(r._identity < _identity)
408
+ {
409
+ return false;
410
+ }
411
+
412
+ if(_context->getValue() < r._context->getValue())
413
+ {
414
+ return true;
415
+ }
416
+ else if(r._context->getValue() < _context->getValue())
417
+ {
418
+ return false;
419
+ }
420
+
421
+ if(_facet < r._facet)
422
+ {
423
+ return true;
424
+ }
425
+ else if(r._facet < _facet)
426
+ {
427
+ return false;
428
+ }
429
+
430
+ if(!_overrideCompress && r._overrideCompress)
431
+ {
432
+ return true;
433
+ }
434
+ else if(r._overrideCompress < _overrideCompress)
435
+ {
436
+ return false;
437
+ }
438
+ else if(_overrideCompress)
439
+ {
440
+ if(!_compress && r._compress)
441
+ {
442
+ return true;
443
+ }
444
+ else if(r._compress < _compress)
445
+ {
446
+ return false;
447
+ }
448
+ }
449
+
450
+ if(!_secure && r._secure)
451
+ {
452
+ return true;
453
+ }
454
+ else if(r._secure < _secure)
455
+ {
456
+ return false;
457
+ }
458
+
459
+ if(_protocol < r._protocol)
460
+ {
461
+ return true;
462
+ }
463
+ else if(r._protocol < _protocol)
464
+ {
465
+ return false;
466
+ }
467
+
468
+ if(_encoding < r._encoding)
469
+ {
470
+ return true;
471
+ }
472
+ else if(r._encoding < _encoding)
473
+ {
474
+ return false;
475
+ }
476
+
477
+ if(_invocationTimeout < r._invocationTimeout)
478
+ {
479
+ return true;
480
+ }
481
+ else if(r._invocationTimeout < _invocationTimeout)
482
+ {
483
+ return false;
484
+ }
485
+
486
+ return false;
487
+ }
488
+
489
+ class ConnectionIsDatagram : public unary_function<ConnectionIPtr, bool>
490
+ {
491
+ public:
492
+
493
+ bool
494
+ operator()(ConnectionIPtr p) const
495
+ {
496
+ return p->endpoint()->datagram();
497
+ }
498
+ };
499
+
500
+ class ConnectionIsSecure : public unary_function<ConnectionIPtr, bool>
501
+ {
502
+ public:
503
+
504
+ bool
505
+ operator()(ConnectionIPtr p) const
506
+ {
507
+ return p->endpoint()->secure();
508
+ }
509
+ };
510
+
511
+ IceInternal::Reference::Reference(const InstancePtr& instance,
512
+ const CommunicatorPtr& communicator,
513
+ const Identity& id,
514
+ const string& facet,
515
+ Mode mode,
516
+ bool secure,
517
+ const ProtocolVersion& protocol,
518
+ const EncodingVersion& encoding,
519
+ int invocationTimeout,
520
+ const Ice::Context& ctx) :
521
+ _hashInitialized(false),
522
+ _instance(instance),
523
+ _communicator(communicator),
524
+ _mode(mode),
525
+ _secure(secure),
526
+ _identity(id),
527
+ _context(new SharedContext(ctx)),
528
+ _facet(facet),
529
+ _protocol(protocol),
530
+ _encoding(encoding),
531
+ _invocationTimeout(invocationTimeout),
532
+ _overrideCompress(false),
533
+ _compress(false)
534
+ {
535
+ }
536
+
537
+ IceInternal::Reference::Reference(const Reference& r) :
538
+ _hashInitialized(false),
539
+ _instance(r._instance),
540
+ _communicator(r._communicator),
541
+ _mode(r._mode),
542
+ _secure(r._secure),
543
+ _identity(r._identity),
544
+ _context(r._context),
545
+ _facet(r._facet),
546
+ _protocol(r._protocol),
547
+ _encoding(r._encoding),
548
+ _invocationTimeout(r._invocationTimeout),
549
+ _overrideCompress(r._overrideCompress),
550
+ _compress(r._compress)
551
+ {
552
+ }
553
+
554
+ int
555
+ IceInternal::Reference::hashInit() const
556
+ {
557
+ Int h = 5381;
558
+ hashAdd(h, static_cast<Int>(_mode));
559
+ hashAdd(h, _secure);
560
+ hashAdd(h, _identity.name);
561
+ hashAdd(h, _identity.category);
562
+ hashAdd(h, _context->getValue());
563
+ hashAdd(h, _facet);
564
+ hashAdd(h, _overrideCompress);
565
+ if(_overrideCompress)
566
+ {
567
+ hashAdd(h, _compress);
568
+ }
569
+ hashAdd(h, _protocol.major);
570
+ hashAdd(h, _protocol.minor);
571
+ hashAdd(h, _encoding.major);
572
+ hashAdd(h, _encoding.minor);
573
+ hashAdd(h, _invocationTimeout);
574
+ return h;
575
+ }
576
+
577
+ IceUtil::Shared* IceInternal::upCast(IceInternal::FixedReference* p) { return p; }
578
+
579
+ IceInternal::FixedReference::FixedReference(const InstancePtr& instance,
580
+ const CommunicatorPtr& communicator,
581
+ const Identity& id,
582
+ const string& facet,
583
+ Mode mode,
584
+ bool secure,
585
+ const EncodingVersion& encoding,
586
+ const ConnectionIPtr& fixedConnection) :
587
+ Reference(instance, communicator, id, facet, mode, secure, Ice::Protocol_1_0, encoding, -1, Ice::Context()),
588
+ _fixedConnection(fixedConnection)
589
+ {
590
+ }
591
+
592
+ vector<EndpointIPtr>
593
+ IceInternal::FixedReference::getEndpoints() const
594
+ {
595
+ return vector<EndpointIPtr>();
596
+ }
597
+
598
+ string
599
+ IceInternal::FixedReference::getAdapterId() const
600
+ {
601
+ return string();
602
+ }
603
+
604
+ bool
605
+ IceInternal::FixedReference::getCollocationOptimized() const
606
+ {
607
+ return false;
608
+ }
609
+
610
+ bool
611
+ IceInternal::FixedReference::getCacheConnection() const
612
+ {
613
+ return true;
614
+ }
615
+
616
+ bool
617
+ IceInternal::FixedReference::getPreferSecure() const
618
+ {
619
+ return false;
620
+ }
621
+
622
+ Ice::EndpointSelectionType
623
+ IceInternal::FixedReference::getEndpointSelection() const
624
+ {
625
+ return Random;
626
+ }
627
+
628
+ int
629
+ IceInternal::FixedReference::getLocatorCacheTimeout() const
630
+ {
631
+ return 0;
632
+ }
633
+
634
+ string
635
+ IceInternal::FixedReference::getConnectionId() const
636
+ {
637
+ return string();
638
+ }
639
+
640
+ ReferencePtr
641
+ IceInternal::FixedReference::changeEndpoints(const vector<EndpointIPtr>& /*newEndpoints*/) const
642
+ {
643
+ throw FixedProxyException(__FILE__, __LINE__);
644
+ return 0; // Keep the compiler happy.
645
+ }
646
+
647
+ ReferencePtr
648
+ IceInternal::FixedReference::changeAdapterId(const string& /*newAdapterId*/) const
649
+ {
650
+ throw FixedProxyException(__FILE__, __LINE__);
651
+ return 0; // Keep the compiler happy.
652
+ }
653
+
654
+ ReferencePtr
655
+ IceInternal::FixedReference::changeLocator(const LocatorPrx&) const
656
+ {
657
+ throw FixedProxyException(__FILE__, __LINE__);
658
+ return 0; // Keep the compiler happy.
659
+ }
660
+
661
+ ReferencePtr
662
+ IceInternal::FixedReference::changeRouter(const RouterPrx&) const
663
+ {
664
+ throw FixedProxyException(__FILE__, __LINE__);
665
+ return 0; // Keep the compiler happy.
666
+ }
667
+
668
+ ReferencePtr
669
+ IceInternal::FixedReference::changeCollocationOptimized(bool) const
670
+ {
671
+ throw FixedProxyException(__FILE__, __LINE__);
672
+ return 0; // Keep the compiler happy.
673
+ }
674
+
675
+ ReferencePtr
676
+ IceInternal::FixedReference::changeCacheConnection(bool) const
677
+ {
678
+ throw FixedProxyException(__FILE__, __LINE__);
679
+ return 0; // Keep the compiler happy.
680
+ }
681
+
682
+ ReferencePtr
683
+ IceInternal::FixedReference::changePreferSecure(bool) const
684
+ {
685
+ throw FixedProxyException(__FILE__, __LINE__);
686
+ return 0; // Keep the compiler happy.
687
+ }
688
+
689
+ ReferencePtr
690
+ IceInternal::FixedReference::changeEndpointSelection(EndpointSelectionType) const
691
+ {
692
+ throw FixedProxyException(__FILE__, __LINE__);
693
+ return 0; // Keep the compiler happy.
694
+ }
695
+
696
+ ReferencePtr
697
+ IceInternal::FixedReference::changeLocatorCacheTimeout(int) const
698
+ {
699
+ throw FixedProxyException(__FILE__, __LINE__);
700
+ return 0; // Keep the compiler happy.
701
+ }
702
+
703
+ ReferencePtr
704
+ IceInternal::FixedReference::changeTimeout(int) const
705
+ {
706
+ throw FixedProxyException(__FILE__, __LINE__);
707
+ return 0; // Keep the compiler happy.
708
+ }
709
+
710
+ ReferencePtr
711
+ IceInternal::FixedReference::changeConnectionId(const string&) const
712
+ {
713
+ throw FixedProxyException(__FILE__, __LINE__);
714
+ return 0; // Keep the compiler happy.
715
+ }
716
+
717
+ bool
718
+ IceInternal::FixedReference::isIndirect() const
719
+ {
720
+ return false;
721
+ }
722
+
723
+ bool
724
+ IceInternal::FixedReference::isWellKnown() const
725
+ {
726
+ return false;
727
+ }
728
+
729
+ void
730
+ IceInternal::FixedReference::streamWrite(BasicStream*) const
731
+ {
732
+ throw FixedProxyException(__FILE__, __LINE__);
733
+ }
734
+
735
+ string
736
+ IceInternal::FixedReference::toString() const
737
+ {
738
+ throw FixedProxyException(__FILE__, __LINE__);
739
+
740
+ assert(false); // Cannot be reached.
741
+ return string(); // To keep the compiler from complaining.
742
+ }
743
+
744
+ PropertyDict
745
+ IceInternal::FixedReference::toProperty(const string&) const
746
+ {
747
+ throw FixedProxyException(__FILE__, __LINE__);
748
+
749
+ assert(false); // Cannot be reached.
750
+ return PropertyDict(); // To keep the compiler from complaining.
751
+ }
752
+
753
+ void
754
+ IceInternal::FixedReference::getConnection(const GetConnectionCallbackPtr& callback) const
755
+ {
756
+ try
757
+ {
758
+ switch(getMode())
759
+ {
760
+ case Reference::ModeTwoway:
761
+ case Reference::ModeOneway:
762
+ case Reference::ModeBatchOneway:
763
+ {
764
+ if(_fixedConnection->endpoint()->datagram())
765
+ {
766
+ throw NoEndpointException(__FILE__, __LINE__, "");
767
+ }
768
+ break;
769
+ }
770
+
771
+ case Reference::ModeDatagram:
772
+ case Reference::ModeBatchDatagram:
773
+ {
774
+ if(!_fixedConnection->endpoint()->datagram())
775
+ {
776
+ throw NoEndpointException(__FILE__, __LINE__, "");
777
+ }
778
+ break;
779
+ }
780
+ }
781
+
782
+ //
783
+ // If a secure connection is requested or secure overrides is set,
784
+ // check if the connection is secure.
785
+ //
786
+ bool secure;
787
+ DefaultsAndOverridesPtr defaultsAndOverrides = getInstance()->defaultsAndOverrides();
788
+ if(defaultsAndOverrides->overrideSecure)
789
+ {
790
+ secure = defaultsAndOverrides->overrideSecureValue;
791
+ }
792
+ else
793
+ {
794
+ secure = getSecure();
795
+ }
796
+ if(secure && !_fixedConnection->endpoint()->secure())
797
+ {
798
+ throw NoEndpointException(__FILE__, __LINE__, "");
799
+ }
800
+
801
+ _fixedConnection->throwException(); // Throw in case our connection is already destroyed.
802
+
803
+ bool compress;
804
+ if(defaultsAndOverrides->overrideCompress)
805
+ {
806
+ compress = defaultsAndOverrides->overrideCompressValue;
807
+ }
808
+ else if(_overrideCompress)
809
+ {
810
+ compress = _compress;
811
+ }
812
+ else
813
+ {
814
+ compress = _fixedConnection->endpoint()->compress();
815
+ }
816
+ callback->setConnection(_fixedConnection, compress);
817
+ }
818
+ catch(const Ice::LocalException& ex)
819
+ {
820
+ callback->setException(ex);
821
+ }
822
+ }
823
+
824
+ bool
825
+ IceInternal::FixedReference::operator==(const Reference& r) const
826
+ {
827
+ if(this == &r)
828
+ {
829
+ return true;
830
+ }
831
+ const FixedReference* rhs = dynamic_cast<const FixedReference*>(&r);
832
+ if(!rhs || !Reference::operator==(r))
833
+ {
834
+ return false;
835
+ }
836
+ return _fixedConnection == rhs->_fixedConnection;
837
+ }
838
+
839
+ bool
840
+ IceInternal::FixedReference::operator!=(const Reference& r) const
841
+ {
842
+ return !operator==(r);
843
+ }
844
+
845
+ bool
846
+ IceInternal::FixedReference::operator<(const Reference& r) const
847
+ {
848
+ if(this == &r)
849
+ {
850
+ return false;
851
+ }
852
+ if(Reference::operator<(r))
853
+ {
854
+ return true;
855
+ }
856
+ if(!Reference::operator==(r))
857
+ {
858
+ return false;
859
+ }
860
+
861
+ const FixedReference* rhs = dynamic_cast<const FixedReference*>(&r);
862
+ if(!rhs)
863
+ {
864
+ assert(dynamic_cast<const RoutableReference*>(&r));
865
+ return false; // As a rule, routable references are superior to fixed references.
866
+ }
867
+ return _fixedConnection < rhs->_fixedConnection;
868
+ }
869
+
870
+ ReferencePtr
871
+ IceInternal::FixedReference::clone() const
872
+ {
873
+ return new FixedReference(*this);
874
+ }
875
+
876
+ IceInternal::FixedReference::FixedReference(const FixedReference& r) :
877
+ Reference(r),
878
+ _fixedConnection(r._fixedConnection)
879
+ {
880
+ }
881
+
882
+ IceUtil::Shared* IceInternal::upCast(IceInternal::RoutableReference* p) { return p; }
883
+
884
+ IceInternal::RoutableReference::RoutableReference(const InstancePtr& instance,
885
+ const CommunicatorPtr& communicator,
886
+ const Identity& id,
887
+ const string& facet,
888
+ Mode mode,
889
+ bool secure,
890
+ const ProtocolVersion& protocol,
891
+ const EncodingVersion& encoding,
892
+ const vector<EndpointIPtr>& endpoints,
893
+ const string& adapterId,
894
+ const LocatorInfoPtr& locatorInfo,
895
+ const RouterInfoPtr& routerInfo,
896
+ bool collocationOptimized,
897
+ bool cacheConnection,
898
+ bool preferSecure,
899
+ EndpointSelectionType endpointSelection,
900
+ int locatorCacheTimeout,
901
+ int invocationTimeout,
902
+ const Ice::Context& ctx) :
903
+ Reference(instance, communicator, id, facet, mode, secure, protocol, encoding, invocationTimeout, ctx),
904
+ _endpoints(endpoints),
905
+ _adapterId(adapterId),
906
+ _locatorInfo(locatorInfo),
907
+ _routerInfo(routerInfo),
908
+ _collocationOptimized(collocationOptimized),
909
+ _cacheConnection(cacheConnection),
910
+ _preferSecure(preferSecure),
911
+ _endpointSelection(endpointSelection),
912
+ _locatorCacheTimeout(locatorCacheTimeout),
913
+ _overrideTimeout(false),
914
+ _timeout(-1)
915
+ {
916
+ assert(_adapterId.empty() || _endpoints.empty());
917
+ }
918
+
919
+ vector<EndpointIPtr>
920
+ IceInternal::RoutableReference::getEndpoints() const
921
+ {
922
+ return _endpoints;
923
+ }
924
+
925
+ string
926
+ IceInternal::RoutableReference::getAdapterId() const
927
+ {
928
+ return _adapterId;
929
+ }
930
+
931
+ LocatorInfoPtr
932
+ IceInternal::RoutableReference::getLocatorInfo() const
933
+ {
934
+ return _locatorInfo;
935
+ }
936
+
937
+ RouterInfoPtr
938
+ IceInternal::RoutableReference::getRouterInfo() const
939
+ {
940
+ return _routerInfo;
941
+ }
942
+
943
+ bool
944
+ IceInternal::RoutableReference::getCollocationOptimized() const
945
+ {
946
+ return _collocationOptimized;
947
+ }
948
+
949
+ bool
950
+ IceInternal::RoutableReference::getCacheConnection() const
951
+ {
952
+ return _cacheConnection;
953
+ }
954
+
955
+ bool
956
+ IceInternal::RoutableReference::getPreferSecure() const
957
+ {
958
+ return _preferSecure;
959
+ }
960
+
961
+ Ice::EndpointSelectionType
962
+ IceInternal::RoutableReference::getEndpointSelection() const
963
+ {
964
+ return _endpointSelection;
965
+ }
966
+
967
+ int
968
+ IceInternal::RoutableReference::getLocatorCacheTimeout() const
969
+ {
970
+ return _locatorCacheTimeout;
971
+ }
972
+
973
+ string
974
+ IceInternal::RoutableReference::getConnectionId() const
975
+ {
976
+ return _connectionId;
977
+ }
978
+
979
+ ReferencePtr
980
+ IceInternal::RoutableReference::changeEncoding(const Ice::EncodingVersion& encoding) const
981
+ {
982
+ ReferencePtr r = Reference::changeEncoding(encoding);
983
+ if(r.get() != const_cast<RoutableReference*>(this))
984
+ {
985
+ LocatorInfoPtr& locInfo = RoutableReferencePtr::dynamicCast(r)->_locatorInfo;
986
+ if(locInfo && locInfo->getLocator()->ice_getEncodingVersion() != encoding)
987
+ {
988
+ locInfo = getInstance()->locatorManager()->get(locInfo->getLocator()->ice_encodingVersion(encoding));
989
+ }
990
+ }
991
+ return r;
992
+ }
993
+
994
+ ReferencePtr
995
+ IceInternal::RoutableReference::changeCompress(bool newCompress) const
996
+ {
997
+ ReferencePtr r = Reference::changeCompress(newCompress);
998
+ // Also override the compress flag on the endpoints if it was updated.
999
+ if(r.get() != const_cast<RoutableReference*>(this) && !_endpoints.empty())
1000
+ {
1001
+ vector<EndpointIPtr> newEndpoints;
1002
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
1003
+ {
1004
+ newEndpoints.push_back((*p)->compress(newCompress));
1005
+ }
1006
+ RoutableReferencePtr::dynamicCast(r)->_endpoints = newEndpoints;
1007
+ }
1008
+ return r;
1009
+ }
1010
+
1011
+ ReferencePtr
1012
+ IceInternal::RoutableReference::changeEndpoints(const vector<EndpointIPtr>& newEndpoints) const
1013
+ {
1014
+ if(newEndpoints == _endpoints)
1015
+ {
1016
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1017
+ }
1018
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1019
+ r->_endpoints = newEndpoints;
1020
+ r->applyOverrides(r->_endpoints);
1021
+ r->_adapterId.clear();
1022
+ return r;
1023
+ }
1024
+
1025
+ ReferencePtr
1026
+ IceInternal::RoutableReference::changeAdapterId(const string& newAdapterId) const
1027
+ {
1028
+ if(newAdapterId == _adapterId)
1029
+ {
1030
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1031
+ }
1032
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1033
+ r->_adapterId = newAdapterId;
1034
+ r->_endpoints.clear();
1035
+ return r;
1036
+ }
1037
+
1038
+ ReferencePtr
1039
+ IceInternal::RoutableReference::changeLocator(const LocatorPrx& newLocator) const
1040
+ {
1041
+ LocatorInfoPtr newLocatorInfo = getInstance()->locatorManager()->get(newLocator);
1042
+ if(newLocatorInfo == _locatorInfo)
1043
+ {
1044
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1045
+ }
1046
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1047
+ r->_locatorInfo = newLocatorInfo;
1048
+ return r;
1049
+ }
1050
+
1051
+ ReferencePtr
1052
+ IceInternal::RoutableReference::changeRouter(const RouterPrx& newRouter) const
1053
+ {
1054
+ RouterInfoPtr newRouterInfo = getInstance()->routerManager()->get(newRouter);
1055
+ if(newRouterInfo == _routerInfo)
1056
+ {
1057
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1058
+ }
1059
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1060
+ r->_routerInfo = newRouterInfo;
1061
+ return r;
1062
+ }
1063
+
1064
+ ReferencePtr
1065
+ IceInternal::RoutableReference::changeCollocationOptimized(bool newCollocationOptimized) const
1066
+ {
1067
+ if(newCollocationOptimized == _collocationOptimized)
1068
+ {
1069
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1070
+ }
1071
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1072
+ r->_collocationOptimized = newCollocationOptimized;
1073
+ return r;
1074
+ }
1075
+
1076
+ ReferencePtr
1077
+ IceInternal::RoutableReference::changeCacheConnection(bool newCache) const
1078
+ {
1079
+ if(newCache == _cacheConnection)
1080
+ {
1081
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1082
+ }
1083
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1084
+ r->_cacheConnection = newCache;
1085
+ return r;
1086
+ }
1087
+
1088
+ ReferencePtr
1089
+ IceInternal::RoutableReference::changePreferSecure(bool newPreferSecure) const
1090
+ {
1091
+ if(newPreferSecure == _preferSecure)
1092
+ {
1093
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1094
+ }
1095
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1096
+ r->_preferSecure = newPreferSecure;
1097
+ return r;
1098
+ }
1099
+
1100
+ ReferencePtr
1101
+ IceInternal::RoutableReference::changeEndpointSelection(EndpointSelectionType newType) const
1102
+ {
1103
+ if(newType == _endpointSelection)
1104
+ {
1105
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1106
+ }
1107
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1108
+ r->_endpointSelection = newType;
1109
+ return r;
1110
+ }
1111
+
1112
+ ReferencePtr
1113
+ IceInternal::RoutableReference::changeLocatorCacheTimeout(int timeout) const
1114
+ {
1115
+ if(timeout == _locatorCacheTimeout)
1116
+ {
1117
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1118
+ }
1119
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1120
+ r->_locatorCacheTimeout = timeout;
1121
+ return r;
1122
+ }
1123
+
1124
+ ReferencePtr
1125
+ IceInternal::RoutableReference::changeTimeout(int newTimeout) const
1126
+ {
1127
+ if(_overrideTimeout && newTimeout == _timeout)
1128
+ {
1129
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1130
+ }
1131
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1132
+ r->_timeout = newTimeout;
1133
+ r->_overrideTimeout = true;
1134
+ if(!_endpoints.empty()) // Also override the timeout on the endpoints.
1135
+ {
1136
+ vector<EndpointIPtr> newEndpoints;
1137
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
1138
+ {
1139
+ newEndpoints.push_back((*p)->timeout(newTimeout));
1140
+ }
1141
+ r->_endpoints = newEndpoints;
1142
+ }
1143
+ return r;
1144
+ }
1145
+
1146
+ ReferencePtr
1147
+ IceInternal::RoutableReference::changeConnectionId(const string& id) const
1148
+ {
1149
+ if(id == _connectionId)
1150
+ {
1151
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
1152
+ }
1153
+ RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
1154
+ r->_connectionId = id;
1155
+ if(!_endpoints.empty()) // Also override the connection id on the endpoints.
1156
+ {
1157
+ vector<EndpointIPtr> newEndpoints;
1158
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
1159
+ {
1160
+ newEndpoints.push_back((*p)->connectionId(id));
1161
+ }
1162
+ r->_endpoints = newEndpoints;
1163
+ }
1164
+ return r;
1165
+ }
1166
+
1167
+ bool
1168
+ IceInternal::RoutableReference::isIndirect() const
1169
+ {
1170
+ return _endpoints.empty();
1171
+ }
1172
+
1173
+ bool
1174
+ IceInternal::RoutableReference::isWellKnown() const
1175
+ {
1176
+ return _endpoints.empty() && _adapterId.empty();
1177
+ }
1178
+
1179
+ void
1180
+ IceInternal::RoutableReference::streamWrite(BasicStream* s) const
1181
+ {
1182
+ Reference::streamWrite(s);
1183
+
1184
+ Int sz = static_cast<Int>(_endpoints.size());
1185
+ s->writeSize(sz);
1186
+ if(sz)
1187
+ {
1188
+ assert(_adapterId.empty());
1189
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
1190
+ {
1191
+ s->write((*p)->type());
1192
+ (*p)->streamWrite(s);
1193
+ }
1194
+ }
1195
+ else
1196
+ {
1197
+ s->write(_adapterId);
1198
+ }
1199
+ }
1200
+
1201
+ string
1202
+ IceInternal::RoutableReference::toString() const
1203
+ {
1204
+ //
1205
+ // WARNING: Certain features, such as proxy validation in Glacier2,
1206
+ // depend on the format of proxy strings. Changes to toString() and
1207
+ // methods called to generate parts of the reference string could break
1208
+ // these features. Please review for all features that depend on the
1209
+ // format of proxyToString() before changing this and related code.
1210
+ //
1211
+ string result = Reference::toString();
1212
+
1213
+ if(!_endpoints.empty())
1214
+ {
1215
+ for(vector<EndpointIPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
1216
+ {
1217
+ string endp = (*p)->toString();
1218
+ if(!endp.empty())
1219
+ {
1220
+ result.append(":");
1221
+ result.append(endp);
1222
+ }
1223
+ }
1224
+ }
1225
+ else if(!_adapterId.empty())
1226
+ {
1227
+ result.append(" @ ");
1228
+
1229
+ //
1230
+ // If the encoded adapter id string contains characters which the
1231
+ // reference parser uses as separators, then we enclose the
1232
+ // adapter id string in quotes.
1233
+ //
1234
+ string a = nativeToUTF8(_adapterId, getInstance()->getStringConverter());
1235
+ a = IceUtilInternal::escapeString(a, "");
1236
+ if(a.find_first_of(" :@") != string::npos)
1237
+ {
1238
+ result.append("\"");
1239
+ result.append(a);
1240
+ result.append("\"");
1241
+ }
1242
+ else
1243
+ {
1244
+ result.append(a);
1245
+ }
1246
+ }
1247
+ else
1248
+ {
1249
+ return result;
1250
+ }
1251
+ return result;
1252
+ }
1253
+
1254
+ PropertyDict
1255
+ IceInternal::RoutableReference::toProperty(const string& prefix) const
1256
+ {
1257
+ Ice::PropertyDict properties;
1258
+
1259
+ properties[prefix] = toString();
1260
+ properties[prefix + ".CollocationOptimized"] = _collocationOptimized ? "1" : "0";
1261
+ properties[prefix + ".ConnectionCached"] = _cacheConnection ? "1" : "0";
1262
+ properties[prefix + ".PreferSecure"] = _preferSecure ? "1" : "0";
1263
+ properties[prefix + ".EndpointSelection"] = _endpointSelection == Random ? "Random" : "Ordered";
1264
+ {
1265
+ ostringstream s;
1266
+ s << _locatorCacheTimeout;
1267
+ properties[prefix + ".LocatorCacheTimeout"] = s.str();
1268
+ }
1269
+ {
1270
+ ostringstream s;
1271
+ s << getInvocationTimeout();
1272
+ properties[prefix + ".InvocationTimeout"] = s.str();
1273
+ }
1274
+ if(_routerInfo)
1275
+ {
1276
+ PropertyDict routerProperties = _routerInfo->getRouter()->__reference()->toProperty(prefix + ".Router");
1277
+ for(PropertyDict::const_iterator p = routerProperties.begin(); p != routerProperties.end(); ++p)
1278
+ {
1279
+ properties[p->first] = p->second;
1280
+ }
1281
+ }
1282
+
1283
+ if(_locatorInfo)
1284
+ {
1285
+ PropertyDict locatorProperties = _locatorInfo->getLocator()->__reference()->toProperty(prefix + ".Locator");
1286
+ for(PropertyDict::const_iterator p = locatorProperties.begin(); p != locatorProperties.end(); ++p)
1287
+ {
1288
+ properties[p->first] = p->second;
1289
+ }
1290
+ }
1291
+
1292
+ return properties;
1293
+ }
1294
+
1295
+ int
1296
+ IceInternal::RoutableReference::hashInit() const
1297
+ {
1298
+ int value = Reference::hashInit();
1299
+ hashAdd(value, _adapterId);
1300
+ return value;
1301
+ }
1302
+
1303
+ bool
1304
+ IceInternal::RoutableReference::operator==(const Reference& r) const
1305
+ {
1306
+ //
1307
+ // Note: if(this == &r) test is performed by each non-abstract derived class.
1308
+ //
1309
+ if(this == &r)
1310
+ {
1311
+ return true;
1312
+ }
1313
+
1314
+ const RoutableReference* rhs = dynamic_cast<const RoutableReference*>(&r);
1315
+ if(!rhs || !Reference::operator==(r))
1316
+ {
1317
+ return false;
1318
+ }
1319
+ if(_preferSecure != rhs->_preferSecure)
1320
+ {
1321
+ return false;
1322
+ }
1323
+ if(_collocationOptimized != rhs->_collocationOptimized)
1324
+ {
1325
+ return false;
1326
+ }
1327
+ if(_cacheConnection != rhs->_cacheConnection)
1328
+ {
1329
+ return false;
1330
+ }
1331
+ if(_endpointSelection != rhs->_endpointSelection)
1332
+ {
1333
+ return false;
1334
+ }
1335
+ if(_connectionId != rhs->_connectionId)
1336
+ {
1337
+ return false;
1338
+ }
1339
+ if((_overrideTimeout != rhs->_overrideTimeout) || (_overrideTimeout && _timeout != rhs->_timeout))
1340
+ {
1341
+ return false;
1342
+ }
1343
+ if(_routerInfo != rhs->_routerInfo)
1344
+ {
1345
+ return false;
1346
+ }
1347
+ if(_locatorInfo != rhs->_locatorInfo)
1348
+ {
1349
+ return false;
1350
+ }
1351
+ if(_endpoints != rhs->_endpoints)
1352
+ {
1353
+ return false;
1354
+ }
1355
+ if(_adapterId != rhs->_adapterId)
1356
+ {
1357
+ return false;
1358
+ }
1359
+ if(_locatorCacheTimeout != rhs->_locatorCacheTimeout)
1360
+ {
1361
+ return false;
1362
+ }
1363
+ return true;
1364
+ }
1365
+
1366
+ bool
1367
+ IceInternal::RoutableReference::operator!=(const Reference& r) const
1368
+ {
1369
+ return !operator==(r);
1370
+ }
1371
+
1372
+ bool
1373
+ IceInternal::RoutableReference::operator<(const Reference& r) const
1374
+ {
1375
+ if(this == &r)
1376
+ {
1377
+ return false;
1378
+ }
1379
+
1380
+ if(Reference::operator<(r))
1381
+ {
1382
+ return true;
1383
+ }
1384
+ else if(!Reference::operator==(r))
1385
+ {
1386
+ return false;
1387
+ }
1388
+
1389
+ const RoutableReference* rhs = dynamic_cast<const RoutableReference*>(&r);
1390
+ if(!rhs)
1391
+ {
1392
+ assert(dynamic_cast<const FixedReference*>(&r));
1393
+ return true; // As a rule, routable references are superior to fixed references.
1394
+ }
1395
+
1396
+ if(!_preferSecure && rhs->_preferSecure)
1397
+ {
1398
+ return true;
1399
+ }
1400
+ else if(rhs->_preferSecure < _preferSecure)
1401
+ {
1402
+ return false;
1403
+ }
1404
+ if(!_collocationOptimized && rhs->_collocationOptimized)
1405
+ {
1406
+ return true;
1407
+ }
1408
+ else if(rhs->_collocationOptimized < _collocationOptimized)
1409
+ {
1410
+ return false;
1411
+ }
1412
+ if(!_cacheConnection && rhs->_cacheConnection)
1413
+ {
1414
+ return true;
1415
+ }
1416
+ else if(rhs->_cacheConnection < _cacheConnection)
1417
+ {
1418
+ return false;
1419
+ }
1420
+ if(_endpointSelection < rhs->_endpointSelection)
1421
+ {
1422
+ return true;
1423
+ }
1424
+ else if(rhs->_endpointSelection < _endpointSelection)
1425
+ {
1426
+ return false;
1427
+ }
1428
+ if(_connectionId < rhs->_connectionId)
1429
+ {
1430
+ return true;
1431
+ }
1432
+ else if(rhs->_connectionId < _connectionId)
1433
+ {
1434
+ return false;
1435
+ }
1436
+ if(!_overrideTimeout && rhs->_overrideTimeout)
1437
+ {
1438
+ return true;
1439
+ }
1440
+ else if(rhs->_overrideTimeout < _overrideTimeout)
1441
+ {
1442
+ return false;
1443
+ }
1444
+ else if(_overrideTimeout)
1445
+ {
1446
+ if(_timeout < rhs->_timeout)
1447
+ {
1448
+ return true;
1449
+ }
1450
+ else if(rhs->_timeout < _timeout)
1451
+ {
1452
+ return false;
1453
+ }
1454
+ }
1455
+ if(_routerInfo < rhs->_routerInfo)
1456
+ {
1457
+ return true;
1458
+ }
1459
+ else if(rhs->_routerInfo < _routerInfo)
1460
+ {
1461
+ return false;
1462
+ }
1463
+ if(_locatorInfo < rhs->_locatorInfo)
1464
+ {
1465
+ return true;
1466
+ }
1467
+ else if(rhs->_locatorInfo < _locatorInfo)
1468
+ {
1469
+ return false;
1470
+ }
1471
+ if(_adapterId < rhs->_adapterId)
1472
+ {
1473
+ return true;
1474
+ }
1475
+ else if(rhs->_adapterId < _adapterId)
1476
+ {
1477
+ return false;
1478
+ }
1479
+ if(_endpoints < rhs->_endpoints)
1480
+ {
1481
+ return true;
1482
+ }
1483
+ else if(rhs->_endpoints < _endpoints)
1484
+ {
1485
+ return false;
1486
+ }
1487
+ if(_locatorCacheTimeout < rhs->_locatorCacheTimeout)
1488
+ {
1489
+ return true;
1490
+ }
1491
+ else if(rhs->_locatorCacheTimeout < _locatorCacheTimeout)
1492
+ {
1493
+ return false;
1494
+ }
1495
+ return false;
1496
+ }
1497
+
1498
+ ReferencePtr
1499
+ IceInternal::RoutableReference::clone() const
1500
+ {
1501
+ return new RoutableReference(*this);
1502
+ }
1503
+
1504
+ void
1505
+ IceInternal::RoutableReference::getConnection(const GetConnectionCallbackPtr& callback) const
1506
+ {
1507
+ class Callback : public RouterInfo::GetClientEndpointsCallback
1508
+ {
1509
+ public:
1510
+
1511
+ virtual void
1512
+ setEndpoints(const vector<EndpointIPtr>& endpoints)
1513
+ {
1514
+ vector<EndpointIPtr> endpts = endpoints;
1515
+ if(!endpts.empty())
1516
+ {
1517
+ _reference->applyOverrides(endpts);
1518
+ _reference->createConnection(endpts, _callback);
1519
+ return;
1520
+ }
1521
+
1522
+ _reference->getConnectionNoRouterInfo(_callback);
1523
+ }
1524
+
1525
+ virtual void
1526
+ setException(const Ice::LocalException& ex)
1527
+ {
1528
+ _callback->setException(ex);
1529
+ }
1530
+
1531
+ Callback(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& callback) :
1532
+ _reference(reference), _callback(callback)
1533
+ {
1534
+ }
1535
+
1536
+ private:
1537
+
1538
+ const RoutableReferencePtr _reference;
1539
+ const GetConnectionCallbackPtr _callback;
1540
+ };
1541
+
1542
+ if(_routerInfo)
1543
+ {
1544
+ //
1545
+ // If we route, we send everything to the router's client
1546
+ // proxy endpoints.
1547
+ //
1548
+ _routerInfo->getClientEndpoints(new Callback(const_cast<RoutableReference*>(this), callback));
1549
+ return;
1550
+ }
1551
+
1552
+ getConnectionNoRouterInfo(callback);
1553
+ }
1554
+
1555
+ void
1556
+ IceInternal::RoutableReference::getConnectionNoRouterInfo(const GetConnectionCallbackPtr& callback) const
1557
+ {
1558
+ class Callback : public LocatorInfo::GetEndpointsCallback
1559
+ {
1560
+ public:
1561
+
1562
+ class Callback2 : public Reference::GetConnectionCallback
1563
+ {
1564
+ public:
1565
+
1566
+ virtual void
1567
+ setConnection(const Ice::ConnectionIPtr& connection, bool compress)
1568
+ {
1569
+ _callback->setConnection(connection, compress);
1570
+ }
1571
+
1572
+ virtual void
1573
+ setException(const Ice::LocalException& exc)
1574
+ {
1575
+ try
1576
+ {
1577
+ exc.ice_throw();
1578
+ }
1579
+ catch(const Ice::NoEndpointException& ex)
1580
+ {
1581
+ _callback->setException(ex); // No need to retry if there's no endpoints.
1582
+ }
1583
+ catch(const Ice::LocalException& ex)
1584
+ {
1585
+ LocatorInfoPtr locatorInfo = _reference->getLocatorInfo();
1586
+ assert(locatorInfo);
1587
+ locatorInfo->clearCache(_reference);
1588
+ if(_cached)
1589
+ {
1590
+ TraceLevelsPtr traceLvls = _reference->getInstance()->traceLevels();
1591
+ if(traceLvls->retry >= 2)
1592
+ {
1593
+ Trace out(_reference->getInstance()->initializationData().logger, traceLvls->retryCat);
1594
+ out << "connection to cached endpoints failed\n"
1595
+ << "removing endpoints from cache and trying one more time\n" << ex;
1596
+ }
1597
+ _reference->getConnectionNoRouterInfo(_callback); // Retry.
1598
+ return;
1599
+ }
1600
+ _callback->setException(ex);
1601
+ }
1602
+ }
1603
+
1604
+ Callback2(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& cb, bool cached) :
1605
+ _reference(reference), _callback(cb), _cached(cached)
1606
+ {
1607
+ }
1608
+
1609
+ private:
1610
+
1611
+ const RoutableReferencePtr _reference;
1612
+ const GetConnectionCallbackPtr _callback;
1613
+ const bool _cached;
1614
+ };
1615
+
1616
+
1617
+ virtual void
1618
+ setEndpoints(const vector<EndpointIPtr>& endpoints, bool cached)
1619
+ {
1620
+ if(endpoints.empty())
1621
+ {
1622
+ _callback->setException(Ice::NoEndpointException(__FILE__, __LINE__, _reference->toString()));
1623
+ return;
1624
+ }
1625
+
1626
+ vector<EndpointIPtr> endpts = endpoints;
1627
+ _reference->applyOverrides(endpts);
1628
+ _reference->createConnection(endpts, new Callback2(_reference, _callback, cached));
1629
+ }
1630
+
1631
+ virtual void
1632
+ setException(const Ice::LocalException& ex)
1633
+ {
1634
+ _callback->setException(ex);
1635
+ }
1636
+
1637
+ Callback(const RoutableReferencePtr& reference, const GetConnectionCallbackPtr& callback) :
1638
+ _reference(reference), _callback(callback)
1639
+ {
1640
+ }
1641
+
1642
+ private:
1643
+
1644
+ const RoutableReferencePtr _reference;
1645
+ const GetConnectionCallbackPtr _callback;
1646
+ };
1647
+
1648
+ if(!_endpoints.empty())
1649
+ {
1650
+ createConnection(_endpoints, callback);
1651
+ return;
1652
+ }
1653
+
1654
+ if(_locatorInfo)
1655
+ {
1656
+ RoutableReference* self = const_cast<RoutableReference*>(this);
1657
+ _locatorInfo->getEndpoints(self, _locatorCacheTimeout, new Callback(self, callback));
1658
+ }
1659
+ else
1660
+ {
1661
+ callback->setException(Ice::NoEndpointException(__FILE__, __LINE__, toString()));
1662
+ }
1663
+ }
1664
+
1665
+ void
1666
+ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& allEndpoints,
1667
+ const GetConnectionCallbackPtr& callback) const
1668
+ {
1669
+ vector<EndpointIPtr> endpoints = filterEndpoints(allEndpoints);
1670
+ if(endpoints.empty())
1671
+ {
1672
+ callback->setException(Ice::NoEndpointException(__FILE__, __LINE__, toString()));
1673
+ return;
1674
+ }
1675
+
1676
+ //
1677
+ // Finally, create the connection.
1678
+ //
1679
+ OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory();
1680
+ if(getCacheConnection() || endpoints.size() == 1)
1681
+ {
1682
+ class CB1 : public OutgoingConnectionFactory::CreateConnectionCallback
1683
+ {
1684
+ public:
1685
+
1686
+ virtual void
1687
+ setConnection(const Ice::ConnectionIPtr& connection, bool compress)
1688
+ {
1689
+ //
1690
+ // If we have a router, set the object adapter for this router
1691
+ // (if any) to the new connection, so that callbacks from the
1692
+ // router can be received over this new connection.
1693
+ //
1694
+ if(_routerInfo && _routerInfo->getAdapter())
1695
+ {
1696
+ connection->setAdapter(_routerInfo->getAdapter());
1697
+ }
1698
+ _callback->setConnection(connection, compress);
1699
+ }
1700
+
1701
+ virtual void
1702
+ setException(const Ice::LocalException& ex)
1703
+ {
1704
+ _callback->setException(ex);
1705
+ }
1706
+
1707
+ CB1(const RouterInfoPtr& routerInfo, const GetConnectionCallbackPtr& callback) :
1708
+ _routerInfo(routerInfo), _callback(callback)
1709
+ {
1710
+ }
1711
+
1712
+ private:
1713
+
1714
+ const RouterInfoPtr _routerInfo;
1715
+ const GetConnectionCallbackPtr _callback;
1716
+ };
1717
+
1718
+ //
1719
+ // Get an existing connection or create one if there's no
1720
+ // existing connection to one of the given endpoints.
1721
+ //
1722
+ factory->create(endpoints, false, getEndpointSelection(), new CB1(_routerInfo, callback));
1723
+ return;
1724
+ }
1725
+ else
1726
+ {
1727
+ class CB2 : public OutgoingConnectionFactory::CreateConnectionCallback
1728
+ {
1729
+ public:
1730
+
1731
+ virtual void
1732
+ setConnection(const Ice::ConnectionIPtr& connection, bool compress)
1733
+ {
1734
+ //
1735
+ // If we have a router, set the object adapter for this router
1736
+ // (if any) to the new connection, so that callbacks from the
1737
+ // router can be received over this new connection.
1738
+ //
1739
+ if(_reference->getRouterInfo() && _reference->getRouterInfo()->getAdapter())
1740
+ {
1741
+ connection->setAdapter(_reference->getRouterInfo()->getAdapter());
1742
+ }
1743
+ _callback->setConnection(connection, compress);
1744
+ }
1745
+
1746
+ virtual void
1747
+ setException(const Ice::LocalException& ex)
1748
+ {
1749
+ if(!_exception.get())
1750
+ {
1751
+ _exception.reset(ex.ice_clone());
1752
+ }
1753
+
1754
+ if(++_i == _endpoints.size())
1755
+ {
1756
+ _callback->setException(*_exception.get());
1757
+ return;
1758
+ }
1759
+
1760
+ const bool more = _i != _endpoints.size() - 1;
1761
+ vector<EndpointIPtr> endpoint;
1762
+ endpoint.push_back(_endpoints[_i]);
1763
+
1764
+ OutgoingConnectionFactoryPtr factory = _reference->getInstance()->outgoingConnectionFactory();
1765
+ factory->create(endpoint, more, _reference->getEndpointSelection(), this);
1766
+ }
1767
+
1768
+ CB2(const RoutableReferencePtr& reference, const vector<EndpointIPtr>& endpoints,
1769
+ const GetConnectionCallbackPtr& callback) :
1770
+ _reference(reference),
1771
+ _endpoints(endpoints),
1772
+ _callback(callback),
1773
+ _i(0)
1774
+ {
1775
+ }
1776
+
1777
+ private:
1778
+
1779
+ const RoutableReferencePtr _reference;
1780
+ const vector<EndpointIPtr> _endpoints;
1781
+ const GetConnectionCallbackPtr _callback;
1782
+ size_t _i;
1783
+ IceUtil::UniquePtr<Ice::LocalException> _exception;
1784
+ };
1785
+
1786
+ //
1787
+ // Go through the list of endpoints and try to create the
1788
+ // connection until it succeeds. This is different from just
1789
+ // calling create() with the given endpoints since this might
1790
+ // create a new connection even if there's an existing
1791
+ // connection for one of the endpoints.
1792
+ //
1793
+
1794
+ vector<EndpointIPtr> endpt;
1795
+ endpt.push_back(endpoints[0]);
1796
+ RoutableReference* self = const_cast<RoutableReference*>(this);
1797
+ factory->create(endpt, true, getEndpointSelection(), new CB2(self, endpoints, callback));
1798
+ return;
1799
+ }
1800
+ }
1801
+
1802
+ void
1803
+ IceInternal::RoutableReference::applyOverrides(vector<EndpointIPtr>& endpoints) const
1804
+ {
1805
+ for(vector<EndpointIPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
1806
+ {
1807
+ *p = (*p)->connectionId(_connectionId);
1808
+ if(_overrideCompress)
1809
+ {
1810
+ *p = (*p)->compress(_compress);
1811
+ }
1812
+ if(_overrideTimeout)
1813
+ {
1814
+ *p = (*p)->timeout(_timeout);
1815
+ }
1816
+ }
1817
+ }
1818
+
1819
+ IceInternal::RoutableReference::RoutableReference(const RoutableReference& r) :
1820
+ Reference(r),
1821
+ _endpoints(r._endpoints),
1822
+ _adapterId(r._adapterId),
1823
+ _locatorInfo(r._locatorInfo),
1824
+ _routerInfo(r._routerInfo),
1825
+ _collocationOptimized(r._collocationOptimized),
1826
+ _cacheConnection(r._cacheConnection),
1827
+ _preferSecure(r._preferSecure),
1828
+ _endpointSelection(r._endpointSelection),
1829
+ _locatorCacheTimeout(r._locatorCacheTimeout),
1830
+ _overrideTimeout(r._overrideTimeout),
1831
+ _timeout(r._timeout),
1832
+ _connectionId(r._connectionId)
1833
+ {
1834
+ }
1835
+
1836
+ namespace
1837
+ {
1838
+
1839
+ struct EndpointIsOpaque : public unary_function<EndpointIPtr, bool>
1840
+ {
1841
+ public:
1842
+
1843
+ bool
1844
+ operator()(EndpointIPtr p) const
1845
+ {
1846
+ return dynamic_cast<OpaqueEndpointI*>(p.get()) != 0;
1847
+ }
1848
+ };
1849
+
1850
+ }
1851
+
1852
+ vector<EndpointIPtr>
1853
+ IceInternal::RoutableReference::filterEndpoints(const vector<EndpointIPtr>& allEndpoints) const
1854
+ {
1855
+ vector<EndpointIPtr> endpoints = allEndpoints;
1856
+
1857
+ //
1858
+ // Filter out unknown endpoints.
1859
+ //
1860
+ endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), EndpointIsOpaque()), endpoints.end());
1861
+
1862
+ //
1863
+ // Filter out endpoints according to the mode of the reference.
1864
+ //
1865
+ switch(getMode())
1866
+ {
1867
+ case Reference::ModeTwoway:
1868
+ case Reference::ModeOneway:
1869
+ case Reference::ModeBatchOneway:
1870
+ {
1871
+ //
1872
+ // Filter out datagram endpoints.
1873
+ //
1874
+ endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), Ice::constMemFun(&EndpointI::datagram)),
1875
+ endpoints.end());
1876
+ break;
1877
+ }
1878
+
1879
+ case Reference::ModeDatagram:
1880
+ case Reference::ModeBatchDatagram:
1881
+ {
1882
+ //
1883
+ // Filter out non-datagram endpoints.
1884
+ //
1885
+ endpoints.erase(remove_if(endpoints.begin(), endpoints.end(),
1886
+ not1(Ice::constMemFun(&EndpointI::datagram))),
1887
+ endpoints.end());
1888
+ break;
1889
+ }
1890
+ }
1891
+
1892
+ //
1893
+ // Sort the endpoints according to the endpoint selection type.
1894
+ //
1895
+ switch(getEndpointSelection())
1896
+ {
1897
+ case Random:
1898
+ {
1899
+ RandomNumberGenerator rng;
1900
+ random_shuffle(endpoints.begin(), endpoints.end(), rng);
1901
+ break;
1902
+ }
1903
+ case Ordered:
1904
+ {
1905
+ // Nothing to do.
1906
+ break;
1907
+ }
1908
+ default:
1909
+ {
1910
+ assert(false);
1911
+ break;
1912
+ }
1913
+ }
1914
+
1915
+ //
1916
+ // If a secure connection is requested or secure overrides is set,
1917
+ // remove all non-secure endpoints. Otherwise if preferSecure is set
1918
+ // make secure endpoints prefered. By default make non-secure
1919
+ // endpoints preferred over secure endpoints.
1920
+ //
1921
+ DefaultsAndOverridesPtr overrides = getInstance()->defaultsAndOverrides();
1922
+ if(overrides->overrideSecure ? overrides->overrideSecureValue : getSecure())
1923
+ {
1924
+ endpoints.erase(remove_if(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::secure))),
1925
+ endpoints.end());
1926
+ }
1927
+ else if(getPreferSecure())
1928
+ {
1929
+ //
1930
+ // We must use stable_partition() instead of just simply
1931
+ // partition(), because otherwise some STL implementations
1932
+ // order our now randomized endpoints.
1933
+ //
1934
+ stable_partition(endpoints.begin(), endpoints.end(), Ice::constMemFun(&EndpointI::secure));
1935
+ }
1936
+ else
1937
+ {
1938
+ //
1939
+ // We must use stable_partition() instead of just simply
1940
+ // partition(), because otherwise some STL implementations
1941
+ // order our now randomized endpoints.
1942
+ //
1943
+ stable_partition(endpoints.begin(), endpoints.end(), not1(Ice::constMemFun(&EndpointI::secure)));
1944
+ }
1945
+
1946
+ return endpoints;
1947
+ }