grpc 1.83.0 → 1.84.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +21 -17
  3. data/include/grpc/credentials.h +10 -0
  4. data/include/grpc/grpc_security_constants.h +2 -0
  5. data/include/grpc/impl/channel_arg_names.h +9 -0
  6. data/src/core/call/call_filters.h +4 -2
  7. data/src/core/call/client_call.cc +20 -8
  8. data/src/core/call/client_call.h +4 -0
  9. data/src/core/call/interception_chain.cc +2 -0
  10. data/src/core/call/interception_chain.h +14 -1
  11. data/src/core/call/metadata.cc +1 -3
  12. data/src/core/call/metadata_batch.h +13 -5
  13. data/src/core/call/server_call.cc +31 -14
  14. data/src/core/call/server_call.h +4 -0
  15. data/src/core/channelz/text_encode.cc +9 -4
  16. data/src/core/channelz/v2tov1/convert.cc +2 -2
  17. data/src/core/client_channel/backup_poller.cc +1 -2
  18. data/src/core/client_channel/client_channel.cc +6 -33
  19. data/src/core/client_channel/client_channel_filter.cc +22 -55
  20. data/src/core/client_channel/client_channel_filter.h +2 -2
  21. data/src/core/client_channel/client_channel_service_config.cc +3 -19
  22. data/src/core/client_channel/direct_channel.cc +7 -1
  23. data/src/core/client_channel/direct_channel.h +2 -2
  24. data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
  25. data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
  26. data/src/core/client_channel/subchannel.cc +310 -1058
  27. data/src/core/client_channel/subchannel.h +44 -329
  28. data/src/core/client_channel/subchannel_metrics.cc +48 -0
  29. data/src/core/client_channel/subchannel_metrics.h +60 -0
  30. data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
  31. data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
  32. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
  33. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
  34. data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
  35. data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
  36. data/src/core/credentials/call/json_util.h +1 -0
  37. data/src/core/credentials/call/jwt/json_token.cc +10 -2
  38. data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
  39. data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
  40. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
  41. data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
  42. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
  43. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
  44. data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
  45. data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
  46. data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
  47. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
  48. data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
  49. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
  50. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
  51. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
  52. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
  53. data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
  54. data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
  55. data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
  56. data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
  57. data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
  58. data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
  59. data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
  60. data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
  61. data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
  62. data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
  63. data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
  64. data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
  65. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
  66. data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
  67. data/src/core/ext/filters/http/message_compress/compression_filter.cc +25 -32
  68. data/src/core/ext/filters/http/message_compress/compression_filter.h +0 -1
  69. data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
  70. data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
  71. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
  72. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
  73. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
  74. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +80 -70
  75. data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
  76. data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
  77. data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
  78. data/src/core/ext/transport/chttp2/transport/frame_data.cc +33 -2
  79. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +55 -23
  80. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -0
  81. data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
  82. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
  83. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
  84. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
  85. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
  86. data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
  87. data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
  88. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
  89. data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
  90. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
  91. data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
  92. data/src/core/ext/transport/chttp2/transport/internal.h +6 -0
  93. data/src/core/ext/transport/chttp2/transport/parsing.cc +13 -5
  94. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
  95. data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
  96. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
  97. data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
  98. data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
  99. data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
  100. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
  101. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
  102. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
  103. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
  104. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
  105. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
  106. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
  107. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
  108. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
  109. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
  110. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
  111. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
  112. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
  113. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
  114. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
  115. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
  116. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
  117. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
  118. data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
  119. data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
  120. data/src/core/filter/auth/server_auth_filter.cc +2 -3
  121. data/src/core/filter/composite/composite_filter.cc +45 -33
  122. data/src/core/filter/composite/composite_filter.h +5 -4
  123. data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
  124. data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
  125. data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
  126. data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
  127. data/src/core/filter/filter_args.h +13 -2
  128. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
  129. data/src/core/handshaker/security/security_handshaker.cc +9 -6
  130. data/src/core/lib/channel/channel_stack.cc +3 -0
  131. data/src/core/lib/channel/channel_stack.h +2 -0
  132. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
  133. data/src/core/lib/channel/promise_based_filter.cc +132 -20
  134. data/src/core/lib/channel/promise_based_filter.h +42 -12
  135. data/src/core/lib/compression/compression_internal.cc +4 -5
  136. data/src/core/lib/compression/message_compress.cc +132 -97
  137. data/src/core/lib/compression/message_compress.h +24 -0
  138. data/src/core/lib/debug/trace_flags.cc +8 -0
  139. data/src/core/lib/debug/trace_flags.h +3 -0
  140. data/src/core/lib/event_engine/ares_resolver.cc +54 -50
  141. data/src/core/lib/event_engine/ares_resolver.h +3 -2
  142. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
  143. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
  144. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
  145. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
  146. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
  147. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
  148. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
  149. data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
  150. data/src/core/lib/experiments/experiments.cc +81 -102
  151. data/src/core/lib/experiments/experiments.h +57 -56
  152. data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
  153. data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
  154. data/src/core/lib/iomgr/error.cc +2 -6
  155. data/src/core/lib/iomgr/error_cfstream.cc +1 -1
  156. data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
  157. data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
  158. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
  159. data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
  160. data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
  161. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
  162. data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
  163. data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
  164. data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
  165. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  166. data/src/core/lib/iomgr/systemd_utils.cc +0 -1
  167. data/src/core/lib/iomgr/tcp_client.h +1 -1
  168. data/src/core/lib/iomgr/tcp_posix.cc +23 -15
  169. data/src/core/lib/iomgr/tcp_server.h +1 -1
  170. data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
  171. data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
  172. data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
  173. data/src/core/lib/iomgr/tcp_windows.cc +5 -10
  174. data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
  175. data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
  176. data/src/core/lib/iomgr/vsock.h +3 -1
  177. data/src/core/lib/resource_quota/memory_quota.cc +1 -1
  178. data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
  179. data/src/core/lib/security/authorization/rbac_policy.h +21 -3
  180. data/src/core/lib/surface/call.cc +3 -9
  181. data/src/core/lib/surface/call_utils.h +113 -0
  182. data/src/core/lib/surface/channel_create.cc +1 -1
  183. data/src/core/lib/surface/channel_create.h +0 -2
  184. data/src/core/lib/surface/channel_init.cc +77 -38
  185. data/src/core/lib/surface/channel_init.h +30 -16
  186. data/src/core/lib/surface/filter_stack_call.cc +5 -10
  187. data/src/core/lib/surface/init.cc +13 -27
  188. data/src/core/lib/surface/legacy_channel.cc +3 -1
  189. data/src/core/lib/surface/version.cc +1 -1
  190. data/src/core/lib/transport/error_utils.cc +0 -27
  191. data/src/core/lib/transport/error_utils.h +0 -16
  192. data/src/core/lib/transport/transport.h +7 -5
  193. data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
  194. data/src/core/load_balancing/rls/rls.cc +28 -11
  195. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
  196. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
  197. data/src/core/load_balancing/xds/cds.cc +3 -1
  198. data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
  199. data/src/core/mitigation_engine/mitigation.h +14 -5
  200. data/src/core/mitigation_engine/mitigation_engine.h +7 -3
  201. data/src/core/mitigation_engine/mitigation_provider.h +2 -1
  202. data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
  203. data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
  204. data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
  205. data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
  206. data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
  207. data/src/core/resolver/endpoint_addresses.h +3 -0
  208. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
  209. data/src/core/resolver/xds/xds_resolver.cc +35 -9
  210. data/src/core/server/server.cc +2 -6
  211. data/src/core/server/server_config_selector.h +18 -3
  212. data/src/core/server/server_config_selector_filter.cc +178 -91
  213. data/src/core/server/server_config_selector_filter.h +58 -3
  214. data/src/core/server/xds_server_config_fetcher.cc +196 -129
  215. data/src/core/server/xds_server_config_fetcher.h +49 -0
  216. data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
  217. data/src/core/telemetry/histogram.h +94 -14
  218. data/src/core/telemetry/instrument.cc +179 -74
  219. data/src/core/telemetry/instrument.h +78 -30
  220. data/src/core/telemetry/metrics.h +5 -0
  221. data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
  222. data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
  223. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
  224. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
  225. data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
  226. data/src/core/tsi/ssl_telemetry_utils.h +12 -2
  227. data/src/core/tsi/ssl_transport_security.cc +238 -80
  228. data/src/core/tsi/ssl_transport_security.h +63 -33
  229. data/src/core/tsi/tls_telemetry.cc +31 -0
  230. data/src/core/tsi/tls_telemetry.h +47 -0
  231. data/src/core/tsi/transport_security.cc +2 -2
  232. data/src/core/tsi/transport_security.h +1 -1
  233. data/src/core/tsi/transport_security_interface.h +1 -1
  234. data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
  235. data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
  236. data/src/core/util/http_client/httpcli.cc +16 -53
  237. data/src/core/util/http_client/httpcli.h +0 -7
  238. data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
  239. data/src/core/util/linux/cpu.cc +1 -1
  240. data/src/core/util/load_file.cc +3 -9
  241. data/src/core/util/load_file.h +3 -4
  242. data/src/core/util/matchers.h +8 -0
  243. data/src/core/util/posix/cpu.cc +1 -1
  244. data/src/core/util/status_helper.cc +0 -20
  245. data/src/core/util/status_helper.h +3 -14
  246. data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
  247. data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
  248. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
  249. data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
  250. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
  251. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
  252. data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
  253. data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
  254. data/src/core/xds/grpc/xds_client_grpc.h +0 -4
  255. data/src/core/xds/grpc/xds_cluster.h +1 -0
  256. data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
  257. data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
  258. data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
  259. data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
  260. data/src/core/xds/grpc/xds_common_types.cc +0 -91
  261. data/src/core/xds/grpc/xds_common_types.h +1 -47
  262. data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
  263. data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
  264. data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
  265. data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
  266. data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
  267. data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
  268. data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
  269. data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
  270. data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
  271. data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
  272. data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
  273. data/src/core/xds/grpc/xds_http_filter.cc +2 -1
  274. data/src/core/xds/grpc/xds_http_filter.h +6 -5
  275. data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
  276. data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
  277. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
  278. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
  279. data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
  280. data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
  281. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
  282. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
  283. data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
  284. data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
  285. data/src/core/xds/grpc/xds_listener.cc +2 -0
  286. data/src/core/xds/grpc/xds_listener.h +5 -0
  287. data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
  288. data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
  289. data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
  290. data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
  291. data/src/core/xds/grpc/xds_route_config.cc +2 -0
  292. data/src/core/xds/grpc/xds_route_config.h +3 -1
  293. data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
  294. data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
  295. data/src/core/xds/grpc/xds_routing.cc +116 -69
  296. data/src/core/xds/grpc/xds_routing.h +19 -8
  297. data/src/core/xds/grpc/xds_tls_context.cc +117 -0
  298. data/src/core/xds/grpc/xds_tls_context.h +76 -0
  299. data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
  300. data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
  301. data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
  302. data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
  303. data/src/ruby/ext/grpc/rb_call.c +26 -15
  304. data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
  305. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  306. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  307. data/src/ruby/lib/grpc/version.rb +1 -1
  308. data/src/ruby/pb/test/client.rb +5 -4
  309. data/src/ruby/spec/call_spec.rb +14 -0
  310. data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
  311. metadata +50 -35
  312. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
  313. data/src/core/lib/iomgr/resolve_address.cc +0 -59
  314. data/src/core/lib/iomgr/resolve_address.h +0 -125
  315. data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
  316. data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
  317. data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
  318. data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
  319. data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
  320. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
  321. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
  322. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
  323. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
  324. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
  325. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
  326. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
  327. data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
  328. data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
  329. data/src/core/util/json/json_util.cc +0 -101
  330. data/src/core/util/json/json_util.h +0 -163
