grpc 1.60.0 → 1.61.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +208 -165
  3. data/include/grpc/event_engine/event_engine.h +59 -12
  4. data/include/grpc/event_engine/internal/memory_allocator_impl.h +6 -0
  5. data/include/grpc/event_engine/internal/slice_cast.h +12 -0
  6. data/include/grpc/event_engine/memory_allocator.h +3 -1
  7. data/include/grpc/event_engine/slice.h +5 -0
  8. data/include/grpc/grpc_security.h +22 -1
  9. data/include/grpc/impl/call.h +29 -0
  10. data/include/grpc/impl/channel_arg_names.h +12 -1
  11. data/include/grpc/impl/slice_type.h +1 -1
  12. data/include/grpc/module.modulemap +1 -0
  13. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +54 -7
  14. data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +20 -6
  15. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +10 -13
  16. data/src/core/ext/filters/channel_idle/channel_idle_filter.h +18 -10
  17. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +326 -0
  18. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.h +143 -0
  19. data/src/core/ext/filters/client_channel/backend_metric.cc +2 -2
  20. data/src/core/ext/filters/client_channel/client_channel.cc +32 -6
  21. data/src/core/ext/filters/client_channel/client_channel_internal.h +2 -0
  22. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +1 -1
  23. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +54 -21
  24. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +3 -2
  25. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +2 -1
  26. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +12 -15
  27. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +8 -5
  28. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +139 -92
  29. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +9 -4
  30. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +9 -4
  31. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +10 -11
  32. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +94 -93
  33. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +5 -3
  34. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +12 -15
  35. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +38 -16
  36. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +25 -28
  37. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +10 -10
  38. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +37 -35
  39. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +11 -9
  40. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +504 -461
  41. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +232 -122
  42. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +8 -6
  43. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +642 -251
  44. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h +2 -6
  45. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +7 -8
  46. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +2 -1
  47. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +3 -1
  48. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -2
  49. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +2 -2
  50. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +6 -8
  51. data/src/core/ext/filters/client_channel/resolver/xds/xds_dependency_manager.cc +1031 -0
  52. data/src/core/ext/filters/client_channel/resolver/xds/xds_dependency_manager.h +277 -0
  53. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +128 -270
  54. data/src/core/ext/filters/client_channel/resolver/xds/{xds_resolver.h → xds_resolver_attributes.h} +5 -4
  55. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.cc +25 -0
  56. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.h +30 -0
  57. data/src/core/ext/filters/client_channel/retry_filter.cc +1 -0
  58. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +35 -17
  59. data/src/core/ext/filters/deadline/deadline_filter.cc +12 -0
  60. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +17 -13
  61. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +13 -4
  62. data/src/core/ext/filters/http/client/http_client_filter.cc +23 -32
  63. data/src/core/ext/filters/http/client/http_client_filter.h +10 -5
  64. data/src/core/ext/filters/http/client_authority_filter.cc +14 -14
  65. data/src/core/ext/filters/http/client_authority_filter.h +12 -4
  66. data/src/core/ext/filters/http/http_filters_plugin.cc +42 -20
  67. data/src/core/ext/filters/http/message_compress/compression_filter.cc +55 -80
  68. data/src/core/ext/filters/http/message_compress/compression_filter.h +54 -12
  69. data/src/core/ext/filters/http/message_compress/legacy_compression_filter.cc +325 -0
  70. data/src/core/ext/filters/http/message_compress/legacy_compression_filter.h +139 -0
  71. data/src/core/ext/filters/http/server/http_server_filter.cc +41 -41
  72. data/src/core/ext/filters/http/server/http_server_filter.h +11 -4
  73. data/src/core/ext/filters/message_size/message_size_filter.cc +56 -76
  74. data/src/core/ext/filters/message_size/message_size_filter.h +35 -23
  75. data/src/core/ext/filters/rbac/rbac_filter.cc +15 -11
  76. data/src/core/ext/filters/rbac/rbac_filter.h +11 -4
  77. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +25 -13
  78. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +47 -50
  79. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +21 -4
  80. data/src/core/ext/transport/chttp2/alpn/alpn.cc +1 -1
  81. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
  82. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +11 -2
  83. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +67 -145
  84. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -3
  85. data/src/core/ext/transport/chttp2/transport/flow_control.cc +21 -82
  86. data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -8
  87. data/src/core/ext/transport/chttp2/transport/frame.cc +506 -0
  88. data/src/core/ext/transport/chttp2/transport/frame.h +214 -0
  89. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
  90. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +33 -79
  91. data/src/core/ext/transport/chttp2/transport/frame_settings.h +4 -7
  92. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +122 -32
  93. data/src/core/ext/transport/chttp2/transport/http2_settings.h +142 -37
  94. data/src/core/ext/transport/chttp2/transport/internal.h +1 -22
  95. data/src/core/ext/transport/chttp2/transport/parsing.cc +23 -37
  96. data/src/core/ext/transport/chttp2/transport/writing.cc +26 -58
  97. data/src/core/ext/transport/inproc/inproc_transport.cc +172 -13
  98. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +712 -0
  99. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +151 -0
  100. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +33 -0
  101. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +133 -0
  102. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +50 -0
  103. data/src/core/ext/xds/certificate_provider_store.cc +2 -1
  104. data/src/core/ext/xds/certificate_provider_store.h +0 -5
  105. data/src/core/ext/xds/xds_api.cc +31 -18
  106. data/src/core/ext/xds/xds_api.h +2 -2
  107. data/src/core/ext/xds/xds_bootstrap.h +3 -0
  108. data/src/core/ext/xds/xds_certificate_provider.cc +88 -287
  109. data/src/core/ext/xds/xds_certificate_provider.h +44 -111
  110. data/src/core/ext/xds/xds_client.cc +420 -414
  111. data/src/core/ext/xds/xds_client.h +31 -22
  112. data/src/core/ext/xds/xds_client_grpc.cc +3 -1
  113. data/src/core/ext/xds/xds_cluster.cc +104 -11
  114. data/src/core/ext/xds/xds_cluster.h +9 -1
  115. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +9 -5
  116. data/src/core/ext/xds/xds_common_types.cc +14 -10
  117. data/src/core/ext/xds/xds_endpoint.cc +9 -4
  118. data/src/core/ext/xds/xds_endpoint.h +5 -1
  119. data/src/core/ext/xds/xds_health_status.cc +12 -2
  120. data/src/core/ext/xds/xds_health_status.h +4 -2
  121. data/src/core/ext/xds/xds_http_rbac_filter.cc +5 -3
  122. data/src/core/ext/xds/xds_listener.cc +14 -8
  123. data/src/core/ext/xds/xds_resource_type_impl.h +6 -4
  124. data/src/core/ext/xds/xds_route_config.cc +34 -22
  125. data/src/core/ext/xds/xds_route_config.h +1 -0
  126. data/src/core/ext/xds/xds_server_config_fetcher.cc +61 -57
  127. data/src/core/ext/xds/xds_transport.h +3 -0
  128. data/src/core/ext/xds/xds_transport_grpc.cc +47 -50
  129. data/src/core/ext/xds/xds_transport_grpc.h +4 -0
  130. data/src/core/lib/channel/call_tracer.cc +12 -0
  131. data/src/core/lib/channel/call_tracer.h +17 -3
  132. data/src/core/lib/channel/channel_args.cc +24 -14
  133. data/src/core/lib/channel/channel_args.h +74 -13
  134. data/src/core/lib/channel/channel_stack.cc +27 -0
  135. data/src/core/lib/channel/channel_stack.h +10 -10
  136. data/src/core/lib/channel/connected_channel.cc +64 -18
  137. data/src/core/lib/channel/promise_based_filter.h +1041 -1
  138. data/src/core/lib/channel/server_call_tracer_filter.cc +43 -35
  139. data/src/core/lib/compression/compression_internal.cc +0 -3
  140. data/src/core/lib/event_engine/ares_resolver.cc +35 -14
  141. data/src/core/lib/event_engine/ares_resolver.h +9 -10
  142. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +8 -1
  143. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +132 -0
  144. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h +61 -0
  145. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +52 -36
  146. data/src/core/lib/event_engine/posix_engine/posix_engine.h +4 -9
  147. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +11 -3
  148. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +9 -2
  149. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +7 -0
  150. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +17 -27
  151. data/src/core/lib/event_engine/posix_engine/timer_manager.h +0 -3
  152. data/src/core/lib/event_engine/ref_counted_dns_resolver_interface.h +55 -0
  153. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.cc +114 -0
  154. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.h +51 -0
  155. data/src/core/lib/event_engine/windows/windows_engine.cc +7 -7
  156. data/src/core/lib/experiments/config.cc +13 -0
  157. data/src/core/lib/experiments/config.h +3 -0
  158. data/src/core/lib/experiments/experiments.cc +245 -366
  159. data/src/core/lib/experiments/experiments.h +50 -156
  160. data/src/core/lib/gprpp/debug_location.h +13 -0
  161. data/src/core/lib/gprpp/dual_ref_counted.h +36 -7
  162. data/src/core/lib/gprpp/orphanable.h +27 -0
  163. data/src/core/lib/gprpp/ref_counted.h +63 -22
  164. data/src/core/lib/gprpp/ref_counted_ptr.h +70 -27
  165. data/src/core/lib/gprpp/ref_counted_string.h +13 -0
  166. data/src/core/lib/gprpp/status_helper.cc +1 -2
  167. data/src/core/lib/iomgr/combiner.cc +15 -51
  168. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +31 -0
  169. data/src/core/lib/iomgr/event_engine_shims/endpoint.h +16 -0
  170. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -3
  171. data/src/core/lib/load_balancing/lb_policy.h +1 -1
  172. data/src/core/lib/promise/activity.cc +17 -2
  173. data/src/core/lib/promise/activity.h +5 -4
  174. data/src/core/lib/promise/all_ok.h +80 -0
  175. data/src/core/lib/promise/detail/join_state.h +2077 -0
  176. data/src/core/lib/promise/detail/promise_factory.h +1 -0
  177. data/src/core/lib/promise/detail/promise_like.h +8 -1
  178. data/src/core/lib/promise/detail/seq_state.h +3458 -150
  179. data/src/core/lib/promise/detail/status.h +42 -5
  180. data/src/core/lib/promise/for_each.h +13 -1
  181. data/src/core/lib/promise/if.h +4 -0
  182. data/src/core/lib/promise/latch.h +6 -3
  183. data/src/core/lib/promise/party.cc +33 -31
  184. data/src/core/lib/promise/party.h +142 -6
  185. data/src/core/lib/promise/poll.h +39 -13
  186. data/src/core/lib/promise/promise.h +4 -0
  187. data/src/core/lib/promise/seq.h +107 -7
  188. data/src/core/lib/promise/status_flag.h +196 -0
  189. data/src/core/lib/promise/try_join.h +132 -0
  190. data/src/core/lib/promise/try_seq.h +132 -10
  191. data/src/core/lib/resolver/endpoint_addresses.cc +0 -1
  192. data/src/core/lib/resolver/endpoint_addresses.h +48 -0
  193. data/src/core/lib/resource_quota/arena.h +2 -2
  194. data/src/core/lib/resource_quota/memory_quota.cc +57 -8
  195. data/src/core/lib/resource_quota/memory_quota.h +6 -0
  196. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +14 -11
  197. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +14 -5
  198. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +4 -0
  199. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +4 -0
  200. data/src/core/lib/security/credentials/external/external_account_credentials.cc +28 -20
  201. data/src/core/lib/security/credentials/external/external_account_credentials.h +4 -0
  202. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +4 -0
  203. data/src/core/lib/security/credentials/external/file_external_account_credentials.h +4 -0
  204. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +4 -0
  205. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +4 -0
  206. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -1
  207. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +0 -3
  208. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +12 -0
  209. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.cc +22 -5
  210. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.h +1 -5
  211. data/src/core/lib/security/credentials/tls/tls_credentials.cc +16 -0
  212. data/src/core/lib/security/credentials/xds/xds_credentials.cc +21 -28
  213. data/src/core/lib/security/credentials/xds/xds_credentials.h +2 -4
  214. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +4 -3
  215. data/src/core/lib/security/transport/auth_filters.h +71 -4
  216. data/src/core/lib/security/transport/client_auth_filter.cc +2 -4
  217. data/src/core/lib/security/transport/legacy_server_auth_filter.cc +244 -0
  218. data/src/core/lib/security/transport/server_auth_filter.cc +70 -90
  219. data/src/core/lib/slice/slice_buffer.h +3 -0
  220. data/src/core/lib/surface/builtins.cc +1 -1
  221. data/src/core/lib/surface/call.cc +683 -196
  222. data/src/core/lib/surface/call.h +26 -13
  223. data/src/core/lib/surface/call_trace.cc +42 -1
  224. data/src/core/lib/surface/channel.cc +0 -1
  225. data/src/core/lib/surface/channel.h +0 -6
  226. data/src/core/lib/surface/channel_init.h +26 -0
  227. data/src/core/lib/surface/init.cc +14 -8
  228. data/src/core/lib/surface/server.cc +256 -237
  229. data/src/core/lib/surface/server.h +26 -54
  230. data/src/core/lib/surface/version.cc +2 -2
  231. data/src/core/lib/surface/wait_for_cq_end_op.h +94 -0
  232. data/src/core/lib/transport/call_final_info.cc +38 -0
  233. data/src/core/lib/transport/call_final_info.h +54 -0
  234. data/src/core/lib/transport/connectivity_state.cc +3 -2
  235. data/src/core/lib/transport/connectivity_state.h +4 -0
  236. data/src/core/lib/transport/metadata_batch.h +4 -4
  237. data/src/core/lib/transport/transport.cc +70 -19
  238. data/src/core/lib/transport/transport.h +395 -25
  239. data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -0
  240. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -3
  241. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  242. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +1 -1
  243. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -1
  244. data/src/core/tsi/ssl_transport_security.cc +65 -43
  245. data/src/ruby/ext/grpc/rb_channel_args.c +3 -1
  246. data/src/ruby/ext/grpc/rb_grpc.c +0 -1
  247. data/src/ruby/ext/grpc/rb_grpc.h +0 -2
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  249. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  250. data/src/ruby/lib/grpc/version.rb +1 -1
  251. data/third_party/upb/upb/reflection/def_pool.h +2 -2
  252. data/third_party/zlib/adler32.c +5 -27
  253. data/third_party/zlib/compress.c +5 -16
  254. data/third_party/zlib/crc32.c +86 -162
  255. data/third_party/zlib/deflate.c +233 -336
  256. data/third_party/zlib/deflate.h +8 -8
  257. data/third_party/zlib/gzguts.h +11 -12
  258. data/third_party/zlib/infback.c +7 -23
  259. data/third_party/zlib/inffast.c +1 -4
  260. data/third_party/zlib/inffast.h +1 -1
  261. data/third_party/zlib/inflate.c +30 -99
  262. data/third_party/zlib/inftrees.c +6 -11
  263. data/third_party/zlib/inftrees.h +3 -3
  264. data/third_party/zlib/trees.c +224 -302
  265. data/third_party/zlib/uncompr.c +4 -12
  266. data/third_party/zlib/zconf.h +6 -2
  267. data/third_party/zlib/zlib.h +191 -188
  268. data/third_party/zlib/zutil.c +16 -44
  269. data/third_party/zlib/zutil.h +10 -10
  270. metadata +35 -13
  271. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +0 -1173
  272. data/src/core/lib/event_engine/memory_allocator.cc +0 -74
  273. data/src/core/lib/transport/pid_controller.cc +0 -51
  274. data/src/core/lib/transport/pid_controller.h +0 -116
  275. data/third_party/upb/upb/collections/array.h +0 -17
  276. data/third_party/upb/upb/collections/map.h +0 -17
  277. data/third_party/upb/upb/upb.hpp +0 -18
