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.
- checksums.yaml +4 -4
- data/Makefile +83 -41
- data/include/grpc/credentials.h +7 -1
- data/src/core/call/client_call.cc +4 -4
- data/src/core/call/filter_fusion.h +1230 -0
- data/src/core/call/metadata.cc +22 -0
- data/src/core/call/metadata.h +24 -2
- data/src/core/channelz/channelz.cc +10 -17
- data/src/core/channelz/channelz.h +58 -19
- data/src/core/channelz/channelz_registry.cc +0 -162
- data/src/core/channelz/channelz_registry.h +14 -7
- data/src/core/channelz/property_list.cc +19 -23
- data/src/core/channelz/property_list.h +3 -1
- data/src/core/channelz/v2tov1/convert.cc +683 -0
- data/src/core/channelz/v2tov1/convert.h +58 -0
- data/src/core/channelz/v2tov1/legacy_api.cc +425 -0
- data/src/core/channelz/v2tov1/legacy_api.h +32 -0
- data/src/core/channelz/v2tov1/property_list.cc +118 -0
- data/src/core/channelz/v2tov1/property_list.h +52 -0
- data/src/core/client_channel/client_channel_filter.cc +5 -4
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_internal.h +2 -1
- data/src/core/client_channel/load_balanced_call_destination.cc +6 -5
- data/src/core/client_channel/subchannel.cc +14 -6
- data/src/core/client_channel/subchannel.h +2 -0
- data/src/core/config/core_configuration.cc +3 -1
- data/src/core/config/core_configuration.h +12 -0
- data/src/core/credentials/transport/alts/alts_credentials.cc +5 -0
- data/src/core/credentials/transport/alts/check_gcp_environment_windows.cc +2 -0
- data/src/core/credentials/transport/channel_creds_registry_init.cc +3 -1
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +1 -1
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +8 -3
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -24
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +19 -8
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +96 -54
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +15 -2
- data/src/core/credentials/transport/tls/spiffe_utils.cc +371 -0
- data/src/core/credentials/transport/tls/spiffe_utils.h +171 -0
- data/src/core/credentials/transport/tls/ssl_utils.cc +11 -10
- data/src/core/credentials/transport/tls/ssl_utils.h +4 -2
- data/src/core/credentials/transport/tls/tls_credentials.cc +2 -0
- data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -26
- data/src/core/credentials/transport/tls/tls_security_connector.h +12 -12
- data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -2
- data/src/core/ext/filters/http/client/http_client_filter.cc +3 -6
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
- data/src/core/ext/filters/http/server/http_server_filter.cc +3 -6
- data/src/core/ext/filters/message_size/message_size_filter.cc +4 -4
- data/src/core/ext/filters/rbac/rbac_filter.cc +1 -1
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +3 -5
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame.cc +89 -6
- data/src/core/ext/transport/chttp2/transport/frame.h +38 -0
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +5 -14
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +4 -1
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +294 -78
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +128 -9
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +11 -38
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +52 -35
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +61 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +142 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +81 -3
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +12 -1
- data/src/core/ext/transport/chttp2/transport/message_assembler.h +2 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +22 -5
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +607 -0
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +254 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +6 -4
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb.h +4959 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.c +1111 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/channelz.upb_minitable.h +108 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb.h +142 -54
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.c +18 -14
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/property_list.upb_minitable.h +2 -2
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +716 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.h +227 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.c +86 -88
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/property_list.upbdefs.h +2 -2
- data/src/core/filter/auth/auth_filters.h +2 -2
- data/src/core/filter/fused_filters.cc +154 -0
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +1 -1
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +965 -0
- data/src/core/handshaker/security/secure_endpoint.cc +28 -13
- data/src/core/handshaker/security/secure_endpoint.h +8 -0
- data/src/core/lib/channel/promise_based_filter.cc +15 -25
- data/src/core/lib/channel/promise_based_filter.h +6 -5
- data/src/core/lib/event_engine/ares_resolver.h +3 -1
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +9 -5
- data/src/core/lib/event_engine/cf_engine/cf_engine.h +2 -1
- data/src/core/lib/event_engine/cf_engine/cfsocket_listener.cc +263 -0
- data/src/core/lib/event_engine/cf_engine/cfsocket_listener.h +107 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +31 -3
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +12 -0
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +12 -10
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.h +6 -4
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +15 -14
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +7 -5
- data/src/core/lib/event_engine/posix_engine/event_poller.h +0 -8
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.cc +11 -5
- data/src/core/lib/event_engine/posix_engine/event_poller_posix_default.h +3 -2
- data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +1 -0
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +4 -4
- data/src/core/lib/event_engine/posix_engine/lockfree_event.h +3 -4
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +188 -199
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +30 -45
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +1 -1
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +2 -1
- data/src/core/lib/experiments/experiments.cc +120 -6
- data/src/core/lib/experiments/experiments.h +46 -3
- data/src/core/lib/iomgr/combiner.cc +1 -1
- data/src/core/lib/iomgr/exec_ctx.h +3 -9
- data/src/core/lib/iomgr/socket_mutator.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +1 -1
- data/src/core/lib/iomgr/tcp_client_posix.cc +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +3 -3
- data/src/core/lib/promise/activity.h +2 -2
- data/src/core/lib/promise/mpsc.cc +8 -8
- data/src/core/lib/promise/party.cc +7 -7
- data/src/core/lib/promise/party.h +4 -4
- data/src/core/lib/promise/poll.h +10 -0
- data/src/core/lib/resource_quota/memory_quota.cc +90 -3
- data/src/core/lib/resource_quota/memory_quota.h +20 -9
- data/src/core/lib/resource_quota/periodic_update.cc +14 -0
- data/src/core/lib/resource_quota/periodic_update.h +8 -0
- data/src/core/lib/resource_quota/resource_quota.cc +15 -4
- data/src/core/lib/resource_quota/resource_quota.h +3 -0
- data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +1 -2
- data/src/core/lib/surface/call.cc +5 -5
- data/src/core/lib/surface/call.h +6 -5
- data/src/core/lib/surface/completion_queue.cc +2 -4
- data/src/core/lib/surface/filter_stack_call.cc +1 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/promise_endpoint.cc +2 -2
- data/src/core/lib/transport/promise_endpoint.h +3 -3
- data/src/core/load_balancing/endpoint_list.cc +29 -2
- data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +3 -3
- data/src/core/load_balancing/grpclb/client_load_reporting_filter.h +1 -1
- data/src/core/load_balancing/pick_first/pick_first.cc +12 -5
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +5 -3
- data/src/core/net/socket_mutator.cc +19 -0
- data/src/core/net/socket_mutator.h +25 -0
- data/src/core/plugin_registry/grpc_plugin_registry.cc +6 -0
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +6 -1
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +2 -1
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +8 -5
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -1
- data/src/core/resolver/xds/xds_dependency_manager.cc +1 -1
- data/src/core/server/server.cc +1 -1
- data/src/core/server/server_call_tracer_filter.cc +0 -66
- data/src/core/server/server_call_tracer_filter.h +64 -0
- data/src/core/server/server_config_selector_filter.cc +1 -1
- data/src/core/service_config/service_config_channel_arg_filter.cc +3 -60
- data/src/core/service_config/service_config_channel_arg_filter.h +82 -0
- data/src/core/telemetry/call_tracer.cc +20 -14
- data/src/core/telemetry/call_tracer.h +22 -17
- data/src/core/telemetry/metrics.h +8 -8
- data/src/core/telemetry/stats_data.cc +151 -151
- data/src/core/telemetry/stats_data.h +87 -87
- data/src/core/transport/auth_context.cc +20 -0
- data/src/core/transport/auth_context.h +4 -0
- data/src/core/transport/auth_context_comparator_registry.h +69 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +2 -3
- data/src/core/tsi/ssl_transport_security.cc +202 -32
- data/src/core/tsi/ssl_transport_security.h +19 -10
- data/src/core/tsi/ssl_transport_security_utils.cc +21 -0
- data/src/core/tsi/ssl_transport_security_utils.h +4 -0
- data/src/core/util/http_client/httpcli_security_connector.cc +3 -1
- data/src/core/util/latent_see.cc +178 -146
- data/src/core/util/latent_see.h +245 -188
- data/src/core/util/single_set_ptr.h +5 -2
- data/src/core/util/useful.h +91 -0
- data/src/core/util/windows/directory_reader.cc +1 -0
- data/src/core/util/windows/thd.cc +1 -3
- data/src/core/util/work_serializer.cc +1 -1
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +32 -5
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +5 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +5 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/cares/cares/include/ares.h +925 -460
- data/third_party/cares/cares/include/ares_dns.h +86 -71
- data/third_party/cares/cares/include/ares_dns_record.h +1118 -0
- data/third_party/cares/cares/include/ares_nameser.h +215 -189
- data/third_party/cares/cares/include/ares_version.h +37 -14
- data/third_party/cares/cares/src/lib/ares_addrinfo2hostent.c +305 -0
- data/third_party/cares/cares/src/lib/ares_addrinfo_localhost.c +245 -0
- data/third_party/cares/cares/src/lib/ares_android.c +216 -164
- data/third_party/cares/cares/src/lib/ares_android.h +25 -14
- data/third_party/cares/cares/src/lib/ares_cancel.c +68 -44
- data/third_party/cares/cares/src/lib/ares_close_sockets.c +137 -0
- data/third_party/cares/cares/src/lib/ares_conn.c +511 -0
- data/third_party/cares/cares/src/lib/ares_conn.h +196 -0
- data/third_party/cares/cares/src/lib/ares_cookie.c +461 -0
- data/third_party/cares/cares/src/lib/ares_data.c +93 -181
- data/third_party/cares/cares/src/lib/ares_data.h +50 -39
- data/third_party/cares/cares/src/lib/ares_destroy.c +127 -89
- data/third_party/cares/cares/src/lib/ares_free_hostent.c +35 -24
- data/third_party/cares/cares/src/lib/ares_free_string.c +24 -16
- data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +45 -38
- data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +549 -663
- data/third_party/cares/cares/src/lib/ares_getenv.c +25 -15
- data/third_party/cares/cares/src/lib/ares_getenv.h +26 -18
- data/third_party/cares/cares/src/lib/ares_gethostbyaddr.c +163 -221
- data/third_party/cares/cares/src/lib/ares_gethostbyname.c +222 -223
- data/third_party/cares/cares/src/lib/ares_getnameinfo.c +328 -338
- data/third_party/cares/cares/src/lib/ares_hosts_file.c +952 -0
- data/third_party/cares/cares/src/lib/ares_inet_net_pton.h +25 -19
- data/third_party/cares/cares/src/lib/ares_init.c +425 -2091
- data/third_party/cares/cares/src/lib/ares_ipv6.h +63 -33
- data/third_party/cares/cares/src/lib/ares_library_init.c +110 -54
- data/third_party/cares/cares/src/lib/ares_metrics.c +261 -0
- data/third_party/cares/cares/src/lib/ares_options.c +418 -332
- data/third_party/cares/cares/src/lib/ares_parse_into_addrinfo.c +179 -0
- data/third_party/cares/cares/src/lib/ares_private.h +558 -356
- data/third_party/cares/cares/src/lib/ares_process.c +1224 -1369
- data/third_party/cares/cares/src/lib/ares_qcache.c +430 -0
- data/third_party/cares/cares/src/lib/ares_query.c +126 -121
- data/third_party/cares/cares/src/lib/ares_search.c +564 -262
- data/third_party/cares/cares/src/lib/ares_send.c +264 -93
- data/third_party/cares/cares/src/lib/ares_set_socket_functions.c +588 -0
- data/third_party/cares/cares/src/lib/ares_setup.h +115 -111
- data/third_party/cares/cares/src/lib/ares_socket.c +425 -0
- data/third_party/cares/cares/src/lib/ares_socket.h +163 -0
- data/third_party/cares/cares/src/lib/ares_sortaddrinfo.c +447 -0
- data/third_party/cares/cares/src/lib/ares_strerror.c +83 -48
- data/third_party/cares/cares/src/lib/ares_sysconfig.c +639 -0
- data/third_party/cares/cares/src/lib/ares_sysconfig_files.c +839 -0
- data/third_party/cares/cares/src/lib/ares_sysconfig_mac.c +373 -0
- data/third_party/cares/cares/src/lib/ares_sysconfig_win.c +621 -0
- data/third_party/cares/cares/src/lib/ares_timeout.c +136 -73
- data/third_party/cares/cares/src/lib/ares_update_servers.c +1362 -0
- data/third_party/cares/cares/src/lib/ares_version.c +29 -4
- data/third_party/cares/cares/src/lib/config-dos.h +88 -89
- data/third_party/cares/cares/src/lib/config-win32.h +122 -77
- data/third_party/cares/cares/src/lib/dsa/ares_array.c +394 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable.c +447 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable.h +174 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_asvp.c +224 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_dict.c +228 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_strvp.c +210 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_szvp.c +188 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_vpstr.c +186 -0
- data/third_party/cares/cares/src/lib/dsa/ares_htable_vpvp.c +194 -0
- data/third_party/cares/cares/src/lib/dsa/ares_llist.c +382 -0
- data/third_party/cares/cares/src/lib/dsa/ares_slist.c +479 -0
- data/third_party/cares/cares/src/lib/dsa/ares_slist.h +207 -0
- data/third_party/cares/cares/src/lib/event/ares_event.h +191 -0
- data/third_party/cares/cares/src/lib/event/ares_event_configchg.c +743 -0
- data/third_party/cares/cares/src/lib/event/ares_event_epoll.c +192 -0
- data/third_party/cares/cares/src/lib/event/ares_event_kqueue.c +248 -0
- data/third_party/cares/cares/src/lib/event/ares_event_poll.c +140 -0
- data/third_party/cares/cares/src/lib/event/ares_event_select.c +159 -0
- data/third_party/cares/cares/src/lib/event/ares_event_thread.c +567 -0
- data/third_party/cares/cares/src/lib/event/ares_event_wake_pipe.c +166 -0
- data/third_party/cares/cares/src/lib/event/ares_event_win32.c +978 -0
- data/third_party/cares/cares/src/lib/event/ares_event_win32.h +161 -0
- data/third_party/cares/cares/src/lib/include/ares_array.h +276 -0
- data/third_party/cares/cares/src/lib/include/ares_buf.h +732 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_asvp.h +130 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_dict.h +123 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_strvp.h +130 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_szvp.h +118 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_vpstr.h +111 -0
- data/third_party/cares/cares/src/lib/include/ares_htable_vpvp.h +128 -0
- data/third_party/cares/cares/src/lib/include/ares_llist.h +239 -0
- data/third_party/cares/cares/src/lib/include/ares_mem.h +38 -0
- data/third_party/cares/cares/src/lib/include/ares_str.h +244 -0
- data/third_party/cares/cares/src/lib/inet_net_pton.c +202 -157
- data/third_party/cares/cares/src/lib/inet_ntop.c +87 -69
- data/third_party/cares/cares/src/lib/legacy/ares_create_query.c +78 -0
- data/third_party/cares/cares/src/lib/legacy/ares_expand_name.c +99 -0
- data/third_party/cares/cares/src/lib/legacy/ares_expand_string.c +107 -0
- data/third_party/cares/cares/src/lib/legacy/ares_fds.c +80 -0
- data/third_party/cares/cares/src/lib/legacy/ares_getsock.c +85 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_a_reply.c +107 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_aaaa_reply.c +109 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_caa_reply.c +137 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_mx_reply.c +110 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_naptr_reply.c +132 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_ns_reply.c +154 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_ptr_reply.c +213 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_soa_reply.c +115 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_srv_reply.c +114 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_txt_reply.c +144 -0
- data/third_party/cares/cares/src/lib/legacy/ares_parse_uri_reply.c +113 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_mapping.c +982 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_multistring.c +307 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_multistring.h +72 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_name.c +673 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_parse.c +1329 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_private.h +273 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_record.c +1661 -0
- data/third_party/cares/cares/src/lib/record/ares_dns_write.c +1229 -0
- data/third_party/cares/cares/src/lib/str/ares_buf.c +1498 -0
- data/third_party/cares/cares/src/lib/str/ares_str.c +508 -0
- data/third_party/cares/cares/src/lib/str/ares_strsplit.c +90 -0
- data/third_party/cares/cares/src/lib/str/ares_strsplit.h +51 -0
- data/third_party/cares/cares/src/lib/thirdparty/apple/dnsinfo.h +122 -0
- data/third_party/cares/cares/src/lib/util/ares_iface_ips.c +628 -0
- data/third_party/cares/cares/src/lib/util/ares_iface_ips.h +139 -0
- data/third_party/cares/cares/src/lib/util/ares_math.c +158 -0
- data/third_party/cares/cares/src/lib/util/ares_math.h +45 -0
- data/third_party/cares/cares/src/lib/util/ares_rand.c +389 -0
- data/third_party/cares/cares/src/lib/util/ares_rand.h +36 -0
- data/third_party/cares/cares/src/lib/util/ares_threads.c +614 -0
- data/third_party/cares/cares/src/lib/util/ares_threads.h +60 -0
- data/third_party/cares/cares/src/lib/util/ares_time.h +48 -0
- data/third_party/cares/cares/src/lib/util/ares_timeval.c +95 -0
- data/third_party/cares/cares/src/lib/util/ares_uri.c +1626 -0
- data/third_party/cares/cares/src/lib/util/ares_uri.h +252 -0
- data/third_party/cares/cares/src/lib/windows_port.c +16 -9
- metadata +121 -49
- data/src/core/util/ring_buffer.h +0 -122
- data/third_party/cares/cares/include/ares_rules.h +0 -125
- data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +0 -266
- data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +0 -240
- data/third_party/cares/cares/src/lib/ares__close_sockets.c +0 -61
- data/third_party/cares/cares/src/lib/ares__get_hostent.c +0 -260
- data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +0 -229
- data/third_party/cares/cares/src/lib/ares__read_line.c +0 -73
- data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +0 -258
- data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +0 -507
- data/third_party/cares/cares/src/lib/ares__timeval.c +0 -111
- data/third_party/cares/cares/src/lib/ares_create_query.c +0 -197
- data/third_party/cares/cares/src/lib/ares_expand_name.c +0 -311
- data/third_party/cares/cares/src/lib/ares_expand_string.c +0 -67
- data/third_party/cares/cares/src/lib/ares_fds.c +0 -59
- data/third_party/cares/cares/src/lib/ares_getsock.c +0 -66
- data/third_party/cares/cares/src/lib/ares_iphlpapi.h +0 -221
- data/third_party/cares/cares/src/lib/ares_llist.c +0 -63
- data/third_party/cares/cares/src/lib/ares_llist.h +0 -39
- data/third_party/cares/cares/src/lib/ares_mkquery.c +0 -24
- data/third_party/cares/cares/src/lib/ares_nowarn.c +0 -260
- data/third_party/cares/cares/src/lib/ares_nowarn.h +0 -61
- data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +0 -90
- data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +0 -92
- data/third_party/cares/cares/src/lib/ares_parse_caa_reply.c +0 -199
- data/third_party/cares/cares/src/lib/ares_parse_mx_reply.c +0 -164
- data/third_party/cares/cares/src/lib/ares_parse_naptr_reply.c +0 -183
- data/third_party/cares/cares/src/lib/ares_parse_ns_reply.c +0 -177
- data/third_party/cares/cares/src/lib/ares_parse_ptr_reply.c +0 -228
- data/third_party/cares/cares/src/lib/ares_parse_soa_reply.c +0 -179
- data/third_party/cares/cares/src/lib/ares_parse_srv_reply.c +0 -168
- data/third_party/cares/cares/src/lib/ares_parse_txt_reply.c +0 -214
- data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +0 -184
- data/third_party/cares/cares/src/lib/ares_platform.c +0 -11042
- data/third_party/cares/cares/src/lib/ares_platform.h +0 -43
- data/third_party/cares/cares/src/lib/ares_rand.c +0 -279
- data/third_party/cares/cares/src/lib/ares_strcasecmp.c +0 -66
- data/third_party/cares/cares/src/lib/ares_strcasecmp.h +0 -30
- data/third_party/cares/cares/src/lib/ares_strdup.c +0 -42
- data/third_party/cares/cares/src/lib/ares_strdup.h +0 -24
- data/third_party/cares/cares/src/lib/ares_strsplit.c +0 -94
- data/third_party/cares/cares/src/lib/ares_strsplit.h +0 -42
- data/third_party/cares/cares/src/lib/ares_writev.c +0 -79
- data/third_party/cares/cares/src/lib/ares_writev.h +0 -36
- data/third_party/cares/cares/src/lib/bitncmp.c +0 -59
- data/third_party/cares/cares/src/lib/bitncmp.h +0 -26
- data/third_party/cares/cares/src/lib/setup_once.h +0 -554
- data/third_party/cares/cares/src/tools/ares_getopt.h +0 -53
data/src/core/util/ring_buffer.h
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
// Copyright 2024 gRPC authors.
|
2
|
-
//
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
// you may not use this file except in compliance with the License.
|
5
|
-
// You may obtain a copy of the License at
|
6
|
-
//
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
//
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
// See the License for the specific language governing permissions and
|
13
|
-
// limitations under the License.
|
14
|
-
|
15
|
-
#ifndef GRPC_SRC_CORE_UTIL_RING_BUFFER_H
|
16
|
-
#define GRPC_SRC_CORE_UTIL_RING_BUFFER_H
|
17
|
-
|
18
|
-
#include <grpc/support/port_platform.h>
|
19
|
-
|
20
|
-
#include <array>
|
21
|
-
#include <cstddef>
|
22
|
-
#include <iterator>
|
23
|
-
#include <optional>
|
24
|
-
|
25
|
-
namespace grpc_core {
|
26
|
-
|
27
|
-
template <typename T, int kCapacity>
|
28
|
-
class RingBuffer {
|
29
|
-
public:
|
30
|
-
class RingBufferIterator {
|
31
|
-
public:
|
32
|
-
using iterator_category = std::forward_iterator_tag;
|
33
|
-
using value_type = const T;
|
34
|
-
using pointer = void;
|
35
|
-
using reference = void;
|
36
|
-
using difference_type = std::ptrdiff_t;
|
37
|
-
|
38
|
-
RingBufferIterator& operator++() {
|
39
|
-
if (--size_ <= 0) {
|
40
|
-
head_ = 0;
|
41
|
-
size_ = 0;
|
42
|
-
buffer_ = nullptr;
|
43
|
-
} else {
|
44
|
-
head_ = (head_ + 1) % kCapacity;
|
45
|
-
}
|
46
|
-
return *this;
|
47
|
-
}
|
48
|
-
|
49
|
-
RingBufferIterator operator++(int) {
|
50
|
-
RingBufferIterator tmp(*this);
|
51
|
-
operator++();
|
52
|
-
return tmp;
|
53
|
-
}
|
54
|
-
|
55
|
-
bool operator==(const RingBufferIterator& rhs) const {
|
56
|
-
return (buffer_ == rhs.buffer_ && head_ == rhs.head_ &&
|
57
|
-
size_ == rhs.size_);
|
58
|
-
}
|
59
|
-
|
60
|
-
bool operator!=(const RingBufferIterator& rhs) const {
|
61
|
-
return !operator==(rhs);
|
62
|
-
}
|
63
|
-
|
64
|
-
T operator*() { return buffer_->data_[head_]; }
|
65
|
-
|
66
|
-
RingBufferIterator() : buffer_(nullptr), head_(0), size_(0) {};
|
67
|
-
RingBufferIterator(const RingBufferIterator& other) = default;
|
68
|
-
explicit RingBufferIterator(const RingBuffer<T, kCapacity>* buffer)
|
69
|
-
: buffer_(buffer), head_(buffer->head_), size_(buffer->size_) {
|
70
|
-
if (!size_) {
|
71
|
-
buffer_ = nullptr;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
|
75
|
-
private:
|
76
|
-
friend class RingBuffer<T, kCapacity>;
|
77
|
-
const RingBuffer<T, kCapacity>* buffer_;
|
78
|
-
int head_ = 0;
|
79
|
-
int size_ = 0;
|
80
|
-
};
|
81
|
-
|
82
|
-
RingBuffer() = default;
|
83
|
-
|
84
|
-
void Append(T data) {
|
85
|
-
if (size_ < kCapacity) {
|
86
|
-
data_[size_] = std::move(data);
|
87
|
-
size_++;
|
88
|
-
} else {
|
89
|
-
data_[head_] = std::move(data);
|
90
|
-
head_ = (head_ + 1) % kCapacity;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
// Returns the data of the first element in the buffer and removes it from
|
95
|
-
// the buffer. If the buffer is empty, returns std::nullopt.
|
96
|
-
std::optional<T> PopIfNotEmpty() {
|
97
|
-
if (!size_) return std::nullopt;
|
98
|
-
T data = std::move(data_[head_]);
|
99
|
-
--size_;
|
100
|
-
head_ = (head_ + 1) % kCapacity;
|
101
|
-
return data;
|
102
|
-
}
|
103
|
-
|
104
|
-
void Clear() {
|
105
|
-
head_ = 0;
|
106
|
-
size_ = 0;
|
107
|
-
}
|
108
|
-
|
109
|
-
RingBufferIterator begin() const { return RingBufferIterator(this); }
|
110
|
-
|
111
|
-
RingBufferIterator end() const { return RingBufferIterator(); }
|
112
|
-
|
113
|
-
private:
|
114
|
-
friend class RingBufferIterator;
|
115
|
-
std::array<T, kCapacity> data_;
|
116
|
-
int head_ = 0;
|
117
|
-
int size_ = 0;
|
118
|
-
};
|
119
|
-
|
120
|
-
} // namespace grpc_core
|
121
|
-
|
122
|
-
#endif // GRPC_SRC_CORE_UTIL_RING_BUFFER_H
|
@@ -1,125 +0,0 @@
|
|
1
|
-
#ifndef __CARES_RULES_H
|
2
|
-
#define __CARES_RULES_H
|
3
|
-
|
4
|
-
|
5
|
-
/* Copyright (C) 2009 - 2021 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://lists.haxx.se/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 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 */
|
@@ -1,266 +0,0 @@
|
|
1
|
-
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
2
|
-
* Copyright 2005 Dominick Meglio
|
3
|
-
* Copyright (C) 2019 by Andrew Selivanov
|
4
|
-
* Copyright (C) 2021 by Brad House
|
5
|
-
*
|
6
|
-
* Permission to use, copy, modify, and distribute this
|
7
|
-
* software and its documentation for any purpose and without
|
8
|
-
* fee is hereby granted, provided that the above copyright
|
9
|
-
* notice appear in all copies and that both that copyright
|
10
|
-
* notice and this permission notice appear in supporting
|
11
|
-
* documentation, and that the name of M.I.T. not be used in
|
12
|
-
* advertising or publicity pertaining to distribution of the
|
13
|
-
* software without specific, written prior permission.
|
14
|
-
* M.I.T. makes no representations about the suitability of
|
15
|
-
* this software for any purpose. It is provided "as is"
|
16
|
-
* without express or implied warranty.
|
17
|
-
*/
|
18
|
-
|
19
|
-
#include "ares_setup.h"
|
20
|
-
|
21
|
-
#ifdef HAVE_NETINET_IN_H
|
22
|
-
# include <netinet/in.h>
|
23
|
-
#endif
|
24
|
-
#ifdef HAVE_NETDB_H
|
25
|
-
# include <netdb.h>
|
26
|
-
#endif
|
27
|
-
#ifdef HAVE_ARPA_INET_H
|
28
|
-
# include <arpa/inet.h>
|
29
|
-
#endif
|
30
|
-
|
31
|
-
#include "ares_nameser.h"
|
32
|
-
|
33
|
-
#ifdef HAVE_STRINGS_H
|
34
|
-
# include <strings.h>
|
35
|
-
#endif
|
36
|
-
|
37
|
-
#ifdef HAVE_LIMITS_H
|
38
|
-
# include <limits.h>
|
39
|
-
#endif
|
40
|
-
|
41
|
-
#include "ares.h"
|
42
|
-
#include "ares_dns.h"
|
43
|
-
#include "ares_inet_net_pton.h"
|
44
|
-
#include "ares_private.h"
|
45
|
-
|
46
|
-
int ares__addrinfo2hostent(const struct ares_addrinfo *ai, int family,
|
47
|
-
struct hostent **host)
|
48
|
-
{
|
49
|
-
struct ares_addrinfo_node *next;
|
50
|
-
struct ares_addrinfo_cname *next_cname;
|
51
|
-
char **aliases = NULL;
|
52
|
-
char *addrs = NULL;
|
53
|
-
int naliases = 0, naddrs = 0, alias = 0, i;
|
54
|
-
|
55
|
-
if (ai == NULL || host == NULL)
|
56
|
-
return ARES_EBADQUERY;
|
57
|
-
|
58
|
-
*host = ares_malloc(sizeof(**host));
|
59
|
-
if (!(*host))
|
60
|
-
{
|
61
|
-
goto enomem;
|
62
|
-
}
|
63
|
-
memset(*host, 0, sizeof(**host));
|
64
|
-
|
65
|
-
/* Use the first node of the response as the family, since hostent can only
|
66
|
-
* represent one family. We assume getaddrinfo() returned a sorted list if
|
67
|
-
* the user requested AF_UNSPEC. */
|
68
|
-
if (family == AF_UNSPEC && ai->nodes)
|
69
|
-
family = ai->nodes->ai_family;
|
70
|
-
|
71
|
-
next = ai->nodes;
|
72
|
-
while (next)
|
73
|
-
{
|
74
|
-
if(next->ai_family == family)
|
75
|
-
{
|
76
|
-
++naddrs;
|
77
|
-
}
|
78
|
-
next = next->ai_next;
|
79
|
-
}
|
80
|
-
|
81
|
-
next_cname = ai->cnames;
|
82
|
-
while (next_cname)
|
83
|
-
{
|
84
|
-
if(next_cname->alias)
|
85
|
-
++naliases;
|
86
|
-
next_cname = next_cname->next;
|
87
|
-
}
|
88
|
-
|
89
|
-
aliases = ares_malloc((naliases + 1) * sizeof(char *));
|
90
|
-
if (!aliases)
|
91
|
-
{
|
92
|
-
goto enomem;
|
93
|
-
}
|
94
|
-
(*host)->h_aliases = aliases;
|
95
|
-
memset(aliases, 0, (naliases + 1) * sizeof(char *));
|
96
|
-
|
97
|
-
if (naliases)
|
98
|
-
{
|
99
|
-
next_cname = ai->cnames;
|
100
|
-
while (next_cname)
|
101
|
-
{
|
102
|
-
if(next_cname->alias) {
|
103
|
-
aliases[alias] = ares_strdup(next_cname->alias);
|
104
|
-
if (!aliases[alias]) {
|
105
|
-
goto enomem;
|
106
|
-
}
|
107
|
-
alias++;
|
108
|
-
}
|
109
|
-
next_cname = next_cname->next;
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
|
114
|
-
(*host)->h_addr_list = ares_malloc((naddrs + 1) * sizeof(char *));
|
115
|
-
if (!(*host)->h_addr_list)
|
116
|
-
{
|
117
|
-
goto enomem;
|
118
|
-
}
|
119
|
-
|
120
|
-
memset((*host)->h_addr_list, 0, (naddrs + 1) * sizeof(char *));
|
121
|
-
|
122
|
-
if (ai->cnames)
|
123
|
-
{
|
124
|
-
(*host)->h_name = ares_strdup(ai->cnames->name);
|
125
|
-
if ((*host)->h_name == NULL && ai->cnames->name)
|
126
|
-
{
|
127
|
-
goto enomem;
|
128
|
-
}
|
129
|
-
}
|
130
|
-
else
|
131
|
-
{
|
132
|
-
(*host)->h_name = ares_strdup(ai->name);
|
133
|
-
if ((*host)->h_name == NULL && ai->name)
|
134
|
-
{
|
135
|
-
goto enomem;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
(*host)->h_addrtype = family;
|
140
|
-
(*host)->h_length = (family == AF_INET)?
|
141
|
-
sizeof(struct in_addr):sizeof(struct ares_in6_addr);
|
142
|
-
|
143
|
-
if (naddrs)
|
144
|
-
{
|
145
|
-
addrs = ares_malloc(naddrs * (*host)->h_length);
|
146
|
-
if (!addrs)
|
147
|
-
{
|
148
|
-
goto enomem;
|
149
|
-
}
|
150
|
-
|
151
|
-
i = 0;
|
152
|
-
next = ai->nodes;
|
153
|
-
while (next)
|
154
|
-
{
|
155
|
-
if(next->ai_family == family)
|
156
|
-
{
|
157
|
-
(*host)->h_addr_list[i] = addrs + (i * (*host)->h_length);
|
158
|
-
if (family == AF_INET6)
|
159
|
-
{
|
160
|
-
memcpy((*host)->h_addr_list[i],
|
161
|
-
&(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr),
|
162
|
-
(*host)->h_length);
|
163
|
-
}
|
164
|
-
else
|
165
|
-
{
|
166
|
-
memcpy((*host)->h_addr_list[i],
|
167
|
-
&(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr),
|
168
|
-
(*host)->h_length);
|
169
|
-
}
|
170
|
-
++i;
|
171
|
-
}
|
172
|
-
next = next->ai_next;
|
173
|
-
}
|
174
|
-
|
175
|
-
if (i == 0)
|
176
|
-
{
|
177
|
-
ares_free(addrs);
|
178
|
-
}
|
179
|
-
}
|
180
|
-
|
181
|
-
if (naddrs == 0 && naliases == 0)
|
182
|
-
{
|
183
|
-
ares_free_hostent(*host);
|
184
|
-
*host = NULL;
|
185
|
-
return ARES_ENODATA;
|
186
|
-
}
|
187
|
-
|
188
|
-
return ARES_SUCCESS;
|
189
|
-
|
190
|
-
enomem:
|
191
|
-
ares_free_hostent(*host);
|
192
|
-
*host = NULL;
|
193
|
-
return ARES_ENOMEM;
|
194
|
-
}
|
195
|
-
|
196
|
-
|
197
|
-
int ares__addrinfo2addrttl(const struct ares_addrinfo *ai, int family,
|
198
|
-
int req_naddrttls, struct ares_addrttl *addrttls,
|
199
|
-
struct ares_addr6ttl *addr6ttls, int *naddrttls)
|
200
|
-
{
|
201
|
-
struct ares_addrinfo_node *next;
|
202
|
-
struct ares_addrinfo_cname *next_cname;
|
203
|
-
int cname_ttl = INT_MAX;
|
204
|
-
|
205
|
-
if (family != AF_INET && family != AF_INET6)
|
206
|
-
return ARES_EBADQUERY;
|
207
|
-
|
208
|
-
if (ai == NULL || naddrttls == NULL)
|
209
|
-
return ARES_EBADQUERY;
|
210
|
-
|
211
|
-
if (family == AF_INET && addrttls == NULL)
|
212
|
-
return ARES_EBADQUERY;
|
213
|
-
|
214
|
-
if (family == AF_INET6 && addr6ttls == NULL)
|
215
|
-
return ARES_EBADQUERY;
|
216
|
-
|
217
|
-
if (req_naddrttls == 0)
|
218
|
-
return ARES_EBADQUERY;
|
219
|
-
|
220
|
-
*naddrttls = 0;
|
221
|
-
|
222
|
-
next_cname = ai->cnames;
|
223
|
-
while (next_cname)
|
224
|
-
{
|
225
|
-
if(next_cname->ttl < cname_ttl)
|
226
|
-
cname_ttl = next_cname->ttl;
|
227
|
-
next_cname = next_cname->next;
|
228
|
-
}
|
229
|
-
|
230
|
-
next = ai->nodes;
|
231
|
-
while (next)
|
232
|
-
{
|
233
|
-
if(next->ai_family == family)
|
234
|
-
{
|
235
|
-
if (*naddrttls < req_naddrttls)
|
236
|
-
{
|
237
|
-
if (family == AF_INET6)
|
238
|
-
{
|
239
|
-
if(next->ai_ttl > cname_ttl)
|
240
|
-
addr6ttls[*naddrttls].ttl = cname_ttl;
|
241
|
-
else
|
242
|
-
addr6ttls[*naddrttls].ttl = next->ai_ttl;
|
243
|
-
|
244
|
-
memcpy(&addr6ttls[*naddrttls].ip6addr,
|
245
|
-
&(CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr)->sin6_addr),
|
246
|
-
sizeof(struct ares_in6_addr));
|
247
|
-
}
|
248
|
-
else
|
249
|
-
{
|
250
|
-
if(next->ai_ttl > cname_ttl)
|
251
|
-
addrttls[*naddrttls].ttl = cname_ttl;
|
252
|
-
else
|
253
|
-
addrttls[*naddrttls].ttl = next->ai_ttl;
|
254
|
-
memcpy(&addrttls[*naddrttls].ipaddr,
|
255
|
-
&(CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr)->sin_addr),
|
256
|
-
sizeof(struct in_addr));
|
257
|
-
}
|
258
|
-
(*naddrttls)++;
|
259
|
-
}
|
260
|
-
}
|
261
|
-
next = next->ai_next;
|
262
|
-
}
|
263
|
-
|
264
|
-
return ARES_SUCCESS;
|
265
|
-
}
|
266
|
-
|