grpc 1.2.5 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (327) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1434 -399
  3. data/etc/roots.pem +34 -150
  4. data/include/grpc/grpc.h +71 -0
  5. data/include/grpc/impl/codegen/atm.h +5 -0
  6. data/include/grpc/impl/codegen/atm_gcc_atomic.h +6 -0
  7. data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
  8. data/include/grpc/impl/codegen/atm_windows.h +11 -0
  9. data/include/grpc/impl/codegen/grpc_types.h +54 -13
  10. data/include/grpc/impl/codegen/port_platform.h +15 -1
  11. data/include/grpc/support/alloc.h +2 -1
  12. data/include/grpc/support/sync.h +4 -0
  13. data/include/grpc/support/tls.h +1 -1
  14. data/src/core/ext/census/gen/trace_context.pb.h +1 -1
  15. data/src/core/ext/census/grpc_filter.c +14 -10
  16. data/src/core/ext/census/grpc_plugin.c +3 -1
  17. data/src/core/ext/census/trace_label.h +1 -1
  18. data/src/core/ext/census/trace_propagation.h +1 -1
  19. data/src/core/ext/census/trace_status.h +1 -1
  20. data/src/core/ext/census/trace_string.h +1 -1
  21. data/src/core/ext/census/tracing.h +1 -1
  22. data/src/core/ext/{client_channel → filters/client_channel}/channel_connectivity.c +56 -27
  23. data/src/core/ext/{client_channel → filters/client_channel}/client_channel.c +407 -202
  24. data/src/core/ext/{client_channel → filters/client_channel}/client_channel.h +10 -6
  25. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.c +1 -1
  26. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.h +4 -4
  27. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_plugin.c +12 -7
  28. data/src/core/ext/{client_channel → filters/client_channel}/connector.c +1 -1
  29. data/src/core/ext/{client_channel → filters/client_channel}/connector.h +3 -5
  30. data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.c +6 -6
  31. data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.h +3 -3
  32. data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.c +4 -4
  33. data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.h +3 -3
  34. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.c +1 -1
  35. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.h +4 -4
  36. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.c +22 -20
  37. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.h +4 -4
  38. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel.h +5 -4
  39. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel_secure.c +2 -2
  40. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.c +1 -1
  41. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.h +6 -5
  42. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +1 -1
  43. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -0
  44. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/pick_first/pick_first.c +20 -15
  45. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/round_robin/round_robin.c +21 -16
  46. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.c +1 -1
  47. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.h +5 -5
  48. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.c +1 -1
  49. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.h +4 -4
  50. data/src/core/ext/{client_channel → filters/client_channel}/parse_address.c +1 -1
  51. data/src/core/ext/{client_channel → filters/client_channel}/parse_address.h +4 -4
  52. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.c +1 -1
  53. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.h +3 -3
  54. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.c +10 -4
  55. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.h +4 -4
  56. data/src/core/ext/{client_channel → filters/client_channel}/resolver.c +1 -1
  57. data/src/core/ext/{client_channel → filters/client_channel}/resolver.h +4 -4
  58. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
  59. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
  60. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
  61. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
  62. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
  63. data/src/core/ext/{resolver → filters/client_channel/resolver}/dns/native/dns_resolver.c +21 -5
  64. data/src/core/ext/{resolver → filters/client_channel/resolver}/sockaddr/sockaddr_resolver.c +3 -3
  65. data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.c +1 -1
  66. data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.h +6 -6
  67. data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.c +1 -2
  68. data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.h +4 -4
  69. data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
  70. data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
  71. data/src/core/ext/{client_channel → filters/client_channel}/subchannel.c +49 -43
  72. data/src/core/ext/{client_channel → filters/client_channel}/subchannel.h +21 -7
  73. data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.c +1 -1
  74. data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.h +5 -5
  75. data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.c +1 -1
  76. data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.h +3 -3
  77. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.c +4 -2
  78. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.h +3 -3
  79. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.c +17 -14
  80. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.h +4 -4
  81. data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
  82. data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
  83. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +6 -41
  84. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +1 -1
  85. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +2 -2
  86. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +3 -3
  87. data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
  88. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +2 -5
  89. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +2 -2
  90. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +449 -204
  91. data/src/core/ext/transport/chttp2/transport/frame_data.c +10 -7
  92. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +3 -2
  93. data/src/core/ext/transport/chttp2/transport/frame_ping.c +37 -7
  94. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
  95. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +4 -3
  96. data/src/core/ext/transport/chttp2/transport/frame_settings.c +18 -38
  97. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -29
  98. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +2 -2
  99. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +64 -37
  100. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +11 -4
  101. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +60 -39
  102. data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
  103. data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
  104. data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
  105. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +22 -43
  106. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +8 -10
  107. data/src/core/ext/transport/chttp2/transport/internal.h +24 -2
  108. data/src/core/ext/transport/chttp2/transport/parsing.c +33 -15
  109. data/src/core/ext/transport/chttp2/transport/writing.c +56 -10
  110. data/src/core/lib/channel/channel_args.c +7 -0
  111. data/src/core/lib/channel/channel_args.h +2 -0
  112. data/src/core/lib/channel/channel_stack.c +20 -27
  113. data/src/core/lib/channel/channel_stack.h +18 -16
  114. data/src/core/lib/channel/compress_filter.c +20 -18
  115. data/src/core/lib/channel/connected_channel.c +9 -8
  116. data/src/core/lib/channel/deadline_filter.c +28 -24
  117. data/src/core/lib/channel/deadline_filter.h +3 -3
  118. data/src/core/lib/channel/handshaker.c +3 -2
  119. data/src/core/lib/channel/http_client_filter.c +119 -61
  120. data/src/core/lib/channel/http_server_filter.c +124 -69
  121. data/src/core/lib/channel/message_size_filter.c +23 -19
  122. data/src/core/lib/http/httpcli.c +8 -6
  123. data/src/core/lib/http/httpcli_security_connector.c +5 -5
  124. data/src/core/lib/http/parser.c +57 -31
  125. data/src/core/lib/iomgr/closure.c +15 -0
  126. data/src/core/lib/iomgr/closure.h +4 -0
  127. data/src/core/lib/iomgr/combiner.c +8 -0
  128. data/src/core/lib/iomgr/endpoint_pair.h +2 -3
  129. data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -7
  130. data/src/core/lib/iomgr/endpoint_pair_uv.c +2 -3
  131. data/src/core/lib/iomgr/endpoint_pair_windows.c +9 -6
  132. data/src/core/lib/iomgr/error.c +360 -177
  133. data/src/core/lib/iomgr/error.h +31 -33
  134. data/src/core/lib/iomgr/error_internal.h +30 -9
  135. data/src/core/lib/iomgr/ev_epoll_linux.c +25 -239
  136. data/src/core/lib/iomgr/ev_poll_posix.c +11 -7
  137. data/src/core/lib/iomgr/ev_posix.c +6 -0
  138. data/src/core/lib/iomgr/ev_posix.h +3 -0
  139. data/src/core/lib/iomgr/exec_ctx.c +6 -0
  140. data/src/core/lib/iomgr/executor.c +8 -2
  141. data/src/core/lib/iomgr/load_file.c +6 -3
  142. data/src/core/lib/iomgr/lockfree_event.c +238 -0
  143. data/src/core/{ext/client_channel/initial_connect_string.h → lib/iomgr/lockfree_event.h} +17 -13
  144. data/src/core/lib/iomgr/pollset.h +4 -0
  145. data/src/core/lib/iomgr/pollset_windows.c +2 -2
  146. data/src/core/lib/iomgr/port.h +9 -0
  147. data/src/core/lib/iomgr/resolve_address_posix.c +15 -9
  148. data/src/core/lib/iomgr/resolve_address_uv.c +8 -6
  149. data/src/core/lib/iomgr/resolve_address_windows.c +2 -2
  150. data/src/core/lib/iomgr/resource_quota.c +19 -4
  151. data/src/core/lib/iomgr/resource_quota.h +2 -0
  152. data/src/core/lib/iomgr/sockaddr_utils.c +3 -1
  153. data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
  154. data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
  155. data/src/core/lib/iomgr/socket_utils_common_posix.c +25 -9
  156. data/src/core/lib/iomgr/socket_utils_posix.h +7 -0
  157. data/src/core/lib/iomgr/tcp_client.h +0 -4
  158. data/src/core/lib/iomgr/tcp_client_posix.c +15 -31
  159. data/src/core/lib/iomgr/tcp_client_uv.c +10 -6
  160. data/src/core/lib/iomgr/tcp_client_windows.c +9 -19
  161. data/src/core/lib/iomgr/tcp_posix.c +111 -22
  162. data/src/core/lib/iomgr/tcp_posix.h +3 -4
  163. data/src/core/lib/iomgr/tcp_server_posix.c +39 -417
  164. data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
  165. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
  166. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
  167. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
  168. data/src/core/lib/iomgr/tcp_server_uv.c +43 -16
  169. data/src/core/lib/iomgr/tcp_server_windows.c +10 -22
  170. data/src/core/lib/iomgr/tcp_uv.c +16 -13
  171. data/src/core/lib/iomgr/tcp_windows.c +24 -12
  172. data/src/core/lib/iomgr/tcp_windows.h +2 -2
  173. data/src/core/lib/iomgr/timer.h +3 -0
  174. data/src/core/lib/iomgr/timer_generic.c +257 -72
  175. data/src/core/lib/iomgr/timer_generic.h +1 -1
  176. data/src/core/lib/iomgr/timer_heap.c +8 -8
  177. data/src/core/lib/iomgr/udp_server.c +54 -24
  178. data/src/core/lib/iomgr/udp_server.h +7 -7
  179. data/src/core/lib/iomgr/unix_sockets_posix.c +1 -1
  180. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +2 -1
  181. data/src/core/lib/iomgr/wakeup_fd_posix.h +1 -1
  182. data/src/core/lib/profiling/basic_timers.c +1 -1
  183. data/src/core/lib/security/credentials/credentials.h +1 -1
  184. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +10 -9
  185. data/src/core/lib/security/credentials/jwt/json_token.c +1 -1
  186. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +2 -2
  187. data/src/core/lib/security/transport/client_auth_filter.c +33 -26
  188. data/src/core/lib/security/transport/secure_endpoint.c +8 -5
  189. data/src/core/lib/security/transport/security_connector.c +37 -37
  190. data/src/core/lib/security/transport/security_connector.h +1 -1
  191. data/src/core/lib/security/transport/security_handshaker.c +15 -12
  192. data/src/core/lib/security/transport/server_auth_filter.c +20 -18
  193. data/src/core/lib/security/transport/tsi_error.c +5 -3
  194. data/src/core/lib/security/transport/tsi_error.h +1 -1
  195. data/src/core/lib/{security/util → slice}/b64.c +21 -6
  196. data/src/core/lib/{security/util → slice}/b64.h +16 -4
  197. data/src/core/lib/slice/slice.c +4 -2
  198. data/src/core/lib/slice/slice_buffer.c +16 -14
  199. data/src/core/lib/support/arena.c +98 -0
  200. data/src/core/{ext/client_channel/initial_connect_string.c → lib/support/arena.h} +17 -15
  201. data/src/core/{ext/client_channel/default_initial_connect_string.c → lib/support/atm.c} +14 -5
  202. data/src/core/lib/support/cpu_linux.c +5 -0
  203. data/src/core/lib/support/sync.c +4 -0
  204. data/src/core/lib/support/time.c +4 -10
  205. data/src/core/lib/support/wrap_memcpy.c +3 -1
  206. data/src/core/lib/surface/call.c +252 -221
  207. data/src/core/lib/surface/channel.c +72 -21
  208. data/src/core/lib/surface/channel.h +8 -0
  209. data/src/core/lib/surface/completion_queue.c +2 -3
  210. data/src/core/lib/surface/completion_queue_factory.c +77 -0
  211. data/src/core/lib/surface/completion_queue_factory.h +51 -0
  212. data/src/core/lib/surface/init_secure.c +3 -1
  213. data/src/core/lib/surface/lame_client.c +18 -14
  214. data/src/core/lib/surface/server.c +43 -41
  215. data/src/core/lib/surface/validate_metadata.c +8 -4
  216. data/src/core/lib/surface/version.c +2 -2
  217. data/src/core/lib/transport/bdp_estimator.h +1 -1
  218. data/src/core/lib/transport/connectivity_state.c +2 -1
  219. data/src/core/lib/transport/error_utils.c +17 -17
  220. data/src/core/lib/transport/error_utils.h +1 -1
  221. data/src/core/lib/transport/metadata_batch.c +6 -7
  222. data/src/core/lib/transport/pid_controller.c +1 -0
  223. data/src/core/lib/transport/service_config.c +12 -0
  224. data/src/core/lib/transport/service_config.h +6 -0
  225. data/src/core/lib/transport/transport.c +29 -17
  226. data/src/core/lib/transport/transport.h +85 -42
  227. data/src/core/lib/transport/transport_impl.h +5 -3
  228. data/src/core/lib/transport/transport_op_string.c +20 -14
  229. data/src/core/plugin_registry/grpc_plugin_registry.c +8 -0
  230. data/src/core/{lib/tsi → tsi}/fake_transport_security.c +2 -2
  231. data/src/core/{lib/tsi → tsi}/fake_transport_security.h +4 -4
  232. data/src/core/{lib/tsi → tsi}/ssl_transport_security.c +40 -79
  233. data/src/core/{lib/tsi → tsi}/ssl_transport_security.h +44 -21
  234. data/src/core/{lib/tsi → tsi}/ssl_types.h +3 -3
  235. data/src/core/{lib/tsi → tsi}/transport_security.c +2 -2
  236. data/src/core/{lib/tsi → tsi}/transport_security.h +4 -4
  237. data/src/core/{lib/tsi → tsi}/transport_security_interface.h +3 -3
  238. data/src/ruby/ext/grpc/extconf.rb +1 -0
  239. data/src/ruby/ext/grpc/rb_call_credentials.c +2 -2
  240. data/src/ruby/ext/grpc/rb_channel.c +520 -93
  241. data/src/ruby/ext/grpc/rb_channel.h +2 -0
  242. data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -0
  243. data/src/ruby/ext/grpc/rb_compression_options.c +5 -2
  244. data/src/ruby/ext/grpc/rb_event_thread.c +6 -6
  245. data/src/ruby/ext/grpc/rb_grpc.c +29 -7
  246. data/src/ruby/ext/grpc/rb_grpc.h +2 -0
  247. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
  249. data/src/ruby/ext/grpc/rb_server.c +5 -3
  250. data/src/ruby/lib/grpc/version.rb +1 -1
  251. data/src/ruby/spec/channel_connection_spec.rb +173 -0
  252. data/src/ruby/spec/channel_spec.rb +29 -0
  253. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +27 -17
  254. data/third_party/cares/ares_build.h +264 -0
  255. data/third_party/cares/cares/ares.h +636 -0
  256. data/third_party/cares/cares/ares__close_sockets.c +61 -0
  257. data/third_party/cares/cares/ares__get_hostent.c +261 -0
  258. data/third_party/cares/cares/ares__read_line.c +73 -0
  259. data/third_party/cares/cares/ares__timeval.c +111 -0
  260. data/third_party/cares/cares/ares_cancel.c +63 -0
  261. data/third_party/cares/cares/ares_create_query.c +202 -0
  262. data/third_party/cares/cares/ares_data.c +221 -0
  263. data/third_party/cares/cares/ares_data.h +72 -0
  264. data/third_party/cares/cares/ares_destroy.c +108 -0
  265. data/third_party/cares/cares/ares_dns.h +103 -0
  266. data/third_party/cares/cares/ares_expand_name.c +205 -0
  267. data/third_party/cares/cares/ares_expand_string.c +70 -0
  268. data/third_party/cares/cares/ares_fds.c +59 -0
  269. data/third_party/cares/cares/ares_free_hostent.c +41 -0
  270. data/third_party/cares/cares/ares_free_string.c +25 -0
  271. data/third_party/cares/cares/ares_getenv.c +30 -0
  272. data/third_party/cares/cares/ares_getenv.h +26 -0
  273. data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
  274. data/third_party/cares/cares/ares_gethostbyname.c +518 -0
  275. data/third_party/cares/cares/ares_getnameinfo.c +422 -0
  276. data/third_party/cares/cares/ares_getopt.c +122 -0
  277. data/third_party/cares/cares/ares_getopt.h +53 -0
  278. data/third_party/cares/cares/ares_getsock.c +66 -0
  279. data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
  280. data/third_party/cares/cares/ares_init.c +2146 -0
  281. data/third_party/cares/cares/ares_iphlpapi.h +221 -0
  282. data/third_party/cares/cares/ares_ipv6.h +78 -0
  283. data/third_party/cares/cares/ares_library_init.c +167 -0
  284. data/third_party/cares/cares/ares_library_init.h +42 -0
  285. data/third_party/cares/cares/ares_llist.c +63 -0
  286. data/third_party/cares/cares/ares_llist.h +39 -0
  287. data/third_party/cares/cares/ares_mkquery.c +24 -0
  288. data/third_party/cares/cares/ares_nowarn.c +260 -0
  289. data/third_party/cares/cares/ares_nowarn.h +61 -0
  290. data/third_party/cares/cares/ares_options.c +402 -0
  291. data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
  292. data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
  293. data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
  294. data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
  295. data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
  296. data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
  297. data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
  298. data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
  299. data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
  300. data/third_party/cares/cares/ares_platform.c +11035 -0
  301. data/third_party/cares/cares/ares_platform.h +43 -0
  302. data/third_party/cares/cares/ares_private.h +363 -0
  303. data/third_party/cares/cares/ares_process.c +1359 -0
  304. data/third_party/cares/cares/ares_query.c +186 -0
  305. data/third_party/cares/cares/ares_rules.h +125 -0
  306. data/third_party/cares/cares/ares_search.c +316 -0
  307. data/third_party/cares/cares/ares_send.c +131 -0
  308. data/third_party/cares/cares/ares_setup.h +217 -0
  309. data/third_party/cares/cares/ares_strcasecmp.c +66 -0
  310. data/third_party/cares/cares/ares_strcasecmp.h +30 -0
  311. data/third_party/cares/cares/ares_strdup.c +49 -0
  312. data/third_party/cares/cares/ares_strdup.h +24 -0
  313. data/third_party/cares/cares/ares_strerror.c +56 -0
  314. data/third_party/cares/cares/ares_timeout.c +88 -0
  315. data/third_party/cares/cares/ares_version.c +11 -0
  316. data/third_party/cares/cares/ares_version.h +24 -0
  317. data/third_party/cares/cares/ares_writev.c +79 -0
  318. data/third_party/cares/cares/bitncmp.c +59 -0
  319. data/third_party/cares/cares/bitncmp.h +26 -0
  320. data/third_party/cares/cares/config-win32.h +377 -0
  321. data/third_party/cares/cares/inet_net_pton.c +450 -0
  322. data/third_party/cares/cares/inet_ntop.c +208 -0
  323. data/third_party/cares/cares/setup_once.h +554 -0
  324. data/third_party/cares/cares/windows_port.c +22 -0
  325. data/third_party/cares/config_darwin/ares_config.h +523 -0
  326. data/third_party/cares/config_linux/ares_config.h +524 -0
  327. metadata +164 -68