@@ -24,6 +24,7 @@
24
24
  #include <stdint.h>
25
25
 
26
26
  #include <algorithm>
27
+ #include <cstddef>
27
28
  #include <iosfwd>
28
29
  #include <optional>
29
30
  #include <string>
@@ -370,6 +371,7 @@ class TransportFlowControl final {
370
371
  int64_t bdp_accumulator;
371
372
  int64_t bdp_estimate;
372
373
  double bdp_bw_est;
374
+ bool bdp_ping_blocked;
373
375
 
374
376
  std::string ToString() const;
375
377
  channelz::PropertyList ChannelzProperties() const {
@@ -386,6 +388,7 @@ class TransportFlowControl final {
386
388
  .Set("announced_stream_total_over_incoming_window",
387
389
  announced_stream_total_over_incoming_window)
388
390
  .Set("bdp_accumulator", bdp_accumulator)
391
+ .Set("bdp_ping_blocked", bdp_ping_blocked)
389
392
  .Set("bdp_estimate", bdp_estimate)
390
393
  .Set("bdp_bw_est", bdp_bw_est);
391
394
  }
@@ -405,6 +408,7 @@ class TransportFlowControl final {
405
408
  stats.announced_stream_total_over_incoming_window =
406
409
  announced_stream_total_over_incoming_window();
407
410
  stats.bdp_accumulator = bdp_estimator_.accumulator();
411
+ stats.bdp_ping_blocked = bdp_ping_blocked_;
408
412
  stats.bdp_estimate = bdp_estimator_.EstimateBdp();
409
413
  stats.bdp_bw_est = bdp_estimator_.EstimateBandwidth();
410
414
  return stats;
@@ -418,6 +422,67 @@ class TransportFlowControl final {
418
422
  }
419
423
  size_t window_update_list_size() const { return window_update_list_.size(); }
420
424
 
425
+ //////////////////////////////////////////////////////////////////////////////
426
+ // BDP Ping related functions.
427
+
428
+ // The current implementation of BDP relies on the assumption that our
429
+ // transport will not send out a new ping till it has received an ACK for the
430
+ // previous ping.
431
+
432
+ // CHTTP2 reference : schedule_bdp_ping_locked
433
+ void ScheduleBdpPing() {
434
+ GRPC_DCHECK(enable_bdp_probe_);
435
+ bdp_estimator_.SchedulePing();
436
+ }
437
+
438
+ // CHTTP2 reference : start_bdp_ping_locked
439
+ void StartBdpPing() {
440
+ // TODO(tjagtap) : [PH2][P1] : Reset the keepalive ping timer
441
+ bdp_estimator_.StartPing();
442
+ }
443
+
444
+ // CHTTP2 reference : finish_bdp_ping_locked
445
+ Duration CompleteBdpPing() {
446
+ return bdp_estimator_.CompletePing() - Timestamp::Now();
447
+ }
448
+
449
+ // CHTTP2 reference : init_data_frame_parser
450
+ void OnReceiveDataFrame(const uint32_t bytes) {
451
+ if (enable_bdp_probe_) {
452
+ bdp_estimator_.AddIncomingBytes(bytes);
453
+ if (bdp_ping_blocked_ && (bytes > 0)) {
454
+ // Once we receive a data frame, we can start sending BDP pings again.
455
+ bdp_ping_blocked_ = false;
456
+ bdp_waker_.Wakeup();
457
+ }
458
+ }
459
+ }
460
+
461
+ // CHTTP2 reference : grpc_chttp2_transport::bdp_ping_blocked
462
+ bool IsBdpPingBlocked() const { return bdp_ping_blocked_; }
463
+
464
+ auto WaitForBdpActivation() {
465
+ GRPC_HTTP2_FLOW_CONTROL_DLOG
466
+ << "TransportFlowControl::WaitForBdpActivation Factory";
467
+ return [this]() -> Poll<absl::Status> {
468
+ GRPC_DCHECK(enable_bdp_probe_);
469
+ if (bdp_estimator_.accumulator() == 0) {
470
+ // Block BDP ping till we receive data in a DATA frame on the transport.
471
+ bdp_ping_blocked_ = true;
472
+ }
473
+ if (bdp_ping_blocked_) {
474
+ bdp_waker_ = GetContext<Activity>()->MakeNonOwningWaker();
475
+ GRPC_HTTP2_FLOW_CONTROL_DLOG
476
+ << "TransportFlowControl::WaitForBdpActivation Pending";
477
+ return Pending{};
478
+ }
479
+ GRPC_HTTP2_FLOW_CONTROL_DLOG
480
+ << "TransportFlowControl::WaitForBdpActivation Resolved";
481
+ ScheduleBdpPing();
482
+ return absl::OkStatus();
483
+ };
484
+ }
485
+
421
486
  private:
422
487
  friend class StreamFlowControl;
423
488
 
@@ -461,10 +526,12 @@ class TransportFlowControl final {
461
526
  /// incoming_window = total_over - max(bdp - total_under, 0)
462
527
  int64_t announced_stream_total_over_incoming_window_ = 0;
463
528
 
464
- /// should we probe bdp?
529
+ // Transport level channel argument GRPC_ARG_HTTP2_BDP_PROBE decides if we
530
+ // should probe for bdp.
465
531
  const bool enable_bdp_probe_;
466
-
467
- // bdp estimation
532
+ // CHTTP2 reference : grpc_chttp2_transport::bdp_ping_blocked
533
+ bool bdp_ping_blocked_;
534
+ Waker bdp_waker_;
468
535
  BdpEstimator bdp_estimator_;
469
536
 
470
537
  int64_t remote_window_ = kDefaultWindow;
@@ -490,10 +557,17 @@ class TransportFlowControl final {
490
557
  class StreamFlowControl final {
491
558
  public:
492
559
  explicit StreamFlowControl(TransportFlowControl* tfc);
560
+ // TODO(ritulb) : [PH2][P5] : When CHTTP2 is removed, delete this
561
+ // destructor(no-op).
493
562
  ~StreamFlowControl() {
494
563
  tfc_->RemoveAnnouncedWindowDelta(announced_window_delta_);
495
564
  }
496
565
 
566
+ void OnStreamClosed() {
567
+ tfc_->RemoveAnnouncedWindowDelta(announced_window_delta_);
568
+ announced_window_delta_ = 0;
569
+ }
570
+
497
571
  // Track an update to the incoming flow control counters - that is how many
498
572
  // tokens we report to our peer that we're willing to accept.
499
573
  // Instantiators *must* call MakeAction before destruction of this value.
@@ -526,7 +600,7 @@ class StreamFlowControl final {
526
600
  // `min_progress_size` bytes to make progress on reading the current stream.
527
601
  // An example usage of this would be, say we receive the first 1000 bytes of
528
602
  // a 2000 byte gRPC message, we can call SetMinProgressSize(1000)
529
- // TODO(tjagtap) [PH2][P2] Plumb with PH2 flow control.
603
+ // TODO(tjagtap) [PH2][P2][FCV3] Plumb with PH2 flow control.
530
604
  void SetMinProgressSize(int64_t min_progress_size) {
531
605
  sfc_->min_progress_size_ = min_progress_size;
532
606
  }
@@ -398,6 +398,8 @@ inline constexpr absl::string_view kSettingsTimeout =
398
398
  "timeout. Connection will be closed";
399
399
  inline constexpr absl::string_view kLastStreamClosed =
400
400
  "Closing last stream and cannot create any more streams.";
401
+ inline constexpr absl::string_view kReceivedStreamAfterGoaway =
402
+ "Received new stream after GOAWAY was received.";
401
403
  inline constexpr absl::string_view kFirstSettingsFrameClient =
402
404
  "RFC9113: The server connection preface consists of a potentially empty "
403
405
  "SETTINGS frame that MUST be the first frame the server sends in the "
@@ -48,6 +48,7 @@ absl::Status grpc_chttp2_data_parser_begin_frame(uint8_t flags,
48
48
  } else {
49
49
  s->received_last_frame = false;
50
50
  }
51
+ ++s->num_frames;
51
52
 
52
53
  return absl::OkStatus();
53
54
  }
@@ -123,6 +124,23 @@ grpc_core::Poll<grpc_error_handle> grpc_deframe_unprocessed_incoming_frames(
123
124
  (static_cast<uint32_t>(header[3]) << 8) |
124
125
  static_cast<uint32_t>(header[4]);
125
126
 
127
+ if (grpc_core::IsMessageSizeRefactoringEnabled()) {
128
+ if (s->max_recv_message_length.has_value() &&
129
+ length > *(s->max_recv_message_length)) {
130
+ error = GRPC_ERROR_CREATE(
131
+ absl::StrFormat("%s: Received message larger than max (%d vs. %u)",
132
+ s->t->is_client ? "CLIENT" : "SERVER", length,
133
+ *(s->max_recv_message_length)));
134
+ error = grpc_error_set_int(error, grpc_core::StatusIntProperty::kStreamId,
135
+ static_cast<intptr_t>(s->id));
136
+ // Attach the explicit gRPC status code to fail the RPC correctly
137
+ error = grpc_core::ReplaceStatusCode(
138
+ error, absl::StatusCode::kResourceExhausted);
139
+ s->message_size_limit_exceeded = true;
140
+ return error;
141
+ }
142
+ }
143
+
126
144
  if (slices->length < length + GRPC_HEADER_SIZE_IN_BYTES) {
127
145
  if (min_progress_size != nullptr) {
128
146
  *min_progress_size = length + GRPC_HEADER_SIZE_IN_BYTES - slices->length;
@@ -138,6 +156,7 @@ grpc_core::Poll<grpc_error_handle> grpc_deframe_unprocessed_incoming_frames(
138
156
  grpc_slice_buffer_move_first_into_buffer(slices, GRPC_HEADER_SIZE_IN_BYTES,
139
157
  header);
140
158
  grpc_slice_buffer_move_first(slices, length, stream_out->c_slice_buffer());
159
+ s->num_frames = 0;
141
160
  }
142
161
 
143
162
  return absl::OkStatus();
@@ -148,8 +167,20 @@ grpc_error_handle grpc_chttp2_data_parser_parse(void* /*parser*/,
148
167
  grpc_chttp2_stream* s,
149
168
  const grpc_slice& slice,
150
169
  int is_last) {
151
- grpc_core::CSliceRef(slice);
152
- grpc_slice_buffer_add(&s->frame_storage, slice);
170
+ const size_t slice_len = GRPC_SLICE_LENGTH(slice);
171
+ bool is_small_frame = 0 < slice_len && slice_len < GRPC_SLICE_INLINED_SIZE;
172
+ bool multiple_small_frames =
173
+ (s->num_frames >= 64) &&
174
+ ((s->frame_storage.length / s->num_frames) < GRPC_SLICE_INLINED_SIZE);
175
+ if (GPR_UNLIKELY(multiple_small_frames && is_small_frame &&
176
+ grpc_core::IsHeaderDataFrameEnabled())) {
177
+ uint8_t* append_ptr =
178
+ grpc_slice_buffer_tiny_add(&s->frame_storage, slice_len);
179
+ memcpy(append_ptr, GRPC_SLICE_START_PTR(slice), slice_len);
180
+ } else {
181
+ grpc_core::CSliceRef(slice);
182
+ grpc_slice_buffer_add(&s->frame_storage, slice);
183
+ }
153
184
  grpc_chttp2_maybe_complete_recv_message(t, s);
154
185
 
155
186
  if (is_last) {
@@ -31,11 +31,15 @@
31
31
  #include "absl/strings/string_view.h"
32
32
 
33
33
  void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser* p) {
34
- p->debug_data = nullptr;
34
+ if (!grpc_core::IsPh2Perf01Enabled()) {
35
+ p->debug_data = nullptr;
36
+ }
35
37
  }
36
38
 
37
39
  void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p) {
38
- gpr_free(p->debug_data);
40
+ if (!grpc_core::IsPh2Perf01Enabled()) {
41
+ gpr_free(p->debug_data);
42
+ }
39
43
  }
40
44
 
41
45
  grpc_error_handle grpc_chttp2_goaway_parser_begin_frame(
@@ -45,10 +49,14 @@ grpc_error_handle grpc_chttp2_goaway_parser_begin_frame(
45
49
  absl::StrFormat("goaway frame too short (%d bytes)", length));
46
50
  }
47
51
 
48
- gpr_free(p->debug_data);
49
52
  p->debug_length = length - 8;
50
- p->debug_data = static_cast<char*>(gpr_malloc(p->debug_length));
51
- p->debug_pos = 0;
53
+ if (grpc_core::IsPh2Perf01Enabled()) {
54
+ p->debug_slice_buffer.Clear();
55
+ } else {
56
+ gpr_free(p->debug_data);
57
+ p->debug_data = static_cast<char*>(gpr_malloc(p->debug_length));
58
+ p->debug_pos = 0;
59
+ }
52
60
  p->state = GRPC_CHTTP2_GOAWAY_LSI0;
53
61
  return absl::OkStatus();
54
62
  }
@@ -130,24 +138,48 @@ grpc_error_handle grpc_chttp2_goaway_parser_parse(void* parser,
130
138
  ++cur;
131
139
  [[fallthrough]];
132
140
  case GRPC_CHTTP2_GOAWAY_DEBUG:
133
- if (end != cur) {
134
- memcpy(p->debug_data + p->debug_pos, cur,
135
- static_cast<size_t>(end - cur));
136
- }
137
- GRPC_CHECK((size_t)(end - cur) < UINT32_MAX - p->debug_pos);
138
- p->debug_pos += static_cast<uint32_t>(end - cur);
139
- p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
140
- if (is_last) {
141
- t->http2_ztrace_collector.Append([p]() {
142
- return grpc_core::H2GoAwayTrace<true>{
143
- p->last_stream_id, p->error_code,
144
- std::string(absl::string_view(p->debug_data, p->debug_length))};
145
- });
146
- grpc_chttp2_add_incoming_goaway(
147
- t, p->error_code, p->last_stream_id,
148
- absl::string_view(p->debug_data, p->debug_length));
149
- gpr_free(p->debug_data);
150
- p->debug_data = nullptr;
141
+ if (grpc_core::IsPh2Perf01Enabled()) {
142
+ if (end != cur) {
143
+ p->debug_slice_buffer.AppendIndexed(
144
+ grpc_core::Slice::FromCopiedBuffer(
145
+ cur, static_cast<size_t>(end - cur)));
146
+ }
147
+ GRPC_CHECK(p->debug_slice_buffer.Length() <= p->debug_length);
148
+ p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
149
+ if (is_last) {
150
+ std::string debug_str = p->debug_slice_buffer.JoinIntoString();
151
+
152
+ grpc_chttp2_add_incoming_goaway(t, p->error_code, p->last_stream_id,
153
+ absl::string_view(debug_str));
154
+
155
+ t->http2_ztrace_collector.Append(
156
+ [last_stream_id = p->last_stream_id, error_code = p->error_code,
157
+ debug_str = std::move(debug_str)]() mutable {
158
+ return grpc_core::H2GoAwayTrace<true>{
159
+ last_stream_id, error_code, std::move(debug_str)};
160
+ });
161
+ p->debug_slice_buffer.Clear();
162
+ }
163
+ } else {
164
+ if (end != cur) {
165
+ memcpy(p->debug_data + p->debug_pos, cur,
166
+ static_cast<size_t>(end - cur));
167
+ }
168
+ GRPC_CHECK((size_t)(end - cur) < UINT32_MAX - p->debug_pos);
169
+ p->debug_pos += static_cast<uint32_t>(end - cur);
170
+ p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
171
+ if (is_last) {
172
+ t->http2_ztrace_collector.Append([p]() {
173
+ return grpc_core::H2GoAwayTrace<true>{
174
+ p->last_stream_id, p->error_code,
175
+ std::string(absl::string_view(p->debug_data, p->debug_length))};
176
+ });
177
+ grpc_chttp2_add_incoming_goaway(
178
+ t, p->error_code, p->last_stream_id,
179
+ absl::string_view(p->debug_data, p->debug_length));
180
+ gpr_free(p->debug_data);
181
+ p->debug_data = nullptr;
182
+ }
151
183
  }
152
184
  return absl::OkStatus();
153
185
  }
@@ -44,6 +44,7 @@ struct grpc_chttp2_goaway_parser {
44
44
  uint32_t last_stream_id;
45
45
  uint32_t error_code;
46
46
  char* debug_data;
47
+ grpc_core::SliceBuffer debug_slice_buffer;
47
48
  uint32_t debug_length;
48
49
  uint32_t debug_pos;
49
50
  };
@@ -365,6 +365,13 @@ class GoawayManager {
365
365
  !context_->was_immediate;
366
366
  }
367
367
 
368
+ bool IsGracefulGoawayInProgress() const {
369
+ return context_->goaway_state ==
370
+ GoawayState::kInitialGracefulGoawayScheduled ||
371
+ context_->goaway_state == GoawayState::kInitialGracefulGoawaySent ||
372
+ context_->goaway_state == GoawayState::kFinalGracefulGoawayScheduled;
373
+ }
374
+
368
375
  // Called from the transport write cycle to notify the GOAWAY manager that a
369
376
  // GOAWAY frame may have been sent. If a GOAWAY frame is sent in current
370
377
  // write cycle, this function handles the needed state transition.
@@ -1009,7 +1009,7 @@ class HPackParser::Parser {
1009
1009
  key_string.size() + value.wire_size + hpack_constants::kEntryOverhead;
1010
1010
  if (state_.mitigation_engine != nullptr) {
1011
1011
  auto action = state_.mitigation_engine->EvaluateIncomingMetadata(
1012
- key_string, value_slice.as_string_view());
1012
+ key_string, value_slice.as_string_view(), state_.peer_address);
1013
1013
  if (action.has_value()) {
1014
1014
  if (action.value() == MitigationEngine::Action::kCloseConnection) {
1015
1015
  input_->SetErrorAndStopParsing(
@@ -1118,7 +1118,8 @@ void HPackParser::BeginFrame(grpc_metadata_batch* metadata_buffer,
1118
1118
  uint32_t metadata_size_hard_limit,
1119
1119
  Boundary boundary, Priority priority,
1120
1120
  LogInfo log_info,
1121
- MitigationEngine* mitigation_engine) {
1121
+ MitigationEngine* mitigation_engine,
1122
+ absl::string_view peer_address) {
1122
1123
  metadata_buffer_ = metadata_buffer;
1123
1124
  if (metadata_buffer != nullptr) {
1124
1125
  metadata_buffer->Set(GrpcStatusFromWire(), true);
@@ -1126,6 +1127,7 @@ void HPackParser::BeginFrame(grpc_metadata_batch* metadata_buffer,
1126
1127
  boundary_ = boundary;
1127
1128
  priority_ = priority;
1128
1129
  state_.mitigation_engine = mitigation_engine;
1130
+ state_.peer_address = peer_address;
1129
1131
  state_.dynamic_table_updates_allowed = 2;
1130
1132
  state_.metadata_early_detection.SetLimits(
1131
1133
  /*soft_limit=*/metadata_size_soft_limit,
@@ -1162,7 +1164,7 @@ grpc_error_handle HPackParser::ParseInput(Input input, bool is_last,
1162
1164
  if (is_last && is_boundary()) {
1163
1165
  if (state_.mitigation_engine != nullptr && metadata_buffer_ != nullptr) {
1164
1166
  auto action = state_.mitigation_engine->EvaluateAllIncomingMetadata(
1165
- *metadata_buffer_);
1167
+ *metadata_buffer_, state_.peer_address);
1166
1168
  if (action.has_value()) {
1167
1169
  if (action.value() == MitigationEngine::Action::kCloseConnection) {
1168
1170
  input.SetErrorAndStopParsing(HpackParseResult::MitigationEngineError(
@@ -101,7 +101,8 @@ class HPackParser {
101
101
  uint32_t metadata_size_soft_limit,
102
102
  uint32_t metadata_size_hard_limit, Boundary boundary,
103
103
  Priority priority, LogInfo log_info,
104
- MitigationEngine* mitigation_engine);
104
+ MitigationEngine* mitigation_engine,
105
+ absl::string_view peer_address = "");
105
106
  // Start throwing away any received headers after parsing them.
106
107
  void StopBufferingFrame() { metadata_buffer_ = nullptr; }
107
108
  // Parse one slice worth of data
@@ -255,6 +256,7 @@ class HPackParser {
255
256
  // Current parse state
256
257
  ParseState parse_state = ParseState::kTop;
257
258
  MitigationEngine* mitigation_engine = nullptr;
259
+ absl::string_view peer_address;
258
260
  std::variant<const HPackTable::Memento*, Slice> key;
259
261
  };
260
262