grpc 1.10.0 → 1.11.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +2098 -501
- data/include/grpc/byte_buffer.h +2 -0
- data/include/grpc/byte_buffer_reader.h +2 -0
- data/include/grpc/census.h +2 -0
- data/include/grpc/fork.h +2 -0
- data/include/grpc/grpc.h +10 -0
- data/include/grpc/grpc_cronet.h +2 -0
- data/include/grpc/grpc_posix.h +2 -1
- data/include/grpc/grpc_security.h +21 -0
- data/include/grpc/grpc_security_constants.h +1 -0
- data/include/grpc/impl/codegen/byte_buffer.h +2 -0
- data/include/grpc/impl/codegen/grpc_types.h +24 -0
- data/include/grpc/impl/codegen/slice.h +1 -1
- data/include/grpc/impl/codegen/sync.h +1 -0
- data/include/grpc/impl/codegen/sync_custom.h +2 -0
- data/include/grpc/impl/codegen/sync_generic.h +2 -0
- data/include/grpc/impl/codegen/sync_posix.h +2 -0
- data/include/grpc/impl/codegen/sync_windows.h +2 -0
- data/include/grpc/slice.h +2 -0
- data/include/grpc/slice_buffer.h +2 -0
- data/include/grpc/status.h +2 -0
- data/include/grpc/support/alloc.h +2 -2
- data/include/grpc/support/atm.h +2 -0
- data/include/grpc/support/atm_gcc_atomic.h +2 -0
- data/include/grpc/support/atm_gcc_sync.h +2 -0
- data/include/grpc/support/atm_windows.h +2 -0
- data/include/grpc/support/log.h +1 -1
- data/include/grpc/support/sync.h +2 -0
- data/include/grpc/support/sync_custom.h +2 -0
- data/include/grpc/support/sync_generic.h +2 -0
- data/include/grpc/support/sync_posix.h +2 -0
- data/include/grpc/support/sync_windows.h +2 -0
- data/include/grpc/support/time.h +2 -0
- data/src/boringssl/err_data.c +444 -438
- data/src/core/ext/census/grpc_context.cc +2 -0
- data/src/core/ext/filters/client_channel/backup_poller.cc +13 -8
- data/src/core/ext/filters/client_channel/backup_poller.h +3 -2
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +2 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +1988 -433
- data/src/core/ext/filters/client_channel/client_channel.h +2 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +2 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -0
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +2 -27
- data/src/core/ext/filters/client_channel/connector.cc +2 -0
- data/src/core/ext/filters/client_channel/connector.h +2 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -0
- data/src/core/ext/filters/client_channel/http_proxy.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +96 -78
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +9 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +70 -62
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +4 -2
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +4 -2
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +3 -1
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -1
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +2 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +2 -1
- data/src/core/ext/filters/client_channel/method_params.cc +178 -0
- data/src/core/ext/filters/client_channel/method_params.h +74 -0
- data/src/core/ext/filters/client_channel/parse_address.cc +17 -13
- data/src/core/ext/filters/client_channel/parse_address.h +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.cc +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.h +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +2 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +2 -0
- data/src/core/ext/filters/client_channel/resolver.cc +2 -0
- data/src/core/ext/filters/client_channel/resolver.h +6 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +24 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +55 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +8 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +30 -3
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +7 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver_factory.h +2 -0
- data/src/core/ext/filters/client_channel/resolver_registry.cc +2 -0
- data/src/core/ext/filters/client_channel/resolver_registry.h +2 -0
- data/src/core/ext/filters/client_channel/retry_throttle.cc +102 -120
- data/src/core/ext/filters/client_channel/retry_throttle.h +52 -25
- data/src/core/ext/filters/client_channel/subchannel.cc +14 -4
- data/src/core/ext/filters/client_channel/subchannel.h +10 -1
- data/src/core/ext/filters/client_channel/subchannel_index.cc +2 -0
- data/src/core/ext/filters/client_channel/subchannel_index.h +2 -0
- data/src/core/ext/filters/client_channel/uri_parser.cc +2 -1
- data/src/core/ext/filters/client_channel/uri_parser.h +2 -1
- data/src/core/ext/filters/deadline/deadline_filter.cc +2 -1
- data/src/core/ext/filters/deadline/deadline_filter.h +2 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +27 -25
- data/src/core/ext/filters/http/client/http_client_filter.h +2 -0
- data/src/core/ext/filters/http/client_authority_filter.cc +156 -0
- data/src/core/ext/filters/http/client_authority_filter.h +34 -0
- data/src/core/ext/filters/http/http_filters_plugin.cc +2 -0
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +21 -22
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +2 -0
- data/src/core/ext/filters/http/server/http_server_filter.cc +11 -8
- data/src/core/ext/filters/http/server/http_server_filter.h +2 -0
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +2 -0
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +2 -0
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +2 -0
- data/src/core/ext/filters/max_age/max_age_filter.cc +2 -0
- data/src/core/ext/filters/max_age/max_age_filter.h +2 -0
- data/src/core/ext/filters/message_size/message_size_filter.cc +52 -49
- data/src/core/ext/filters/message_size/message_size_filter.h +2 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +5 -1
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +2 -0
- data/src/core/ext/filters/workarounds/workaround_utils.cc +2 -0
- data/src/core/ext/filters/workarounds/workaround_utils.h +2 -0
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +3 -1
- data/src/core/ext/transport/chttp2/alpn/alpn.h +2 -0
- data/src/core/ext/transport/chttp2/client/authority.cc +42 -0
- data/src/core/ext/transport/chttp2/client/authority.h +36 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +2 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +10 -3
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +2 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +37 -25
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +2 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +3 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +2 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +2 -1
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +3 -1
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -0
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +2 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +152 -182
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -0
- data/src/core/ext/transport/chttp2/transport/frame.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +15 -19
- data/src/core/ext/transport/chttp2/transport/frame_data.h +7 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +2 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +2 -0
- data/src/core/ext/transport/chttp2/transport/huffsyms.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +2 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +60 -24
- data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -4
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/varint.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +10 -6
- data/src/core/ext/transport/inproc/inproc_plugin.cc +2 -0
- data/src/core/ext/transport/inproc/inproc_transport.cc +20 -23
- data/src/core/ext/transport/inproc/inproc_transport.h +2 -0
- data/src/core/lib/avl/avl.cc +2 -0
- data/src/core/lib/avl/avl.h +2 -0
- data/src/core/lib/backoff/backoff.cc +2 -0
- data/src/core/lib/backoff/backoff.h +2 -0
- data/src/core/lib/channel/channel_args.h +2 -0
- data/src/core/lib/channel/channel_stack.cc +3 -1
- data/src/core/lib/channel/channel_stack.h +2 -0
- data/src/core/lib/channel/channel_stack_builder.cc +2 -0
- data/src/core/lib/channel/channel_stack_builder.h +2 -0
- data/src/core/lib/channel/channel_trace.cc +239 -0
- data/src/core/lib/channel/channel_trace.h +133 -0
- data/src/core/lib/channel/channel_trace_registry.cc +80 -0
- data/src/core/lib/channel/channel_trace_registry.h +43 -0
- data/src/core/lib/channel/connected_channel.cc +2 -0
- data/src/core/lib/channel/connected_channel.h +2 -0
- data/src/core/lib/channel/handshaker.cc +2 -0
- data/src/core/lib/channel/handshaker.h +2 -0
- data/src/core/lib/channel/handshaker_factory.cc +2 -0
- data/src/core/lib/channel/handshaker_factory.h +2 -1
- data/src/core/lib/channel/handshaker_registry.cc +2 -0
- data/src/core/lib/channel/handshaker_registry.h +2 -1
- data/src/core/lib/channel/status_util.cc +100 -0
- data/src/core/lib/channel/status_util.h +58 -0
- data/src/core/lib/compression/algorithm_metadata.h +2 -0
- data/src/core/lib/compression/compression.cc +2 -0
- data/src/core/lib/compression/compression_internal.cc +2 -0
- data/src/core/lib/compression/compression_internal.h +2 -0
- data/src/core/lib/compression/message_compress.cc +2 -0
- data/src/core/lib/compression/message_compress.h +2 -0
- data/src/core/lib/compression/stream_compression.cc +2 -0
- data/src/core/lib/compression/stream_compression.h +2 -0
- data/src/core/lib/compression/stream_compression_gzip.cc +2 -0
- data/src/core/lib/compression/stream_compression_gzip.h +2 -0
- data/src/core/lib/compression/stream_compression_identity.cc +2 -1
- data/src/core/lib/compression/stream_compression_identity.h +2 -0
- data/src/core/lib/debug/stats.cc +2 -0
- data/src/core/lib/debug/stats.h +2 -0
- data/src/core/lib/debug/stats_data.cc +3 -1
- data/src/core/lib/debug/stats_data.h +2 -0
- data/src/core/lib/debug/trace.cc +2 -0
- data/src/core/lib/debug/trace.h +2 -1
- data/src/core/lib/gpr/alloc.cc +2 -1
- data/src/core/lib/gpr/arena.cc +47 -0
- data/src/core/lib/gpr/arena.h +2 -0
- data/src/core/lib/gpr/atm.cc +2 -0
- data/src/core/lib/gpr/cpu_linux.cc +5 -1
- data/src/core/lib/gpr/cpu_posix.cc +1 -1
- data/src/core/lib/gpr/env.h +2 -0
- data/src/core/lib/gpr/fork.cc +2 -0
- data/src/core/lib/gpr/host_port.cc +2 -0
- data/src/core/lib/gpr/log.cc +2 -1
- data/src/core/lib/gpr/log_linux.cc +1 -0
- data/src/core/lib/gpr/mpscq.cc +2 -0
- data/src/core/lib/gpr/mpscq.h +2 -0
- data/src/core/lib/gpr/murmur_hash.cc +2 -0
- data/src/core/lib/gpr/spinlock.h +2 -0
- data/src/core/lib/gpr/string.cc +2 -1
- data/src/core/lib/gpr/string.h +2 -2
- data/src/core/lib/gpr/sync.cc +2 -0
- data/src/core/lib/gpr/time.cc +2 -0
- data/src/core/lib/gpr/time_posix.cc +1 -0
- data/src/core/lib/gpr/time_precise.cc +2 -0
- data/src/core/lib/gpr/time_precise.h +2 -0
- data/src/core/lib/gpr/tls_gcc.h +2 -0
- data/src/core/lib/gpr/tls_msvc.h +2 -0
- data/src/core/lib/gpr/tls_pthread.h +2 -0
- data/src/core/lib/gpr/tmpfile.h +2 -0
- data/src/core/lib/gprpp/atomic_with_atm.h +2 -0
- data/src/core/lib/gprpp/atomic_with_std.h +2 -0
- data/src/core/lib/gprpp/inlined_vector.h +2 -0
- data/src/core/lib/gprpp/manual_constructor.h +3 -1
- data/src/core/lib/gprpp/memory.h +5 -3
- data/src/core/lib/gprpp/orphanable.h +3 -0
- data/src/core/lib/gprpp/ref_counted.h +4 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +3 -0
- data/src/core/lib/gprpp/thd.h +135 -0
- data/src/core/lib/gprpp/thd_posix.cc +209 -0
- data/src/core/lib/gprpp/thd_windows.cc +162 -0
- data/src/core/lib/http/format_request.cc +2 -0
- data/src/core/lib/http/format_request.h +2 -0
- data/src/core/lib/http/httpcli.cc +2 -0
- data/src/core/lib/http/httpcli.h +2 -0
- data/src/core/lib/http/httpcli_security_connector.cc +16 -7
- data/src/core/lib/http/parser.cc +2 -0
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/call_combiner.cc +2 -0
- data/src/core/lib/iomgr/call_combiner.h +2 -1
- data/src/core/lib/iomgr/combiner.cc +2 -0
- data/src/core/lib/iomgr/combiner.h +2 -0
- data/src/core/lib/iomgr/endpoint.cc +4 -0
- data/src/core/lib/iomgr/endpoint.h +2 -0
- data/src/core/lib/iomgr/endpoint_pair.h +2 -0
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -0
- data/src/core/lib/iomgr/endpoint_pair_uv.cc +2 -0
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +7 -4
- data/src/core/lib/iomgr/error.h +2 -0
- data/src/core/lib/iomgr/error_internal.h +2 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +2 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.h +2 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +4 -18
- data/src/core/lib/iomgr/ev_epollex_linux.h +2 -0
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +2 -0
- data/src/core/lib/iomgr/ev_epollsig_linux.h +2 -0
- data/src/core/lib/iomgr/ev_poll_posix.cc +61 -31
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -0
- data/src/core/lib/iomgr/ev_posix.cc +35 -19
- data/src/core/lib/iomgr/ev_posix.h +2 -0
- data/src/core/lib/iomgr/ev_windows.cc +2 -0
- data/src/core/lib/iomgr/exec_ctx.cc +3 -1
- data/src/core/lib/iomgr/exec_ctx.h +21 -9
- data/src/core/lib/iomgr/executor.cc +13 -11
- data/src/core/lib/iomgr/executor.h +2 -0
- data/src/core/lib/iomgr/fork_posix.cc +4 -2
- data/src/core/lib/iomgr/fork_windows.cc +2 -0
- data/src/core/lib/iomgr/gethostname_fallback.cc +2 -0
- data/src/core/lib/iomgr/gethostname_host_name_max.cc +2 -0
- data/src/core/lib/iomgr/gethostname_sysconf.cc +2 -0
- data/src/core/lib/iomgr/iocp_windows.cc +3 -1
- data/src/core/lib/iomgr/iocp_windows.h +3 -0
- data/src/core/lib/iomgr/iomgr.cc +2 -1
- data/src/core/lib/iomgr/iomgr.h +2 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +63 -0
- data/src/core/lib/iomgr/iomgr_custom.h +47 -0
- data/src/core/lib/iomgr/iomgr_internal.cc +43 -0
- data/src/core/lib/iomgr/iomgr_internal.h +14 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +30 -3
- data/src/core/lib/iomgr/iomgr_posix.h +2 -0
- data/src/core/lib/iomgr/iomgr_uv.cc +17 -20
- data/src/core/lib/iomgr/iomgr_windows.cc +29 -3
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +2 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.h +2 -0
- data/src/core/lib/iomgr/load_file.cc +2 -0
- data/src/core/lib/iomgr/load_file.h +2 -0
- data/src/core/lib/iomgr/lockfree_event.cc +2 -0
- data/src/core/lib/iomgr/lockfree_event.h +14 -1
- data/src/core/lib/iomgr/nameser.h +2 -0
- data/src/core/lib/iomgr/network_status_tracker.cc +3 -1
- data/src/core/lib/iomgr/network_status_tracker.h +2 -0
- data/src/core/lib/iomgr/polling_entity.cc +2 -0
- data/src/core/lib/iomgr/polling_entity.h +2 -0
- data/src/core/lib/iomgr/pollset.cc +56 -0
- data/src/core/lib/iomgr/pollset.h +19 -0
- data/src/core/lib/iomgr/pollset_custom.cc +106 -0
- data/src/core/lib/iomgr/{timer_generic.h → pollset_custom.h} +15 -17
- data/src/core/lib/iomgr/pollset_set.cc +55 -0
- data/src/core/lib/iomgr/pollset_set.h +13 -0
- data/src/core/lib/iomgr/pollset_set_custom.cc +48 -0
- data/src/core/lib/iomgr/{pollset_uv.h → pollset_set_custom.h} +6 -7
- data/src/core/lib/iomgr/pollset_set_windows.cc +17 -10
- data/src/core/lib/iomgr/pollset_set_windows.h +2 -0
- data/src/core/lib/iomgr/pollset_uv.cc +42 -105
- data/src/core/lib/iomgr/pollset_windows.cc +20 -12
- data/src/core/lib/iomgr/pollset_windows.h +2 -0
- data/src/core/lib/iomgr/port.h +10 -19
- data/src/core/lib/iomgr/resolve_address.cc +50 -0
- data/src/core/lib/iomgr/resolve_address.h +39 -10
- data/src/core/lib/iomgr/resolve_address_custom.cc +187 -0
- data/src/core/lib/iomgr/resolve_address_custom.h +43 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +10 -22
- data/src/core/lib/iomgr/resolve_address_windows.cc +10 -22
- data/src/core/lib/iomgr/resource_quota.cc +2 -0
- data/src/core/lib/iomgr/resource_quota.h +3 -5
- data/src/core/lib/iomgr/sockaddr.h +3 -11
- data/src/core/lib/iomgr/sockaddr_custom.h +54 -0
- data/src/core/lib/iomgr/sockaddr_posix.h +26 -0
- data/src/core/lib/iomgr/sockaddr_utils.cc +91 -71
- data/src/core/lib/iomgr/sockaddr_utils.h +4 -0
- data/src/core/lib/iomgr/sockaddr_windows.h +21 -0
- data/src/core/lib/iomgr/socket_factory_posix.cc +2 -0
- data/src/core/lib/iomgr/socket_factory_posix.h +2 -0
- data/src/core/lib/iomgr/socket_mutator.cc +2 -0
- data/src/core/lib/iomgr/socket_mutator.h +2 -0
- data/src/core/lib/iomgr/socket_utils.h +11 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +15 -6
- data/src/core/lib/iomgr/socket_utils_linux.cc +4 -4
- data/src/core/lib/iomgr/socket_utils_posix.cc +3 -2
- data/src/core/lib/iomgr/socket_utils_posix.h +2 -0
- data/src/core/lib/iomgr/socket_utils_uv.cc +13 -2
- data/src/core/lib/iomgr/socket_utils_windows.cc +10 -0
- data/src/core/lib/iomgr/socket_windows.cc +2 -0
- data/src/core/lib/iomgr/socket_windows.h +2 -1
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +2 -0
- data/src/core/lib/iomgr/tcp_client.cc +36 -0
- data/src/core/lib/iomgr/tcp_client.h +13 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +151 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +11 -24
- data/src/core/lib/iomgr/tcp_client_posix.h +2 -0
- data/src/core/lib/iomgr/tcp_client_windows.cc +10 -23
- data/src/core/lib/iomgr/tcp_custom.cc +365 -0
- data/src/core/lib/iomgr/tcp_custom.h +81 -0
- data/src/core/lib/iomgr/tcp_posix.cc +3 -1
- data/src/core/lib/iomgr/tcp_posix.h +2 -0
- data/src/core/lib/iomgr/tcp_server.cc +73 -0
- data/src/core/lib/iomgr/tcp_server.h +24 -0
- data/src/core/lib/iomgr/tcp_server_custom.cc +472 -0
- data/src/core/lib/iomgr/tcp_server_posix.cc +41 -23
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +7 -7
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +8 -6
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +2 -0
- data/src/core/lib/iomgr/tcp_server_windows.cc +43 -21
- data/src/core/lib/iomgr/tcp_uv.cc +308 -314
- data/src/core/lib/iomgr/tcp_windows.cc +3 -1
- data/src/core/lib/iomgr/tcp_windows.h +2 -0
- data/src/core/lib/iomgr/time_averaged_stats.cc +2 -0
- data/src/core/lib/iomgr/timer.cc +45 -0
- data/src/core/lib/iomgr/timer.h +36 -15
- data/src/core/lib/iomgr/timer_custom.cc +93 -0
- data/src/core/lib/iomgr/timer_custom.h +43 -0
- data/src/core/lib/iomgr/timer_generic.cc +12 -10
- data/src/core/lib/iomgr/timer_heap.cc +2 -4
- data/src/core/lib/iomgr/timer_heap.h +2 -0
- data/src/core/lib/iomgr/timer_manager.cc +12 -20
- data/src/core/lib/iomgr/timer_manager.h +2 -0
- data/src/core/lib/iomgr/timer_uv.cc +15 -49
- data/src/core/lib/iomgr/udp_server.cc +271 -230
- data/src/core/lib/iomgr/udp_server.h +44 -20
- data/src/core/lib/iomgr/unix_sockets_posix.cc +10 -7
- data/src/core/lib/iomgr/unix_sockets_posix.h +2 -0
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_cv.cc +3 -1
- data/src/core/lib/iomgr/wakeup_fd_cv.h +2 -0
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +2 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.cc +2 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.h +2 -0
- data/src/core/lib/json/json.cc +38 -0
- data/src/core/lib/json/json.h +22 -1
- data/src/core/lib/json/json_reader.cc +2 -2
- data/src/core/lib/json/json_reader.h +1 -0
- data/src/core/lib/json/json_string.cc +2 -0
- data/src/core/lib/json/json_writer.cc +2 -2
- data/src/core/lib/json/json_writer.h +2 -0
- data/src/core/lib/profiling/basic_timers.cc +11 -9
- data/src/core/lib/profiling/timers.h +6 -3
- data/src/core/lib/security/context/security_context.cc +2 -0
- data/src/core/lib/security/context/security_context.h +2 -0
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +119 -0
- data/src/core/lib/security/credentials/alts/alts_credentials.h +102 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +72 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment.h +57 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +67 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +33 -0
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +114 -0
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +126 -0
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc +46 -0
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +112 -0
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc +58 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +2 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -0
- data/src/core/lib/security/credentials/credentials.cc +2 -0
- data/src/core/lib/security/credentials/credentials.h +2 -0
- data/src/core/lib/security/credentials/credentials_metadata.cc +2 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +2 -3
- data/src/core/lib/security/credentials/fake/fake_credentials.h +5 -0
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +2 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +2 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +2 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +2 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +2 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +11 -2
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +2 -0
- data/src/core/lib/security/security_connector/alts_security_connector.cc +287 -0
- data/src/core/lib/security/security_connector/alts_security_connector.h +69 -0
- data/src/core/lib/security/security_connector/security_connector.cc +174 -74
- data/src/core/lib/security/security_connector/security_connector.h +41 -7
- data/src/core/lib/security/transport/auth_filters.h +2 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +14 -28
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -0
- data/src/core/lib/security/transport/secure_endpoint.h +2 -0
- data/src/core/lib/security/transport/security_handshaker.cc +2 -0
- data/src/core/lib/security/transport/security_handshaker.h +2 -1
- data/src/core/lib/security/transport/server_auth_filter.cc +2 -0
- data/src/core/lib/security/transport/target_authority_table.cc +75 -0
- data/src/core/lib/security/transport/{lb_targets_info.h → target_authority_table.h} +16 -8
- data/src/core/lib/security/transport/tsi_error.cc +2 -0
- data/src/core/lib/security/transport/tsi_error.h +2 -0
- data/src/core/lib/security/util/json_util.cc +2 -0
- data/src/core/lib/security/util/json_util.h +2 -0
- data/src/core/lib/slice/b64.cc +2 -0
- data/src/core/lib/slice/b64.h +2 -0
- data/src/core/lib/slice/percent_encoding.cc +2 -0
- data/src/core/lib/slice/percent_encoding.h +2 -0
- data/src/core/lib/slice/slice.cc +2 -0
- data/src/core/lib/slice/slice_buffer.cc +3 -1
- data/src/core/lib/slice/slice_hash_table.h +178 -45
- data/src/core/lib/slice/slice_intern.cc +2 -0
- data/src/core/lib/slice/slice_internal.h +2 -2
- data/src/core/lib/slice/slice_string_helpers.cc +2 -0
- data/src/core/lib/slice/slice_string_helpers.h +2 -1
- data/src/core/lib/slice/slice_weak_hash_table.h +105 -0
- data/src/core/lib/surface/api_trace.cc +3 -1
- data/src/core/lib/surface/api_trace.h +2 -0
- data/src/core/lib/surface/byte_buffer.cc +3 -0
- data/src/core/lib/surface/byte_buffer_reader.cc +3 -0
- data/src/core/lib/surface/call.cc +46 -80
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/call_details.cc +2 -0
- data/src/core/lib/surface/call_log_batch.cc +2 -0
- data/src/core/lib/surface/call_test_only.h +2 -0
- data/src/core/lib/surface/channel.cc +72 -41
- data/src/core/lib/surface/channel.h +2 -0
- data/src/core/lib/surface/channel_init.cc +2 -0
- data/src/core/lib/surface/channel_init.h +2 -0
- data/src/core/lib/surface/channel_ping.cc +2 -0
- data/src/core/lib/surface/channel_stack_type.cc +3 -2
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.h +2 -0
- data/src/core/lib/surface/completion_queue_factory.cc +3 -1
- data/src/core/lib/surface/completion_queue_factory.h +2 -0
- data/src/core/lib/surface/event_string.cc +2 -0
- data/src/core/lib/surface/event_string.h +2 -0
- data/src/core/lib/surface/init.cc +5 -2
- data/src/core/lib/surface/init_secure.cc +5 -2
- data/src/core/lib/surface/lame_client.cc +7 -5
- data/src/core/lib/surface/lame_client.h +2 -0
- data/src/core/lib/surface/metadata_array.cc +2 -0
- data/src/core/lib/surface/server.cc +2 -0
- data/src/core/lib/surface/server.h +2 -0
- data/src/core/lib/surface/validate_metadata.cc +2 -1
- data/src/core/lib/surface/validate_metadata.h +2 -0
- data/src/core/lib/surface/version.cc +4 -2
- data/src/core/lib/transport/bdp_estimator.cc +2 -0
- data/src/core/lib/transport/byte_stream.cc +94 -116
- data/src/core/lib/transport/byte_stream.h +111 -78
- data/src/core/lib/transport/connectivity_state.cc +2 -0
- data/src/core/lib/transport/connectivity_state.h +3 -1
- data/src/core/lib/transport/error_utils.cc +2 -0
- data/src/core/lib/transport/error_utils.h +2 -0
- data/src/core/lib/transport/metadata.cc +2 -0
- data/src/core/lib/transport/metadata.h +3 -1
- data/src/core/lib/transport/metadata_batch.cc +26 -0
- data/src/core/lib/transport/metadata_batch.h +12 -1
- data/src/core/lib/transport/pid_controller.cc +2 -0
- data/src/core/lib/transport/pid_controller.h +2 -0
- data/src/core/lib/transport/service_config.cc +21 -175
- data/src/core/lib/transport/service_config.h +223 -35
- data/src/core/lib/transport/static_metadata.cc +310 -294
- data/src/core/lib/transport/static_metadata.h +96 -82
- data/src/core/lib/transport/status_conversion.cc +2 -0
- data/src/core/lib/transport/status_conversion.h +3 -0
- data/src/core/lib/transport/status_metadata.cc +54 -0
- data/src/core/lib/{iomgr/timer_uv.h → transport/status_metadata.h} +10 -12
- data/src/core/lib/transport/timeout_encoding.cc +2 -1
- data/src/core/lib/transport/timeout_encoding.h +2 -0
- data/src/core/lib/transport/transport.cc +3 -1
- data/src/core/lib/transport/transport.h +33 -7
- data/src/core/lib/transport/transport_impl.h +2 -0
- data/src/core/lib/transport/transport_op_string.cc +10 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +10 -4
- data/src/core/tsi/alts/crypt/aes_gcm.cc +687 -0
- data/src/core/tsi/alts/crypt/gsec.cc +189 -0
- data/src/core/tsi/alts/crypt/gsec.h +454 -0
- data/src/core/tsi/alts/frame_protector/alts_counter.cc +118 -0
- data/src/core/tsi/alts/frame_protector/alts_counter.h +98 -0
- data/src/core/tsi/alts/frame_protector/alts_crypter.cc +66 -0
- data/src/core/tsi/alts/frame_protector/alts_crypter.h +255 -0
- data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +407 -0
- data/src/core/tsi/alts/frame_protector/alts_frame_protector.h +55 -0
- data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.cc +114 -0
- data/src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h +114 -0
- data/src/core/tsi/alts/frame_protector/alts_seal_privacy_integrity_crypter.cc +105 -0
- data/src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc +103 -0
- data/src/core/tsi/alts/frame_protector/frame_handler.cc +218 -0
- data/src/core/tsi/alts/frame_protector/frame_handler.h +236 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +316 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +137 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +520 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +323 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +143 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +149 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_event.cc +73 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_event.h +93 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +483 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +83 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +52 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +58 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +52 -0
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +48 -0
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +64 -0
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +123 -0
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +255 -0
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +50 -0
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +78 -0
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +196 -0
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +163 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +180 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h +52 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc +144 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h +49 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h +91 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +174 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h +100 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +476 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h +199 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +296 -0
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h +52 -0
- data/src/core/tsi/alts_transport_security.cc +3 -1
- data/src/core/tsi/alts_transport_security.h +4 -2
- data/src/core/tsi/fake_transport_security.cc +2 -1
- data/src/core/tsi/fake_transport_security.h +2 -0
- data/src/core/tsi/ssl/session_cache/ssl_session.h +73 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +58 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +211 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +93 -0
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +76 -0
- data/src/core/tsi/ssl_transport_security.cc +266 -62
- data/src/core/tsi/ssl_transport_security.h +128 -6
- data/src/core/tsi/ssl_types.h +2 -0
- data/src/core/tsi/transport_security.cc +2 -0
- data/src/core/tsi/transport_security.h +2 -0
- data/src/core/tsi/transport_security_adapter.cc +2 -0
- data/src/core/tsi/transport_security_adapter.h +2 -0
- data/src/core/tsi/transport_security_grpc.cc +2 -0
- data/src/core/tsi/transport_security_grpc.h +2 -0
- data/src/core/tsi/transport_security_interface.h +2 -0
- data/src/ruby/ext/grpc/extconf.rb +1 -2
- data/src/ruby/ext/grpc/rb_call.c +1 -13
- data/src/ruby/ext/grpc/rb_channel.c +6 -6
- data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
- data/src/ruby/lib/grpc/core/time_consts.rb +1 -1
- data/src/ruby/lib/grpc/generic/bidi_call.rb +19 -8
- data/src/ruby/lib/grpc/generic/client_stub.rb +6 -10
- data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/generic/client_stub_spec.rb +133 -0
- data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +54 -0
- data/src/ruby/spec/pb/package_with_underscore/data.proto +23 -0
- data/src/ruby/spec/pb/package_with_underscore/service.proto +23 -0
- data/third_party/address_sorting/address_sorting.c +369 -0
- data/third_party/address_sorting/address_sorting_internal.h +70 -0
- data/third_party/address_sorting/address_sorting_posix.c +97 -0
- data/third_party/address_sorting/address_sorting_windows.c +55 -0
- data/third_party/address_sorting/include/address_sorting/address_sorting.h +110 -0
- data/third_party/boringssl/crypto/asn1/a_enum.c +20 -9
- data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +3 -0
- data/third_party/boringssl/crypto/asn1/a_int.c +19 -8
- data/third_party/boringssl/crypto/asn1/a_object.c +0 -128
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +3 -0
- data/third_party/boringssl/crypto/asn1/tasn_fre.c +2 -4
- data/third_party/boringssl/crypto/asn1/tasn_new.c +3 -2
- data/third_party/boringssl/crypto/bn_extra/bn_asn1.c +0 -16
- data/third_party/boringssl/crypto/buf/buf.c +14 -0
- data/third_party/boringssl/crypto/bytestring/cbb.c +93 -0
- data/third_party/boringssl/crypto/conf/conf.c +2 -2
- data/third_party/boringssl/crypto/cpu-intel.c +17 -17
- data/third_party/boringssl/crypto/crypto.c +16 -4
- data/third_party/boringssl/crypto/curve25519/spake25519.c +11 -11
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +1 -1
- data/third_party/boringssl/crypto/dsa/dsa.c +9 -21
- data/third_party/boringssl/crypto/ec_extra/ec_asn1.c +2 -2
- data/third_party/boringssl/crypto/ecdsa_extra/ecdsa_asn1.c +1 -8
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +2 -23
- data/third_party/boringssl/crypto/ex_data.c +0 -1
- data/third_party/boringssl/crypto/fipsmodule/bn/add.c +7 -11
- data/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.c +19 -16
- data/third_party/boringssl/crypto/fipsmodule/bn/cmp.c +15 -0
- data/third_party/boringssl/crypto/fipsmodule/bn/div.c +53 -46
- data/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.c +242 -85
- data/third_party/boringssl/crypto/fipsmodule/bn/generic.c +42 -47
- data/third_party/boringssl/crypto/fipsmodule/bn/internal.h +176 -34
- data/third_party/boringssl/crypto/fipsmodule/bn/montgomery.c +118 -65
- data/third_party/boringssl/crypto/fipsmodule/bn/mul.c +94 -61
- data/third_party/boringssl/crypto/fipsmodule/bn/random.c +79 -63
- data/third_party/boringssl/crypto/fipsmodule/bn/shift.c +26 -28
- data/third_party/boringssl/crypto/fipsmodule/cipher/cipher.c +2 -0
- data/third_party/boringssl/crypto/fipsmodule/ec/ec.c +250 -149
- data/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.c +0 -27
- data/third_party/boringssl/crypto/fipsmodule/ec/internal.h +54 -20
- data/third_party/boringssl/crypto/fipsmodule/ec/oct.c +3 -3
- data/third_party/boringssl/crypto/fipsmodule/ec/p224-64.c +7 -41
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-64.c +6 -40
- data/third_party/boringssl/crypto/fipsmodule/ec/p256-x86_64.c +17 -122
- data/third_party/boringssl/crypto/fipsmodule/ec/simple.c +3 -64
- data/third_party/boringssl/crypto/fipsmodule/ec/wnaf.c +27 -9
- data/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.c +203 -205
- data/third_party/boringssl/crypto/fipsmodule/modes/cbc.c +14 -15
- data/third_party/boringssl/crypto/fipsmodule/modes/cfb.c +12 -8
- data/third_party/boringssl/crypto/fipsmodule/modes/ctr.c +4 -3
- data/third_party/boringssl/crypto/fipsmodule/modes/gcm.c +25 -36
- data/third_party/boringssl/crypto/fipsmodule/modes/internal.h +10 -0
- data/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +0 -4
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa.c +2 -0
- data/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.c +9 -19
- data/third_party/boringssl/crypto/lhash/lhash.c +19 -0
- data/third_party/boringssl/crypto/obj/obj.c +29 -69
- data/third_party/boringssl/crypto/pem/pem_lib.c +2 -2
- data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +4 -55
- data/third_party/boringssl/crypto/rsa_extra/rsa_asn1.c +3 -22
- data/third_party/boringssl/crypto/x509/by_dir.c +1 -3
- data/third_party/boringssl/crypto/x509/by_file.c +0 -1
- data/third_party/boringssl/crypto/x509/x509_lu.c +0 -1
- data/third_party/boringssl/crypto/x509/x509_obj.c +1 -3
- data/third_party/boringssl/crypto/x509/x509_txt.c +0 -6
- data/third_party/boringssl/crypto/x509/x509_vfy.c +0 -1
- data/third_party/boringssl/crypto/x509/x509_vpm.c +0 -1
- data/third_party/boringssl/crypto/x509/x_algor.c +2 -2
- data/third_party/boringssl/crypto/x509v3/v3_alt.c +3 -4
- data/third_party/boringssl/crypto/x509v3/v3_genn.c +1 -0
- data/third_party/boringssl/crypto/x509v3/v3_info.c +1 -2
- data/third_party/boringssl/crypto/x509v3/v3_lib.c +15 -7
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +41 -2
- data/third_party/boringssl/include/openssl/asn1.h +0 -1
- data/third_party/boringssl/include/openssl/base.h +1 -1
- data/third_party/boringssl/include/openssl/bio.h +5 -2
- data/third_party/boringssl/include/openssl/bn.h +2 -17
- data/third_party/boringssl/include/openssl/buf.h +4 -0
- data/third_party/boringssl/include/openssl/bytestring.h +11 -0
- data/third_party/boringssl/include/openssl/chacha.h +5 -1
- data/third_party/boringssl/include/openssl/cipher.h +10 -0
- data/third_party/boringssl/include/openssl/conf.h +4 -8
- data/third_party/boringssl/include/openssl/dsa.h +2 -18
- data/third_party/boringssl/include/openssl/ec.h +5 -5
- data/third_party/boringssl/include/openssl/ecdsa.h +10 -28
- data/third_party/boringssl/include/openssl/evp.h +0 -4
- data/third_party/boringssl/include/openssl/lhash.h +1 -18
- data/third_party/boringssl/include/openssl/obj.h +1 -0
- data/third_party/boringssl/include/openssl/rsa.h +3 -4
- data/third_party/boringssl/include/openssl/ssl.h +35 -54
- data/third_party/boringssl/include/openssl/ssl3.h +2 -0
- data/third_party/boringssl/include/openssl/stack.h +1 -1
- data/third_party/boringssl/include/openssl/tls1.h +1 -16
- data/third_party/boringssl/include/openssl/x509.h +3 -2
- data/third_party/boringssl/include/openssl/x509_vfy.h +0 -2
- data/third_party/boringssl/include/openssl/x509v3.h +1 -0
- data/third_party/boringssl/ssl/custom_extensions.cc +1 -1
- data/third_party/boringssl/ssl/d1_both.cc +120 -129
- data/third_party/boringssl/ssl/d1_lib.cc +23 -21
- data/third_party/boringssl/ssl/d1_pkt.cc +39 -143
- data/third_party/boringssl/ssl/dtls_method.cc +16 -23
- data/third_party/boringssl/ssl/dtls_record.cc +11 -4
- data/third_party/boringssl/ssl/handshake.cc +109 -40
- data/third_party/boringssl/ssl/handshake_client.cc +104 -96
- data/third_party/boringssl/ssl/handshake_server.cc +62 -72
- data/third_party/boringssl/ssl/internal.h +397 -318
- data/third_party/boringssl/ssl/s3_both.cc +173 -191
- data/third_party/boringssl/ssl/s3_lib.cc +26 -34
- data/third_party/boringssl/ssl/s3_pkt.cc +105 -247
- data/third_party/boringssl/ssl/ssl_asn1.cc +22 -22
- data/third_party/boringssl/ssl/ssl_buffer.cc +98 -108
- data/third_party/boringssl/ssl/ssl_cert.cc +12 -1
- data/third_party/boringssl/ssl/ssl_cipher.cc +23 -28
- data/third_party/boringssl/ssl/ssl_key_share.cc +11 -6
- data/third_party/boringssl/ssl/ssl_lib.cc +190 -113
- data/third_party/boringssl/ssl/ssl_privkey.cc +76 -106
- data/third_party/boringssl/ssl/ssl_session.cc +3 -3
- data/third_party/boringssl/ssl/ssl_stat.cc +3 -3
- data/third_party/boringssl/ssl/ssl_transcript.cc +38 -22
- data/third_party/boringssl/ssl/ssl_versions.cc +64 -31
- data/third_party/boringssl/ssl/t1_enc.cc +137 -154
- data/third_party/boringssl/ssl/t1_lib.cc +463 -478
- data/third_party/boringssl/ssl/tls13_both.cc +57 -58
- data/third_party/boringssl/ssl/tls13_client.cc +256 -121
- data/third_party/boringssl/ssl/tls13_enc.cc +187 -72
- data/third_party/boringssl/ssl/tls13_server.cc +187 -86
- data/third_party/boringssl/ssl/tls_method.cc +20 -30
- data/third_party/boringssl/ssl/tls_record.cc +77 -40
- data/third_party/boringssl/third_party/fiat/curve25519.c +5062 -0
- data/third_party/boringssl/{crypto/curve25519 → third_party/fiat}/internal.h +40 -27
- data/third_party/nanopb/pb.h +1 -1
- metadata +147 -45
- data/src/core/lib/gpr/thd.cc +0 -49
- data/src/core/lib/gpr/thd.h +0 -71
- data/src/core/lib/gpr/thd_posix.cc +0 -154
- data/src/core/lib/gpr/thd_windows.cc +0 -107
- data/src/core/lib/iomgr/iomgr_uv.h +0 -37
- data/src/core/lib/iomgr/pollset_set_uv.cc +0 -43
- data/src/core/lib/iomgr/resolve_address_uv.cc +0 -284
- data/src/core/lib/iomgr/tcp_client_uv.cc +0 -175
- data/src/core/lib/iomgr/tcp_server_uv.cc +0 -471
- data/src/core/lib/iomgr/tcp_uv.h +0 -51
- data/src/core/lib/security/transport/lb_targets_info.cc +0 -59
- data/src/core/lib/slice/slice_hash_table.cc +0 -145
- data/third_party/boringssl/crypto/curve25519/curve25519.c +0 -4938
@@ -58,8 +58,8 @@ module GRPC
|
|
58
58
|
# Minimally, a stub is created with the just the host of the gRPC service
|
59
59
|
# it wishes to access, e.g.,
|
60
60
|
#
|
61
|
-
#
|
62
|
-
#
|
61
|
+
# my_stub = ClientStub.new(example.host.com:50505,
|
62
|
+
# :this_channel_is_insecure)
|
63
63
|
#
|
64
64
|
# If a channel_override argument is passed, it will be used as the
|
65
65
|
# underlying channel. Otherwise, the channel_args argument will be used
|
@@ -376,7 +376,7 @@ module GRPC
|
|
376
376
|
# This is a blocking call.
|
377
377
|
#
|
378
378
|
# * the call completes when the next call to provided block returns
|
379
|
-
#
|
379
|
+
# false
|
380
380
|
#
|
381
381
|
# * the execution block parameters are two objects for sending and
|
382
382
|
# receiving responses, each of which blocks waiting for flow control.
|
@@ -398,13 +398,9 @@ module GRPC
|
|
398
398
|
# responses by throwing StopIteration, but can only happen either
|
399
399
|
# if bidi_call#writes_done is called.
|
400
400
|
#
|
401
|
-
# To terminate the RPC
|
402
|
-
#
|
403
|
-
#
|
404
|
-
#
|
405
|
-
# * either return false as soon as there is no need for other responses
|
406
|
-
#
|
407
|
-
# * loop on responses#next until no further responses are available
|
401
|
+
# To properly terminate the RPC, the responses should be completely iterated
|
402
|
+
# through; one way to do this is to loop on responses#next until no further
|
403
|
+
# responses are available.
|
408
404
|
#
|
409
405
|
# == Errors ==
|
410
406
|
# An RuntimeError is raised if
|
@@ -204,7 +204,7 @@ module GRPC
|
|
204
204
|
# * connect_md_proc:
|
205
205
|
# when non-nil is a proc for determining metadata to to send back the client
|
206
206
|
# on receiving an invocation req. The proc signature is:
|
207
|
-
#
|
207
|
+
# {key: val, ..} func(method_name, {key: val, ...})
|
208
208
|
#
|
209
209
|
# * server_args:
|
210
210
|
# A server arguments hash to be passed down to the underlying core server
|
@@ -283,7 +283,7 @@ module GRPC
|
|
283
283
|
# If run has not been called, this returns immediately.
|
284
284
|
#
|
285
285
|
# @param timeout [Numeric] number of seconds to wait
|
286
|
-
# @
|
286
|
+
# @return [true, false] true if the server is running, false otherwise
|
287
287
|
def wait_till_running(timeout = nil)
|
288
288
|
@run_mutex.synchronize do
|
289
289
|
@run_cond.wait(@run_mutex, timeout) if @running_state == :not_started
|
@@ -750,6 +750,90 @@ describe 'ClientStub' do # rubocop:disable Metrics/BlockLength
|
|
750
750
|
expected_error_message)
|
751
751
|
end
|
752
752
|
end
|
753
|
+
|
754
|
+
# Prompted by grpc/github #14853
|
755
|
+
describe 'client-side error handling on bidi streams' do
|
756
|
+
class EnumeratorQueue
|
757
|
+
def initialize(queue)
|
758
|
+
@queue = queue
|
759
|
+
end
|
760
|
+
|
761
|
+
def each
|
762
|
+
loop do
|
763
|
+
msg = @queue.pop
|
764
|
+
break if msg.nil?
|
765
|
+
yield msg
|
766
|
+
end
|
767
|
+
end
|
768
|
+
end
|
769
|
+
|
770
|
+
def run_server_bidi_shutdown_after_one_read
|
771
|
+
@server.start
|
772
|
+
recvd_rpc = @server.request_call
|
773
|
+
recvd_call = recvd_rpc.call
|
774
|
+
server_call = GRPC::ActiveCall.new(
|
775
|
+
recvd_call, noop, noop, INFINITE_FUTURE,
|
776
|
+
metadata_received: true, started: false)
|
777
|
+
expect(server_call.remote_read).to eq('first message')
|
778
|
+
@server.shutdown_and_notify(from_relative_time(0))
|
779
|
+
@server.close
|
780
|
+
end
|
781
|
+
|
782
|
+
it 'receives a grpc status code when writes to a bidi stream fail' do
|
783
|
+
# This test tries to trigger the case when a 'SEND_MESSAGE' op
|
784
|
+
# and subseqeunt 'SEND_CLOSE_FROM_CLIENT' op of a bidi stream fails.
|
785
|
+
# In this case, iteration through the response stream should result
|
786
|
+
# in a grpc status code, and the writer thread should not raise an
|
787
|
+
# exception.
|
788
|
+
server_thread = Thread.new do
|
789
|
+
run_server_bidi_shutdown_after_one_read
|
790
|
+
end
|
791
|
+
stub = GRPC::ClientStub.new(@host, :this_channel_is_insecure)
|
792
|
+
request_queue = Queue.new
|
793
|
+
@sent_msgs = EnumeratorQueue.new(request_queue)
|
794
|
+
responses = get_responses(stub)
|
795
|
+
request_queue.push('first message')
|
796
|
+
# Now wait for the server to shut down.
|
797
|
+
server_thread.join
|
798
|
+
# Sanity check. This test is not interesting if
|
799
|
+
# Thread.abort_on_exception is not set.
|
800
|
+
expect(Thread.abort_on_exception).to be(true)
|
801
|
+
# An attempt to send a second message should fail now that the
|
802
|
+
# server is down.
|
803
|
+
request_queue.push('second message')
|
804
|
+
request_queue.push(nil)
|
805
|
+
expect { responses.next }.to raise_error(GRPC::BadStatus)
|
806
|
+
end
|
807
|
+
|
808
|
+
def run_server_bidi_shutdown_after_one_write
|
809
|
+
@server.start
|
810
|
+
recvd_rpc = @server.request_call
|
811
|
+
recvd_call = recvd_rpc.call
|
812
|
+
server_call = GRPC::ActiveCall.new(
|
813
|
+
recvd_call, noop, noop, INFINITE_FUTURE,
|
814
|
+
metadata_received: true, started: false)
|
815
|
+
server_call.send_initial_metadata
|
816
|
+
server_call.remote_send('message')
|
817
|
+
@server.shutdown_and_notify(from_relative_time(0))
|
818
|
+
@server.close
|
819
|
+
end
|
820
|
+
|
821
|
+
it 'receives a grpc status code when reading from a failed bidi call' do
|
822
|
+
server_thread = Thread.new do
|
823
|
+
run_server_bidi_shutdown_after_one_write
|
824
|
+
end
|
825
|
+
stub = GRPC::ClientStub.new(@host, :this_channel_is_insecure)
|
826
|
+
request_queue = Queue.new
|
827
|
+
@sent_msgs = EnumeratorQueue.new(request_queue)
|
828
|
+
responses = get_responses(stub)
|
829
|
+
expect(responses.next).to eq('message')
|
830
|
+
# Wait for the server to shut down
|
831
|
+
server_thread.join
|
832
|
+
expect { responses.next }.to raise_error(GRPC::BadStatus)
|
833
|
+
# Push a sentinel to allow the writer thread to finish
|
834
|
+
request_queue.push(nil)
|
835
|
+
end
|
836
|
+
end
|
753
837
|
end
|
754
838
|
|
755
839
|
describe 'without a call operation' do
|
@@ -810,6 +894,55 @@ describe 'ClientStub' do # rubocop:disable Metrics/BlockLength
|
|
810
894
|
responses.each { |r| p r }
|
811
895
|
end
|
812
896
|
end
|
897
|
+
|
898
|
+
def run_server_bidi_expect_client_to_cancel(wait_for_shutdown_ok_callback)
|
899
|
+
@server.start
|
900
|
+
recvd_rpc = @server.request_call
|
901
|
+
recvd_call = recvd_rpc.call
|
902
|
+
server_call = GRPC::ActiveCall.new(
|
903
|
+
recvd_call, noop, noop, INFINITE_FUTURE,
|
904
|
+
metadata_received: true, started: false)
|
905
|
+
server_call.send_initial_metadata
|
906
|
+
server_call.remote_send('server call received')
|
907
|
+
wait_for_shutdown_ok_callback.call
|
908
|
+
# since the client is cancelling the call,
|
909
|
+
# we should be able to shut down cleanly
|
910
|
+
@server.shutdown_and_notify(nil)
|
911
|
+
@server.close
|
912
|
+
end
|
913
|
+
|
914
|
+
it 'receives a grpc status code when reading from a cancelled bidi call' do
|
915
|
+
# This test tries to trigger a 'RECV_INITIAL_METADATA' and/or
|
916
|
+
# 'RECV_MESSAGE' op failure.
|
917
|
+
# An attempt to read a message might fail; in that case, iteration
|
918
|
+
# through the response stream should still result in a grpc status.
|
919
|
+
server_can_shutdown = false
|
920
|
+
server_can_shutdown_mu = Mutex.new
|
921
|
+
server_can_shutdown_cv = ConditionVariable.new
|
922
|
+
wait_for_shutdown_ok_callback = proc do
|
923
|
+
server_can_shutdown_mu.synchronize do
|
924
|
+
server_can_shutdown_cv.wait(server_can_shutdown_mu) until server_can_shutdown
|
925
|
+
end
|
926
|
+
end
|
927
|
+
server_thread = Thread.new do
|
928
|
+
run_server_bidi_expect_client_to_cancel(wait_for_shutdown_ok_callback)
|
929
|
+
end
|
930
|
+
stub = GRPC::ClientStub.new(@host, :this_channel_is_insecure)
|
931
|
+
request_queue = Queue.new
|
932
|
+
@sent_msgs = EnumeratorQueue.new(request_queue)
|
933
|
+
responses = get_responses(stub)
|
934
|
+
expect(responses.next).to eq('server call received')
|
935
|
+
@op.cancel
|
936
|
+
expect { responses.next }.to raise_error(GRPC::Cancelled)
|
937
|
+
# Now let the server proceed to shut down.
|
938
|
+
server_can_shutdown_mu.synchronize do
|
939
|
+
server_can_shutdown = true
|
940
|
+
server_can_shutdown_cv.broadcast
|
941
|
+
end
|
942
|
+
server_thread.join
|
943
|
+
# Push a sentinel to allow the writer thread to finish
|
944
|
+
request_queue.push(nil)
|
945
|
+
end
|
813
946
|
end
|
814
947
|
end
|
815
948
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright 2016 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
|
+
require 'open3'
|
16
|
+
require 'tmpdir'
|
17
|
+
|
18
|
+
def debug_mode?
|
19
|
+
!ENV['CONFIG'].nil? && ENV['CONFIG'] == 'dbg'
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'Package with underscore protobuf code generation' do
|
23
|
+
it 'should have the same content as created by code generation' do
|
24
|
+
root_dir = File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..')
|
25
|
+
pb_dir = File.join(root_dir, 'src', 'ruby', 'spec', 'pb')
|
26
|
+
|
27
|
+
bins_sub_dir = debug_mode? ? 'dbg' : 'opt'
|
28
|
+
bins_dir = File.join(root_dir, 'bins', bins_sub_dir)
|
29
|
+
|
30
|
+
plugin = File.join(bins_dir, 'grpc_ruby_plugin')
|
31
|
+
protoc = File.join(bins_dir, 'protobuf', 'protoc')
|
32
|
+
|
33
|
+
got = nil
|
34
|
+
|
35
|
+
Dir.mktmpdir do |tmp_dir|
|
36
|
+
gen_out = File.join(tmp_dir, 'package_with_underscore', 'service_services_pb.rb')
|
37
|
+
|
38
|
+
pid = spawn(
|
39
|
+
protoc,
|
40
|
+
'-I.',
|
41
|
+
'package_with_underscore/service.proto',
|
42
|
+
"--grpc_out=#{tmp_dir}",
|
43
|
+
"--plugin=protoc-gen-grpc=#{plugin}",
|
44
|
+
chdir: pb_dir)
|
45
|
+
Process.waitpid2(pid)
|
46
|
+
File.open(gen_out) { |f| got = f.read }
|
47
|
+
end
|
48
|
+
|
49
|
+
correct_modularized_rpc = 'rpc :TestOne, ' \
|
50
|
+
'Grpc::Testing::PackageWithUnderscore::Data::Request, ' \
|
51
|
+
'Grpc::Testing::PackageWithUnderscore::Data::Response'
|
52
|
+
expect(got).to include(correct_modularized_rpc)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// Copyright 2018 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
|
+
syntax = "proto3";
|
16
|
+
|
17
|
+
package grpc.testing.package_with_underscore.data;
|
18
|
+
|
19
|
+
message Request {
|
20
|
+
}
|
21
|
+
|
22
|
+
message Response {
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// Copyright 2018 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
|
+
syntax = "proto3";
|
16
|
+
|
17
|
+
package grpc.testing.package_with_underscore.service;
|
18
|
+
|
19
|
+
import "package_with_underscore/data.proto";
|
20
|
+
|
21
|
+
service MyService {
|
22
|
+
rpc TestOne(data.Request) returns (data.Response) {}
|
23
|
+
}
|
@@ -0,0 +1,369 @@
|
|
1
|
+
/* $NetBSD: getaddrinfo.c,v 1.82 2006/03/25 12:09:40 rpaulo Exp $ */
|
2
|
+
/* $KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $ */
|
3
|
+
/*
|
4
|
+
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
5
|
+
* All rights reserved.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
8
|
+
* modification, are permitted provided that the following conditions
|
9
|
+
* are met:
|
10
|
+
* 1. Redistributions of source code must retain the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
12
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
13
|
+
* notice, this list of conditions and the following disclaimer in the
|
14
|
+
* documentation and/or other materials provided with the distribution.
|
15
|
+
* 3. Neither the name of the project nor the names of its contributors
|
16
|
+
* may be used to endorse or promote products derived from this software
|
17
|
+
* without specific prior written permission.
|
18
|
+
*
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
20
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
23
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
25
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
26
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
27
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
28
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
29
|
+
* SUCH DAMAGE.
|
30
|
+
*
|
31
|
+
*/
|
32
|
+
|
33
|
+
/*
|
34
|
+
* This is an adaptation of Android's implementation of RFC 6724
|
35
|
+
* (in Android's getaddrinfo.c). It has some cosmetic differences
|
36
|
+
* from Android's getaddrinfo.c, but Android's getaddrinfo.c was
|
37
|
+
* used as a guide or example of a way to implement the RFC 6724 spec when
|
38
|
+
* this was written.
|
39
|
+
*/
|
40
|
+
|
41
|
+
#include "address_sorting_internal.h"
|
42
|
+
|
43
|
+
#include <errno.h>
|
44
|
+
#include <inttypes.h>
|
45
|
+
#include <limits.h>
|
46
|
+
#include <stdlib.h>
|
47
|
+
#include <string.h>
|
48
|
+
#include <sys/types.h>
|
49
|
+
|
50
|
+
// Scope values increase with increase in scope.
|
51
|
+
static const int kIPv6AddrScopeLinkLocal = 1;
|
52
|
+
static const int kIPv6AddrScopeSiteLocal = 2;
|
53
|
+
static const int kIPv6AddrScopeGlobal = 3;
|
54
|
+
|
55
|
+
static address_sorting_source_addr_factory* g_current_source_addr_factory =
|
56
|
+
NULL;
|
57
|
+
|
58
|
+
static int address_sorting_get_source_addr(const address_sorting_address* dest,
|
59
|
+
address_sorting_address* source) {
|
60
|
+
return g_current_source_addr_factory->vtable->get_source_addr(
|
61
|
+
g_current_source_addr_factory, dest, source);
|
62
|
+
}
|
63
|
+
|
64
|
+
static int ipv6_prefix_match_length(const struct sockaddr_in6* sa,
|
65
|
+
const struct sockaddr_in6* sb) {
|
66
|
+
unsigned char* a = (unsigned char*)&sa->sin6_addr;
|
67
|
+
unsigned char* b = (unsigned char*)&sb->sin6_addr;
|
68
|
+
int cur_bit = 0;
|
69
|
+
while (cur_bit < 128) {
|
70
|
+
int high_bit = 1 << (CHAR_BIT - 1);
|
71
|
+
int a_val = a[cur_bit / CHAR_BIT] & (high_bit >> (cur_bit % CHAR_BIT));
|
72
|
+
int b_val = b[cur_bit / CHAR_BIT] & (high_bit >> (cur_bit % CHAR_BIT));
|
73
|
+
if (a_val == b_val) {
|
74
|
+
cur_bit++;
|
75
|
+
} else {
|
76
|
+
break;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
return cur_bit;
|
80
|
+
}
|
81
|
+
|
82
|
+
static int in6_is_addr_loopback(const struct in6_addr* ipv6_address) {
|
83
|
+
uint32_t* bits32 = (uint32_t*)ipv6_address;
|
84
|
+
return bits32[0] == 0 && bits32[1] == 0 && bits32[2] == 0 &&
|
85
|
+
bits32[3] == htonl(1);
|
86
|
+
}
|
87
|
+
|
88
|
+
static int in6_is_addr_v4mapped(const struct in6_addr* ipv6_address) {
|
89
|
+
uint32_t* bits32 = (uint32_t*)ipv6_address;
|
90
|
+
return bits32[0] == 0 && bits32[1] == 0 && bits32[2] == htonl(0x0000ffff);
|
91
|
+
}
|
92
|
+
|
93
|
+
static int in6_is_addr_v4compat(const struct in6_addr* ipv6_address) {
|
94
|
+
uint32_t* bits32 = (uint32_t*)ipv6_address;
|
95
|
+
return bits32[0] == 0 && bits32[1] == 0 && bits32[2] == 0 && bits32[3] != 0 &&
|
96
|
+
bits32[3] != htonl(1);
|
97
|
+
}
|
98
|
+
|
99
|
+
static int in6_is_addr_sitelocal(const struct in6_addr* ipv6_address) {
|
100
|
+
uint8_t* bytes = (uint8_t*)ipv6_address;
|
101
|
+
return bytes[0] == 0xfe && (bytes[1] & 0xc0) == 0xc0;
|
102
|
+
}
|
103
|
+
|
104
|
+
static int in6_is_addr_linklocal(const struct in6_addr* ipv6_address) {
|
105
|
+
uint8_t* bytes = (uint8_t*)ipv6_address;
|
106
|
+
return bytes[0] == 0xfe && (bytes[1] & 0xc0) == 0x80;
|
107
|
+
}
|
108
|
+
|
109
|
+
static int in6_is_addr_6to4(const struct in6_addr* ipv6_address) {
|
110
|
+
uint8_t* bytes = (uint8_t*)ipv6_address;
|
111
|
+
return bytes[0] == 0x20 && bytes[1] == 0x02;
|
112
|
+
}
|
113
|
+
|
114
|
+
static int in6_is_addr_ula(const struct in6_addr* ipv6_address) {
|
115
|
+
uint8_t* bytes = (uint8_t*)ipv6_address;
|
116
|
+
return (bytes[0] & 0xfe) == 0xfc;
|
117
|
+
}
|
118
|
+
|
119
|
+
static int in6_is_addr_teredo(const struct in6_addr* ipv6_address) {
|
120
|
+
uint8_t* bytes = (uint8_t*)ipv6_address;
|
121
|
+
return bytes[0] == 0x20 && bytes[1] == 0x01 && bytes[2] == 0x00 &&
|
122
|
+
bytes[3] == 0x00;
|
123
|
+
}
|
124
|
+
|
125
|
+
static int in6_is_addr_6bone(const struct in6_addr* ipv6_address) {
|
126
|
+
uint8_t* bytes = (uint8_t*)ipv6_address;
|
127
|
+
return bytes[0] == 0x3f && bytes[1] == 0xfe;
|
128
|
+
}
|
129
|
+
|
130
|
+
address_sorting_family address_sorting_abstract_get_family(
|
131
|
+
const address_sorting_address* address) {
|
132
|
+
switch (((struct sockaddr*)address)->sa_family) {
|
133
|
+
case AF_INET:
|
134
|
+
return ADDRESS_SORTING_AF_INET;
|
135
|
+
case AF_INET6:
|
136
|
+
return ADDRESS_SORTING_AF_INET6;
|
137
|
+
default:
|
138
|
+
return ADDRESS_SORTING_UNKNOWN_FAMILY;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
static int get_label_value(const address_sorting_address* resolved_addr) {
|
143
|
+
if (address_sorting_abstract_get_family(resolved_addr) ==
|
144
|
+
ADDRESS_SORTING_AF_INET) {
|
145
|
+
return 4;
|
146
|
+
} else if (address_sorting_abstract_get_family(resolved_addr) !=
|
147
|
+
ADDRESS_SORTING_AF_INET6) {
|
148
|
+
return 1;
|
149
|
+
}
|
150
|
+
struct sockaddr_in6* ipv6_addr = (struct sockaddr_in6*)&resolved_addr->addr;
|
151
|
+
if (in6_is_addr_loopback(&ipv6_addr->sin6_addr)) {
|
152
|
+
return 0;
|
153
|
+
} else if (in6_is_addr_v4mapped(&ipv6_addr->sin6_addr)) {
|
154
|
+
return 4;
|
155
|
+
} else if (in6_is_addr_6to4(&ipv6_addr->sin6_addr)) {
|
156
|
+
return 2;
|
157
|
+
} else if (in6_is_addr_teredo(&ipv6_addr->sin6_addr)) {
|
158
|
+
return 5;
|
159
|
+
} else if (in6_is_addr_ula(&ipv6_addr->sin6_addr)) {
|
160
|
+
return 13;
|
161
|
+
} else if (in6_is_addr_v4compat(&ipv6_addr->sin6_addr)) {
|
162
|
+
return 3;
|
163
|
+
} else if (in6_is_addr_sitelocal(&ipv6_addr->sin6_addr)) {
|
164
|
+
return 11;
|
165
|
+
} else if (in6_is_addr_6bone(&ipv6_addr->sin6_addr)) {
|
166
|
+
return 12;
|
167
|
+
}
|
168
|
+
return 1;
|
169
|
+
}
|
170
|
+
|
171
|
+
static int get_precedence_value(const address_sorting_address* resolved_addr) {
|
172
|
+
if (address_sorting_abstract_get_family(resolved_addr) ==
|
173
|
+
ADDRESS_SORTING_AF_INET) {
|
174
|
+
return 35;
|
175
|
+
} else if (address_sorting_abstract_get_family(resolved_addr) !=
|
176
|
+
ADDRESS_SORTING_AF_INET6) {
|
177
|
+
return 1;
|
178
|
+
}
|
179
|
+
struct sockaddr_in6* ipv6_addr = (struct sockaddr_in6*)&resolved_addr->addr;
|
180
|
+
if (in6_is_addr_loopback(&ipv6_addr->sin6_addr)) {
|
181
|
+
return 50;
|
182
|
+
} else if (in6_is_addr_v4mapped(&ipv6_addr->sin6_addr)) {
|
183
|
+
return 35;
|
184
|
+
} else if (in6_is_addr_6to4(&ipv6_addr->sin6_addr)) {
|
185
|
+
return 30;
|
186
|
+
} else if (in6_is_addr_teredo(&ipv6_addr->sin6_addr)) {
|
187
|
+
return 5;
|
188
|
+
} else if (in6_is_addr_ula(&ipv6_addr->sin6_addr)) {
|
189
|
+
return 3;
|
190
|
+
} else if (in6_is_addr_v4compat(&ipv6_addr->sin6_addr) ||
|
191
|
+
in6_is_addr_sitelocal(&ipv6_addr->sin6_addr) ||
|
192
|
+
in6_is_addr_6bone(&ipv6_addr->sin6_addr)) {
|
193
|
+
return 1;
|
194
|
+
}
|
195
|
+
return 40;
|
196
|
+
}
|
197
|
+
|
198
|
+
static int sockaddr_get_scope(const address_sorting_address* resolved_addr) {
|
199
|
+
if (address_sorting_abstract_get_family(resolved_addr) ==
|
200
|
+
ADDRESS_SORTING_AF_INET) {
|
201
|
+
return kIPv6AddrScopeGlobal;
|
202
|
+
} else if (address_sorting_abstract_get_family(resolved_addr) ==
|
203
|
+
ADDRESS_SORTING_AF_INET6) {
|
204
|
+
struct sockaddr_in6* ipv6_addr = (struct sockaddr_in6*)&resolved_addr->addr;
|
205
|
+
if (in6_is_addr_loopback(&ipv6_addr->sin6_addr) ||
|
206
|
+
in6_is_addr_linklocal(&ipv6_addr->sin6_addr)) {
|
207
|
+
return kIPv6AddrScopeLinkLocal;
|
208
|
+
}
|
209
|
+
if (in6_is_addr_sitelocal(&ipv6_addr->sin6_addr)) {
|
210
|
+
return kIPv6AddrScopeSiteLocal;
|
211
|
+
}
|
212
|
+
return kIPv6AddrScopeGlobal;
|
213
|
+
}
|
214
|
+
return 0;
|
215
|
+
}
|
216
|
+
|
217
|
+
static int compare_source_addr_exists(const address_sorting_sortable* first,
|
218
|
+
const address_sorting_sortable* second) {
|
219
|
+
if (first->source_addr_exists != second->source_addr_exists) {
|
220
|
+
return first->source_addr_exists ? -1 : 1;
|
221
|
+
}
|
222
|
+
return 0;
|
223
|
+
}
|
224
|
+
|
225
|
+
static int compare_source_dest_scope_matches(
|
226
|
+
const address_sorting_sortable* first,
|
227
|
+
const address_sorting_sortable* second) {
|
228
|
+
int first_src_dst_scope_matches = 0;
|
229
|
+
if (sockaddr_get_scope(&first->dest_addr) ==
|
230
|
+
sockaddr_get_scope(&first->source_addr)) {
|
231
|
+
first_src_dst_scope_matches = 1;
|
232
|
+
}
|
233
|
+
int second_src_dst_scope_matches = 0;
|
234
|
+
if (sockaddr_get_scope(&second->dest_addr) ==
|
235
|
+
sockaddr_get_scope(&second->source_addr)) {
|
236
|
+
second_src_dst_scope_matches = 1;
|
237
|
+
}
|
238
|
+
if (first_src_dst_scope_matches != second_src_dst_scope_matches) {
|
239
|
+
return first_src_dst_scope_matches ? -1 : 1;
|
240
|
+
}
|
241
|
+
return 0;
|
242
|
+
}
|
243
|
+
|
244
|
+
static int compare_source_dest_labels_match(
|
245
|
+
const address_sorting_sortable* first,
|
246
|
+
const address_sorting_sortable* second) {
|
247
|
+
int first_label_matches = 0;
|
248
|
+
if (get_label_value(&first->dest_addr) ==
|
249
|
+
get_label_value(&first->source_addr)) {
|
250
|
+
first_label_matches = 1;
|
251
|
+
}
|
252
|
+
int second_label_matches = 0;
|
253
|
+
if (get_label_value(&second->dest_addr) ==
|
254
|
+
get_label_value(&second->source_addr)) {
|
255
|
+
second_label_matches = 1;
|
256
|
+
}
|
257
|
+
if (first_label_matches != second_label_matches) {
|
258
|
+
return first_label_matches ? 1 : 1;
|
259
|
+
}
|
260
|
+
return 0;
|
261
|
+
}
|
262
|
+
|
263
|
+
static int compare_dest_precedence(const address_sorting_sortable* first,
|
264
|
+
const address_sorting_sortable* second) {
|
265
|
+
return get_precedence_value(&second->dest_addr) -
|
266
|
+
get_precedence_value(&first->dest_addr);
|
267
|
+
}
|
268
|
+
|
269
|
+
static int compare_dest_scope(const address_sorting_sortable* first,
|
270
|
+
const address_sorting_sortable* second) {
|
271
|
+
return sockaddr_get_scope(&first->dest_addr) -
|
272
|
+
sockaddr_get_scope(&second->dest_addr);
|
273
|
+
}
|
274
|
+
|
275
|
+
static int compare_source_dest_prefix_match_lengths(
|
276
|
+
const address_sorting_sortable* first,
|
277
|
+
const address_sorting_sortable* second) {
|
278
|
+
if (first->source_addr_exists &&
|
279
|
+
address_sorting_abstract_get_family(&first->source_addr) ==
|
280
|
+
ADDRESS_SORTING_AF_INET6 &&
|
281
|
+
second->source_addr_exists &&
|
282
|
+
address_sorting_abstract_get_family(&second->source_addr) ==
|
283
|
+
ADDRESS_SORTING_AF_INET6) {
|
284
|
+
int first_match_length =
|
285
|
+
ipv6_prefix_match_length((struct sockaddr_in6*)&first->source_addr.addr,
|
286
|
+
(struct sockaddr_in6*)&first->dest_addr.addr);
|
287
|
+
int second_match_length = ipv6_prefix_match_length(
|
288
|
+
(struct sockaddr_in6*)&second->source_addr.addr,
|
289
|
+
(struct sockaddr_in6*)&second->dest_addr.addr);
|
290
|
+
return second_match_length - first_match_length;
|
291
|
+
}
|
292
|
+
return 0;
|
293
|
+
}
|
294
|
+
|
295
|
+
static int rfc_6724_compare(const void* a, const void* b) {
|
296
|
+
const address_sorting_sortable* first = (address_sorting_sortable*)a;
|
297
|
+
const address_sorting_sortable* second = (address_sorting_sortable*)b;
|
298
|
+
int out = 0;
|
299
|
+
if ((out = compare_source_addr_exists(first, second))) {
|
300
|
+
return out;
|
301
|
+
}
|
302
|
+
if ((out = compare_source_dest_scope_matches(first, second))) {
|
303
|
+
return out;
|
304
|
+
}
|
305
|
+
if ((out = compare_source_dest_labels_match(first, second))) {
|
306
|
+
return out;
|
307
|
+
}
|
308
|
+
// TODO: Implement rule 3; avoid deprecated addresses.
|
309
|
+
// TODO: Implement rule 4; avoid temporary addresses.
|
310
|
+
if ((out = compare_dest_precedence(first, second))) {
|
311
|
+
return out;
|
312
|
+
}
|
313
|
+
// TODO: Implement rule 7; prefer native transports.
|
314
|
+
if ((out = compare_dest_scope(first, second))) {
|
315
|
+
return out;
|
316
|
+
}
|
317
|
+
if ((out = compare_source_dest_prefix_match_lengths(first, second))) {
|
318
|
+
return out;
|
319
|
+
}
|
320
|
+
// Prefer that the sort be stable otherwise
|
321
|
+
return (int)(first->original_index - second->original_index);
|
322
|
+
}
|
323
|
+
|
324
|
+
void address_sorting_override_source_addr_factory_for_testing(
|
325
|
+
address_sorting_source_addr_factory* factory) {
|
326
|
+
if (g_current_source_addr_factory == NULL) {
|
327
|
+
abort();
|
328
|
+
}
|
329
|
+
g_current_source_addr_factory->vtable->destroy(g_current_source_addr_factory);
|
330
|
+
g_current_source_addr_factory = factory;
|
331
|
+
}
|
332
|
+
|
333
|
+
static void sanity_check_private_fields_are_unused(
|
334
|
+
const address_sorting_sortable* sortable) {
|
335
|
+
address_sorting_address expected_source_addr;
|
336
|
+
memset(&expected_source_addr, 0, sizeof(expected_source_addr));
|
337
|
+
if (memcmp(&expected_source_addr, &sortable->source_addr,
|
338
|
+
sizeof(address_sorting_address)) ||
|
339
|
+
sortable->original_index || sortable->source_addr_exists) {
|
340
|
+
abort();
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
void address_sorting_rfc_6724_sort(address_sorting_sortable* sortables,
|
345
|
+
size_t sortables_len) {
|
346
|
+
for (size_t i = 0; i < sortables_len; i++) {
|
347
|
+
sanity_check_private_fields_are_unused(&sortables[i]);
|
348
|
+
sortables[i].original_index = i;
|
349
|
+
sortables[i].source_addr_exists = address_sorting_get_source_addr(
|
350
|
+
&sortables[i].dest_addr, &sortables[i].source_addr);
|
351
|
+
}
|
352
|
+
qsort(sortables, sortables_len, sizeof(address_sorting_sortable),
|
353
|
+
rfc_6724_compare);
|
354
|
+
}
|
355
|
+
|
356
|
+
void address_sorting_init() {
|
357
|
+
if (g_current_source_addr_factory != NULL) {
|
358
|
+
abort();
|
359
|
+
}
|
360
|
+
g_current_source_addr_factory =
|
361
|
+
address_sorting_create_source_addr_factory_for_current_platform();
|
362
|
+
}
|
363
|
+
|
364
|
+
void address_sorting_shutdown() {
|
365
|
+
if (g_current_source_addr_factory == NULL) {
|
366
|
+
abort();
|
367
|
+
}
|
368
|
+
g_current_source_addr_factory->vtable->destroy(g_current_source_addr_factory);
|
369
|
+
}
|