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
@@ -1,179 +0,0 @@
|
|
1
|
-
|
2
|
-
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
3
|
-
* Copyright (C) 2012 Marko Kreen <markokr@gmail.com>
|
4
|
-
*
|
5
|
-
* Permission to use, copy, modify, and distribute this
|
6
|
-
* software and its documentation for any purpose and without
|
7
|
-
* fee is hereby granted, provided that the above copyright
|
8
|
-
* notice appear in all copies and that both that copyright
|
9
|
-
* notice and this permission notice appear in supporting
|
10
|
-
* documentation, and that the name of M.I.T. not be used in
|
11
|
-
* advertising or publicity pertaining to distribution of the
|
12
|
-
* software without specific, written prior permission.
|
13
|
-
* M.I.T. makes no representations about the suitability of
|
14
|
-
* this software for any purpose. It is provided "as is"
|
15
|
-
* without express or implied warranty.
|
16
|
-
*/
|
17
|
-
|
18
|
-
#include "ares_setup.h"
|
19
|
-
|
20
|
-
#ifdef HAVE_NETINET_IN_H
|
21
|
-
# include <netinet/in.h>
|
22
|
-
#endif
|
23
|
-
#ifdef HAVE_NETDB_H
|
24
|
-
# include <netdb.h>
|
25
|
-
#endif
|
26
|
-
#ifdef HAVE_ARPA_INET_H
|
27
|
-
# include <arpa/inet.h>
|
28
|
-
#endif
|
29
|
-
|
30
|
-
#include "ares_nameser.h"
|
31
|
-
|
32
|
-
#include "ares.h"
|
33
|
-
#include "ares_dns.h"
|
34
|
-
#include "ares_data.h"
|
35
|
-
#include "ares_private.h"
|
36
|
-
|
37
|
-
int
|
38
|
-
ares_parse_soa_reply(const unsigned char *abuf, int alen,
|
39
|
-
struct ares_soa_reply **soa_out)
|
40
|
-
{
|
41
|
-
const unsigned char *aptr;
|
42
|
-
long len;
|
43
|
-
char *qname = NULL, *rr_name = NULL;
|
44
|
-
struct ares_soa_reply *soa = NULL;
|
45
|
-
int qdcount, ancount, qclass;
|
46
|
-
int status, i, rr_type, rr_class, rr_len;
|
47
|
-
|
48
|
-
if (alen < HFIXEDSZ)
|
49
|
-
return ARES_EBADRESP;
|
50
|
-
|
51
|
-
/* parse message header */
|
52
|
-
qdcount = DNS_HEADER_QDCOUNT(abuf);
|
53
|
-
ancount = DNS_HEADER_ANCOUNT(abuf);
|
54
|
-
|
55
|
-
if (qdcount != 1)
|
56
|
-
return ARES_EBADRESP;
|
57
|
-
if (ancount == 0)
|
58
|
-
return ARES_EBADRESP;
|
59
|
-
|
60
|
-
aptr = abuf + HFIXEDSZ;
|
61
|
-
|
62
|
-
/* query name */
|
63
|
-
status = ares__expand_name_for_response(aptr, abuf, alen, &qname, &len, 0);
|
64
|
-
if (status != ARES_SUCCESS)
|
65
|
-
goto failed_stat;
|
66
|
-
|
67
|
-
if (alen <= len + HFIXEDSZ + 1)
|
68
|
-
goto failed;
|
69
|
-
aptr += len;
|
70
|
-
|
71
|
-
qclass = DNS_QUESTION_TYPE(aptr);
|
72
|
-
|
73
|
-
/* skip qtype & qclass */
|
74
|
-
if (aptr + QFIXEDSZ > abuf + alen)
|
75
|
-
goto failed;
|
76
|
-
aptr += QFIXEDSZ;
|
77
|
-
|
78
|
-
/* qclass of SOA with multiple answers */
|
79
|
-
if (qclass == T_SOA && ancount > 1)
|
80
|
-
goto failed;
|
81
|
-
|
82
|
-
/* examine all the records, break and return if found soa */
|
83
|
-
for (i = 0; i < ancount; i++)
|
84
|
-
{
|
85
|
-
rr_name = NULL;
|
86
|
-
status = ares__expand_name_for_response (aptr, abuf, alen, &rr_name, &len, 0);
|
87
|
-
if (status != ARES_SUCCESS)
|
88
|
-
{
|
89
|
-
ares_free(rr_name);
|
90
|
-
goto failed_stat;
|
91
|
-
}
|
92
|
-
|
93
|
-
aptr += len;
|
94
|
-
if ( aptr + RRFIXEDSZ > abuf + alen )
|
95
|
-
{
|
96
|
-
ares_free(rr_name);
|
97
|
-
status = ARES_EBADRESP;
|
98
|
-
goto failed_stat;
|
99
|
-
}
|
100
|
-
rr_type = DNS_RR_TYPE( aptr );
|
101
|
-
rr_class = DNS_RR_CLASS( aptr );
|
102
|
-
rr_len = DNS_RR_LEN( aptr );
|
103
|
-
aptr += RRFIXEDSZ;
|
104
|
-
if (aptr + rr_len > abuf + alen)
|
105
|
-
{
|
106
|
-
ares_free(rr_name);
|
107
|
-
status = ARES_EBADRESP;
|
108
|
-
goto failed_stat;
|
109
|
-
}
|
110
|
-
if ( rr_class == C_IN && rr_type == T_SOA )
|
111
|
-
{
|
112
|
-
/* allocate result struct */
|
113
|
-
soa = ares_malloc_data(ARES_DATATYPE_SOA_REPLY);
|
114
|
-
if (!soa)
|
115
|
-
{
|
116
|
-
ares_free(rr_name);
|
117
|
-
status = ARES_ENOMEM;
|
118
|
-
goto failed_stat;
|
119
|
-
}
|
120
|
-
|
121
|
-
/* nsname */
|
122
|
-
status = ares__expand_name_for_response(aptr, abuf, alen, &soa->nsname,
|
123
|
-
&len, 0);
|
124
|
-
if (status != ARES_SUCCESS)
|
125
|
-
{
|
126
|
-
ares_free(rr_name);
|
127
|
-
goto failed_stat;
|
128
|
-
}
|
129
|
-
aptr += len;
|
130
|
-
|
131
|
-
/* hostmaster */
|
132
|
-
status = ares__expand_name_for_response(aptr, abuf, alen,
|
133
|
-
&soa->hostmaster, &len, 0);
|
134
|
-
if (status != ARES_SUCCESS)
|
135
|
-
{
|
136
|
-
ares_free(rr_name);
|
137
|
-
goto failed_stat;
|
138
|
-
}
|
139
|
-
aptr += len;
|
140
|
-
|
141
|
-
/* integer fields */
|
142
|
-
if (aptr + 5 * 4 > abuf + alen)
|
143
|
-
{
|
144
|
-
ares_free(rr_name);
|
145
|
-
goto failed;
|
146
|
-
}
|
147
|
-
soa->serial = DNS__32BIT(aptr + 0 * 4);
|
148
|
-
soa->refresh = DNS__32BIT(aptr + 1 * 4);
|
149
|
-
soa->retry = DNS__32BIT(aptr + 2 * 4);
|
150
|
-
soa->expire = DNS__32BIT(aptr + 3 * 4);
|
151
|
-
soa->minttl = DNS__32BIT(aptr + 4 * 4);
|
152
|
-
|
153
|
-
ares_free(qname);
|
154
|
-
ares_free(rr_name);
|
155
|
-
|
156
|
-
*soa_out = soa;
|
157
|
-
|
158
|
-
return ARES_SUCCESS;
|
159
|
-
}
|
160
|
-
aptr += rr_len;
|
161
|
-
|
162
|
-
ares_free(rr_name);
|
163
|
-
|
164
|
-
if (aptr > abuf + alen)
|
165
|
-
goto failed_stat;
|
166
|
-
}
|
167
|
-
/* no SOA record found */
|
168
|
-
status = ARES_EBADRESP;
|
169
|
-
goto failed_stat;
|
170
|
-
failed:
|
171
|
-
status = ARES_EBADRESP;
|
172
|
-
|
173
|
-
failed_stat:
|
174
|
-
if (soa)
|
175
|
-
ares_free_data(soa);
|
176
|
-
if (qname)
|
177
|
-
ares_free(qname);
|
178
|
-
return status;
|
179
|
-
}
|
@@ -1,168 +0,0 @@
|
|
1
|
-
|
2
|
-
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
3
|
-
* Copyright (C) 2009 by Jakub Hrozek <jhrozek@redhat.com>
|
4
|
-
*
|
5
|
-
* Permission to use, copy, modify, and distribute this
|
6
|
-
* software and its documentation for any purpose and without
|
7
|
-
* fee is hereby granted, provided that the above copyright
|
8
|
-
* notice appear in all copies and that both that copyright
|
9
|
-
* notice and this permission notice appear in supporting
|
10
|
-
* documentation, and that the name of M.I.T. not be used in
|
11
|
-
* advertising or publicity pertaining to distribution of the
|
12
|
-
* software without specific, written prior permission.
|
13
|
-
* M.I.T. makes no representations about the suitability of
|
14
|
-
* this software for any purpose. It is provided "as is"
|
15
|
-
* without express or implied warranty.
|
16
|
-
*/
|
17
|
-
|
18
|
-
#include "ares_setup.h"
|
19
|
-
|
20
|
-
#ifdef HAVE_NETINET_IN_H
|
21
|
-
# include <netinet/in.h>
|
22
|
-
#endif
|
23
|
-
#ifdef HAVE_NETDB_H
|
24
|
-
# include <netdb.h>
|
25
|
-
#endif
|
26
|
-
#ifdef HAVE_ARPA_INET_H
|
27
|
-
# include <arpa/inet.h>
|
28
|
-
#endif
|
29
|
-
|
30
|
-
#include "ares_nameser.h"
|
31
|
-
|
32
|
-
#include "ares.h"
|
33
|
-
#include "ares_dns.h"
|
34
|
-
#include "ares_data.h"
|
35
|
-
#include "ares_private.h"
|
36
|
-
|
37
|
-
int
|
38
|
-
ares_parse_srv_reply (const unsigned char *abuf, int alen,
|
39
|
-
struct ares_srv_reply **srv_out)
|
40
|
-
{
|
41
|
-
unsigned int qdcount, ancount, i;
|
42
|
-
const unsigned char *aptr, *vptr;
|
43
|
-
int status, rr_type, rr_class, rr_len;
|
44
|
-
long len;
|
45
|
-
char *hostname = NULL, *rr_name = NULL;
|
46
|
-
struct ares_srv_reply *srv_head = NULL;
|
47
|
-
struct ares_srv_reply *srv_last = NULL;
|
48
|
-
struct ares_srv_reply *srv_curr;
|
49
|
-
|
50
|
-
/* Set *srv_out to NULL for all failure cases. */
|
51
|
-
*srv_out = NULL;
|
52
|
-
|
53
|
-
/* Give up if abuf doesn't have room for a header. */
|
54
|
-
if (alen < HFIXEDSZ)
|
55
|
-
return ARES_EBADRESP;
|
56
|
-
|
57
|
-
/* Fetch the question and answer count from the header. */
|
58
|
-
qdcount = DNS_HEADER_QDCOUNT (abuf);
|
59
|
-
ancount = DNS_HEADER_ANCOUNT (abuf);
|
60
|
-
if (qdcount != 1)
|
61
|
-
return ARES_EBADRESP;
|
62
|
-
if (ancount == 0)
|
63
|
-
return ARES_ENODATA;
|
64
|
-
|
65
|
-
/* Expand the name from the question, and skip past the question. */
|
66
|
-
aptr = abuf + HFIXEDSZ;
|
67
|
-
status = ares_expand_name (aptr, abuf, alen, &hostname, &len);
|
68
|
-
if (status != ARES_SUCCESS)
|
69
|
-
return status;
|
70
|
-
|
71
|
-
if (aptr + len + QFIXEDSZ > abuf + alen)
|
72
|
-
{
|
73
|
-
ares_free (hostname);
|
74
|
-
return ARES_EBADRESP;
|
75
|
-
}
|
76
|
-
aptr += len + QFIXEDSZ;
|
77
|
-
|
78
|
-
/* Examine each answer resource record (RR) in turn. */
|
79
|
-
for (i = 0; i < ancount; i++)
|
80
|
-
{
|
81
|
-
/* Decode the RR up to the data field. */
|
82
|
-
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len);
|
83
|
-
if (status != ARES_SUCCESS)
|
84
|
-
{
|
85
|
-
break;
|
86
|
-
}
|
87
|
-
aptr += len;
|
88
|
-
if (aptr + RRFIXEDSZ > abuf + alen)
|
89
|
-
{
|
90
|
-
status = ARES_EBADRESP;
|
91
|
-
break;
|
92
|
-
}
|
93
|
-
rr_type = DNS_RR_TYPE (aptr);
|
94
|
-
rr_class = DNS_RR_CLASS (aptr);
|
95
|
-
rr_len = DNS_RR_LEN (aptr);
|
96
|
-
aptr += RRFIXEDSZ;
|
97
|
-
if (aptr + rr_len > abuf + alen)
|
98
|
-
{
|
99
|
-
status = ARES_EBADRESP;
|
100
|
-
break;
|
101
|
-
}
|
102
|
-
|
103
|
-
/* Check if we are really looking at a SRV record */
|
104
|
-
if (rr_class == C_IN && rr_type == T_SRV)
|
105
|
-
{
|
106
|
-
/* parse the SRV record itself */
|
107
|
-
if (rr_len < 6)
|
108
|
-
{
|
109
|
-
status = ARES_EBADRESP;
|
110
|
-
break;
|
111
|
-
}
|
112
|
-
|
113
|
-
/* Allocate storage for this SRV answer appending it to the list */
|
114
|
-
srv_curr = ares_malloc_data(ARES_DATATYPE_SRV_REPLY);
|
115
|
-
if (!srv_curr)
|
116
|
-
{
|
117
|
-
status = ARES_ENOMEM;
|
118
|
-
break;
|
119
|
-
}
|
120
|
-
if (srv_last)
|
121
|
-
{
|
122
|
-
srv_last->next = srv_curr;
|
123
|
-
}
|
124
|
-
else
|
125
|
-
{
|
126
|
-
srv_head = srv_curr;
|
127
|
-
}
|
128
|
-
srv_last = srv_curr;
|
129
|
-
|
130
|
-
vptr = aptr;
|
131
|
-
srv_curr->priority = DNS__16BIT(vptr);
|
132
|
-
vptr += sizeof(unsigned short);
|
133
|
-
srv_curr->weight = DNS__16BIT(vptr);
|
134
|
-
vptr += sizeof(unsigned short);
|
135
|
-
srv_curr->port = DNS__16BIT(vptr);
|
136
|
-
vptr += sizeof(unsigned short);
|
137
|
-
|
138
|
-
status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len);
|
139
|
-
if (status != ARES_SUCCESS)
|
140
|
-
break;
|
141
|
-
}
|
142
|
-
|
143
|
-
/* Don't lose memory in the next iteration */
|
144
|
-
ares_free (rr_name);
|
145
|
-
rr_name = NULL;
|
146
|
-
|
147
|
-
/* Move on to the next record */
|
148
|
-
aptr += rr_len;
|
149
|
-
}
|
150
|
-
|
151
|
-
if (hostname)
|
152
|
-
ares_free (hostname);
|
153
|
-
if (rr_name)
|
154
|
-
ares_free (rr_name);
|
155
|
-
|
156
|
-
/* clean up on error */
|
157
|
-
if (status != ARES_SUCCESS)
|
158
|
-
{
|
159
|
-
if (srv_head)
|
160
|
-
ares_free_data (srv_head);
|
161
|
-
return status;
|
162
|
-
}
|
163
|
-
|
164
|
-
/* everything looks fine, return the data */
|
165
|
-
*srv_out = srv_head;
|
166
|
-
|
167
|
-
return ARES_SUCCESS;
|
168
|
-
}
|
@@ -1,214 +0,0 @@
|
|
1
|
-
|
2
|
-
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
3
|
-
* Copyright (C) 2009 by Jakub Hrozek <jhrozek@redhat.com>
|
4
|
-
*
|
5
|
-
* Permission to use, copy, modify, and distribute this
|
6
|
-
* software and its documentation for any purpose and without
|
7
|
-
* fee is hereby granted, provided that the above copyright
|
8
|
-
* notice appear in all copies and that both that copyright
|
9
|
-
* notice and this permission notice appear in supporting
|
10
|
-
* documentation, and that the name of M.I.T. not be used in
|
11
|
-
* advertising or publicity pertaining to distribution of the
|
12
|
-
* software without specific, written prior permission.
|
13
|
-
* M.I.T. makes no representations about the suitability of
|
14
|
-
* this software for any purpose. It is provided "as is"
|
15
|
-
* without express or implied warranty.
|
16
|
-
*/
|
17
|
-
|
18
|
-
#include "ares_setup.h"
|
19
|
-
|
20
|
-
#ifdef HAVE_NETINET_IN_H
|
21
|
-
# include <netinet/in.h>
|
22
|
-
#endif
|
23
|
-
#ifdef HAVE_NETDB_H
|
24
|
-
# include <netdb.h>
|
25
|
-
#endif
|
26
|
-
#ifdef HAVE_ARPA_INET_H
|
27
|
-
# include <arpa/inet.h>
|
28
|
-
#endif
|
29
|
-
|
30
|
-
#include "ares_nameser.h"
|
31
|
-
|
32
|
-
#ifdef HAVE_STRINGS_H
|
33
|
-
# include <strings.h>
|
34
|
-
#endif
|
35
|
-
|
36
|
-
#include "ares.h"
|
37
|
-
#include "ares_dns.h"
|
38
|
-
#include "ares_data.h"
|
39
|
-
#include "ares_private.h"
|
40
|
-
|
41
|
-
static int
|
42
|
-
ares__parse_txt_reply (const unsigned char *abuf, int alen,
|
43
|
-
int ex, void **txt_out)
|
44
|
-
{
|
45
|
-
size_t substr_len;
|
46
|
-
unsigned int qdcount, ancount, i;
|
47
|
-
const unsigned char *aptr;
|
48
|
-
const unsigned char *strptr;
|
49
|
-
int status, rr_type, rr_class, rr_len;
|
50
|
-
long len;
|
51
|
-
char *hostname = NULL, *rr_name = NULL;
|
52
|
-
struct ares_txt_ext *txt_head = NULL;
|
53
|
-
struct ares_txt_ext *txt_last = NULL;
|
54
|
-
struct ares_txt_ext *txt_curr;
|
55
|
-
|
56
|
-
/* Set *txt_out to NULL for all failure cases. */
|
57
|
-
*txt_out = NULL;
|
58
|
-
|
59
|
-
/* Give up if abuf doesn't have room for a header. */
|
60
|
-
if (alen < HFIXEDSZ)
|
61
|
-
return ARES_EBADRESP;
|
62
|
-
|
63
|
-
/* Fetch the question and answer count from the header. */
|
64
|
-
qdcount = DNS_HEADER_QDCOUNT (abuf);
|
65
|
-
ancount = DNS_HEADER_ANCOUNT (abuf);
|
66
|
-
if (qdcount != 1)
|
67
|
-
return ARES_EBADRESP;
|
68
|
-
if (ancount == 0)
|
69
|
-
return ARES_ENODATA;
|
70
|
-
|
71
|
-
/* Expand the name from the question, and skip past the question. */
|
72
|
-
aptr = abuf + HFIXEDSZ;
|
73
|
-
status = ares_expand_name (aptr, abuf, alen, &hostname, &len);
|
74
|
-
if (status != ARES_SUCCESS)
|
75
|
-
return status;
|
76
|
-
|
77
|
-
if (aptr + len + QFIXEDSZ > abuf + alen)
|
78
|
-
{
|
79
|
-
ares_free (hostname);
|
80
|
-
return ARES_EBADRESP;
|
81
|
-
}
|
82
|
-
aptr += len + QFIXEDSZ;
|
83
|
-
|
84
|
-
/* Examine each answer resource record (RR) in turn. */
|
85
|
-
for (i = 0; i < ancount; i++)
|
86
|
-
{
|
87
|
-
/* Decode the RR up to the data field. */
|
88
|
-
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len);
|
89
|
-
if (status != ARES_SUCCESS)
|
90
|
-
{
|
91
|
-
break;
|
92
|
-
}
|
93
|
-
aptr += len;
|
94
|
-
if (aptr + RRFIXEDSZ > abuf + alen)
|
95
|
-
{
|
96
|
-
status = ARES_EBADRESP;
|
97
|
-
break;
|
98
|
-
}
|
99
|
-
rr_type = DNS_RR_TYPE (aptr);
|
100
|
-
rr_class = DNS_RR_CLASS (aptr);
|
101
|
-
rr_len = DNS_RR_LEN (aptr);
|
102
|
-
aptr += RRFIXEDSZ;
|
103
|
-
if (aptr + rr_len > abuf + alen)
|
104
|
-
{
|
105
|
-
status = ARES_EBADRESP;
|
106
|
-
break;
|
107
|
-
}
|
108
|
-
|
109
|
-
/* Check if we are really looking at a TXT record */
|
110
|
-
if ((rr_class == C_IN || rr_class == C_CHAOS) && rr_type == T_TXT)
|
111
|
-
{
|
112
|
-
/*
|
113
|
-
* There may be multiple substrings in a single TXT record. Each
|
114
|
-
* substring may be up to 255 characters in length, with a
|
115
|
-
* "length byte" indicating the size of the substring payload.
|
116
|
-
* RDATA contains both the length-bytes and payloads of all
|
117
|
-
* substrings contained therein.
|
118
|
-
*/
|
119
|
-
|
120
|
-
strptr = aptr;
|
121
|
-
while (strptr < (aptr + rr_len))
|
122
|
-
{
|
123
|
-
substr_len = (unsigned char)*strptr;
|
124
|
-
if (strptr + substr_len + 1 > aptr + rr_len)
|
125
|
-
{
|
126
|
-
status = ARES_EBADRESP;
|
127
|
-
break;
|
128
|
-
}
|
129
|
-
|
130
|
-
/* Allocate storage for this TXT answer appending it to the list */
|
131
|
-
txt_curr = ares_malloc_data(ex ? ARES_DATATYPE_TXT_EXT :
|
132
|
-
ARES_DATATYPE_TXT_REPLY);
|
133
|
-
if (!txt_curr)
|
134
|
-
{
|
135
|
-
status = ARES_ENOMEM;
|
136
|
-
break;
|
137
|
-
}
|
138
|
-
if (txt_last)
|
139
|
-
{
|
140
|
-
txt_last->next = txt_curr;
|
141
|
-
}
|
142
|
-
else
|
143
|
-
{
|
144
|
-
txt_head = txt_curr;
|
145
|
-
}
|
146
|
-
txt_last = txt_curr;
|
147
|
-
|
148
|
-
if (ex)
|
149
|
-
txt_curr->record_start = (strptr == aptr);
|
150
|
-
txt_curr->length = substr_len;
|
151
|
-
txt_curr->txt = ares_malloc (substr_len + 1/* Including null byte */);
|
152
|
-
if (txt_curr->txt == NULL)
|
153
|
-
{
|
154
|
-
status = ARES_ENOMEM;
|
155
|
-
break;
|
156
|
-
}
|
157
|
-
|
158
|
-
++strptr;
|
159
|
-
memcpy ((char *) txt_curr->txt, strptr, substr_len);
|
160
|
-
|
161
|
-
/* Make sure we NULL-terminate */
|
162
|
-
txt_curr->txt[substr_len] = 0;
|
163
|
-
|
164
|
-
strptr += substr_len;
|
165
|
-
}
|
166
|
-
}
|
167
|
-
|
168
|
-
/* Propagate any failures */
|
169
|
-
if (status != ARES_SUCCESS)
|
170
|
-
{
|
171
|
-
break;
|
172
|
-
}
|
173
|
-
|
174
|
-
/* Don't lose memory in the next iteration */
|
175
|
-
ares_free (rr_name);
|
176
|
-
rr_name = NULL;
|
177
|
-
|
178
|
-
/* Move on to the next record */
|
179
|
-
aptr += rr_len;
|
180
|
-
}
|
181
|
-
|
182
|
-
if (hostname)
|
183
|
-
ares_free (hostname);
|
184
|
-
if (rr_name)
|
185
|
-
ares_free (rr_name);
|
186
|
-
|
187
|
-
/* clean up on error */
|
188
|
-
if (status != ARES_SUCCESS)
|
189
|
-
{
|
190
|
-
if (txt_head)
|
191
|
-
ares_free_data (txt_head);
|
192
|
-
return status;
|
193
|
-
}
|
194
|
-
|
195
|
-
/* everything looks fine, return the data */
|
196
|
-
*txt_out = txt_head;
|
197
|
-
|
198
|
-
return ARES_SUCCESS;
|
199
|
-
}
|
200
|
-
|
201
|
-
int
|
202
|
-
ares_parse_txt_reply (const unsigned char *abuf, int alen,
|
203
|
-
struct ares_txt_reply **txt_out)
|
204
|
-
{
|
205
|
-
return ares__parse_txt_reply(abuf, alen, 0, (void **) txt_out);
|
206
|
-
}
|
207
|
-
|
208
|
-
|
209
|
-
int
|
210
|
-
ares_parse_txt_reply_ext (const unsigned char *abuf, int alen,
|
211
|
-
struct ares_txt_ext **txt_out)
|
212
|
-
{
|
213
|
-
return ares__parse_txt_reply(abuf, alen, 1, (void **) txt_out);
|
214
|
-
}
|