grpc 1.74.1 → 1.75.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +83 -41
  3. data/include/grpc/credentials.h +7 -1
  4. data/src/core/call/client_call.cc +4 -4
  5. data/src/core/call/filter_fusion.h +1230 -0
  6. data/src/core/call/metadata.cc +22 -0
  7. data/src/core/call/metadata.h +24 -2
  8. data/src/core/channelz/channelz.cc +10 -17
  9. data/src/core/channelz/channelz.h +58 -19
  10. data/src/core/channelz/channelz_registry.cc +0 -162
  11. data/src/core/channelz/channelz_registry.h +14 -7
  12. data/src/core/channelz/property_list.cc +19 -23
  13. data/src/core/channelz/property_list.h +3 -1
  14. data/src/core/channelz/v2tov1/convert.cc +683 -0
  15. data/src/core/channelz/v2tov1/convert.h +58 -0
  16. data/src/core/channelz/v2tov1/legacy_api.cc +425 -0
  17. data/src/core/channelz/v2tov1/legacy_api.h +32 -0
  18. data/src/core/channelz/v2tov1/property_list.cc +118 -0
  19. data/src/core/channelz/v2tov1/property_list.h +52 -0
  20. data/src/core/client_channel/client_channel_filter.cc +5 -4
  21. data/src/core/client_channel/client_channel_filter.h +2 -2
  22. data/src/core/client_channel/client_channel_internal.h +2 -1
  23. data/src/core/client_channel/load_balanced_call_destination.cc +6 -5
  24. data/src/core/client_channel/subchannel.cc +14 -6
  25. data/src/core/client_channel/subchannel.h +2 -0
  26. data/src/core/config/core_configuration.cc +3 -1
  27. data/src/core/config/core_configuration.h +12 -0
  28. data/src/core/credentials/transport/alts/alts_credentials.cc +5 -0
  29. data/src/core/credentials/transport/alts/check_gcp_environment_windows.cc +2 -0
  30. data/src/core/credentials/transport/channel_creds_registry_init.cc +3 -1
  31. data/src/core/credentials/transport/ssl/ssl_credentials.cc +1 -1
  32. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +8 -3
  33. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -24
  34. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +19 -8
  35. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +96 -54
  36. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +15 -2
  37. data/src/core/credentials/transport/tls/spiffe_utils.cc +371 -0
  38. data/src/core/credentials/transport/tls/spiffe_utils.h +171 -0
  39. data/src/core/credentials/transport/tls/ssl_utils.cc +11 -10
  40. data/src/core/credentials/transport/tls/ssl_utils.h +4 -2
  41. data/src/core/credentials/transport/tls/tls_credentials.cc +2 -0
  42. data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -26
  43. data/src/core/credentials/transport/tls/tls_security_connector.h +12 -12
  44. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -2
  45. data/src/core/ext/filters/http/client/http_client_filter.cc +3 -6
  46. data/src/core/ext/filters/http/client_authority_filter.cc +1 -2
  47. data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
  48. data/src/core/ext/filters/http/server/http_server_filter.cc +3 -6
  49. data/src/core/ext/filters/message_size/message_size_filter.cc +4 -4
  50. data/src/core/ext/filters/rbac/rbac_filter.cc +1 -1
  51. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +3 -5
  52. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +3 -2
  53. data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
  54. data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -0
  55. data/src/core/ext/transport/chttp2/transport/frame.cc +89 -6
  56. data/src/core/ext/transport/chttp2/transport/frame.h +38 -0
  57. data/src/core/ext/transport/chttp2/transport/header_assembler.h +5 -14
  58. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +4 -1
  59. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +294 -78
  60. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +128 -9
  61. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +11 -38
  62. data/src/core/ext/transport/chttp2/transport/http2_settings.h +52 -35
  63. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +61 -0
  64. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +142 -0
  65. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +81 -3
  66. data/src/core/ext/transport/chttp2/transport/http2_transport.h +12 -1
  67. data/src/core/ext/transport/chttp2/transport/message_assembler.h +2 -2
  68. data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -1
  69. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +2 -1
  70. data/src/core/ext/transport/chttp2/transport/ping_promise.h +22 -5
  71. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +607 -0
  72. data/src/core/ext/transport/chttp2/transport/writable_streams.h +254 -0
  73. data/src/core/ext/transport/chttp2/transport/writing.cc +6 -4
  74. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb.h +4959 -0
  75. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.c +1111 -0
  76. data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.h +108 -0
  77. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb.h +142 -54
  78. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.c +18 -14
  79. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.h +2 -2
  80. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +716 -0
  81. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.h +227 -0
  82. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.c +86 -88
  83. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.h +2 -2
  84. data/src/core/filter/auth/auth_filters.h +2 -2
  85. data/src/core/filter/fused_filters.cc +154 -0
  86. data/src/core/handshaker/security/legacy_secure_endpoint.cc +1 -1
  87. data/src/core/handshaker/security/pipelined_secure_endpoint.cc +965 -0
  88. data/src/core/handshaker/security/secure_endpoint.cc +28 -13
  89. data/src/core/handshaker/security/secure_endpoint.h +8 -0
  90. data/src/core/lib/channel/promise_based_filter.cc +15 -25
  91. data/src/core/lib/channel/promise_based_filter.h +6 -5
  92. data/src/core/lib/event_engine/ares_resolver.h +3 -1
  93. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +9 -5
  94. data/src/core/lib/event_engine/cf_engine/cf_engine.h +2 -1
  95. data/src/core/lib/event_engine/cf_engine/cfsocket_listener.cc +263 -0
  96. data/src/core/lib/event_engine/cf_engine/cfsocket_listener.h +107 -0
  97. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +31 -3
  98. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +12 -0
  99. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +12 -10
  100. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +6 -4
  101. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +15 -14
  102. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +7 -5
  103. data/src/core/lib/event_engine/posix_engine/event_poller.h +0 -8
  104. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +11 -5
  105. data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +3 -2
  106. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +1 -0
  107. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +4 -4
  108. data/src/core/lib/event_engine/posix_engine/lockfree_event.h +3 -4
  109. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +2 -2
  110. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +188 -199
  111. data/src/core/lib/event_engine/posix_engine/posix_engine.h +30 -45
  112. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -1
  113. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +1 -1
  114. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +2 -1
  115. data/src/core/lib/experiments/experiments.cc +120 -6
  116. data/src/core/lib/experiments/experiments.h +46 -3
  117. data/src/core/lib/iomgr/combiner.cc +1 -1
  118. data/src/core/lib/iomgr/exec_ctx.h +3 -9
  119. data/src/core/lib/iomgr/socket_mutator.cc +1 -1
  120. data/src/core/lib/iomgr/socket_utils_posix.cc +1 -1
  121. data/src/core/lib/iomgr/socket_utils_posix.h +1 -1
  122. data/src/core/lib/iomgr/tcp_client_posix.cc +1 -1
  123. data/src/core/lib/iomgr/tcp_posix.cc +3 -3
  124. data/src/core/lib/promise/activity.h +2 -2
  125. data/src/core/lib/promise/mpsc.cc +8 -8
  126. data/src/core/lib/promise/party.cc +7 -7
  127. data/src/core/lib/promise/party.h +4 -4
  128. data/src/core/lib/promise/poll.h +10 -0
  129. data/src/core/lib/resource_quota/memory_quota.cc +90 -3
  130. data/src/core/lib/resource_quota/memory_quota.h +20 -9
  131. data/src/core/lib/resource_quota/periodic_update.cc +14 -0
  132. data/src/core/lib/resource_quota/periodic_update.h +8 -0
  133. data/src/core/lib/resource_quota/resource_quota.cc +15 -4
  134. data/src/core/lib/resource_quota/resource_quota.h +3 -0
  135. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +1 -2
  136. data/src/core/lib/surface/call.cc +5 -5
  137. data/src/core/lib/surface/call.h +6 -5
  138. data/src/core/lib/surface/completion_queue.cc +2 -4
  139. data/src/core/lib/surface/filter_stack_call.cc +1 -1
  140. data/src/core/lib/surface/version.cc +2 -2
  141. data/src/core/lib/transport/promise_endpoint.cc +2 -2
  142. data/src/core/lib/transport/promise_endpoint.h +3 -3
  143. data/src/core/load_balancing/endpoint_list.cc +29 -2
  144. data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +3 -3
  145. data/src/core/load_balancing/grpclb/client_load_reporting_filter.h +1 -1
  146. data/src/core/load_balancing/pick_first/pick_first.cc +12 -5
  147. data/src/core/load_balancing/xds/xds_cluster_impl.cc +5 -3
  148. data/src/core/net/socket_mutator.cc +19 -0
  149. data/src/core/net/socket_mutator.h +25 -0
  150. data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -0
  151. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +6 -1
  152. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +2 -1
  153. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +8 -5
  154. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -1
  155. data/src/core/resolver/xds/xds_dependency_manager.cc +1 -1
  156. data/src/core/server/server.cc +1 -1
  157. data/src/core/server/server_call_tracer_filter.cc +0 -66
  158. data/src/core/server/server_call_tracer_filter.h +64 -0
  159. data/src/core/server/server_config_selector_filter.cc +1 -1
  160. data/src/core/service_config/service_config_channel_arg_filter.cc +3 -60
  161. data/src/core/service_config/service_config_channel_arg_filter.h +82 -0
  162. data/src/core/telemetry/call_tracer.cc +20 -14
  163. data/src/core/telemetry/call_tracer.h +22 -17
  164. data/src/core/telemetry/metrics.h +8 -8
  165. data/src/core/telemetry/stats_data.cc +151 -151
  166. data/src/core/telemetry/stats_data.h +87 -87
  167. data/src/core/transport/auth_context.cc +20 -0
  168. data/src/core/transport/auth_context.h +4 -0
  169. data/src/core/transport/auth_context_comparator_registry.h +69 -0
  170. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +2 -3
  171. data/src/core/tsi/ssl_transport_security.cc +202 -32
  172. data/src/core/tsi/ssl_transport_security.h +19 -10
  173. data/src/core/tsi/ssl_transport_security_utils.cc +21 -0
  174. data/src/core/tsi/ssl_transport_security_utils.h +4 -0
  175. data/src/core/util/http_client/httpcli_security_connector.cc +3 -1
  176. data/src/core/util/latent_see.cc +178 -146
  177. data/src/core/util/latent_see.h +245 -188
  178. data/src/core/util/single_set_ptr.h +5 -2
  179. data/src/core/util/useful.h +91 -0
  180. data/src/core/util/windows/directory_reader.cc +1 -0
  181. data/src/core/util/windows/thd.cc +1 -3
  182. data/src/core/util/work_serializer.cc +1 -1
  183. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +32 -5
  184. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +5 -0
  185. data/src/core/xds/grpc/xds_certificate_provider.cc +5 -6
  186. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
  187. data/src/ruby/lib/grpc/version.rb +1 -1
  188. data/third_party/cares/cares/include/ares.h +925 -460
  189. data/third_party/cares/cares/include/ares_dns.h +86 -71
  190. data/third_party/cares/cares/include/ares_dns_record.h +1118 -0
  191. data/third_party/cares/cares/include/ares_nameser.h +215 -189
  192. data/third_party/cares/cares/include/ares_version.h +37 -14
  193. data/third_party/cares/cares/src/lib/ares_addrinfo2hostent.c +305 -0
  194. data/third_party/cares/cares/src/lib/ares_addrinfo_localhost.c +245 -0
  195. data/third_party/cares/cares/src/lib/ares_android.c +216 -164
  196. data/third_party/cares/cares/src/lib/ares_android.h +25 -14
  197. data/third_party/cares/cares/src/lib/ares_cancel.c +68 -44
  198. data/third_party/cares/cares/src/lib/ares_close_sockets.c +137 -0
  199. data/third_party/cares/cares/src/lib/ares_conn.c +511 -0
  200. data/third_party/cares/cares/src/lib/ares_conn.h +196 -0
  201. data/third_party/cares/cares/src/lib/ares_cookie.c +461 -0
  202. data/third_party/cares/cares/src/lib/ares_data.c +93 -181
  203. data/third_party/cares/cares/src/lib/ares_data.h +50 -39
  204. data/third_party/cares/cares/src/lib/ares_destroy.c +127 -89
  205. data/third_party/cares/cares/src/lib/ares_free_hostent.c +35 -24
  206. data/third_party/cares/cares/src/lib/ares_free_string.c +24 -16
  207. data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +45 -38
  208. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +549 -663
  209. data/third_party/cares/cares/src/lib/ares_getenv.c +25 -15
  210. data/third_party/cares/cares/src/lib/ares_getenv.h +26 -18
  211. data/third_party/cares/cares/src/lib/ares_gethostbyaddr.c +163 -221
  212. data/third_party/cares/cares/src/lib/ares_gethostbyname.c +222 -223
  213. data/third_party/cares/cares/src/lib/ares_getnameinfo.c +328 -338
  214. data/third_party/cares/cares/src/lib/ares_hosts_file.c +952 -0
  215. data/third_party/cares/cares/src/lib/ares_inet_net_pton.h +25 -19
  216. data/third_party/cares/cares/src/lib/ares_init.c +425 -2091
  217. data/third_party/cares/cares/src/lib/ares_ipv6.h +63 -33
  218. data/third_party/cares/cares/src/lib/ares_library_init.c +110 -54
  219. data/third_party/cares/cares/src/lib/ares_metrics.c +261 -0
  220. data/third_party/cares/cares/src/lib/ares_options.c +418 -332
  221. data/third_party/cares/cares/src/lib/ares_parse_into_addrinfo.c +179 -0
  222. data/third_party/cares/cares/src/lib/ares_private.h +558 -356
  223. data/third_party/cares/cares/src/lib/ares_process.c +1224 -1369
  224. data/third_party/cares/cares/src/lib/ares_qcache.c +430 -0
  225. data/third_party/cares/cares/src/lib/ares_query.c +126 -121
  226. data/third_party/cares/cares/src/lib/ares_search.c +564 -262
  227. data/third_party/cares/cares/src/lib/ares_send.c +264 -93
  228. data/third_party/cares/cares/src/lib/ares_set_socket_functions.c +588 -0
  229. data/third_party/cares/cares/src/lib/ares_setup.h +115 -111
  230. data/third_party/cares/cares/src/lib/ares_socket.c +425 -0
  231. data/third_party/cares/cares/src/lib/ares_socket.h +163 -0
  232. data/third_party/cares/cares/src/lib/ares_sortaddrinfo.c +447 -0
  233. data/third_party/cares/cares/src/lib/ares_strerror.c +83 -48
  234. data/third_party/cares/cares/src/lib/ares_sysconfig.c +639 -0
  235. data/third_party/cares/cares/src/lib/ares_sysconfig_files.c +839 -0
  236. data/third_party/cares/cares/src/lib/ares_sysconfig_mac.c +373 -0
  237. data/third_party/cares/cares/src/lib/ares_sysconfig_win.c +621 -0
  238. data/third_party/cares/cares/src/lib/ares_timeout.c +136 -73
  239. data/third_party/cares/cares/src/lib/ares_update_servers.c +1362 -0
  240. data/third_party/cares/cares/src/lib/ares_version.c +29 -4
  241. data/third_party/cares/cares/src/lib/config-dos.h +88 -89
  242. data/third_party/cares/cares/src/lib/config-win32.h +122 -77
  243. data/third_party/cares/cares/src/lib/dsa/ares_array.c +394 -0
  244. data/third_party/cares/cares/src/lib/dsa/ares_htable.c +447 -0
  245. data/third_party/cares/cares/src/lib/dsa/ares_htable.h +174 -0
  246. data/third_party/cares/cares/src/lib/dsa/ares_htable_asvp.c +224 -0
  247. data/third_party/cares/cares/src/lib/dsa/ares_htable_dict.c +228 -0
  248. data/third_party/cares/cares/src/lib/dsa/ares_htable_strvp.c +210 -0
  249. data/third_party/cares/cares/src/lib/dsa/ares_htable_szvp.c +188 -0
  250. data/third_party/cares/cares/src/lib/dsa/ares_htable_vpstr.c +186 -0
  251. data/third_party/cares/cares/src/lib/dsa/ares_htable_vpvp.c +194 -0
  252. data/third_party/cares/cares/src/lib/dsa/ares_llist.c +382 -0
  253. data/third_party/cares/cares/src/lib/dsa/ares_slist.c +479 -0
  254. data/third_party/cares/cares/src/lib/dsa/ares_slist.h +207 -0
  255. data/third_party/cares/cares/src/lib/event/ares_event.h +191 -0
  256. data/third_party/cares/cares/src/lib/event/ares_event_configchg.c +743 -0
  257. data/third_party/cares/cares/src/lib/event/ares_event_epoll.c +192 -0
  258. data/third_party/cares/cares/src/lib/event/ares_event_kqueue.c +248 -0
  259. data/third_party/cares/cares/src/lib/event/ares_event_poll.c +140 -0
  260. data/third_party/cares/cares/src/lib/event/ares_event_select.c +159 -0
  261. data/third_party/cares/cares/src/lib/event/ares_event_thread.c +567 -0
  262. data/third_party/cares/cares/src/lib/event/ares_event_wake_pipe.c +166 -0
  263. data/third_party/cares/cares/src/lib/event/ares_event_win32.c +978 -0
  264. data/third_party/cares/cares/src/lib/event/ares_event_win32.h +161 -0
  265. data/third_party/cares/cares/src/lib/include/ares_array.h +276 -0
  266. data/third_party/cares/cares/src/lib/include/ares_buf.h +732 -0
  267. data/third_party/cares/cares/src/lib/include/ares_htable_asvp.h +130 -0
  268. data/third_party/cares/cares/src/lib/include/ares_htable_dict.h +123 -0
  269. data/third_party/cares/cares/src/lib/include/ares_htable_strvp.h +130 -0
  270. data/third_party/cares/cares/src/lib/include/ares_htable_szvp.h +118 -0
  271. data/third_party/cares/cares/src/lib/include/ares_htable_vpstr.h +111 -0
  272. data/third_party/cares/cares/src/lib/include/ares_htable_vpvp.h +128 -0
  273. data/third_party/cares/cares/src/lib/include/ares_llist.h +239 -0
  274. data/third_party/cares/cares/src/lib/include/ares_mem.h +38 -0
  275. data/third_party/cares/cares/src/lib/include/ares_str.h +244 -0
  276. data/third_party/cares/cares/src/lib/inet_net_pton.c +202 -157
  277. data/third_party/cares/cares/src/lib/inet_ntop.c +87 -69
  278. data/third_party/cares/cares/src/lib/legacy/ares_create_query.c +78 -0
  279. data/third_party/cares/cares/src/lib/legacy/ares_expand_name.c +99 -0
  280. data/third_party/cares/cares/src/lib/legacy/ares_expand_string.c +107 -0
  281. data/third_party/cares/cares/src/lib/legacy/ares_fds.c +80 -0
  282. data/third_party/cares/cares/src/lib/legacy/ares_getsock.c +85 -0
  283. data/third_party/cares/cares/src/lib/legacy/ares_parse_a_reply.c +107 -0
  284. data/third_party/cares/cares/src/lib/legacy/ares_parse_aaaa_reply.c +109 -0
  285. data/third_party/cares/cares/src/lib/legacy/ares_parse_caa_reply.c +137 -0
  286. data/third_party/cares/cares/src/lib/legacy/ares_parse_mx_reply.c +110 -0
  287. data/third_party/cares/cares/src/lib/legacy/ares_parse_naptr_reply.c +132 -0
  288. data/third_party/cares/cares/src/lib/legacy/ares_parse_ns_reply.c +154 -0
  289. data/third_party/cares/cares/src/lib/legacy/ares_parse_ptr_reply.c +213 -0
  290. data/third_party/cares/cares/src/lib/legacy/ares_parse_soa_reply.c +115 -0
  291. data/third_party/cares/cares/src/lib/legacy/ares_parse_srv_reply.c +114 -0
  292. data/third_party/cares/cares/src/lib/legacy/ares_parse_txt_reply.c +144 -0
  293. data/third_party/cares/cares/src/lib/legacy/ares_parse_uri_reply.c +113 -0
  294. data/third_party/cares/cares/src/lib/record/ares_dns_mapping.c +982 -0
  295. data/third_party/cares/cares/src/lib/record/ares_dns_multistring.c +307 -0
  296. data/third_party/cares/cares/src/lib/record/ares_dns_multistring.h +72 -0
  297. data/third_party/cares/cares/src/lib/record/ares_dns_name.c +673 -0
  298. data/third_party/cares/cares/src/lib/record/ares_dns_parse.c +1329 -0
  299. data/third_party/cares/cares/src/lib/record/ares_dns_private.h +273 -0
  300. data/third_party/cares/cares/src/lib/record/ares_dns_record.c +1661 -0
  301. data/third_party/cares/cares/src/lib/record/ares_dns_write.c +1229 -0
  302. data/third_party/cares/cares/src/lib/str/ares_buf.c +1498 -0
  303. data/third_party/cares/cares/src/lib/str/ares_str.c +508 -0
  304. data/third_party/cares/cares/src/lib/str/ares_strsplit.c +90 -0
  305. data/third_party/cares/cares/src/lib/str/ares_strsplit.h +51 -0
  306. data/third_party/cares/cares/src/lib/thirdparty/apple/dnsinfo.h +122 -0
  307. data/third_party/cares/cares/src/lib/util/ares_iface_ips.c +628 -0
  308. data/third_party/cares/cares/src/lib/util/ares_iface_ips.h +139 -0
  309. data/third_party/cares/cares/src/lib/util/ares_math.c +158 -0
  310. data/third_party/cares/cares/src/lib/util/ares_math.h +45 -0
  311. data/third_party/cares/cares/src/lib/util/ares_rand.c +389 -0
  312. data/third_party/cares/cares/src/lib/util/ares_rand.h +36 -0
  313. data/third_party/cares/cares/src/lib/util/ares_threads.c +614 -0
  314. data/third_party/cares/cares/src/lib/util/ares_threads.h +60 -0
  315. data/third_party/cares/cares/src/lib/util/ares_time.h +48 -0
  316. data/third_party/cares/cares/src/lib/util/ares_timeval.c +95 -0
  317. data/third_party/cares/cares/src/lib/util/ares_uri.c +1626 -0
  318. data/third_party/cares/cares/src/lib/util/ares_uri.h +252 -0
  319. data/third_party/cares/cares/src/lib/windows_port.c +16 -9
  320. metadata +121 -49
  321. data/src/core/util/ring_buffer.h +0 -122
  322. data/third_party/cares/cares/include/ares_rules.h +0 -125
  323. data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +0 -266
  324. data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +0 -240
  325. data/third_party/cares/cares/src/lib/ares__close_sockets.c +0 -61
  326. data/third_party/cares/cares/src/lib/ares__get_hostent.c +0 -260
  327. data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +0 -229
  328. data/third_party/cares/cares/src/lib/ares__read_line.c +0 -73
  329. data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +0 -258
  330. data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +0 -507
  331. data/third_party/cares/cares/src/lib/ares__timeval.c +0 -111
  332. data/third_party/cares/cares/src/lib/ares_create_query.c +0 -197
  333. data/third_party/cares/cares/src/lib/ares_expand_name.c +0 -311
  334. data/third_party/cares/cares/src/lib/ares_expand_string.c +0 -67
  335. data/third_party/cares/cares/src/lib/ares_fds.c +0 -59
  336. data/third_party/cares/cares/src/lib/ares_getsock.c +0 -66
  337. data/third_party/cares/cares/src/lib/ares_iphlpapi.h +0 -221
  338. data/third_party/cares/cares/src/lib/ares_llist.c +0 -63
  339. data/third_party/cares/cares/src/lib/ares_llist.h +0 -39
  340. data/third_party/cares/cares/src/lib/ares_mkquery.c +0 -24
  341. data/third_party/cares/cares/src/lib/ares_nowarn.c +0 -260
  342. data/third_party/cares/cares/src/lib/ares_nowarn.h +0 -61
  343. data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +0 -90
  344. data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +0 -92
  345. data/third_party/cares/cares/src/lib/ares_parse_caa_reply.c +0 -199
  346. data/third_party/cares/cares/src/lib/ares_parse_mx_reply.c +0 -164
  347. data/third_party/cares/cares/src/lib/ares_parse_naptr_reply.c +0 -183
  348. data/third_party/cares/cares/src/lib/ares_parse_ns_reply.c +0 -177
  349. data/third_party/cares/cares/src/lib/ares_parse_ptr_reply.c +0 -228
  350. data/third_party/cares/cares/src/lib/ares_parse_soa_reply.c +0 -179
  351. data/third_party/cares/cares/src/lib/ares_parse_srv_reply.c +0 -168
  352. data/third_party/cares/cares/src/lib/ares_parse_txt_reply.c +0 -214
  353. data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +0 -184
  354. data/third_party/cares/cares/src/lib/ares_platform.c +0 -11042
  355. data/third_party/cares/cares/src/lib/ares_platform.h +0 -43
  356. data/third_party/cares/cares/src/lib/ares_rand.c +0 -279
  357. data/third_party/cares/cares/src/lib/ares_strcasecmp.c +0 -66
  358. data/third_party/cares/cares/src/lib/ares_strcasecmp.h +0 -30
  359. data/third_party/cares/cares/src/lib/ares_strdup.c +0 -42
  360. data/third_party/cares/cares/src/lib/ares_strdup.h +0 -24
  361. data/third_party/cares/cares/src/lib/ares_strsplit.c +0 -94
  362. data/third_party/cares/cares/src/lib/ares_strsplit.h +0 -42
  363. data/third_party/cares/cares/src/lib/ares_writev.c +0 -79
  364. data/third_party/cares/cares/src/lib/ares_writev.h +0 -36
  365. data/third_party/cares/cares/src/lib/bitncmp.c +0 -59
  366. data/third_party/cares/cares/src/lib/bitncmp.h +0 -26
  367. data/third_party/cares/cares/src/lib/setup_once.h +0 -554
  368. data/third_party/cares/cares/src/tools/ares_getopt.h +0 -53
