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,186 @@
1
+
2
+ /* Copyright 1998 by the Massachusetts Institute of Technology.
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
+ #include "ares_setup.h"
18
+
19
+ #ifdef HAVE_NETINET_IN_H
20
+ # include <netinet/in.h>
21
+ #endif
22
+ #ifdef HAVE_ARPA_NAMESER_H
23
+ # include <arpa/nameser.h>
24
+ #else
25
+ # include "nameser.h"
26
+ #endif
27
+ #ifdef HAVE_ARPA_NAMESER_COMPAT_H
28
+ # include <arpa/nameser_compat.h>
29
+ #endif
30
+
31
+ #include "ares.h"
32
+ #include "ares_dns.h"
33
+ #include "ares_private.h"
34
+
35
+ struct qquery {
36
+ ares_callback callback;
37
+ void *arg;
38
+ };
39
+
40
+ static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen);
41
+
42
+ static void rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
43
+ {
44
+ unsigned char x;
45
+ unsigned char y;
46
+ unsigned char* state;
47
+ unsigned char xorIndex;
48
+ short counter;
49
+
50
+ x = key->x;
51
+ y = key->y;
52
+
53
+ state = &key->state[0];
54
+ for(counter = 0; counter < buffer_len; counter ++)
55
+ {
56
+ x = (unsigned char)((x + 1) % 256);
57
+ y = (unsigned char)((state[x] + y) % 256);
58
+ ARES_SWAP_BYTE(&state[x], &state[y]);
59
+
60
+ xorIndex = (unsigned char)((state[x] + state[y]) % 256);
61
+
62
+ buffer_ptr[counter] = (unsigned char)(buffer_ptr[counter]^state[xorIndex]);
63
+ }
64
+ key->x = x;
65
+ key->y = y;
66
+ }
67
+
68
+ static struct query* find_query_by_id(ares_channel channel, unsigned short id)
69
+ {
70
+ unsigned short qid;
71
+ struct list_node* list_head;
72
+ struct list_node* list_node;
73
+ DNS_HEADER_SET_QID(((unsigned char*)&qid), id);
74
+
75
+ /* Find the query corresponding to this packet. */
76
+ list_head = &(channel->queries_by_qid[qid % ARES_QID_TABLE_SIZE]);
77
+ for (list_node = list_head->next; list_node != list_head;
78
+ list_node = list_node->next)
79
+ {
80
+ struct query *q = list_node->data;
81
+ if (q->qid == qid)
82
+ return q;
83
+ }
84
+ return NULL;
85
+ }
86
+
87
+
88
+ /* a unique query id is generated using an rc4 key. Since the id may already
89
+ be used by a running query (as infrequent as it may be), a lookup is
90
+ performed per id generation. In practice this search should happen only
91
+ once per newly generated id
92
+ */
93
+ static unsigned short generate_unique_id(ares_channel channel)
94
+ {
95
+ unsigned short id;
96
+
97
+ do {
98
+ id = ares__generate_new_id(&channel->id_key);
99
+ } while (find_query_by_id(channel, id));
100
+
101
+ return (unsigned short)id;
102
+ }
103
+
104
+ unsigned short ares__generate_new_id(rc4_key* key)
105
+ {
106
+ unsigned short r=0;
107
+ rc4(key, (unsigned char *)&r, sizeof(r));
108
+ return r;
109
+ }
110
+
111
+ void ares_query(ares_channel channel, const char *name, int dnsclass,
112
+ int type, ares_callback callback, void *arg)
113
+ {
114
+ struct qquery *qquery;
115
+ unsigned char *qbuf;
116
+ int qlen, rd, status;
117
+
118
+ /* Compose the query. */
119
+ rd = !(channel->flags & ARES_FLAG_NORECURSE);
120
+ status = ares_create_query(name, dnsclass, type, channel->next_id, rd, &qbuf,
121
+ &qlen, (channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : 0);
122
+ if (status != ARES_SUCCESS)
123
+ {
124
+ if (qbuf != NULL) ares_free(qbuf);
125
+ callback(arg, status, 0, NULL, 0);
126
+ return;
127
+ }
128
+
129
+ channel->next_id = generate_unique_id(channel);
130
+
131
+ /* Allocate and fill in the query structure. */
132
+ qquery = ares_malloc(sizeof(struct qquery));
133
+ if (!qquery)
134
+ {
135
+ ares_free_string(qbuf);
136
+ callback(arg, ARES_ENOMEM, 0, NULL, 0);
137
+ return;
138
+ }
139
+ qquery->callback = callback;
140
+ qquery->arg = arg;
141
+
142
+ /* Send it off. qcallback will be called when we get an answer. */
143
+ ares_send(channel, qbuf, qlen, qcallback, qquery);
144
+ ares_free_string(qbuf);
145
+ }
146
+
147
+ static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen)
148
+ {
149
+ struct qquery *qquery = (struct qquery *) arg;
150
+ unsigned int ancount;
151
+ int rcode;
152
+
153
+ if (status != ARES_SUCCESS)
154
+ qquery->callback(qquery->arg, status, timeouts, abuf, alen);
155
+ else
156
+ {
157
+ /* Pull the response code and answer count from the packet. */
158
+ rcode = DNS_HEADER_RCODE(abuf);
159
+ ancount = DNS_HEADER_ANCOUNT(abuf);
160
+
161
+ /* Convert errors. */
162
+ switch (rcode)
163
+ {
164
+ case NOERROR:
165
+ status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA;
166
+ break;
167
+ case FORMERR:
168
+ status = ARES_EFORMERR;
169
+ break;
170
+ case SERVFAIL:
171
+ status = ARES_ESERVFAIL;
172
+ break;
173
+ case NXDOMAIN:
174
+ status = ARES_ENOTFOUND;
175
+ break;
176
+ case NOTIMP:
177
+ status = ARES_ENOTIMP;
178
+ break;
179
+ case REFUSED:
180
+ status = ARES_EREFUSED;
181
+ break;
182
+ }
183
+ qquery->callback(qquery->arg, status, timeouts, abuf, alen);
184
+ }
185
+ ares_free(qquery);
186
+ }
@@ -0,0 +1,125 @@
1
+ #ifndef __CARES_RULES_H
2
+ #define __CARES_RULES_H
3
+
4
+
5
+ /* Copyright (C) 2009 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
+ /* COMPILE TIME SANITY CHECKS */
20
+ /* ================================================================ */
21
+
22
+ /*
23
+ * NOTE 1:
24
+ * -------
25
+ *
26
+ * All checks done in this file are intentionally placed in a public
27
+ * header file which is pulled by ares.h when an application is
28
+ * being built using an already built c-ares library. Additionally
29
+ * this file is also included and used when building the library.
30
+ *
31
+ * If compilation fails on this file it is certainly sure that the
32
+ * problem is elsewhere. It could be a problem in the ares_build.h
33
+ * header file, or simply that you are using different compilation
34
+ * settings than those used to build the library.
35
+ *
36
+ * Nothing in this file is intended to be modified or adjusted by the
37
+ * c-ares library user nor by the c-ares library builder.
38
+ *
39
+ * Do not deactivate any check, these are done to make sure that the
40
+ * library is properly built and used.
41
+ *
42
+ * You can find further help on the c-ares development mailing list:
43
+ * http://cool.haxx.se/mailman/listinfo/c-ares/
44
+ *
45
+ * NOTE 2
46
+ * ------
47
+ *
48
+ * Some of the following compile time checks are based on the fact
49
+ * that the dimension of a constant array can not be a negative one.
50
+ * In this way if the compile time verification fails, the compilation
51
+ * will fail issuing an error. The error description wording is compiler
52
+ * dependent but it will be quite similar to one of the following:
53
+ *
54
+ * "negative subscript or subscript is too large"
55
+ * "array must have at least one element"
56
+ * "-1 is an illegal array size"
57
+ * "size of array is negative"
58
+ *
59
+ * If you are building an application which tries to use an already
60
+ * built c-ares library and you are getting this kind of errors on
61
+ * this file, it is a clear indication that there is a mismatch between
62
+ * how the library was built and how you are trying to use it for your
63
+ * application. Your already compiled or binary library provider is the
64
+ * only one who can give you the details you need to properly use it.
65
+ */
66
+
67
+ /*
68
+ * Verify that some macros are actually defined.
69
+ */
70
+
71
+ #ifndef CARES_TYPEOF_ARES_SOCKLEN_T
72
+ # error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
73
+ Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
74
+ #endif
75
+
76
+ /*
77
+ * Macros private to this header file.
78
+ */
79
+
80
+ #define CareschkszEQ(t, s) sizeof(t) == s ? 1 : -1
81
+
82
+ #define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
83
+
84
+ /*
85
+ * Verify that the size previously defined and expected for
86
+ * ares_socklen_t is actually the the same as the one reported
87
+ * by sizeof() at compile time.
88
+ */
89
+
90
+ typedef char
91
+ __cares_rule_02__
92
+ [CareschkszEQ(ares_socklen_t, sizeof(CARES_TYPEOF_ARES_SOCKLEN_T))];
93
+
94
+ /*
95
+ * Verify at compile time that the size of ares_socklen_t as reported
96
+ * by sizeof() is greater or equal than the one reported for int for
97
+ * the current compilation.
98
+ */
99
+
100
+ typedef char
101
+ __cares_rule_03__
102
+ [CareschkszGE(ares_socklen_t, int)];
103
+
104
+ /* ================================================================ */
105
+ /* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
106
+ /* ================================================================ */
107
+
108
+ /*
109
+ * Get rid of macros private to this header file.
110
+ */
111
+
112
+ #undef CareschkszEQ
113
+ #undef CareschkszGE
114
+
115
+ /*
116
+ * Get rid of macros not intended to exist beyond this point.
117
+ */
118
+
119
+ #undef CARES_PULL_WS2TCPIP_H
120
+ #undef CARES_PULL_SYS_TYPES_H
121
+ #undef CARES_PULL_SYS_SOCKET_H
122
+
123
+ #undef CARES_TYPEOF_ARES_SOCKLEN_T
124
+
125
+ #endif /* __CARES_RULES_H */
@@ -0,0 +1,316 @@
1
+
2
+ /* Copyright 1998 by the Massachusetts Institute of Technology.
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
+ #include "ares_setup.h"
18
+
19
+ #ifdef HAVE_STRINGS_H
20
+ # include <strings.h>
21
+ #endif
22
+
23
+ #include "ares.h"
24
+ #include "ares_private.h"
25
+
26
+ struct search_query {
27
+ /* Arguments passed to ares_search */
28
+ ares_channel channel;
29
+ char *name; /* copied into an allocated buffer */
30
+ int dnsclass;
31
+ int type;
32
+ ares_callback callback;
33
+ void *arg;
34
+
35
+ int status_as_is; /* error status from trying as-is */
36
+ int next_domain; /* next search domain to try */
37
+ int trying_as_is; /* current query is for name as-is */
38
+ int timeouts; /* number of timeouts we saw for this request */
39
+ int ever_got_nodata; /* did we ever get ARES_ENODATA along the way? */
40
+ };
41
+
42
+ static void search_callback(void *arg, int status, int timeouts,
43
+ unsigned char *abuf, int alen);
44
+ static void end_squery(struct search_query *squery, int status,
45
+ unsigned char *abuf, int alen);
46
+ static int cat_domain(const char *name, const char *domain, char **s);
47
+ STATIC_TESTABLE int single_domain(ares_channel channel, const char *name, char **s);
48
+
49
+ void ares_search(ares_channel channel, const char *name, int dnsclass,
50
+ int type, ares_callback callback, void *arg)
51
+ {
52
+ struct search_query *squery;
53
+ char *s;
54
+ const char *p;
55
+ int status, ndots;
56
+
57
+ /* If name only yields one domain to search, then we don't have
58
+ * to keep extra state, so just do an ares_query().
59
+ */
60
+ status = single_domain(channel, name, &s);
61
+ if (status != ARES_SUCCESS)
62
+ {
63
+ callback(arg, status, 0, NULL, 0);
64
+ return;
65
+ }
66
+ if (s)
67
+ {
68
+ ares_query(channel, s, dnsclass, type, callback, arg);
69
+ ares_free(s);
70
+ return;
71
+ }
72
+
73
+ /* Allocate a search_query structure to hold the state necessary for
74
+ * doing multiple lookups.
75
+ */
76
+ squery = ares_malloc(sizeof(struct search_query));
77
+ if (!squery)
78
+ {
79
+ callback(arg, ARES_ENOMEM, 0, NULL, 0);
80
+ return;
81
+ }
82
+ squery->channel = channel;
83
+ squery->name = ares_strdup(name);
84
+ if (!squery->name)
85
+ {
86
+ ares_free(squery);
87
+ callback(arg, ARES_ENOMEM, 0, NULL, 0);
88
+ return;
89
+ }
90
+ squery->dnsclass = dnsclass;
91
+ squery->type = type;
92
+ squery->status_as_is = -1;
93
+ squery->callback = callback;
94
+ squery->arg = arg;
95
+ squery->timeouts = 0;
96
+ squery->ever_got_nodata = 0;
97
+
98
+ /* Count the number of dots in name. */
99
+ ndots = 0;
100
+ for (p = name; *p; p++)
101
+ {
102
+ if (*p == '.')
103
+ ndots++;
104
+ }
105
+
106
+ /* If ndots is at least the channel ndots threshold (usually 1),
107
+ * then we try the name as-is first. Otherwise, we try the name
108
+ * as-is last.
109
+ */
110
+ if (ndots >= channel->ndots)
111
+ {
112
+ /* Try the name as-is first. */
113
+ squery->next_domain = 0;
114
+ squery->trying_as_is = 1;
115
+ ares_query(channel, name, dnsclass, type, search_callback, squery);
116
+ }
117
+ else
118
+ {
119
+ /* Try the name as-is last; start with the first search domain. */
120
+ squery->next_domain = 1;
121
+ squery->trying_as_is = 0;
122
+ status = cat_domain(name, channel->domains[0], &s);
123
+ if (status == ARES_SUCCESS)
124
+ {
125
+ ares_query(channel, s, dnsclass, type, search_callback, squery);
126
+ ares_free(s);
127
+ }
128
+ else
129
+ {
130
+ /* failed, free the malloc()ed memory */
131
+ ares_free(squery->name);
132
+ ares_free(squery);
133
+ callback(arg, status, 0, NULL, 0);
134
+ }
135
+ }
136
+ }
137
+
138
+ static void search_callback(void *arg, int status, int timeouts,
139
+ unsigned char *abuf, int alen)
140
+ {
141
+ struct search_query *squery = (struct search_query *) arg;
142
+ ares_channel channel = squery->channel;
143
+ char *s;
144
+
145
+ squery->timeouts += timeouts;
146
+
147
+ /* Stop searching unless we got a non-fatal error. */
148
+ if (status != ARES_ENODATA && status != ARES_ESERVFAIL
149
+ && status != ARES_ENOTFOUND)
150
+ end_squery(squery, status, abuf, alen);
151
+ else
152
+ {
153
+ /* Save the status if we were trying as-is. */
154
+ if (squery->trying_as_is)
155
+ squery->status_as_is = status;
156
+
157
+ /*
158
+ * If we ever get ARES_ENODATA along the way, record that; if the search
159
+ * should run to the very end and we got at least one ARES_ENODATA,
160
+ * then callers like ares_gethostbyname() may want to try a T_A search
161
+ * even if the last domain we queried for T_AAAA resource records
162
+ * returned ARES_ENOTFOUND.
163
+ */
164
+ if (status == ARES_ENODATA)
165
+ squery->ever_got_nodata = 1;
166
+
167
+ if (squery->next_domain < channel->ndomains)
168
+ {
169
+ /* Try the next domain. */
170
+ status = cat_domain(squery->name,
171
+ channel->domains[squery->next_domain], &s);
172
+ if (status != ARES_SUCCESS)
173
+ end_squery(squery, status, NULL, 0);
174
+ else
175
+ {
176
+ squery->trying_as_is = 0;
177
+ squery->next_domain++;
178
+ ares_query(channel, s, squery->dnsclass, squery->type,
179
+ search_callback, squery);
180
+ ares_free(s);
181
+ }
182
+ }
183
+ else if (squery->status_as_is == -1)
184
+ {
185
+ /* Try the name as-is at the end. */
186
+ squery->trying_as_is = 1;
187
+ ares_query(channel, squery->name, squery->dnsclass, squery->type,
188
+ search_callback, squery);
189
+ }
190
+ else {
191
+ if (squery->status_as_is == ARES_ENOTFOUND && squery->ever_got_nodata) {
192
+ end_squery(squery, ARES_ENODATA, NULL, 0);
193
+ }
194
+ else
195
+ end_squery(squery, squery->status_as_is, NULL, 0);
196
+ }
197
+ }
198
+ }
199
+
200
+ static void end_squery(struct search_query *squery, int status,
201
+ unsigned char *abuf, int alen)
202
+ {
203
+ squery->callback(squery->arg, status, squery->timeouts, abuf, alen);
204
+ ares_free(squery->name);
205
+ ares_free(squery);
206
+ }
207
+
208
+ /* Concatenate two domains. */
209
+ static int cat_domain(const char *name, const char *domain, char **s)
210
+ {
211
+ size_t nlen = strlen(name);
212
+ size_t dlen = strlen(domain);
213
+
214
+ *s = ares_malloc(nlen + 1 + dlen + 1);
215
+ if (!*s)
216
+ return ARES_ENOMEM;
217
+ memcpy(*s, name, nlen);
218
+ (*s)[nlen] = '.';
219
+ memcpy(*s + nlen + 1, domain, dlen);
220
+ (*s)[nlen + 1 + dlen] = 0;
221
+ return ARES_SUCCESS;
222
+ }
223
+
224
+ /* Determine if this name only yields one query. If it does, set *s to
225
+ * the string we should query, in an allocated buffer. If not, set *s
226
+ * to NULL.
227
+ */
228
+ STATIC_TESTABLE int single_domain(ares_channel channel, const char *name, char **s)
229
+ {
230
+ size_t len = strlen(name);
231
+ const char *hostaliases;
232
+ FILE *fp;
233
+ char *line = NULL;
234
+ int status;
235
+ size_t linesize;
236
+ const char *p, *q;
237
+ int error;
238
+
239
+ /* If the name contains a trailing dot, then the single query is the name
240
+ * sans the trailing dot.
241
+ */
242
+ if ((len > 0) && (name[len - 1] == '.'))
243
+ {
244
+ *s = ares_strdup(name);
245
+ return (*s) ? ARES_SUCCESS : ARES_ENOMEM;
246
+ }
247
+
248
+ if (!(channel->flags & ARES_FLAG_NOALIASES) && !strchr(name, '.'))
249
+ {
250
+ /* The name might be a host alias. */
251
+ hostaliases = getenv("HOSTALIASES");
252
+ if (hostaliases)
253
+ {
254
+ fp = fopen(hostaliases, "r");
255
+ if (fp)
256
+ {
257
+ while ((status = ares__read_line(fp, &line, &linesize))
258
+ == ARES_SUCCESS)
259
+ {
260
+ if (strncasecmp(line, name, len) != 0 ||
261
+ !ISSPACE(line[len]))
262
+ continue;
263
+ p = line + len;
264
+ while (ISSPACE(*p))
265
+ p++;
266
+ if (*p)
267
+ {
268
+ q = p + 1;
269
+ while (*q && !ISSPACE(*q))
270
+ q++;
271
+ *s = ares_malloc(q - p + 1);
272
+ if (*s)
273
+ {
274
+ memcpy(*s, p, q - p);
275
+ (*s)[q - p] = 0;
276
+ }
277
+ ares_free(line);
278
+ fclose(fp);
279
+ return (*s) ? ARES_SUCCESS : ARES_ENOMEM;
280
+ }
281
+ }
282
+ ares_free(line);
283
+ fclose(fp);
284
+ if (status != ARES_SUCCESS && status != ARES_EOF)
285
+ return status;
286
+ }
287
+ else
288
+ {
289
+ error = ERRNO;
290
+ switch(error)
291
+ {
292
+ case ENOENT:
293
+ case ESRCH:
294
+ break;
295
+ default:
296
+ DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
297
+ error, strerror(error)));
298
+ DEBUGF(fprintf(stderr, "Error opening file: %s\n",
299
+ hostaliases));
300
+ *s = NULL;
301
+ return ARES_EFILE;
302
+ }
303
+ }
304
+ }
305
+ }
306
+
307
+ if (channel->flags & ARES_FLAG_NOSEARCH || channel->ndomains == 0)
308
+ {
309
+ /* No domain search to do; just try the name as-is. */
310
+ *s = ares_strdup(name);
311
+ return (*s) ? ARES_SUCCESS : ARES_ENOMEM;
312
+ }
313
+
314
+ *s = NULL;
315
+ return ARES_SUCCESS;
316
+ }