@@ -0,0 +1,214 @@
1
+ // Copyright 2015 gRPC authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #ifndef GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
16
+ #define GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
17
+
18
+ #include <grpc/support/port_platform.h>
19
+
20
+ #include <cstdint>
21
+ #include <string>
22
+ #include <vector>
23
+
24
+ #include "absl/status/statusor.h"
25
+ #include "absl/strings/string_view.h"
26
+ #include "absl/types/span.h"
27
+ #include "absl/types/variant.h"
28
+
29
+ #include "src/core/lib/slice/slice.h"
30
+ #include "src/core/lib/slice/slice_buffer.h"
31
+
32
+ namespace grpc_core {
33
+
34
+ ///////////////////////////////////////////////////////////////////////////////
35
+ // Frame types
36
+ //
37
+ // Define structs for each kind of frame that chttp2 reasons about.
38
+ //
39
+ // Each struct gets the members defined by the HTTP/2 spec for that frame type
40
+ // *that the semantic layers of chttp2 neead to reason about*.
41
+ //
42
+ // That means, for instance, that we drop padding and prioritization data from
43
+ // these structs, as they are handled by the HTTP/2 framing layer and are
44
+ // meaningless to the semantic layers above.
45
+ //
46
+ // If a frame type is associated with a stream, it has a stream_id member.
47
+ // If that frame type is only used at the channel layer it does not.
48
+ //
49
+ // Instead of carrying bitfields of flags like the wire format, we instead
50
+ // declare a bool per flag to make producing/consuming code easier to write.
51
+ //
52
+ // Equality operators are defined for use in unit tests.
53
+
54
+ // DATA frame
55
+ struct Http2DataFrame {
56
+ uint32_t stream_id = 0;
57
+ bool end_stream = false;
58
+ SliceBuffer payload;
59
+
60
+ bool operator==(const Http2DataFrame& other) const {
61
+ return stream_id == other.stream_id && end_stream == other.end_stream &&
62
+ payload.JoinIntoString() == other.payload.JoinIntoString();
63
+ }
64
+ };
65
+
66
+ // HEADER frame
67
+ struct Http2HeaderFrame {
68
+ uint32_t stream_id = 0;
69
+ bool end_headers = false;
70
+ bool end_stream = false;
71
+ SliceBuffer payload;
72
+
73
+ bool operator==(const Http2HeaderFrame& other) const {
74
+ return stream_id == other.stream_id && end_headers == other.end_headers &&
75
+ end_stream == other.end_stream &&
76
+ payload.JoinIntoString() == other.payload.JoinIntoString();
77
+ }
78
+ };
79
+
80
+ // CONTINUATION frame
81
+ struct Http2ContinuationFrame {
82
+ uint32_t stream_id = 0;
83
+ bool end_headers = false;
84
+ SliceBuffer payload;
85
+
86
+ bool operator==(const Http2ContinuationFrame& other) const {
87
+ return stream_id == other.stream_id && end_headers == other.end_headers &&
88
+ payload.JoinIntoString() == other.payload.JoinIntoString();
89
+ }
90
+ };
91
+
92
+ // RST_STREAM frame
93
+ struct Http2RstStreamFrame {
94
+ uint32_t stream_id = 0;
95
+ uint32_t error_code = 0;
96
+
97
+ bool operator==(const Http2RstStreamFrame& other) const {
98
+ return stream_id == other.stream_id && error_code == other.error_code;
99
+ }
100
+ };
101
+
102
+ // SETTINGS frame
103
+ struct Http2SettingsFrame {
104
+ struct Setting {
105
+ Setting(uint16_t id, uint32_t value) : id(id), value(value) {}
106
+
107
+ uint16_t id;
108
+ uint32_t value;
109
+
110
+ bool operator==(const Setting& other) const {
111
+ return id == other.id && value == other.value;
112
+ }
113
+ };
114
+ bool ack = false;
115
+ std::vector<Setting> settings;
116
+
117
+ bool operator==(const Http2SettingsFrame& other) const {
118
+ return ack == other.ack && settings == other.settings;
119
+ }
120
+ };
121
+
122
+ // PING frame
123
+ struct Http2PingFrame {
124
+ bool ack = false;
125
+ uint64_t opaque = 0;
126
+
127
+ bool operator==(const Http2PingFrame& other) const {
128
+ return ack == other.ack && opaque == other.opaque;
129
+ }
130
+ };
131
+
132
+ // GOAWAY frame
133
+ struct Http2GoawayFrame {
134
+ uint32_t last_stream_id = 0;
135
+ uint32_t error_code = 0;
136
+ Slice debug_data;
137
+
138
+ bool operator==(const Http2GoawayFrame& other) const {
139
+ return last_stream_id == other.last_stream_id &&
140
+ error_code == other.error_code &&
141
+ debug_data.as_string_view() == other.debug_data.as_string_view();
142
+ }
143
+ };
144
+
145
+ // WINDOW_UPDATE frame
146
+ struct Http2WindowUpdateFrame {
147
+ uint32_t stream_id;
148
+ uint32_t increment;
149
+
150
+ bool operator==(const Http2WindowUpdateFrame& other) const {
151
+ return stream_id == other.stream_id && increment == other.increment;
152
+ }
153
+ };
154
+
155
+ // Type of frame was unknown (and should be ignored)
156
+ struct Http2UnknownFrame {
157
+ bool operator==(const Http2UnknownFrame&) const { return true; }
158
+ };
159
+
160
+ ///////////////////////////////////////////////////////////////////////////////
161
+ // Frame variant
162
+ //
163
+ // A union of all the frame types above, so that we may pass around an
164
+ // arbitrary frame between layers as appropriate.
165
+ using Http2Frame =
166
+ absl::variant<Http2DataFrame, Http2HeaderFrame, Http2ContinuationFrame,
167
+ Http2RstStreamFrame, Http2SettingsFrame, Http2PingFrame,
168
+ Http2GoawayFrame, Http2WindowUpdateFrame, Http2UnknownFrame>;
169
+
170
+ ///////////////////////////////////////////////////////////////////////////////
171
+ // Frame header
172
+ //
173
+ // Define a struct for the frame header.
174
+ // Parsing this type is the first step in parsing a frame.
175
+ // No validation on the header is done during parsing - the fields should be
176
+ // instead interpreted by the frame type parser.
177
+ struct Http2FrameHeader {
178
+ uint32_t length;
179
+ uint8_t type;
180
+ uint8_t flags;
181
+ uint32_t stream_id;
182
+ // Serialize header to 9 byte long buffer output
183
+ // Crashes if length > 16777215 (as this is unencodable)
184
+ void Serialize(uint8_t* output) const;
185
+ // Parse header from 9 byte long buffer input
186
+ static Http2FrameHeader Parse(const uint8_t* input);
187
+ std::string ToString() const;
188
+
189
+ bool operator==(const Http2FrameHeader& other) const {
190
+ return length == other.length && type == other.type &&
191
+ flags == other.flags && stream_id == other.stream_id;
192
+ }
193
+ };
194
+
195
+ ///////////////////////////////////////////////////////////////////////////////
196
+ // Parsing & serialization
197
+
198
+ // Given a frame header and a payload, parse the payload into a frame and
199
+ // return it.
200
+ // If this function returns an error, that should be considered a connection
201
+ // error.
202
+ // If a frame should simply be ignored, this function returns a
203
+ // Http2UnknownFrame.
204
+ // It is expected that hdr.length == payload.Length().
205
+ absl::StatusOr<Http2Frame> ParseFramePayload(const Http2FrameHeader& hdr,
206
+ SliceBuffer payload);
207
+
208
+ // Serialize frame and append to out, leaves frames in an unknown state (may
209
+ // move things out of frames)
210
+ void Serialize(absl::Span<Http2Frame> frames, SliceBuffer& out);
211
+
212
+ } // namespace grpc_core
213
+
214
+ #endif // GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
@@ -126,7 +126,7 @@ grpc_error_handle grpc_chttp2_rst_stream_parser_parse(void* parser,
126
126
  grpc_core::StatusIntProperty::kHttp2Error,
127
127
  static_cast<intptr_t>(reason));
