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
@@ -0,0 +1,161 @@
|
|
1
|
+
/* MIT License
|
2
|
+
*
|
3
|
+
* Copyright (c) 2024 Brad House
|
4
|
+
*
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
10
|
+
* furnished to do so, subject to the following conditions:
|
11
|
+
*
|
12
|
+
* The above copyright notice and this permission notice (including the next
|
13
|
+
* paragraph) shall be included in all copies or substantial portions of the
|
14
|
+
* Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
* SOFTWARE.
|
23
|
+
*
|
24
|
+
* SPDX-License-Identifier: MIT
|
25
|
+
*/
|
26
|
+
#ifndef __ARES_EVENT_WIN32_H
|
27
|
+
#define __ARES_EVENT_WIN32_H
|
28
|
+
|
29
|
+
#ifdef _WIN32
|
30
|
+
# ifdef HAVE_WINSOCK2_H
|
31
|
+
# include <winsock2.h>
|
32
|
+
# endif
|
33
|
+
# ifdef HAVE_WS2TCPIP_H
|
34
|
+
# include <ws2tcpip.h>
|
35
|
+
# endif
|
36
|
+
# ifdef HAVE_MSWSOCK_H
|
37
|
+
# include <mswsock.h>
|
38
|
+
# endif
|
39
|
+
# ifdef HAVE_WINDOWS_H
|
40
|
+
# include <windows.h>
|
41
|
+
# endif
|
42
|
+
|
43
|
+
/* From winternl.h */
|
44
|
+
|
45
|
+
/* If WDK is not installed and not using MinGW, provide the needed definitions
|
46
|
+
*/
|
47
|
+
typedef LONG NTSTATUS;
|
48
|
+
|
49
|
+
typedef struct _IO_STATUS_BLOCK {
|
50
|
+
union {
|
51
|
+
NTSTATUS Status;
|
52
|
+
PVOID Pointer;
|
53
|
+
};
|
54
|
+
|
55
|
+
ULONG_PTR Information;
|
56
|
+
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
57
|
+
|
58
|
+
typedef VOID(NTAPI *PIO_APC_ROUTINE)(PVOID ApcContext,
|
59
|
+
PIO_STATUS_BLOCK IoStatusBlock,
|
60
|
+
ULONG Reserved);
|
61
|
+
|
62
|
+
/* From ntstatus.h */
|
63
|
+
# define STATUS_SUCCESS ((NTSTATUS)0x00000000)
|
64
|
+
# ifndef STATUS_PENDING
|
65
|
+
# define STATUS_PENDING ((NTSTATUS)0x00000103L)
|
66
|
+
# endif
|
67
|
+
# define STATUS_CANCELLED ((NTSTATUS)0xC0000120L)
|
68
|
+
# define STATUS_NOT_FOUND ((NTSTATUS)0xC0000225L)
|
69
|
+
|
70
|
+
typedef struct _UNICODE_STRING {
|
71
|
+
USHORT Length;
|
72
|
+
USHORT MaximumLength;
|
73
|
+
LPCWSTR Buffer;
|
74
|
+
} UNICODE_STRING, *PUNICODE_STRING;
|
75
|
+
|
76
|
+
typedef struct _OBJECT_ATTRIBUTES {
|
77
|
+
ULONG Length;
|
78
|
+
HANDLE RootDirectory;
|
79
|
+
PUNICODE_STRING ObjectName;
|
80
|
+
ULONG Attributes;
|
81
|
+
PVOID SecurityDescriptor;
|
82
|
+
PVOID SecurityQualityOfService;
|
83
|
+
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
|
84
|
+
|
85
|
+
# ifndef FILE_OPEN
|
86
|
+
# define FILE_OPEN 0x00000001UL
|
87
|
+
# endif
|
88
|
+
|
89
|
+
/* Not sure what headers might have these */
|
90
|
+
# define IOCTL_AFD_POLL 0x00012024
|
91
|
+
|
92
|
+
# define AFD_POLL_RECEIVE_BIT 0
|
93
|
+
# define AFD_POLL_RECEIVE (1 << AFD_POLL_RECEIVE_BIT)
|
94
|
+
# define AFD_POLL_RECEIVE_EXPEDITED_BIT 1
|
95
|
+
# define AFD_POLL_RECEIVE_EXPEDITED (1 << AFD_POLL_RECEIVE_EXPEDITED_BIT)
|
96
|
+
# define AFD_POLL_SEND_BIT 2
|
97
|
+
# define AFD_POLL_SEND (1 << AFD_POLL_SEND_BIT)
|
98
|
+
# define AFD_POLL_DISCONNECT_BIT 3
|
99
|
+
# define AFD_POLL_DISCONNECT (1 << AFD_POLL_DISCONNECT_BIT)
|
100
|
+
# define AFD_POLL_ABORT_BIT 4
|
101
|
+
# define AFD_POLL_ABORT (1 << AFD_POLL_ABORT_BIT)
|
102
|
+
# define AFD_POLL_LOCAL_CLOSE_BIT 5
|
103
|
+
# define AFD_POLL_LOCAL_CLOSE (1 << AFD_POLL_LOCAL_CLOSE_BIT)
|
104
|
+
# define AFD_POLL_CONNECT_BIT 6
|
105
|
+
# define AFD_POLL_CONNECT (1 << AFD_POLL_CONNECT_BIT)
|
106
|
+
# define AFD_POLL_ACCEPT_BIT 7
|
107
|
+
# define AFD_POLL_ACCEPT (1 << AFD_POLL_ACCEPT_BIT)
|
108
|
+
# define AFD_POLL_CONNECT_FAIL_BIT 8
|
109
|
+
# define AFD_POLL_CONNECT_FAIL (1 << AFD_POLL_CONNECT_FAIL_BIT)
|
110
|
+
# define AFD_POLL_QOS_BIT 9
|
111
|
+
# define AFD_POLL_QOS (1 << AFD_POLL_QOS_BIT)
|
112
|
+
# define AFD_POLL_GROUP_QOS_BIT 10
|
113
|
+
# define AFD_POLL_GROUP_QOS (1 << AFD_POLL_GROUP_QOS_BIT)
|
114
|
+
|
115
|
+
# define AFD_NUM_POLL_EVENTS 11
|
116
|
+
# define AFD_POLL_ALL ((1 << AFD_NUM_POLL_EVENTS) - 1)
|
117
|
+
|
118
|
+
typedef struct _AFD_POLL_HANDLE_INFO {
|
119
|
+
HANDLE Handle;
|
120
|
+
ULONG Events;
|
121
|
+
NTSTATUS Status;
|
122
|
+
} AFD_POLL_HANDLE_INFO, *PAFD_POLL_HANDLE_INFO;
|
123
|
+
|
124
|
+
typedef struct _AFD_POLL_INFO {
|
125
|
+
LARGE_INTEGER Timeout;
|
126
|
+
ULONG NumberOfHandles;
|
127
|
+
ULONG Exclusive;
|
128
|
+
AFD_POLL_HANDLE_INFO Handles[1];
|
129
|
+
} AFD_POLL_INFO, *PAFD_POLL_INFO;
|
130
|
+
|
131
|
+
/* Prototypes for dynamically loaded functions from ntdll.dll */
|
132
|
+
typedef NTSTATUS(NTAPI *NtCancelIoFileEx_t)(HANDLE FileHandle,
|
133
|
+
PIO_STATUS_BLOCK IoRequestToCancel,
|
134
|
+
PIO_STATUS_BLOCK IoStatusBlock);
|
135
|
+
typedef NTSTATUS(NTAPI *NtDeviceIoControlFile_t)(
|
136
|
+
HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext,
|
137
|
+
PIO_STATUS_BLOCK IoStatusBlock, ULONG IoControlCode, PVOID InputBuffer,
|
138
|
+
ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength);
|
139
|
+
|
140
|
+
typedef NTSTATUS(NTAPI *NtCreateFile_t)(
|
141
|
+
PHANDLE FileHandle, ACCESS_MASK DesiredAccess,
|
142
|
+
POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock,
|
143
|
+
PLARGE_INTEGER AllocationSize, ULONG FileAttributes, ULONG ShareAccess,
|
144
|
+
ULONG CreateDisposition, ULONG CreateOptions, PVOID EaBuffer, ULONG EaLength);
|
145
|
+
|
146
|
+
/* On UWP/Windows Store, these definitions aren't there for some reason */
|
147
|
+
# ifndef SIO_BSP_HANDLE_POLL
|
148
|
+
# define SIO_BSP_HANDLE_POLL 0x4800001D
|
149
|
+
# endif
|
150
|
+
|
151
|
+
# ifndef SIO_BASE_HANDLE
|
152
|
+
# define SIO_BASE_HANDLE 0x48000022
|
153
|
+
# endif
|
154
|
+
|
155
|
+
# ifndef HANDLE_FLAG_INHERIT
|
156
|
+
# define HANDLE_FLAG_INHERIT 0x00000001
|
157
|
+
# endif
|
158
|
+
|
159
|
+
#endif /* _WIN32 */
|
160
|
+
|
161
|
+
#endif /* __ARES_EVENT_WIN32_H */
|
@@ -0,0 +1,276 @@
|
|
1
|
+
/* MIT License
|
2
|
+
*
|
3
|
+
* Copyright (c) 2024 Brad House
|
4
|
+
*
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
10
|
+
* furnished to do so, subject to the following conditions:
|
11
|
+
*
|
12
|
+
* The above copyright notice and this permission notice (including the next
|
13
|
+
* paragraph) shall be included in all copies or substantial portions of the
|
14
|
+
* Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
* SOFTWARE.
|
23
|
+
*
|
24
|
+
* SPDX-License-Identifier: MIT
|
25
|
+
*/
|
26
|
+
#ifndef __ARES__ARRAY_H
|
27
|
+
#define __ARES__ARRAY_H
|
28
|
+
|
29
|
+
#include "ares.h"
|
30
|
+
|
31
|
+
/*! \addtogroup ares_array Array Data Structure
|
32
|
+
*
|
33
|
+
* This is an array with helpers. It is meant to have as little overhead
|
34
|
+
* as possible over direct array management by applications but to provide
|
35
|
+
* safety and some optimization features. It can also return the array in
|
36
|
+
* native form once all manipulation has been performed.
|
37
|
+
*
|
38
|
+
* @{
|
39
|
+
*/
|
40
|
+
|
41
|
+
struct ares_array;
|
42
|
+
|
43
|
+
/*! Opaque data structure for array */
|
44
|
+
typedef struct ares_array ares_array_t;
|
45
|
+
|
46
|
+
/*! Callback to free user-defined member data
|
47
|
+
*
|
48
|
+
* \param[in] data pointer to member of array to be destroyed. The pointer
|
49
|
+
* itself must not be destroyed, just the data it contains.
|
50
|
+
*/
|
51
|
+
typedef void (*ares_array_destructor_t)(void *data);
|
52
|
+
|
53
|
+
/*! Callback to compare two array elements used for sorting
|
54
|
+
*
|
55
|
+
* \param[in] data1 array member 1
|
56
|
+
* \param[in] data2 array member 2
|
57
|
+
* \return < 0 if data1 < data2, > 0 if data1 > data2, 0 if data1 == data2
|
58
|
+
*/
|
59
|
+
typedef int (*ares_array_cmp_t)(const void *data1, const void *data2);
|
60
|
+
|
61
|
+
/*! Create an array object
|
62
|
+
*
|
63
|
+
* NOTE: members of the array are typically going to be an going to be a
|
64
|
+
* struct with compiler/ABI specific padding to ensure proper alignment.
|
65
|
+
* Care needs to be taken if using primitive types, especially floating
|
66
|
+
* point numbers which size may not indicate the required alignment.
|
67
|
+
* For example, a double may be 80 bits (10 bytes), but required
|
68
|
+
* alignment of 16 bytes. In such a case, a member_size of 16 would be
|
69
|
+
* required to be used.
|
70
|
+
*
|
71
|
+
* \param[in] destruct Optional. Destructor to call on a removed member
|
72
|
+
* \param[in] member_size Size of array member, usually determined using
|
73
|
+
* sizeof() for the member such as a struct.
|
74
|
+
*
|
75
|
+
* \return array object or NULL on out of memory
|
76
|
+
*/
|
77
|
+
CARES_EXTERN ares_array_t *ares_array_create(size_t member_size,
|
78
|
+
ares_array_destructor_t destruct);
|
79
|
+
|
80
|
+
|
81
|
+
/*! Request the array be at least the requested size. Useful if the desired
|
82
|
+
* array size is known prior to populating the array to prevent reallocations.
|
83
|
+
*
|
84
|
+
* \param[in] arr Initialized array object.
|
85
|
+
* \param[in] size Minimum number of members
|
86
|
+
* \return ARES_SUCCESS on success, ARES_EFORMERR on misuse,
|
87
|
+
* ARES_ENOMEM on out of memory */
|
88
|
+
CARES_EXTERN ares_status_t ares_array_set_size(ares_array_t *arr, size_t size);
|
89
|
+
|
90
|
+
/*! Sort the array using the given comparison function. This is not
|
91
|
+
* persistent, any future elements inserted will not maintain this sort.
|
92
|
+
*
|
93
|
+
* \param[in] arr Initialized array object.
|
94
|
+
* \param[in] cb Sort callback
|
95
|
+
* \return ARES_SUCCESS on success
|
96
|
+
*/
|
97
|
+
CARES_EXTERN ares_status_t ares_array_sort(ares_array_t *arr,
|
98
|
+
ares_array_cmp_t cmp);
|
99
|
+
|
100
|
+
/*! Destroy an array object. If a destructor is set, will be called on each
|
101
|
+
* member of the array.
|
102
|
+
*
|
103
|
+
* \param[in] arr Initialized array object.
|
104
|
+
*/
|
105
|
+
CARES_EXTERN void ares_array_destroy(ares_array_t *arr);
|
106
|
+
|
107
|
+
/*! Retrieve the array in the native format. This will also destroy the
|
108
|
+
* container. It is the responsibility of the caller to free the returned
|
109
|
+
* pointer and also any data within each array element.
|
110
|
+
*
|
111
|
+
* \param[in] arr Initialized array object
|
112
|
+
* \param[out] num_members the number of members in the returned array
|
113
|
+
* \return pointer to native array on success, NULL on failure.
|
114
|
+
*/
|
115
|
+
CARES_EXTERN void *ares_array_finish(ares_array_t *arr, size_t *num_members);
|
116
|
+
|
117
|
+
/*! Retrieve the number of members in the array
|
118
|
+
*
|
119
|
+
* \param[in] arr Initialized array object.
|
120
|
+
* \return numbrer of members
|
121
|
+
*/
|
122
|
+
CARES_EXTERN size_t ares_array_len(const ares_array_t *arr);
|
123
|
+
|
124
|
+
/*! Insert a new array member at the given index
|
125
|
+
*
|
126
|
+
* \param[out] elem_ptr Optional. Pointer to the returned array element.
|
127
|
+
* \param[in] arr Initialized array object.
|
128
|
+
* \param[in] idx Index in array to place new element, will shift any
|
129
|
+
* elements down that exist after this point.
|
130
|
+
* \return ARES_SUCCESS on success, ARES_EFORMERR on bad index,
|
131
|
+
* ARES_ENOMEM on out of memory.
|
132
|
+
*/
|
133
|
+
CARES_EXTERN ares_status_t ares_array_insert_at(void **elem_ptr,
|
134
|
+
ares_array_t *arr, size_t idx);
|
135
|
+
|
136
|
+
/*! Insert a new array member at the end of the array
|
137
|
+
*
|
138
|
+
* \param[out] elem_ptr Optional. Pointer to the returned array element.
|
139
|
+
* \param[in] arr Initialized array object.
|
140
|
+
* \return ARES_SUCCESS on success, ARES_ENOMEM on out of memory.
|
141
|
+
*/
|
142
|
+
CARES_EXTERN ares_status_t ares_array_insert_last(void **elem_ptr,
|
143
|
+
ares_array_t *arr);
|
144
|
+
|
145
|
+
/*! Insert a new array member at the beginning of the array
|
146
|
+
*
|
147
|
+
* \param[out] elem_ptr Optional. Pointer to the returned array element.
|
148
|
+
* \param[in] arr Initialized array object.
|
149
|
+
* \return ARES_SUCCESS on success, ARES_ENOMEM on out of memory.
|
150
|
+
*/
|
151
|
+
CARES_EXTERN ares_status_t ares_array_insert_first(void **elem_ptr,
|
152
|
+
ares_array_t *arr);
|
153
|
+
|
154
|
+
|
155
|
+
/*! Insert a new array member at the given index and copy the data pointed
|
156
|
+
* to by the data pointer into the array. This will copy member_size bytes
|
157
|
+
* from the provided pointer, this may not be safe for some data types
|
158
|
+
* that may have a smaller size than the provided member_size which includes
|
159
|
+
* padding as discussed in ares_array_create().
|
160
|
+
*
|
161
|
+
* \param[in] arr Initialized array object.
|
162
|
+
* \param[in] idx Index in array to place new element, will shift any
|
163
|
+
* elements down that exist after this point.
|
164
|
+
* \param[in] data_ptr Pointer to data to copy into array.
|
165
|
+
* \return ARES_SUCCESS on success, ARES_EFORMERR on bad index or null data
|
166
|
+
* ptr, ARES_ENOMEM on out of memory.
|
167
|
+
*/
|
168
|
+
CARES_EXTERN ares_status_t ares_array_insertdata_at(ares_array_t *arr,
|
169
|
+
size_t idx,
|
170
|
+
const void *data_ptr);
|
171
|
+
|
172
|
+
/*! Insert a new array member at the end of the array and copy the data pointed
|
173
|
+
* to by the data pointer into the array. This will copy member_size bytes
|
174
|
+
* from the provided pointer, this may not be safe for some data types
|
175
|
+
* that may have a smaller size than the provided member_size which includes
|
176
|
+
* padding as discussed in ares_array_create().
|
177
|
+
*
|
178
|
+
* \param[in] arr Initialized array object.
|
179
|
+
* \param[in] data_ptr Pointer to data to copy into array.
|
180
|
+
* \return ARES_SUCCESS on success, ARES_EFORMERR on bad index or null data
|
181
|
+
* ptr, ARES_ENOMEM on out of memory.
|
182
|
+
*/
|
183
|
+
CARES_EXTERN ares_status_t ares_array_insertdata_last(ares_array_t *arr,
|
184
|
+
const void *data_ptr);
|
185
|
+
|
186
|
+
/*! Insert a new array member at the beginning of the array and copy the data
|
187
|
+
* pointed to by the data pointer into the array. This will copy member_size
|
188
|
+
* bytes from the provided pointer, this may not be safe for some data types
|
189
|
+
* that may have a smaller size than the provided member_size which includes
|
190
|
+
* padding as discussed in ares_array_create().
|
191
|
+
*
|
192
|
+
* \param[in] arr Initialized array object.
|
193
|
+
* \param[in] data_ptr Pointer to data to copy into array.
|
194
|
+
* \return ARES_SUCCESS on success, ARES_EFORMERR on bad index or null data
|
195
|
+
* ptr, ARES_ENOMEM on out of memory.
|
196
|
+
*/
|
197
|
+
CARES_EXTERN ares_status_t ares_array_insertdata_first(ares_array_t *arr,
|
198
|
+
const void *data_ptr);
|
199
|
+
|
200
|
+
/*! Fetch a pointer to the given element in the array
|
201
|
+
* \param[in] array Initialized array object
|
202
|
+
* \param[in] idx Index to fetch
|
203
|
+
* \return pointer on success, NULL on failure */
|
204
|
+
CARES_EXTERN void *ares_array_at(ares_array_t *arr, size_t idx);
|
205
|
+
|
206
|
+
/*! Fetch a pointer to the first element in the array
|
207
|
+
* \param[in] array Initialized array object
|
208
|
+
* \return pointer on success, NULL on failure */
|
209
|
+
CARES_EXTERN void *ares_array_first(ares_array_t *arr);
|
210
|
+
|
211
|
+
/*! Fetch a pointer to the last element in the array
|
212
|
+
* \param[in] array Initialized array object
|
213
|
+
* \return pointer on success, NULL on failure */
|
214
|
+
CARES_EXTERN void *ares_array_last(ares_array_t *arr);
|
215
|
+
|
216
|
+
/*! Fetch a constant pointer to the given element in the array
|
217
|
+
* \param[in] array Initialized array object
|
218
|
+
* \param[in] idx Index to fetch
|
219
|
+
* \return pointer on success, NULL on failure */
|
220
|
+
CARES_EXTERN const void *ares_array_at_const(const ares_array_t *arr,
|
221
|
+
size_t idx);
|
222
|
+
|
223
|
+
/*! Fetch a constant pointer to the first element in the array
|
224
|
+
* \param[in] array Initialized array object
|
225
|
+
* \return pointer on success, NULL on failure */
|
226
|
+
CARES_EXTERN const void *ares_array_first_const(const ares_array_t *arr);
|
227
|
+
|
228
|
+
/*! Fetch a constant pointer to the last element in the array
|
229
|
+
* \param[in] array Initialized array object
|
230
|
+
* \return pointer on success, NULL on failure */
|
231
|
+
CARES_EXTERN const void *ares_array_last_const(const ares_array_t *arr);
|
232
|
+
|
233
|
+
/*! Claim the data from the specified array index, copying it to the buffer
|
234
|
+
* provided by the caller. The index specified in the array will then be
|
235
|
+
* removed (without calling any possible destructor)
|
236
|
+
*
|
237
|
+
* \param[in,out] dest Optional. Buffer to hold array member. Pass NULL
|
238
|
+
* if not needed. This could leak memory if array
|
239
|
+
* member needs destructor if not provided.
|
240
|
+
* \param[in] dest_size Size of buffer provided, used as a sanity check.
|
241
|
+
* Must match member_size provided to
|
242
|
+
* ares_array_create() if dest_size specified.
|
243
|
+
* \param[in] arr Initialized array object
|
244
|
+
* \param[in] idx Index to claim
|
245
|
+
* \return ARES_SUCCESS on success, ARES_EFORMERR on usage failure.
|
246
|
+
*/
|
247
|
+
CARES_EXTERN ares_status_t ares_array_claim_at(void *dest, size_t dest_size,
|
248
|
+
ares_array_t *arr, size_t idx);
|
249
|
+
|
250
|
+
/*! Remove the member at the specified array index. The destructor will be
|
251
|
+
* called.
|
252
|
+
*
|
253
|
+
* \param[in] arr Initialized array object
|
254
|
+
* \param[in] idx Index to remove
|
255
|
+
* \return ARES_SUCCESS if removed, ARES_EFORMERR on invalid use
|
256
|
+
*/
|
257
|
+
CARES_EXTERN ares_status_t ares_array_remove_at(ares_array_t *arr, size_t idx);
|
258
|
+
|
259
|
+
/*! Remove the first member of the array.
|
260
|
+
*
|
261
|
+
* \param[in] arr Initialized array object
|
262
|
+
* \return ARES_SUCCESS if removed, ARES_EFORMERR on invalid use
|
263
|
+
*/
|
264
|
+
CARES_EXTERN ares_status_t ares_array_remove_first(ares_array_t *arr);
|
265
|
+
|
266
|
+
/*! Remove the last member of the array.
|
267
|
+
*
|
268
|
+
* \param[in] arr Initialized array object
|
269
|
+
* \return ARES_SUCCESS if removed, ARES_EFORMERR on invalid use
|
270
|
+
*/
|
271
|
+
CARES_EXTERN ares_status_t ares_array_remove_last(ares_array_t *arr);
|
272
|
+
|
273
|
+
|
274
|
+
/*! @} */
|
275
|
+
|
276
|
+
#endif /* __ARES__ARRAY_H */
|