grpc 1.38.0 → 1.40.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (340) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +68 -21
  3. data/include/grpc/event_engine/endpoint_config.h +48 -0
  4. data/include/grpc/event_engine/event_engine.h +23 -29
  5. data/include/grpc/event_engine/port.h +2 -0
  6. data/include/grpc/event_engine/slice_allocator.h +21 -36
  7. data/include/grpc/grpc.h +9 -2
  8. data/include/grpc/grpc_security.h +32 -0
  9. data/include/grpc/grpc_security_constants.h +1 -0
  10. data/include/grpc/impl/codegen/grpc_types.h +33 -19
  11. data/include/grpc/impl/codegen/port_platform.h +41 -0
  12. data/src/core/ext/filters/client_channel/client_channel.cc +415 -249
  13. data/src/core/ext/filters/client_channel/client_channel.h +42 -18
  14. data/src/core/ext/filters/client_channel/config_selector.h +19 -6
  15. data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -0
  16. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  17. data/src/core/ext/filters/client_channel/http_proxy.cc +16 -1
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +7 -8
  19. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +12 -21
  20. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +3 -5
  21. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +734 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -0
  23. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +8 -15
  24. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +3 -6
  25. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +18 -36
  26. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +14 -22
  27. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +2 -9
  28. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +68 -103
  29. data/src/core/ext/filters/client_channel/lb_policy.cc +1 -15
  30. data/src/core/ext/filters/client_channel/lb_policy.h +70 -46
  31. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -3
  32. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_event_engine.cc +31 -0
  33. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_event_engine.cc +28 -0
  34. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -3
  35. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +7 -2
  36. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +116 -76
  37. data/src/core/ext/filters/client_channel/retry_filter.cc +967 -544
  38. data/src/core/ext/filters/client_channel/retry_service_config.cc +57 -28
  39. data/src/core/ext/filters/client_channel/retry_service_config.h +9 -3
  40. data/src/core/ext/filters/client_channel/service_config_call_data.h +45 -5
  41. data/src/core/ext/filters/client_idle/client_idle_filter.cc +1 -1
  42. data/src/core/ext/filters/http/client/http_client_filter.cc +5 -2
  43. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +2 -1
  44. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +5 -1
  45. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
  46. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +1 -1
  47. data/src/core/{lib/event_engine/slice_allocator.cc → ext/transport/chttp2/transport/chttp2_slice_allocator.cc} +23 -16
  48. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +74 -0
  49. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +12 -10
  50. data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
  51. data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -4
  52. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +8 -8
  53. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +5 -5
  54. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +639 -752
  55. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +190 -69
  56. data/src/core/ext/transport/chttp2/transport/internal.h +2 -1
  57. data/src/core/ext/transport/chttp2/transport/parsing.cc +72 -56
  58. data/src/core/ext/transport/chttp2/transport/varint.cc +6 -4
  59. data/src/core/ext/transport/inproc/inproc_transport.cc +42 -31
  60. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +56 -35
  61. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +180 -76
  62. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +35 -27
  63. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +97 -48
  64. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +45 -9
  65. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +67 -7
  66. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +66 -9
  67. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +227 -0
  68. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +46 -0
  69. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +121 -0
  70. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +1 -0
  71. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +35 -0
  72. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +90 -0
  73. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +32 -24
  74. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +120 -73
  75. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +4 -2
  76. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +15 -0
  77. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +48 -0
  78. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +171 -0
  79. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +8 -6
  80. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +27 -19
  81. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +1 -0
  82. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +24 -7
  83. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +57 -0
  84. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +29 -17
  85. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +72 -0
  86. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +3 -2
  87. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +4 -0
  88. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +6 -5
  89. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +15 -11
  90. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +85 -43
  91. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +274 -91
  92. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +11 -8
  93. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +30 -13
  94. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +33 -5
  95. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +115 -0
  96. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +60 -0
  97. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +181 -0
  98. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +1 -0
  99. data/src/core/ext/upb-generated/validate/validate.upb.c +82 -66
  100. data/src/core/ext/upb-generated/validate/validate.upb.h +220 -124
  101. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +15 -7
  102. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +53 -52
  103. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +318 -277
  104. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +5 -0
  105. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +437 -410
  106. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +198 -170
  107. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +10 -0
  108. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +9 -8
  109. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +219 -163
  110. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +15 -0
  111. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.c +59 -0
  112. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.h +40 -0
  113. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +29 -25
  114. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.c +52 -0
  115. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.h +35 -0
  116. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +135 -125
  117. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +5 -0
  118. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +131 -123
  119. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +90 -0
  120. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.h +35 -0
  121. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +32 -24
  122. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +69 -55
  123. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +5 -0
  124. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +684 -664
  125. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +5 -0
  126. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +13 -10
  127. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +13 -10
  128. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +441 -375
  129. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +10 -0
  130. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +122 -114
  131. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +1 -1
  132. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +112 -79
  133. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +5 -0
  134. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.c +64 -0
  135. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.h +50 -0
  136. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +35 -32
  137. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +4 -4
  138. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +182 -160
  139. data/src/core/ext/xds/certificate_provider_store.h +1 -1
  140. data/src/core/ext/xds/xds_api.cc +582 -257
  141. data/src/core/ext/xds/xds_api.h +46 -8
  142. data/src/core/ext/xds/xds_bootstrap.cc +4 -1
  143. data/src/core/ext/xds/xds_client.cc +66 -43
  144. data/src/core/ext/xds/xds_client.h +0 -4
  145. data/src/core/ext/xds/xds_http_filters.cc +3 -2
  146. data/src/core/ext/xds/xds_http_filters.h +3 -0
  147. data/src/core/lib/address_utils/sockaddr_utils.cc +13 -0
  148. data/src/core/lib/address_utils/sockaddr_utils.h +10 -0
  149. data/src/core/lib/channel/call_tracer.h +85 -0
  150. data/src/core/lib/channel/channel_stack.h +1 -1
  151. data/src/core/lib/channel/channelz.h +3 -0
  152. data/src/core/lib/channel/context.h +3 -0
  153. data/src/core/lib/channel/status_util.h +4 -0
  154. data/src/core/lib/compression/stream_compression.h +1 -1
  155. data/src/core/lib/compression/stream_compression_gzip.h +1 -1
  156. data/src/core/lib/compression/stream_compression_identity.h +1 -1
  157. data/src/core/lib/debug/stats.h +1 -1
  158. data/src/core/lib/event_engine/endpoint_config.cc +46 -0
  159. data/src/core/lib/event_engine/endpoint_config_internal.h +42 -0
  160. data/src/core/lib/event_engine/event_engine.cc +50 -0
  161. data/src/core/lib/event_engine/sockaddr.cc +14 -12
  162. data/src/core/lib/event_engine/sockaddr.h +44 -0
  163. data/src/core/lib/gpr/murmur_hash.cc +4 -2
  164. data/src/core/lib/gpr/wrap_memcpy.cc +2 -1
  165. data/src/core/lib/gprpp/manual_constructor.h +1 -1
  166. data/src/core/lib/gprpp/orphanable.h +3 -3
  167. data/src/core/lib/gprpp/status_helper.h +3 -0
  168. data/src/core/lib/gprpp/sync.h +2 -30
  169. data/src/core/lib/iomgr/buffer_list.cc +1 -1
  170. data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +33 -0
  171. data/src/core/lib/iomgr/error.cc +5 -4
  172. data/src/core/lib/iomgr/error.h +1 -1
  173. data/src/core/lib/iomgr/ev_apple.h +1 -1
  174. data/src/core/lib/iomgr/event_engine/closure.cc +54 -0
  175. data/src/core/lib/iomgr/event_engine/closure.h +33 -0
  176. data/src/core/lib/iomgr/event_engine/endpoint.cc +192 -0
  177. data/src/core/lib/iomgr/event_engine/endpoint.h +53 -0
  178. data/src/core/lib/iomgr/event_engine/iomgr.cc +105 -0
  179. data/src/core/lib/iomgr/event_engine/iomgr.h +24 -0
  180. data/src/core/lib/iomgr/event_engine/pollset.cc +87 -0
  181. data/{include/grpc/event_engine/channel_args.h → src/core/lib/iomgr/event_engine/pollset.h} +7 -10
  182. data/src/core/lib/iomgr/event_engine/promise.h +51 -0
  183. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +41 -0
  184. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +35 -0
  185. data/src/core/lib/iomgr/event_engine/resolver.cc +110 -0
  186. data/src/core/lib/iomgr/event_engine/tcp.cc +263 -0
  187. data/src/core/lib/iomgr/event_engine/timer.cc +57 -0
  188. data/src/core/lib/iomgr/exec_ctx.cc +8 -0
  189. data/src/core/lib/iomgr/exec_ctx.h +3 -4
  190. data/src/core/lib/iomgr/executor/threadpool.cc +2 -3
  191. data/src/core/lib/iomgr/executor/threadpool.h +2 -2
  192. data/src/core/lib/iomgr/iomgr.cc +1 -1
  193. data/src/core/lib/iomgr/iomgr_posix.cc +2 -0
  194. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +40 -10
  195. data/src/core/lib/iomgr/pollset_custom.cc +2 -2
  196. data/src/core/lib/iomgr/pollset_custom.h +3 -1
  197. data/src/core/lib/iomgr/pollset_uv.cc +3 -1
  198. data/src/core/lib/iomgr/pollset_uv.h +5 -1
  199. data/src/core/lib/iomgr/port.h +7 -5
  200. data/src/core/lib/iomgr/python_util.h +1 -1
  201. data/src/core/lib/iomgr/resolve_address.cc +5 -1
  202. data/src/core/lib/iomgr/resolve_address.h +6 -0
  203. data/src/core/lib/iomgr/resource_quota.cc +2 -0
  204. data/src/core/lib/iomgr/sockaddr.h +1 -0
  205. data/src/core/lib/iomgr/socket_mutator.cc +15 -2
  206. data/src/core/lib/iomgr/socket_mutator.h +26 -2
  207. data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -4
  208. data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
  209. data/src/core/lib/iomgr/tcp_client_posix.cc +7 -2
  210. data/src/core/lib/iomgr/tcp_client_windows.cc +2 -0
  211. data/src/core/lib/iomgr/tcp_posix.cc +42 -39
  212. data/src/core/lib/iomgr/tcp_posix.h +8 -0
  213. data/src/core/lib/iomgr/tcp_server_custom.cc +3 -4
  214. data/src/core/lib/iomgr/tcp_server_posix.cc +7 -0
  215. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +2 -1
  216. data/src/core/lib/iomgr/timer.h +6 -1
  217. data/src/core/lib/iomgr/timer_manager.cc +1 -1
  218. data/src/core/lib/json/json_reader.cc +1 -2
  219. data/src/core/lib/matchers/matchers.cc +8 -20
  220. data/src/core/lib/matchers/matchers.h +2 -1
  221. data/src/core/lib/security/authorization/authorization_engine.h +44 -0
  222. data/src/core/lib/security/authorization/authorization_policy_provider.h +32 -0
  223. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +46 -0
  224. data/src/core/lib/security/authorization/evaluate_args.cc +209 -0
  225. data/src/core/lib/security/authorization/evaluate_args.h +91 -0
  226. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +3 -1
  227. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +49 -0
  228. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +7 -0
  229. data/src/core/lib/security/credentials/tls/tls_utils.cc +32 -0
  230. data/src/core/lib/security/credentials/tls/tls_utils.h +13 -0
  231. data/src/core/lib/security/security_connector/local/local_security_connector.cc +9 -6
  232. data/src/core/lib/security/security_connector/ssl_utils.cc +5 -0
  233. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +6 -18
  234. data/src/core/lib/security/transport/security_handshaker.cc +12 -4
  235. data/src/core/lib/security/transport/server_auth_filter.cc +0 -7
  236. data/src/core/lib/slice/slice.cc +12 -2
  237. data/src/core/lib/slice/slice_internal.h +1 -0
  238. data/src/core/lib/surface/call.cc +26 -7
  239. data/src/core/lib/surface/call.h +11 -0
  240. data/src/core/lib/surface/completion_queue.cc +22 -22
  241. data/src/core/lib/surface/completion_queue.h +1 -1
  242. data/src/core/lib/surface/completion_queue_factory.cc +1 -2
  243. data/src/core/lib/surface/init.cc +1 -3
  244. data/src/core/lib/surface/init.h +10 -1
  245. data/src/core/lib/surface/server.cc +3 -1
  246. data/src/core/lib/surface/server.h +3 -3
  247. data/src/core/lib/surface/version.cc +2 -4
  248. data/src/core/lib/transport/error_utils.cc +2 -2
  249. data/src/core/lib/transport/metadata_batch.cc +13 -2
  250. data/src/core/lib/transport/metadata_batch.h +7 -0
  251. data/src/core/lib/transport/transport.h +2 -0
  252. data/src/core/lib/transport/transport_op_string.cc +1 -1
  253. data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
  254. data/src/core/tsi/alts/crypt/gsec.h +2 -0
  255. data/src/ruby/ext/grpc/extconf.rb +2 -0
  256. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +6 -0
  257. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +10 -1
  258. data/src/ruby/lib/grpc/version.rb +1 -1
  259. data/third_party/boringssl-with-bazel/err_data.c +269 -263
  260. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +8 -6
  261. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +4 -0
  262. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +1 -1
  263. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
  264. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +9 -0
  265. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.c +0 -4
  266. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +7 -0
  267. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +87 -121
  268. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +20 -30
  269. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +19 -30
  270. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -4
  271. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +0 -13
  272. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +26 -24
  273. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +10 -7
  274. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +28 -39
  275. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +48 -66
  276. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +4 -5
  277. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +362 -371
  278. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +4 -2
  279. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +2 -2
  280. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_asn1.c +1 -2
  281. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +101 -11
  282. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +3 -0
  283. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +2 -2
  284. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +3 -0
  285. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +1 -1
  286. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +2 -0
  287. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +14 -15
  288. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +53 -73
  289. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +31 -0
  290. data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.c +3 -0
  291. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +3 -0
  292. data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.c +5 -8
  293. data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +5 -0
  294. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +3 -0
  295. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +7 -0
  296. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -1
  297. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +5 -8
  298. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +1 -1
  299. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +66 -1
  300. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +40 -9
  301. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +1 -0
  302. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
  303. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +6 -2
  304. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +14 -0
  305. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +19 -11
  306. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +325 -0
  307. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +23 -7
  308. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +99 -63
  309. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +139 -109
  310. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +12 -19
  311. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +48 -50
  312. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +451 -435
  313. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +0 -1
  314. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +2 -2
  315. data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +1 -1
  316. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +773 -84
  317. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +80 -47
  318. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +24 -19
  319. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +189 -86
  320. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +45 -56
  321. data/third_party/boringssl-with-bazel/src/ssl/internal.h +272 -167
  322. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +2 -2
  323. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
  324. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +14 -19
  325. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +34 -102
  326. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +2 -0
  327. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +8 -31
  328. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -0
  329. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +4 -3
  330. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +7 -3
  331. data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +576 -648
  332. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +31 -3
  333. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -39
  334. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +141 -94
  335. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +58 -68
  336. data/third_party/xxhash/xxhash.h +77 -195
  337. metadata +81 -39
  338. data/src/core/lib/gpr/arena.h +0 -47
  339. data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +0 -267
  340. data/third_party/boringssl-with-bazel/src/crypto/x509/vpm_int.h +0 -71