128
128
  }
129
- if (grpc_core::IsPingOnRstStreamEnabled() && !t->is_client &&
129
+ if (!t->is_client &&
130
130
  absl::Bernoulli(t->bitgen, t->ping_on_rst_stream_percent / 100.0)) {
131
131
  ++t->num_pending_induced_frames;
132
132
  t->ping_callbacks.RequestPing();
@@ -33,6 +33,7 @@
33
33
 
34
34
  #include "src/core/ext/transport/chttp2/transport/flow_control.h"
35
35
  #include "src/core/ext/transport/chttp2/transport/frame_goaway.h"
36
+ #include "src/core/ext/transport/chttp2/transport/http2_settings.h"
36
37
  #include "src/core/ext/transport/chttp2/transport/http_trace.h"
37
38
  #include "src/core/ext/transport/chttp2/transport/internal.h"
38
39
  #include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
@@ -55,38 +56,6 @@ static uint8_t* fill_header(uint8_t* out, uint32_t length, uint8_t flags) {
55
56
  return out;
56
57
  }
57
58
 
58
- grpc_slice grpc_chttp2_settings_create(uint32_t* old_settings,
59
- const uint32_t* new_settings,
60
- uint32_t force_mask, size_t count) {
61
- size_t i;
62
- uint32_t n = 0;
63
- grpc_slice output;
64
- uint8_t* p;
65
-
66
- for (i = 0; i < count; i++) {
67
- n += (new_settings[i] != old_settings[i] || (force_mask & (1u << i)) != 0);
68
- }
69
-
70
- output = GRPC_SLICE_MALLOC(9 + 6 * n);
71
- p = fill_header(GRPC_SLICE_START_PTR(output), 6 * n, 0);
72
-
73
- for (i = 0; i < count; i++) {
74
- if (new_settings[i] != old_settings[i] || (force_mask & (1u << i)) != 0) {
75
- *p++ = static_cast<uint8_t>(grpc_setting_id_to_wire_id[i] >> 8);
76
- *p++ = static_cast<uint8_t>(grpc_setting_id_to_wire_id[i]);
77
- *p++ = static_cast<uint8_t>(new_settings[i] >> 24);
78
- *p++ = static_cast<uint8_t>(new_settings[i] >> 16);
79
- *p++ = static_cast<uint8_t>(new_settings[i] >> 8);
80
- *p++ = static_cast<uint8_t>(new_settings[i]);
81
- old_settings[i] = new_settings[i];
82
- }
83
- }
84
-
85
- GPR_ASSERT(p == GRPC_SLICE_END_PTR(output));
86
-
87
- return output;
88
- }
89
-
90
59
  grpc_slice grpc_chttp2_settings_ack_create(void) {
91
60
  grpc_slice output = GRPC_SLICE_MALLOC(9);
92
61
  fill_header(GRPC_SLICE_START_PTR(output), 0, GRPC_CHTTP2_FLAG_ACK);
@@ -95,10 +64,9 @@ grpc_slice grpc_chttp2_settings_ack_create(void) {
95
64
 
96
65
  grpc_error_handle grpc_chttp2_settings_parser_begin_frame(
97
66
  grpc_chttp2_settings_parser* parser, uint32_t length, uint8_t flags,
98
- uint32_t* settings) {
99
- parser->target_settings = settings;
100
- memcpy(parser->incoming_settings, settings,
101
- GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t));
67
+ grpc_core::Http2Settings& settings) {
68
+ parser->target_settings = &settings;
69
+ parser->incoming_settings.Init(settings);
102
70
  parser->is_ack = 0;
103
71
  parser->state = GRPC_CHTTP2_SPS_ID0;
104
72
  if (flags == GRPC_CHTTP2_FLAG_ACK) {
@@ -125,7 +93,6 @@ grpc_error_handle grpc_chttp2_settings_parser_parse(void* p,
125
93
  static_cast<grpc_chttp2_settings_parser*>(p);
126
94
  const uint8_t* cur = GRPC_SLICE_START_PTR(slice);
127
95
  const uint8_t* end = GRPC_SLICE_END_PTR(slice);
128
- grpc_chttp2_setting_id id;
129
96
 
130
97
  if (parser->is_ack) {
131
98
  return absl::OkStatus();
@@ -137,8 +104,7 @@ grpc_error_handle grpc_chttp2_settings_parser_parse(void* p,
137
104
  if (cur == end) {
138
105
  parser->state = GRPC_CHTTP2_SPS_ID0;
139
106
  if (is_last) {
140
- memcpy(parser->target_settings, parser->incoming_settings,
141
- GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t));
107
+ *parser->target_settings = *parser->incoming_settings;
142
108
  t->num_pending_induced_frames++;
143
109
  grpc_slice_buffer_add(&t->qbuf, grpc_chttp2_settings_ack_create());
144
110
  grpc_chttp2_initiate_write(t,
@@ -187,7 +153,7 @@ grpc_error_handle grpc_chttp2_settings_parser_parse(void* p,
187
153
  parser->value |= (static_cast<uint32_t>(*cur)) << 8;
188
154
  cur++;
189
155
  ABSL_FALLTHROUGH_INTENDED;
190
- case GRPC_CHTTP2_SPS_VAL3:
156
+ case GRPC_CHTTP2_SPS_VAL3: {
191
157
  if (cur == end) {
192
158
  parser->state = GRPC_CHTTP2_SPS_VAL3;
193
159
  return absl::OkStatus();
@@ -197,47 +163,35 @@ grpc_error_handle grpc_chttp2_settings_parser_parse(void* p,
197
163
  parser->value |= *cur;
198
164
  cur++;
199
165
 
200
- if (grpc_wire_id_to_setting_id(parser->id, &id)) {
201
- const grpc_chttp2_setting_parameters* sp =
202
- &grpc_chttp2_settings_parameters[id];
203
- if (parser->value < sp->min_value || parser->value > sp->max_value) {
204
- switch (sp->invalid_value_behavior) {
205
- case GRPC_CHTTP2_CLAMP_INVALID_VALUE:
206
- parser->value = grpc_core::Clamp(parser->value, sp->min_value,
207
- sp->max_value);
208
- break;
209
- case GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE:
210
- grpc_chttp2_goaway_append(
211
- t->last_new_stream_id, sp->error_value,
212
- grpc_slice_from_static_string("HTTP2 settings error"),
213
- &t->qbuf);
214
- return GRPC_ERROR_CREATE(absl::StrFormat(
215
- "invalid value %u passed for %s", parser->value, sp->name));
216
- }
217
- }
218
- if (id == GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE &&
219
- parser->incoming_settings[id] != parser->value) {
220
- t->initial_window_update += static_cast<int64_t>(parser->value) -
221
- parser->incoming_settings[id];
222
- if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
223
- GRPC_TRACE_FLAG_ENABLED(grpc_flowctl_trace)) {
224
- gpr_log(GPR_INFO, "%p[%s] adding %d for initial_window change", t,
225
- t->is_client ? "cli" : "svr",
226
- static_cast<int>(t->initial_window_update));
227
- }
228
- }
229
- parser->incoming_settings[id] = parser->value;
230
- if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
231
- gpr_log(GPR_INFO, "CHTTP2:%s:%s: got setting %s = %d",
232
- t->is_client ? "CLI" : "SVR",
233
- std::string(t->peer_string.as_string_view()).c_str(),
234
- sp->name, parser->value);
166
+ if (parser->id == grpc_core::Http2Settings::kInitialWindowSizeWireId) {
167
+ t->initial_window_update +=
168
+ static_cast<int64_t>(parser->value) -
169
+ parser->incoming_settings->initial_window_size();
170
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
171
+ GRPC_TRACE_FLAG_ENABLED(grpc_flowctl_trace)) {
172
+ gpr_log(GPR_INFO, "%p[%s] adding %d for initial_window change", t,
173
+ t->is_client ? "cli" : "svr",
174
+ static_cast<int>(t->initial_window_update));
235
175
  }
236
- } else if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
237
- gpr_log(GPR_DEBUG, "CHTTP2: Ignoring unknown setting %d (value %d)",
238
- parser->id, parser->value);
239
176
  }
240
- break;
177
+ auto error =
178
+ parser->incoming_settings->Apply(parser->id, parser->value);
179
+ if (error != GRPC_HTTP2_NO_ERROR) {
180
+ grpc_chttp2_goaway_append(
181
+ t->last_new_stream_id, error,
182
+ grpc_slice_from_static_string("HTTP2 settings error"), &t->qbuf);
183
+ return GRPC_ERROR_CREATE(absl::StrFormat(
184
+ "invalid value %u passed for %s", parser->value,
185
+ grpc_core::Http2Settings::WireIdToName(parser->id).c_str()));
186
+ }
187
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
188
+ gpr_log(GPR_INFO, "CHTTP2:%s:%s: got setting %s = %d",
189
+ t->is_client ? "CLI" : "SVR",
190
+ std::string(t->peer_string.as_string_view()).c_str(),
191
+ grpc_core::Http2Settings::WireIdToName(parser->id).c_str(),
192
+ parser->value);
193
+ }
194
+ } break;
241
195
  }
242
196
  }
243
197
  }
@@ -28,6 +28,7 @@
28
28
 
29
29
  #include "src/core/ext/transport/chttp2/transport/http2_settings.h"
30
30
  #include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
31
+ #include "src/core/lib/gprpp/manual_constructor.h"
31
32
  #include "src/core/lib/iomgr/error.h"
32
33
 
33
34
  typedef enum {
@@ -41,22 +42,18 @@ typedef enum {
41
42
 
42
43
  struct grpc_chttp2_settings_parser {
43
44
  grpc_chttp2_settings_parse_state state;
44
- uint32_t* target_settings;
45
+ grpc_core::Http2Settings* target_settings;
46
+ grpc_core::ManualConstructor<grpc_core::Http2Settings> incoming_settings;
45
47
  uint8_t is_ack;
46
48
  uint16_t id;
47
49
  uint32_t value;
48
- uint32_t incoming_settings[GRPC_CHTTP2_NUM_SETTINGS];
49
50
  };
50
- // Create a settings frame by diffing old & new, and updating old to be new
51
- grpc_slice grpc_chttp2_settings_create(uint32_t* old_settings,
52
- const uint32_t* new_settings,
53
- uint32_t force_mask, size_t count);
54
51
  // Create an ack settings frame
55
52
  grpc_slice grpc_chttp2_settings_ack_create(void);
56
53
 
57
54
  grpc_error_handle grpc_chttp2_settings_parser_begin_frame(
58
55
  grpc_chttp2_settings_parser* parser, uint32_t length, uint8_t flags,
59
- uint32_t* settings);
56
+ grpc_core::Http2Settings& settings);
60
57
  grpc_error_handle grpc_chttp2_settings_parser_parse(void* parser,
61
58
  grpc_chttp2_transport* t,
62
59
  grpc_chttp2_stream* s,
@@ -22,43 +22,133 @@
22
22
 
23
23
  #include "src/core/ext/transport/chttp2/transport/http2_settings.h"
24
24
 
25
+ #include "absl/strings/str_cat.h"
26
+
27
+ #include "src/core/ext/transport/chttp2/transport/frame.h"
25
28
  #include "src/core/lib/gpr/useful.h"
26
29
  #include "src/core/lib/transport/http2_errors.h"
27
30
 
28
- const uint16_t grpc_setting_id_to_wire_id[] = {1, 2, 3, 4, 5, 6, 65027, 65028};
31
+ namespace grpc_core {
32
+
33
+ void Http2Settings::Diff(
34
+ bool is_first_send, const Http2Settings& old,
35
+ absl::FunctionRef<void(uint16_t key, uint32_t value)> cb) const {
36
+ if (header_table_size_ != old.header_table_size_) {
37
+ cb(kHeaderTableSizeWireId, header_table_size_);
38
+ }
39
+ if (enable_push_ != old.enable_push_) {
40
+ cb(kEnablePushWireId, enable_push_);
41
+ }
42
+ if (max_concurrent_streams_ != old.max_concurrent_streams_) {
43
+ cb(kMaxConcurrentStreamsWireId, max_concurrent_streams_);
44
+ }
45
+ if (is_first_send || initial_window_size_ != old.initial_window_size_) {
46
+ cb(kInitialWindowSizeWireId, initial_window_size_);
47
+ }
48
+ if (max_frame_size_ != old.max_frame_size_) {
49
+ cb(kMaxFrameSizeWireId, max_frame_size_);
50
+ }
51
+ if (max_header_list_size_ != old.max_header_list_size_) {
52
+ cb(kMaxHeaderListSizeWireId, max_header_list_size_);
53
+ }
54
+ if (allow_true_binary_metadata_ != old.allow_true_binary_metadata_) {
55
+ cb(kGrpcAllowTrueBinaryMetadataWireId, allow_true_binary_metadata_);
56
+ }
57
+ if (preferred_receive_crypto_message_size_ !=
58
+ old.preferred_receive_crypto_message_size_) {
59
+ cb(kGrpcPreferredReceiveCryptoFrameSizeWireId,
60
+ preferred_receive_crypto_message_size_);
61
+ }
62
+ }
63
+
64
+ std::string Http2Settings::WireIdToName(uint16_t wire_id) {
65
+ switch (wire_id) {
66
+ case kHeaderTableSizeWireId:
67
+ return std::string(header_table_size_name());
68
+ case kEnablePushWireId:
69
+ return std::string(enable_push_name());
70
+ case kMaxConcurrentStreamsWireId:
71
+ return std::string(max_concurrent_streams_name());
72
+ case kInitialWindowSizeWireId:
73
+ return std::string(initial_window_size_name());
74
+ case kMaxFrameSizeWireId:
75
+ return std::string(max_frame_size_name());
76
+ case kMaxHeaderListSizeWireId:
77
+ return std::string(max_header_list_size_name());
78
+ case kGrpcAllowTrueBinaryMetadataWireId:
79
+ return std::string(allow_true_binary_metadata_name());
80
+ case kGrpcPreferredReceiveCryptoFrameSizeWireId:
81
+ return std::string(preferred_receive_crypto_message_size_name());
82
+ default:
83
+ return absl::StrCat("UNKNOWN (", wire_id, ")");
84
+ }
85
+ }
86
+
87
+ grpc_http2_error_code Http2Settings::Apply(uint16_t key, uint32_t value) {
88
+ switch (key) {
89
+ case kHeaderTableSizeWireId:
90
+ header_table_size_ = value;
91
+ break;
92
+ case kEnablePushWireId:
93
+ if (value > 1) return GRPC_HTTP2_PROTOCOL_ERROR;
94
+ enable_push_ = value != 0;
95
+ break;
96
+ case kMaxConcurrentStreamsWireId:
97
+ max_concurrent_streams_ = value;
98
+ break;
99
+ case kInitialWindowSizeWireId:
100
+ if (value > max_initial_window_size()) {
101
+ return GRPC_HTTP2_FLOW_CONTROL_ERROR;
102
+ }
103
+ initial_window_size_ = value;
104
+ break;
105
+ case kMaxFrameSizeWireId:
106
+ if (value < min_max_frame_size() || value > max_max_frame_size()) {
107
+ return GRPC_HTTP2_PROTOCOL_ERROR;
108
+ }
109
+ max_frame_size_ = value;
110
+ break;
111
+ case kMaxHeaderListSizeWireId:
112
+ max_header_list_size_ = std::min(value, 16777216u);
113
+ break;
114
+ case kGrpcAllowTrueBinaryMetadataWireId:
115
+ if (value > 1) return GRPC_HTTP2_PROTOCOL_ERROR;
116
+ allow_true_binary_metadata_ = value != 0;
117
+ break;
118
+ case kGrpcPreferredReceiveCryptoFrameSizeWireId:
119
+ preferred_receive_crypto_message_size_ =
120
+ Clamp(value, min_preferred_receive_crypto_message_size(),
121
+ max_preferred_receive_crypto_message_size());
122
+ break;
123
+ }
124
+ return GRPC_HTTP2_NO_ERROR;
125
+ }
29
126
 
30
- bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id* out) {
31
- uint32_t i = wire_id - 1;
32
- uint32_t x = i % 256;
33
- uint32_t y = i / 256;
34
- uint32_t h = x;
35
- switch (y) {
36
- case 254:
37
- h += 4;
127
+ absl::optional<Http2SettingsFrame> Http2SettingsManager::MaybeSendUpdate() {
128
+ switch (update_state_) {
129
+ case UpdateState::kSending:
130
+ return absl::nullopt;
131
+ case UpdateState::kIdle:
132
+ if (local_ == sent_) return absl::nullopt;
133
+ break;
134
+ case UpdateState::kFirst:
38
135
  break;
39
136
  }
40
- *out = static_cast<grpc_chttp2_setting_id>(h);
41
- return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) &&
42
- grpc_setting_id_to_wire_id[h] == wire_id;
137
+ Http2SettingsFrame frame;
138
+ local_.Diff(update_state_ == UpdateState::kFirst, sent_,
139
+ [&frame](uint16_t key, uint32_t value) {
140
+ frame.settings.emplace_back(key, value);
141
+ });
142
+ sent_ = local_;
143
+ update_state_ = UpdateState::kSending;
144
+ return frame;
145
+ }
146
+
147
+ bool Http2SettingsManager::AckLastSend() {
148
+ if (update_state_ != UpdateState::kSending) return false;
149
+ update_state_ = UpdateState::kIdle;
150
+ acked_ = sent_;
151
+ return true;
43
152
  }
44
153
 
45
- const grpc_chttp2_setting_parameters
46
- grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = {
47
- {"HEADER_TABLE_SIZE", 4096u, 0u, 4294967295u,
48
- GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
49
- {"ENABLE_PUSH", 1u, 0u, 1u, GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE,
50
- GRPC_HTTP2_PROTOCOL_ERROR},
51
- {"MAX_CONCURRENT_STREAMS", 4294967295u, 0u, 4294967295u,
52
- GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
53
- {"INITIAL_WINDOW_SIZE", 65535u, 0u, 2147483647u,
54
- GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE,
55
- GRPC_HTTP2_FLOW_CONTROL_ERROR},
56
- {"MAX_FRAME_SIZE", 16384u, 16384u, 16777215u,
57
- GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
58
- {"MAX_HEADER_LIST_SIZE", 16777216u, 0u, 16777216u,
59
- GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
60
- {"GRPC_ALLOW_TRUE_BINARY_METADATA", 0u, 0u, 1u,
61
- GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
62
- {"GRPC_PREFERRED_RECEIVE_CRYPTO_FRAME_SIZE", 0u, 16384u, 2147483647u,
63
- GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
64
- };
154
+ } // namespace grpc_core