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,66 @@
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_SSL_ACCEPTOR_I_H
11
+ #define ICE_SSL_ACCEPTOR_I_H
12
+
13
+ #include <Ice/TransceiverF.h>
14
+ #include <Ice/Acceptor.h>
15
+ #include <IceSSL/InstanceF.h>
16
+ #include <Ice/Network.h>
17
+
18
+ #include <vector>
19
+
20
+ namespace IceSSL
21
+ {
22
+
23
+ class AcceptorI : public IceInternal::Acceptor, public IceInternal::NativeInfo
24
+ {
25
+ public:
26
+
27
+ virtual IceInternal::NativeInfoPtr getNativeInfo();
28
+ #ifdef ICE_USE_IOCP
29
+ virtual IceInternal::AsyncInfo* getAsyncInfo(IceInternal::SocketOperation);
30
+ #endif
31
+
32
+ virtual void close();
33
+ virtual IceInternal::EndpointIPtr listen();
34
+ #ifdef ICE_USE_IOCP
35
+ virtual void startAccept();
36
+ virtual void finishAccept();
37
+ #endif
38
+ virtual IceInternal::TransceiverPtr accept();
39
+ virtual std::string protocol() const;
40
+ virtual std::string toString() const;
41
+ virtual std::string toDetailedString() const;
42
+
43
+ int effectivePort() const;
44
+
45
+ private:
46
+
47
+ AcceptorI(const EndpointIPtr&, const InstancePtr&, const std::string&, const std::string&, int);
48
+ virtual ~AcceptorI();
49
+ friend class EndpointI;
50
+
51
+ EndpointIPtr _endpoint;
52
+ const InstancePtr _instance;
53
+ const std::string _adapterName;
54
+ const IceInternal::Address _addr;
55
+ int _backlog;
56
+ #ifdef ICE_USE_IOCP
57
+ SOCKET _acceptFd;
58
+ int _acceptError;
59
+ std::vector<char> _acceptBuf;
60
+ IceInternal::AsyncInfo _info;
61
+ #endif
62
+ };
63
+
64
+ }
65
+
66
+ #endif
@@ -0,0 +1,1334 @@
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/DisableWarnings.h>
11
+ #include <IceUtil/Mutex.h>
12
+ #include <IceUtil/MutexPtrLock.h>
13
+ #include <IceUtil/StringUtil.h>
14
+ #include <IceSSL/Plugin.h>
15
+ #include <IceSSL/Util.h>
16
+ #include <IceSSL/RFC2253.h>
17
+ #include <Ice/Object.h>
18
+
19
+ #if defined(ICE_USE_OPENSSL)
20
+ # include <openssl/x509v3.h>
21
+ # include <openssl/pem.h>
22
+ //
23
+ // Avoid old style cast warnings from OpenSSL macros
24
+ //
25
+ # pragma GCC diagnostic ignored "-Wold-style-cast"
26
+ #elif defined(ICE_USE_SECURE_TRANSPORT)
27
+ # include <Security/Security.h>
28
+ #endif
29
+
30
+ #ifdef __SUNPRO_CC
31
+
32
+ //
33
+ // The call to sk_GENERAL_NAME_pop_free fails to compile if we don't
34
+ // remove the extern "C" vs non extern "C" check with the macro below:
35
+ //
36
+
37
+ extern "C" typedef void (*FreeFunc)(void*);
38
+
39
+ #undef CHECKED_SK_FREE_FUNC
40
+ #define CHECKED_SK_FREE_FUNC(type, p) \
41
+ (FreeFunc) (p)
42
+
43
+ #endif
44
+
45
+
46
+ using namespace std;
47
+ using namespace Ice;
48
+ using namespace IceSSL;
49
+
50
+ const char* IceSSL::CertificateReadException::_name = "IceSSL::CertificateReadException";
51
+
52
+ #if defined(ICE_USE_SECURE_TRANSPORT) || defined(ICE_USE_SCHANNEL)
53
+ //
54
+ // Map a certificate OID to its alias
55
+ //
56
+ struct CertificateOID
57
+ {
58
+ const char* name;
59
+ const char* alias;
60
+ };
61
+
62
+ const CertificateOID certificateOIDS[] =
63
+ {
64
+ {"2.5.4.3", "CN"},
65
+ {"2.5.4.4", "SN"},
66
+ {"2.5.4.5", "DeviceSerialNumber"},
67
+ {"2.5.4.6", "C"},
68
+ {"2.5.4.7", "L"},
69
+ {"2.5.4.8", "ST"},
70
+ {"2.5.4.9", "STREET"},
71
+ {"2.5.4.10", "O"},
72
+ {"2.5.4.11", "OU"},
73
+ {"2.5.4.12", "T"},
74
+ {"2.5.4.42", "G"},
75
+ {"2.5.4.43", "I"},
76
+ {"1.2.840.113549.1.9.8", "unstructuredAddress"},
77
+ {"1.2.840.113549.1.9.2", "unstructuredName"},
78
+ {"1.2.840.113549.1.9.1", "emailAddress"},
79
+ {"0.9.2342.19200300.100.1.25", "DC"}
80
+ };
81
+ const int certificateOIDSSize = sizeof(certificateOIDS) / sizeof(CertificateOID);
82
+
83
+ #endif
84
+
85
+
86
+ #if defined(ICE_USE_SECURE_TRANSPORT)
87
+
88
+ string
89
+ certificateOIDAlias(const string& name)
90
+ {
91
+ for(int i = 0; i < certificateOIDSSize; ++i)
92
+ {
93
+ const CertificateOID* certificateOID = &certificateOIDS[i];
94
+ assert(certificateOID);
95
+ if(name == certificateOID->name)
96
+ {
97
+ return certificateOID->alias;
98
+ }
99
+ }
100
+ return name;
101
+ }
102
+
103
+ //
104
+ // Map alternative name alias to its types.
105
+ //
106
+ const char* certificateAlternativeNameTypes[] = {"", "Email Address", "DNS Name", "", "Directory Name", "", "URI",
107
+ "IP Address"};
108
+ const int certificateAlternativeNameTypesSize = sizeof(certificateAlternativeNameTypes) / sizeof(char*);
109
+
110
+ int
111
+ certificateAlternativeNameType(const string& alias)
112
+ {
113
+ if(!alias.empty())
114
+ {
115
+ for(int i = 0; i < certificateAlternativeNameTypesSize; ++i)
116
+ {
117
+ if(alias == certificateAlternativeNameTypes[i])
118
+ {
119
+ return i;
120
+ }
121
+ }
122
+ }
123
+ return -1; // Not supported
124
+ }
125
+
126
+ string
127
+ escapeX509Name(const string& name)
128
+ {
129
+ ostringstream os;
130
+ for(string::const_iterator i = name.begin(); i != name.end(); ++i)
131
+ {
132
+ switch(*i)
133
+ {
134
+ case ',':
135
+ case '=':
136
+ case '+':
137
+ case '<':
138
+ case '>':
139
+ case '#':
140
+ case ';':
141
+ {
142
+ os << '\\';
143
+ }
144
+ default:
145
+ {
146
+ break;
147
+ }
148
+ }
149
+ os << *i;
150
+ }
151
+ return os.str();
152
+ }
153
+
154
+ DistinguishedName
155
+ getX509Name(SecCertificateRef cert, CFTypeRef key)
156
+ {
157
+ assert(key == kSecOIDX509V1IssuerName || key == kSecOIDX509V1SubjectName);
158
+ list<pair<string, string> > rdnPairs;
159
+ CFDictionaryRef property = getCertificateProperty(cert, key);
160
+ if(property)
161
+ {
162
+ CFArrayRef dn = (CFArrayRef)CFDictionaryGetValue(property, kSecPropertyKeyValue);
163
+ int size = CFArrayGetCount(dn);
164
+ for(int i = 0; i < size; ++i)
165
+ {
166
+ CFDictionaryRef dict = (CFDictionaryRef)CFArrayGetValueAtIndex(dn, i);
167
+ rdnPairs.push_front(make_pair(
168
+ certificateOIDAlias(fromCFString((CFStringRef)CFDictionaryGetValue(dict, kSecPropertyKeyLabel))),
169
+ escapeX509Name(fromCFString((CFStringRef)CFDictionaryGetValue(dict, kSecPropertyKeyValue)))));
170
+ }
171
+ CFRelease(property);
172
+ }
173
+ return DistinguishedName(rdnPairs);
174
+ }
175
+
176
+ vector<pair<int, string> >
177
+ getX509AltName(SecCertificateRef cert, CFTypeRef key)
178
+ {
179
+ assert(key == kSecOIDIssuerAltName || key == kSecOIDSubjectAltName);
180
+ CFDictionaryRef property = getCertificateProperty(cert, key);
181
+
182
+ vector<pair<int, string> > pairs;
183
+ if(property)
184
+ {
185
+ CFArrayRef names = (CFArrayRef)CFDictionaryGetValue(property, kSecPropertyKeyValue);
186
+ int size = CFArrayGetCount(names);
187
+
188
+ for(int i = 0; i < size; ++i)
189
+ {
190
+ CFDictionaryRef dict = (CFDictionaryRef)CFArrayGetValueAtIndex(names, i);
191
+
192
+ int type = certificateAlternativeNameType(fromCFString(
193
+ (CFStringRef)CFDictionaryGetValue(dict, kSecPropertyKeyLabel)));
194
+ if(type != -1)
195
+ {
196
+ CFTypeRef v = (CFTypeRef)CFDictionaryGetValue(dict, kSecPropertyKeyValue);
197
+ CFStringRef t = (CFStringRef)CFDictionaryGetValue(dict, kSecPropertyKeyType);
198
+ if(CFEqual(t, kSecPropertyTypeString) || CFEqual(t, kSecPropertyTypeTitle))
199
+ {
200
+ pairs.push_back(make_pair(type, fromCFString((CFStringRef)v)));
201
+ }
202
+ else if(CFEqual(t, kSecPropertyTypeURL))
203
+ {
204
+ pairs.push_back(make_pair(type, fromCFString(CFURLGetString((CFURLRef)v))));
205
+ }
206
+ else if(CFEqual(t, kSecPropertyTypeSection))
207
+ {
208
+ CFArrayRef section = (CFArrayRef)v;
209
+ ostringstream os;
210
+ for(int i = 0, count = CFArrayGetCount(section); i < count;)
211
+ {
212
+ CFDictionaryRef d = (CFDictionaryRef)CFArrayGetValueAtIndex(section, i);
213
+
214
+ CFStringRef sectionLabel = (CFStringRef)CFDictionaryGetValue(d, kSecPropertyKeyLabel);
215
+ CFStringRef sectionValue = (CFStringRef)CFDictionaryGetValue(d, kSecPropertyKeyValue);
216
+
217
+ os << certificateOIDAlias(fromCFString(sectionLabel)) << "=" << fromCFString(sectionValue);
218
+ if(++i < count)
219
+ {
220
+ os << ",";
221
+ }
222
+ }
223
+ pairs.push_back(make_pair(type, os.str()));
224
+ }
225
+ }
226
+ }
227
+ CFRelease(property);
228
+ }
229
+ return pairs;
230
+ }
231
+
232
+ IceUtil::Time
233
+ getX509Date(SecCertificateRef cert, CFTypeRef key)
234
+ {
235
+ assert(key == kSecOIDX509V1ValidityNotAfter || key == kSecOIDX509V1ValidityNotBefore);
236
+ CFDictionaryRef property = getCertificateProperty(cert, key);
237
+ CFAbsoluteTime seconds = 0;
238
+ if(property)
239
+ {
240
+ CFNumberRef date = (CFNumberRef)CFDictionaryGetValue(property, kSecPropertyKeyValue);
241
+ CFNumberGetValue(date, kCFNumberDoubleType, &seconds);
242
+ CFRelease(property);
243
+ }
244
+ return IceUtil::Time::secondsDouble(kCFAbsoluteTimeIntervalSince1970 + seconds);
245
+ }
246
+
247
+ string
248
+ getX509String(SecCertificateRef cert, CFTypeRef key)
249
+ {
250
+ assert(key == kSecOIDX509V1SerialNumber || key == kSecOIDX509V1Version);
251
+ CFDictionaryRef property = getCertificateProperty(cert, key);
252
+ string value;
253
+ if(property)
254
+ {
255
+ value = fromCFString((CFStringRef)CFDictionaryGetValue(property, kSecPropertyKeyValue));
256
+ CFRelease(property);
257
+ }
258
+ return value;
259
+ }
260
+
261
+ #elif defined(ICE_USE_SCHANNEL)
262
+
263
+ void
264
+ loadCertificate(PCERT_SIGNED_CONTENT_INFO* cert, const char* buffer, DWORD length)
265
+ {
266
+ DWORD outLength = length;
267
+ vector<BYTE> outBuffer;
268
+ outBuffer.resize(outLength);
269
+
270
+ if(!CryptStringToBinary(buffer, length, CRYPT_STRING_BASE64HEADER, &outBuffer[0], &outLength, 0, 0))
271
+ {
272
+ //
273
+ // Base64 data should always be bigger than binary
274
+ //
275
+ assert(GetLastError() != ERROR_MORE_DATA);
276
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
277
+ }
278
+
279
+ DWORD decodedLeng = 0;
280
+ if(!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_CERT, &outBuffer[0], outLength, CRYPT_DECODE_ALLOC_FLAG, 0,
281
+ cert, &decodedLeng))
282
+ {
283
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
284
+ }
285
+ }
286
+
287
+ void
288
+ loadCertificate(PCERT_SIGNED_CONTENT_INFO* cert, const string& file)
289
+ {
290
+ vector<char> buffer;
291
+ readFile(file, buffer);
292
+ loadCertificate(cert, &buffer[0], static_cast<DWORD>(buffer.size()));
293
+ }
294
+
295
+ const Ice::Long TICKS_PER_MSECOND = 10000LL;
296
+ const Ice::Long MSECS_TO_EPOCH = 11644473600000LL;
297
+
298
+ IceUtil::Time
299
+ filetimeToTime(FILETIME ftime)
300
+ {
301
+ Ice::Long value = 0;
302
+ DWORD* dest = reinterpret_cast<DWORD*>(&value);
303
+ *dest++ = ftime.dwLowDateTime;
304
+ *dest = ftime.dwHighDateTime;
305
+ return IceUtil::Time::milliSeconds((value / TICKS_PER_MSECOND) - MSECS_TO_EPOCH);
306
+ }
307
+
308
+ string
309
+ certNameToString(CERT_NAME_BLOB* name)
310
+ {
311
+ assert(name);
312
+ DWORD length = 0;
313
+ if(!(length = CertNameToStr(X509_ASN_ENCODING, name, CERT_OID_NAME_STR|CERT_NAME_STR_REVERSE_FLAG, 0, 0)))
314
+ {
315
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
316
+ }
317
+
318
+ vector<char> buffer(length);
319
+ if(!CertNameToStr(X509_ASN_ENCODING, name, CERT_OID_NAME_STR|CERT_NAME_STR_REVERSE_FLAG, &buffer[0], length))
320
+ {
321
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
322
+ }
323
+
324
+ string s(&buffer[0]);
325
+ for(int i = 0; i < certificateOIDSSize; ++i)
326
+ {
327
+ const CertificateOID* certificateOID = &certificateOIDS[i];
328
+ assert(certificateOID);
329
+ const string name = string(certificateOID->name) + "=";
330
+ const string alias = string(certificateOID->alias) + "=";
331
+ size_t pos = 0;
332
+ while((pos = s.find(name, pos)) != string::npos)
333
+ {
334
+ s.replace(pos, name.size(), alias);
335
+ }
336
+ }
337
+ return s;
338
+ }
339
+
340
+ vector<pair<int, string> >
341
+ certificateAltNames(CERT_INFO* certInfo, LPCSTR altNameOID)
342
+ {
343
+ vector<pair<int, string> > altNames;
344
+
345
+ PCERT_EXTENSION extension = CertFindExtension(altNameOID, certInfo->cExtension, certInfo->rgExtension);
346
+ if(extension)
347
+ {
348
+ CERT_ALT_NAME_INFO* altName;
349
+ DWORD length = 0;
350
+ if(!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ALTERNATE_NAME, extension->Value.pbData,
351
+ extension->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, 0, &altName, &length))
352
+ {
353
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
354
+ }
355
+
356
+ for(DWORD i = 0; i < altName->cAltEntry; ++i)
357
+ {
358
+ CERT_ALT_NAME_ENTRY* entry = &altName->rgAltEntry[i];
359
+
360
+ switch(entry->dwAltNameChoice)
361
+ {
362
+ case CERT_ALT_NAME_RFC822_NAME:
363
+ {
364
+ altNames.push_back(make_pair(AltNameEmail, IceUtil::wstringToString(entry->pwszRfc822Name)));
365
+ break;
366
+ }
367
+ case CERT_ALT_NAME_DNS_NAME:
368
+ {
369
+ altNames.push_back(make_pair(AltNameDNS, IceUtil::wstringToString(entry->pwszDNSName)));
370
+ break;
371
+ }
372
+ case CERT_ALT_NAME_DIRECTORY_NAME:
373
+ {
374
+ altNames.push_back(make_pair(AltNameDirectory, certNameToString(&entry->DirectoryName)));
375
+ break;
376
+ }
377
+ case CERT_ALT_NAME_URL:
378
+ {
379
+ altNames.push_back(make_pair(AltNameURL, IceUtil::wstringToString(entry->pwszURL)));
380
+ break;
381
+ }
382
+ case CERT_ALT_NAME_IP_ADDRESS:
383
+ {
384
+ if(entry->IPAddress.cbData == 4)
385
+ {
386
+ //
387
+ // IPv4 address
388
+ //
389
+ ostringstream os;
390
+ Byte* src = reinterpret_cast<Byte*>(entry->IPAddress.pbData);
391
+ for(int j = 0; j < 4;)
392
+ {
393
+ int value = 0;
394
+ Byte* dest = reinterpret_cast<Byte*>(&value);
395
+ *dest = *src++;
396
+ os << value;
397
+ if(++j < 4)
398
+ {
399
+ os << ".";
400
+ }
401
+ }
402
+ altNames.push_back(make_pair(AltNAmeIP, os.str()));
403
+ }
404
+ //
405
+ // TODO IPv6 Address support.
406
+ //
407
+ break;
408
+ }
409
+ default:
410
+ {
411
+ // Not supported
412
+ break;
413
+ }
414
+ }
415
+ }
416
+ LocalFree(altName);
417
+ }
418
+ return altNames;
419
+ }
420
+ #endif
421
+
422
+ CertificateReadException::CertificateReadException(const char* file, int line, const string& r) :
423
+ Exception(file, line),
424
+ reason(r)
425
+ {
426
+ }
427
+
428
+ CertificateReadException::~CertificateReadException() throw()
429
+ {
430
+ }
431
+
432
+ string
433
+ CertificateReadException::ice_name() const
434
+ {
435
+ return _name;
436
+ }
437
+
438
+ CertificateReadException*
439
+ CertificateReadException::ice_clone() const
440
+ {
441
+ return new CertificateReadException(*this);
442
+ }
443
+
444
+ void
445
+ CertificateReadException::ice_throw() const
446
+ {
447
+ throw *this;
448
+ }
449
+
450
+ const char* IceSSL::CertificateEncodingException::_name = "IceSSL::CertificateEncodingException";
451
+
452
+ #ifdef ICE_USE_SECURE_TRANSPORT
453
+ CertificateEncodingException::CertificateEncodingException(const char* file, int line, CFErrorRef err) :
454
+ Exception(file, line)
455
+ {
456
+ assert(err);
457
+ reason = "certificate error:\n" + errorToString(err);
458
+ CFRelease(err);
459
+ }
460
+ #endif
461
+
462
+ CertificateEncodingException::CertificateEncodingException(const char* file, int line, const string& r) :
463
+ Exception(file, line),
464
+ reason(r)
465
+ {
466
+ }
467
+
468
+ CertificateEncodingException::~CertificateEncodingException() throw()
469
+ {
470
+ }
471
+
472
+ string
473
+ CertificateEncodingException::ice_name() const
474
+ {
475
+ return _name;
476
+ }
477
+
478
+ CertificateEncodingException*
479
+ CertificateEncodingException::ice_clone() const
480
+ {
481
+ return new CertificateEncodingException(*this);
482
+ }
483
+
484
+ void
485
+ CertificateEncodingException::ice_throw() const
486
+ {
487
+ throw *this;
488
+ }
489
+
490
+ #ifdef ICE_USE_OPENSSL
491
+
492
+ namespace
493
+ {
494
+
495
+ IceUtil::Mutex* mut = 0;
496
+
497
+ class Init
498
+ {
499
+ public:
500
+
501
+ Init()
502
+ {
503
+ mut = new IceUtil::Mutex;
504
+ }
505
+
506
+ ~Init()
507
+ {
508
+ delete mut;
509
+ mut = 0;
510
+ }
511
+ };
512
+
513
+ Init init;
514
+
515
+ }
516
+
517
+ static IceUtil::Time
518
+ ASMUtcTimeToIceUtilTime(const ASN1_UTCTIME* s)
519
+ {
520
+ struct tm tm;
521
+ int offset;
522
+
523
+ memset(&tm, '\0', sizeof tm);
524
+
525
+ # define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
526
+ tm.tm_year = g2(s->data);
527
+ if(tm.tm_year < 50)
528
+ tm.tm_year += 100;
529
+ tm.tm_mon = g2(s->data + 2) - 1;
530
+ tm.tm_mday = g2(s->data + 4);
531
+ tm.tm_hour = g2(s->data + 6);
532
+ tm.tm_min = g2(s->data + 8);
533
+ tm.tm_sec = g2(s->data + 10);
534
+ if(s->data[12] == 'Z')
535
+ {
536
+ offset = 0;
537
+ }
538
+ else
539
+ {
540
+ offset = g2(s->data + 13) * 60 + g2(s->data + 15);
541
+ if(s->data[12] == '-')
542
+ {
543
+ offset = -offset;
544
+ }
545
+ }
546
+ # undef g2
547
+
548
+ //
549
+ // If timegm was on all systems this code could be
550
+ // return IceUtil::Time::seconds(timegm(&tm) - offset*60);
551
+ //
552
+ // Windows doesn't support the re-entrant _r versions.
553
+ //
554
+ time_t tzone;
555
+ {
556
+ IceUtilInternal::MutexPtrLock<IceUtil::Mutex> sync(mut);
557
+ time_t now = time(0);
558
+ tzone = mktime(localtime(&now)) - mktime(gmtime(&now));
559
+ }
560
+ return IceUtil::Time::seconds(mktime(&tm) - offset*60 + tzone);
561
+ }
562
+
563
+ static string
564
+ convertX509NameToString(X509_NAME* name)
565
+ {
566
+ BIO* out = BIO_new(BIO_s_mem());
567
+ X509_NAME_print_ex(out, name, 0, XN_FLAG_RFC2253);
568
+ BUF_MEM* p;
569
+ BIO_get_mem_ptr(out, &p);
570
+ string result = string(p->data, p->length);
571
+ BIO_free(out);
572
+ return result;
573
+ }
574
+
575
+ static vector<pair<int, string> >
576
+ convertGeneralNames(GENERAL_NAMES* gens)
577
+ {
578
+ vector<pair<int, string> > alt;
579
+ if(gens == 0)
580
+ {
581
+ return alt;
582
+ }
583
+ for(int i = 0; i < sk_GENERAL_NAME_num(gens); ++i)
584
+ {
585
+ GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i);
586
+ pair<int, string> p;
587
+ p.first = gen->type;
588
+ switch(gen->type)
589
+ {
590
+ case GEN_EMAIL:
591
+ {
592
+ ASN1_IA5STRING* str = gen->d.rfc822Name;
593
+ if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
594
+ {
595
+ p.second = string(reinterpret_cast<const char*>(str->data), str->length);
596
+ }
597
+ break;
598
+ }
599
+ case GEN_DNS:
600
+ {
601
+ ASN1_IA5STRING* str = gen->d.dNSName;
602
+ if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
603
+ {
604
+ p.second = string(reinterpret_cast<const char*>(str->data), str->length);
605
+ }
606
+ break;
607
+ }
608
+ case GEN_DIRNAME:
609
+ {
610
+ p.second = convertX509NameToString(gen->d.directoryName);
611
+ break;
612
+ }
613
+ case GEN_URI:
614
+ {
615
+ ASN1_IA5STRING* str = gen->d.uniformResourceIdentifier;
616
+ if(str && str->type == V_ASN1_IA5STRING && str->data && str->length > 0)
617
+ {
618
+ p.second = string(reinterpret_cast<const char*>(str->data), str->length);
619
+ }
620
+ break;
621
+ }
622
+ case GEN_IPADD:
623
+ {
624
+ ASN1_OCTET_STRING* addr = gen->d.iPAddress;
625
+ // TODO: Support IPv6 someday.
626
+ if(addr && addr->type == V_ASN1_OCTET_STRING && addr->data && addr->length == 4)
627
+ {
628
+ ostringstream ostr;
629
+ for(int j = 0; j < 4; ++j)
630
+ {
631
+ if(j > 0)
632
+ {
633
+ ostr << '.';
634
+ }
635
+ ostr << static_cast<int>(addr->data[j]);
636
+ }
637
+ p.second = ostr.str();
638
+ }
639
+ break;
640
+ }
641
+ case GEN_OTHERNAME:
642
+ case GEN_EDIPARTY:
643
+ case GEN_X400:
644
+ case GEN_RID:
645
+ {
646
+ //
647
+ // TODO: These types are not supported. If the user wants
648
+ // them, they have to get at the certificate data. Another
649
+ // alternative is to DER encode the data (as the Java
650
+ // certificate does).
651
+ //
652
+ break;
653
+ }
654
+ }
655
+ alt.push_back(p);
656
+ }
657
+ sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free);
658
+ return alt;
659
+ }
660
+ #endif
661
+
662
+ const char* ParseException::_name = "IceSSL::ParseException";
663
+
664
+ ParseException::ParseException(const char* file, int line, const string& r) :
665
+ Exception(file, line),
666
+ reason(r)
667
+ {
668
+ }
669
+
670
+ ParseException::~ParseException() throw()
671
+ {
672
+ }
673
+
674
+ string
675
+ ParseException::ice_name() const
676
+ {
677
+ return _name;
678
+ }
679
+
680
+ ParseException*
681
+ ParseException::ice_clone() const
682
+ {
683
+ return new ParseException(*this);
684
+ }
685
+
686
+ void
687
+ ParseException::ice_throw() const
688
+ {
689
+ throw *this;
690
+ }
691
+
692
+ #ifdef ICE_USE_OPENSSL
693
+ DistinguishedName::DistinguishedName(X509NAME* name) :
694
+ _rdns(RFC2253::parseStrict(convertX509NameToString(name)))
695
+ {
696
+ unescape();
697
+ }
698
+ #endif
699
+
700
+ DistinguishedName::DistinguishedName(const string& dn) :
701
+ _rdns(RFC2253::parseStrict(dn))
702
+ {
703
+ unescape();
704
+ }
705
+
706
+ DistinguishedName::DistinguishedName(const list<pair<string, string> >& rdns) :
707
+ _rdns(rdns)
708
+ {
709
+ unescape();
710
+ }
711
+
712
+ bool
713
+ DistinguishedName::operator==(const DistinguishedName& other) const
714
+ {
715
+ return other._unescaped == _unescaped;
716
+ }
717
+
718
+ bool
719
+ DistinguishedName::operator!=(const DistinguishedName& other) const
720
+ {
721
+ return other._unescaped != _unescaped;
722
+ }
723
+
724
+ bool
725
+ DistinguishedName::operator<(const DistinguishedName& other) const
726
+ {
727
+ return other._unescaped < _unescaped;
728
+ }
729
+
730
+ bool
731
+ DistinguishedName::match(const DistinguishedName& other) const
732
+ {
733
+ for(list< pair<string, string> >::const_iterator p = other._unescaped.begin(); p != other._unescaped.end(); ++p)
734
+ {
735
+ bool found = false;
736
+ for(list< pair<string, string> >::const_iterator q = _unescaped.begin(); q != _unescaped.end(); ++q)
737
+ {
738
+ if(p->first == q->first)
739
+ {
740
+ found = true;
741
+ if(p->second != q->second)
742
+ {
743
+ return false;
744
+ }
745
+ }
746
+ }
747
+ if(!found)
748
+ {
749
+ return false;
750
+ }
751
+ }
752
+ return true;
753
+ }
754
+
755
+ //
756
+ // This always produces the same output as the input DN -- the type of
757
+ // escaping is not changed.
758
+ //
759
+ DistinguishedName::operator string() const
760
+ {
761
+ ostringstream os;
762
+ bool first = true;
763
+ for(list< pair<string, string> >::const_iterator p = _rdns.begin(); p != _rdns.end(); ++p)
764
+ {
765
+ if(!first)
766
+ {
767
+ os << ",";
768
+ }
769
+ first = false;
770
+ os << p->first << "=" << p->second;
771
+ }
772
+ return os.str();
773
+ }
774
+
775
+ void
776
+ DistinguishedName::unescape()
777
+ {
778
+ for(list< pair<string, string> >::const_iterator q = _rdns.begin(); q != _rdns.end(); ++q)
779
+ {
780
+ pair<string, string> rdn = *q;
781
+ rdn.second = RFC2253::unescape(rdn.second);
782
+ _unescaped.push_back(rdn);
783
+ }
784
+ }
785
+
786
+ PublicKey::PublicKey(const CertificatePtr& cert, KeyRef key) :
787
+ _cert(cert),
788
+ _key(key)
789
+ {
790
+ if(!_key)
791
+ {
792
+ throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Invalid key reference");
793
+ }
794
+ }
795
+
796
+ PublicKey::~PublicKey()
797
+ {
798
+ #ifndef ICE_USE_SCHANNEL
799
+ if(_key)
800
+ {
801
+ # if defined(ICE_USE_SECURE_TRANSPORT)
802
+ CFRelease(_key);
803
+ # else
804
+ EVP_PKEY_free(_key);
805
+ # endif
806
+ }
807
+ #endif
808
+ }
809
+
810
+ KeyRef
811
+ PublicKey::key() const
812
+ {
813
+ return _key;
814
+ }
815
+
816
+ //
817
+ // The caller is responsible for incrementing the reference count.
818
+ //
819
+ Certificate::Certificate(X509CertificateRef cert) : _cert(cert)
820
+ #ifdef ICE_USE_SCHANNEL
821
+ , _certInfo(0)
822
+ #endif
823
+ {
824
+ if(!_cert)
825
+ {
826
+ throw IceUtil::IllegalArgumentException(__FILE__, __LINE__, "Invalid certificate reference");
827
+ }
828
+
829
+ #ifdef ICE_USE_SCHANNEL
830
+ try
831
+ {
832
+ //
833
+ // Decode certificate info
834
+ //
835
+ DWORD length = 0;
836
+ if(!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED, _cert->ToBeSigned.pbData,
837
+ _cert->ToBeSigned.cbData, CRYPT_DECODE_ALLOC_FLAG, 0, &_certInfo, &length))
838
+ {
839
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
840
+ }
841
+ }
842
+ catch(...)
843
+ {
844
+ LocalFree(_cert);
845
+ _cert = 0;
846
+ throw;
847
+ }
848
+ #endif
849
+ }
850
+
851
+ Certificate::~Certificate()
852
+ {
853
+ if(_cert)
854
+ {
855
+ #if defined(ICE_USE_SECURE_TRANSPORT)
856
+ CFRelease(_cert);
857
+ #elif defined(ICE_USE_SCHANNEL)
858
+ LocalFree(_cert);
859
+ if(_certInfo)
860
+ {
861
+ LocalFree(_certInfo);
862
+ }
863
+ #else
864
+ X509_free(_cert);
865
+ #endif
866
+ }
867
+ }
868
+
869
+ CertificatePtr
870
+ Certificate::load(const string& file)
871
+ {
872
+ #if defined(ICE_USE_SECURE_TRANSPORT)
873
+ SecCertificateRef cert = 0;
874
+ loadCertificate(&cert, 0, 0, 0, file);
875
+ return new Certificate(cert);
876
+ #elif defined(ICE_USE_SCHANNEL)
877
+ CERT_SIGNED_CONTENT_INFO* cert;
878
+ loadCertificate(&cert, file);
879
+ return new Certificate(cert);
880
+ #else
881
+ BIO *cert = BIO_new(BIO_s_file());
882
+ if(BIO_read_filename(cert, file.c_str()) <= 0)
883
+ {
884
+ BIO_free(cert);
885
+ throw CertificateReadException(__FILE__, __LINE__, "error opening file");
886
+ }
887
+
888
+ X509CertificateRef x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
889
+ if(x == NULL)
890
+ {
891
+ BIO_free(cert);
892
+ throw CertificateReadException(__FILE__, __LINE__, "error reading file:\n" + getSslErrors(false));
893
+ }
894
+ BIO_free(cert);
895
+ return new Certificate(x);
896
+ #endif
897
+ }
898
+
899
+ CertificatePtr
900
+ Certificate::decode(const string& encoding)
901
+ {
902
+ #if defined(ICE_USE_SECURE_TRANSPORT)
903
+ CFDataRef data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(encoding.c_str()),
904
+ encoding.size(), kCFAllocatorNull);
905
+
906
+ SecExternalFormat format = kSecFormatUnknown;
907
+ SecExternalItemType type = kSecItemTypeCertificate;
908
+
909
+ SecItemImportExportKeyParameters params;
910
+ memset(&params, 0, sizeof(params));
911
+ params.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
912
+
913
+ CFArrayRef items = 0;
914
+ OSStatus err = SecItemImport(data, 0, &format, &type, 0, &params, 0, &items);
915
+ CFRelease(data);
916
+ if(err)
917
+ {
918
+ throw CertificateEncodingException(__FILE__, __LINE__, errorToString(err));
919
+ }
920
+
921
+ SecKeychainItemRef item = (SecKeychainItemRef)CFArrayGetValueAtIndex(items, 0);
922
+ CFRetain(item);
923
+ CFRelease(items);
924
+
925
+ assert(SecCertificateGetTypeID() == CFGetTypeID(item));
926
+ return new Certificate((SecCertificateRef)item);
927
+ #elif defined(ICE_USE_SCHANNEL)
928
+ CERT_SIGNED_CONTENT_INFO* cert;
929
+ loadCertificate(&cert, encoding.c_str(), static_cast<DWORD>(encoding.size()));
930
+ return new Certificate(cert);
931
+ #else
932
+ BIO *cert = BIO_new_mem_buf(static_cast<void*>(const_cast<char*>(&encoding[0])), static_cast<int>(encoding.size()));
933
+ X509CertificateRef x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
934
+ if(x == NULL)
935
+ {
936
+ BIO_free(cert);
937
+ throw CertificateEncodingException(__FILE__, __LINE__, getSslErrors(false));
938
+ }
939
+ BIO_free(cert);
940
+ return new Certificate(x);
941
+ #endif
942
+ }
943
+
944
+ bool
945
+ Certificate::operator==(const Certificate& other) const
946
+ {
947
+ #if defined(ICE_USE_SECURE_TRANSPORT)
948
+ return CFEqual(_cert, other._cert);
949
+ #elif defined(ICE_USE_SCHANNEL)
950
+ return CertCompareCertificate(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, _certInfo, other._certInfo);
951
+ #else
952
+ return X509_cmp(_cert, other._cert) == 0;
953
+ #endif
954
+ }
955
+
956
+ bool
957
+ Certificate::operator!=(const Certificate& other) const
958
+ {
959
+ #if defined(ICE_USE_SECURE_TRANSPORT)
960
+ return !CFEqual(_cert, other._cert);
961
+ #elif defined(ICE_USE_SCHANNEL)
962
+ return !CertCompareCertificate(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, _certInfo, other._certInfo);
963
+ #else
964
+ return X509_cmp(_cert, other._cert) != 0;
965
+ #endif
966
+ }
967
+
968
+ PublicKeyPtr
969
+ Certificate::getPublicKey() const
970
+ {
971
+ #if defined(ICE_USE_SECURE_TRANSPORT)
972
+ SecKeyRef key;
973
+ OSStatus err = SecCertificateCopyPublicKey(_cert, &key);
974
+ if(err)
975
+ {
976
+ throw CertificateEncodingException(__FILE__, __LINE__, errorToString(err));
977
+ }
978
+ return new PublicKey(const_cast<Certificate*>(this), key);
979
+ #elif defined(ICE_USE_SCHANNEL)
980
+ return new PublicKey(const_cast<Certificate*>(this), &_certInfo->SubjectPublicKeyInfo);
981
+ #else
982
+ return new PublicKey(const_cast<Certificate*>(this), X509_get_pubkey(_cert));
983
+ #endif
984
+ }
985
+
986
+ bool
987
+ Certificate::verify(const CertificatePtr& cert) const
988
+ {
989
+ #if defined(ICE_USE_SECURE_TRANSPORT)
990
+ //
991
+ // We first check if the given certificate subject match
992
+ // our certificate issuer. Otherwhise when use SecTrustEvaluate
993
+ // and check a certificate against itself will always return
994
+ // that is valid.
995
+ //
996
+ bool valid = false;
997
+
998
+ CFErrorRef error = 0;
999
+ CFDataRef issuer = 0;
1000
+ CFDataRef subject = 0;
1001
+
1002
+ try
1003
+ {
1004
+ issuer = SecCertificateCopyNormalizedIssuerContent(_cert, &error);
1005
+ if(error)
1006
+ {
1007
+ throw CertificateEncodingException(__FILE__, __LINE__, error);
1008
+ }
1009
+
1010
+ subject = SecCertificateCopyNormalizedSubjectContent(cert->getCert(), &error);
1011
+ if(error)
1012
+ {
1013
+ throw CertificateEncodingException(__FILE__, __LINE__, error);
1014
+ }
1015
+ }
1016
+ catch(...)
1017
+ {
1018
+ if(issuer)
1019
+ {
1020
+ CFRelease(issuer);
1021
+ }
1022
+
1023
+ if(subject)
1024
+ {
1025
+ CFRelease(subject);
1026
+ }
1027
+ throw;
1028
+ }
1029
+
1030
+ //
1031
+ // The certificate issuer must match the CA subject.
1032
+ //
1033
+ valid = CFEqual(issuer, subject);
1034
+
1035
+ CFRelease(issuer);
1036
+ CFRelease(subject);
1037
+
1038
+ if(valid)
1039
+ {
1040
+ SecPolicyRef policy = 0;
1041
+ SecTrustRef trust = 0;
1042
+ try
1043
+ {
1044
+ SecPolicyRef policy = SecPolicyCreateBasicX509();
1045
+ SecTrustResultType trustResult = kSecTrustResultInvalid;
1046
+ SecTrustRef trust;
1047
+ OSStatus err = 0;
1048
+
1049
+ if((err = SecTrustCreateWithCertificates(_cert, policy, &trust)))
1050
+ {
1051
+ throw CertificateEncodingException(__FILE__, __LINE__, errorToString(err));
1052
+ }
1053
+
1054
+ SecCertificateRef certs[1] = { cert->getCert() };
1055
+
1056
+ CFArrayRef anchorCertificates = CFArrayCreate(kCFAllocatorDefault, (const void**)&certs, 1,
1057
+ &kCFTypeArrayCallBacks);
1058
+ err = SecTrustSetAnchorCertificates(trust, anchorCertificates);
1059
+ CFRelease(anchorCertificates);
1060
+
1061
+ if(err)
1062
+ {
1063
+ throw CertificateEncodingException(__FILE__, __LINE__, errorToString(err));
1064
+ }
1065
+
1066
+ if((err = SecTrustEvaluate(trust, &trustResult)))
1067
+ {
1068
+ throw CertificateEncodingException(__FILE__, __LINE__, errorToString(err));
1069
+ }
1070
+
1071
+ valid = trustResult == kSecTrustResultUnspecified;
1072
+
1073
+ CFRelease(policy);
1074
+ CFRelease(trust);
1075
+ }
1076
+ catch(...)
1077
+ {
1078
+ if(policy)
1079
+ {
1080
+ CFRelease(policy);
1081
+ }
1082
+
1083
+ if(trust)
1084
+ {
1085
+ CFRelease(trust);
1086
+ }
1087
+ throw;
1088
+ }
1089
+ }
1090
+ return valid;
1091
+ #elif defined(ICE_USE_SCHANNEL)
1092
+ BYTE* buffer = 0;
1093
+ DWORD length = 0;
1094
+ if(!CryptEncodeObjectEx(X509_ASN_ENCODING, X509_CERT, _cert, CRYPT_ENCODE_ALLOC_FLAG , 0, &buffer, &length))
1095
+ {
1096
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
1097
+ }
1098
+
1099
+ bool result = CryptVerifyCertificateSignature(0, X509_ASN_ENCODING, buffer, length, cert->getPublicKey()->key());
1100
+ LocalFree(buffer);
1101
+ return result;
1102
+ #else
1103
+ return X509_verify(_cert, cert->getPublicKey()->key()) > 0;
1104
+ #endif
1105
+ }
1106
+
1107
+ #ifdef ICE_USE_OPENSSL
1108
+ bool
1109
+ Certificate::verify(const PublicKeyPtr& key) const
1110
+ {
1111
+ return X509_verify(_cert, key->key()) > 0;
1112
+ }
1113
+ #endif
1114
+
1115
+ string
1116
+ Certificate::encode() const
1117
+ {
1118
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1119
+ CFDataRef exported;
1120
+ OSStatus err = SecItemExport(_cert, kSecFormatPEMSequence, kSecItemPemArmour, 0, &exported);
1121
+ if(err != noErr)
1122
+ {
1123
+ throw CertificateEncodingException(__FILE__, __LINE__, errorToString(err));
1124
+ }
1125
+ string data(reinterpret_cast<const char*>(CFDataGetBytePtr(exported)), CFDataGetLength(exported));
1126
+ CFRelease(exported);
1127
+ return data;
1128
+ #elif defined(ICE_USE_SCHANNEL)
1129
+ string s;
1130
+ DWORD length = 0;
1131
+ BYTE* buffer = 0;
1132
+ try
1133
+ {
1134
+ if(!CryptEncodeObjectEx(X509_ASN_ENCODING, X509_CERT, _cert, CRYPT_ENCODE_ALLOC_FLAG , 0, &buffer, &length))
1135
+ {
1136
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
1137
+ }
1138
+
1139
+ DWORD encodedLength = 0;
1140
+ if(!CryptBinaryToString(buffer, length, CRYPT_STRING_BASE64HEADER | CRYPT_STRING_NOCR, 0, &encodedLength))
1141
+ {
1142
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
1143
+ }
1144
+
1145
+ std::vector<char> encoded;
1146
+ encoded.resize(encodedLength);
1147
+ if(!CryptBinaryToString(buffer, length, CRYPT_STRING_BASE64HEADER | CRYPT_STRING_NOCR, &encoded[0],
1148
+ &encodedLength))
1149
+ {
1150
+ throw CertificateEncodingException(__FILE__, __LINE__, IceUtilInternal::lastErrorToString());
1151
+ }
1152
+ LocalFree(buffer);
1153
+ buffer = 0;
1154
+ s.assign(&encoded[0]);
1155
+ }
1156
+ catch(...)
1157
+ {
1158
+ if(buffer)
1159
+ {
1160
+ LocalFree(buffer);
1161
+ }
1162
+ throw;
1163
+ }
1164
+ return s;
1165
+ #else
1166
+ BIO* out = BIO_new(BIO_s_mem());
1167
+ int i = PEM_write_bio_X509_AUX(out, _cert);
1168
+ if(i <= 0)
1169
+ {
1170
+ BIO_free(out);
1171
+ throw CertificateEncodingException(__FILE__, __LINE__, getSslErrors(false));
1172
+ }
1173
+ BUF_MEM* p;
1174
+ BIO_get_mem_ptr(out, &p);
1175
+ string result = string(p->data, p->length);
1176
+ BIO_free(out);
1177
+ return result;
1178
+ #endif
1179
+ }
1180
+
1181
+ bool
1182
+ Certificate::checkValidity() const
1183
+ {
1184
+ IceUtil::Time now = IceUtil::Time::now();
1185
+ return now > getNotBefore() && now <= getNotAfter();
1186
+ }
1187
+
1188
+ bool
1189
+ Certificate::checkValidity(const IceUtil::Time& now) const
1190
+ {
1191
+ return now > getNotBefore() && now <= getNotAfter();
1192
+ }
1193
+
1194
+ IceUtil::Time
1195
+ Certificate::getNotAfter() const
1196
+ {
1197
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1198
+ return getX509Date(_cert, kSecOIDX509V1ValidityNotAfter);
1199
+ #elif defined(ICE_USE_SCHANNEL)
1200
+ return filetimeToTime(_certInfo->NotAfter);
1201
+ #else
1202
+ return ASMUtcTimeToIceUtilTime(X509_get_notAfter(_cert));
1203
+ #endif
1204
+ }
1205
+
1206
+ IceUtil::Time
1207
+ Certificate::getNotBefore() const
1208
+ {
1209
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1210
+ return getX509Date(_cert, kSecOIDX509V1ValidityNotBefore);
1211
+ #elif defined(ICE_USE_SCHANNEL)
1212
+ return filetimeToTime(_certInfo->NotBefore);
1213
+ #else
1214
+ return ASMUtcTimeToIceUtilTime(X509_get_notBefore(_cert));
1215
+ #endif
1216
+ }
1217
+
1218
+ string
1219
+ Certificate::getSerialNumber() const
1220
+ {
1221
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1222
+ return getX509String(_cert, kSecOIDX509V1SerialNumber);
1223
+ #elif defined(ICE_USE_SCHANNEL)
1224
+ ostringstream os;
1225
+ for(int i = _certInfo->SerialNumber.cbData - 1; i >= 0; --i)
1226
+ {
1227
+ unsigned char c = _certInfo->SerialNumber.pbData[i];
1228
+ os.fill('0');
1229
+ os.width(2);
1230
+ os << hex << (int)c;
1231
+ if(i)
1232
+ {
1233
+ os << ' ';
1234
+ }
1235
+ }
1236
+ return IceUtilInternal::toUpper(os.str());
1237
+ #else
1238
+ BIGNUM* bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(_cert), 0);
1239
+ char* dec = BN_bn2dec(bn);
1240
+ string result = dec;
1241
+ OPENSSL_free(dec);
1242
+ BN_free(bn);
1243
+
1244
+ return result;
1245
+ #endif
1246
+ }
1247
+
1248
+ //string
1249
+ //Certificate::getSigAlgName() const
1250
+ //{
1251
+ //}
1252
+
1253
+ //string
1254
+ //Certificate::getSigAlgOID() const
1255
+ //{
1256
+ //}
1257
+
1258
+ DistinguishedName
1259
+ Certificate::getIssuerDN() const
1260
+ {
1261
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1262
+ return getX509Name(_cert, kSecOIDX509V1IssuerName);
1263
+ #elif defined(ICE_USE_SCHANNEL)
1264
+ return DistinguishedName(certNameToString(&_certInfo->Issuer));
1265
+ #else
1266
+ return DistinguishedName(RFC2253::parseStrict(convertX509NameToString(X509_get_issuer_name(_cert))));
1267
+ #endif
1268
+ }
1269
+
1270
+ vector<pair<int, string> >
1271
+ Certificate::getIssuerAlternativeNames()
1272
+ {
1273
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1274
+ return getX509AltName(_cert, kSecOIDIssuerAltName);
1275
+ #elif defined(ICE_USE_SCHANNEL)
1276
+ return certificateAltNames(_certInfo, szOID_ISSUER_ALT_NAME2);
1277
+ #else
1278
+ return convertGeneralNames(reinterpret_cast<GENERAL_NAMES*>(X509_get_ext_d2i(_cert, NID_issuer_alt_name, 0, 0)));
1279
+ #endif
1280
+ }
1281
+
1282
+ DistinguishedName
1283
+ Certificate::getSubjectDN() const
1284
+ {
1285
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1286
+ return getX509Name(_cert, kSecOIDX509V1SubjectName);
1287
+ #elif defined(ICE_USE_SCHANNEL)
1288
+ return DistinguishedName(certNameToString(&_certInfo->Subject));
1289
+ #else
1290
+ return DistinguishedName(RFC2253::parseStrict(convertX509NameToString(X509_get_subject_name(_cert))));
1291
+ #endif
1292
+ }
1293
+
1294
+ vector<pair<int, string> >
1295
+ Certificate::getSubjectAlternativeNames()
1296
+ {
1297
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1298
+ return getX509AltName(_cert, kSecOIDSubjectAltName);
1299
+ #elif defined(ICE_USE_SCHANNEL)
1300
+ return certificateAltNames(_certInfo, szOID_SUBJECT_ALT_NAME2);
1301
+ #else
1302
+ return convertGeneralNames(reinterpret_cast<GENERAL_NAMES*>(X509_get_ext_d2i(_cert, NID_subject_alt_name, 0, 0)));
1303
+ #endif
1304
+ }
1305
+
1306
+ int
1307
+ Certificate::getVersion() const
1308
+ {
1309
+ #if defined(ICE_USE_SECURE_TRANSPORT)
1310
+ return atoi(getX509String(_cert, kSecOIDX509V1Version).c_str()) - 1;
1311
+ #elif defined(ICE_USE_SCHANNEL)
1312
+ return _certInfo->dwVersion;
1313
+ #else
1314
+ return static_cast<int>(X509_get_version(_cert));
1315
+ #endif
1316
+ }
1317
+
1318
+ string
1319
+ Certificate::toString() const
1320
+ {
1321
+ ostringstream os;
1322
+ os << "serial: " << getSerialNumber() << "\n";
1323
+ os << "issuer: " << string(getIssuerDN()) << "\n";
1324
+ os << "subject: " << string(getSubjectDN()) << "\n";
1325
+ os << "notBefore: " << getNotBefore().toDateTime() << "\n";
1326
+ os << "notAfter: " << getNotAfter().toDateTime();
1327
+ return os.str();
1328
+ }
1329
+
1330
+ X509CertificateRef
1331
+ Certificate::getCert() const
1332
+ {
1333
+ return _cert;
1334
+ }