@@ -1,197 +0,0 @@
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
-
23
- #include "ares_nameser.h"
24
-
25
- #include "ares.h"
26
- #include "ares_dns.h"
27
- #include "ares_private.h"
28
-
29
-
30
- /* Header format, from RFC 1035:
31
- * 1 1 1 1 1 1
32
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
33
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
34
- * | ID |
35
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
36
- * |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
37
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
38
- * | QDCOUNT |
39
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
40
- * | ANCOUNT |
41
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
42
- * | NSCOUNT |
43
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
44
- * | ARCOUNT |
45
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
46
- *
47
- * AA, TC, RA, and RCODE are only set in responses. Brief description
48
- * of the remaining fields:
49
- * ID Identifier to match responses with queries
50
- * QR Query (0) or response (1)
51
- * Opcode For our purposes, always O_QUERY
52
- * RD Recursion desired
53
- * Z Reserved (zero)
54
- * QDCOUNT Number of queries
55
- * ANCOUNT Number of answers
56
- * NSCOUNT Number of name server records
57
- * ARCOUNT Number of additional records
58
- *
59
- * Question format, from RFC 1035:
60
- * 1 1 1 1 1 1
61
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
62
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
63
- * | |
64
- * / QNAME /
65
- * / /
66
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
67
- * | QTYPE |
68
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
69
- * | QCLASS |
70
- * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
71
- *
72
- * The query name is encoded as a series of labels, each represented
73
- * as a one-byte length (maximum 63) followed by the text of the
74
- * label. The list is terminated by a label of length zero (which can
75
- * be thought of as the root domain).
76
- */
77
-
78
- int ares_create_query(const char *name, int dnsclass, int type,
79
- unsigned short id, int rd, unsigned char **bufp,
80
- int *buflenp, int max_udp_size)
81
- {
82
- size_t len;
83
- unsigned char *q;
84
- const char *p;
85
- size_t buflen;
86
- unsigned char *buf;
87
-
88
- /* Set our results early, in case we bail out early with an error. */
89
- *buflenp = 0;
90
- *bufp = NULL;
91
-
92
- /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
93
- if (ares__is_onion_domain(name))
94
- return ARES_ENOTFOUND;
95
-
96
- /* Allocate a memory area for the maximum size this packet might need. +2
97
- * is for the length byte and zero termination if no dots or ecscaping is
98
- * used.
99
- */
100
- len = strlen(name) + 2 + HFIXEDSZ + QFIXEDSZ +
101
- (max_udp_size ? EDNSFIXEDSZ : 0);
102
- buf = ares_malloc(len);
103
- if (!buf)
104
- return ARES_ENOMEM;
105
-
106
- /* Set up the header. */
107
- q = buf;
108
- memset(q, 0, HFIXEDSZ);
109
- DNS_HEADER_SET_QID(q, id);
110
- DNS_HEADER_SET_OPCODE(q, O_QUERY);
111
- if (rd) {
112
- DNS_HEADER_SET_RD(q, 1);
113
- }
114
- else {
115
- DNS_HEADER_SET_RD(q, 0);
116
- }
117
- DNS_HEADER_SET_QDCOUNT(q, 1);
118
-
119
- if (max_udp_size) {
120
- DNS_HEADER_SET_ARCOUNT(q, 1);
121
- }
122
-
123
- /* A name of "." is a screw case for the loop below, so adjust it. */
124
- if (strcmp(name, ".") == 0)
125
- name++;
126
-
127
- /* Start writing out the name after the header. */
128
- q += HFIXEDSZ;
129
- while (*name)
130
- {
131
- if (*name == '.') {
132
- ares_free (buf);
133
- return ARES_EBADNAME;
134
- }
135
-
136
- /* Count the number of bytes in this label. */
137
- len = 0;
138
- for (p = name; *p && *p != '.'; p++)
139
- {
140
- if (*p == '\\' && *(p + 1) != 0)
141
- p++;
142
- len++;
143
- }
144
- if (len > MAXLABEL) {
145
- ares_free (buf);
146
- return ARES_EBADNAME;
147
- }
148
-
149
- /* Encode the length and copy the data. */
150
- *q++ = (unsigned char)len;
151
- for (p = name; *p && *p != '.'; p++)
152
- {
153
- if (*p == '\\' && *(p + 1) != 0)
154
- p++;
155
- *q++ = *p;
156
- }
157
-
158
- /* Go to the next label and repeat, unless we hit the end. */
159
- if (!*p)
160
- break;
161
- name = p + 1;
162
- }
163
-
164
- /* Add the zero-length label at the end. */
165
- *q++ = 0;
166
-
167
- /* Finish off the question with the type and class. */
168
- DNS_QUESTION_SET_TYPE(q, type);
169
- DNS_QUESTION_SET_CLASS(q, dnsclass);
170
-
171
- q += QFIXEDSZ;
172
- if (max_udp_size)
173
- {
174
- memset(q, 0, EDNSFIXEDSZ);
175
- q++;
176
- DNS_RR_SET_TYPE(q, T_OPT);
177
- DNS_RR_SET_CLASS(q, max_udp_size);
178
- q += (EDNSFIXEDSZ-1);
179
- }
180
- buflen = (q - buf);
181
-
182
- /* Reject names that are longer than the maximum of 255 bytes that's
183
- * specified in RFC 1035 ("To simplify implementations, the total length of
184
- * a domain name (i.e., label octets and label length octets) is restricted
185
- * to 255 octets or less."). */
186
- if (buflen > (size_t)(MAXCDNAME + HFIXEDSZ + QFIXEDSZ +
187
- (max_udp_size ? EDNSFIXEDSZ : 0))) {
188
- ares_free (buf);
189
- return ARES_EBADNAME;
190
- }
191
-
192
- /* we know this fits in an int at this point */
193
- *buflenp = (int) buflen;
194
- *bufp = buf;
195
-
196
- return ARES_SUCCESS;
197
- }
@@ -1,311 +0,0 @@
1
-
2
- /* Copyright 1998, 2011 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
-
23
- #include "ares_nameser.h"
24
-
25
- #include "ares.h"
26
- #include "ares_nowarn.h"
27
- #include "ares_private.h" /* for the memdebug */
28
-
29
- /* Maximum number of indirections allowed for a name */
30
- #define MAX_INDIRS 50
31
-
32
- static int name_length(const unsigned char *encoded, const unsigned char *abuf,
33
- int alen, int is_hostname);
34
-
35
- /* Reserved characters for names that need to be escaped */
36
- static int is_reservedch(int ch)
37
- {
38
- switch (ch) {
39
- case '"':
40
- case '.':
41
- case ';':
42
- case '\\':
43
- case '(':
44
- case ')':
45
- case '@':
46
- case '$':
47
- return 1;
48
- default:
49
- break;
50
- }
51
-
52
- return 0;
53
- }
54
-
55
- static int ares__isprint(int ch)
56
- {
57
- if (ch >= 0x20 && ch <= 0x7E)
58
- return 1;
59
- return 0;
60
- }
61
-
62
- /* Character set allowed by hostnames. This is to include the normal
63
- * domain name character set plus:
64
- * - underscores which are used in SRV records.
65
- * - Forward slashes such as are used for classless in-addr.arpa
66
- * delegation (CNAMEs)
67
- * - Asterisks may be used for wildcard domains in CNAMEs as seen in the
68
- * real world.
69
- * While RFC 2181 section 11 does state not to do validation,
70
- * that applies to servers, not clients. Vulnerabilities have been
71
- * reported when this validation is not performed. Security is more
72
- * important than edge-case compatibility (which is probably invalid
73
- * anyhow). */
74
- static int is_hostnamech(int ch)
75
- {
76
- /* [A-Za-z0-9-*._/]
77
- * Don't use isalnum() as it is locale-specific
78
- */
79
- if (ch >= 'A' && ch <= 'Z')
80
- return 1;
81
- if (ch >= 'a' && ch <= 'z')
82
- return 1;
83
- if (ch >= '0' && ch <= '9')
84
- return 1;
85
- if (ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '*')
86
- return 1;
87
-
88
- return 0;
89
- }
90
-
91
- /* Expand an RFC1035-encoded domain name given by encoded. The
92
- * containing message is given by abuf and alen. The result given by
93
- * *s, which is set to a NUL-terminated allocated buffer. *enclen is
94
- * set to the length of the encoded name (not the length of the
95
- * expanded name; the goal is to tell the caller how many bytes to
96
- * move forward to get past the encoded name).
97
- *
98
- * In the simple case, an encoded name is a series of labels, each
99
- * composed of a one-byte length (limited to values between 0 and 63
100
- * inclusive) followed by the label contents. The name is terminated
101
- * by a zero-length label.
102
- *
103
- * In the more complicated case, a label may be terminated by an
104
- * indirection pointer, specified by two bytes with the high bits of
105
- * the first byte (corresponding to INDIR_MASK) set to 11. With the
106
- * two high bits of the first byte stripped off, the indirection
107
- * pointer gives an offset from the beginning of the containing
108
- * message with more labels to decode. Indirection can happen an
109
- * arbitrary number of times, so we have to detect loops.
110
- *
111
- * Since the expanded name uses '.' as a label separator, we use
112
- * backslashes to escape periods or backslashes in the expanded name.
113
- *
114
- * If the result is expected to be a hostname, then no escaped data is allowed
115
- * and will return error.
116
- */
117
-
118
- int ares__expand_name_validated(const unsigned char *encoded,
119
- const unsigned char *abuf,
120
- int alen, char **s, long *enclen,
121
- int is_hostname)
122
- {
123
- int len, indir = 0;
124
- char *q;
125
- const unsigned char *p;
126
- union {
127
- ares_ssize_t sig;
128
- size_t uns;
129
- } nlen;
130
-
131
- nlen.sig = name_length(encoded, abuf, alen, is_hostname);
132
- if (nlen.sig < 0)
133
- return ARES_EBADNAME;
134
-
135
- *s = ares_malloc(nlen.uns + 1);
136
- if (!*s)
137
- return ARES_ENOMEM;
138
- q = *s;
139
-
140
- if (nlen.uns == 0) {
141
- /* RFC2181 says this should be ".": the root of the DNS tree.
142
- * Since this function strips trailing dots though, it becomes ""
143
- */
144
- q[0] = '\0';
145
-
146
- /* indirect root label (like 0xc0 0x0c) is 2 bytes long (stupid, but
147
- valid) */
148
- if ((*encoded & INDIR_MASK) == INDIR_MASK)
149
- *enclen = 2L;
150
- else
151
- *enclen = 1L; /* the caller should move one byte to get past this */
152
-
153
- return ARES_SUCCESS;
154
- }
155
-
156
- /* No error-checking necessary; it was all done by name_length(). */
157
- p = encoded;
158
- while (*p)
159
- {
160
- if ((*p & INDIR_MASK) == INDIR_MASK)
161
- {
162
- if (!indir)
163
- {
164
- *enclen = aresx_uztosl(p + 2U - encoded);
165
- indir = 1;
166
- }
167
- p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
168
- }
169
- else
170
- {
171
- int name_len = *p;
172
- len = name_len;
173
- p++;
174
-
175
- while (len--)
176
- {
177
- /* Output as \DDD for consistency with RFC1035 5.1, except
178
- * for the special case of a root name response */
179
- if (!ares__isprint(*p) && !(name_len == 1 && *p == 0))
180
- {
181
- *q++ = '\\';
182
- *q++ = (char)('0' + *p / 100);
183
- *q++ = (char)('0' + (*p % 100) / 10);
184
- *q++ = (char)('0' + (*p % 10));
185
- }
186
- else if (is_reservedch(*p))
187
- {
188
- *q++ = '\\';
189
- *q++ = *p;
190
- }
191
- else
192
- {
193
- *q++ = *p;
194
- }
195
- p++;
196
- }
197
- *q++ = '.';
198
- }
199
- }
200
-
201
- if (!indir)
202
- *enclen = aresx_uztosl(p + 1U - encoded);
203
-
204
- /* Nuke the trailing period if we wrote one. */
205
- if (q > *s)
206
- *(q - 1) = 0;
207
- else
208
- *q = 0; /* zero terminate; LCOV_EXCL_LINE: empty names exit above */
209
-
210
- return ARES_SUCCESS;
211
- }
212
-
213
-
214
- int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
215
- int alen, char **s, long *enclen)
216
- {
217
- return ares__expand_name_validated(encoded, abuf, alen, s, enclen, 0);
218
- }
219
-
220
- /* Return the length of the expansion of an encoded domain name, or
221
- * -1 if the encoding is invalid.
222
- */
223
- static int name_length(const unsigned char *encoded, const unsigned char *abuf,
224
- int alen, int is_hostname)
225
- {
226
- int n = 0, offset, indir = 0, top;
227
-
228
- /* Allow the caller to pass us abuf + alen and have us check for it. */
229
- if (encoded >= abuf + alen)
230
- return -1;
231
-
232
- while (*encoded)
233
- {
234
- top = (*encoded & INDIR_MASK);
235
- if (top == INDIR_MASK)
236
- {
237
- /* Check the offset and go there. */
238
- if (encoded + 1 >= abuf + alen)
239
- return -1;
240
- offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1);
241
- if (offset >= alen)
242
- return -1;
243
- encoded = abuf + offset;
244
-
245
- /* If we've seen more indirects than the message length,
246
- * then there's a loop.
247
- */
248
- ++indir;
249
- if (indir > alen || indir > MAX_INDIRS)
250
- return -1;
251
- }
252
- else if (top == 0x00)
253
- {
254
- int name_len = *encoded;
255
- offset = name_len;
256
- if (encoded + offset + 1 >= abuf + alen)
257
- return -1;
258
- encoded++;
259
-
260
- while (offset--)
261
- {
262
- if (!ares__isprint(*encoded) && !(name_len == 1 && *encoded == 0))
263
- {
264
- if (is_hostname)
265
- return -1;
266
- n += 4;
267
- }
268
- else if (is_reservedch(*encoded))
269
- {
270
- if (is_hostname)
271
- return -1;
272
- n += 2;
273
- }
274
- else
275
- {
276
- if (is_hostname && !is_hostnamech(*encoded))
277
- return -1;
278
- n += 1;
279
- }
280
- encoded++;
281
- }
282
-
283
- n++;
284
- }
285
- else
286
- {
287
- /* RFC 1035 4.1.4 says other options (01, 10) for top 2
288
- * bits are reserved.
289
- */
290
- return -1;
291
- }
292
- }
293
-
294
- /* If there were any labels at all, then the number of dots is one
295
- * less than the number of labels, so subtract one.
296
- */
297
- return (n) ? n - 1 : n;
298
- }
299
-
300
- /* Like ares_expand_name_validated but returns EBADRESP in case of invalid
301
- * input. */
302
- int ares__expand_name_for_response(const unsigned char *encoded,
303
- const unsigned char *abuf, int alen,
304
- char **s, long *enclen, int is_hostname)
305
- {
306
- int status = ares__expand_name_validated(encoded, abuf, alen, s, enclen,
307
- is_hostname);
308
- if (status == ARES_EBADNAME)
309
- status = ARES_EBADRESP;
310
- return status;
311
- }
@@ -1,67 +0,0 @@
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
-
23
- #include "ares_nameser.h"
24
-
25
- #include "ares.h"
26
- #include "ares_private.h" /* for the memdebug */
27
-
28
- /* Simply decodes a length-encoded character string. The first byte of the
29
- * input is the length of the string to be returned and the bytes thereafter
30
- * are the characters of the string. The returned result will be NULL
31
- * terminated.
32
- */
33
- int ares_expand_string(const unsigned char *encoded,
34
- const unsigned char *abuf,
35
- int alen,
36
- unsigned char **s,
37
- long *enclen)
38
- {
39
- unsigned char *q;
40
- union {
41
- ares_ssize_t sig;
42
- size_t uns;
43
- } elen;
44
-
45
- if (encoded == abuf+alen)
46
- return ARES_EBADSTR;
47
-
48
- elen.uns = *encoded;
49
- if (encoded+elen.sig+1 > abuf+alen)
50
- return ARES_EBADSTR;
51
-
52
- encoded++;
53
-
54
- *s = ares_malloc(elen.uns+1);
55
- if (*s == NULL)
56
- return ARES_ENOMEM;
57
- q = *s;
58
- strncpy((char *)q, (char *)encoded, elen.uns);
59
- q[elen.uns] = '\0';
60
-
61
- *s = q;
62
-
63
- *enclen = (long)(elen.sig+1);
64
-
65
- return ARES_SUCCESS;
66
- }
67
-
@@ -1,59 +0,0 @@
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
- #include "ares.h"
20
- #include "ares_nowarn.h"
21
- #include "ares_private.h"
22
-
23
- int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
24
- {
25
- struct server_state *server;
26
- ares_socket_t nfds;
27
- int i;
28
-
29
- /* Are there any active queries? */
30
- int active_queries = !ares__is_list_empty(&(channel->all_queries));
31
-
32
- nfds = 0;
33
- for (i = 0; i < channel->nservers; i++)
34
- {
35
- server = &channel->servers[i];
36
- /* We only need to register interest in UDP sockets if we have
37
- * outstanding queries.
38
- */
39
- if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
40
- {
41
- FD_SET(server->udp_socket, read_fds);
42
- if (server->udp_socket >= nfds)
43
- nfds = server->udp_socket + 1;
44
- }
45
- /* We always register for TCP events, because we want to know
46
- * when the other side closes the connection, so we don't waste
47
- * time trying to use a broken connection.
48
- */
49
- if (server->tcp_socket != ARES_SOCKET_BAD)
50
- {
51
- FD_SET(server->tcp_socket, read_fds);
52
- if (server->qhead)
53
- FD_SET(server->tcp_socket, write_fds);
54
- if (server->tcp_socket >= nfds)
55
- nfds = server->tcp_socket + 1;
56
- }
57
- }
58
- return (int)nfds;
59
- }
@@ -1,66 +0,0 @@
1
-
2
- /* Copyright (C) 2005 - 2010, Daniel Stenberg
3
- *
4
- * Permission to use, copy, modify, and distribute this software and its
5
- * documentation for any purpose and without fee is hereby granted, provided
6
- * that the above copyright notice appear in all copies and that both that
7
- * copyright notice and this permission notice appear in supporting
8
- * documentation, and that the name of M.I.T. not be used in advertising or
9
- * publicity pertaining to distribution of the software without specific,
10
- * written prior permission. M.I.T. makes no representations about the
11
- * suitability of this software for any purpose. It is provided "as is"
12
- * without express or implied warranty.
13
- */
14
-
15
- #include "ares_setup.h"
16
-
17
- #include "ares.h"
18
- #include "ares_private.h"
19
-
20
- int ares_getsock(ares_channel channel,
21
- ares_socket_t *socks,
22
- int numsocks) /* size of the 'socks' array */
23
- {
24
- struct server_state *server;
25
- int i;
26
- int sockindex=0;
27
- int bitmap = 0;
28
- unsigned int setbits = 0xffffffff;
29
-
30
- /* Are there any active queries? */
31
- int active_queries = !ares__is_list_empty(&(channel->all_queries));
32
-
33
- for (i = 0; i < channel->nservers; i++)
34
- {
35
- server = &channel->servers[i];
36
- /* We only need to register interest in UDP sockets if we have
37
- * outstanding queries.
38
- */
39
- if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
40
- {
41
- if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM)
42
- break;
43
- socks[sockindex] = server->udp_socket;
44
- bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
45
- sockindex++;
46
- }
47
- /* We always register for TCP events, because we want to know
48
- * when the other side closes the connection, so we don't waste
49
- * time trying to use a broken connection.
50
- */
51
- if (server->tcp_socket != ARES_SOCKET_BAD)
52
- {
53
- if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM)
54
- break;
55
- socks[sockindex] = server->tcp_socket;
56
- bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
57
-
58
- if (server->qhead && active_queries)
59
- /* then the tcp socket is also writable! */
60
- bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex);
61
-
62
- sockindex++;
63
- }
64
- }
65
- return bitmap;
66
- }