@@ -38,6 +38,7 @@
38
38
  #include "src/core/ext/xds/xds_bootstrap.h"
39
39
  #include "src/core/ext/xds/xds_client_stats.h"
40
40
  #include "src/core/ext/xds/xds_http_filters.h"
41
+ #include "src/core/lib/channel/status_util.h"
41
42
  #include "src/core/lib/matchers/matchers.h"
42
43
 
43
44
  namespace grpc_core {
@@ -109,10 +110,34 @@ class XdsApi {
109
110
  bool operator==(const HashPolicy& other) const;
110
111
  std::string ToString() const;
111
112
  };
112
-
113
113
  Matchers matchers;
114
114
  std::vector<HashPolicy> hash_policies;
115
115
 
116
+ struct RetryPolicy {
117
+ internal::StatusCodeSet retry_on;
118
+ uint32_t num_retries;
119
+
120
+ struct RetryBackOff {
121
+ Duration base_interval;
122
+ Duration max_interval;
123
+
124
+ bool operator==(const RetryBackOff& other) const {
125
+ return base_interval == other.base_interval &&
126
+ max_interval == other.max_interval;
127
+ }
128
+ std::string ToString() const;
129
+ };
130
+ RetryBackOff retry_back_off;
131
+
132
+ bool operator==(const RetryPolicy& other) const {
133
+ return (retry_on == other.retry_on &&
134
+ num_retries == other.num_retries &&
135
+ retry_back_off == other.retry_back_off);
136
+ }
137
+ std::string ToString() const;
138
+ };
139
+ absl::optional<RetryPolicy> retry_policy;
140
+
116
141
  // Action for this route.
117
142
  // TODO(roth): When we can use absl::variant<>, consider using that
118
143
  // here, to enforce the fact that only one of the two fields can be set.
@@ -139,6 +164,7 @@ class XdsApi {
139
164
 
140
165
  bool operator==(const Route& other) const {
141
166
  return matchers == other.matchers && cluster_name == other.cluster_name &&
167
+ retry_policy == other.retry_policy &&
142
168
  weighted_clusters == other.weighted_clusters &&
143
169
  max_stream_duration == other.max_stream_duration &&
144
170
  typed_per_filter_config == other.typed_per_filter_config;
@@ -399,34 +425,42 @@ class XdsApi {
399
425
  // The name to use in the EDS request.
400
426
  // If empty, the cluster name will be used.
401
427
  std::string eds_service_name;
428
+ // For cluster type LOGICAL_DNS.
429
+ // The hostname to lookup in DNS.
430
+ std::string dns_hostname;
431
+ // For cluster type AGGREGATE.
432
+ // The prioritized list of cluster names.
433
+ std::vector<std::string> prioritized_cluster_names;
434
+
402
435
  // Tls Context used by clients
403
436
  CommonTlsContext common_tls_context;
437
+
404
438
  // The LRS server to use for load reporting.
405
439
  // If not set, load reporting will be disabled.
406
440
  // If set to the empty string, will use the same server we obtained the CDS
407
441
  // data from.
408
442
  absl::optional<std::string> lrs_load_reporting_server_name;
443
+
409
444
  // The LB policy to use (e.g., "ROUND_ROBIN" or "RING_HASH").
410
445
  std::string lb_policy;
411
446
  // Used for RING_HASH LB policy only.
412
447
  uint64_t min_ring_size = 1024;
413
448
  uint64_t max_ring_size = 8388608;
414
- enum HashFunction { XX_HASH, MURMUR_HASH_2 };
415
- HashFunction hash_function;
416
449
  // Maximum number of outstanding requests can be made to the upstream
417
450
  // cluster.
418
451
  uint32_t max_concurrent_requests = 1024;
419
- // For cluster type AGGREGATE.
420
- // The prioritized list of cluster names.
421
- std::vector<std::string> prioritized_cluster_names;
422
452
 
423
453
  bool operator==(const CdsUpdate& other) const {
424
454
  return cluster_type == other.cluster_type &&
425
455
  eds_service_name == other.eds_service_name &&
456
+ dns_hostname == other.dns_hostname &&
457
+ prioritized_cluster_names == other.prioritized_cluster_names &&
426
458
  common_tls_context == other.common_tls_context &&
427
459
  lrs_load_reporting_server_name ==
428
460
  other.lrs_load_reporting_server_name &&
429
- prioritized_cluster_names == other.prioritized_cluster_names &&
461
+ lb_policy == other.lb_policy &&
462
+ min_ring_size == other.min_ring_size &&
463
+ max_ring_size == other.max_ring_size &&
430
464
  max_concurrent_requests == other.max_concurrent_requests;
431
465
  }
432
466
 
@@ -620,7 +654,8 @@ class XdsApi {
620
654
  std::set<std::string> resource_names_failed;
621
655
  };
622
656
 
623
- XdsApi(XdsClient* client, TraceFlag* tracer, const XdsBootstrap::Node* node);
657
+ XdsApi(XdsClient* client, TraceFlag* tracer, const XdsBootstrap::Node* node,
658
+ const CertificateProviderStore::PluginDefinitionMap* map);
624
659
 
625
660
  // Creates an ADS request.
626
661
  // Takes ownership of \a error.
@@ -661,9 +696,12 @@ class XdsApi {
661
696
  XdsClient* client_;
662
697
  TraceFlag* tracer_;
663
698
  const XdsBootstrap::Node* node_; // Do not own.
699
+ const CertificateProviderStore::PluginDefinitionMap*
700
+ certificate_provider_definition_map_; // Do not own.
664
701
  upb::SymbolTable symtab_;
665
702
  const std::string build_version_;
666
703
  const std::string user_agent_name_;
704
+ const std::string user_agent_version_;
667
705
  };
668
706
 
669
707
  } // namespace grpc_core
@@ -403,7 +403,10 @@ grpc_error_handle XdsBootstrap::ParseCertificateProvider(
403
403
  CertificateProviderFactory* factory =
404
404
  CertificateProviderRegistry::LookupCertificateProviderFactory(
405
405
  plugin_name);
406
- if (factory != nullptr) {
406
+ if (factory == nullptr) {
407
+ error_list.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
408
+ absl::StrCat("Unrecognized plugin name: ", plugin_name).c_str()));
409
+ } else {
407
410
  RefCountedPtr<CertificateProviderFactory::Config> config;
408
411
  it = certificate_provider_json->mutable_object()->find("config");
409
412
  if (it != certificate_provider_json->mutable_object()->end()) {
@@ -275,6 +275,12 @@ class XdsClient::ChannelState::AdsCallState
275
275
  XdsApi::EdsUpdateMap eds_update_map)
276
276
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
277
277
 
278
+ template <typename StateMap>
279
+ void RejectAdsUpdateLocked(grpc_millis update_time,
280
+ const XdsApi::AdsParseResult& result,
281
+ StateMap* state_map)
282
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
283
+
278
284
  static void OnRequestSent(void* arg, grpc_error_handle error);
279
285
  void OnRequestSentLocked(grpc_error_handle error)
280
286
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
@@ -1145,6 +1151,47 @@ void XdsClient::ChannelState::AdsCallState::AcceptEdsUpdateLocked(
1145
1151
  }
1146
1152
  }
1147
1153
 
1154
+ namespace {
1155
+
1156
+ // Update resource_metadata for NACK.
1157
+ void UpdateResourceMetadataNacked(const std::string& version,
1158
+ const std::string& details,
1159
+ grpc_millis update_time,
1160
+ XdsApi::ResourceMetadata* resource_metadata) {
1161
+ resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
1162
+ resource_metadata->failed_version = version;
1163
+ resource_metadata->failed_details = details;
1164
+ resource_metadata->failed_update_time = update_time;
1165
+ }
1166
+
1167
+ } // namespace
1168
+
1169
+ template <typename StateMap>
1170
+ void XdsClient::ChannelState::AdsCallState::RejectAdsUpdateLocked(
1171
+ grpc_millis update_time, const XdsApi::AdsParseResult& result,
1172
+ StateMap* state_map) {
1173
+ if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1174
+ gpr_log(GPR_INFO,
1175
+ "[xds_client %p] %s update NACKed containing %" PRIuPTR
1176
+ " resources",
1177
+ xds_client(), result.type_url.c_str(),
1178
+ result.resource_names_failed.size());
1179
+ }
1180
+ std::string details = grpc_error_std_string(result.parse_error);
1181
+ for (auto& name : result.resource_names_failed) {
1182
+ auto it = state_map->find(name);
1183
+ if (it == state_map->end()) continue;
1184
+ auto& state = it->second;
1185
+ // Notify watchers of error.
1186
+ for (const auto& p : state.watchers) {
1187
+ p.first->OnError(GRPC_ERROR_REF(result.parse_error));
1188
+ }
1189
+ // Update resource metadata for CSDS.
1190
+ UpdateResourceMetadataNacked(result.version, details, update_time,
1191
+ &state.meta);
1192
+ }
1193
+ }
1194
+
1148
1195
  void XdsClient::ChannelState::AdsCallState::OnRequestSent(
1149
1196
  void* arg, grpc_error_handle error) {
1150
1197
  AdsCallState* ads_calld = static_cast<AdsCallState*>(arg);
@@ -1223,10 +1270,6 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1223
1270
  state.nonce = std::move(result.nonce);
1224
1271
  // NACK or ACK the response.
1225
1272
  if (result.parse_error != GRPC_ERROR_NONE) {
1226
- xds_client()->UpdateResourceMetadataWithFailedParseResultLocked(
1227
- update_time, result);
1228
- GRPC_ERROR_UNREF(state.error);
1229
- state.error = result.parse_error;
1230
1273
  // NACK unacceptable update.
1231
1274
  gpr_log(GPR_ERROR,
1232
1275
  "[xds_client %p] ADS response invalid for resource type %s "
@@ -1234,6 +1277,23 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
1234
1277
  xds_client(), result.type_url.c_str(), result.version.c_str(),
1235
1278
  state.nonce.c_str(),
1236
1279
  grpc_error_std_string(result.parse_error).c_str());
1280
+ result.parse_error =
1281
+ grpc_error_set_int(result.parse_error, GRPC_ERROR_INT_GRPC_STATUS,
1282
+ GRPC_STATUS_UNAVAILABLE);
1283
+ GRPC_ERROR_UNREF(state.error);
1284
+ state.error = result.parse_error;
1285
+ if (result.type_url == XdsApi::kLdsTypeUrl) {
1286
+ RejectAdsUpdateLocked(update_time, result,
1287
+ &xds_client()->listener_map_);
1288
+ } else if (result.type_url == XdsApi::kRdsTypeUrl) {
1289
+ RejectAdsUpdateLocked(update_time, result,
1290
+ &xds_client()->route_config_map_);
1291
+ } else if (result.type_url == XdsApi::kCdsTypeUrl) {
1292
+ RejectAdsUpdateLocked(update_time, result, &xds_client()->cluster_map_);
1293
+ } else if (result.type_url == XdsApi::kEdsTypeUrl) {
1294
+ RejectAdsUpdateLocked(update_time, result,
1295
+ &xds_client()->endpoint_map_);
1296
+ }
1237
1297
  SendMessageLocked(result.type_url);
1238
1298
  } else {
1239
1299
  seen_response_ = true;
@@ -1803,7 +1863,8 @@ XdsClient::XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
1803
1863
  interested_parties_(grpc_pollset_set_create()),
1804
1864
  certificate_provider_store_(MakeOrphanable<CertificateProviderStore>(
1805
1865
  bootstrap_->certificate_providers())),
1806
- api_(this, &grpc_xds_client_trace, bootstrap_->node()) {
1866
+ api_(this, &grpc_xds_client_trace, bootstrap_->node(),
1867
+ &bootstrap_->certificate_providers()) {
1807
1868
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
1808
1869
  gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
1809
1870
  }
@@ -2252,44 +2313,6 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshotLocked(
2252
2313
  return snapshot_map;
2253
2314
  }
2254
2315
 
2255
- void XdsClient::UpdateResourceMetadataWithFailedParseResultLocked(
2256
- grpc_millis update_time, const XdsApi::AdsParseResult& result) {
2257
- // ADS update is rejected and the resource names in the failed update is
2258
- // available.
2259
- std::string details = grpc_error_std_string(result.parse_error);
2260
- for (auto& name : result.resource_names_failed) {
2261
- XdsApi::ResourceMetadata* resource_metadata = nullptr;
2262
- if (result.type_url == XdsApi::kLdsTypeUrl) {
2263
- auto it = listener_map_.find(name);
2264
- if (it != listener_map_.end()) {
2265
- resource_metadata = &it->second.meta;
2266
- }
2267
- } else if (result.type_url == XdsApi::kRdsTypeUrl) {
2268
- auto it = route_config_map_.find(name);
2269
- if (route_config_map_.find(name) != route_config_map_.end()) {
2270
- resource_metadata = &it->second.meta;
2271
- }
2272
- } else if (result.type_url == XdsApi::kCdsTypeUrl) {
2273
- auto it = cluster_map_.find(name);
2274
- if (cluster_map_.find(name) != cluster_map_.end()) {
2275
- resource_metadata = &it->second.meta;
2276
- }
2277
- } else if (result.type_url == XdsApi::kEdsTypeUrl) {
2278
- auto it = endpoint_map_.find(name);
2279
- if (endpoint_map_.find(name) != endpoint_map_.end()) {
2280
- resource_metadata = &it->second.meta;
2281
- }
2282
- }
2283
- if (resource_metadata == nullptr) {
2284
- return;
2285
- }
2286
- resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
2287
- resource_metadata->failed_version = result.version;
2288
- resource_metadata->failed_details = details;
2289
- resource_metadata->failed_update_time = update_time;
2290
- }
2291
- }
2292
-
2293
2316
  std::string XdsClient::DumpClientConfigBinary() {
2294
2317
  MutexLock lock(&mu_);
2295
2318
  XdsApi::ResourceTypeMetadataMap resource_type_metadata_map;
@@ -324,10 +324,6 @@ class XdsClient : public DualRefCounted<XdsClient> {
324
324
  bool send_all_clusters, const std::set<std::string>& clusters)
325
325
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
326
326
 
327
- void UpdateResourceMetadataWithFailedParseResultLocked(
328
- grpc_millis update_time, const XdsApi::AdsParseResult& result)
329
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
330
-
331
327
  std::unique_ptr<XdsBootstrap> bootstrap_;
332
328
  grpc_channel_args* args_;
333
329
  const grpc_millis request_timeout_;
@@ -52,10 +52,9 @@ class XdsHttpRouterFilter : public XdsHttpFilterImpl {
52
52
  "router filter does not support config override");
53
53
  }
54
54
 
55
- // No-op -- this filter is special-cased by the xds resolver.
56
55
  const grpc_channel_filter* channel_filter() const override { return nullptr; }
57
56
 
58
- // No-op -- this filter is special-cased by the xds resolver.
57
+ // No-op. This will never be called, since channel_filter() returns null.
59
58
  absl::StatusOr<ServiceConfigJsonEntry> GenerateServiceConfig(
60
59
  const FilterConfig& /*hcm_filter_config*/,
61
60
  const FilterConfig* /*filter_config_override*/) const override {
@@ -65,6 +64,8 @@ class XdsHttpRouterFilter : public XdsHttpFilterImpl {
65
64
  bool IsSupportedOnClients() const override { return true; }
66
65
 
67
66
  bool IsSupportedOnServers() const override { return true; }
67
+
68
+ bool IsTerminalFilter() const override { return true; }
68
69
  };
69
70
 
70
71
  using FilterOwnerList = std::vector<std::unique_ptr<XdsHttpFilterImpl>>;
@@ -107,6 +107,9 @@ class XdsHttpFilterImpl {
107
107
 
108
108
  // Returns true if the filter is supported on servers; false otherwise
109
109
  virtual bool IsSupportedOnServers() const = 0;
110
+
111
+ // Returns true if the filter must be the last filter in the chain.
112
+ virtual bool IsTerminalFilter() const { return false; }
110
113
  };
111
114
 
112
115
  class XdsHttpFilterRegistry {
@@ -29,11 +29,13 @@
29
29
  #include "absl/strings/str_cat.h"
30
30
  #include "absl/strings/str_format.h"
31
31
 
32
+ #include <grpc/event_engine/event_engine.h>
32
33
  #include <grpc/support/alloc.h>
33
34
  #include <grpc/support/log.h>
34
35
 
35
36
  #include "src/core/lib/gpr/string.h"
36
37
  #include "src/core/lib/gprpp/host_port.h"
38
+ #include "src/core/lib/iomgr/event_engine/resolved_address_internal.h"
37
39
  #include "src/core/lib/iomgr/sockaddr.h"
38
40
  #include "src/core/lib/iomgr/socket_utils.h"
39
41
  #include "src/core/lib/iomgr/unix_sockets_posix.h"
@@ -397,3 +399,14 @@ bool grpc_sockaddr_match_subnet(const grpc_resolved_address* address,
397
399
  }
398
400
  return false;
399
401
  }
402
+
403
+ namespace grpc_event_engine {
404
+ namespace experimental {
405
+
406
+ std::string ResolvedAddressToURI(const EventEngine::ResolvedAddress& addr) {
407
+ auto gra = CreateGRPCResolvedAddress(addr);
408
+ return grpc_sockaddr_to_uri(&gra);
409
+ }
410
+
411
+ } // namespace experimental
412
+ } // namespace grpc_event_engine
@@ -23,6 +23,8 @@
23
23
 
24
24
  #include <string>
25
25
 
26
+ #include <grpc/event_engine/event_engine.h>
27
+
26
28
  #include "src/core/lib/iomgr/resolve_address.h"
27
29
 
28
30
  /* Returns true if addr is an IPv4-mapped IPv6 address within the
@@ -97,4 +99,12 @@ bool grpc_sockaddr_match_subnet(const grpc_resolved_address* address,
97
99
  const grpc_resolved_address* subnet_address,
98
100
  uint32_t mask_bits);
99
101
 
102
+ namespace grpc_event_engine {
103
+ namespace experimental {
104
+
105
+ std::string ResolvedAddressToURI(const EventEngine::ResolvedAddress& addr);
106
+
107
+ } // namespace experimental
108
+ } // namespace grpc_event_engine
109
+
100
110
  #endif /* GRPC_CORE_LIB_ADDRESS_UTILS_SOCKADDR_UTILS_H */
@@ -0,0 +1,85 @@
1
+ //
2
+ //
3
+ // Copyright 2021 gRPC authors.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ //
18
+
19
+ #ifndef GRPC_CORE_LIB_CHANNEL_CALL_TRACER_H
20
+ #define GRPC_CORE_LIB_CHANNEL_CALL_TRACER_H
21
+
22
+ #include <grpc/support/port_platform.h>
23
+
24
+ #include "absl/strings/string_view.h"
25
+
26
+ #include "src/core/lib/channel/channel_stack.h"
27
+ #include "src/core/lib/transport/byte_stream.h"
28
+ #include "src/core/lib/transport/metadata_batch.h"
29
+
30
+ namespace grpc_core {
31
+
32
+ // Interface for a tracer that records activities on a call. Actual attempts for
33
+ // this call are traced with CallAttemptTracer after invoking RecordNewAttempt()
34
+ // on the CallTracer object.
35
+ class CallTracer {
36
+ public:
37
+ // Interface for a tracer that records activities on a particular call
38
+ // attempt.
39
+ // (A single RPC can have multiple attempts due to retry/hedging policies or
40
+ // as transparent retry attempts.)
41
+ class CallAttemptTracer {
42
+ public:
43
+ virtual ~CallAttemptTracer() {}
44
+ // Please refer to `grpc_transport_stream_op_batch_payload` for details on
45
+ // arguments.
46
+ virtual void RecordSendInitialMetadata(
47
+ grpc_metadata_batch* send_initial_metadata, uint32_t flags) = 0;
48
+ // TODO(yashkt): We are using gpr_atm here instead of absl::string_view
49
+ // since that's what the transport API uses, and performing an atomic load
50
+ // is unnecessary if the census tracer does not need it at present. Fix this
51
+ // when the transport API changes.
52
+ virtual void RecordOnDoneSendInitialMetadata(gpr_atm* peer_string) = 0;
53
+ virtual void RecordSendTrailingMetadata(
54
+ grpc_metadata_batch* send_trailing_metadata) = 0;
55
+ virtual void RecordSendMessage(const ByteStream& send_message) = 0;
56
+ // The `RecordReceivedInitialMetadata()` and `RecordReceivedMessage()`
57
+ // methods should only be invoked when the metadata/message was
58
+ // successfully received, i.e., without any error.
59
+ virtual void RecordReceivedInitialMetadata(
60
+ grpc_metadata_batch* recv_initial_metadata, uint32_t flags) = 0;
61
+ virtual void RecordReceivedMessage(const ByteStream& recv_message) = 0;
62
+ virtual void RecordReceivedTrailingMetadata(
63
+ absl::Status status, grpc_metadata_batch* recv_trailing_metadata,
64
+ const grpc_transport_stream_stats& transport_stream_stats) = 0;
65
+ virtual void RecordCancel(grpc_error_handle cancel_error) = 0;
66
+ // Should be the last API call to the object. Once invoked, the tracer
67
+ // library is free to destroy the object.
68
+ virtual void RecordEnd(const gpr_timespec& latency) = 0;
69
+ };
70
+
71
+ virtual ~CallTracer() {}
72
+
73
+ // Records a new attempt for the associated call. \a transparent denotes
74
+ // whether the attempt is being made as a transparent retry or as a
75
+ // non-transparent retry/heding attempt. (There will be at least one attempt
76
+ // even if the call is not being retried.) The `CallTracer` object retains
77
+ // ownership to the newly created `CallAttemptTracer` object. RecordEnd()
78
+ // serves as an indication that the call stack is done with all API calls, and
79
+ // the tracer library is free to destroy it after that.
80
+ virtual CallAttemptTracer* StartNewAttempt(bool is_transparent_retry) = 0;
81
+ };
82
+
83
+ } // namespace grpc_core
84
+
85
+ #endif // GRPC_CORE_LIB_CHANNEL_CALL_TRACER_H