grpc 1.75.0.pre1 → 1.76.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 (387) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +18 -5
  3. data/include/grpc/credentials.h +21 -5
  4. data/src/core/call/call_filters.cc +4 -4
  5. data/src/core/call/call_filters.h +36 -36
  6. data/src/core/call/call_spine.h +27 -27
  7. data/src/core/call/client_call.cc +6 -5
  8. data/src/core/call/filter_fusion.h +5 -5
  9. data/src/core/call/metadata_batch.h +3 -3
  10. data/src/core/call/security_context.cc +1 -1
  11. data/src/core/call/server_call.cc +4 -4
  12. data/src/core/call/server_call.h +1 -1
  13. data/src/core/channelz/channelz.cc +12 -18
  14. data/src/core/channelz/channelz.h +32 -16
  15. data/src/core/channelz/channelz_registry.h +11 -0
  16. data/src/core/channelz/property_list.cc +18 -0
  17. data/src/core/channelz/property_list.h +10 -1
  18. data/src/core/channelz/text_encode.cc +66 -0
  19. data/src/core/channelz/text_encode.h +29 -0
  20. data/src/core/channelz/v2tov1/convert.cc +11 -0
  21. data/src/core/channelz/v2tov1/legacy_api.cc +15 -8
  22. data/src/core/channelz/ztrace_collector.h +247 -86
  23. data/src/core/client_channel/backup_poller.cc +5 -6
  24. data/src/core/client_channel/client_channel.cc +20 -13
  25. data/src/core/client_channel/client_channel_filter.cc +53 -45
  26. data/src/core/client_channel/client_channel_filter.h +2 -2
  27. data/src/core/client_channel/client_channel_internal.h +3 -4
  28. data/src/core/client_channel/config_selector.h +3 -3
  29. data/src/core/client_channel/dynamic_filters.cc +3 -3
  30. data/src/core/client_channel/global_subchannel_pool.cc +0 -37
  31. data/src/core/client_channel/global_subchannel_pool.h +0 -27
  32. data/src/core/client_channel/load_balanced_call_destination.cc +7 -7
  33. data/src/core/client_channel/local_subchannel_pool.cc +4 -4
  34. data/src/core/client_channel/retry_filter.h +3 -3
  35. data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -5
  36. data/src/core/client_channel/subchannel.cc +8 -8
  37. data/src/core/client_channel/subchannel_stream_client.cc +4 -4
  38. data/src/core/config/config_vars.cc +30 -1
  39. data/src/core/config/config_vars.h +21 -0
  40. data/src/core/config/core_configuration.cc +5 -5
  41. data/src/core/config/core_configuration.h +7 -7
  42. data/src/core/config/load_config.cc +12 -0
  43. data/src/core/config/load_config.h +2 -0
  44. data/src/core/credentials/call/call_credentials.h +2 -2
  45. data/src/core/credentials/call/call_creds_util.cc +4 -3
  46. data/src/core/credentials/call/composite/composite_call_credentials.cc +4 -4
  47. data/src/core/credentials/call/external/aws_external_account_credentials.cc +3 -3
  48. data/src/core/credentials/call/external/external_account_credentials.cc +1 -1
  49. data/src/core/credentials/call/external/url_external_account_credentials.cc +1 -1
  50. data/src/core/credentials/call/iam/iam_credentials.cc +4 -4
  51. data/src/core/credentials/call/jwt/json_token.cc +3 -3
  52. data/src/core/credentials/call/jwt/jwt_credentials.cc +2 -2
  53. data/src/core/credentials/call/jwt/jwt_verifier.cc +14 -13
  54. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +20 -12
  55. data/src/core/credentials/call/plugin/plugin_credentials.cc +2 -2
  56. data/src/core/credentials/transport/alts/alts_credentials.cc +4 -4
  57. data/src/core/credentials/transport/alts/alts_security_connector.cc +14 -12
  58. data/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc +22 -2
  59. data/src/core/credentials/transport/alts/grpc_alts_credentials_options.cc +10 -1
  60. data/src/core/credentials/transport/alts/grpc_alts_credentials_options.h +31 -0
  61. data/src/core/credentials/transport/alts/grpc_alts_credentials_server_options.cc +8 -3
  62. data/src/core/credentials/transport/composite/composite_channel_credentials.cc +5 -5
  63. data/src/core/credentials/transport/fake/fake_security_connector.cc +2 -2
  64. data/src/core/credentials/transport/google_default/google_default_credentials.cc +78 -28
  65. data/src/core/credentials/transport/insecure/insecure_security_connector.cc +3 -3
  66. data/src/core/credentials/transport/local/local_security_connector.cc +8 -8
  67. data/src/core/credentials/transport/security_connector.cc +5 -5
  68. data/src/core/credentials/transport/ssl/ssl_credentials.cc +12 -12
  69. data/src/core/credentials/transport/ssl/ssl_credentials.h +2 -2
  70. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +3 -3
  71. data/src/core/credentials/transport/tls/certificate_provider_registry.cc +2 -2
  72. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +24 -24
  73. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +5 -5
  74. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +2 -2
  75. data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.cc +2 -2
  76. data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.h +2 -2
  77. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +17 -17
  78. data/src/core/credentials/transport/tls/ssl_utils.cc +14 -9
  79. data/src/core/credentials/transport/tls/tls_credentials.cc +2 -2
  80. data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -11
  81. data/src/core/credentials/transport/transport_credentials.cc +2 -2
  82. data/src/core/credentials/transport/transport_credentials.h +2 -2
  83. data/src/core/credentials/transport/xds/xds_credentials.cc +5 -5
  84. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +2 -0
  85. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +1 -1
  86. data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
  87. data/src/core/ext/filters/http/message_compress/compression_filter.h +3 -3
  88. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +7 -7
  89. data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -2
  90. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +10 -9
  91. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +10 -7
  92. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +5 -5
  93. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +6 -6
  94. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +96 -88
  95. data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
  96. data/src/core/ext/transport/chttp2/transport/flow_control.h +12 -7
  97. data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +60 -0
  98. data/src/core/ext/transport/chttp2/transport/frame.cc +32 -10
  99. data/src/core/ext/transport/chttp2/transport/frame.h +16 -2
  100. data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -2
  101. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -4
  102. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -2
  103. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -2
  104. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +3 -3
  105. data/src/core/ext/transport/chttp2/transport/header_assembler.h +28 -12
  106. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -2
  107. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -2
  108. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +8 -8
  109. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +2 -2
  110. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +2 -2
  111. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +27 -27
  112. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
  113. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
  114. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +543 -366
  115. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +198 -277
  116. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +3 -0
  117. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +11 -0
  118. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +179 -0
  119. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +51 -23
  120. data/src/core/ext/transport/chttp2/transport/http2_transport.h +13 -6
  121. data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +115 -71
  122. data/src/core/ext/transport/chttp2/transport/internal.h +6 -14
  123. data/src/core/ext/transport/chttp2/transport/message_assembler.h +7 -7
  124. data/src/core/ext/transport/chttp2/transport/parsing.cc +17 -15
  125. data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +2 -2
  126. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +62 -26
  127. data/src/core/ext/transport/chttp2/transport/ping_promise.h +58 -22
  128. data/src/core/ext/transport/chttp2/transport/stream.h +207 -0
  129. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +328 -187
  130. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +7 -7
  131. data/src/core/ext/transport/chttp2/transport/transport_common.cc +17 -1
  132. data/src/core/ext/transport/chttp2/transport/transport_common.h +52 -0
  133. data/src/core/ext/transport/chttp2/transport/varint.h +2 -2
  134. data/src/core/ext/transport/chttp2/transport/writable_streams.h +181 -79
  135. data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +2 -2
  136. data/src/core/ext/transport/chttp2/transport/writing.cc +3 -3
  137. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
  138. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +3 -3
  139. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb.h +740 -0
  140. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.c +218 -0
  141. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.h +46 -0
  142. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +87 -55
  143. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +23 -21
  144. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.c +80 -0
  145. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.h +47 -0
  146. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.c +129 -0
  147. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.h +72 -0
  148. data/src/core/filter/auth/server_auth_filter.cc +2 -2
  149. data/src/core/handshaker/handshaker.cc +3 -3
  150. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +2 -2
  151. data/src/core/handshaker/security/legacy_secure_endpoint.cc +2 -2
  152. data/src/core/handshaker/security/pipelined_secure_endpoint.cc +31 -8
  153. data/src/core/handshaker/security/secure_endpoint.cc +16 -6
  154. data/src/core/handshaker/security/security_handshaker.cc +3 -3
  155. data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +2 -2
  156. data/src/core/lib/channel/channel_stack.cc +8 -5
  157. data/src/core/lib/channel/channel_stack.h +3 -0
  158. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -0
  159. data/src/core/lib/channel/connected_channel.cc +2 -2
  160. data/src/core/lib/channel/promise_based_filter.cc +69 -64
  161. data/src/core/lib/channel/promise_based_filter.h +16 -15
  162. data/src/core/lib/compression/compression_internal.cc +2 -2
  163. data/src/core/lib/compression/message_compress.cc +7 -7
  164. data/src/core/lib/event_engine/ares_resolver.cc +22 -20
  165. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -2
  166. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +2 -2
  167. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -2
  168. data/src/core/lib/event_engine/extensions/channelz.h +2 -2
  169. data/src/core/lib/event_engine/extensions/supports_fd.h +5 -5
  170. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +8 -8
  171. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -10
  172. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +2 -2
  173. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +23 -22
  174. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +11 -11
  175. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +168 -170
  176. data/src/core/lib/event_engine/posix_engine/posix_engine.h +33 -54
  177. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +4 -3
  178. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +5 -5
  179. data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
  180. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
  181. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +3 -3
  182. data/src/core/lib/event_engine/resolved_address.cc +3 -3
  183. data/src/core/lib/event_engine/shim.cc +8 -11
  184. data/src/core/lib/event_engine/shim.h +2 -1
  185. data/src/core/lib/event_engine/slice.cc +2 -2
  186. data/src/core/lib/event_engine/tcp_socket_utils.cc +11 -11
  187. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +7 -7
  188. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +31 -31
  189. data/src/core/lib/event_engine/windows/iocp.cc +10 -10
  190. data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
  191. data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -11
  192. data/src/core/lib/event_engine/windows/windows_engine.cc +16 -14
  193. data/src/core/lib/event_engine/windows/windows_listener.cc +7 -7
  194. data/src/core/lib/experiments/experiments.cc +105 -18
  195. data/src/core/lib/experiments/experiments.h +43 -11
  196. data/src/core/lib/iomgr/call_combiner.cc +3 -3
  197. data/src/core/lib/iomgr/endpoint_cfstream.cc +6 -6
  198. data/src/core/lib/iomgr/endpoint_pair_posix.cc +5 -5
  199. data/src/core/lib/iomgr/endpoint_pair_windows.cc +15 -14
  200. data/src/core/lib/iomgr/ev_epoll1_linux.cc +15 -15
  201. data/src/core/lib/iomgr/ev_poll_posix.cc +11 -11
  202. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +5 -4
  203. data/src/core/lib/iomgr/event_engine_shims/endpoint.h +1 -1
  204. data/src/core/lib/iomgr/iocp_windows.cc +8 -8
  205. data/src/core/lib/iomgr/iomgr_windows.cc +3 -3
  206. data/src/core/lib/iomgr/lockfree_event.cc +2 -2
  207. data/src/core/lib/iomgr/polling_entity.cc +3 -3
  208. data/src/core/lib/iomgr/socket_utils_common_posix.cc +2 -2
  209. data/src/core/lib/iomgr/socket_windows.cc +4 -4
  210. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -4
  211. data/src/core/lib/iomgr/tcp_client_windows.cc +4 -4
  212. data/src/core/lib/iomgr/tcp_posix.cc +42 -42
  213. data/src/core/lib/iomgr/tcp_server.cc +5 -0
  214. data/src/core/lib/iomgr/tcp_server.h +7 -0
  215. data/src/core/lib/iomgr/tcp_server_posix.cc +47 -27
  216. data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
  217. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -5
  218. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +2 -2
  219. data/src/core/lib/iomgr/tcp_server_windows.cc +68 -29
  220. data/src/core/lib/iomgr/tcp_windows.cc +7 -7
  221. data/src/core/lib/iomgr/timer_generic.cc +2 -2
  222. data/src/core/lib/iomgr/timer_manager.cc +2 -2
  223. data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -2
  224. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +2 -2
  225. data/src/core/lib/promise/activity.cc +2 -2
  226. data/src/core/lib/promise/activity.h +6 -6
  227. data/src/core/lib/promise/context.h +2 -2
  228. data/src/core/lib/promise/detail/join_state.h +9 -9
  229. data/src/core/lib/promise/detail/seq_state.h +13 -13
  230. data/src/core/lib/promise/detail/status.h +2 -2
  231. data/src/core/lib/promise/for_each.h +5 -5
  232. data/src/core/lib/promise/interceptor_list.h +2 -2
  233. data/src/core/lib/promise/latch.h +7 -7
  234. data/src/core/lib/promise/mpsc.cc +26 -26
  235. data/src/core/lib/promise/mpsc.h +2 -2
  236. data/src/core/lib/promise/observable.h +4 -4
  237. data/src/core/lib/promise/party.cc +32 -25
  238. data/src/core/lib/promise/party.h +16 -19
  239. data/src/core/lib/promise/pipe.h +15 -15
  240. data/src/core/lib/promise/poll.h +5 -4
  241. data/src/core/lib/promise/promise.h +0 -2
  242. data/src/core/lib/promise/sleep.cc +3 -1
  243. data/src/core/lib/promise/status_flag.h +7 -7
  244. data/src/core/lib/promise/try_join.h +2 -2
  245. data/src/core/lib/promise/try_seq.h +2 -2
  246. data/src/core/lib/resource_quota/arena.h +15 -2
  247. data/src/core/lib/resource_quota/connection_quota.cc +9 -7
  248. data/src/core/lib/resource_quota/memory_quota.cc +45 -24
  249. data/src/core/lib/resource_quota/memory_quota.h +48 -16
  250. data/src/core/lib/resource_quota/telemetry.h +54 -0
  251. data/src/core/lib/resource_quota/thread_quota.cc +2 -2
  252. data/src/core/lib/resource_tracker/resource_tracker.cc +33 -0
  253. data/src/core/lib/resource_tracker/resource_tracker.h +46 -0
  254. data/src/core/lib/security/authorization/audit_logging.cc +5 -5
  255. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +2 -2
  256. data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
  257. data/src/core/lib/surface/byte_buffer_reader.cc +2 -2
  258. data/src/core/lib/surface/call.cc +16 -14
  259. data/src/core/lib/surface/call.h +1 -1
  260. data/src/core/lib/surface/call_utils.cc +2 -2
  261. data/src/core/lib/surface/call_utils.h +2 -2
  262. data/src/core/lib/surface/channel.cc +4 -4
  263. data/src/core/lib/surface/channel_create.cc +10 -6
  264. data/src/core/lib/surface/channel_init.cc +80 -23
  265. data/src/core/lib/surface/channel_init.h +26 -11
  266. data/src/core/lib/surface/completion_queue.cc +17 -16
  267. data/src/core/lib/surface/completion_queue_factory.cc +7 -7
  268. data/src/core/lib/surface/connection_context.h +45 -2
  269. data/src/core/lib/surface/filter_stack_call.cc +12 -23
  270. data/src/core/lib/surface/filter_stack_call.h +3 -4
  271. data/src/core/lib/surface/legacy_channel.cc +7 -7
  272. data/src/core/lib/surface/validate_metadata.h +2 -2
  273. data/src/core/lib/surface/version.cc +2 -2
  274. data/src/core/lib/transport/bdp_estimator.cc +2 -2
  275. data/src/core/lib/transport/bdp_estimator.h +3 -3
  276. data/src/core/lib/transport/promise_endpoint.cc +3 -3
  277. data/src/core/lib/transport/promise_endpoint.h +8 -8
  278. data/src/core/lib/transport/timeout_encoding.cc +4 -4
  279. data/src/core/load_balancing/child_policy_handler.cc +4 -4
  280. data/src/core/load_balancing/endpoint_list.cc +2 -2
  281. data/src/core/load_balancing/grpclb/grpclb.cc +24 -24
  282. data/src/core/load_balancing/health_check_client.cc +4 -4
  283. data/src/core/load_balancing/health_check_client_internal.h +2 -2
  284. data/src/core/load_balancing/lb_policy_registry.cc +2 -2
  285. data/src/core/load_balancing/oob_backend_metric.cc +4 -4
  286. data/src/core/load_balancing/oob_backend_metric_internal.h +2 -2
  287. data/src/core/load_balancing/outlier_detection/outlier_detection.cc +2 -2
  288. data/src/core/load_balancing/pick_first/pick_first.cc +14 -14
  289. data/src/core/load_balancing/priority/priority.cc +23 -24
  290. data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -3
  291. data/src/core/load_balancing/rls/rls.cc +13 -13
  292. data/src/core/load_balancing/round_robin/round_robin.cc +9 -9
  293. data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +3 -3
  294. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -26
  295. data/src/core/load_balancing/weighted_target/weighted_target.cc +5 -5
  296. data/src/core/load_balancing/xds/cds.cc +76 -32
  297. data/src/core/load_balancing/xds/xds_cluster_impl.cc +3 -3
  298. data/src/core/load_balancing/xds/xds_override_host.cc +4 -4
  299. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
  300. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +33 -33
  301. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +10 -10
  302. data/src/core/resolver/dns/dns_resolver_plugin.cc +6 -3
  303. data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +2 -2
  304. data/src/core/resolver/endpoint_addresses.cc +3 -3
  305. data/src/core/resolver/endpoint_addresses.h +3 -0
  306. data/src/core/resolver/fake/fake_resolver.cc +2 -2
  307. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +41 -54
  308. data/src/core/resolver/polling_resolver.cc +3 -3
  309. data/src/core/resolver/resolver_registry.cc +5 -4
  310. data/src/core/resolver/xds/xds_dependency_manager.cc +5 -5
  311. data/src/core/resolver/xds/xds_resolver.cc +9 -9
  312. data/src/core/server/server.cc +38 -38
  313. data/src/core/server/server_call_tracer_filter.h +4 -4
  314. data/src/core/server/server_config_selector_filter.cc +2 -2
  315. data/src/core/server/xds_server_config_fetcher.cc +9 -8
  316. data/src/core/service_config/service_config_impl.h +2 -2
  317. data/src/core/telemetry/call_tracer.cc +39 -49
  318. data/src/core/telemetry/call_tracer.h +199 -22
  319. data/src/core/telemetry/histogram.h +205 -0
  320. data/src/core/telemetry/instrument.cc +719 -0
  321. data/src/core/telemetry/instrument.h +932 -0
  322. data/src/core/telemetry/metrics.cc +13 -5
  323. data/src/core/telemetry/metrics.h +3 -1
  324. data/src/core/telemetry/stats_data.cc +0 -19
  325. data/src/core/telemetry/stats_data.h +0 -19
  326. data/src/core/transport/auth_context.cc +2 -2
  327. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +78 -45
  328. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -0
  329. data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +3 -3
  330. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +39 -31
  331. data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +3 -3
  332. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +3 -3
  333. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +7 -7
  334. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +3 -3
  335. data/src/core/tsi/fake_transport_security.cc +4 -4
  336. data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +4 -4
  337. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +9 -9
  338. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +3 -3
  339. data/src/core/tsi/ssl_transport_security.cc +26 -25
  340. data/src/core/tsi/ssl_transport_security_utils.cc +9 -9
  341. data/src/core/util/chunked_vector.h +4 -4
  342. data/src/core/util/event_log.cc +2 -2
  343. data/src/core/util/gcp_metadata_query.cc +2 -2
  344. data/src/core/util/grpc_check.cc +22 -0
  345. data/src/core/util/grpc_check.h +103 -0
  346. data/src/core/util/http_client/httpcli.cc +3 -3
  347. data/src/core/util/http_client/parser.cc +4 -4
  348. data/src/core/util/latent_see.h +7 -4
  349. data/src/core/util/lru_cache.h +4 -4
  350. data/src/core/util/memory_usage.h +16 -0
  351. data/src/core/util/posix/directory_reader.cc +3 -2
  352. data/src/core/util/posix/sync.cc +24 -24
  353. data/src/core/util/postmortem_emit.cc +52 -0
  354. data/src/core/util/postmortem_emit.h +30 -0
  355. data/src/core/util/ref_counted_ptr.h +5 -0
  356. data/src/core/util/trie_lookup.h +170 -0
  357. data/src/core/util/unique_ptr_with_bitset.h +5 -5
  358. data/src/core/xds/grpc/xds_bootstrap_grpc.h +6 -1
  359. data/src/core/xds/grpc/xds_certificate_provider.cc +3 -3
  360. data/src/core/xds/grpc/xds_client_grpc.cc +34 -15
  361. data/src/core/xds/grpc/xds_client_grpc.h +4 -1
  362. data/src/core/xds/grpc/xds_cluster_parser.cc +2 -2
  363. data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
  364. data/src/core/xds/grpc/xds_endpoint_parser.cc +2 -2
  365. data/src/core/xds/grpc/xds_http_filter_registry.cc +4 -3
  366. data/src/core/xds/grpc/xds_listener_parser.cc +3 -3
  367. data/src/core/xds/grpc/xds_matcher.cc +277 -0
  368. data/src/core/xds/grpc/xds_matcher.h +432 -0
  369. data/src/core/xds/grpc/xds_matcher_action.cc +47 -0
  370. data/src/core/xds/grpc/xds_matcher_action.h +48 -0
  371. data/src/core/xds/grpc/xds_matcher_context.cc +29 -0
  372. data/src/core/xds/grpc/xds_matcher_context.h +46 -0
  373. data/src/core/xds/grpc/xds_matcher_input.cc +79 -0
  374. data/src/core/xds/grpc/xds_matcher_input.h +105 -0
  375. data/src/core/xds/grpc/xds_matcher_parse.cc +356 -0
  376. data/src/core/xds/grpc/xds_matcher_parse.h +39 -0
  377. data/src/core/xds/grpc/xds_metadata.cc +4 -3
  378. data/src/core/xds/grpc/xds_route_config_parser.cc +6 -6
  379. data/src/core/xds/grpc/xds_routing.cc +3 -3
  380. data/src/core/xds/grpc/xds_transport_grpc.cc +10 -10
  381. data/src/core/xds/xds_client/lrs_client.cc +6 -6
  382. data/src/core/xds/xds_client/xds_client.cc +9 -9
  383. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -2
  384. data/src/ruby/lib/grpc/version.rb +1 -1
  385. data/third_party/abseil-cpp/absl/container/internal/node_slot_policy.h +95 -0
  386. data/third_party/abseil-cpp/absl/container/node_hash_map.h +687 -0
  387. metadata +37 -2
