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,554 @@
1
+ #ifndef __SETUP_ONCE_H
2
+ #define __SETUP_ONCE_H
3
+
4
+
5
+ /* Copyright (C) 2004 - 2013 by Daniel Stenberg et al
6
+ *
7
+ * Permission to use, copy, modify, and distribute this software and its
8
+ * documentation for any purpose and without fee is hereby granted, provided
9
+ * that the above copyright notice appear in all copies and that both that
10
+ * copyright notice and this permission notice appear in supporting
11
+ * documentation, and that the name of M.I.T. not be used in advertising or
12
+ * publicity pertaining to distribution of the software without specific,
13
+ * written prior permission. M.I.T. makes no representations about the
14
+ * suitability of this software for any purpose. It is provided "as is"
15
+ * without express or implied warranty.
16
+ */
17
+
18
+
19
+ /********************************************************************
20
+ * NOTICE *
21
+ * ======== *
22
+ * *
23
+ * Content of header files lib/setup_once.h and ares/setup_once.h *
24
+ * must be kept in sync. Modify the other one if you change this. *
25
+ * *
26
+ ********************************************************************/
27
+
28
+
29
+ /*
30
+ * Inclusion of common header files.
31
+ */
32
+
33
+ #include <stdio.h>
34
+ #include <stdlib.h>
35
+ #include <string.h>
36
+ #include <stdarg.h>
37
+ #include <ctype.h>
38
+
39
+ #ifdef HAVE_ERRNO_H
40
+ #include <errno.h>
41
+ #endif
42
+
43
+ #ifdef HAVE_SYS_TYPES_H
44
+ #include <sys/types.h>
45
+ #endif
46
+
47
+ #ifdef NEED_MALLOC_H
48
+ #include <malloc.h>
49
+ #endif
50
+
51
+ #ifdef NEED_MEMORY_H
52
+ #include <memory.h>
53
+ #endif
54
+
55
+ #ifdef HAVE_SYS_STAT_H
56
+ #include <sys/stat.h>
57
+ #endif
58
+
59
+ #ifdef HAVE_SYS_TIME_H
60
+ #include <sys/time.h>
61
+ #ifdef TIME_WITH_SYS_TIME
62
+ #include <time.h>
63
+ #endif
64
+ #else
65
+ #ifdef HAVE_TIME_H
66
+ #include <time.h>
67
+ #endif
68
+ #endif
69
+
70
+ #ifdef WIN32
71
+ #include <io.h>
72
+ #include <fcntl.h>
73
+ #endif
74
+
75
+ #if defined(HAVE_STDBOOL_H) && defined(HAVE_BOOL_T)
76
+ #include <stdbool.h>
77
+ #endif
78
+
79
+ #ifdef HAVE_UNISTD_H
80
+ #include <unistd.h>
81
+ #endif
82
+
83
+ #ifdef __hpux
84
+ # if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
85
+ # ifdef _APP32_64BIT_OFF_T
86
+ # define OLD_APP32_64BIT_OFF_T _APP32_64BIT_OFF_T
87
+ # undef _APP32_64BIT_OFF_T
88
+ # else
89
+ # undef OLD_APP32_64BIT_OFF_T
90
+ # endif
91
+ # endif
92
+ #endif
93
+
94
+ #ifdef HAVE_SYS_SOCKET_H
95
+ #include <sys/socket.h>
96
+ #endif
97
+
98
+ #ifdef __hpux
99
+ # if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
100
+ # ifdef OLD_APP32_64BIT_OFF_T
101
+ # define _APP32_64BIT_OFF_T OLD_APP32_64BIT_OFF_T
102
+ # undef OLD_APP32_64BIT_OFF_T
103
+ # endif
104
+ # endif
105
+ #endif
106
+
107
+
108
+ /*
109
+ * Definition of timeval struct for platforms that don't have it.
110
+ */
111
+
112
+ #ifndef HAVE_STRUCT_TIMEVAL
113
+ struct timeval {
114
+ long tv_sec;
115
+ long tv_usec;
116
+ };
117
+ #endif
118
+
119
+
120
+ /*
121
+ * If we have the MSG_NOSIGNAL define, make sure we use
122
+ * it as the fourth argument of function send()
123
+ */
124
+
125
+ #ifdef HAVE_MSG_NOSIGNAL
126
+ #define SEND_4TH_ARG MSG_NOSIGNAL
127
+ #else
128
+ #define SEND_4TH_ARG 0
129
+ #endif
130
+
131
+
132
+ #if defined(__minix)
133
+ /* Minix doesn't support recv on TCP sockets */
134
+ #define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \
135
+ (RECV_TYPE_ARG2)(y), \
136
+ (RECV_TYPE_ARG3)(z))
137
+
138
+ #elif defined(HAVE_RECV)
139
+ /*
140
+ * The definitions for the return type and arguments types
141
+ * of functions recv() and send() belong and come from the
142
+ * configuration file. Do not define them in any other place.
143
+ *
144
+ * HAVE_RECV is defined if you have a function named recv()
145
+ * which is used to read incoming data from sockets. If your
146
+ * function has another name then don't define HAVE_RECV.
147
+ *
148
+ * If HAVE_RECV is defined then RECV_TYPE_ARG1, RECV_TYPE_ARG2,
149
+ * RECV_TYPE_ARG3, RECV_TYPE_ARG4 and RECV_TYPE_RETV must also
150
+ * be defined.
151
+ *
152
+ * HAVE_SEND is defined if you have a function named send()
153
+ * which is used to write outgoing data on a connected socket.
154
+ * If yours has another name then don't define HAVE_SEND.
155
+ *
156
+ * If HAVE_SEND is defined then SEND_TYPE_ARG1, SEND_QUAL_ARG2,
157
+ * SEND_TYPE_ARG2, SEND_TYPE_ARG3, SEND_TYPE_ARG4 and
158
+ * SEND_TYPE_RETV must also be defined.
159
+ */
160
+
161
+ #if !defined(RECV_TYPE_ARG1) || \
162
+ !defined(RECV_TYPE_ARG2) || \
163
+ !defined(RECV_TYPE_ARG3) || \
164
+ !defined(RECV_TYPE_ARG4) || \
165
+ !defined(RECV_TYPE_RETV)
166
+ /* */
167
+ Error Missing_definition_of_return_and_arguments_types_of_recv
168
+ /* */
169
+ #else
170
+ #define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \
171
+ (RECV_TYPE_ARG2)(y), \
172
+ (RECV_TYPE_ARG3)(z), \
173
+ (RECV_TYPE_ARG4)(0))
174
+ #endif
175
+ #else /* HAVE_RECV */
176
+ #ifndef sread
177
+ /* */
178
+ Error Missing_definition_of_macro_sread
179
+ /* */
180
+ #endif
181
+ #endif /* HAVE_RECV */
182
+
183
+
184
+ #if defined(__minix)
185
+ /* Minix doesn't support send on TCP sockets */
186
+ #define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \
187
+ (SEND_TYPE_ARG2)(y), \
188
+ (SEND_TYPE_ARG3)(z))
189
+
190
+ #elif defined(HAVE_SEND)
191
+ #if !defined(SEND_TYPE_ARG1) || \
192
+ !defined(SEND_QUAL_ARG2) || \
193
+ !defined(SEND_TYPE_ARG2) || \
194
+ !defined(SEND_TYPE_ARG3) || \
195
+ !defined(SEND_TYPE_ARG4) || \
196
+ !defined(SEND_TYPE_RETV)
197
+ /* */
198
+ Error Missing_definition_of_return_and_arguments_types_of_send
199
+ /* */
200
+ #else
201
+ #define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \
202
+ (SEND_TYPE_ARG2)(y), \
203
+ (SEND_TYPE_ARG3)(z), \
204
+ (SEND_TYPE_ARG4)(SEND_4TH_ARG))
205
+ #endif
206
+ #else /* HAVE_SEND */
207
+ #ifndef swrite
208
+ /* */
209
+ Error Missing_definition_of_macro_swrite
210
+ /* */
211
+ #endif
212
+ #endif /* HAVE_SEND */
213
+
214
+
215
+ #if 0
216
+ #if defined(HAVE_RECVFROM)
217
+ /*
218
+ * Currently recvfrom is only used on udp sockets.
219
+ */
220
+ #if !defined(RECVFROM_TYPE_ARG1) || \
221
+ !defined(RECVFROM_TYPE_ARG2) || \
222
+ !defined(RECVFROM_TYPE_ARG3) || \
223
+ !defined(RECVFROM_TYPE_ARG4) || \
224
+ !defined(RECVFROM_TYPE_ARG5) || \
225
+ !defined(RECVFROM_TYPE_ARG6) || \
226
+ !defined(RECVFROM_TYPE_RETV)
227
+ /* */
228
+ Error Missing_definition_of_return_and_arguments_types_of_recvfrom
229
+ /* */
230
+ #else
231
+ #define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \
232
+ (RECVFROM_TYPE_ARG2 *)(b), \
233
+ (RECVFROM_TYPE_ARG3) (bl), \
234
+ (RECVFROM_TYPE_ARG4) (0), \
235
+ (RECVFROM_TYPE_ARG5 *)(f), \
236
+ (RECVFROM_TYPE_ARG6 *)(fl))
237
+ #endif
238
+ #else /* HAVE_RECVFROM */
239
+ #ifndef sreadfrom
240
+ /* */
241
+ Error Missing_definition_of_macro_sreadfrom
242
+ /* */
243
+ #endif
244
+ #endif /* HAVE_RECVFROM */
245
+
246
+
247
+ #ifdef RECVFROM_TYPE_ARG6_IS_VOID
248
+ # define RECVFROM_ARG6_T int
249
+ #else
250
+ # define RECVFROM_ARG6_T RECVFROM_TYPE_ARG6
251
+ #endif
252
+ #endif /* if 0 */
253
+
254
+
255
+ /*
256
+ * Function-like macro definition used to close a socket.
257
+ */
258
+
259
+ #if defined(HAVE_CLOSESOCKET)
260
+ # define sclose(x) closesocket((x))
261
+ #elif defined(HAVE_CLOSESOCKET_CAMEL)
262
+ # define sclose(x) CloseSocket((x))
263
+ #elif defined(HAVE_CLOSE_S)
264
+ # define sclose(x) close_s((x))
265
+ #else
266
+ # define sclose(x) close((x))
267
+ #endif
268
+
269
+
270
+ /*
271
+ * Uppercase macro versions of ANSI/ISO is*() functions/macros which
272
+ * avoid negative number inputs with argument byte codes > 127.
273
+ */
274
+
275
+ #define ISSPACE(x) (isspace((int) ((unsigned char)x)))
276
+ #define ISDIGIT(x) (isdigit((int) ((unsigned char)x)))
277
+ #define ISALNUM(x) (isalnum((int) ((unsigned char)x)))
278
+ #define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x)))
279
+ #define ISGRAPH(x) (isgraph((int) ((unsigned char)x)))
280
+ #define ISALPHA(x) (isalpha((int) ((unsigned char)x)))
281
+ #define ISPRINT(x) (isprint((int) ((unsigned char)x)))
282
+ #define ISUPPER(x) (isupper((int) ((unsigned char)x)))
283
+ #define ISLOWER(x) (islower((int) ((unsigned char)x)))
284
+ #define ISASCII(x) (isascii((int) ((unsigned char)x)))
285
+
286
+ #define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \
287
+ (((unsigned char)x) == '\t'))
288
+
289
+ #define TOLOWER(x) (tolower((int) ((unsigned char)x)))
290
+
291
+
292
+ /*
293
+ * 'bool' stuff compatible with HP-UX headers.
294
+ */
295
+
296
+ #if defined(__hpux) && !defined(HAVE_BOOL_T)
297
+ typedef int bool;
298
+ # define false 0
299
+ # define true 1
300
+ # define HAVE_BOOL_T
301
+ #endif
302
+
303
+
304
+ /*
305
+ * 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms.
306
+ * On non-C99 platforms there's no bool, so define an enum for that.
307
+ * On C99 platforms 'false' and 'true' also exist. Enum uses a
308
+ * global namespace though, so use bool_false and bool_true.
309
+ */
310
+
311
+ #ifndef HAVE_BOOL_T
312
+ typedef enum {
313
+ bool_false = 0,
314
+ bool_true = 1
315
+ } bool;
316
+
317
+ /*
318
+ * Use a define to let 'true' and 'false' use those enums. There
319
+ * are currently no use of true and false in libcurl proper, but
320
+ * there are some in the examples. This will cater for any later
321
+ * code happening to use true and false.
322
+ */
323
+ # define false bool_false
324
+ # define true bool_true
325
+ # define HAVE_BOOL_T
326
+ #endif
327
+
328
+
329
+ /*
330
+ * Redefine TRUE and FALSE too, to catch current use. With this
331
+ * change, 'bool found = 1' will give a warning on MIPSPro, but
332
+ * 'bool found = TRUE' will not. Change tested on IRIX/MIPSPro,
333
+ * AIX 5.1/Xlc, Tru64 5.1/cc, w/make test too.
334
+ */
335
+
336
+ #ifndef TRUE
337
+ #define TRUE true
338
+ #endif
339
+ #ifndef FALSE
340
+ #define FALSE false
341
+ #endif
342
+
343
+
344
+ /*
345
+ * Macro WHILE_FALSE may be used to build single-iteration do-while loops,
346
+ * avoiding compiler warnings. Mostly intended for other macro definitions.
347
+ */
348
+
349
+ #define WHILE_FALSE while(0)
350
+
351
+ #if defined(_MSC_VER) && !defined(__POCC__)
352
+ # undef WHILE_FALSE
353
+ # if (_MSC_VER < 1500)
354
+ # define WHILE_FALSE while(1, 0)
355
+ # else
356
+ # define WHILE_FALSE \
357
+ __pragma(warning(push)) \
358
+ __pragma(warning(disable:4127)) \
359
+ while(0) \
360
+ __pragma(warning(pop))
361
+ # endif
362
+ #endif
363
+
364
+
365
+ /*
366
+ * Typedef to 'int' if sig_atomic_t is not an available 'typedefed' type.
367
+ */
368
+
369
+ #ifndef HAVE_SIG_ATOMIC_T
370
+ typedef int sig_atomic_t;
371
+ #define HAVE_SIG_ATOMIC_T
372
+ #endif
373
+
374
+
375
+ /*
376
+ * Convenience SIG_ATOMIC_T definition
377
+ */
378
+
379
+ #ifdef HAVE_SIG_ATOMIC_T_VOLATILE
380
+ #define SIG_ATOMIC_T static sig_atomic_t
381
+ #else
382
+ #define SIG_ATOMIC_T static volatile sig_atomic_t
383
+ #endif
384
+
385
+
386
+ /*
387
+ * Default return type for signal handlers.
388
+ */
389
+
390
+ #ifndef RETSIGTYPE
391
+ #define RETSIGTYPE void
392
+ #endif
393
+
394
+
395
+ /*
396
+ * Macro used to include code only in debug builds.
397
+ */
398
+
399
+ #ifdef DEBUGBUILD
400
+ #define DEBUGF(x) x
401
+ #else
402
+ #define DEBUGF(x) do { } WHILE_FALSE
403
+ #endif
404
+
405
+
406
+ /*
407
+ * Macro used to include assertion code only in debug builds.
408
+ */
409
+
410
+ #if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H)
411
+ #define DEBUGASSERT(x) assert(x)
412
+ #else
413
+ #define DEBUGASSERT(x) do { } WHILE_FALSE
414
+ #endif
415
+
416
+
417
+ /*
418
+ * Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno
419
+ * (or equivalent) on this platform to hide platform details to code using it.
420
+ */
421
+
422
+ #ifdef USE_WINSOCK
423
+ #define SOCKERRNO ((int)WSAGetLastError())
424
+ #define SET_SOCKERRNO(x) (WSASetLastError((int)(x)))
425
+ #else
426
+ #define SOCKERRNO (errno)
427
+ #define SET_SOCKERRNO(x) (errno = (x))
428
+ #endif
429
+
430
+
431
+ /*
432
+ * Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno
433
+ * (or equivalent) on this platform to hide platform details to code using it.
434
+ */
435
+
436
+ #if defined(WIN32) && !defined(WATT32)
437
+ #define ERRNO ((int)GetLastError())
438
+ #define SET_ERRNO(x) (SetLastError((DWORD)(x)))
439
+ #else
440
+ #define ERRNO (errno)
441
+ #define SET_ERRNO(x) (errno = (x))
442
+ #endif
443
+
444
+
445
+ /*
446
+ * Portable error number symbolic names defined to Winsock error codes.
447
+ */
448
+
449
+ #ifdef USE_WINSOCK
450
+ #undef EBADF /* override definition in errno.h */
451
+ #define EBADF WSAEBADF
452
+ #undef EINTR /* override definition in errno.h */
453
+ #define EINTR WSAEINTR
454
+ #undef EINVAL /* override definition in errno.h */
455
+ #define EINVAL WSAEINVAL
456
+ #undef EWOULDBLOCK /* override definition in errno.h */
457
+ #define EWOULDBLOCK WSAEWOULDBLOCK
458
+ #undef EINPROGRESS /* override definition in errno.h */
459
+ #define EINPROGRESS WSAEINPROGRESS
460
+ #undef EALREADY /* override definition in errno.h */
461
+ #define EALREADY WSAEALREADY
462
+ #undef ENOTSOCK /* override definition in errno.h */
463
+ #define ENOTSOCK WSAENOTSOCK
464
+ #undef EDESTADDRREQ /* override definition in errno.h */
465
+ #define EDESTADDRREQ WSAEDESTADDRREQ
466
+ #undef EMSGSIZE /* override definition in errno.h */
467
+ #define EMSGSIZE WSAEMSGSIZE
468
+ #undef EPROTOTYPE /* override definition in errno.h */
469
+ #define EPROTOTYPE WSAEPROTOTYPE
470
+ #undef ENOPROTOOPT /* override definition in errno.h */
471
+ #define ENOPROTOOPT WSAENOPROTOOPT
472
+ #undef EPROTONOSUPPORT /* override definition in errno.h */
473
+ #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
474
+ #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
475
+ #undef EOPNOTSUPP /* override definition in errno.h */
476
+ #define EOPNOTSUPP WSAEOPNOTSUPP
477
+ #define EPFNOSUPPORT WSAEPFNOSUPPORT
478
+ #undef EAFNOSUPPORT /* override definition in errno.h */
479
+ #define EAFNOSUPPORT WSAEAFNOSUPPORT
480
+ #undef EADDRINUSE /* override definition in errno.h */
481
+ #define EADDRINUSE WSAEADDRINUSE
482
+ #undef EADDRNOTAVAIL /* override definition in errno.h */
483
+ #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
484
+ #undef ENETDOWN /* override definition in errno.h */
485
+ #define ENETDOWN WSAENETDOWN
486
+ #undef ENETUNREACH /* override definition in errno.h */
487
+ #define ENETUNREACH WSAENETUNREACH
488
+ #undef ENETRESET /* override definition in errno.h */
489
+ #define ENETRESET WSAENETRESET
490
+ #undef ECONNABORTED /* override definition in errno.h */
491
+ #define ECONNABORTED WSAECONNABORTED
492
+ #undef ECONNRESET /* override definition in errno.h */
493
+ #define ECONNRESET WSAECONNRESET
494
+ #undef ENOBUFS /* override definition in errno.h */
495
+ #define ENOBUFS WSAENOBUFS
496
+ #undef EISCONN /* override definition in errno.h */
497
+ #define EISCONN WSAEISCONN
498
+ #undef ENOTCONN /* override definition in errno.h */
499
+ #define ENOTCONN WSAENOTCONN
500
+ #define ESHUTDOWN WSAESHUTDOWN
501
+ #define ETOOMANYREFS WSAETOOMANYREFS
502
+ #undef ETIMEDOUT /* override definition in errno.h */
503
+ #define ETIMEDOUT WSAETIMEDOUT
504
+ #undef ECONNREFUSED /* override definition in errno.h */
505
+ #define ECONNREFUSED WSAECONNREFUSED
506
+ #undef ELOOP /* override definition in errno.h */
507
+ #define ELOOP WSAELOOP
508
+ #ifndef ENAMETOOLONG /* possible previous definition in errno.h */
509
+ #define ENAMETOOLONG WSAENAMETOOLONG
510
+ #endif
511
+ #define EHOSTDOWN WSAEHOSTDOWN
512
+ #undef EHOSTUNREACH /* override definition in errno.h */
513
+ #define EHOSTUNREACH WSAEHOSTUNREACH
514
+ #ifndef ENOTEMPTY /* possible previous definition in errno.h */
515
+ #define ENOTEMPTY WSAENOTEMPTY
516
+ #endif
517
+ #define EPROCLIM WSAEPROCLIM
518
+ #define EUSERS WSAEUSERS
519
+ #define EDQUOT WSAEDQUOT
520
+ #define ESTALE WSAESTALE
521
+ #define EREMOTE WSAEREMOTE
522
+ #endif
523
+
524
+
525
+ /*
526
+ * Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid()
527
+ */
528
+
529
+ #if defined(__VMS) && \
530
+ defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64)
531
+ #define getpwuid __32_getpwuid
532
+ #endif
533
+
534
+
535
+ /*
536
+ * Macro argv_item_t hides platform details to code using it.
537
+ */
538
+
539
+ #ifdef __VMS
540
+ #define argv_item_t __char_ptr32
541
+ #else
542
+ #define argv_item_t char *
543
+ #endif
544
+
545
+
546
+ /*
547
+ * We use this ZERO_NULL to avoid picky compiler warnings,
548
+ * when assigning a NULL pointer to a function pointer var.
549
+ */
550
+
551
+ #define ZERO_NULL 0
552
+
553
+
554
+ #endif /* __SETUP_ONCE_H */