@@ -0,0 +1,221 @@
1
+ #ifndef HEADER_CARES_IPHLPAPI_H
2
+ #define HEADER_CARES_IPHLPAPI_H
3
+
4
+ /* Copyright 1998 by the Massachusetts Institute of Technology.
5
+ * Copyright (C) 2004 - 2011 by Daniel Stenberg et al
6
+ *
7
+ * Permission to use, copy, modify, and distribute this
8
+ * software and its documentation for any purpose and without
9
+ * fee is hereby granted, provided that the above copyright
10
+ * notice appear in all copies and that both that copyright
11
+ * notice and this permission notice appear in supporting
12
+ * documentation, and that the name of M.I.T. not be used in
13
+ * advertising or publicity pertaining to distribution of the
14
+ * software without specific, written prior permission.
15
+ * M.I.T. makes no representations about the suitability of
16
+ * this software for any purpose. It is provided "as is"
17
+ * without express or implied warranty.
18
+ */
19
+
20
+ #if defined(USE_WINSOCK)
21
+
22
+ #ifndef INET_ADDRSTRLEN
23
+ #define INET_ADDRSTRLEN 22
24
+ #endif
25
+
26
+ #ifndef INET6_ADDRSTRLEN
27
+ #define INET6_ADDRSTRLEN 65
28
+ #endif
29
+
30
+ /* ---------------------------------- */
31
+ #if !defined(_WS2DEF_) && \
32
+ !defined(__CSADDR_DEFINED__) && \
33
+ !defined(__CSADDR_T_DEFINED)
34
+ /* ---------------------------------- */
35
+
36
+ typedef struct _SOCKET_ADDRESS {
37
+ LPSOCKADDR lpSockaddr;
38
+ INT iSockaddrLength;
39
+ } SOCKET_ADDRESS, *PSOCKET_ADDRESS;
40
+
41
+ typedef struct _CSADDR_INFO {
42
+ SOCKET_ADDRESS LocalAddr;
43
+ SOCKET_ADDRESS RemoteAddr;
44
+ INT iSocketType;
45
+ INT iProtocol;
46
+ } CSADDR_INFO, *PCSADDR_INFO;
47
+
48
+ /* --------------------------------- */
49
+ #endif /* ! _WS2DEF_ && \ */
50
+ /* ! __CSADDR_DEFINED__ && \ */
51
+ /* ! __CSADDR_T_DEFINED */
52
+ /* --------------------------------- */
53
+
54
+ /* ------------------------------- */
55
+ #if !defined(IP_ADAPTER_DDNS_ENABLED)
56
+ /* ------------------------------- */
57
+
58
+ #define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x0001
59
+ #define IP_ADAPTER_ADDRESS_TRANSIENT 0x0002
60
+
61
+ #define IP_ADAPTER_DDNS_ENABLED 0x0001
62
+ #define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x0002
63
+ #define IP_ADAPTER_DHCP_ENABLED 0x0004
64
+ #define IP_ADAPTER_RECEIVE_ONLY 0x0008
65
+ #define IP_ADAPTER_NO_MULTICAST 0x0010
66
+ #define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x0020
67
+
68
+ #define GAA_FLAG_SKIP_UNICAST 0x0001
69
+ #define GAA_FLAG_SKIP_ANYCAST 0x0002
70
+ #define GAA_FLAG_SKIP_MULTICAST 0x0004
71
+ #define GAA_FLAG_SKIP_DNS_SERVER 0x0008
72
+ #define GAA_FLAG_INCLUDE_PREFIX 0x0010
73
+ #define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020
74
+
75
+ typedef enum {
76
+ IpPrefixOriginOther = 0,
77
+ IpPrefixOriginManual,
78
+ IpPrefixOriginWellKnown,
79
+ IpPrefixOriginDhcp,
80
+ IpPrefixOriginRouterAdvertisement
81
+ } IP_PREFIX_ORIGIN;
82
+
83
+ typedef enum {
84
+ IpSuffixOriginOther = 0,
85
+ IpSuffixOriginManual,
86
+ IpSuffixOriginWellKnown,
87
+ IpSuffixOriginDhcp,
88
+ IpSuffixOriginLinkLayerAddress,
89
+ IpSuffixOriginRandom
90
+ } IP_SUFFIX_ORIGIN;
91
+
92
+ typedef enum {
93
+ IpDadStateInvalid = 0,
94
+ IpDadStateTentative,
95
+ IpDadStateDuplicate,
96
+ IpDadStateDeprecated,
97
+ IpDadStatePreferred
98
+ } IP_DAD_STATE;
99
+
100
+ typedef enum {
101
+ IfOperStatusUp = 1,
102
+ IfOperStatusDown,
103
+ IfOperStatusTesting,
104
+ IfOperStatusUnknown,
105
+ IfOperStatusDormant,
106
+ IfOperStatusNotPresent,
107
+ IfOperStatusLowerLayerDown
108
+ } IF_OPER_STATUS;
109
+
110
+ typedef enum {
111
+ ScopeLevelInterface = 0x0001,
112
+ ScopeLevelLink = 0x0002,
113
+ ScopeLevelSubnet = 0x0003,
114
+ ScopeLevelAdmin = 0x0004,
115
+ ScopeLevelSite = 0x0005,
116
+ ScopeLevelOrganization = 0x0008,
117
+ ScopeLevelGlobal = 0x000E
118
+ } SCOPE_LEVEL;
119
+
120
+ typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
121
+ union {
122
+ ULONGLONG Alignment;
123
+ struct {
124
+ ULONG Length;
125
+ DWORD Flags;
126
+ } s;
127
+ } u;
128
+ struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
129
+ SOCKET_ADDRESS Address;
130
+ IP_PREFIX_ORIGIN PrefixOrigin;
131
+ IP_SUFFIX_ORIGIN SuffixOrigin;
132
+ IP_DAD_STATE DadState;
133
+ ULONG ValidLifetime;
134
+ ULONG PreferredLifetime;
135
+ ULONG LeaseLifetime;
136
+ } IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
137
+
138
+ typedef struct _IP_ADAPTER_ANYCAST_ADDRESS {
139
+ union {
140
+ ULONGLONG Alignment;
141
+ struct {
142
+ ULONG Length;
143
+ DWORD Flags;
144
+ } s;
145
+ } u;
146
+ struct _IP_ADAPTER_ANYCAST_ADDRESS *Next;
147
+ SOCKET_ADDRESS Address;
148
+ } IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS;
149
+
150
+ typedef struct _IP_ADAPTER_MULTICAST_ADDRESS {
151
+ union {
152
+ ULONGLONG Alignment;
153
+ struct {
154
+ ULONG Length;
155
+ DWORD Flags;
156
+ } s;
157
+ } u;
158
+ struct _IP_ADAPTER_MULTICAST_ADDRESS *Next;
159
+ SOCKET_ADDRESS Address;
160
+ } IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS;
161
+
162
+ typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS {
163
+ union {
164
+ ULONGLONG Alignment;
165
+ struct {
166
+ ULONG Length;
167
+ DWORD Reserved;
168
+ } s;
169
+ } u;
170
+ struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next;
171
+ SOCKET_ADDRESS Address;
172
+ } IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS;
173
+
174
+ typedef struct _IP_ADAPTER_PREFIX {
175
+ union {
176
+ ULONGLONG Alignment;
177
+ struct {
178
+ ULONG Length;
179
+ DWORD Flags;
180
+ } s;
181
+ } u;
182
+ struct _IP_ADAPTER_PREFIX *Next;
183
+ SOCKET_ADDRESS Address;
184
+ ULONG PrefixLength;
185
+ } IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX;
186
+
187
+ typedef struct _IP_ADAPTER_ADDRESSES {
188
+ union {
189
+ ULONGLONG Alignment;
190
+ struct {
191
+ ULONG Length;
192
+ DWORD IfIndex;
193
+ } s;
194
+ } u;
195
+ struct _IP_ADAPTER_ADDRESSES *Next;
196
+ PCHAR AdapterName;
197
+ PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress;
198
+ PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress;
199
+ PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress;
200
+ PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress;
201
+ PWCHAR DnsSuffix;
202
+ PWCHAR Description;
203
+ PWCHAR FriendlyName;
204
+ BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
205
+ DWORD PhysicalAddressLength;
206
+ DWORD Flags;
207
+ DWORD Mtu;
208
+ DWORD IfType;
209
+ IF_OPER_STATUS OperStatus;
210
+ DWORD Ipv6IfIndex;
211
+ DWORD ZoneIndices[16];
212
+ PIP_ADAPTER_PREFIX FirstPrefix;
213
+ } IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
214
+
215
+ /* -------------------------------- */
216
+ #endif /* ! IP_ADAPTER_DDNS_ENABLED */
217
+ /* -------------------------------- */
218
+
219
+ #endif /* USE_WINSOCK */
220
+
221
+ #endif /* HEADER_CARES_IPHLPAPI_H */
@@ -0,0 +1,78 @@
1
+
2
+ /* Copyright (C) 2005 by Dominick Meglio
3
+ *
4
+ * Permission to use, copy, modify, and distribute this
5
+ * software and its documentation for any purpose and without
6
+ * fee is hereby granted, provided that the above copyright
7
+ * notice appear in all copies and that both that copyright
8
+ * notice and this permission notice appear in supporting
9
+ * documentation, and that the name of M.I.T. not be used in
10
+ * advertising or publicity pertaining to distribution of the
11
+ * software without specific, written prior permission.
12
+ * M.I.T. makes no representations about the suitability of
13
+ * this software for any purpose. It is provided "as is"
14
+ * without express or implied warranty.
15
+ */
16
+
17
+ #ifndef ARES_IPV6_H
18
+ #define ARES_IPV6_H
19
+
20
+ #ifndef HAVE_PF_INET6
21
+ #define PF_INET6 AF_INET6
22
+ #endif
23
+
24
+ #ifndef HAVE_STRUCT_SOCKADDR_IN6
25
+ struct sockaddr_in6
26
+ {
27
+ unsigned short sin6_family;
28
+ unsigned short sin6_port;
29
+ unsigned long sin6_flowinfo;
30
+ struct ares_in6_addr sin6_addr;
31
+ unsigned int sin6_scope_id;
32
+ };
33
+ #endif
34
+
35
+ #ifndef HAVE_STRUCT_ADDRINFO
36
+ struct addrinfo
37
+ {
38
+ int ai_flags;
39
+ int ai_family;
40
+ int ai_socktype;
41
+ int ai_protocol;
42
+ ares_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */
43
+ char *ai_canonname;
44
+ struct sockaddr *ai_addr;
45
+ struct addrinfo *ai_next;
46
+ };
47
+ #endif
48
+
49
+ #ifndef NS_IN6ADDRSZ
50
+ #ifndef HAVE_STRUCT_IN6_ADDR
51
+ /* We cannot have it set to zero, so we pick a fixed value here */
52
+ #define NS_IN6ADDRSZ 16
53
+ #else
54
+ #define NS_IN6ADDRSZ sizeof(struct in6_addr)
55
+ #endif
56
+ #endif
57
+
58
+ #ifndef NS_INADDRSZ
59
+ #define NS_INADDRSZ sizeof(struct in_addr)
60
+ #endif
61
+
62
+ #ifndef NS_INT16SZ
63
+ #define NS_INT16SZ 2
64
+ #endif
65
+
66
+ #ifndef IF_NAMESIZE
67
+ #ifdef IFNAMSIZ
68
+ #define IF_NAMESIZE IFNAMSIZ
69
+ #else
70
+ #define IF_NAMESIZE 256
71
+ #endif
72
+ #endif
73
+
74
+ /* Defined in inet_net_pton.c for no particular reason. */
75
+ extern const struct ares_in6_addr ares_in6addr_any; /* :: */
76
+
77
+
78
+ #endif /* ARES_IPV6_H */
@@ -0,0 +1,167 @@
1
+
2
+ /* Copyright 1998 by the Massachusetts Institute of Technology.
3
+ * Copyright (C) 2004-2009 by Daniel Stenberg
4
+ *
5
+ * Permission to use, copy, modify, and distribute this
6
+ * software and its documentation for any purpose and without
7
+ * fee is hereby granted, provided that the above copyright
8
+ * notice appear in all copies and that both that copyright
9
+ * notice and this permission notice appear in supporting
10
+ * documentation, and that the name of M.I.T. not be used in
11
+ * advertising or publicity pertaining to distribution of the
12
+ * software without specific, written prior permission.
13
+ * M.I.T. makes no representations about the suitability of
14
+ * this software for any purpose. It is provided "as is"
15
+ * without express or implied warranty.
16
+ */
17
+
18
+ #include "ares_setup.h"
19
+
20
+ #include "ares.h"
21
+ #include "ares_library_init.h"
22
+ #include "ares_private.h"
23
+
24
+ /* library-private global and unique instance vars */
25
+
26
+ #ifdef USE_WINSOCK
27
+ fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL;
28
+ fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL;
29
+ fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses = ZERO_NULL;
30
+ #endif
31
+
32
+ /* library-private global vars with source visibility restricted to this file */
33
+
34
+ static unsigned int ares_initialized;
35
+ static int ares_init_flags;
36
+
37
+ /* library-private global vars with visibility across the whole library */
38
+ void *(*ares_malloc)(size_t size) = malloc;
39
+ void *(*ares_realloc)(void *ptr, size_t size) = realloc;
40
+ void (*ares_free)(void *ptr) = free;
41
+
42
+ #ifdef USE_WINSOCK
43
+ static HMODULE hnd_iphlpapi;
44
+ static HMODULE hnd_advapi32;
45
+ #endif
46
+
47
+
48
+ static int ares_win32_init(void)
49
+ {
50
+ #ifdef USE_WINSOCK
51
+
52
+ hnd_iphlpapi = 0;
53
+ hnd_iphlpapi = LoadLibraryW(L"iphlpapi.dll");
54
+ if (!hnd_iphlpapi)
55
+ return ARES_ELOADIPHLPAPI;
56
+
57
+ ares_fpGetNetworkParams = (fpGetNetworkParams_t)
58
+ GetProcAddress(hnd_iphlpapi, "GetNetworkParams");
59
+ if (!ares_fpGetNetworkParams)
60
+ {
61
+ FreeLibrary(hnd_iphlpapi);
62
+ return ARES_EADDRGETNETWORKPARAMS;
63
+ }
64
+
65
+ ares_fpGetAdaptersAddresses = (fpGetAdaptersAddresses_t)
66
+ GetProcAddress(hnd_iphlpapi, "GetAdaptersAddresses");
67
+ if (!ares_fpGetAdaptersAddresses)
68
+ {
69
+ /* This can happen on clients before WinXP, I don't
70
+ think it should be an error, unless we don't want to
71
+ support Windows 2000 anymore */
72
+ }
73
+
74
+ /*
75
+ * When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036,
76
+ * also known as RtlGenRandom, which is the case for Windows versions prior
77
+ * to WinXP then c-ares uses portable rand() function. Then don't error here.
78
+ */
79
+
80
+ hnd_advapi32 = 0;
81
+ hnd_advapi32 = LoadLibraryW(L"advapi32.dll");
82
+ if (hnd_advapi32)
83
+ {
84
+ ares_fpSystemFunction036 = (fpSystemFunction036_t)
85
+ GetProcAddress(hnd_advapi32, "SystemFunction036");
86
+ }
87
+
88
+ #endif
89
+ return ARES_SUCCESS;
90
+ }
91
+
92
+
93
+ static void ares_win32_cleanup(void)
94
+ {
95
+ #ifdef USE_WINSOCK
96
+ if (hnd_advapi32)
97
+ FreeLibrary(hnd_advapi32);
98
+ if (hnd_iphlpapi)
99
+ FreeLibrary(hnd_iphlpapi);
100
+ #endif
101
+ }
102
+
103
+
104
+ int ares_library_init(int flags)
105
+ {
106
+ int res;
107
+
108
+ if (ares_initialized)
109
+ {
110
+ ares_initialized++;
111
+ return ARES_SUCCESS;
112
+ }
113
+ ares_initialized++;
114
+
115
+ if (flags & ARES_LIB_INIT_WIN32)
116
+ {
117
+ res = ares_win32_init();
118
+ if (res != ARES_SUCCESS)
119
+ return res; /* LCOV_EXCL_LINE: can't test Win32 init failure */
120
+ }
121
+
122
+ ares_init_flags = flags;
123
+
124
+ return ARES_SUCCESS;
125
+ }
126
+
127
+ int ares_library_init_mem(int flags,
128
+ void *(*amalloc)(size_t size),
129
+ void (*afree)(void *ptr),
130
+ void *(*arealloc)(void *ptr, size_t size))
131
+ {
132
+ if (amalloc)
133
+ ares_malloc = amalloc;
134
+ if (arealloc)
135
+ ares_realloc = arealloc;
136
+ if (afree)
137
+ ares_free = afree;
138
+ return ares_library_init(flags);
139
+ }
140
+
141
+
142
+ void ares_library_cleanup(void)
143
+ {
144
+ if (!ares_initialized)
145
+ return;
146
+ ares_initialized--;
147
+ if (ares_initialized)
148
+ return;
149
+
150
+ if (ares_init_flags & ARES_LIB_INIT_WIN32)
151
+ ares_win32_cleanup();
152
+
153
+ ares_init_flags = ARES_LIB_INIT_NONE;
154
+ ares_malloc = malloc;
155
+ ares_realloc = realloc;
156
+ ares_free = free;
157
+ }
158
+
159
+
160
+ int ares_library_initialized(void)
161
+ {
162
+ #ifdef USE_WINSOCK
163
+ if (!ares_initialized)
164
+ return ARES_ENOTINITIALIZED;
165
+ #endif
166
+ return ARES_SUCCESS;
167
+ }