@@ -45,7 +45,6 @@
45
45
  #include <grpc/support/string_util.h>
46
46
  #include <grpc/support/time.h>
47
47
 
48
- #include "absl/log/check.h"
49
48
  #include "absl/log/log.h"
50
49
  #include "absl/status/status.h"
51
50
  #include "absl/status/statusor.h"
@@ -61,6 +60,7 @@
61
60
  #include "src/core/lib/slice/slice.h"
62
61
  #include "src/core/lib/slice/slice_internal.h"
63
62
  #include "src/core/tsi/ssl_types.h"
63
+ #include "src/core/util/grpc_check.h"
64
64
  #include "src/core/util/http_client/httpcli.h"
65
65
  #include "src/core/util/http_client/httpcli_ssl_credentials.h"
66
66
  #include "src/core/util/http_client/parser.h"
@@ -311,7 +311,7 @@ grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims* claims,
311
311
  gpr_timespec skewed_now;
312
312
  int audience_ok;
313
313
 
314
- CHECK_NE(claims, nullptr);
314
+ GRPC_CHECK_NE(claims, nullptr);
315
315
 
316
316
  skewed_now =
317
317
  gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_clock_skew);
@@ -455,7 +455,7 @@ static EVP_PKEY* extract_pkey_from_x509(const char* x509_str) {
455
455
  EVP_PKEY* result = nullptr;
456
456
  BIO* bio = BIO_new(BIO_s_mem());
457
457
  size_t len = strlen(x509_str);
458
- CHECK_LT(len, static_cast<size_t>(INT_MAX));
458
+ GRPC_CHECK_LT(len, static_cast<size_t>(INT_MAX));
459
459
  BIO_write(bio, x509_str, static_cast<int>(len));
460
460
  x509 = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr);
