grpc 1.7.3 → 1.8.0
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 +2106 -2116
- data/include/grpc/census.h +1 -432
- data/include/grpc/compression.h +9 -9
- data/include/grpc/grpc.h +115 -98
- data/include/grpc/grpc_cronet.h +3 -3
- data/include/grpc/grpc_posix.h +4 -4
- data/include/grpc/grpc_security.h +160 -88
- data/include/grpc/grpc_security_constants.h +7 -0
- data/include/grpc/impl/codegen/atm.h +9 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +13 -4
- data/include/grpc/impl/codegen/atm_gcc_sync.h +6 -5
- data/include/grpc/impl/codegen/atm_windows.h +23 -22
- data/include/grpc/impl/codegen/byte_buffer.h +14 -14
- data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
- data/include/grpc/impl/codegen/connectivity_state.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +32 -28
- data/include/grpc/impl/codegen/port_platform.h +48 -0
- data/include/grpc/impl/codegen/slice.h +10 -10
- data/include/grpc/impl/codegen/sync_generic.h +9 -3
- data/include/grpc/slice.h +16 -17
- data/include/grpc/slice_buffer.h +22 -22
- data/include/grpc/support/alloc.h +11 -11
- data/include/grpc/support/avl.h +28 -20
- data/include/grpc/support/cmdline.h +13 -13
- data/include/grpc/support/histogram.h +17 -17
- data/include/grpc/support/host_port.h +2 -2
- data/include/grpc/support/log.h +9 -9
- data/include/grpc/support/log_windows.h +1 -1
- data/include/grpc/support/string_util.h +2 -2
- data/include/grpc/support/subprocess.h +5 -5
- data/include/grpc/support/sync.h +43 -27
- data/include/grpc/support/thd.h +6 -6
- data/include/grpc/support/tls_gcc.h +1 -1
- data/include/grpc/support/tls_pthread.h +1 -1
- data/src/core/ext/census/{grpc_context.c → grpc_context.cc} +5 -8
- data/src/core/ext/filters/client_channel/backup_poller.cc +165 -0
- data/src/core/ext/{census/grpc_filter.h → filters/client_channel/backup_poller.h} +12 -7
- data/src/core/ext/filters/client_channel/{channel_connectivity.c → channel_connectivity.cc} +45 -42
- data/src/core/ext/filters/client_channel/{client_channel.c → client_channel.cc} +452 -417
- data/src/core/ext/filters/client_channel/client_channel.h +16 -8
- data/src/core/ext/filters/client_channel/{client_channel_factory.c → client_channel_factory.cc} +0 -0
- data/src/core/ext/filters/client_channel/client_channel_factory.h +29 -21
- data/src/core/ext/filters/client_channel/{client_channel_plugin.c → client_channel_plugin.cc} +15 -19
- data/src/core/ext/filters/client_channel/{connector.c → connector.cc} +0 -0
- data/src/core/ext/filters/client_channel/connector.h +29 -21
- data/src/core/ext/filters/client_channel/{http_connect_handshaker.c → http_connect_handshaker.cc} +10 -10
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +8 -0
- data/src/core/ext/filters/client_channel/{http_proxy.c → http_proxy.cc} +14 -14
- data/src/core/ext/filters/client_channel/http_proxy.h +8 -0
- data/src/core/ext/filters/client_channel/{lb_policy.c → lb_policy.cc} +47 -48
- data/src/core/ext/filters/client_channel/lb_policy.h +76 -70
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{client_load_reporting_filter.c → client_load_reporting_filter.cc} +28 -29
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +9 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb.c → grpclb.cc} +554 -563
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +9 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +17 -9
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb_channel_secure.c → grpclb_channel_secure.cc} +17 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{grpclb_client_stats.c → grpclb_client_stats.cc} +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +9 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/{load_balancer_api.c → load_balancer_api.cc} +64 -67
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +20 -21
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +599 -0
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +695 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +270 -0
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +153 -0
- data/src/core/ext/filters/client_channel/{lb_policy_factory.c → lb_policy_factory.cc} +10 -10
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +48 -40
- data/src/core/ext/filters/client_channel/{lb_policy_registry.c → lb_policy_registry.cc} +9 -9
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +11 -3
- data/src/core/ext/filters/client_channel/{parse_address.c → parse_address.cc} +24 -24
- data/src/core/ext/filters/client_channel/parse_address.h +14 -6
- data/src/core/ext/filters/client_channel/{proxy_mapper.c → proxy_mapper.cc} +0 -0
- data/src/core/ext/filters/client_channel/proxy_mapper.h +8 -0
- data/src/core/ext/filters/client_channel/{proxy_mapper_registry.c → proxy_mapper_registry.cc} +0 -0
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +8 -0
- data/src/core/ext/filters/client_channel/{resolver.c → resolver.cc} +21 -23
- data/src/core/ext/filters/client_channel/resolver.h +33 -27
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{dns_resolver_ares.c → dns_resolver_ares.cc} +133 -133
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +18 -9
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{grpc_ares_ev_driver_posix.c → grpc_ares_ev_driver_posix.cc} +58 -56
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/{grpc_ares_wrapper.c → grpc_ares_wrapper.cc} +118 -115
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +23 -15
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +60 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/{dns_resolver.c → dns_resolver.cc} +100 -94
- data/src/core/ext/filters/client_channel/resolver/fake/{fake_resolver.c → fake_resolver.cc} +14 -14
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +9 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/{sockaddr_resolver.c → sockaddr_resolver.cc} +60 -60
- data/src/core/ext/filters/client_channel/{resolver_factory.c → resolver_factory.cc} +2 -2
- data/src/core/ext/filters/client_channel/resolver_factory.h +27 -19
- data/src/core/ext/filters/client_channel/{resolver_registry.c → resolver_registry.cc} +35 -35
- data/src/core/ext/filters/client_channel/resolver_registry.h +18 -10
- data/src/core/ext/filters/client_channel/{retry_throttle.c → retry_throttle.cc} +10 -10
- data/src/core/ext/filters/client_channel/retry_throttle.h +8 -0
- data/src/core/ext/filters/client_channel/{subchannel.c → subchannel.cc} +210 -213
- data/src/core/ext/filters/client_channel/subchannel.h +68 -60
- data/src/core/ext/filters/client_channel/{subchannel_index.c → subchannel_index.cc} +52 -52
- data/src/core/ext/filters/client_channel/subchannel_index.h +22 -14
- data/src/core/ext/filters/client_channel/{uri_parser.c → uri_parser.cc} +29 -27
- data/src/core/ext/filters/client_channel/uri_parser.h +18 -10
- data/src/core/ext/filters/deadline/{deadline_filter.c → deadline_filter.cc} +12 -15
- data/src/core/ext/filters/deadline/deadline_filter.h +11 -2
- data/src/core/ext/filters/http/client/{http_client_filter.c → http_client_filter.cc} +83 -83
- data/src/core/ext/filters/http/client/http_client_filter.h +8 -0
- data/src/core/ext/filters/http/{http_filters_plugin.c → http_filters_plugin.cc} +20 -21
- data/src/core/ext/filters/http/message_compress/{message_compress_filter.c → message_compress_filter.cc} +84 -83
- data/src/core/ext/filters/http/message_compress/message_compress_filter.h +9 -1
- data/src/core/ext/filters/http/server/{http_server_filter.c → http_server_filter.cc} +80 -78
- data/src/core/ext/filters/http/server/http_server_filter.h +8 -0
- data/src/core/ext/filters/load_reporting/{server_load_reporting_filter.c → server_load_reporting_filter.cc} +29 -29
- data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +9 -1
- data/src/core/ext/filters/load_reporting/{server_load_reporting_plugin.c → server_load_reporting_plugin.cc} +11 -11
- data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +13 -5
- data/src/core/ext/filters/max_age/{max_age_filter.c → max_age_filter.cc} +46 -56
- data/src/core/ext/filters/max_age/max_age_filter.h +8 -0
- data/src/core/ext/filters/message_size/{message_size_filter.c → message_size_filter.cc} +62 -40
- data/src/core/ext/filters/message_size/message_size_filter.h +8 -0
- data/src/core/ext/filters/workarounds/{workaround_cronet_compression_filter.c → workaround_cronet_compression_filter.cc} +11 -11
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +8 -0
- data/src/core/ext/filters/workarounds/{workaround_utils.c → workaround_utils.cc} +7 -7
- data/src/core/ext/filters/workarounds/workaround_utils.h +9 -1
- data/src/core/ext/transport/chttp2/alpn/{alpn.c → alpn.cc} +3 -3
- data/src/core/ext/transport/chttp2/alpn/alpn.h +10 -2
- data/src/core/ext/transport/chttp2/client/{chttp2_connector.c → chttp2_connector.cc} +49 -45
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +8 -0
- data/src/core/ext/transport/chttp2/client/insecure/{channel_create.c → channel_create.cc} +28 -27
- data/src/core/ext/transport/chttp2/client/insecure/{channel_create_posix.c → channel_create_posix.cc} +14 -13
- data/src/core/ext/transport/chttp2/client/secure/{secure_channel_create.c → secure_channel_create.cc} +68 -66
- data/src/core/ext/transport/chttp2/server/{chttp2_server.c → chttp2_server.cc} +76 -77
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +11 -3
- data/src/core/ext/transport/chttp2/server/insecure/{server_chttp2.c → server_chttp2.cc} +3 -3
- data/src/core/ext/transport/chttp2/server/insecure/{server_chttp2_posix.c → server_chttp2_posix.cc} +13 -12
- data/src/core/ext/transport/chttp2/server/secure/{server_secure_chttp2.c → server_secure_chttp2.cc} +12 -10
- data/src/core/ext/transport/chttp2/transport/{bin_decoder.c → bin_decoder.cc} +7 -7
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +15 -7
- data/src/core/ext/transport/chttp2/transport/{bin_encoder.c → bin_encoder.cc} +11 -11
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +8 -0
- data/src/core/ext/transport/chttp2/transport/{chttp2_plugin.c → chttp2_plugin.cc} +2 -9
- data/src/core/ext/transport/chttp2/transport/{chttp2_transport.c → chttp2_transport.cc} +778 -778
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +14 -10
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +385 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +337 -0
- data/src/core/ext/transport/chttp2/transport/frame.h +8 -0
- data/src/core/ext/transport/chttp2/transport/{frame_data.c → frame_data.cc} +34 -34
- data/src/core/ext/transport/chttp2/transport/frame_data.h +25 -17
- data/src/core/ext/transport/chttp2/transport/{frame_goaway.c → frame_goaway.cc} +18 -18
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +18 -10
- data/src/core/ext/transport/chttp2/transport/{frame_ping.c → frame_ping.cc} +18 -19
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +12 -4
- data/src/core/ext/transport/chttp2/transport/{frame_rst_stream.c → frame_rst_stream.cc} +16 -16
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +16 -8
- data/src/core/ext/transport/chttp2/transport/{frame_settings.c → frame_settings.cc} +23 -24
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +17 -9
- data/src/core/ext/transport/chttp2/transport/{frame_window_update.c → frame_window_update.cc} +22 -24
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +14 -6
- data/src/core/ext/transport/chttp2/transport/{hpack_encoder.c → hpack_encoder.cc} +206 -161
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +23 -13
- data/src/core/ext/transport/chttp2/transport/{hpack_parser.c → hpack_parser.cc} +340 -334
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +30 -22
- data/src/core/ext/transport/chttp2/transport/{hpack_table.c → hpack_table.cc} +25 -25
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +19 -11
- data/src/core/ext/transport/chttp2/transport/{http2_settings.c → http2_settings.cc} +1 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +10 -2
- data/src/core/ext/transport/chttp2/transport/{huffsyms.c → huffsyms.cc} +0 -0
- data/src/core/ext/transport/chttp2/transport/huffsyms.h +8 -0
- data/src/core/ext/transport/chttp2/transport/{incoming_metadata.c → incoming_metadata.cc} +14 -13
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +18 -10
- data/src/core/ext/transport/chttp2/transport/internal.h +214 -340
- data/src/core/ext/transport/chttp2/transport/{parsing.c → parsing.cc} +152 -141
- data/src/core/ext/transport/chttp2/transport/{stream_lists.c → stream_lists.cc} +53 -53
- data/src/core/ext/transport/chttp2/transport/{stream_map.c → stream_map.cc} +35 -34
- data/src/core/ext/transport/chttp2/transport/stream_map.h +22 -14
- data/src/core/ext/transport/chttp2/transport/{varint.c → varint.cc} +0 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +8 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +636 -0
- data/src/core/ext/transport/inproc/{inproc_plugin.c → inproc_plugin.cc} +5 -6
- data/src/core/ext/transport/inproc/{inproc_transport.c → inproc_transport.cc} +479 -544
- data/src/core/ext/transport/inproc/inproc_transport.h +4 -4
- data/src/core/lib/backoff/backoff.cc +80 -0
- data/src/core/lib/backoff/backoff.h +83 -0
- data/src/core/lib/channel/{channel_args.c → channel_args.cc} +92 -92
- data/src/core/lib/channel/channel_args.h +45 -37
- data/src/core/lib/channel/{channel_stack.c → channel_stack.cc} +67 -68
- data/src/core/lib/channel/channel_stack.h +76 -75
- data/src/core/lib/channel/{channel_stack_builder.c → channel_stack_builder.cc} +91 -91
- data/src/core/lib/channel/channel_stack_builder.h +45 -45
- data/src/core/lib/channel/{connected_channel.c → connected_channel.cc} +70 -70
- data/src/core/lib/channel/connected_channel.h +12 -4
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/channel/{handshaker.c → handshaker.cc} +7 -9
- data/src/core/lib/channel/handshaker.h +9 -1
- data/src/core/lib/channel/{handshaker_factory.c → handshaker_factory.cc} +7 -7
- data/src/core/lib/channel/handshaker_factory.h +18 -10
- data/src/core/lib/channel/{handshaker_registry.c → handshaker_registry.cc} +0 -0
- data/src/core/lib/channel/handshaker_registry.h +8 -0
- data/src/core/lib/compression/algorithm_metadata.h +8 -0
- data/src/core/lib/compression/{compression.c → compression.cc} +9 -9
- data/src/core/lib/compression/{message_compress.c → message_compress.cc} +0 -0
- data/src/core/lib/compression/message_compress.h +8 -0
- data/src/core/lib/compression/{stream_compression.c → stream_compression.cc} +12 -12
- data/src/core/lib/compression/stream_compression.h +27 -19
- data/src/core/lib/compression/{stream_compression_gzip.c → stream_compression_gzip.cc} +35 -36
- data/src/core/lib/compression/stream_compression_gzip.h +8 -0
- data/src/core/lib/compression/{stream_compression_identity.c → stream_compression_identity.cc} +19 -20
- data/src/core/lib/compression/stream_compression_identity.h +8 -0
- data/src/core/lib/debug/{stats.c → stats.cc} +19 -19
- data/src/core/lib/debug/stats.h +17 -9
- data/src/core/lib/debug/{stats_data.c → stats_data.cc} +45 -22
- data/src/core/lib/debug/stats_data.h +58 -19
- data/src/core/lib/debug/trace.cc +142 -0
- data/src/core/lib/debug/trace.h +74 -14
- data/src/core/lib/http/{format_request.c → format_request.cc} +10 -10
- data/src/core/lib/http/format_request.h +12 -4
- data/src/core/lib/http/{httpcli.c → httpcli.cc} +80 -80
- data/src/core/lib/http/httpcli.h +41 -33
- data/src/core/lib/http/{httpcli_security_connector.c → httpcli_security_connector.cc} +69 -55
- data/src/core/lib/http/{parser.c → parser.cc} +42 -42
- data/src/core/lib/http/parser.h +28 -20
- data/src/core/lib/{support → iomgr}/block_annotate.h +17 -8
- data/src/core/lib/iomgr/{call_combiner.c → call_combiner.cc} +29 -17
- data/src/core/lib/iomgr/call_combiner.h +9 -1
- data/src/core/lib/iomgr/closure.h +220 -62
- data/src/core/lib/iomgr/{combiner.c → combiner.cc} +63 -62
- data/src/core/lib/iomgr/combiner.h +16 -8
- data/src/core/lib/iomgr/{endpoint.c → endpoint.cc} +6 -0
- data/src/core/lib/iomgr/endpoint.h +47 -32
- data/src/core/lib/iomgr/endpoint_pair.h +12 -4
- data/src/core/lib/iomgr/{endpoint_pair_posix.c → endpoint_pair_posix.cc} +3 -3
- data/src/core/lib/iomgr/{endpoint_pair_uv.c → endpoint_pair_uv.cc} +2 -2
- data/src/core/lib/iomgr/{endpoint_pair_windows.c → endpoint_pair_windows.cc} +6 -6
- data/src/core/lib/iomgr/{error.c → error.cc} +125 -124
- data/src/core/lib/iomgr/error.h +32 -27
- data/src/core/lib/iomgr/error_internal.h +11 -2
- data/src/core/lib/iomgr/{ev_epoll1_linux.c → ev_epoll1_linux.cc} +214 -215
- data/src/core/lib/iomgr/ev_epoll1_linux.h +9 -1
- data/src/core/lib/iomgr/ev_epollex_linux.cc +1488 -0
- data/src/core/lib/iomgr/ev_epollex_linux.h +9 -1
- data/src/core/lib/iomgr/{ev_epollsig_linux.c → ev_epollsig_linux.cc} +304 -305
- data/src/core/lib/iomgr/ev_epollsig_linux.h +12 -4
- data/src/core/lib/iomgr/{ev_poll_posix.c → ev_poll_posix.cc} +272 -283
- data/src/core/lib/iomgr/ev_poll_posix.h +10 -2
- data/src/core/lib/iomgr/ev_posix.cc +288 -0
- data/src/core/lib/iomgr/ev_posix.h +75 -67
- data/src/core/lib/iomgr/{ev_windows.c → ev_windows.cc} +2 -2
- data/src/core/lib/iomgr/exec_ctx.cc +177 -0
- data/src/core/lib/iomgr/exec_ctx.h +35 -13
- data/src/core/lib/iomgr/{executor.c → executor.cc} +34 -35
- data/src/core/lib/iomgr/executor.h +12 -4
- data/src/core/lib/iomgr/{fork_posix.c → fork_posix.cc} +0 -0
- data/src/core/lib/iomgr/{fork_windows.c → fork_windows.cc} +0 -0
- data/src/core/lib/iomgr/gethostname.h +9 -1
- data/src/core/lib/iomgr/{gethostname_fallback.c → gethostname_fallback.cc} +2 -1
- data/src/core/lib/iomgr/{gethostname_host_name_max.c → gethostname_host_name_max.cc} +4 -3
- data/src/core/lib/iomgr/{gethostname_sysconf.c → gethostname_sysconf.cc} +3 -2
- data/src/core/lib/iomgr/{iocp_windows.c → iocp_windows.cc} +23 -25
- data/src/core/lib/iomgr/iocp_windows.h +17 -3
- data/src/core/lib/iomgr/{iomgr.c → iomgr.cc} +25 -19
- data/src/core/lib/iomgr/iomgr.h +11 -3
- data/src/core/lib/iomgr/iomgr_internal.h +13 -5
- data/src/core/lib/iomgr/{iomgr_posix.c → iomgr_posix.cc} +0 -1
- data/src/core/lib/iomgr/{iomgr_uv.c → iomgr_uv.cc} +1 -1
- data/src/core/lib/iomgr/iomgr_uv.h +8 -0
- data/src/core/lib/iomgr/{iomgr_windows.c → iomgr_windows.cc} +0 -0
- data/src/core/lib/iomgr/{is_epollexclusive_available.c → is_epollexclusive_available.cc} +1 -1
- data/src/core/lib/iomgr/is_epollexclusive_available.h +8 -0
- data/src/core/lib/iomgr/{load_file.c → load_file.cc} +12 -12
- data/src/core/lib/iomgr/load_file.h +2 -2
- data/src/core/lib/iomgr/{lockfree_event.c → lockfree_event.cc} +76 -68
- data/src/core/lib/iomgr/lockfree_event.h +30 -11
- data/src/core/lib/iomgr/{network_status_tracker.c → network_status_tracker.cc} +3 -2
- data/src/core/lib/iomgr/network_status_tracker.h +2 -2
- data/src/core/lib/iomgr/{polling_entity.c → polling_entity.cc} +18 -18
- data/src/core/lib/iomgr/polling_entity.h +21 -13
- data/src/core/lib/iomgr/pollset.h +17 -11
- data/src/core/lib/iomgr/pollset_set.h +23 -15
- data/src/core/lib/iomgr/{pollset_set_uv.c → pollset_set_uv.cc} +0 -0
- data/src/core/lib/iomgr/{pollset_set_windows.c → pollset_set_windows.cc} +0 -0
- data/src/core/lib/iomgr/{pollset_uv.c → pollset_uv.cc} +31 -29
- data/src/core/lib/iomgr/pollset_uv.h +8 -0
- data/src/core/lib/iomgr/{pollset_windows.c → pollset_windows.cc} +24 -24
- data/src/core/lib/iomgr/pollset_windows.h +17 -4
- data/src/core/lib/iomgr/port.h +10 -0
- data/src/core/lib/iomgr/resolve_address.h +18 -10
- data/src/core/lib/iomgr/{resolve_address_posix.c → resolve_address_posix.cc} +40 -40
- data/src/core/lib/iomgr/{resolve_address_uv.c → resolve_address_uv.cc} +61 -56
- data/src/core/lib/iomgr/{resolve_address_windows.c → resolve_address_windows.cc} +36 -34
- data/src/core/lib/iomgr/{resource_quota.c → resource_quota.cc} +209 -180
- data/src/core/lib/iomgr/resource_quota.h +45 -37
- data/src/core/lib/iomgr/{sockaddr_utils.c → sockaddr_utils.cc} +61 -61
- data/src/core/lib/iomgr/sockaddr_utils.h +23 -15
- data/src/core/lib/iomgr/sockaddr_windows.h +6 -0
- data/src/core/lib/iomgr/{socket_factory_posix.c → socket_factory_posix.cc} +20 -20
- data/src/core/lib/iomgr/socket_factory_posix.h +15 -15
- data/src/core/lib/iomgr/{socket_mutator.c → socket_mutator.cc} +18 -18
- data/src/core/lib/iomgr/socket_mutator.h +11 -11
- data/src/core/lib/iomgr/socket_utils.h +9 -1
- data/src/core/lib/iomgr/{socket_utils_common_posix.c → socket_utils_common_posix.cc} +28 -28
- data/src/core/lib/iomgr/{socket_utils_linux.c → socket_utils_linux.cc} +3 -3
- data/src/core/lib/iomgr/{socket_utils_posix.c → socket_utils_posix.cc} +3 -3
- data/src/core/lib/iomgr/socket_utils_posix.h +26 -18
- data/src/core/lib/iomgr/{socket_utils_uv.c → socket_utils_uv.cc} +1 -1
- data/src/core/lib/iomgr/{socket_utils_windows.c → socket_utils_windows.cc} +2 -2
- data/src/core/lib/iomgr/{socket_windows.c → socket_windows.cc} +18 -18
- data/src/core/lib/iomgr/socket_windows.h +26 -13
- data/src/core/lib/iomgr/tcp_client.h +14 -6
- data/src/core/lib/iomgr/{tcp_client_posix.c → tcp_client_posix.cc} +69 -70
- data/src/core/lib/iomgr/tcp_client_posix.h +11 -3
- data/src/core/lib/iomgr/{tcp_client_uv.c → tcp_client_uv.cc} +47 -48
- data/src/core/lib/iomgr/{tcp_client_windows.c → tcp_client_windows.cc} +46 -44
- data/src/core/lib/iomgr/{tcp_posix.c → tcp_posix.cc} +198 -175
- data/src/core/lib/iomgr/tcp_posix.h +15 -7
- data/src/core/lib/iomgr/tcp_server.h +31 -23
- data/src/core/lib/iomgr/{tcp_server_posix.c → tcp_server_posix.cc} +78 -77
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +27 -19
- data/src/core/lib/iomgr/{tcp_server_utils_posix_common.c → tcp_server_utils_posix_common.cc} +27 -27
- data/src/core/lib/iomgr/{tcp_server_utils_posix_ifaddrs.c → tcp_server_utils_posix_ifaddrs.cc} +25 -25
- data/src/core/lib/iomgr/{tcp_server_utils_posix_noifaddrs.c → tcp_server_utils_posix_noifaddrs.cc} +2 -2
- data/src/core/lib/iomgr/{tcp_server_uv.c → tcp_server_uv.cc} +133 -105
- data/src/core/lib/iomgr/{tcp_server_windows.c → tcp_server_windows.cc} +81 -77
- data/src/core/lib/iomgr/tcp_uv.cc +420 -0
- data/src/core/lib/iomgr/tcp_uv.h +18 -4
- data/src/core/lib/iomgr/{tcp_windows.c → tcp_windows.cc} +90 -79
- data/src/core/lib/iomgr/tcp_windows.h +17 -4
- data/src/core/lib/iomgr/{time_averaged_stats.c → time_averaged_stats.cc} +0 -0
- data/src/core/lib/iomgr/time_averaged_stats.h +8 -0
- data/src/core/lib/iomgr/timer.h +16 -9
- data/src/core/lib/iomgr/{timer_generic.c → timer_generic.cc} +130 -171
- data/src/core/lib/iomgr/timer_generic.h +4 -4
- data/src/core/lib/iomgr/{timer_heap.c → timer_heap.cc} +20 -21
- data/src/core/lib/iomgr/timer_heap.h +16 -8
- data/src/core/lib/iomgr/{timer_manager.c → timer_manager.cc} +54 -52
- data/src/core/lib/iomgr/timer_manager.h +8 -0
- data/src/core/lib/iomgr/{timer_uv.c → timer_uv.cc} +22 -24
- data/src/core/lib/iomgr/timer_uv.h +2 -2
- data/src/core/lib/iomgr/{udp_server.c → udp_server.cc} +75 -75
- data/src/core/lib/iomgr/udp_server.h +25 -17
- data/src/core/lib/iomgr/{unix_sockets_posix.c → unix_sockets_posix.cc} +22 -21
- data/src/core/lib/iomgr/unix_sockets_posix.h +14 -6
- data/src/core/lib/iomgr/{unix_sockets_posix_noop.c → unix_sockets_posix_noop.cc} +5 -5
- data/src/core/lib/iomgr/{wakeup_fd_cv.c → wakeup_fd_cv.cc} +2 -2
- data/src/core/lib/iomgr/wakeup_fd_cv.h +10 -0
- data/src/core/lib/iomgr/{wakeup_fd_eventfd.c → wakeup_fd_eventfd.cc} +0 -0
- data/src/core/lib/iomgr/{wakeup_fd_nospecial.c → wakeup_fd_nospecial.cc} +0 -0
- data/src/core/lib/iomgr/{wakeup_fd_pipe.c → wakeup_fd_pipe.cc} +1 -0
- data/src/core/lib/iomgr/wakeup_fd_pipe.h +9 -1
- data/src/core/lib/iomgr/{wakeup_fd_posix.c → wakeup_fd_posix.cc} +6 -7
- data/src/core/lib/iomgr/wakeup_fd_posix.h +8 -0
- data/src/core/lib/json/{json.c → json.cc} +0 -0
- data/src/core/lib/json/json.h +8 -0
- data/src/core/lib/json/{json_reader.c → json_reader.cc} +18 -18
- data/src/core/lib/json/json_reader.h +26 -18
- data/src/core/lib/json/{json_string.c → json_string.cc} +57 -57
- data/src/core/lib/json/{json_writer.c → json_writer.cc} +20 -20
- data/src/core/lib/json/json_writer.h +23 -15
- data/src/core/lib/profiling/{basic_timers.c → basic_timers.cc} +34 -34
- data/src/core/lib/profiling/{stap_timers.c → stap_timers.cc} +5 -5
- data/src/core/lib/profiling/timers.h +6 -6
- data/src/core/lib/security/context/{security_context.c → security_context.cc} +98 -95
- data/src/core/lib/security/context/security_context.h +27 -29
- data/src/core/lib/security/credentials/composite/{composite_credentials.c → composite_credentials.cc} +79 -73
- data/src/core/lib/security/credentials/composite/composite_credentials.h +17 -9
- data/src/core/lib/security/credentials/{credentials.c → credentials.cc} +97 -92
- data/src/core/lib/security/credentials/credentials.h +83 -75
- data/src/core/lib/security/credentials/{credentials_metadata.c → credentials_metadata.cc} +7 -6
- data/src/core/lib/security/credentials/fake/{fake_credentials.c → fake_credentials.cc} +39 -36
- data/src/core/lib/security/credentials/fake/fake_credentials.h +13 -5
- data/src/core/lib/security/credentials/google_default/{credentials_generic.c → credentials_generic.cc} +5 -5
- data/src/core/lib/security/credentials/google_default/{google_default_credentials.c → google_default_credentials.cc} +55 -55
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +9 -1
- data/src/core/lib/security/credentials/iam/{iam_credentials.c → iam_credentials.cc} +19 -18
- data/src/core/lib/security/credentials/jwt/{json_token.c → json_token.cc} +80 -75
- data/src/core/lib/security/credentials/jwt/json_token.h +23 -15
- data/src/core/lib/security/credentials/jwt/{jwt_credentials.c → jwt_credentials.cc} +45 -41
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +11 -3
- data/src/core/lib/security/credentials/jwt/{jwt_verifier.c → jwt_verifier.cc} +262 -252
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +38 -30
- data/src/core/lib/security/credentials/oauth2/{oauth2_credentials.c → oauth2_credentials.cc} +138 -141
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +30 -22
- data/src/core/lib/security/credentials/plugin/{plugin_credentials.c → plugin_credentials.cc} +52 -53
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +7 -7
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +344 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +27 -0
- data/src/core/lib/security/transport/auth_filters.h +16 -0
- data/src/core/lib/security/transport/{client_auth_filter.c → client_auth_filter.cc} +127 -115
- data/src/core/lib/security/transport/{lb_targets_info.c → lb_targets_info.cc} +16 -13
- data/src/core/lib/security/transport/lb_targets_info.h +11 -3
- data/src/core/lib/security/transport/{secure_endpoint.c → secure_endpoint.cc} +84 -76
- data/src/core/lib/security/transport/secure_endpoint.h +13 -5
- data/src/core/lib/security/transport/security_connector.cc +1121 -0
- data/src/core/lib/security/transport/security_connector.h +97 -79
- data/src/core/lib/security/transport/{security_handshaker.c → security_handshaker.cc} +139 -132
- data/src/core/lib/security/transport/security_handshaker.h +11 -3
- data/src/core/lib/security/transport/{server_auth_filter.c → server_auth_filter.cc} +68 -68
- data/src/core/lib/security/transport/{tsi_error.c → tsi_error.cc} +1 -1
- data/src/core/lib/security/transport/tsi_error.h +9 -1
- data/src/core/lib/security/util/{json_util.c → json_util.cc} +11 -11
- data/src/core/lib/security/util/json_util.h +12 -4
- data/src/core/lib/slice/{b64.c → b64.cc} +15 -15
- data/src/core/lib/slice/b64.h +12 -4
- data/src/core/lib/slice/{percent_encoding.c → percent_encoding.cc} +15 -15
- data/src/core/lib/slice/percent_encoding.h +11 -3
- data/src/core/lib/slice/{slice.c → slice.cc} +64 -64
- data/src/core/lib/slice/{slice_buffer.c → slice_buffer.cc} +38 -38
- data/src/core/lib/slice/{slice_hash_table.c → slice_hash_table.cc} +7 -7
- data/src/core/lib/slice/slice_hash_table.h +19 -11
- data/src/core/lib/slice/{slice_intern.c → slice_intern.cc} +35 -34
- data/src/core/lib/slice/slice_internal.h +17 -6
- data/src/core/lib/slice/{slice_string_helpers.c → slice_string_helpers.cc} +9 -9
- data/src/core/lib/slice/slice_string_helpers.h +3 -3
- data/src/core/lib/support/abstract.h +29 -0
- data/src/core/lib/support/{alloc.c → alloc.cc} +22 -22
- data/src/core/lib/support/{arena.c → arena.cc} +12 -12
- data/src/core/lib/support/arena.h +11 -3
- data/src/core/lib/support/{atm.c → atm.cc} +1 -1
- data/src/core/lib/support/{avl.c → avl.cc} +71 -70
- data/src/core/lib/support/{cmdline.c → cmdline.cc} +62 -62
- data/src/core/lib/support/{cpu_iphone.c → cpu_iphone.cc} +2 -0
- data/src/core/lib/support/{cpu_linux.c → cpu_linux.cc} +10 -0
- data/src/core/lib/support/{cpu_posix.c → cpu_posix.cc} +27 -4
- data/src/core/lib/support/{cpu_windows.c → cpu_windows.cc} +1 -0
- data/src/core/lib/support/env.h +3 -3
- data/src/core/lib/support/{env_linux.c → env_linux.cc} +11 -11
- data/src/core/lib/support/{env_posix.c → env_posix.cc} +4 -4
- data/src/core/lib/support/{env_windows.c → env_windows.cc} +5 -5
- data/src/core/lib/support/{fork.c → fork.cc} +2 -2
- data/src/core/lib/support/{histogram.c → histogram.cc} +25 -26
- data/src/core/lib/support/{host_port.c → host_port.cc} +16 -16
- data/src/core/lib/support/{log.c → log.cc} +8 -8
- data/src/core/lib/support/{log_android.c → log_android.cc} +7 -7
- data/src/core/lib/support/{log_linux.c → log_linux.cc} +8 -8
- data/src/core/lib/support/{log_posix.c → log_posix.cc} +9 -10
- data/src/core/lib/support/{log_windows.c → log_windows.cc} +7 -7
- data/src/core/lib/support/manual_constructor.h +211 -0
- data/src/core/lib/support/memory.h +41 -0
- data/src/core/lib/support/mpscq.cc +114 -0
- data/src/core/lib/support/mpscq.h +45 -7
- data/src/core/lib/support/{murmur_hash.c → murmur_hash.cc} +9 -12
- data/src/core/lib/support/murmur_hash.h +9 -1
- data/src/core/lib/support/spinlock.h +8 -1
- data/src/core/lib/support/{string.c → string.cc} +56 -55
- data/src/core/lib/support/string.h +21 -21
- data/src/core/lib/support/{string_posix.c → string_posix.cc} +5 -4
- data/src/core/lib/support/{string_util_windows.c → string_util_windows.cc} +9 -6
- data/src/core/lib/support/{string_windows.c → string_windows.cc} +3 -2
- data/src/core/lib/support/string_windows.h +8 -0
- data/src/core/lib/support/{subprocess_posix.c → subprocess_posix.cc} +13 -13
- data/src/core/lib/support/{subprocess_windows.c → subprocess_windows.cc} +9 -9
- data/src/core/lib/support/{sync.c → sync.cc} +22 -22
- data/src/core/lib/support/{sync_posix.c → sync_posix.cc} +6 -2
- data/src/core/lib/support/{sync_windows.c → sync_windows.cc} +14 -14
- data/src/core/lib/support/{thd.c → thd.cc} +0 -0
- data/src/core/lib/support/{thd_posix.c → thd_posix.cc} +10 -10
- data/src/core/lib/support/{thd_windows.c → thd_windows.cc} +10 -10
- data/src/core/lib/support/{time.c → time.cc} +0 -0
- data/src/core/lib/support/{time_posix.c → time_posix.cc} +5 -6
- data/src/core/lib/support/{time_precise.c → time_precise.cc} +6 -4
- data/src/core/lib/support/time_precise.h +9 -1
- data/src/core/lib/support/{time_windows.c → time_windows.cc} +2 -3
- data/src/core/lib/support/{tls_pthread.c → tls_pthread.cc} +2 -2
- data/src/core/lib/support/tmpfile.h +1 -1
- data/src/core/lib/support/{tmpfile_msys.c → tmpfile_msys.cc} +2 -2
- data/src/core/lib/support/{tmpfile_posix.c → tmpfile_posix.cc} +7 -7
- data/src/core/lib/support/{tmpfile_windows.c → tmpfile_windows.cc} +2 -2
- data/src/core/lib/support/{wrap_memcpy.c → wrap_memcpy.cc} +4 -2
- data/src/core/lib/surface/{alarm.c → alarm.cc} +32 -31
- data/src/core/lib/surface/alarm_internal.h +10 -2
- data/src/core/lib/surface/{api_trace.c → api_trace.cc} +1 -1
- data/src/core/lib/surface/api_trace.h +2 -2
- data/src/core/lib/surface/{byte_buffer.c → byte_buffer.cc} +13 -13
- data/src/core/lib/surface/{byte_buffer_reader.c → byte_buffer_reader.cc} +9 -9
- data/src/core/lib/surface/{call.c → call.cc} +379 -372
- data/src/core/lib/surface/call.h +37 -38
- data/src/core/lib/surface/{call_details.c → call_details.cc} +0 -0
- data/src/core/lib/surface/{call_log_batch.c → call_log_batch.cc} +13 -11
- data/src/core/lib/surface/call_test_only.h +5 -5
- data/src/core/lib/surface/{channel.c → channel.cc} +94 -95
- data/src/core/lib/surface/channel.h +29 -21
- data/src/core/lib/surface/{channel_init.c → channel_init.cc} +13 -13
- data/src/core/lib/surface/channel_init.h +6 -6
- data/src/core/lib/surface/{channel_ping.c → channel_ping.cc} +12 -12
- data/src/core/lib/surface/{channel_stack_type.c → channel_stack_type.cc} +1 -1
- data/src/core/lib/surface/channel_stack_type.h +9 -1
- data/src/core/lib/surface/{completion_queue.c → completion_queue.cc} +416 -379
- data/src/core/lib/surface/completion_queue.h +29 -29
- data/src/core/lib/surface/{completion_queue_factory.c → completion_queue_factory.cc} +1 -1
- data/src/core/lib/surface/completion_queue_factory.h +8 -0
- data/src/core/lib/surface/{event_string.c → event_string.cc} +9 -9
- data/src/core/lib/surface/event_string.h +9 -1
- data/src/core/lib/surface/{init.c → init.cc} +16 -39
- data/src/core/lib/surface/init.h +8 -0
- data/src/core/lib/surface/{init_secure.c → init_secure.cc} +12 -25
- data/src/core/lib/surface/lame_client.cc +38 -40
- data/src/core/lib/surface/lame_client.h +8 -0
- data/src/core/lib/surface/{metadata_array.c → metadata_array.cc} +0 -0
- data/src/core/lib/surface/{server.c → server.cc} +340 -404
- data/src/core/lib/surface/server.h +22 -14
- data/src/core/lib/surface/{validate_metadata.c → validate_metadata.cc} +10 -9
- data/src/core/lib/surface/validate_metadata.h +10 -2
- data/src/core/lib/surface/{version.c → version.cc} +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +84 -0
- data/src/core/lib/transport/bdp_estimator.h +67 -42
- data/src/core/lib/transport/{byte_stream.c → byte_stream.cc} +51 -51
- data/src/core/lib/transport/byte_stream.h +41 -33
- data/src/core/lib/transport/{connectivity_state.c → connectivity_state.cc} +36 -40
- data/src/core/lib/transport/connectivity_state.h +29 -21
- data/src/core/lib/transport/{error_utils.c → error_utils.cc} +26 -22
- data/src/core/lib/transport/error_utils.h +18 -6
- data/src/core/lib/transport/{metadata.c → metadata.cc} +92 -88
- data/src/core/lib/transport/metadata.h +22 -20
- data/src/core/lib/transport/{metadata_batch.c → metadata_batch.cc} +78 -79
- data/src/core/lib/transport/metadata_batch.h +46 -45
- data/src/core/lib/transport/pid_controller.cc +48 -0
- data/src/core/lib/transport/pid_controller.h +84 -32
- data/src/core/lib/transport/{service_config.c → service_config.cc} +66 -48
- data/src/core/lib/transport/service_config.h +11 -2
- data/src/core/lib/transport/{static_metadata.c → static_metadata.cc} +2 -2
- data/src/core/lib/transport/static_metadata.h +30 -23
- data/src/core/lib/transport/{status_conversion.c → status_conversion.cc} +4 -3
- data/src/core/lib/transport/status_conversion.h +12 -2
- data/src/core/lib/transport/{timeout_encoding.c → timeout_encoding.cc} +28 -61
- data/src/core/lib/transport/timeout_encoding.h +11 -2
- data/src/core/lib/transport/{transport.c → transport.cc} +79 -79
- data/src/core/lib/transport/transport.h +78 -80
- data/src/core/lib/transport/transport_impl.h +27 -19
- data/src/core/lib/transport/{transport_op_string.c → transport_op_string.cc} +32 -30
- data/src/core/plugin_registry/{grpc_plugin_registry.c → grpc_plugin_registry.cc} +34 -38
- data/src/core/tsi/{fake_transport_security.c → fake_transport_security.cc} +141 -132
- data/src/core/tsi/fake_transport_security.h +5 -5
- data/src/core/tsi/{gts_transport_security.c → gts_transport_security.cc} +4 -4
- data/src/core/tsi/gts_transport_security.h +11 -3
- data/src/core/tsi/{ssl_transport_security.c → ssl_transport_security.cc} +309 -300
- data/src/core/tsi/ssl_transport_security.h +25 -25
- data/src/core/tsi/ssl_types.h +8 -0
- data/src/core/tsi/{transport_security.c → transport_security.cc} +94 -87
- data/src/core/tsi/transport_security.h +55 -55
- data/src/core/tsi/{transport_security_adapter.c → transport_security_adapter.cc} +58 -55
- data/src/core/tsi/transport_security_adapter.h +2 -2
- data/src/core/tsi/{transport_security_grpc.c → transport_security_grpc.cc} +21 -21
- data/src/core/tsi/transport_security_grpc.h +19 -19
- data/src/core/tsi/transport_security_interface.h +41 -41
- data/src/ruby/ext/grpc/extconf.rb +4 -2
- data/src/ruby/ext/grpc/rb_byte_buffer.c +5 -5
- data/src/ruby/ext/grpc/rb_byte_buffer.h +2 -2
- data/src/ruby/ext/grpc/rb_call.c +41 -42
- data/src/ruby/ext/grpc/rb_call.h +6 -6
- data/src/ruby/ext/grpc/rb_call_credentials.c +30 -30
- data/src/ruby/ext/grpc/rb_channel.c +87 -87
- data/src/ruby/ext/grpc/rb_channel_credentials.c +23 -23
- data/src/ruby/ext/grpc/rb_completion_queue.c +11 -11
- data/src/ruby/ext/grpc/rb_completion_queue.h +3 -3
- data/src/ruby/ext/grpc/rb_compression_options.c +20 -20
- data/src/ruby/ext/grpc/rb_event_thread.c +14 -14
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +8 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -58
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +242 -306
- data/src/ruby/ext/grpc/rb_server.c +23 -23
- data/src/ruby/ext/grpc/rb_server_credentials.c +13 -13
- data/src/ruby/lib/grpc/generic/rpc_server.rb +25 -12
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/checker.rb +14 -0
- data/src/ruby/spec/pb/health/checker_spec.rb +29 -0
- data/third_party/cares/config_freebsd/ares_config.h +502 -0
- data/third_party/cares/config_openbsd/ares_config.h +502 -0
- metadata +302 -328
- data/src/core/ext/census/aggregation.h +0 -51
- data/src/core/ext/census/base_resources.c +0 -56
- data/src/core/ext/census/base_resources.h +0 -24
- data/src/core/ext/census/census_interface.h +0 -61
- data/src/core/ext/census/census_rpc_stats.h +0 -86
- data/src/core/ext/census/context.c +0 -496
- data/src/core/ext/census/gen/census.pb.c +0 -161
- data/src/core/ext/census/gen/census.pb.h +0 -280
- data/src/core/ext/census/gen/trace_context.pb.c +0 -39
- data/src/core/ext/census/gen/trace_context.pb.h +0 -78
- data/src/core/ext/census/grpc_filter.c +0 -196
- data/src/core/ext/census/grpc_plugin.c +0 -70
- data/src/core/ext/census/initialize.c +0 -51
- data/src/core/ext/census/intrusive_hash_map.c +0 -305
- data/src/core/ext/census/intrusive_hash_map.h +0 -152
- data/src/core/ext/census/intrusive_hash_map_internal.h +0 -48
- data/src/core/ext/census/mlog.c +0 -586
- data/src/core/ext/census/mlog.h +0 -80
- data/src/core/ext/census/operation.c +0 -48
- data/src/core/ext/census/placeholders.c +0 -49
- data/src/core/ext/census/resource.c +0 -303
- data/src/core/ext/census/resource.h +0 -48
- data/src/core/ext/census/rpc_metric_id.h +0 -36
- data/src/core/ext/census/trace_context.c +0 -71
- data/src/core/ext/census/trace_context.h +0 -56
- data/src/core/ext/census/trace_label.h +0 -46
- data/src/core/ext/census/trace_propagation.h +0 -48
- data/src/core/ext/census/trace_status.h +0 -30
- data/src/core/ext/census/trace_string.h +0 -35
- data/src/core/ext/census/tracing.c +0 -55
- data/src/core/ext/census/tracing.h +0 -109
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +0 -714
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +0 -924
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.c +0 -60
- data/src/core/ext/transport/chttp2/transport/flow_control.c +0 -502
- data/src/core/ext/transport/chttp2/transport/writing.c +0 -534
- data/src/core/lib/debug/trace.c +0 -146
- data/src/core/lib/iomgr/closure.c +0 -219
- data/src/core/lib/iomgr/ev_epollex_linux.c +0 -1461
- data/src/core/lib/iomgr/ev_posix.c +0 -266
- data/src/core/lib/iomgr/exec_ctx.c +0 -113
- data/src/core/lib/iomgr/tcp_uv.c +0 -381
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +0 -194
- data/src/core/lib/security/transport/security_connector.c +0 -914
- data/src/core/lib/support/backoff.c +0 -72
- data/src/core/lib/support/backoff.h +0 -56
- data/src/core/lib/support/mpscq.c +0 -79
- data/src/core/lib/support/stack_lockfree.c +0 -137
- data/src/core/lib/support/stack_lockfree.h +0 -38
- data/src/core/lib/transport/bdp_estimator.c +0 -110
- data/src/core/lib/transport/pid_controller.c +0 -63
@@ -34,6 +34,12 @@
|
|
34
34
|
/* maximum table size we'll actually use */
|
35
35
|
#define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE (1024 * 1024)
|
36
36
|
|
37
|
+
extern grpc_core::TraceFlag grpc_http_trace;
|
38
|
+
|
39
|
+
#ifdef __cplusplus
|
40
|
+
extern "C" {
|
41
|
+
#endif
|
42
|
+
|
37
43
|
typedef struct {
|
38
44
|
uint32_t filter_elems_sum;
|
39
45
|
uint32_t max_table_size;
|
@@ -64,31 +70,35 @@ typedef struct {
|
|
64
70
|
uint32_t indices_keys[GRPC_CHTTP2_HPACKC_NUM_VALUES];
|
65
71
|
uint32_t indices_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
|
66
72
|
|
67
|
-
uint16_t
|
73
|
+
uint16_t* table_elem_size;
|
68
74
|
} grpc_chttp2_hpack_compressor;
|
69
75
|
|
70
|
-
void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor
|
71
|
-
void grpc_chttp2_hpack_compressor_destroy(grpc_exec_ctx
|
72
|
-
grpc_chttp2_hpack_compressor
|
76
|
+
void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor* c);
|
77
|
+
void grpc_chttp2_hpack_compressor_destroy(grpc_exec_ctx* exec_ctx,
|
78
|
+
grpc_chttp2_hpack_compressor* c);
|
73
79
|
void grpc_chttp2_hpack_compressor_set_max_table_size(
|
74
|
-
grpc_chttp2_hpack_compressor
|
80
|
+
grpc_chttp2_hpack_compressor* c, uint32_t max_table_size);
|
75
81
|
void grpc_chttp2_hpack_compressor_set_max_usable_size(
|
76
|
-
grpc_chttp2_hpack_compressor
|
82
|
+
grpc_chttp2_hpack_compressor* c, uint32_t max_table_size);
|
77
83
|
|
78
84
|
typedef struct {
|
79
85
|
uint32_t stream_id;
|
80
86
|
bool is_eof;
|
81
87
|
bool use_true_binary_metadata;
|
82
88
|
size_t max_frame_size;
|
83
|
-
grpc_transport_one_way_stats
|
89
|
+
grpc_transport_one_way_stats* stats;
|
84
90
|
} grpc_encode_header_options;
|
85
91
|
|
86
|
-
void grpc_chttp2_encode_header(grpc_exec_ctx
|
87
|
-
grpc_chttp2_hpack_compressor
|
88
|
-
grpc_mdelem
|
92
|
+
void grpc_chttp2_encode_header(grpc_exec_ctx* exec_ctx,
|
93
|
+
grpc_chttp2_hpack_compressor* c,
|
94
|
+
grpc_mdelem** extra_headers,
|
89
95
|
size_t extra_headers_size,
|
90
|
-
grpc_metadata_batch
|
91
|
-
const grpc_encode_header_options
|
92
|
-
grpc_slice_buffer
|
96
|
+
grpc_metadata_batch* metadata,
|
97
|
+
const grpc_encode_header_options* options,
|
98
|
+
grpc_slice_buffer* outbuf);
|
99
|
+
|
100
|
+
#ifdef __cplusplus
|
101
|
+
}
|
102
|
+
#endif
|
93
103
|
|
94
104
|
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */
|
@@ -33,6 +33,7 @@
|
|
33
33
|
#include "src/core/lib/debug/stats.h"
|
34
34
|
#include "src/core/lib/profiling/timers.h"
|
35
35
|
#include "src/core/lib/slice/slice_internal.h"
|
36
|
+
#include "src/core/lib/slice/slice_string_helpers.h"
|
36
37
|
#include "src/core/lib/support/string.h"
|
37
38
|
#include "src/core/lib/transport/http2_errors.h"
|
38
39
|
|
@@ -60,97 +61,97 @@ typedef enum {
|
|
60
61
|
a set of indirect jumps, and so not waste stack space. */
|
61
62
|
|
62
63
|
/* forward declarations for parsing states */
|
63
|
-
static grpc_error
|
64
|
-
grpc_chttp2_hpack_parser
|
65
|
-
const uint8_t
|
66
|
-
static grpc_error
|
67
|
-
grpc_chttp2_hpack_parser
|
68
|
-
const uint8_t
|
69
|
-
static grpc_error
|
70
|
-
grpc_chttp2_hpack_parser
|
71
|
-
const uint8_t
|
72
|
-
static grpc_error
|
73
|
-
grpc_chttp2_hpack_parser
|
74
|
-
const uint8_t
|
75
|
-
|
76
|
-
static grpc_error
|
77
|
-
grpc_chttp2_hpack_parser
|
78
|
-
const uint8_t
|
79
|
-
static grpc_error
|
80
|
-
grpc_chttp2_hpack_parser
|
81
|
-
const uint8_t
|
82
|
-
static grpc_error
|
83
|
-
grpc_exec_ctx
|
84
|
-
const uint8_t
|
85
|
-
static grpc_error
|
86
|
-
grpc_exec_ctx
|
87
|
-
const uint8_t
|
88
|
-
|
89
|
-
static grpc_error
|
90
|
-
grpc_chttp2_hpack_parser
|
91
|
-
const uint8_t
|
92
|
-
static grpc_error
|
93
|
-
grpc_chttp2_hpack_parser
|
94
|
-
const uint8_t
|
95
|
-
static grpc_error
|
96
|
-
grpc_chttp2_hpack_parser
|
97
|
-
const uint8_t
|
98
|
-
static grpc_error
|
99
|
-
grpc_chttp2_hpack_parser
|
100
|
-
const uint8_t
|
101
|
-
static grpc_error
|
102
|
-
grpc_chttp2_hpack_parser
|
103
|
-
const uint8_t
|
104
|
-
static grpc_error
|
105
|
-
grpc_chttp2_hpack_parser
|
106
|
-
const uint8_t
|
107
|
-
|
108
|
-
static grpc_error
|
109
|
-
grpc_chttp2_hpack_parser
|
110
|
-
const uint8_t
|
111
|
-
static grpc_error
|
112
|
-
grpc_chttp2_hpack_parser
|
113
|
-
const uint8_t
|
114
|
-
const uint8_t
|
115
|
-
static grpc_error
|
116
|
-
grpc_chttp2_hpack_parser
|
117
|
-
const uint8_t
|
118
|
-
static grpc_error
|
119
|
-
grpc_chttp2_hpack_parser
|
120
|
-
const uint8_t
|
121
|
-
const uint8_t
|
122
|
-
static grpc_error
|
123
|
-
grpc_chttp2_hpack_parser
|
124
|
-
const uint8_t
|
125
|
-
const uint8_t
|
126
|
-
static grpc_error
|
127
|
-
grpc_chttp2_hpack_parser
|
128
|
-
const uint8_t
|
129
|
-
static grpc_error
|
130
|
-
grpc_chttp2_hpack_parser
|
131
|
-
const uint8_t
|
132
|
-
const uint8_t
|
133
|
-
static grpc_error
|
134
|
-
grpc_chttp2_hpack_parser
|
135
|
-
const uint8_t
|
136
|
-
const uint8_t
|
137
|
-
static grpc_error
|
138
|
-
grpc_chttp2_hpack_parser
|
139
|
-
const uint8_t
|
140
|
-
static grpc_error
|
141
|
-
grpc_chttp2_hpack_parser
|
142
|
-
const uint8_t
|
143
|
-
const uint8_t
|
144
|
-
static grpc_error
|
145
|
-
grpc_chttp2_hpack_parser
|
146
|
-
const uint8_t
|
147
|
-
const uint8_t
|
148
|
-
static grpc_error
|
149
|
-
grpc_chttp2_hpack_parser
|
150
|
-
const uint8_t
|
151
|
-
static grpc_error
|
152
|
-
grpc_chttp2_hpack_parser
|
153
|
-
const uint8_t
|
64
|
+
static grpc_error* parse_begin(grpc_exec_ctx* exec_ctx,
|
65
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
66
|
+
const uint8_t* end);
|
67
|
+
static grpc_error* parse_error(grpc_exec_ctx* exec_ctx,
|
68
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
69
|
+
const uint8_t* end, grpc_error* error);
|
70
|
+
static grpc_error* still_parse_error(grpc_exec_ctx* exec_ctx,
|
71
|
+
grpc_chttp2_hpack_parser* p,
|
72
|
+
const uint8_t* cur, const uint8_t* end);
|
73
|
+
static grpc_error* parse_illegal_op(grpc_exec_ctx* exec_ctx,
|
74
|
+
grpc_chttp2_hpack_parser* p,
|
75
|
+
const uint8_t* cur, const uint8_t* end);
|
76
|
+
|
77
|
+
static grpc_error* parse_string_prefix(grpc_exec_ctx* exec_ctx,
|
78
|
+
grpc_chttp2_hpack_parser* p,
|
79
|
+
const uint8_t* cur, const uint8_t* end);
|
80
|
+
static grpc_error* parse_key_string(grpc_exec_ctx* exec_ctx,
|
81
|
+
grpc_chttp2_hpack_parser* p,
|
82
|
+
const uint8_t* cur, const uint8_t* end);
|
83
|
+
static grpc_error* parse_value_string_with_indexed_key(
|
84
|
+
grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
85
|
+
const uint8_t* end);
|
86
|
+
static grpc_error* parse_value_string_with_literal_key(
|
87
|
+
grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
88
|
+
const uint8_t* end);
|
89
|
+
|
90
|
+
static grpc_error* parse_value0(grpc_exec_ctx* exec_ctx,
|
91
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
92
|
+
const uint8_t* end);
|
93
|
+
static grpc_error* parse_value1(grpc_exec_ctx* exec_ctx,
|
94
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
95
|
+
const uint8_t* end);
|
96
|
+
static grpc_error* parse_value2(grpc_exec_ctx* exec_ctx,
|
97
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
98
|
+
const uint8_t* end);
|
99
|
+
static grpc_error* parse_value3(grpc_exec_ctx* exec_ctx,
|
100
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
101
|
+
const uint8_t* end);
|
102
|
+
static grpc_error* parse_value4(grpc_exec_ctx* exec_ctx,
|
103
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
104
|
+
const uint8_t* end);
|
105
|
+
static grpc_error* parse_value5up(grpc_exec_ctx* exec_ctx,
|
106
|
+
grpc_chttp2_hpack_parser* p,
|
107
|
+
const uint8_t* cur, const uint8_t* end);
|
108
|
+
|
109
|
+
static grpc_error* parse_indexed_field(grpc_exec_ctx* exec_ctx,
|
110
|
+
grpc_chttp2_hpack_parser* p,
|
111
|
+
const uint8_t* cur, const uint8_t* end);
|
112
|
+
static grpc_error* parse_indexed_field_x(grpc_exec_ctx* exec_ctx,
|
113
|
+
grpc_chttp2_hpack_parser* p,
|
114
|
+
const uint8_t* cur,
|
115
|
+
const uint8_t* end);
|
116
|
+
static grpc_error* parse_lithdr_incidx(grpc_exec_ctx* exec_ctx,
|
117
|
+
grpc_chttp2_hpack_parser* p,
|
118
|
+
const uint8_t* cur, const uint8_t* end);
|
119
|
+
static grpc_error* parse_lithdr_incidx_x(grpc_exec_ctx* exec_ctx,
|
120
|
+
grpc_chttp2_hpack_parser* p,
|
121
|
+
const uint8_t* cur,
|
122
|
+
const uint8_t* end);
|
123
|
+
static grpc_error* parse_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
|
124
|
+
grpc_chttp2_hpack_parser* p,
|
125
|
+
const uint8_t* cur,
|
126
|
+
const uint8_t* end);
|
127
|
+
static grpc_error* parse_lithdr_notidx(grpc_exec_ctx* exec_ctx,
|
128
|
+
grpc_chttp2_hpack_parser* p,
|
129
|
+
const uint8_t* cur, const uint8_t* end);
|
130
|
+
static grpc_error* parse_lithdr_notidx_x(grpc_exec_ctx* exec_ctx,
|
131
|
+
grpc_chttp2_hpack_parser* p,
|
132
|
+
const uint8_t* cur,
|
133
|
+
const uint8_t* end);
|
134
|
+
static grpc_error* parse_lithdr_notidx_v(grpc_exec_ctx* exec_ctx,
|
135
|
+
grpc_chttp2_hpack_parser* p,
|
136
|
+
const uint8_t* cur,
|
137
|
+
const uint8_t* end);
|
138
|
+
static grpc_error* parse_lithdr_nvridx(grpc_exec_ctx* exec_ctx,
|
139
|
+
grpc_chttp2_hpack_parser* p,
|
140
|
+
const uint8_t* cur, const uint8_t* end);
|
141
|
+
static grpc_error* parse_lithdr_nvridx_x(grpc_exec_ctx* exec_ctx,
|
142
|
+
grpc_chttp2_hpack_parser* p,
|
143
|
+
const uint8_t* cur,
|
144
|
+
const uint8_t* end);
|
145
|
+
static grpc_error* parse_lithdr_nvridx_v(grpc_exec_ctx* exec_ctx,
|
146
|
+
grpc_chttp2_hpack_parser* p,
|
147
|
+
const uint8_t* cur,
|
148
|
+
const uint8_t* end);
|
149
|
+
static grpc_error* parse_max_tbl_size(grpc_exec_ctx* exec_ctx,
|
150
|
+
grpc_chttp2_hpack_parser* p,
|
151
|
+
const uint8_t* cur, const uint8_t* end);
|
152
|
+
static grpc_error* parse_max_tbl_size_x(grpc_exec_ctx* exec_ctx,
|
153
|
+
grpc_chttp2_hpack_parser* p,
|
154
|
+
const uint8_t* cur, const uint8_t* end);
|
154
155
|
|
155
156
|
/* we translate the first byte of a hpack field into one of these decoding
|
156
157
|
cases, then use a lookup table to jump directly to the appropriate parser.
|
@@ -648,11 +649,16 @@ static const uint8_t inverse_base64[256] = {
|
|
648
649
|
};
|
649
650
|
|
650
651
|
/* emission helpers */
|
651
|
-
static grpc_error
|
652
|
+
static grpc_error* on_hdr(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p,
|
652
653
|
grpc_mdelem md, int add_to_table) {
|
653
|
-
if (
|
654
|
-
char
|
655
|
-
char
|
654
|
+
if (grpc_http_trace.enabled()) {
|
655
|
+
char* k = grpc_slice_to_c_string(GRPC_MDKEY(md));
|
656
|
+
char* v = nullptr;
|
657
|
+
if (grpc_is_binary_header(GRPC_MDKEY(md))) {
|
658
|
+
v = grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX);
|
659
|
+
} else {
|
660
|
+
v = grpc_slice_to_c_string(GRPC_MDVALUE(md));
|
661
|
+
}
|
656
662
|
gpr_log(
|
657
663
|
GPR_DEBUG,
|
658
664
|
"Decode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
|
@@ -665,10 +671,10 @@ static grpc_error *on_hdr(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p,
|
|
665
671
|
if (add_to_table) {
|
666
672
|
GPR_ASSERT(GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_INTERNED ||
|
667
673
|
GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC);
|
668
|
-
grpc_error
|
674
|
+
grpc_error* err = grpc_chttp2_hptbl_add(exec_ctx, &p->table, md);
|
669
675
|
if (err != GRPC_ERROR_NONE) return err;
|
670
676
|
}
|
671
|
-
if (p->on_header ==
|
677
|
+
if (p->on_header == nullptr) {
|
672
678
|
GRPC_MDELEM_UNREF(exec_ctx, md);
|
673
679
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set");
|
674
680
|
}
|
@@ -676,9 +682,9 @@ static grpc_error *on_hdr(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p,
|
|
676
682
|
return GRPC_ERROR_NONE;
|
677
683
|
}
|
678
684
|
|
679
|
-
static grpc_slice take_string(grpc_exec_ctx
|
680
|
-
grpc_chttp2_hpack_parser
|
681
|
-
grpc_chttp2_hpack_parser_string
|
685
|
+
static grpc_slice take_string(grpc_exec_ctx* exec_ctx,
|
686
|
+
grpc_chttp2_hpack_parser* p,
|
687
|
+
grpc_chttp2_hpack_parser_string* str,
|
682
688
|
bool intern) {
|
683
689
|
grpc_slice s;
|
684
690
|
if (!str->copied) {
|
@@ -702,18 +708,18 @@ static grpc_slice take_string(grpc_exec_ctx *exec_ctx,
|
|
702
708
|
}
|
703
709
|
|
704
710
|
/* jump to the next state */
|
705
|
-
static grpc_error
|
706
|
-
grpc_chttp2_hpack_parser
|
707
|
-
const uint8_t
|
711
|
+
static grpc_error* parse_next(grpc_exec_ctx* exec_ctx,
|
712
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
713
|
+
const uint8_t* end) {
|
708
714
|
p->state = *p->next_state++;
|
709
715
|
return p->state(exec_ctx, p, cur, end);
|
710
716
|
}
|
711
717
|
|
712
718
|
/* begin parsing a header: all functionality is encoded into lookup tables
|
713
719
|
above */
|
714
|
-
static grpc_error
|
715
|
-
grpc_chttp2_hpack_parser
|
716
|
-
const uint8_t
|
720
|
+
static grpc_error* parse_begin(grpc_exec_ctx* exec_ctx,
|
721
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
722
|
+
const uint8_t* end) {
|
717
723
|
if (cur == end) {
|
718
724
|
p->state = parse_begin;
|
719
725
|
return GRPC_ERROR_NONE;
|
@@ -723,9 +729,9 @@ static grpc_error *parse_begin(grpc_exec_ctx *exec_ctx,
|
|
723
729
|
}
|
724
730
|
|
725
731
|
/* stream dependency and prioritization data: we just skip it */
|
726
|
-
static grpc_error
|
727
|
-
grpc_chttp2_hpack_parser
|
728
|
-
const uint8_t
|
732
|
+
static grpc_error* parse_stream_weight(grpc_exec_ctx* exec_ctx,
|
733
|
+
grpc_chttp2_hpack_parser* p,
|
734
|
+
const uint8_t* cur, const uint8_t* end) {
|
729
735
|
if (cur == end) {
|
730
736
|
p->state = parse_stream_weight;
|
731
737
|
return GRPC_ERROR_NONE;
|
@@ -734,9 +740,9 @@ static grpc_error *parse_stream_weight(grpc_exec_ctx *exec_ctx,
|
|
734
740
|
return p->after_prioritization(exec_ctx, p, cur + 1, end);
|
735
741
|
}
|
736
742
|
|
737
|
-
static grpc_error
|
738
|
-
grpc_chttp2_hpack_parser
|
739
|
-
const uint8_t
|
743
|
+
static grpc_error* parse_stream_dep3(grpc_exec_ctx* exec_ctx,
|
744
|
+
grpc_chttp2_hpack_parser* p,
|
745
|
+
const uint8_t* cur, const uint8_t* end) {
|
740
746
|
if (cur == end) {
|
741
747
|
p->state = parse_stream_dep3;
|
742
748
|
return GRPC_ERROR_NONE;
|
@@ -745,9 +751,9 @@ static grpc_error *parse_stream_dep3(grpc_exec_ctx *exec_ctx,
|
|
745
751
|
return parse_stream_weight(exec_ctx, p, cur + 1, end);
|
746
752
|
}
|
747
753
|
|
748
|
-
static grpc_error
|
749
|
-
grpc_chttp2_hpack_parser
|
750
|
-
const uint8_t
|
754
|
+
static grpc_error* parse_stream_dep2(grpc_exec_ctx* exec_ctx,
|
755
|
+
grpc_chttp2_hpack_parser* p,
|
756
|
+
const uint8_t* cur, const uint8_t* end) {
|
751
757
|
if (cur == end) {
|
752
758
|
p->state = parse_stream_dep2;
|
753
759
|
return GRPC_ERROR_NONE;
|
@@ -756,9 +762,9 @@ static grpc_error *parse_stream_dep2(grpc_exec_ctx *exec_ctx,
|
|
756
762
|
return parse_stream_dep3(exec_ctx, p, cur + 1, end);
|
757
763
|
}
|
758
764
|
|
759
|
-
static grpc_error
|
760
|
-
grpc_chttp2_hpack_parser
|
761
|
-
const uint8_t
|
765
|
+
static grpc_error* parse_stream_dep1(grpc_exec_ctx* exec_ctx,
|
766
|
+
grpc_chttp2_hpack_parser* p,
|
767
|
+
const uint8_t* cur, const uint8_t* end) {
|
762
768
|
if (cur == end) {
|
763
769
|
p->state = parse_stream_dep1;
|
764
770
|
return GRPC_ERROR_NONE;
|
@@ -767,9 +773,9 @@ static grpc_error *parse_stream_dep1(grpc_exec_ctx *exec_ctx,
|
|
767
773
|
return parse_stream_dep2(exec_ctx, p, cur + 1, end);
|
768
774
|
}
|
769
775
|
|
770
|
-
static grpc_error
|
771
|
-
grpc_chttp2_hpack_parser
|
772
|
-
const uint8_t
|
776
|
+
static grpc_error* parse_stream_dep0(grpc_exec_ctx* exec_ctx,
|
777
|
+
grpc_chttp2_hpack_parser* p,
|
778
|
+
const uint8_t* cur, const uint8_t* end) {
|
773
779
|
if (cur == end) {
|
774
780
|
p->state = parse_stream_dep0;
|
775
781
|
return GRPC_ERROR_NONE;
|
@@ -779,10 +785,10 @@ static grpc_error *parse_stream_dep0(grpc_exec_ctx *exec_ctx,
|
|
779
785
|
}
|
780
786
|
|
781
787
|
/* emit an indexed field; jumps to begin the next field on completion */
|
782
|
-
static grpc_error
|
783
|
-
grpc_chttp2_hpack_parser
|
784
|
-
const uint8_t
|
785
|
-
const uint8_t
|
788
|
+
static grpc_error* finish_indexed_field(grpc_exec_ctx* exec_ctx,
|
789
|
+
grpc_chttp2_hpack_parser* p,
|
790
|
+
const uint8_t* cur,
|
791
|
+
const uint8_t* end) {
|
786
792
|
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
787
793
|
if (GRPC_MDISNULL(md)) {
|
788
794
|
return grpc_error_set_int(
|
@@ -793,25 +799,25 @@ static grpc_error *finish_indexed_field(grpc_exec_ctx *exec_ctx,
|
|
793
799
|
}
|
794
800
|
GRPC_MDELEM_REF(md);
|
795
801
|
GRPC_STATS_INC_HPACK_RECV_INDEXED(exec_ctx);
|
796
|
-
grpc_error
|
802
|
+
grpc_error* err = on_hdr(exec_ctx, p, md, 0);
|
797
803
|
if (err != GRPC_ERROR_NONE) return err;
|
798
804
|
return parse_begin(exec_ctx, p, cur, end);
|
799
805
|
}
|
800
806
|
|
801
807
|
/* parse an indexed field with index < 127 */
|
802
|
-
static grpc_error
|
803
|
-
grpc_chttp2_hpack_parser
|
804
|
-
const uint8_t
|
808
|
+
static grpc_error* parse_indexed_field(grpc_exec_ctx* exec_ctx,
|
809
|
+
grpc_chttp2_hpack_parser* p,
|
810
|
+
const uint8_t* cur, const uint8_t* end) {
|
805
811
|
p->dynamic_table_update_allowed = 0;
|
806
812
|
p->index = (*cur) & 0x7f;
|
807
813
|
return finish_indexed_field(exec_ctx, p, cur + 1, end);
|
808
814
|
}
|
809
815
|
|
810
816
|
/* parse an indexed field with index >= 127 */
|
811
|
-
static grpc_error
|
812
|
-
grpc_chttp2_hpack_parser
|
813
|
-
const uint8_t
|
814
|
-
const uint8_t
|
817
|
+
static grpc_error* parse_indexed_field_x(grpc_exec_ctx* exec_ctx,
|
818
|
+
grpc_chttp2_hpack_parser* p,
|
819
|
+
const uint8_t* cur,
|
820
|
+
const uint8_t* end) {
|
815
821
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
816
822
|
finish_indexed_field};
|
817
823
|
p->dynamic_table_update_allowed = 0;
|
@@ -822,14 +828,14 @@ static grpc_error *parse_indexed_field_x(grpc_exec_ctx *exec_ctx,
|
|
822
828
|
}
|
823
829
|
|
824
830
|
/* finish a literal header with incremental indexing */
|
825
|
-
static grpc_error
|
826
|
-
grpc_chttp2_hpack_parser
|
827
|
-
const uint8_t
|
828
|
-
const uint8_t
|
831
|
+
static grpc_error* finish_lithdr_incidx(grpc_exec_ctx* exec_ctx,
|
832
|
+
grpc_chttp2_hpack_parser* p,
|
833
|
+
const uint8_t* cur,
|
834
|
+
const uint8_t* end) {
|
829
835
|
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
830
836
|
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
|
831
837
|
GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX(exec_ctx);
|
832
|
-
grpc_error
|
838
|
+
grpc_error* err = on_hdr(
|
833
839
|
exec_ctx, p,
|
834
840
|
grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
|
835
841
|
take_string(exec_ctx, p, &p->value, true)),
|
@@ -839,12 +845,12 @@ static grpc_error *finish_lithdr_incidx(grpc_exec_ctx *exec_ctx,
|
|
839
845
|
}
|
840
846
|
|
841
847
|
/* finish a literal header with incremental indexing with no index */
|
842
|
-
static grpc_error
|
843
|
-
grpc_chttp2_hpack_parser
|
844
|
-
const uint8_t
|
845
|
-
const uint8_t
|
848
|
+
static grpc_error* finish_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
|
849
|
+
grpc_chttp2_hpack_parser* p,
|
850
|
+
const uint8_t* cur,
|
851
|
+
const uint8_t* end) {
|
846
852
|
GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX_V(exec_ctx);
|
847
|
-
grpc_error
|
853
|
+
grpc_error* err = on_hdr(
|
848
854
|
exec_ctx, p,
|
849
855
|
grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
|
850
856
|
take_string(exec_ctx, p, &p->value, true)),
|
@@ -854,9 +860,9 @@ static grpc_error *finish_lithdr_incidx_v(grpc_exec_ctx *exec_ctx,
|
|
854
860
|
}
|
855
861
|
|
856
862
|
/* parse a literal header with incremental indexing; index < 63 */
|
857
|
-
static grpc_error
|
858
|
-
grpc_chttp2_hpack_parser
|
859
|
-
const uint8_t
|
863
|
+
static grpc_error* parse_lithdr_incidx(grpc_exec_ctx* exec_ctx,
|
864
|
+
grpc_chttp2_hpack_parser* p,
|
865
|
+
const uint8_t* cur, const uint8_t* end) {
|
860
866
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
861
867
|
parse_value_string_with_indexed_key, finish_lithdr_incidx};
|
862
868
|
p->dynamic_table_update_allowed = 0;
|
@@ -866,10 +872,10 @@ static grpc_error *parse_lithdr_incidx(grpc_exec_ctx *exec_ctx,
|
|
866
872
|
}
|
867
873
|
|
868
874
|
/* parse a literal header with incremental indexing; index >= 63 */
|
869
|
-
static grpc_error
|
870
|
-
grpc_chttp2_hpack_parser
|
871
|
-
const uint8_t
|
872
|
-
const uint8_t
|
875
|
+
static grpc_error* parse_lithdr_incidx_x(grpc_exec_ctx* exec_ctx,
|
876
|
+
grpc_chttp2_hpack_parser* p,
|
877
|
+
const uint8_t* cur,
|
878
|
+
const uint8_t* end) {
|
873
879
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
874
880
|
parse_string_prefix, parse_value_string_with_indexed_key,
|
875
881
|
finish_lithdr_incidx};
|
@@ -881,10 +887,10 @@ static grpc_error *parse_lithdr_incidx_x(grpc_exec_ctx *exec_ctx,
|
|
881
887
|
}
|
882
888
|
|
883
889
|
/* parse a literal header with incremental indexing; index = 0 */
|
884
|
-
static grpc_error
|
885
|
-
grpc_chttp2_hpack_parser
|
886
|
-
const uint8_t
|
887
|
-
const uint8_t
|
890
|
+
static grpc_error* parse_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
|
891
|
+
grpc_chttp2_hpack_parser* p,
|
892
|
+
const uint8_t* cur,
|
893
|
+
const uint8_t* end) {
|
888
894
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
889
895
|
parse_key_string, parse_string_prefix,
|
890
896
|
parse_value_string_with_literal_key, finish_lithdr_incidx_v};
|
@@ -894,14 +900,14 @@ static grpc_error *parse_lithdr_incidx_v(grpc_exec_ctx *exec_ctx,
|
|
894
900
|
}
|
895
901
|
|
896
902
|
/* finish a literal header without incremental indexing */
|
897
|
-
static grpc_error
|
898
|
-
grpc_chttp2_hpack_parser
|
899
|
-
const uint8_t
|
900
|
-
const uint8_t
|
903
|
+
static grpc_error* finish_lithdr_notidx(grpc_exec_ctx* exec_ctx,
|
904
|
+
grpc_chttp2_hpack_parser* p,
|
905
|
+
const uint8_t* cur,
|
906
|
+
const uint8_t* end) {
|
901
907
|
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
902
908
|
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
|
903
909
|
GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX(exec_ctx);
|
904
|
-
grpc_error
|
910
|
+
grpc_error* err = on_hdr(
|
905
911
|
exec_ctx, p,
|
906
912
|
grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
|
907
913
|
take_string(exec_ctx, p, &p->value, false)),
|
@@ -911,12 +917,12 @@ static grpc_error *finish_lithdr_notidx(grpc_exec_ctx *exec_ctx,
|
|
911
917
|
}
|
912
918
|
|
913
919
|
/* finish a literal header without incremental indexing with index = 0 */
|
914
|
-
static grpc_error
|
915
|
-
grpc_chttp2_hpack_parser
|
916
|
-
const uint8_t
|
917
|
-
const uint8_t
|
920
|
+
static grpc_error* finish_lithdr_notidx_v(grpc_exec_ctx* exec_ctx,
|
921
|
+
grpc_chttp2_hpack_parser* p,
|
922
|
+
const uint8_t* cur,
|
923
|
+
const uint8_t* end) {
|
918
924
|
GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX_V(exec_ctx);
|
919
|
-
grpc_error
|
925
|
+
grpc_error* err = on_hdr(
|
920
926
|
exec_ctx, p,
|
921
927
|
grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
|
922
928
|
take_string(exec_ctx, p, &p->value, false)),
|
@@ -926,9 +932,9 @@ static grpc_error *finish_lithdr_notidx_v(grpc_exec_ctx *exec_ctx,
|
|
926
932
|
}
|
927
933
|
|
928
934
|
/* parse a literal header without incremental indexing; index < 15 */
|
929
|
-
static grpc_error
|
930
|
-
grpc_chttp2_hpack_parser
|
931
|
-
const uint8_t
|
935
|
+
static grpc_error* parse_lithdr_notidx(grpc_exec_ctx* exec_ctx,
|
936
|
+
grpc_chttp2_hpack_parser* p,
|
937
|
+
const uint8_t* cur, const uint8_t* end) {
|
932
938
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
933
939
|
parse_value_string_with_indexed_key, finish_lithdr_notidx};
|
934
940
|
p->dynamic_table_update_allowed = 0;
|
@@ -938,10 +944,10 @@ static grpc_error *parse_lithdr_notidx(grpc_exec_ctx *exec_ctx,
|
|
938
944
|
}
|
939
945
|
|
940
946
|
/* parse a literal header without incremental indexing; index >= 15 */
|
941
|
-
static grpc_error
|
942
|
-
grpc_chttp2_hpack_parser
|
943
|
-
const uint8_t
|
944
|
-
const uint8_t
|
947
|
+
static grpc_error* parse_lithdr_notidx_x(grpc_exec_ctx* exec_ctx,
|
948
|
+
grpc_chttp2_hpack_parser* p,
|
949
|
+
const uint8_t* cur,
|
950
|
+
const uint8_t* end) {
|
945
951
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
946
952
|
parse_string_prefix, parse_value_string_with_indexed_key,
|
947
953
|
finish_lithdr_notidx};
|
@@ -953,10 +959,10 @@ static grpc_error *parse_lithdr_notidx_x(grpc_exec_ctx *exec_ctx,
|
|
953
959
|
}
|
954
960
|
|
955
961
|
/* parse a literal header without incremental indexing; index == 0 */
|
956
|
-
static grpc_error
|
957
|
-
grpc_chttp2_hpack_parser
|
958
|
-
const uint8_t
|
959
|
-
const uint8_t
|
962
|
+
static grpc_error* parse_lithdr_notidx_v(grpc_exec_ctx* exec_ctx,
|
963
|
+
grpc_chttp2_hpack_parser* p,
|
964
|
+
const uint8_t* cur,
|
965
|
+
const uint8_t* end) {
|
960
966
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
961
967
|
parse_key_string, parse_string_prefix,
|
962
968
|
parse_value_string_with_literal_key, finish_lithdr_notidx_v};
|
@@ -966,14 +972,14 @@ static grpc_error *parse_lithdr_notidx_v(grpc_exec_ctx *exec_ctx,
|
|
966
972
|
}
|
967
973
|
|
968
974
|
/* finish a literal header that is never indexed */
|
969
|
-
static grpc_error
|
970
|
-
grpc_chttp2_hpack_parser
|
971
|
-
const uint8_t
|
972
|
-
const uint8_t
|
975
|
+
static grpc_error* finish_lithdr_nvridx(grpc_exec_ctx* exec_ctx,
|
976
|
+
grpc_chttp2_hpack_parser* p,
|
977
|
+
const uint8_t* cur,
|
978
|
+
const uint8_t* end) {
|
973
979
|
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
974
980
|
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
|
975
981
|
GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX(exec_ctx);
|
976
|
-
grpc_error
|
982
|
+
grpc_error* err = on_hdr(
|
977
983
|
exec_ctx, p,
|
978
984
|
grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
|
979
985
|
take_string(exec_ctx, p, &p->value, false)),
|
@@ -983,12 +989,12 @@ static grpc_error *finish_lithdr_nvridx(grpc_exec_ctx *exec_ctx,
|
|
983
989
|
}
|
984
990
|
|
985
991
|
/* finish a literal header that is never indexed with an extra value */
|
986
|
-
static grpc_error
|
987
|
-
grpc_chttp2_hpack_parser
|
988
|
-
const uint8_t
|
989
|
-
const uint8_t
|
992
|
+
static grpc_error* finish_lithdr_nvridx_v(grpc_exec_ctx* exec_ctx,
|
993
|
+
grpc_chttp2_hpack_parser* p,
|
994
|
+
const uint8_t* cur,
|
995
|
+
const uint8_t* end) {
|
990
996
|
GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX_V(exec_ctx);
|
991
|
-
grpc_error
|
997
|
+
grpc_error* err = on_hdr(
|
992
998
|
exec_ctx, p,
|
993
999
|
grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
|
994
1000
|
take_string(exec_ctx, p, &p->value, false)),
|
@@ -998,9 +1004,9 @@ static grpc_error *finish_lithdr_nvridx_v(grpc_exec_ctx *exec_ctx,
|
|
998
1004
|
}
|
999
1005
|
|
1000
1006
|
/* parse a literal header that is never indexed; index < 15 */
|
1001
|
-
static grpc_error
|
1002
|
-
grpc_chttp2_hpack_parser
|
1003
|
-
const uint8_t
|
1007
|
+
static grpc_error* parse_lithdr_nvridx(grpc_exec_ctx* exec_ctx,
|
1008
|
+
grpc_chttp2_hpack_parser* p,
|
1009
|
+
const uint8_t* cur, const uint8_t* end) {
|
1004
1010
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
1005
1011
|
parse_value_string_with_indexed_key, finish_lithdr_nvridx};
|
1006
1012
|
p->dynamic_table_update_allowed = 0;
|
@@ -1010,10 +1016,10 @@ static grpc_error *parse_lithdr_nvridx(grpc_exec_ctx *exec_ctx,
|
|
1010
1016
|
}
|
1011
1017
|
|
1012
1018
|
/* parse a literal header that is never indexed; index >= 15 */
|
1013
|
-
static grpc_error
|
1014
|
-
grpc_chttp2_hpack_parser
|
1015
|
-
const uint8_t
|
1016
|
-
const uint8_t
|
1019
|
+
static grpc_error* parse_lithdr_nvridx_x(grpc_exec_ctx* exec_ctx,
|
1020
|
+
grpc_chttp2_hpack_parser* p,
|
1021
|
+
const uint8_t* cur,
|
1022
|
+
const uint8_t* end) {
|
1017
1023
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
1018
1024
|
parse_string_prefix, parse_value_string_with_indexed_key,
|
1019
1025
|
finish_lithdr_nvridx};
|
@@ -1025,10 +1031,10 @@ static grpc_error *parse_lithdr_nvridx_x(grpc_exec_ctx *exec_ctx,
|
|
1025
1031
|
}
|
1026
1032
|
|
1027
1033
|
/* parse a literal header that is never indexed; index == 0 */
|
1028
|
-
static grpc_error
|
1029
|
-
grpc_chttp2_hpack_parser
|
1030
|
-
const uint8_t
|
1031
|
-
const uint8_t
|
1034
|
+
static grpc_error* parse_lithdr_nvridx_v(grpc_exec_ctx* exec_ctx,
|
1035
|
+
grpc_chttp2_hpack_parser* p,
|
1036
|
+
const uint8_t* cur,
|
1037
|
+
const uint8_t* end) {
|
1032
1038
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
1033
1039
|
parse_key_string, parse_string_prefix,
|
1034
1040
|
parse_value_string_with_literal_key, finish_lithdr_nvridx_v};
|
@@ -1038,22 +1044,22 @@ static grpc_error *parse_lithdr_nvridx_v(grpc_exec_ctx *exec_ctx,
|
|
1038
1044
|
}
|
1039
1045
|
|
1040
1046
|
/* finish parsing a max table size change */
|
1041
|
-
static grpc_error
|
1042
|
-
grpc_chttp2_hpack_parser
|
1043
|
-
const uint8_t
|
1044
|
-
if (
|
1047
|
+
static grpc_error* finish_max_tbl_size(grpc_exec_ctx* exec_ctx,
|
1048
|
+
grpc_chttp2_hpack_parser* p,
|
1049
|
+
const uint8_t* cur, const uint8_t* end) {
|
1050
|
+
if (grpc_http_trace.enabled()) {
|
1045
1051
|
gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
|
1046
1052
|
}
|
1047
|
-
grpc_error
|
1053
|
+
grpc_error* err =
|
1048
1054
|
grpc_chttp2_hptbl_set_current_table_size(exec_ctx, &p->table, p->index);
|
1049
1055
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
1050
1056
|
return parse_begin(exec_ctx, p, cur, end);
|
1051
1057
|
}
|
1052
1058
|
|
1053
1059
|
/* parse a max table size change, max size < 15 */
|
1054
|
-
static grpc_error
|
1055
|
-
grpc_chttp2_hpack_parser
|
1056
|
-
const uint8_t
|
1060
|
+
static grpc_error* parse_max_tbl_size(grpc_exec_ctx* exec_ctx,
|
1061
|
+
grpc_chttp2_hpack_parser* p,
|
1062
|
+
const uint8_t* cur, const uint8_t* end) {
|
1057
1063
|
if (p->dynamic_table_update_allowed == 0) {
|
1058
1064
|
return parse_error(
|
1059
1065
|
exec_ctx, p, cur, end,
|
@@ -1066,10 +1072,10 @@ static grpc_error *parse_max_tbl_size(grpc_exec_ctx *exec_ctx,
|
|
1066
1072
|
}
|
1067
1073
|
|
1068
1074
|
/* parse a max table size change, max size >= 15 */
|
1069
|
-
static grpc_error
|
1070
|
-
grpc_chttp2_hpack_parser
|
1071
|
-
const uint8_t
|
1072
|
-
const uint8_t
|
1075
|
+
static grpc_error* parse_max_tbl_size_x(grpc_exec_ctx* exec_ctx,
|
1076
|
+
grpc_chttp2_hpack_parser* p,
|
1077
|
+
const uint8_t* cur,
|
1078
|
+
const uint8_t* end) {
|
1073
1079
|
static const grpc_chttp2_hpack_parser_state and_then[] = {
|
1074
1080
|
finish_max_tbl_size};
|
1075
1081
|
if (p->dynamic_table_update_allowed == 0) {
|
@@ -1086,9 +1092,9 @@ static grpc_error *parse_max_tbl_size_x(grpc_exec_ctx *exec_ctx,
|
|
1086
1092
|
}
|
1087
1093
|
|
1088
1094
|
/* a parse error: jam the parse state into parse_error, and return error */
|
1089
|
-
static grpc_error
|
1090
|
-
grpc_chttp2_hpack_parser
|
1091
|
-
const uint8_t
|
1095
|
+
static grpc_error* parse_error(grpc_exec_ctx* exec_ctx,
|
1096
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1097
|
+
const uint8_t* end, grpc_error* err) {
|
1092
1098
|
GPR_ASSERT(err != GRPC_ERROR_NONE);
|
1093
1099
|
if (p->last_error == GRPC_ERROR_NONE) {
|
1094
1100
|
p->last_error = GRPC_ERROR_REF(err);
|
@@ -1097,28 +1103,28 @@ static grpc_error *parse_error(grpc_exec_ctx *exec_ctx,
|
|
1097
1103
|
return err;
|
1098
1104
|
}
|
1099
1105
|
|
1100
|
-
static grpc_error
|
1101
|
-
grpc_chttp2_hpack_parser
|
1102
|
-
const uint8_t
|
1106
|
+
static grpc_error* still_parse_error(grpc_exec_ctx* exec_ctx,
|
1107
|
+
grpc_chttp2_hpack_parser* p,
|
1108
|
+
const uint8_t* cur, const uint8_t* end) {
|
1103
1109
|
return GRPC_ERROR_REF(p->last_error);
|
1104
1110
|
}
|
1105
1111
|
|
1106
|
-
static grpc_error
|
1107
|
-
grpc_chttp2_hpack_parser
|
1108
|
-
const uint8_t
|
1112
|
+
static grpc_error* parse_illegal_op(grpc_exec_ctx* exec_ctx,
|
1113
|
+
grpc_chttp2_hpack_parser* p,
|
1114
|
+
const uint8_t* cur, const uint8_t* end) {
|
1109
1115
|
GPR_ASSERT(cur != end);
|
1110
|
-
char
|
1116
|
+
char* msg;
|
1111
1117
|
gpr_asprintf(&msg, "Illegal hpack op code %d", *cur);
|
1112
|
-
grpc_error
|
1118
|
+
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
1113
1119
|
gpr_free(msg);
|
1114
1120
|
return parse_error(exec_ctx, p, cur, end, err);
|
1115
1121
|
}
|
1116
1122
|
|
1117
1123
|
/* parse the 1st byte of a varint into p->parsing.value
|
1118
1124
|
no overflow is possible */
|
1119
|
-
static grpc_error
|
1120
|
-
grpc_chttp2_hpack_parser
|
1121
|
-
const uint8_t
|
1125
|
+
static grpc_error* parse_value0(grpc_exec_ctx* exec_ctx,
|
1126
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1127
|
+
const uint8_t* end) {
|
1122
1128
|
if (cur == end) {
|
1123
1129
|
p->state = parse_value0;
|
1124
1130
|
return GRPC_ERROR_NONE;
|
@@ -1135,9 +1141,9 @@ static grpc_error *parse_value0(grpc_exec_ctx *exec_ctx,
|
|
1135
1141
|
|
1136
1142
|
/* parse the 2nd byte of a varint into p->parsing.value
|
1137
1143
|
no overflow is possible */
|
1138
|
-
static grpc_error
|
1139
|
-
grpc_chttp2_hpack_parser
|
1140
|
-
const uint8_t
|
1144
|
+
static grpc_error* parse_value1(grpc_exec_ctx* exec_ctx,
|
1145
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1146
|
+
const uint8_t* end) {
|
1141
1147
|
if (cur == end) {
|
1142
1148
|
p->state = parse_value1;
|
1143
1149
|
return GRPC_ERROR_NONE;
|
@@ -1154,9 +1160,9 @@ static grpc_error *parse_value1(grpc_exec_ctx *exec_ctx,
|
|
1154
1160
|
|
1155
1161
|
/* parse the 3rd byte of a varint into p->parsing.value
|
1156
1162
|
no overflow is possible */
|
1157
|
-
static grpc_error
|
1158
|
-
grpc_chttp2_hpack_parser
|
1159
|
-
const uint8_t
|
1163
|
+
static grpc_error* parse_value2(grpc_exec_ctx* exec_ctx,
|
1164
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1165
|
+
const uint8_t* end) {
|
1160
1166
|
if (cur == end) {
|
1161
1167
|
p->state = parse_value2;
|
1162
1168
|
return GRPC_ERROR_NONE;
|
@@ -1173,9 +1179,9 @@ static grpc_error *parse_value2(grpc_exec_ctx *exec_ctx,
|
|
1173
1179
|
|
1174
1180
|
/* parse the 4th byte of a varint into p->parsing.value
|
1175
1181
|
no overflow is possible */
|
1176
|
-
static grpc_error
|
1177
|
-
grpc_chttp2_hpack_parser
|
1178
|
-
const uint8_t
|
1182
|
+
static grpc_error* parse_value3(grpc_exec_ctx* exec_ctx,
|
1183
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1184
|
+
const uint8_t* end) {
|
1179
1185
|
if (cur == end) {
|
1180
1186
|
p->state = parse_value3;
|
1181
1187
|
return GRPC_ERROR_NONE;
|
@@ -1192,13 +1198,13 @@ static grpc_error *parse_value3(grpc_exec_ctx *exec_ctx,
|
|
1192
1198
|
|
1193
1199
|
/* parse the 5th byte of a varint into p->parsing.value
|
1194
1200
|
depending on the byte, we may overflow, and care must be taken */
|
1195
|
-
static grpc_error
|
1196
|
-
grpc_chttp2_hpack_parser
|
1197
|
-
const uint8_t
|
1201
|
+
static grpc_error* parse_value4(grpc_exec_ctx* exec_ctx,
|
1202
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1203
|
+
const uint8_t* end) {
|
1198
1204
|
uint8_t c;
|
1199
1205
|
uint32_t cur_value;
|
1200
1206
|
uint32_t add_value;
|
1201
|
-
char
|
1207
|
+
char* msg;
|
1202
1208
|
|
1203
1209
|
if (cur == end) {
|
1204
1210
|
p->state = parse_value4;
|
@@ -1229,7 +1235,7 @@ error:
|
|
1229
1235
|
"integer overflow in hpack integer decoding: have 0x%08x, "
|
1230
1236
|
"got byte 0x%02x on byte 5",
|
1231
1237
|
*p->parsing.value, *cur);
|
1232
|
-
grpc_error
|
1238
|
+
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
1233
1239
|
gpr_free(msg);
|
1234
1240
|
return parse_error(exec_ctx, p, cur, end, err);
|
1235
1241
|
}
|
@@ -1237,9 +1243,9 @@ error:
|
|
1237
1243
|
/* parse any trailing bytes in a varint: it's possible to append an arbitrary
|
1238
1244
|
number of 0x80's and not affect the value - a zero will terminate - and
|
1239
1245
|
anything else will overflow */
|
1240
|
-
static grpc_error
|
1241
|
-
grpc_chttp2_hpack_parser
|
1242
|
-
const uint8_t
|
1246
|
+
static grpc_error* parse_value5up(grpc_exec_ctx* exec_ctx,
|
1247
|
+
grpc_chttp2_hpack_parser* p,
|
1248
|
+
const uint8_t* cur, const uint8_t* end) {
|
1243
1249
|
while (cur != end && *cur == 0x80) {
|
1244
1250
|
++cur;
|
1245
1251
|
}
|
@@ -1253,20 +1259,20 @@ static grpc_error *parse_value5up(grpc_exec_ctx *exec_ctx,
|
|
1253
1259
|
return parse_next(exec_ctx, p, cur + 1, end);
|
1254
1260
|
}
|
1255
1261
|
|
1256
|
-
char
|
1262
|
+
char* msg;
|
1257
1263
|
gpr_asprintf(&msg,
|
1258
1264
|
"integer overflow in hpack integer decoding: have 0x%08x, "
|
1259
1265
|
"got byte 0x%02x sometime after byte 5",
|
1260
1266
|
*p->parsing.value, *cur);
|
1261
|
-
grpc_error
|
1267
|
+
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
1262
1268
|
gpr_free(msg);
|
1263
1269
|
return parse_error(exec_ctx, p, cur, end, err);
|
1264
1270
|
}
|
1265
1271
|
|
1266
1272
|
/* parse a string prefix */
|
1267
|
-
static grpc_error
|
1268
|
-
grpc_chttp2_hpack_parser
|
1269
|
-
const uint8_t
|
1273
|
+
static grpc_error* parse_string_prefix(grpc_exec_ctx* exec_ctx,
|
1274
|
+
grpc_chttp2_hpack_parser* p,
|
1275
|
+
const uint8_t* cur, const uint8_t* end) {
|
1270
1276
|
if (cur == end) {
|
1271
1277
|
p->state = parse_string_prefix;
|
1272
1278
|
return GRPC_ERROR_NONE;
|
@@ -1283,24 +1289,24 @@ static grpc_error *parse_string_prefix(grpc_exec_ctx *exec_ctx,
|
|
1283
1289
|
}
|
1284
1290
|
|
1285
1291
|
/* append some bytes to a string */
|
1286
|
-
static void append_bytes(grpc_chttp2_hpack_parser_string
|
1287
|
-
const uint8_t
|
1292
|
+
static void append_bytes(grpc_chttp2_hpack_parser_string* str,
|
1293
|
+
const uint8_t* data, size_t length) {
|
1288
1294
|
if (length == 0) return;
|
1289
1295
|
if (length + str->data.copied.length > str->data.copied.capacity) {
|
1290
1296
|
GPR_ASSERT(str->data.copied.length + length <= UINT32_MAX);
|
1291
1297
|
str->data.copied.capacity = (uint32_t)(str->data.copied.length + length);
|
1292
1298
|
str->data.copied.str =
|
1293
|
-
(char
|
1299
|
+
(char*)gpr_realloc(str->data.copied.str, str->data.copied.capacity);
|
1294
1300
|
}
|
1295
1301
|
memcpy(str->data.copied.str + str->data.copied.length, data, length);
|
1296
1302
|
GPR_ASSERT(length <= UINT32_MAX - str->data.copied.length);
|
1297
1303
|
str->data.copied.length += (uint32_t)length;
|
1298
1304
|
}
|
1299
1305
|
|
1300
|
-
static grpc_error
|
1301
|
-
grpc_chttp2_hpack_parser
|
1302
|
-
const uint8_t
|
1303
|
-
grpc_chttp2_hpack_parser_string
|
1306
|
+
static grpc_error* append_string(grpc_exec_ctx* exec_ctx,
|
1307
|
+
grpc_chttp2_hpack_parser* p,
|
1308
|
+
const uint8_t* cur, const uint8_t* end) {
|
1309
|
+
grpc_chttp2_hpack_parser_string* str = p->parsing.str;
|
1304
1310
|
uint32_t bits;
|
1305
1311
|
uint8_t decoded[3];
|
1306
1312
|
switch ((binary_state)p->binary) {
|
@@ -1397,12 +1403,12 @@ static grpc_error *append_string(grpc_exec_ctx *exec_ctx,
|
|
1397
1403
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here")));
|
1398
1404
|
}
|
1399
1405
|
|
1400
|
-
static grpc_error
|
1401
|
-
grpc_chttp2_hpack_parser
|
1402
|
-
const uint8_t
|
1406
|
+
static grpc_error* finish_str(grpc_exec_ctx* exec_ctx,
|
1407
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1408
|
+
const uint8_t* end) {
|
1403
1409
|
uint8_t decoded[2];
|
1404
1410
|
uint32_t bits;
|
1405
|
-
grpc_chttp2_hpack_parser_string
|
1411
|
+
grpc_chttp2_hpack_parser_string* str = p->parsing.str;
|
1406
1412
|
switch ((binary_state)p->binary) {
|
1407
1413
|
case NOT_BINARY:
|
1408
1414
|
break;
|
@@ -1417,10 +1423,10 @@ static grpc_error *finish_str(grpc_exec_ctx *exec_ctx,
|
|
1417
1423
|
case B64_BYTE2:
|
1418
1424
|
bits = p->base64_buffer;
|
1419
1425
|
if (bits & 0xffff) {
|
1420
|
-
char
|
1426
|
+
char* msg;
|
1421
1427
|
gpr_asprintf(&msg, "trailing bits in base64 encoding: 0x%04x",
|
1422
1428
|
bits & 0xffff);
|
1423
|
-
grpc_error
|
1429
|
+
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
1424
1430
|
gpr_free(msg);
|
1425
1431
|
return parse_error(exec_ctx, p, cur, end, err);
|
1426
1432
|
}
|
@@ -1430,10 +1436,10 @@ static grpc_error *finish_str(grpc_exec_ctx *exec_ctx,
|
|
1430
1436
|
case B64_BYTE3:
|
1431
1437
|
bits = p->base64_buffer;
|
1432
1438
|
if (bits & 0xff) {
|
1433
|
-
char
|
1439
|
+
char* msg;
|
1434
1440
|
gpr_asprintf(&msg, "trailing bits in base64 encoding: 0x%02x",
|
1435
1441
|
bits & 0xff);
|
1436
|
-
grpc_error
|
1442
|
+
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
1437
1443
|
gpr_free(msg);
|
1438
1444
|
return parse_error(exec_ctx, p, cur, end, err);
|
1439
1445
|
}
|
@@ -1446,14 +1452,14 @@ static grpc_error *finish_str(grpc_exec_ctx *exec_ctx,
|
|
1446
1452
|
}
|
1447
1453
|
|
1448
1454
|
/* decode a nibble from a huffman encoded stream */
|
1449
|
-
static grpc_error
|
1450
|
-
grpc_chttp2_hpack_parser
|
1455
|
+
static grpc_error* huff_nibble(grpc_exec_ctx* exec_ctx,
|
1456
|
+
grpc_chttp2_hpack_parser* p, uint8_t nibble) {
|
1451
1457
|
int16_t emit = emit_sub_tbl[16 * emit_tbl[p->huff_state] + nibble];
|
1452
1458
|
int16_t next = next_sub_tbl[16 * next_tbl[p->huff_state] + nibble];
|
1453
1459
|
if (emit != -1) {
|
1454
1460
|
if (emit >= 0 && emit < 256) {
|
1455
1461
|
uint8_t c = (uint8_t)emit;
|
1456
|
-
grpc_error
|
1462
|
+
grpc_error* err = append_string(exec_ctx, p, &c, (&c) + 1);
|
1457
1463
|
if (err != GRPC_ERROR_NONE) return err;
|
1458
1464
|
} else {
|
1459
1465
|
assert(emit == 256);
|
@@ -1464,11 +1470,11 @@ static grpc_error *huff_nibble(grpc_exec_ctx *exec_ctx,
|
|
1464
1470
|
}
|
1465
1471
|
|
1466
1472
|
/* decode full bytes from a huffman encoded stream */
|
1467
|
-
static grpc_error
|
1468
|
-
grpc_chttp2_hpack_parser
|
1469
|
-
const uint8_t
|
1473
|
+
static grpc_error* add_huff_bytes(grpc_exec_ctx* exec_ctx,
|
1474
|
+
grpc_chttp2_hpack_parser* p,
|
1475
|
+
const uint8_t* cur, const uint8_t* end) {
|
1470
1476
|
for (; cur != end; ++cur) {
|
1471
|
-
grpc_error
|
1477
|
+
grpc_error* err = huff_nibble(exec_ctx, p, *cur >> 4);
|
1472
1478
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
1473
1479
|
err = huff_nibble(exec_ctx, p, *cur & 0xf);
|
1474
1480
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
@@ -1478,9 +1484,9 @@ static grpc_error *add_huff_bytes(grpc_exec_ctx *exec_ctx,
|
|
1478
1484
|
|
1479
1485
|
/* decode some string bytes based on the current decoding mode
|
1480
1486
|
(huffman or not) */
|
1481
|
-
static grpc_error
|
1482
|
-
grpc_chttp2_hpack_parser
|
1483
|
-
const uint8_t
|
1487
|
+
static grpc_error* add_str_bytes(grpc_exec_ctx* exec_ctx,
|
1488
|
+
grpc_chttp2_hpack_parser* p,
|
1489
|
+
const uint8_t* cur, const uint8_t* end) {
|
1484
1490
|
if (p->huff) {
|
1485
1491
|
return add_huff_bytes(exec_ctx, p, cur, end);
|
1486
1492
|
} else {
|
@@ -1489,19 +1495,19 @@ static grpc_error *add_str_bytes(grpc_exec_ctx *exec_ctx,
|
|
1489
1495
|
}
|
1490
1496
|
|
1491
1497
|
/* parse a string - tries to do large chunks at a time */
|
1492
|
-
static grpc_error
|
1493
|
-
grpc_chttp2_hpack_parser
|
1494
|
-
const uint8_t
|
1498
|
+
static grpc_error* parse_string(grpc_exec_ctx* exec_ctx,
|
1499
|
+
grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1500
|
+
const uint8_t* end) {
|
1495
1501
|
size_t remaining = p->strlen - p->strgot;
|
1496
1502
|
size_t given = (size_t)(end - cur);
|
1497
1503
|
if (remaining <= given) {
|
1498
|
-
grpc_error
|
1504
|
+
grpc_error* err = add_str_bytes(exec_ctx, p, cur, cur + remaining);
|
1499
1505
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
1500
1506
|
err = finish_str(exec_ctx, p, cur + remaining, end);
|
1501
1507
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
1502
1508
|
return parse_next(exec_ctx, p, cur + remaining, end);
|
1503
1509
|
} else {
|
1504
|
-
grpc_error
|
1510
|
+
grpc_error* err = add_str_bytes(exec_ctx, p, cur, cur + given);
|
1505
1511
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
1506
1512
|
GPR_ASSERT(given <= UINT32_MAX - p->strgot);
|
1507
1513
|
p->strgot += (uint32_t)given;
|
@@ -1511,17 +1517,17 @@ static grpc_error *parse_string(grpc_exec_ctx *exec_ctx,
|
|
1511
1517
|
}
|
1512
1518
|
|
1513
1519
|
/* begin parsing a string - performs setup, calls parse_string */
|
1514
|
-
static grpc_error
|
1515
|
-
grpc_chttp2_hpack_parser
|
1516
|
-
const uint8_t
|
1520
|
+
static grpc_error* begin_parse_string(grpc_exec_ctx* exec_ctx,
|
1521
|
+
grpc_chttp2_hpack_parser* p,
|
1522
|
+
const uint8_t* cur, const uint8_t* end,
|
1517
1523
|
uint8_t binary,
|
1518
|
-
grpc_chttp2_hpack_parser_string
|
1524
|
+
grpc_chttp2_hpack_parser_string* str) {
|
1519
1525
|
if (!p->huff && binary == NOT_BINARY && (end - cur) >= (intptr_t)p->strlen &&
|
1520
|
-
p->current_slice_refcount !=
|
1526
|
+
p->current_slice_refcount != nullptr) {
|
1521
1527
|
GRPC_STATS_INC_HPACK_RECV_UNCOMPRESSED(exec_ctx);
|
1522
1528
|
str->copied = false;
|
1523
1529
|
str->data.referenced.refcount = p->current_slice_refcount;
|
1524
|
-
str->data.referenced.data.refcounted.bytes = (uint8_t
|
1530
|
+
str->data.referenced.data.refcounted.bytes = (uint8_t*)cur;
|
1525
1531
|
str->data.referenced.data.refcounted.length = p->strlen;
|
1526
1532
|
grpc_slice_ref_internal(str->data.referenced);
|
1527
1533
|
return parse_next(exec_ctx, p, cur + p->strlen, end);
|
@@ -1550,23 +1556,23 @@ static grpc_error *begin_parse_string(grpc_exec_ctx *exec_ctx,
|
|
1550
1556
|
}
|
1551
1557
|
|
1552
1558
|
/* parse the key string */
|
1553
|
-
static grpc_error
|
1554
|
-
grpc_chttp2_hpack_parser
|
1555
|
-
const uint8_t
|
1559
|
+
static grpc_error* parse_key_string(grpc_exec_ctx* exec_ctx,
|
1560
|
+
grpc_chttp2_hpack_parser* p,
|
1561
|
+
const uint8_t* cur, const uint8_t* end) {
|
1556
1562
|
return begin_parse_string(exec_ctx, p, cur, end, NOT_BINARY, &p->key);
|
1557
1563
|
}
|
1558
1564
|
|
1559
1565
|
/* check if a key represents a binary header or not */
|
1560
1566
|
|
1561
|
-
static bool is_binary_literal_header(grpc_chttp2_hpack_parser
|
1567
|
+
static bool is_binary_literal_header(grpc_chttp2_hpack_parser* p) {
|
1562
1568
|
return grpc_is_binary_header(
|
1563
1569
|
p->key.copied ? grpc_slice_from_static_buffer(p->key.data.copied.str,
|
1564
1570
|
p->key.data.copied.length)
|
1565
1571
|
: p->key.data.referenced);
|
1566
1572
|
}
|
1567
1573
|
|
1568
|
-
static grpc_error
|
1569
|
-
bool
|
1574
|
+
static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
|
1575
|
+
bool* is) {
|
1570
1576
|
grpc_mdelem elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
|
1571
1577
|
if (GRPC_MDISNULL(elem)) {
|
1572
1578
|
return grpc_error_set_int(
|
@@ -1580,42 +1586,42 @@ static grpc_error *is_binary_indexed_header(grpc_chttp2_hpack_parser *p,
|
|
1580
1586
|
}
|
1581
1587
|
|
1582
1588
|
/* parse the value string */
|
1583
|
-
static grpc_error
|
1584
|
-
grpc_chttp2_hpack_parser
|
1585
|
-
const uint8_t
|
1589
|
+
static grpc_error* parse_value_string(grpc_exec_ctx* exec_ctx,
|
1590
|
+
grpc_chttp2_hpack_parser* p,
|
1591
|
+
const uint8_t* cur, const uint8_t* end,
|
1586
1592
|
bool is_binary) {
|
1587
1593
|
return begin_parse_string(exec_ctx, p, cur, end,
|
1588
1594
|
is_binary ? BINARY_BEGIN : NOT_BINARY, &p->value);
|
1589
1595
|
}
|
1590
1596
|
|
1591
|
-
static grpc_error
|
1592
|
-
grpc_exec_ctx
|
1593
|
-
const uint8_t
|
1597
|
+
static grpc_error* parse_value_string_with_indexed_key(
|
1598
|
+
grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1599
|
+
const uint8_t* end) {
|
1594
1600
|
bool is_binary = false;
|
1595
|
-
grpc_error
|
1601
|
+
grpc_error* err = is_binary_indexed_header(p, &is_binary);
|
1596
1602
|
if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
|
1597
1603
|
return parse_value_string(exec_ctx, p, cur, end, is_binary);
|
1598
1604
|
}
|
1599
1605
|
|
1600
|
-
static grpc_error
|
1601
|
-
grpc_exec_ctx
|
1602
|
-
const uint8_t
|
1606
|
+
static grpc_error* parse_value_string_with_literal_key(
|
1607
|
+
grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* cur,
|
1608
|
+
const uint8_t* end) {
|
1603
1609
|
return parse_value_string(exec_ctx, p, cur, end, is_binary_literal_header(p));
|
1604
1610
|
}
|
1605
1611
|
|
1606
1612
|
/* PUBLIC INTERFACE */
|
1607
1613
|
|
1608
|
-
void grpc_chttp2_hpack_parser_init(grpc_exec_ctx
|
1609
|
-
grpc_chttp2_hpack_parser
|
1610
|
-
p->on_header =
|
1611
|
-
p->on_header_user_data =
|
1614
|
+
void grpc_chttp2_hpack_parser_init(grpc_exec_ctx* exec_ctx,
|
1615
|
+
grpc_chttp2_hpack_parser* p) {
|
1616
|
+
p->on_header = nullptr;
|
1617
|
+
p->on_header_user_data = nullptr;
|
1612
1618
|
p->state = parse_begin;
|
1613
1619
|
p->key.data.referenced = grpc_empty_slice();
|
1614
|
-
p->key.data.copied.str =
|
1620
|
+
p->key.data.copied.str = nullptr;
|
1615
1621
|
p->key.data.copied.capacity = 0;
|
1616
1622
|
p->key.data.copied.length = 0;
|
1617
1623
|
p->value.data.referenced = grpc_empty_slice();
|
1618
|
-
p->value.data.copied.str =
|
1624
|
+
p->value.data.copied.str = nullptr;
|
1619
1625
|
p->value.data.copied.capacity = 0;
|
1620
1626
|
p->value.data.copied.length = 0;
|
1621
1627
|
p->dynamic_table_update_allowed = 2;
|
@@ -1623,13 +1629,13 @@ void grpc_chttp2_hpack_parser_init(grpc_exec_ctx *exec_ctx,
|
|
1623
1629
|
grpc_chttp2_hptbl_init(exec_ctx, &p->table);
|
1624
1630
|
}
|
1625
1631
|
|
1626
|
-
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser
|
1632
|
+
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser* p) {
|
1627
1633
|
p->after_prioritization = p->state;
|
1628
1634
|
p->state = parse_stream_dep0;
|
1629
1635
|
}
|
1630
1636
|
|
1631
|
-
void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx
|
1632
|
-
grpc_chttp2_hpack_parser
|
1637
|
+
void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx* exec_ctx,
|
1638
|
+
grpc_chttp2_hpack_parser* p) {
|
1633
1639
|
grpc_chttp2_hptbl_destroy(exec_ctx, &p->table);
|
1634
1640
|
GRPC_ERROR_UNREF(p->last_error);
|
1635
1641
|
grpc_slice_unref_internal(exec_ctx, p->key.data.referenced);
|
@@ -1638,36 +1644,36 @@ void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx *exec_ctx,
|
|
1638
1644
|
gpr_free(p->value.data.copied.str);
|
1639
1645
|
}
|
1640
1646
|
|
1641
|
-
grpc_error
|
1642
|
-
grpc_chttp2_hpack_parser
|
1647
|
+
grpc_error* grpc_chttp2_hpack_parser_parse(grpc_exec_ctx* exec_ctx,
|
1648
|
+
grpc_chttp2_hpack_parser* p,
|
1643
1649
|
grpc_slice slice) {
|
1644
1650
|
/* max number of bytes to parse at a time... limits call stack depth on
|
1645
1651
|
* compilers without TCO */
|
1646
1652
|
#define MAX_PARSE_LENGTH 1024
|
1647
1653
|
p->current_slice_refcount = slice.refcount;
|
1648
|
-
uint8_t
|
1649
|
-
uint8_t
|
1650
|
-
grpc_error
|
1654
|
+
uint8_t* start = GRPC_SLICE_START_PTR(slice);
|
1655
|
+
uint8_t* end = GRPC_SLICE_END_PTR(slice);
|
1656
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
1651
1657
|
while (start != end && error == GRPC_ERROR_NONE) {
|
1652
|
-
uint8_t
|
1658
|
+
uint8_t* target = start + GPR_MIN(MAX_PARSE_LENGTH, end - start);
|
1653
1659
|
error = p->state(exec_ctx, p, start, target);
|
1654
1660
|
start = target;
|
1655
1661
|
}
|
1656
|
-
p->current_slice_refcount =
|
1662
|
+
p->current_slice_refcount = nullptr;
|
1657
1663
|
return error;
|
1658
1664
|
}
|
1659
1665
|
|
1660
|
-
typedef void (*maybe_complete_func_type)(grpc_exec_ctx
|
1661
|
-
grpc_chttp2_transport
|
1662
|
-
grpc_chttp2_stream
|
1666
|
+
typedef void (*maybe_complete_func_type)(grpc_exec_ctx* exec_ctx,
|
1667
|
+
grpc_chttp2_transport* t,
|
1668
|
+
grpc_chttp2_stream* s);
|
1663
1669
|
static const maybe_complete_func_type maybe_complete_funcs[] = {
|
1664
1670
|
grpc_chttp2_maybe_complete_recv_initial_metadata,
|
1665
1671
|
grpc_chttp2_maybe_complete_recv_trailing_metadata};
|
1666
1672
|
|
1667
|
-
static void force_client_rst_stream(grpc_exec_ctx
|
1668
|
-
grpc_error
|
1669
|
-
grpc_chttp2_stream
|
1670
|
-
grpc_chttp2_transport
|
1673
|
+
static void force_client_rst_stream(grpc_exec_ctx* exec_ctx, void* sp,
|
1674
|
+
grpc_error* error) {
|
1675
|
+
grpc_chttp2_stream* s = (grpc_chttp2_stream*)sp;
|
1676
|
+
grpc_chttp2_transport* t = s->t;
|
1671
1677
|
if (!s->write_closed) {
|
1672
1678
|
grpc_slice_buffer_add(
|
1673
1679
|
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR,
|
@@ -1679,11 +1685,11 @@ static void force_client_rst_stream(grpc_exec_ctx *exec_ctx, void *sp,
|
|
1679
1685
|
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "final_rst");
|
1680
1686
|
}
|
1681
1687
|
|
1682
|
-
static void parse_stream_compression_md(grpc_exec_ctx
|
1683
|
-
grpc_chttp2_transport
|
1684
|
-
grpc_chttp2_stream
|
1685
|
-
grpc_metadata_batch
|
1686
|
-
if (initial_metadata->idx.named.content_encoding ==
|
1688
|
+
static void parse_stream_compression_md(grpc_exec_ctx* exec_ctx,
|
1689
|
+
grpc_chttp2_transport* t,
|
1690
|
+
grpc_chttp2_stream* s,
|
1691
|
+
grpc_metadata_batch* initial_metadata) {
|
1692
|
+
if (initial_metadata->idx.named.content_encoding == nullptr ||
|
1687
1693
|
grpc_stream_compression_method_parse(
|
1688
1694
|
GRPC_MDVALUE(initial_metadata->idx.named.content_encoding->md), false,
|
1689
1695
|
&s->stream_decompression_method) == 0) {
|
@@ -1692,17 +1698,17 @@ static void parse_stream_compression_md(grpc_exec_ctx *exec_ctx,
|
|
1692
1698
|
}
|
1693
1699
|
}
|
1694
1700
|
|
1695
|
-
grpc_error
|
1696
|
-
void
|
1697
|
-
grpc_chttp2_transport
|
1698
|
-
grpc_chttp2_stream
|
1701
|
+
grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
|
1702
|
+
void* hpack_parser,
|
1703
|
+
grpc_chttp2_transport* t,
|
1704
|
+
grpc_chttp2_stream* s,
|
1699
1705
|
grpc_slice slice, int is_last) {
|
1700
|
-
grpc_chttp2_hpack_parser
|
1706
|
+
grpc_chttp2_hpack_parser* parser = (grpc_chttp2_hpack_parser*)hpack_parser;
|
1701
1707
|
GPR_TIMER_BEGIN("grpc_chttp2_hpack_parser_parse", 0);
|
1702
|
-
if (s !=
|
1708
|
+
if (s != nullptr) {
|
1703
1709
|
s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
|
1704
1710
|
}
|
1705
|
-
grpc_error
|
1711
|
+
grpc_error* error = grpc_chttp2_hpack_parser_parse(exec_ctx, parser, slice);
|
1706
1712
|
if (error != GRPC_ERROR_NONE) {
|
1707
1713
|
GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
|
1708
1714
|
return error;
|
@@ -1715,7 +1721,7 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
|
|
1715
1721
|
}
|
1716
1722
|
/* need to check for null stream: this can occur if we receive an invalid
|
1717
1723
|
stream id on a header */
|
1718
|
-
if (s !=
|
1724
|
+
if (s != nullptr) {
|
1719
1725
|
if (parser->is_boundary) {
|
1720
1726
|
if (s->header_frames_received == GPR_ARRAY_SIZE(s->metadata_buffer)) {
|
1721
1727
|
GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
|
@@ -1750,8 +1756,8 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
|
|
1750
1756
|
GRPC_ERROR_NONE);
|
1751
1757
|
}
|
1752
1758
|
}
|
1753
|
-
parser->on_header =
|
1754
|
-
parser->on_header_user_data =
|
1759
|
+
parser->on_header = nullptr;
|
1760
|
+
parser->on_header_user_data = nullptr;
|
1755
1761
|
parser->is_boundary = 0xde;
|
1756
1762
|
parser->is_eof = 0xde;
|
1757
1763
|
parser->dynamic_table_update_allowed = 2;
|