461
461
  if (x509 == nullptr) {
@@ -526,8 +526,8 @@ static EVP_PKEY* pkey_from_jwk(const Json& json, const char* kty) {
526
526
  BIGNUM* tmp_e = nullptr;
527
527
  Json::Object::const_iterator it;
528
528
 
529
- CHECK(json.type() == Json::Type::kObject);
530
- CHECK_NE(kty, nullptr);
529
+ GRPC_CHECK(json.type() == Json::Type::kObject);
530
+ GRPC_CHECK_NE(kty, nullptr);
531
531
  if (strcmp(kty, "RSA") != 0) {
532
532
  LOG(ERROR) << "Unsupported key type " << kty;
533
533
  goto end;
@@ -652,7 +652,7 @@ static int verify_jwt_signature(EVP_PKEY* key, const char* alg,
652
652
  const EVP_MD* md = evp_md_from_alg(alg);
653
653
  int result = 0;
654
654
 
655
- CHECK_NE(md, nullptr); // Checked before.
655
+ GRPC_CHECK_NE(md, nullptr); // Checked before.
656
656
  if (md_ctx == nullptr) {
657
657
  LOG(ERROR) << "Could not create EVP_MD_CTX.";
658
658
  goto end;
@@ -791,7 +791,7 @@ static email_key_mapping* verifier_get_mapping(grpc_jwt_verifier* v,
791
791
  static void verifier_put_mapping(grpc_jwt_verifier* v, const char* email_domain,
792
792
  const char* key_url_prefix) {
793
793
  email_key_mapping* mapping = verifier_get_mapping(v, email_domain);
794
- CHECK(v->num_mappings < v->allocated_mappings);
794
+ GRPC_CHECK(v->num_mappings < v->allocated_mappings);
795
795
  if (mapping != nullptr) {
796
796
  gpr_free(mapping->key_url_prefix);
797
797
  mapping->key_url_prefix = gpr_strdup(key_url_prefix);
@@ -800,7 +800,7 @@ static void verifier_put_mapping(grpc_jwt_verifier* v, const char* email_domain,
800
800
  v->mappings[v->num_mappings].email_domain = gpr_strdup(email_domain);
801
801
  v->mappings[v->num_mappings].key_url_prefix = gpr_strdup(key_url_prefix);
802
802
  v->num_mappings++;
803
- CHECK(v->num_mappings <= v->allocated_mappings);
803
+ GRPC_CHECK(v->num_mappings <= v->allocated_mappings);
804
804
  }
805
805
 
806
806
  // Very non-sophisticated way to detect an email address. Should be good
@@ -812,7 +812,7 @@ const char* grpc_jwt_issuer_email_domain(const char* issuer) {
812
812
  if (*email_domain == '\0') return nullptr;
813
813
  const char* dot = strrchr(email_domain, '.');
814
814
  if (dot == nullptr || dot == email_domain) return email_domain;
815
- CHECK(dot > email_domain);
815
+ GRPC_CHECK(dot > email_domain);
816
816
  // There may be a subdomain, we just want the domain.
817
817
  dot = static_cast<const char*>(
818
818
  gpr_memrchr(email_domain, '.', static_cast<size_t>(dot - email_domain)));
@@ -833,7 +833,8 @@ static void retrieve_key_and_verify(verifier_cb_ctx* ctx) {
833
833
  char* path;
834
834
  absl::StatusOr<grpc_core::URI> uri;
835
835
 
836
- CHECK(ctx != nullptr && ctx->header != nullptr && ctx->claims != nullptr);
836
+ GRPC_CHECK(ctx != nullptr && ctx->header != nullptr &&
837
+ ctx->claims != nullptr);
837
838
  iss = ctx->claims->iss;
838
839
  if (ctx->header->kid == nullptr) {
839
840
  LOG(ERROR) << "Missing kid in jose header.";
@@ -852,7 +853,7 @@ static void retrieve_key_and_verify(verifier_cb_ctx* ctx) {
852
853
  email_domain = grpc_jwt_issuer_email_domain(iss);
853
854
  if (email_domain != nullptr) {
854
855
  email_key_mapping* mapping;
855
- CHECK_NE(ctx->verifier, nullptr);
856
+ GRPC_CHECK_NE(ctx->verifier, nullptr);
856
857
  mapping = verifier_get_mapping(ctx->verifier, email_domain);
857
858
  if (mapping == nullptr) {
858
859
  LOG(ERROR) << "Missing mapping for issuer email.";
@@ -919,8 +920,8 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier* verifier,
919
920
  Json json;
920
921
  std::string signature_str;
921
922
 
922
- CHECK(verifier != nullptr && jwt != nullptr && audience != nullptr &&
923
- cb != nullptr);
923
+ GRPC_CHECK(verifier != nullptr && jwt != nullptr && audience != nullptr &&
924
+ cb != nullptr);
924
925
  dot = strchr(cur, '.');
925
926
  if (dot == nullptr) goto error;
926
927
  json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur));
@@ -35,7 +35,6 @@
35
35
  #include <memory>
36
36
  #include <vector>
37
37
 
38
- #include "absl/log/check.h"
39
38
  #include "absl/log/log.h"
40
39
  #include "absl/status/status.h"
41
40
  #include "absl/strings/numbers.h"
@@ -53,6 +52,7 @@
53
52
  #include "src/core/lib/promise/poll.h"
54
53
  #include "src/core/lib/promise/promise.h"
55
54
  #include "src/core/lib/transport/error_utils.h"
55
+ #include "src/core/util/grpc_check.h"
56
56
  #include "src/core/util/http_client/httpcli_ssl_credentials.h"
57
57
  #include "src/core/util/json/json.h"
58
58
  #include "src/core/util/json/json_reader.h"
@@ -293,6 +293,9 @@ class grpc_compute_engine_token_fetcher_credentials
293
293
  : public grpc_core::Oauth2TokenFetcherCredentials {
294
294
  public:
295
295
  grpc_compute_engine_token_fetcher_credentials() = default;
296
+ explicit grpc_compute_engine_token_fetcher_credentials(
297
+ std::vector<grpc_core::URI::QueryParam> query_params)
298
+ : query_params_(std::move(query_params)) {}
296
299
  ~grpc_compute_engine_token_fetcher_credentials() override = default;
297
300
 
298
301
  std::string debug_string() override {
@@ -317,8 +320,8 @@ class grpc_compute_engine_token_fetcher_credentials
317
320
  auto uri = grpc_core::URI::Create("http", /*user_info=*/"",
318
321
  GRPC_COMPUTE_ENGINE_METADATA_HOST,
319
322
  GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH,
320
- {} /* query params */, "" /* fragment */);
321
- CHECK(uri.ok()); // params are hardcoded
323
+ query_params_, "" /* fragment */);
324
+ GRPC_CHECK(uri.ok()); // params are hardcoded
322
325
  auto http_request = grpc_core::HttpRequest::Get(
323
326
  std::move(*uri), /*args=*/nullptr, pollent, &request, deadline,
324
327
  on_complete, response,
@@ -327,17 +330,22 @@ class grpc_compute_engine_token_fetcher_credentials
327
330
  http_request->Start();
328
331
  return http_request;
329
332
  }
330
- };
331
333
 
334
+ std::vector<grpc_core::URI::QueryParam> query_params_;
335
+ };
332
336
  } // namespace
333
337
 
334
338
  grpc_call_credentials* grpc_google_compute_engine_credentials_create(
335
- void* reserved) {
339
+ grpc_google_compute_engine_credentials_options* options) {
336
340
  GRPC_TRACE_LOG(api, INFO)
337
- << "grpc_compute_engine_credentials_create(reserved=" << reserved << ")";
338
- CHECK_EQ(reserved, nullptr);
341
+ << "grpc_compute_engine_credentials_create(options=" << options << ")";
342
+ std::vector<grpc_core::URI::QueryParam> query_params;
343
+ if (options != nullptr && options->alts_hard_bound) {
344
+ query_params.push_back({"transport", "alts"});
345
+ }
339
346
  return grpc_core::MakeRefCounted<
340
- grpc_compute_engine_token_fetcher_credentials>()
347
+ grpc_compute_engine_token_fetcher_credentials>(
348
+ std::move(query_params))
341
349
  .release();
342
350
  }
343
351
 
@@ -377,7 +385,7 @@ grpc_google_refresh_token_credentials::StartHttpRequest(
377
385
  GRPC_GOOGLE_OAUTH2_SERVICE_HOST,
378
386
  GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH,
379
387
  {} /* query params */, "" /* fragment */);
380
- CHECK(uri.ok()); // params are hardcoded
388
+ GRPC_CHECK(uri.ok()); // params are hardcoded
381
389
  auto http_request = grpc_core::HttpRequest::Post(
382
390
  std::move(*uri), /*args=*/nullptr, pollent, &request, deadline,
383
391
  on_complete, response, grpc_core::CreateHttpRequestSSLCredentials());
@@ -426,7 +434,7 @@ grpc_call_credentials* grpc_google_refresh_token_credentials_create(
426
434
  << "grpc_refresh_token_credentials_create(json_refresh_token="
427
435
  << create_loggable_refresh_token(&token) << ", reserved=" << reserved
428
436
  << ")";
429
- CHECK_EQ(reserved, nullptr);
437
+ GRPC_CHECK_EQ(reserved, nullptr);
430
438
  return grpc_refresh_token_credentials_create_from_auth_refresh_token(token)
431
439
  .release();
432
440
  }
@@ -604,7 +612,7 @@ absl::StatusOr<URI> ValidateStsCredentialsOptions(
604
612
 
605
613
  grpc_call_credentials* grpc_sts_credentials_create(
606
614
  const grpc_sts_credentials_options* options, void* reserved) {
607
- CHECK_EQ(reserved, nullptr);
615
+ GRPC_CHECK_EQ(reserved, nullptr);
608
616
  absl::StatusOr<grpc_core::URI> sts_url =
609
617
  grpc_core::ValidateStsCredentialsOptions(options);
610
618
  if (!sts_url.ok()) {
@@ -650,7 +658,7 @@ grpc_call_credentials* grpc_access_token_credentials_create(
650
658
  GRPC_TRACE_LOG(api, INFO) << "grpc_access_token_credentials_create(access_"
651
659
  "token=<redacted>, reserved="
652
660
  << reserved << ")";
653
- CHECK_EQ(reserved, nullptr);
661
+ GRPC_CHECK_EQ(reserved, nullptr);
654
662
  return grpc_core::MakeRefCounted<grpc_access_token_credentials>(access_token)
655
663
  .release();
656
664
  }
@@ -24,7 +24,6 @@
24
24
  #include <atomic>
25
25
  #include <memory>
26
26
 
27
- #include "absl/log/check.h"
28
27
  #include "absl/log/log.h"
29
28
  #include "absl/status/status.h"
30
29
  #include "absl/strings/str_cat.h"
@@ -36,6 +35,7 @@
36
35
  #include "src/core/lib/slice/slice.h"
37
36
  #include "src/core/lib/slice/slice_internal.h"
38
37
  #include "src/core/lib/surface/validate_metadata.h"
38
+ #include "src/core/util/grpc_check.h"
39
39
 
40
40
  grpc_plugin_credentials::~grpc_plugin_credentials() {
41
41
  if (plugin_.state != nullptr && plugin_.destroy != nullptr) {
@@ -196,6 +196,6 @@ grpc_call_credentials* grpc_metadata_credentials_create_from_plugin(
196
196
  GRPC_TRACE_LOG(api, INFO)
197
197
  << "grpc_metadata_credentials_create_from_plugin(reserved=" << reserved
198
198
  << ")";
199
- CHECK_EQ(reserved, nullptr);
199
+ GRPC_CHECK_EQ(reserved, nullptr);
200
200
  return new grpc_plugin_credentials(plugin, min_security_level);
201
201
  }
@@ -90,8 +90,8 @@ grpc_channel_credentials* grpc_alts_credentials_create_customized(
90
90
  const grpc_alts_credentials_options* options,
91
91
  const char* handshaker_service_url, bool enable_untrusted_alts) {
92
92
  if (!enable_untrusted_alts && !grpc_alts_is_running_on_gcp()) {
93
- LOG(ERROR) << "ALTS creds ignored. Not running on GCP and untrusted ALTS "
94
- "is not enabled.";
93
+ VLOG(1) << "ALTS creds ignored. Not running on GCP and untrusted ALTS "
94
+ "is not enabled.";
95
95
  return nullptr;
96
96
  }
97
97
  return new grpc_alts_credentials(options, handshaker_service_url);
@@ -101,8 +101,8 @@ grpc_server_credentials* grpc_alts_server_credentials_create_customized(
101
101
  const grpc_alts_credentials_options* options,
102
102
  const char* handshaker_service_url, bool enable_untrusted_alts) {
103
103
  if (!enable_untrusted_alts && !grpc_alts_is_running_on_gcp()) {
104
- LOG(ERROR) << "ALTS server creds ignored. Not running on GCP and untrusted "
105
- "ALTS is not enabled.";
104
+ VLOG(1) << "ALTS server creds ignored. Not running on GCP and untrusted "
105
+ "ALTS is not enabled.";
106
106
  return nullptr;
107
107
  }
108
108
  return new grpc_alts_server_credentials(options, handshaker_service_url);
@@ -31,7 +31,6 @@
31
31
  #include <optional>
32
32
  #include <utility>
33
33
 
34
- #include "absl/log/check.h"
35
34
  #include "absl/log/log.h"
36
35
  #include "absl/status/status.h"
37
36
  #include "absl/strings/string_view.h"
@@ -53,6 +52,7 @@
53
52
  #include "src/core/tsi/alts/handshaker/alts_tsi_handshaker.h"
54
53
  #include "src/core/tsi/transport_security.h"
55
54
  #include "src/core/util/debug_location.h"
55
+ #include "src/core/util/grpc_check.h"
56
56
  #include "src/core/util/ref_counted_ptr.h"
57
57
 
58
58
  void grpc_alts_set_rpc_protocol_versions(
@@ -102,11 +102,12 @@ class grpc_alts_channel_security_connector final
102
102
  static_cast<const grpc_alts_credentials*>(channel_creds());
103
103
  const size_t user_specified_max_frame_size =
104
104
  std::max(0, args.GetInt(GRPC_ARG_TSI_MAX_FRAME_SIZE).value_or(0));
105
- CHECK(alts_tsi_handshaker_create(
106
- creds->options(), target_name_, creds->handshaker_service_url(),
107
- true, interested_parties, &handshaker,
108
- user_specified_max_frame_size,
109
- args.GetOwnedString(GRPC_ARG_TRANSPORT_PROTOCOLS)) == TSI_OK);
105
+ GRPC_CHECK(alts_tsi_handshaker_create(
106
+ creds->options(), target_name_,
107
+ creds->handshaker_service_url(), true, interested_parties,
108
+ &handshaker, user_specified_max_frame_size,
109
+ args.GetOwnedString(GRPC_ARG_TRANSPORT_PROTOCOLS)) ==
110
+ TSI_OK);
110
111
  handshake_manager->Add(
111
112
  grpc_core::SecurityHandshakerCreate(handshaker, this, args));
112
113
  }
@@ -156,10 +157,11 @@ class grpc_alts_server_security_connector final
156
157
  static_cast<const grpc_alts_server_credentials*>(server_creds());
157
158
  size_t user_specified_max_frame_size =
158
159
  std::max(0, args.GetInt(GRPC_ARG_TSI_MAX_FRAME_SIZE).value_or(0));
159
- CHECK(alts_tsi_handshaker_create(
160
- creds->options(), nullptr, creds->handshaker_service_url(), false,
161
- interested_parties, &handshaker, user_specified_max_frame_size,
162
- args.GetOwnedString(GRPC_ARG_TRANSPORT_PROTOCOLS)) == TSI_OK);
160
+ GRPC_CHECK(
161
+ alts_tsi_handshaker_create(
162
+ creds->options(), nullptr, creds->handshaker_service_url(), false,
163
+ interested_parties, &handshaker, user_specified_max_frame_size,
164
+ args.GetOwnedString(GRPC_ARG_TRANSPORT_PROTOCOLS)) == TSI_OK);
163
165
  handshake_manager->Add(
164
166
  grpc_core::SecurityHandshakerCreate(handshaker, this, args));
165
167
  }
@@ -250,8 +252,8 @@ RefCountedPtr<grpc_auth_context> grpc_alts_auth_context_from_tsi_peer(
250
252
  grpc_auth_context_add_property(
251
253
  ctx.get(), TSI_ALTS_SERVICE_ACCOUNT_PEER_PROPERTY,
252
254
  tsi_prop->value.data, tsi_prop->value.length);
253
- CHECK(grpc_auth_context_set_peer_identity_property_name(
254
- ctx.get(), TSI_ALTS_SERVICE_ACCOUNT_PEER_PROPERTY) == 1);
255
+ GRPC_CHECK(grpc_auth_context_set_peer_identity_property_name(
256
+ ctx.get(), TSI_ALTS_SERVICE_ACCOUNT_PEER_PROPERTY) == 1);
255
257
  }
256
258
  // Add alts context to auth context.
257
259
  if (strcmp(tsi_prop->name, TSI_ALTS_CONTEXT) == 0) {
@@ -21,6 +21,10 @@
21
21
  #include <grpc/support/port_platform.h>
22
22
  #include <grpc/support/string_util.h>
23
23
 
24
+ #include <algorithm>
25
+ #include <memory>
26
+ #include <optional>
27
+
24
28
  #include "absl/log/log.h"
25
29
  #include "src/core/credentials/transport/alts/grpc_alts_credentials_options.h"
26
30
  #include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
@@ -70,8 +74,7 @@ static const grpc_alts_credentials_options_vtable vtable = {
70
74
 
71
75
  grpc_alts_credentials_options* grpc_alts_credentials_client_options_create(
72
76
  void) {
73
- auto client_options = static_cast<grpc_alts_credentials_client_options*>(
74
- gpr_zalloc(sizeof(grpc_alts_credentials_client_options)));
77
+ auto client_options = new grpc_alts_credentials_client_options();
75
78
  client_options->base.vtable = &vtable;
76
79
  return &client_options->base;
77
80
  }
@@ -101,12 +104,28 @@ static grpc_alts_credentials_options* alts_client_options_copy(
101
104
  prev = new_node;
102
105
  node = node->next;
103
106
  }
107
+
108
+ new_options->record_protocols = options->record_protocols;
109
+
110
+ new_client_options->token_fetcher =
111
+ reinterpret_cast<const grpc_alts_credentials_client_options*>(options)
112
+ ->token_fetcher;
104
113
  // Copy rpc protocol versions.
105
114
  grpc_gcp_rpc_protocol_versions_copy(&options->rpc_versions,
106
115
  &new_options->rpc_versions);
107
116
  return new_options;
108
117
  }
109
118
 
119
+ void grpc_alts_credentials_client_options_set_token_fetcher(
120
+ grpc_alts_credentials_options* options,
121
+ std::shared_ptr<grpc::alts::TokenFetcher> token_fetcher) {
122
+ if (options == nullptr) {
123
+ return;
124
+ }
125
+ reinterpret_cast<grpc_alts_credentials_client_options*>(options)
126
+ ->token_fetcher = token_fetcher;
127
+ }
128
+
110
129
  static void alts_client_options_destroy(
111
130
  grpc_alts_credentials_options* options) {
112
131
  if (options == nullptr) {
@@ -120,4 +139,5 @@ static void alts_client_options_destroy(
120
139
  target_service_account_destroy(node);
121
140
  node = next_node;
122
141
  }
142
+ delete client_options;
123
143
  }
@@ -40,6 +40,15 @@ void grpc_alts_credentials_options_destroy(
40
40
  if (options->vtable != nullptr && options->vtable->destruct != nullptr) {
41
41
  options->vtable->destruct(options);
42
42
  }
43
- gpr_free(options);
44
43
  }
45
44
  }
45
+
46
+ void grpc_alts_credentials_client_options_set_record_protocols(
47
+ grpc_alts_credentials_options* options,
48
+ const absl::Span<std::string> record_protocols) {
49
+ if (options == nullptr) {
50
+ return;
51
+ }
52
+ std::copy(record_protocols.begin(), record_protocols.end(),
53
+ std::back_inserter(options->record_protocols));
54
+ }
@@ -23,8 +23,29 @@
23
23
  #include <grpc/grpc_security.h>
24
24
  #include <grpc/support/port_platform.h>
25
25
 
26
+ #include <memory>
27
+ #include <string>
28
+ #include <vector>
29
+
30
+ #include "absl/status/statusor.h"
26
31
  #include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
27
32
 
33
+ namespace grpc::alts {
34
+
35
+ // Its implementation must be thread-safe.
36
+ class TokenFetcher {
37
+ public:
38
+ virtual ~TokenFetcher() = default;
39
+
40
+ // Thread-safe and non-blocking. The returned token must be strongly bound.
41
+ // Failure to comply with this requirement will result in a serious security
42
+ // issue. The token must also be valid for at least 9 hours to outlive an
43
+ // arbitrary ALTS connection.
44
+ virtual absl::StatusOr<std::string> GetToken() = 0;
45
+ };
46
+
47
+ } // namespace grpc::alts
48
+
28
49
  // V-table for grpc_alts_credentials_options
29
50
  typedef struct grpc_alts_credentials_options_vtable {
30
51
  grpc_alts_credentials_options* (*copy)(
@@ -35,6 +56,7 @@ typedef struct grpc_alts_credentials_options_vtable {
35
56
  struct grpc_alts_credentials_options {
36
57
  const struct grpc_alts_credentials_options_vtable* vtable;
37
58
  grpc_gcp_rpc_protocol_versions rpc_versions;
59
+ std::vector<std::string> record_protocols;
38
60
  };
39
61
 
40
62
  typedef struct target_service_account {
@@ -50,6 +72,7 @@ typedef struct target_service_account {
50
72
  typedef struct grpc_alts_credentials_client_options {
51
73
  grpc_alts_credentials_options base;
52
74
  target_service_account* target_account_list_head;
75
+ std::shared_ptr<grpc::alts::TokenFetcher> token_fetcher;
53
76
  } grpc_alts_credentials_client_options;
54
77
 
55
78
  ///
@@ -71,4 +94,12 @@ typedef struct grpc_alts_credentials_server_options {
71
94
  grpc_alts_credentials_options* grpc_alts_credentials_options_copy(
72
95
  const grpc_alts_credentials_options* options);
73
96
 
97
+ void grpc_alts_credentials_client_options_set_token_fetcher(
98
+ grpc_alts_credentials_options* options,
99
+ std::shared_ptr<grpc::alts::TokenFetcher> token_fetcher);
100
+
101
+ void grpc_alts_credentials_client_options_set_record_protocols(
102
+ grpc_alts_credentials_options* options,
103
+ const absl::Span<std::string> record_protocols);
104
+
74
105
  #endif // GRPC_SRC_CORE_CREDENTIALS_TRANSPORT_ALTS_GRPC_ALTS_CREDENTIALS_OPTIONS_H
@@ -27,7 +27,12 @@ static grpc_alts_credentials_options* alts_server_options_copy(
27
27
  const grpc_alts_credentials_options* options);
28
28
 
29
29
  static void alts_server_options_destroy(
30
- grpc_alts_credentials_options* /*options*/) {}
30
+ grpc_alts_credentials_options* options) {
31
+ if (options == nullptr) {
32
+ return;
33
+ }
34
+ delete reinterpret_cast<grpc_alts_credentials_server_options*>(options);
35
+ }
31
36
 
32
37
  static const grpc_alts_credentials_options_vtable vtable = {
33
38
  alts_server_options_copy, alts_server_options_destroy};
@@ -35,8 +40,7 @@ static const grpc_alts_credentials_options_vtable vtable = {
35
40
  grpc_alts_credentials_options* grpc_alts_credentials_server_options_create(
36
41
  void) {
37
42
  grpc_alts_credentials_server_options* server_options =
38
- static_cast<grpc_alts_credentials_server_options*>(
39
- gpr_zalloc(sizeof(*server_options)));
43
+ new grpc_alts_credentials_server_options();
40
44
  server_options->base.vtable = &vtable;
41
45
  return &server_options->base;
42
46
  }
@@ -51,5 +55,6 @@ static grpc_alts_credentials_options* alts_server_options_copy(
51
55
  // Copy rpc protocol versions.
52
56
  grpc_gcp_rpc_protocol_versions_copy(&options->rpc_versions,
53
57
  &new_options->rpc_versions);
58
+ new_options->record_protocols = options->record_protocols;
54
59
  return new_options;
55
60
  }
@@ -22,13 +22,13 @@
22
22
  #include <memory>
23
23
  #include <vector>
24
24
 
25
- #include "absl/log/check.h"
26
25
  #include "absl/strings/str_cat.h"
27
26
  #include "absl/strings/str_join.h"
28
27
  #include "src/core/call/metadata_batch.h"
29
28
  #include "src/core/credentials/call/composite/composite_call_credentials.h"
30
29
  #include "src/core/lib/debug/trace.h"
31
30
  #include "src/core/lib/promise/try_seq.h"
31
+ #include "src/core/util/grpc_check.h"
32
32
  #include "src/core/util/ref_counted_ptr.h"
33
33
 
34
34
  grpc_core::UniqueTypeName grpc_composite_channel_credentials::Type() {
@@ -40,8 +40,8 @@ grpc_core::RefCountedPtr<grpc_channel_security_connector>
40
40
  grpc_composite_channel_credentials::create_security_connector(
41
41
  grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,
42
42
  const char* target, grpc_core::ChannelArgs* args) {
43
- CHECK(inner_creds_ != nullptr);
44
- CHECK(call_creds_ != nullptr);
43
+ GRPC_CHECK(inner_creds_ != nullptr);
44
+ GRPC_CHECK(call_creds_ != nullptr);
45
45
  // If we are passed a call_creds, create a call composite to pass it
46
46
  // downstream.
47
47
  if (call_creds != nullptr) {
@@ -57,8 +57,8 @@ grpc_composite_channel_credentials::create_security_connector(
57
57
  grpc_channel_credentials* grpc_composite_channel_credentials_create(
58
58
  grpc_channel_credentials* channel_creds, grpc_call_credentials* call_creds,
59
59
  void* reserved) {
60
- CHECK(channel_creds != nullptr && call_creds != nullptr &&
61
- reserved == nullptr);
60
+ GRPC_CHECK(channel_creds != nullptr && call_creds != nullptr &&
61
+ reserved == nullptr);
62
62
  GRPC_TRACE_LOG(api, INFO)
63
63
  << "grpc_composite_channel_credentials_create(channel_creds="
64
64
  << channel_creds << ", call_creds=" << call_creds
@@ -30,7 +30,6 @@
30
30
  #include <string>
31
31
  #include <utility>
32
32
 
33
- #include "absl/log/check.h"
34
33
  #include "absl/log/log.h"
35
34
  #include "absl/status/status.h"
36
35
  #include "absl/strings/str_cat.h"
@@ -54,6 +53,7 @@
54
53
  #include "src/core/tsi/transport_security_interface.h"
55
54
  #include "src/core/util/crash.h"
56
55
  #include "src/core/util/debug_location.h"
56
+ #include "src/core/util/grpc_check.h"
57
57
  #include "src/core/util/host_port.h"
58
58
  #include "src/core/util/ref_counted_ptr.h"
59
59
  #include "src/core/util/string.h"
@@ -140,7 +140,7 @@ class grpc_fake_channel_security_connector final
140
140
 
141
141
  private:
142
142
  bool fake_check_target(const char* target, const char* set_str) const {
143
- CHECK_NE(target, nullptr);
143
+ GRPC_CHECK_NE(target, nullptr);
144
144
  char** set = nullptr;
145
145
  size_t set_size = 0;
146
146
  gpr_string_split(set_str, ",", &set, &set_size);