grpc 1.69.0 → 1.70.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (640) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +251 -249
  3. data/include/grpc/support/atm.h +0 -13
  4. data/src/core/call/request_buffer.cc +224 -0
  5. data/src/core/call/request_buffer.h +192 -0
  6. data/src/core/client_channel/client_channel.cc +2 -3
  7. data/src/core/client_channel/client_channel_args.h +21 -0
  8. data/src/core/client_channel/client_channel_filter.h +1 -3
  9. data/src/core/client_channel/retry_interceptor.cc +406 -0
  10. data/src/core/client_channel/retry_interceptor.h +157 -0
  11. data/src/core/client_channel/retry_service_config.h +13 -0
  12. data/src/core/client_channel/retry_throttle.cc +33 -18
  13. data/src/core/client_channel/retry_throttle.h +3 -3
  14. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +596 -94
  15. data/src/core/ext/transport/chttp2/server/chttp2_server.h +189 -13
  16. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +1 -0
  17. data/src/core/ext/transport/chttp2/transport/frame_security.cc +1 -3
  18. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +40 -1
  19. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb.h +3 -1
  20. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +66 -36
  21. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +19 -17
  22. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +116 -0
  23. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +31 -5
  24. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.h +2 -0
  25. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +67 -6
  26. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +12 -8
  27. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb.h +151 -0
  28. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.c +60 -0
  29. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_cmsg_headers.upb_minitable.h +32 -0
  30. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +228 -21
  31. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +65 -17
  32. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.h +6 -0
  33. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb.h +7 -106
  34. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.c +7 -28
  35. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.h +0 -2
  36. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +85 -0
  37. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +25 -3
  38. data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
  39. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +152 -0
  40. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +40 -10
  41. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.h +2 -0
  42. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +135 -4
  43. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +41 -9
  44. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.h +2 -0
  45. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb.h +0 -2
  46. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.c +0 -1
  47. data/src/core/ext/upb-gen/envoy/config/trace/v3/trace.upb_minitable.h +0 -1
  48. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +16 -0
  49. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +3 -2
  50. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +60 -0
  51. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +13 -2
  52. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb.h +0 -1
  53. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upb_minitable.c +0 -1
  54. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +102 -24
  55. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.c +28 -19
  56. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb.h +251 -18
  57. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c +41 -16
  58. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.h +2 -0
  59. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb.h +2 -1
  60. data/src/core/ext/upbdefs-gen/envoy/admin/v3/config_dump_shared.upbdefs.c +11 -10
  61. data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +418 -413
  62. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +161 -153
  63. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.h +5 -0
  64. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +267 -261
  65. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.c +46 -0
  66. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_cmsg_headers.upbdefs.h +33 -0
  67. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.c +29 -19
  68. data/src/core/ext/upbdefs-gen/envoy/config/core/v3/socket_option.upbdefs.h +15 -0
  69. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.c +58 -65
  70. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener_components.upbdefs.h +0 -5
  71. data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +73 -63
  72. data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +49 -48
  73. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +117 -100
  74. data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.h +5 -0
  75. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +905 -897
  76. data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.h +5 -0
  77. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/trace.upbdefs.c +15 -18
  78. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +460 -457
  79. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.upbdefs.c +16 -19
  80. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +95 -95
  81. data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +202 -191
  82. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.c +148 -135
  83. data/src/core/ext/upbdefs-gen/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
  84. data/src/core/ext/upbdefs-gen/envoy/service/status/v3/csds.upbdefs.c +23 -22
  85. data/src/core/filter/filter_args.h +112 -0
  86. data/src/core/handshaker/http_connect/http_connect_handshaker.cc +1 -1
  87. data/src/core/lib/channel/promise_based_filter.h +5 -79
  88. data/src/core/lib/debug/trace_flags.cc +2 -0
  89. data/src/core/lib/debug/trace_flags.h +1 -0
  90. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +14 -0
  91. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +7 -2
  92. data/src/core/lib/event_engine/posix_engine/posix_engine.h +0 -2
  93. data/src/core/lib/event_engine/windows/windows_engine.cc +1 -0
  94. data/src/core/lib/experiments/experiments.cc +90 -39
  95. data/src/core/lib/experiments/experiments.h +43 -24
  96. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -1
  97. data/src/core/lib/promise/activity.cc +2 -0
  98. data/src/core/lib/promise/activity.h +29 -8
  99. data/src/core/lib/promise/map.h +42 -0
  100. data/src/core/lib/promise/party.cc +36 -1
  101. data/src/core/lib/promise/party.h +13 -5
  102. data/src/core/lib/promise/sleep.h +1 -0
  103. data/src/core/lib/promise/status_flag.h +10 -0
  104. data/src/core/lib/resource_quota/arena.h +8 -0
  105. data/src/core/lib/resource_quota/connection_quota.h +4 -0
  106. data/src/core/lib/surface/call_utils.h +2 -0
  107. data/src/core/lib/surface/client_call.cc +43 -35
  108. data/src/core/lib/surface/client_call.h +5 -0
  109. data/src/core/lib/surface/event_string.cc +7 -1
  110. data/src/core/lib/surface/init_internally.h +13 -2
  111. data/src/core/lib/surface/server_call.cc +100 -85
  112. data/src/core/lib/surface/version.cc +2 -2
  113. data/src/core/lib/transport/call_filters.cc +10 -4
  114. data/src/core/lib/transport/call_filters.h +8 -0
  115. data/src/core/lib/transport/call_spine.cc +36 -71
  116. data/src/core/lib/transport/call_spine.h +131 -7
  117. data/src/core/lib/transport/call_state.h +132 -39
  118. data/src/core/lib/transport/interception_chain.cc +8 -0
  119. data/src/core/lib/transport/interception_chain.h +9 -0
  120. data/src/core/load_balancing/endpoint_list.cc +10 -0
  121. data/src/core/load_balancing/endpoint_list.h +13 -6
  122. data/src/core/load_balancing/lb_policy.h +0 -8
  123. data/src/core/load_balancing/pick_first/pick_first.cc +89 -56
  124. data/src/core/load_balancing/ring_hash/ring_hash.cc +158 -70
  125. data/src/core/load_balancing/ring_hash/ring_hash.h +4 -11
  126. data/src/core/load_balancing/round_robin/round_robin.cc +9 -14
  127. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +12 -15
  128. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +4 -4
  129. data/src/core/resolver/xds/xds_dependency_manager.cc +139 -135
  130. data/src/core/resolver/xds/xds_dependency_manager.h +24 -18
  131. data/src/core/resolver/xds/xds_resolver.cc +28 -47
  132. data/src/core/server/server.cc +290 -24
  133. data/src/core/server/server.h +199 -61
  134. data/src/core/server/xds_server_config_fetcher.cc +78 -142
  135. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  136. data/src/core/util/backoff.cc +15 -4
  137. data/src/core/util/http_client/httpcli.cc +66 -18
  138. data/src/core/util/http_client/httpcli.h +14 -4
  139. data/src/core/util/matchers.h +5 -10
  140. data/src/core/util/ref_counted.h +1 -0
  141. data/src/core/util/ref_counted_ptr.h +1 -1
  142. data/src/core/util/useful.h +9 -11
  143. data/src/core/xds/grpc/xds_endpoint_parser.cc +54 -23
  144. data/src/core/xds/grpc/xds_metadata.h +8 -0
  145. data/src/core/xds/xds_client/xds_api.cc +0 -223
  146. data/src/core/xds/xds_client/xds_api.h +1 -133
  147. data/src/core/xds/xds_client/xds_client.cc +599 -466
  148. data/src/core/xds/xds_client/xds_client.h +107 -26
  149. data/src/core/xds/xds_client/xds_resource_type_impl.h +10 -5
  150. data/src/ruby/ext/grpc/extconf.rb +1 -0
  151. data/src/ruby/lib/grpc/version.rb +1 -1
  152. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_bitstr.c → a_bitstr.cc} +3 -2
  153. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_d2i_fp.c → a_d2i_fp.cc} +1 -1
  154. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_dup.c → a_dup.cc} +1 -1
  155. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_i2d_fp.c → a_i2d_fp.cc} +1 -1
  156. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_int.c → a_int.cc} +2 -1
  157. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_mbstr.c → a_mbstr.cc} +9 -7
  158. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_object.c → a_object.cc} +1 -1
  159. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strnid.c → a_strnid.cc} +7 -4
  160. data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_type.c → a_type.cc} +4 -4
  161. data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_lib.c → asn1_lib.cc} +4 -4
  162. data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn_pack.c → asn_pack.cc} +2 -2
  163. data/third_party/boringssl-with-bazel/src/crypto/asn1/{posix_time.c → posix_time.cc} +2 -2
  164. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_dec.c → tasn_dec.cc} +4 -3
  165. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_enc.c → tasn_enc.cc} +9 -6
  166. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_fre.c → tasn_fre.cc} +14 -20
  167. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_new.c → tasn_new.cc} +7 -6
  168. data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_utl.c → tasn_utl.cc} +13 -10
  169. data/third_party/boringssl-with-bazel/src/crypto/base64/{base64.c → base64.cc} +9 -12
  170. data/third_party/boringssl-with-bazel/src/crypto/bcm_support.h +7 -1
  171. data/third_party/boringssl-with-bazel/src/crypto/bio/{bio.c → bio.cc} +32 -58
  172. data/third_party/boringssl-with-bazel/src/crypto/bio/{bio_mem.c → bio_mem.cc} +8 -7
  173. data/third_party/boringssl-with-bazel/src/crypto/bio/{connect.c → connect.cc} +24 -16
  174. data/third_party/boringssl-with-bazel/src/crypto/bio/{file.c → file.cc} +3 -3
  175. data/third_party/boringssl-with-bazel/src/crypto/bio/{pair.c → pair.cc} +22 -20
  176. data/third_party/boringssl-with-bazel/src/crypto/bio/{printf.c → printf.cc} +2 -2
  177. data/third_party/boringssl-with-bazel/src/crypto/bio/{socket_helper.c → socket_helper.cc} +1 -1
  178. data/third_party/boringssl-with-bazel/src/crypto/blake2/{blake2.c → blake2.cc} +2 -2
  179. data/third_party/boringssl-with-bazel/src/crypto/bn_extra/{bn_asn1.c → bn_asn1.cc} +1 -1
  180. data/third_party/boringssl-with-bazel/src/crypto/bn_extra/{convert.c → convert.cc} +21 -21
  181. data/third_party/boringssl-with-bazel/src/crypto/buf/{buf.c → buf.cc} +6 -3
  182. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{asn1_compat.c → asn1_compat.cc} +1 -1
  183. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{ber.c → ber.cc} +1 -1
  184. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbb.c → cbb.cc} +33 -49
  185. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{cbs.c → cbs.cc} +20 -27
  186. data/third_party/boringssl-with-bazel/src/crypto/bytestring/internal.h +1 -1
  187. data/third_party/boringssl-with-bazel/src/crypto/bytestring/{unicode.c → unicode.cc} +1 -1
  188. data/third_party/boringssl-with-bazel/src/crypto/chacha/{chacha.c → chacha.cc} +1 -1
  189. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +1 -1
  190. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_aesctrhmac.c → e_aesctrhmac.cc} +1 -1
  191. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_aesgcmsiv.c → e_aesgcmsiv.cc} +23 -26
  192. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_chacha20poly1305.c → e_chacha20poly1305.cc} +1 -8
  193. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_des.c → e_des.cc} +61 -49
  194. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_null.c → e_null.cc} +12 -9
  195. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_rc2.c → e_rc2.cc} +23 -19
  196. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_rc4.c → e_rc4.cc} +10 -8
  197. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{e_tls.c → e_tls.cc} +2 -1
  198. data/third_party/boringssl-with-bazel/src/crypto/conf/{conf.c → conf.cc} +17 -14
  199. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +1 -1
  200. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_apple.c → cpu_aarch64_apple.cc} +2 -2
  201. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_fuchsia.c → cpu_aarch64_fuchsia.cc} +2 -2
  202. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_linux.c → cpu_aarch64_linux.cc} +2 -2
  203. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_openbsd.c → cpu_aarch64_openbsd.cc} +4 -4
  204. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_sysreg.c → cpu_aarch64_sysreg.cc} +3 -2
  205. data/third_party/boringssl-with-bazel/src/crypto/{cpu_aarch64_win.c → cpu_aarch64_win.cc} +2 -2
  206. data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_freebsd.c → cpu_arm_freebsd.cc} +3 -3
  207. data/third_party/boringssl-with-bazel/src/crypto/{cpu_arm_linux.c → cpu_arm_linux.cc} +5 -5
  208. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.h +1 -1
  209. data/third_party/boringssl-with-bazel/src/crypto/{cpu_intel.c → cpu_intel.cc} +47 -32
  210. data/third_party/boringssl-with-bazel/src/crypto/{crypto.c → crypto.cc} +6 -11
  211. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{curve25519.c → curve25519.cc} +28 -31
  212. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{curve25519_64_adx.c → curve25519_64_adx.cc} +1 -1
  213. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +1 -1
  214. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
  215. data/third_party/boringssl-with-bazel/src/crypto/curve25519/{spake25519.c → spake25519.cc} +20 -16
  216. data/third_party/boringssl-with-bazel/src/crypto/dh_extra/{dh_asn1.c → dh_asn1.cc} +2 -2
  217. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/{digest_extra.c → digest_extra.cc} +113 -31
  218. data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa.c → dsa.cc} +153 -154
  219. data/third_party/boringssl-with-bazel/src/crypto/dsa/{dsa_asn1.c → dsa_asn1.cc} +2 -2
  220. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +1 -3
  221. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{ec_asn1.c → ec_asn1.cc} +35 -0
  222. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{ec_derive.c → ec_derive.cc} +1 -1
  223. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/{hash_to_curve.c → hash_to_curve.cc} +66 -64
  224. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +1 -1
  225. data/third_party/boringssl-with-bazel/src/crypto/ecdsa_extra/{ecdsa_asn1.c → ecdsa_asn1.cc} +15 -25
  226. data/third_party/boringssl-with-bazel/src/crypto/engine/{engine.c → engine.cc} +12 -8
  227. data/third_party/boringssl-with-bazel/src/crypto/err/{err.c → err.cc} +24 -27
  228. data/third_party/boringssl-with-bazel/src/crypto/err/internal.h +1 -1
  229. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp.c → evp.cc} +8 -9
  230. data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_ctx.c → evp_ctx.cc} +7 -8
  231. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh.c → p_dh.cc} +23 -14
  232. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dh_asn1.c → p_dh_asn1.cc} +38 -21
  233. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_dsa_asn1.c → p_dsa_asn1.cc} +19 -24
  234. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec.c → p_ec.cc} +20 -23
  235. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ec_asn1.c → p_ec_asn1.cc} +20 -20
  236. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519.c → p_ed25519.cc} +22 -19
  237. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_ed25519_asn1.c → p_ed25519_asn1.cc} +14 -13
  238. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_hkdf.c → p_hkdf.cc} +18 -14
  239. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa.c → p_rsa.cc} +38 -37
  240. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_rsa_asn1.c → p_rsa_asn1.cc} +16 -18
  241. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519.c → p_x25519.cc} +22 -19
  242. data/third_party/boringssl-with-bazel/src/crypto/evp/{p_x25519_asn1.c → p_x25519_asn1.cc} +18 -17
  243. data/third_party/boringssl-with-bazel/src/crypto/evp/{pbkdf.c → pbkdf.cc} +2 -2
  244. data/third_party/boringssl-with-bazel/src/crypto/evp/{print.c → print.cc} +4 -5
  245. data/third_party/boringssl-with-bazel/src/crypto/evp/{scrypt.c → scrypt.cc} +7 -5
  246. data/third_party/boringssl-with-bazel/src/crypto/{ex_data.c → ex_data.cc} +3 -4
  247. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes_nohw.c.inc → aes_nohw.cc.inc} +1 -1
  248. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/internal.h +1 -5
  249. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{key_wrap.c.inc → key_wrap.cc.inc} +1 -1
  250. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{bcm.c → bcm.cc} +96 -101
  251. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm_interface.h +165 -12
  252. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{add.c.inc → add.cc.inc} +1 -0
  253. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/asm/{x86_64-gcc.c.inc → x86_64-gcc.cc.inc} +4 -4
  254. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bn.c.inc → bn.cc.inc} +12 -24
  255. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{ctx.c.inc → ctx.cc.inc} +5 -7
  256. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div.c.inc → div.cc.inc} +29 -38
  257. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{div_extra.c.inc → div_extra.cc.inc} +1 -1
  258. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{exponentiation.c.inc → exponentiation.cc.inc} +22 -22
  259. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd.c.inc → gcd.cc.inc} +3 -6
  260. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{gcd_extra.c.inc → gcd_extra.cc.inc} +33 -25
  261. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery.c.inc → montgomery.cc.inc} +10 -17
  262. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{mul.c.inc → mul.cc.inc} +11 -15
  263. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{prime.c.inc → prime.cc.inc} +31 -34
  264. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{shift.c.inc → shift.cc.inc} +3 -4
  265. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{aead.c.inc → aead.cc.inc} +18 -10
  266. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{cipher.c.inc → cipher.cc.inc} +6 -9
  267. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aes.c.inc → e_aes.cc.inc} +46 -54
  268. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cmac/{cmac.c.inc → cmac.cc.inc} +6 -6
  269. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +14 -10
  270. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{dh.c.inc → dh.cc.inc} +15 -19
  271. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +1 -3
  272. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digest.c.inc → digest.cc.inc} +17 -13
  273. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/{digests.c.inc → digests.cc.inc} +29 -113
  274. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digestsign/{digestsign.c.inc → digestsign.cc.inc} +3 -3
  275. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +1 -1
  276. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec.c.inc → ec.cc.inc} +10 -15
  277. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_key.c.inc → ec_key.cc.inc} +12 -14
  278. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{felem.c.inc → felem.cc.inc} +1 -1
  279. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{oct.c.inc → oct.cc.inc} +5 -6
  280. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p224-64.c.inc → p224-64.cc.inc} +1 -1
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz-table.h +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256-nistz.c.inc → p256-nistz.cc.inc} +15 -13
  283. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{p256.c.inc → p256.cc.inc} +1 -1
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +1 -1
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{scalar.c.inc → scalar.cc.inc} +1 -1
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple_mul.c.inc → simple_mul.cc.inc} +1 -1
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{util.c.inc → util.cc.inc} +1 -1
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{wnaf.c.inc → wnaf.cc.inc} +24 -15
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/{ecdh.c.inc → ecdh.cc.inc} +14 -5
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/{ecdsa.c.inc → ecdsa.cc.inc} +6 -7
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/internal.h +1 -1
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/{fips_shared_support.c → fips_shared_support.cc} +2 -3
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/{hkdf.c.inc → hkdf.cc.inc} +1 -1
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hmac/{hmac.c.inc → hmac.cc.inc} +3 -2
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm.c.inc → gcm.cc.inc} +69 -21
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{gcm_nohw.c.inc → gcm_nohw.cc.inc} +1 -1
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +53 -33
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{polyval.c.inc → polyval.cc.inc} +2 -3
  299. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{ctrdrbg.c.inc → ctrdrbg.cc.inc} +5 -4
  300. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -1
  301. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/{rand.c.inc → rand.cc.inc} +20 -18
  302. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{blinding.c.inc → blinding.cc.inc} +5 -4
  303. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{padding.c.inc → padding.cc.inc} +21 -21
  304. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa.c.inc → rsa.cc.inc} +77 -73
  305. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/{rsa_impl.c.inc → rsa_impl.cc.inc} +50 -53
  306. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{fips.c.inc → fips.cc.inc} +14 -6
  307. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/{self_check.c.inc → self_check.cc.inc} +56 -52
  308. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/{service_indicator.c.inc → service_indicator.cc.inc} +10 -11
  309. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/internal.h +2 -4
  310. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha1.c.inc → sha1.cc.inc} +26 -33
  311. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha256.c.inc → sha256.cc.inc} +37 -55
  312. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/{sha512.c.inc → sha512.cc.inc} +48 -76
  313. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +1 -1
  314. data/third_party/boringssl-with-bazel/src/crypto/hpke/{hpke.c → hpke.cc} +7 -4
  315. data/third_party/boringssl-with-bazel/src/crypto/hrss/{hrss.c → hrss.cc} +53 -110
  316. data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +1 -1
  317. data/third_party/boringssl-with-bazel/src/crypto/internal.h +191 -248
  318. data/third_party/boringssl-with-bazel/src/crypto/keccak/internal.h +1 -1
  319. data/third_party/boringssl-with-bazel/src/crypto/keccak/{keccak.c → keccak.cc} +1 -1
  320. data/third_party/boringssl-with-bazel/src/crypto/kyber/internal.h +1 -1
  321. data/third_party/boringssl-with-bazel/src/crypto/kyber/{kyber.c → kyber.cc} +1 -1
  322. data/third_party/boringssl-with-bazel/src/crypto/lhash/{lhash.c → lhash.cc} +8 -7
  323. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md4/md4.c.inc → md4/md4.cc} +8 -12
  324. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md5 → md5}/internal.h +1 -1
  325. data/third_party/boringssl-with-bazel/src/crypto/{fipsmodule/md5/md5.c.inc → md5/md5.cc} +4 -3
  326. data/third_party/boringssl-with-bazel/src/crypto/{mem.c → mem.cc} +34 -22
  327. data/third_party/boringssl-with-bazel/src/crypto/mldsa/internal.h +4 -1
  328. data/third_party/boringssl-with-bazel/src/crypto/mldsa/{mldsa.c → mldsa.cc} +646 -543
  329. data/third_party/boringssl-with-bazel/src/crypto/mlkem/internal.h +1 -1
  330. data/third_party/boringssl-with-bazel/src/crypto/mlkem/mlkem.cc +8 -8
  331. data/third_party/boringssl-with-bazel/src/crypto/obj/{obj.c → obj.cc} +27 -30
  332. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_info.c → pem_info.cc} +2 -2
  333. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_lib.c → pem_lib.cc} +3 -4
  334. data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_oth.c → pem_oth.cc} +1 -1
  335. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +1 -1
  336. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7.c → pkcs7.cc} +5 -5
  337. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/{pkcs7_x509.c → pkcs7_x509.cc} +26 -25
  338. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +2 -2
  339. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{p5_pbev2.c → p5_pbev2.cc} +2 -2
  340. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8.c → pkcs8.cc} +159 -158
  341. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/{pkcs8_x509.c → pkcs8_x509.cc} +90 -97
  342. data/third_party/boringssl-with-bazel/src/crypto/poly1305/internal.h +1 -1
  343. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305.c → poly1305.cc} +3 -3
  344. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_arm.c → poly1305_arm.cc} +4 -2
  345. data/third_party/boringssl-with-bazel/src/crypto/poly1305/{poly1305_vec.c → poly1305_vec.cc} +14 -11
  346. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -1
  347. data/third_party/boringssl-with-bazel/src/crypto/pool/{pool.c → pool.cc} +12 -11
  348. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{deterministic.c → deterministic.cc} +2 -2
  349. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fork_detect.c → fork_detect.cc} +11 -12
  350. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{forkunsafe.c → forkunsafe.cc} +2 -2
  351. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{getentropy.c → getentropy.cc} +1 -1
  352. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getrandom_fillin.h +1 -1
  353. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{ios.c → ios.cc} +1 -1
  354. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{passive.c → passive.cc} +22 -18
  355. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{rand_extra.c → rand_extra.cc} +1 -1
  356. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/sysrand_internal.h +1 -1
  357. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{trusty.c → trusty.cc} +1 -1
  358. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{urandom.c → urandom.cc} +7 -7
  359. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{windows.c → windows.cc} +1 -1
  360. data/third_party/boringssl-with-bazel/src/crypto/{refcount.c → refcount.cc} +1 -1
  361. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_asn1.c → rsa_asn1.cc} +2 -2
  362. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_crypt.c → rsa_crypt.cc} +81 -78
  363. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_extra.cc +17 -0
  364. data/third_party/boringssl-with-bazel/src/crypto/sha/sha1.cc +52 -0
  365. data/third_party/boringssl-with-bazel/src/crypto/sha/sha256.cc +87 -0
  366. data/third_party/boringssl-with-bazel/src/crypto/sha/sha512.cc +104 -0
  367. data/third_party/boringssl-with-bazel/src/crypto/siphash/{siphash.c → siphash.cc} +1 -1
  368. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/address.h +123 -0
  369. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/fors.cc +169 -0
  370. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/fors.h +58 -0
  371. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/internal.h +63 -0
  372. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/merkle.cc +161 -0
  373. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/merkle.h +70 -0
  374. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/params.h +83 -0
  375. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/slhdsa.cc +307 -0
  376. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/thash.cc +173 -0
  377. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/thash.h +85 -0
  378. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/wots.cc +171 -0
  379. data/third_party/boringssl-with-bazel/src/crypto/slhdsa/wots.h +50 -0
  380. data/third_party/boringssl-with-bazel/src/crypto/stack/{stack.c → stack.cc} +10 -6
  381. data/third_party/boringssl-with-bazel/src/crypto/{thread_none.c → thread_none.cc} +1 -1
  382. data/third_party/boringssl-with-bazel/src/crypto/{thread_pthread.c → thread_pthread.cc} +9 -8
  383. data/third_party/boringssl-with-bazel/src/crypto/{thread_win.c → thread_win.cc} +21 -17
  384. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +1 -1
  385. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{pmbtoken.c → pmbtoken.cc} +146 -158
  386. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{trust_token.c → trust_token.cc} +19 -21
  387. data/third_party/boringssl-with-bazel/src/crypto/trust_token/{voprf.c → voprf.cc} +165 -169
  388. data/third_party/boringssl-with-bazel/src/crypto/x509/{a_digest.c → a_digest.cc} +1 -1
  389. data/third_party/boringssl-with-bazel/src/crypto/x509/{a_sign.c → a_sign.cc} +37 -34
  390. data/third_party/boringssl-with-bazel/src/crypto/x509/{a_verify.c → a_verify.cc} +1 -1
  391. data/third_party/boringssl-with-bazel/src/crypto/x509/{algorithm.c → algorithm.cc} +1 -1
  392. data/third_party/boringssl-with-bazel/src/crypto/x509/{asn1_gen.c → asn1_gen.cc} +5 -6
  393. data/third_party/boringssl-with-bazel/src/crypto/x509/{by_dir.c → by_dir.cc} +7 -6
  394. data/third_party/boringssl-with-bazel/src/crypto/x509/{policy.c → policy.cc} +188 -178
  395. data/third_party/boringssl-with-bazel/src/crypto/x509/{rsa_pss.c → rsa_pss.cc} +48 -44
  396. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_akey.c → v3_akey.cc} +4 -2
  397. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_alt.c → v3_alt.cc} +5 -5
  398. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_bcons.c → v3_bcons.cc} +3 -1
  399. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_bitst.c → v3_bitst.cc} +6 -3
  400. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_conf.c → v3_conf.cc} +5 -5
  401. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_cpols.c → v3_cpols.cc} +47 -41
  402. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_crld.c → v3_crld.cc} +3 -2
  403. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_enum.c → v3_enum.cc} +5 -2
  404. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_extku.c → v3_extku.cc} +3 -1
  405. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_genn.c → v3_genn.cc} +7 -7
  406. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ia5.c → v3_ia5.cc} +3 -2
  407. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_info.c → v3_info.cc} +4 -2
  408. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_int.c → v3_int.cc} +3 -1
  409. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_lib.c → v3_lib.cc} +9 -6
  410. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ncons.c → v3_ncons.cc} +3 -3
  411. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_ocsp.c → v3_ocsp.cc} +4 -1
  412. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_pcons.c → v3_pcons.cc} +3 -3
  413. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_pmaps.c → v3_pmaps.cc} +3 -3
  414. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_prn.c → v3_prn.cc} +2 -1
  415. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_purp.c → v3_purp.cc} +16 -8
  416. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_skey.c → v3_skey.cc} +6 -3
  417. data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_utl.c → v3_utl.cc} +15 -10
  418. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_att.c → x509_att.cc} +3 -2
  419. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_lu.c → x509_lu.cc} +6 -5
  420. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_v3.c → x509_v3.cc} +2 -2
  421. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vfy.c → x509_vfy.cc} +216 -212
  422. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_vpm.c → x509_vpm.cc} +55 -13
  423. data/third_party/boringssl-with-bazel/src/crypto/x509/{x509spki.c → x509spki.cc} +3 -3
  424. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_all.c → x_all.cc} +10 -6
  425. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_crl.c → x_crl.cc} +6 -6
  426. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_name.c → x_name.cc} +39 -32
  427. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_pubkey.c → x_pubkey.cc} +4 -2
  428. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509.c → x_x509.cc} +48 -44
  429. data/third_party/boringssl-with-bazel/src/crypto/x509/{x_x509a.c → x_x509a.cc} +4 -2
  430. data/third_party/boringssl-with-bazel/src/gen/crypto/{err_data.c → err_data.cc} +359 -358
  431. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +1 -1
  432. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +1 -1
  433. data/third_party/boringssl-with-bazel/src/include/openssl/asn1_mac.h +1 -1
  434. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +237 -275
  435. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +12 -5
  436. data/third_party/boringssl-with-bazel/src/include/openssl/bcm_public.h +82 -0
  437. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -1
  438. data/third_party/boringssl-with-bazel/src/include/openssl/buffer.h +1 -1
  439. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +1 -1
  440. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
  441. data/third_party/boringssl-with-bazel/src/include/openssl/cmac.h +1 -1
  442. data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +1 -1
  443. data/third_party/boringssl-with-bazel/src/include/openssl/crypto.h +13 -2
  444. data/third_party/boringssl-with-bazel/src/include/openssl/ctrdrbg.h +1 -1
  445. data/third_party/boringssl-with-bazel/src/include/openssl/curve25519.h +1 -1
  446. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -0
  447. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +6 -1
  448. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +4 -0
  449. data/third_party/boringssl-with-bazel/src/include/openssl/dtls1.h +1 -1
  450. data/third_party/boringssl-with-bazel/src/include/openssl/e_os2.h +1 -1
  451. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +17 -1
  452. data/third_party/boringssl-with-bazel/src/include/openssl/engine.h +1 -1
  453. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +1 -1
  454. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/kyber.h +1 -1
  455. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +1 -1
  456. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
  457. data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +1 -1
  458. data/third_party/boringssl-with-bazel/src/include/openssl/is_boringssl.h +1 -1
  459. data/third_party/boringssl-with-bazel/src/include/openssl/kdf.h +1 -1
  460. data/third_party/boringssl-with-bazel/src/include/openssl/mldsa.h +8 -8
  461. data/third_party/boringssl-with-bazel/src/include/openssl/mlkem.h +1 -1
  462. data/third_party/boringssl-with-bazel/src/include/openssl/obj_mac.h +1 -1
  463. data/third_party/boringssl-with-bazel/src/include/openssl/objects.h +1 -1
  464. data/third_party/boringssl-with-bazel/src/include/openssl/opensslconf.h +1 -1
  465. data/third_party/boringssl-with-bazel/src/include/openssl/opensslv.h +1 -1
  466. data/third_party/boringssl-with-bazel/src/include/openssl/ossl_typ.h +1 -1
  467. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs12.h +1 -1
  468. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +1 -1
  469. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +2 -2
  470. data/third_party/boringssl-with-bazel/src/include/openssl/poly1305.h +1 -1
  471. data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +1 -1
  472. data/third_party/boringssl-with-bazel/src/include/openssl/posix_time.h +1 -1
  473. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +1 -1
  474. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +10 -5
  475. data/third_party/boringssl-with-bazel/src/include/openssl/safestack.h +1 -1
  476. data/third_party/boringssl-with-bazel/src/include/openssl/sha.h +2 -40
  477. data/third_party/boringssl-with-bazel/src/include/openssl/siphash.h +1 -1
  478. data/third_party/boringssl-with-bazel/src/include/openssl/slhdsa.h +133 -0
  479. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +6 -1
  480. data/third_party/boringssl-with-bazel/src/include/openssl/srtp.h +1 -1
  481. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +160 -116
  482. data/third_party/boringssl-with-bazel/src/include/openssl/ssl3.h +1 -0
  483. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +1 -1
  484. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +2 -2
  485. data/third_party/boringssl-with-bazel/src/include/openssl/time.h +1 -1
  486. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -1
  487. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +1 -1
  488. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +1 -1
  489. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3_errors.h +2 -2
  490. data/third_party/boringssl-with-bazel/src/ssl/bio_ssl.cc +2 -6
  491. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +667 -322
  492. data/third_party/boringssl-with-bazel/src/ssl/d1_lib.cc +116 -119
  493. data/third_party/boringssl-with-bazel/src/ssl/d1_pkt.cc +163 -21
  494. data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +4 -12
  495. data/third_party/boringssl-with-bazel/src/ssl/dtls_method.cc +94 -49
  496. data/third_party/boringssl-with-bazel/src/ssl/dtls_record.cc +296 -198
  497. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +23 -14
  498. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +363 -343
  499. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +48 -58
  500. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +44 -36
  501. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +145 -159
  502. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +65 -58
  503. data/third_party/boringssl-with-bazel/src/ssl/internal.h +910 -356
  504. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +29 -41
  505. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +13 -11
  506. data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +2 -2
  507. data/third_party/boringssl-with-bazel/src/ssl/ssl_aead_ctx.cc +90 -183
  508. data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +38 -64
  509. data/third_party/boringssl-with-bazel/src/ssl/ssl_buffer.cc +1 -1
  510. data/third_party/boringssl-with-bazel/src/ssl/ssl_cert.cc +103 -44
  511. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +210 -220
  512. data/third_party/boringssl-with-bazel/src/ssl/ssl_credential.cc +70 -12
  513. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +20 -17
  514. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +146 -169
  515. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +15 -16
  516. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +79 -95
  517. data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -9
  518. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +91 -16
  519. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +30 -16
  520. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +51 -56
  521. data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +22 -25
  522. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +43 -27
  523. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +63 -59
  524. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +204 -121
  525. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +86 -59
  526. data/third_party/boringssl-with-bazel/src/ssl/tls_method.cc +51 -62
  527. data/third_party/boringssl-with-bazel/src/ssl/tls_record.cc +37 -25
  528. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_32.h +6 -0
  529. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64.h +6 -0
  530. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +4 -1
  531. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_32.h +1 -1
  532. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64.h +3 -0
  533. metadata +339 -339
  534. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb.h +0 -426
  535. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.c +0 -87
  536. data/src/core/ext/upb-gen/envoy/config/trace/v3/opencensus.upb_minitable.h +0 -32
  537. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb.h +0 -408
  538. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.c +0 -124
  539. data/src/core/ext/upb-gen/opencensus/proto/trace/v1/trace_config.upb_minitable.h +0 -38
  540. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.c +0 -108
  541. data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opencensus.upbdefs.h +0 -33
  542. data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.c +0 -67
  543. data/src/core/ext/upbdefs-gen/opencensus/proto/trace/v1/trace_config.upbdefs.h +0 -48
  544. data/src/core/util/atm.cc +0 -34
  545. data/third_party/boringssl-with-bazel/src/crypto/dilithium/dilithium.c +0 -1539
  546. data/third_party/boringssl-with-bazel/src/crypto/dilithium/internal.h +0 -58
  547. data/third_party/boringssl-with-bazel/src/crypto/spx/address.c +0 -101
  548. data/third_party/boringssl-with-bazel/src/crypto/spx/address.h +0 -50
  549. data/third_party/boringssl-with-bazel/src/crypto/spx/fors.c +0 -133
  550. data/third_party/boringssl-with-bazel/src/crypto/spx/fors.h +0 -54
  551. data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.c +0 -150
  552. data/third_party/boringssl-with-bazel/src/crypto/spx/merkle.h +0 -61
  553. data/third_party/boringssl-with-bazel/src/crypto/spx/params.h +0 -71
  554. data/third_party/boringssl-with-bazel/src/crypto/spx/spx.c +0 -140
  555. data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.c +0 -53
  556. data/third_party/boringssl-with-bazel/src/crypto/spx/spx_util.h +0 -44
  557. data/third_party/boringssl-with-bazel/src/crypto/spx/thash.c +0 -136
  558. data/third_party/boringssl-with-bazel/src/crypto/spx/thash.h +0 -70
  559. data/third_party/boringssl-with-bazel/src/crypto/spx/wots.c +0 -135
  560. data/third_party/boringssl-with-bazel/src/crypto/spx/wots.h +0 -45
  561. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/dilithium.h +0 -129
  562. data/third_party/boringssl-with-bazel/src/include/openssl/experimental/spx.h +0 -90
  563. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_bool.c → a_bool.cc} +0 -0
  564. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_gentm.c → a_gentm.cc} +0 -0
  565. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_octet.c → a_octet.cc} +0 -0
  566. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_strex.c → a_strex.cc} +0 -0
  567. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_time.c → a_time.cc} +0 -0
  568. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{a_utctm.c → a_utctm.cc} +0 -0
  569. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_par.c → asn1_par.cc} +0 -0
  570. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{f_int.c → f_int.cc} +0 -0
  571. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{f_string.c → f_string.cc} +0 -0
  572. /data/third_party/boringssl-with-bazel/src/crypto/asn1/{tasn_typ.c → tasn_typ.cc} +0 -0
  573. /data/third_party/boringssl-with-bazel/src/crypto/bio/{errno.c → errno.cc} +0 -0
  574. /data/third_party/boringssl-with-bazel/src/crypto/bio/{fd.c → fd.cc} +0 -0
  575. /data/third_party/boringssl-with-bazel/src/crypto/bio/{hexdump.c → hexdump.cc} +0 -0
  576. /data/third_party/boringssl-with-bazel/src/crypto/bio/{socket.c → socket.cc} +0 -0
  577. /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{cipher_extra.c → cipher_extra.cc} +0 -0
  578. /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{derive_key.c → derive_key.cc} +0 -0
  579. /data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/{tls_cbc.c → tls_cbc.cc} +0 -0
  580. /data/third_party/boringssl-with-bazel/src/crypto/des/{des.c → des.cc} +0 -0
  581. /data/third_party/boringssl-with-bazel/src/crypto/dh_extra/{params.c → params.cc} +0 -0
  582. /data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/{ecdh_extra.c → ecdh_extra.cc} +0 -0
  583. /data/third_party/boringssl-with-bazel/src/crypto/evp/{evp_asn1.c → evp_asn1.cc} +0 -0
  584. /data/third_party/boringssl-with-bazel/src/crypto/evp/{sign.c → sign.cc} +0 -0
  585. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{aes.c.inc → aes.cc.inc} +0 -0
  586. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/{mode_wrappers.c.inc → mode_wrappers.cc.inc} +0 -0
  587. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{bytes.c.inc → bytes.cc.inc} +0 -0
  588. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{cmp.c.inc → cmp.cc.inc} +0 -0
  589. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{generic.c.inc → generic.cc.inc} +0 -0
  590. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{jacobi.c.inc → jacobi.cc.inc} +0 -0
  591. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{montgomery_inv.c.inc → montgomery_inv.cc.inc} +0 -0
  592. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{random.c.inc → random.cc.inc} +0 -0
  593. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{rsaz_exp.c.inc → rsaz_exp.cc.inc} +0 -0
  594. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/{sqrt.c.inc → sqrt.cc.inc} +0 -0
  595. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/{e_aesccm.c.inc → e_aesccm.cc.inc} +0 -0
  596. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/{check.c.inc → check.cc.inc} +0 -0
  597. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{ec_montgomery.c.inc → ec_montgomery.cc.inc} +0 -0
  598. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/{simple.c.inc → simple.cc.inc} +0 -0
  599. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cbc.c.inc → cbc.cc.inc} +0 -0
  600. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{cfb.c.inc → cfb.cc.inc} +0 -0
  601. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ctr.c.inc → ctr.cc.inc} +0 -0
  602. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/{ofb.c.inc → ofb.cc.inc} +0 -0
  603. /data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/{kdf.c.inc → kdf.cc.inc} +0 -0
  604. /data/third_party/boringssl-with-bazel/src/crypto/obj/{obj_xref.c → obj_xref.cc} +0 -0
  605. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_all.c → pem_all.cc} +0 -0
  606. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pk8.c → pem_pk8.cc} +0 -0
  607. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_pkey.c → pem_pkey.cc} +0 -0
  608. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_x509.c → pem_x509.cc} +0 -0
  609. /data/third_party/boringssl-with-bazel/src/crypto/pem/{pem_xaux.c → pem_xaux.cc} +0 -0
  610. /data/third_party/boringssl-with-bazel/src/crypto/rc4/{rc4.c → rc4.cc} +0 -0
  611. /data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/{rsa_print.c → rsa_print.cc} +0 -0
  612. /data/third_party/boringssl-with-bazel/src/crypto/{thread.c → thread.cc} +0 -0
  613. /data/third_party/boringssl-with-bazel/src/crypto/x509/{by_file.c → by_file.cc} +0 -0
  614. /data/third_party/boringssl-with-bazel/src/crypto/x509/{i2d_pr.c → i2d_pr.cc} +0 -0
  615. /data/third_party/boringssl-with-bazel/src/crypto/x509/{name_print.c → name_print.cc} +0 -0
  616. /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_crl.c → t_crl.cc} +0 -0
  617. /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_req.c → t_req.cc} +0 -0
  618. /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_x509.c → t_x509.cc} +0 -0
  619. /data/third_party/boringssl-with-bazel/src/crypto/x509/{t_x509a.c → t_x509a.cc} +0 -0
  620. /data/third_party/boringssl-with-bazel/src/crypto/x509/{v3_akeya.c → v3_akeya.cc} +0 -0
  621. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509.c → x509.cc} +0 -0
  622. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_cmp.c → x509_cmp.cc} +0 -0
  623. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_d2.c → x509_d2.cc} +0 -0
  624. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_def.c → x509_def.cc} +0 -0
  625. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_ext.c → x509_ext.cc} +0 -0
  626. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_obj.c → x509_obj.cc} +0 -0
  627. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_req.c → x509_req.cc} +0 -0
  628. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_set.c → x509_set.cc} +0 -0
  629. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_trs.c → x509_trs.cc} +0 -0
  630. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509_txt.c → x509_txt.cc} +0 -0
  631. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509cset.c → x509cset.cc} +0 -0
  632. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509name.c → x509name.cc} +0 -0
  633. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x509rset.c → x509rset.cc} +0 -0
  634. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_algor.c → x_algor.cc} +0 -0
  635. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_attrib.c → x_attrib.cc} +0 -0
  636. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_exten.c → x_exten.cc} +0 -0
  637. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_req.c → x_req.cc} +0 -0
  638. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_sig.c → x_sig.cc} +0 -0
  639. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_spki.c → x_spki.cc} +0 -0
  640. /data/third_party/boringssl-with-bazel/src/crypto/x509/{x_val.c → x_val.cc} +0 -0
@@ -39,9 +39,11 @@
39
39
  #include "absl/strings/strip.h"
40
40
  #include "absl/types/optional.h"
41
41
  #include "envoy/config/core/v3/base.upb.h"
42
- #include "envoy/service/status/v3/csds.upb.h"
42
+ #include "envoy/service/discovery/v3/discovery.upb.h"
43
+ #include "envoy/service/discovery/v3/discovery.upbdefs.h"
43
44
  #include "google/protobuf/any.upb.h"
44
45
  #include "google/protobuf/timestamp.upb.h"
46
+ #include "google/rpc/status.upb.h"
45
47
  #include "src/core/lib/iomgr/exec_ctx.h"
46
48
  #include "src/core/util/backoff.h"
47
49
  #include "src/core/util/debug_location.h"
@@ -55,6 +57,8 @@
55
57
  #include "src/core/xds/xds_client/xds_locality.h"
56
58
  #include "upb/base/string_view.h"
57
59
  #include "upb/mem/arena.h"
60
+ #include "upb/reflection/def.h"
61
+ #include "upb/text/encode.h"
58
62
 
59
63
  #define GRPC_XDS_INITIAL_CONNECT_BACKOFF_SECONDS 1
60
64
  #define GRPC_XDS_RECONNECT_BACKOFF_MULTIPLIER 1.6
@@ -141,44 +145,6 @@ class XdsClient::XdsChannel::AdsCall final
141
145
  private:
142
146
  class AdsReadDelayHandle;
143
147
 
144
- class AdsResponseParser final : public XdsApi::AdsResponseParserInterface {
145
- public:
146
- struct Result {
147
- const XdsResourceType* type;
148
- std::string type_url;
149
- std::string version;
150
- std::string nonce;
151
- std::vector<std::string> errors;
152
- std::map<std::string /*authority*/, std::set<XdsResourceKey>>
153
- resources_seen;
154
- uint64_t num_valid_resources = 0;
155
- uint64_t num_invalid_resources = 0;
156
- RefCountedPtr<ReadDelayHandle> read_delay_handle;
157
- };
158
-
159
- explicit AdsResponseParser(AdsCall* ads_call) : ads_call_(ads_call) {}
160
-
161
- absl::Status ProcessAdsResponseFields(AdsResponseFields fields) override
162
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
163
-
164
- void ParseResource(upb_Arena* arena, size_t idx, absl::string_view type_url,
165
- absl::string_view resource_name,
166
- absl::string_view serialized_resource) override
167
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
168
-
169
- void ResourceWrapperParsingFailed(size_t idx,
170
- absl::string_view message) override;
171
-
172
- Result TakeResult() { return std::move(result_); }
173
-
174
- private:
175
- XdsClient* xds_client() const { return ads_call_->xds_client(); }
176
-
177
- AdsCall* ads_call_;
178
- const Timestamp update_time_ = Timestamp::Now();
179
- Result result_;
180
- };
181
-
182
148
  class ResourceTimer final : public InternallyRefCounted<ResourceTimer> {
183
149
  public:
184
150
  ResourceTimer(const XdsResourceType* type, const XdsResourceName& name)
@@ -239,7 +205,7 @@ class XdsClient::XdsChannel::AdsCall final
239
205
  auto& authority_state =
240
206
  ads_call->xds_client()->authority_state_map_[name_.authority];
241
207
  ResourceState& state = authority_state.resource_map[type_][name_.key];
242
- if (state.resource != nullptr) return;
208
+ if (state.HasResource()) return;
243
209
  // Start timer.
244
210
  ads_call_ = std::move(ads_call);
245
211
  timer_handle_ = ads_call_->xds_client()->engine()->RunAfter(
@@ -260,7 +226,7 @@ class XdsClient::XdsChannel::AdsCall final
260
226
  ResourceState& state = authority_state.resource_map[type_][name_.key];
261
227
  // We might have received the resource after the timer fired but before
262
228
  // the callback ran.
263
- if (state.resource == nullptr) {
229
+ if (!state.HasResource()) {
264
230
  GRPC_TRACE_LOG(xds_client, INFO)
265
231
  << "[xds_client " << ads_call_->xds_client() << "] xds server "
266
232
  << ads_call_->xds_channel()->server_.server_uri()
@@ -270,9 +236,10 @@ class XdsClient::XdsChannel::AdsCall final
270
236
  name_.authority, type_->type_url(), name_.key)
271
237
  << "} from xds server";
272
238
  resource_seen_ = true;
273
- state.meta.client_status = XdsApi::ResourceMetadata::DOES_NOT_EXIST;
274
- ads_call_->xds_client()->NotifyWatchersOnResourceDoesNotExist(
275
- state.watchers, ReadDelayHandle::NoWait());
239
+ state.SetDoesNotExist();
240
+ ads_call_->xds_client()->NotifyWatchersOnResourceChanged(
241
+ absl::NotFoundError("does not exist"), state.watchers(),
242
+ ReadDelayHandle::NoWait());
276
243
  }
277
244
  }
278
245
  ads_call_->xds_client()->work_serializer_.DrainQueue();
@@ -323,9 +290,39 @@ class XdsClient::XdsChannel::AdsCall final
323
290
  subscribed_resources;
324
291
  };
325
292
 
293
+ std::string CreateAdsRequest(absl::string_view type_url,
294
+ absl::string_view version,
295
+ absl::string_view nonce,
296
+ const std::vector<std::string>& resource_names,
297
+ absl::Status status) const
298
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
299
+
326
300
  void SendMessageLocked(const XdsResourceType* type)
327
301
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
328
302
 
303
+ struct DecodeContext {
304
+ upb::Arena arena;
305
+ const XdsResourceType* type;
306
+ std::string type_url;
307
+ std::string version;
308
+ std::string nonce;
309
+ std::vector<std::string> errors;
310
+ std::map<std::string /*authority*/, std::set<XdsResourceKey>>
311
+ resources_seen;
312
+ uint64_t num_valid_resources = 0;
313
+ uint64_t num_invalid_resources = 0;
314
+ Timestamp update_time = Timestamp::Now();
315
+ RefCountedPtr<ReadDelayHandle> read_delay_handle;
316
+ };
317
+ void ParseResource(size_t idx, absl::string_view type_url,
318
+ absl::string_view resource_name,
319
+ absl::string_view serialized_resource,
320
+ DecodeContext* context)
321
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
322
+ absl::Status DecodeAdsResponse(absl::string_view encoded_response,
323
+ DecodeContext* context)
324
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
325
+
329
326
  void OnRequestSent(bool ok);
330
327
  void OnRecvMessage(absl::string_view payload);
331
328
  void OnStatusReceived(absl::Status status);
@@ -535,15 +532,6 @@ void XdsClient::XdsChannel::SetChannelStatusLocked(absl::Status status) {
535
532
  server_.server_uri(), ": ",
536
533
  status.message()));
537
534
  LOG(INFO) << "[xds_client " << xds_client() << "] " << status;
538
- // If the node ID is set, append that to the status message that we send to
539
- // the watchers, so that it will appear in log messages visible to users.
540
- const auto* node = xds_client_->bootstrap_->node();
541
- if (node != nullptr) {
542
- status = absl::Status(
543
- status.code(),
544
- absl::StrCat(status.message(),
545
- " (node ID:", xds_client_->bootstrap_->node()->id(), ")"));
546
- }
547
535
  // If status was previously OK, report that the channel has gone unhealthy.
548
536
  if (status_.ok() && xds_client_->metrics_reporter_ != nullptr) {
549
537
  xds_client_->metrics_reporter_->ReportServerFailure(server_.server_uri());
@@ -552,7 +540,8 @@ void XdsClient::XdsChannel::SetChannelStatusLocked(absl::Status status) {
552
540
  // error for any new watchers that may be started.
553
541
  status_ = status;
554
542
  // Find all watchers for this channel.
555
- std::set<RefCountedPtr<ResourceWatcherInterface>> watchers;
543
+ WatcherSet watchers_cached;
544
+ WatcherSet watchers_uncached;
556
545
  for (auto& a : xds_client_->authority_state_map_) { // authority
557
546
  if (a.second.xds_channels.empty() || a.second.xds_channels.back() != this ||
558
547
  MaybeFallbackLocked(a.first, a.second)) {
@@ -560,22 +549,22 @@ void XdsClient::XdsChannel::SetChannelStatusLocked(absl::Status status) {
560
549
  }
561
550
  for (const auto& t : a.second.resource_map) { // type
562
551
  for (const auto& r : t.second) { // resource id
563
- for (const auto& w : r.second.watchers) { // watchers
564
- watchers.insert(w.second);
552
+ auto& watchers =
553
+ r.second.HasResource() ? watchers_cached : watchers_uncached;
554
+ for (const auto& w : r.second.watchers()) { // watchers
555
+ watchers.insert(w);
565
556
  }
566
557
  }
567
558
  }
568
559
  }
569
- if (!watchers.empty()) {
570
- // Enqueue notification for the watchers.
571
- xds_client_->work_serializer_.Schedule(
572
- [watchers = std::move(watchers), status = std::move(status)]()
573
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(xds_client_->work_serializer_) {
574
- for (const auto& watcher : watchers) {
575
- watcher->OnError(status, ReadDelayHandle::NoWait());
576
- }
577
- },
578
- DEBUG_LOCATION);
560
+ // Enqueue notifications for the watchers.
561
+ if (!watchers_cached.empty()) {
562
+ xds_client_->NotifyWatchersOnAmbientError(
563
+ status, std::move(watchers_cached), ReadDelayHandle::NoWait());
564
+ }
565
+ if (!watchers_uncached.empty()) {
566
+ xds_client_->NotifyWatchersOnResourceChanged(
567
+ status, std::move(watchers_uncached), ReadDelayHandle::NoWait());
579
568
  }
580
569
  }
581
570
 
@@ -682,203 +671,6 @@ class XdsClient::XdsChannel::AdsCall::AdsReadDelayHandle final
682
671
  RefCountedPtr<AdsCall> ads_call_;
683
672
  };
684
673
 
685
- //
686
- // XdsClient::XdsChannel::AdsCall::AdsResponseParser
687
- //
688
-
689
- absl::Status
690
- XdsClient::XdsChannel::AdsCall::AdsResponseParser::ProcessAdsResponseFields(
691
- AdsResponseFields fields) {
692
- GRPC_TRACE_LOG(xds_client, INFO)
693
- << "[xds_client " << ads_call_->xds_client() << "] xds server "
694
- << ads_call_->xds_channel()->server_.server_uri()
695
- << ": received ADS response: type_url=" << fields.type_url
696
- << ", version=" << fields.version << ", nonce=" << fields.nonce
697
- << ", num_resources=" << fields.num_resources;
698
- result_.type =
699
- ads_call_->xds_client()->GetResourceTypeLocked(fields.type_url);
700
- if (result_.type == nullptr) {
701
- return absl::InvalidArgumentError(
702
- absl::StrCat("unknown resource type ", fields.type_url));
703
- }
704
- result_.type_url = std::move(fields.type_url);
705
- result_.version = std::move(fields.version);
706
- result_.nonce = std::move(fields.nonce);
707
- result_.read_delay_handle =
708
- MakeRefCounted<AdsReadDelayHandle>(ads_call_->Ref());
709
- return absl::OkStatus();
710
- }
711
-
712
- namespace {
713
-
714
- // Build a resource metadata struct for ADS result accepting methods and CSDS.
715
- XdsApi::ResourceMetadata CreateResourceMetadataAcked(
716
- std::string serialized_proto, std::string version, Timestamp update_time) {
717
- XdsApi::ResourceMetadata resource_metadata;
718
- resource_metadata.serialized_proto = std::move(serialized_proto);
719
- resource_metadata.update_time = update_time;
720
- resource_metadata.version = std::move(version);
721
- resource_metadata.client_status = XdsApi::ResourceMetadata::ACKED;
722
- return resource_metadata;
723
- }
724
-
725
- // Update resource_metadata for NACK.
726
- void UpdateResourceMetadataNacked(const std::string& version,
727
- const std::string& details,
728
- Timestamp update_time,
729
- XdsApi::ResourceMetadata* resource_metadata) {
730
- resource_metadata->client_status = XdsApi::ResourceMetadata::NACKED;
731
- resource_metadata->failed_version = version;
732
- resource_metadata->failed_details = details;
733
- resource_metadata->failed_update_time = update_time;
734
- }
735
-
736
- } // namespace
737
-
738
- void XdsClient::XdsChannel::AdsCall::AdsResponseParser::ParseResource(
739
- upb_Arena* arena, size_t idx, absl::string_view type_url,
740
- absl::string_view resource_name, absl::string_view serialized_resource) {
741
- std::string error_prefix = absl::StrCat(
742
- "resource index ", idx, ": ",
743
- resource_name.empty() ? "" : absl::StrCat(resource_name, ": "));
744
- // Check the type_url of the resource.
745
- if (result_.type_url != type_url) {
746
- result_.errors.emplace_back(
747
- absl::StrCat(error_prefix, "incorrect resource type \"", type_url,
748
- "\" (should be \"", result_.type_url, "\")"));
749
- ++result_.num_invalid_resources;
750
- return;
751
- }
752
- // Parse the resource.
753
- XdsResourceType::DecodeContext context = {
754
- xds_client(), ads_call_->xds_channel()->server_, &xds_client_trace,
755
- xds_client()->def_pool_.ptr(), arena};
756
- XdsResourceType::DecodeResult decode_result =
757
- result_.type->Decode(context, serialized_resource);
758
- // If we didn't already have the resource name from the Resource
759
- // wrapper, try to get it from the decoding result.
760
- if (resource_name.empty()) {
761
- if (decode_result.name.has_value()) {
762
- resource_name = *decode_result.name;
763
- error_prefix =
764
- absl::StrCat("resource index ", idx, ": ", resource_name, ": ");
765
- } else {
766
- // We don't have any way of determining the resource name, so
767
- // there's nothing more we can do here.
768
- result_.errors.emplace_back(absl::StrCat(
769
- error_prefix, decode_result.resource.status().ToString()));
770
- ++result_.num_invalid_resources;
771
- return;
772
- }
773
- }
774
- // If decoding failed, make sure we include the error in the NACK.
775
- const absl::Status& decode_status = decode_result.resource.status();
776
- if (!decode_status.ok()) {
777
- result_.errors.emplace_back(
778
- absl::StrCat(error_prefix, decode_status.ToString()));
779
- }
780
- // Check the resource name.
781
- auto parsed_resource_name =
782
- xds_client()->ParseXdsResourceName(resource_name, result_.type);
783
- if (!parsed_resource_name.ok()) {
784
- result_.errors.emplace_back(
785
- absl::StrCat(error_prefix, "Cannot parse xDS resource name"));
786
- ++result_.num_invalid_resources;
787
- return;
788
- }
789
- // Cancel resource-does-not-exist timer, if needed.
790
- auto timer_it = ads_call_->state_map_.find(result_.type);
791
- if (timer_it != ads_call_->state_map_.end()) {
792
- auto it = timer_it->second.subscribed_resources.find(
793
- parsed_resource_name->authority);
794
- if (it != timer_it->second.subscribed_resources.end()) {
795
- auto res_it = it->second.find(parsed_resource_name->key);
796
- if (res_it != it->second.end()) {
797
- res_it->second->MarkSeen();
798
- }
799
- }
800
- }
801
- // Lookup the authority in the cache.
802
- auto authority_it =
803
- xds_client()->authority_state_map_.find(parsed_resource_name->authority);
804
- if (authority_it == xds_client()->authority_state_map_.end()) {
805
- return; // Skip resource -- we don't have a subscription for it.
806
- }
807
- // Found authority, so look up type.
808
- AuthorityState& authority_state = authority_it->second;
809
- auto type_it = authority_state.resource_map.find(result_.type);
810
- if (type_it == authority_state.resource_map.end()) {
811
- return; // Skip resource -- we don't have a subscription for it.
812
- }
813
- auto& type_map = type_it->second;
814
- // Found type, so look up resource key.
815
- auto it = type_map.find(parsed_resource_name->key);
816
- if (it == type_map.end()) {
817
- return; // Skip resource -- we don't have a subscription for it.
818
- }
819
- ResourceState& resource_state = it->second;
820
- // If needed, record that we've seen this resource.
821
- if (result_.type->AllResourcesRequiredInSotW()) {
822
- result_.resources_seen[parsed_resource_name->authority].insert(
823
- parsed_resource_name->key);
824
- }
825
- // If we previously ignored the resource's deletion, log that we're
826
- // now re-adding it.
827
- if (resource_state.ignored_deletion) {
828
- LOG(INFO) << "[xds_client " << xds_client() << "] xds server "
829
- << ads_call_->xds_channel()->server_.server_uri()
830
- << ": server returned new version of resource for which we "
831
- "previously ignored a deletion: type "
832
- << type_url << " name " << resource_name;
833
- resource_state.ignored_deletion = false;
834
- }
835
- // Update resource state based on whether the resource is valid.
836
- if (!decode_status.ok()) {
837
- xds_client()->NotifyWatchersOnErrorLocked(
838
- resource_state.watchers,
839
- absl::UnavailableError(
840
- absl::StrCat("invalid resource: ", decode_status.ToString())),
841
- result_.read_delay_handle);
842
- UpdateResourceMetadataNacked(result_.version, decode_status.ToString(),
843
- update_time_, &resource_state.meta);
844
- ++result_.num_invalid_resources;
845
- return;
846
- }
847
- // Resource is valid.
848
- ++result_.num_valid_resources;
849
- // If it didn't change, ignore it.
850
- if (resource_state.resource != nullptr &&
851
- result_.type->ResourcesEqual(resource_state.resource.get(),
852
- decode_result.resource->get())) {
853
- GRPC_TRACE_LOG(xds_client, INFO)
854
- << "[xds_client " << xds_client() << "] " << result_.type_url
855
- << " resource " << resource_name << " identical to current, ignoring.";
856
- return;
857
- }
858
- // Update the resource state.
859
- resource_state.resource = std::move(*decode_result.resource);
860
- resource_state.meta = CreateResourceMetadataAcked(
861
- std::string(serialized_resource), result_.version, update_time_);
862
- // Notify watchers.
863
- auto& watchers_list = resource_state.watchers;
864
- xds_client()->work_serializer_.Schedule(
865
- [watchers_list, value = resource_state.resource,
866
- read_delay_handle = result_.read_delay_handle]()
867
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&xds_client()->work_serializer_) {
868
- for (const auto& p : watchers_list) {
869
- p.first->OnGenericResourceChanged(value, read_delay_handle);
870
- }
871
- },
872
- DEBUG_LOCATION);
873
- }
874
-
875
- void XdsClient::XdsChannel::AdsCall::AdsResponseParser::
876
- ResourceWrapperParsingFailed(size_t idx, absl::string_view message) {
877
- result_.errors.emplace_back(
878
- absl::StrCat("resource index ", idx, ": ", message));
879
- ++result_.num_invalid_resources;
880
- }
881
-
882
674
  //
883
675
  // XdsClient::XdsChannel::AdsCall
884
676
  //
@@ -938,31 +730,6 @@ void XdsClient::XdsChannel::AdsCall::Orphan() {
938
730
  streaming_call_.reset();
939
731
  }
940
732
 
941
- void XdsClient::XdsChannel::AdsCall::SendMessageLocked(
942
- const XdsResourceType* type)
943
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
944
- // Buffer message sending if an existing message is in flight.
945
- if (send_message_pending_ != nullptr) {
946
- buffered_requests_.insert(type);
947
- return;
948
- }
949
- auto& state = state_map_[type];
950
- std::string serialized_message = xds_client()->api_.CreateAdsRequest(
951
- type->type_url(), xds_channel()->resource_type_version_map_[type],
952
- state.nonce, ResourceNamesForRequest(type), state.status,
953
- !sent_initial_message_);
954
- sent_initial_message_ = true;
955
- GRPC_TRACE_LOG(xds_client, INFO)
956
- << "[xds_client " << xds_client() << "] xds server "
957
- << xds_channel()->server_.server_uri()
958
- << ": sending ADS request: type=" << type->type_url()
959
- << " version=" << xds_channel()->resource_type_version_map_[type]
960
- << " nonce=" << state.nonce << " error=" << state.status;
961
- state.status = absl::OkStatus();
962
- streaming_call_->SendMessage(std::move(serialized_message));
963
- send_message_pending_ = type;
964
- }
965
-
966
733
  void XdsClient::XdsChannel::AdsCall::SubscribeLocked(
967
734
  const XdsResourceType* type, const XdsResourceName& name, bool delay_send) {
968
735
  auto& state = state_map_[type].subscribed_resources[name.authority][name.key];
@@ -980,6 +747,10 @@ void XdsClient::XdsChannel::AdsCall::UnsubscribeLocked(
980
747
  authority_map.erase(name.key);
981
748
  if (authority_map.empty()) {
982
749
  type_state_map.subscribed_resources.erase(name.authority);
750
+ // Note: We intentionally do not remove the top-level map entry for
751
+ // the resource type even if the authority map for the type is empty,
752
+ // because we need to retain the nonce in case a new watch is
753
+ // started for a resource of this type while this stream is still open.
983
754
  }
984
755
  // Don't need to send unsubscription message if this was the last
985
756
  // resource we were subscribed to, since we'll be closing the stream
@@ -996,6 +767,116 @@ bool XdsClient::XdsChannel::AdsCall::HasSubscribedResources() const {
996
767
  return false;
997
768
  }
998
769
 
770
+ namespace {
771
+
772
+ void MaybeLogDiscoveryRequest(
773
+ const XdsClient* client, upb_DefPool* def_pool,
774
+ const envoy_service_discovery_v3_DiscoveryRequest* request) {
775
+ if (GRPC_TRACE_FLAG_ENABLED(xds_client) && ABSL_VLOG_IS_ON(2)) {
776
+ const upb_MessageDef* msg_type =
777
+ envoy_service_discovery_v3_DiscoveryRequest_getmsgdef(def_pool);
778
+ char buf[10240];
779
+ upb_TextEncode(reinterpret_cast<const upb_Message*>(request), msg_type,
780
+ nullptr, 0, buf, sizeof(buf));
781
+ VLOG(2) << "[xds_client " << client << "] constructed ADS request: " << buf;
782
+ }
783
+ }
784
+
785
+ std::string SerializeDiscoveryRequest(
786
+ upb_Arena* arena, envoy_service_discovery_v3_DiscoveryRequest* request) {
787
+ size_t output_length;
788
+ char* output = envoy_service_discovery_v3_DiscoveryRequest_serialize(
789
+ request, arena, &output_length);
790
+ return std::string(output, output_length);
791
+ }
792
+
793
+ } // namespace
794
+
795
+ std::string XdsClient::XdsChannel::AdsCall::CreateAdsRequest(
796
+ absl::string_view type_url, absl::string_view version,
797
+ absl::string_view nonce, const std::vector<std::string>& resource_names,
798
+ absl::Status status) const {
799
+ upb::Arena arena;
800
+ // Create a request.
801
+ envoy_service_discovery_v3_DiscoveryRequest* request =
802
+ envoy_service_discovery_v3_DiscoveryRequest_new(arena.ptr());
803
+ // Set type_url.
804
+ std::string type_url_str = absl::StrCat("type.googleapis.com/", type_url);
805
+ envoy_service_discovery_v3_DiscoveryRequest_set_type_url(
806
+ request, StdStringToUpbString(type_url_str));
807
+ // Set version_info.
808
+ if (!version.empty()) {
809
+ envoy_service_discovery_v3_DiscoveryRequest_set_version_info(
810
+ request, StdStringToUpbString(version));
811
+ }
812
+ // Set nonce.
813
+ if (!nonce.empty()) {
814
+ envoy_service_discovery_v3_DiscoveryRequest_set_response_nonce(
815
+ request, StdStringToUpbString(nonce));
816
+ }
817
+ // Set error_detail if it's a NACK.
818
+ std::string error_string_storage;
819
+ if (!status.ok()) {
820
+ google_rpc_Status* error_detail =
821
+ envoy_service_discovery_v3_DiscoveryRequest_mutable_error_detail(
822
+ request, arena.ptr());
823
+ // Hard-code INVALID_ARGUMENT as the status code.
824
+ // TODO(roth): If at some point we decide we care about this value,
825
+ // we could attach a status code to the individual errors where we
826
+ // generate them in the parsing code, and then use that here.
827
+ google_rpc_Status_set_code(error_detail, GRPC_STATUS_INVALID_ARGUMENT);
828
+ // Error description comes from the status that was passed in.
829
+ error_string_storage = std::string(status.message());
830
+ upb_StringView error_description =
831
+ StdStringToUpbString(error_string_storage);
832
+ google_rpc_Status_set_message(error_detail, error_description);
833
+ }
834
+ // Populate node.
835
+ if (!sent_initial_message_) {
836
+ envoy_config_core_v3_Node* node_msg =
837
+ envoy_service_discovery_v3_DiscoveryRequest_mutable_node(request,
838
+ arena.ptr());
839
+ PopulateXdsNode(xds_client()->bootstrap_->node(),
840
+ xds_client()->user_agent_name_,
841
+ xds_client()->user_agent_version_, node_msg, arena.ptr());
842
+ envoy_config_core_v3_Node_add_client_features(
843
+ node_msg, upb_StringView_FromString("xds.config.resource-in-sotw"),
844
+ arena.ptr());
845
+ }
846
+ // Add resource_names.
847
+ for (const std::string& resource_name : resource_names) {
848
+ envoy_service_discovery_v3_DiscoveryRequest_add_resource_names(
849
+ request, StdStringToUpbString(resource_name), arena.ptr());
850
+ }
851
+ MaybeLogDiscoveryRequest(xds_client(), xds_client()->def_pool_.ptr(),
852
+ request);
853
+ return SerializeDiscoveryRequest(arena.ptr(), request);
854
+ }
855
+
856
+ void XdsClient::XdsChannel::AdsCall::SendMessageLocked(
857
+ const XdsResourceType* type)
858
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_) {
859
+ // Buffer message sending if an existing message is in flight.
860
+ if (send_message_pending_ != nullptr) {
861
+ buffered_requests_.insert(type);
862
+ return;
863
+ }
864
+ auto& state = state_map_[type];
865
+ std::string serialized_message = CreateAdsRequest(
866
+ type->type_url(), xds_channel()->resource_type_version_map_[type],
867
+ state.nonce, ResourceNamesForRequest(type), state.status);
868
+ sent_initial_message_ = true;
869
+ GRPC_TRACE_LOG(xds_client, INFO)
870
+ << "[xds_client " << xds_client() << "] xds server "
871
+ << xds_channel()->server_.server_uri()
872
+ << ": sending ADS request: type=" << type->type_url()
873
+ << " version=" << xds_channel()->resource_type_version_map_[type]
874
+ << " nonce=" << state.nonce << " error=" << state.status;
875
+ state.status = absl::OkStatus();
876
+ streaming_call_->SendMessage(std::move(serialized_message));
877
+ send_message_pending_ = type;
878
+ }
879
+
999
880
  void XdsClient::XdsChannel::AdsCall::OnRequestSent(bool ok) {
1000
881
  MutexLock lock(&xds_client()->mu_);
1001
882
  // For each resource that was in the message we just sent, start the
@@ -1028,18 +909,261 @@ void XdsClient::XdsChannel::AdsCall::OnRequestSent(bool ok) {
1028
909
  }
1029
910
  }
1030
911
 
912
+ void XdsClient::XdsChannel::AdsCall::ParseResource(
913
+ size_t idx, absl::string_view type_url, absl::string_view resource_name,
914
+ absl::string_view serialized_resource, DecodeContext* context) {
915
+ std::string error_prefix = absl::StrCat(
916
+ "resource index ", idx, ": ",
917
+ resource_name.empty() ? "" : absl::StrCat(resource_name, ": "));
918
+ // Check the type_url of the resource.
919
+ if (context->type_url != type_url) {
920
+ context->errors.emplace_back(
921
+ absl::StrCat(error_prefix, "incorrect resource type \"", type_url,
922
+ "\" (should be \"", context->type_url, "\")"));
923
+ ++context->num_invalid_resources;
924
+ return;
925
+ }
926
+ // Parse the resource.
927
+ XdsResourceType::DecodeContext resource_type_context = {
928
+ xds_client(), xds_channel()->server_, &xds_client_trace,
929
+ xds_client()->def_pool_.ptr(), context->arena.ptr()};
930
+ XdsResourceType::DecodeResult decode_result =
931
+ context->type->Decode(resource_type_context, serialized_resource);
932
+ // If we didn't already have the resource name from the Resource
933
+ // wrapper, try to get it from the decoding result.
934
+ if (resource_name.empty()) {
935
+ if (decode_result.name.has_value()) {
936
+ resource_name = *decode_result.name;
937
+ error_prefix =
938
+ absl::StrCat("resource index ", idx, ": ", resource_name, ": ");
939
+ } else {
940
+ // We don't have any way of determining the resource name, so
941
+ // there's nothing more we can do here.
942
+ context->errors.emplace_back(absl::StrCat(
943
+ error_prefix, decode_result.resource.status().ToString()));
944
+ ++context->num_invalid_resources;
945
+ return;
946
+ }
947
+ }
948
+ // If decoding failed, make sure we include the error in the NACK.
949
+ const absl::Status& decode_status = decode_result.resource.status();
950
+ if (!decode_status.ok()) {
951
+ context->errors.emplace_back(
952
+ absl::StrCat(error_prefix, decode_status.ToString()));
953
+ }
954
+ // Check the resource name.
955
+ auto parsed_resource_name =
956
+ xds_client()->ParseXdsResourceName(resource_name, context->type);
957
+ if (!parsed_resource_name.ok()) {
958
+ context->errors.emplace_back(
959
+ absl::StrCat(error_prefix, "Cannot parse xDS resource name"));
960
+ ++context->num_invalid_resources;
961
+ return;
962
+ }
963
+ // Cancel resource-does-not-exist timer, if needed.
964
+ auto timer_it = state_map_.find(context->type);
965
+ if (timer_it != state_map_.end()) {
966
+ auto it = timer_it->second.subscribed_resources.find(
967
+ parsed_resource_name->authority);
968
+ if (it != timer_it->second.subscribed_resources.end()) {
969
+ auto res_it = it->second.find(parsed_resource_name->key);
970
+ if (res_it != it->second.end()) {
971
+ res_it->second->MarkSeen();
972
+ }
973
+ }
974
+ }
975
+ // Lookup the authority in the cache.
976
+ auto authority_it =
977
+ xds_client()->authority_state_map_.find(parsed_resource_name->authority);
978
+ if (authority_it == xds_client()->authority_state_map_.end()) {
979
+ return; // Skip resource -- we don't have a subscription for it.
980
+ }
981
+ // Found authority, so look up type.
982
+ AuthorityState& authority_state = authority_it->second;
983
+ auto type_it = authority_state.resource_map.find(context->type);
984
+ if (type_it == authority_state.resource_map.end()) {
985
+ return; // Skip resource -- we don't have a subscription for it.
986
+ }
987
+ auto& type_map = type_it->second;
988
+ // Found type, so look up resource key.
989
+ auto it = type_map.find(parsed_resource_name->key);
990
+ if (it == type_map.end()) {
991
+ return; // Skip resource -- we don't have a subscription for it.
992
+ }
993
+ ResourceState& resource_state = it->second;
994
+ // If needed, record that we've seen this resource.
995
+ if (context->type->AllResourcesRequiredInSotW()) {
996
+ context->resources_seen[parsed_resource_name->authority].insert(
997
+ parsed_resource_name->key);
998
+ }
999
+ // If we previously ignored the resource's deletion, log that we're
1000
+ // now re-adding it.
1001
+ if (resource_state.ignored_deletion()) {
1002
+ LOG(INFO) << "[xds_client " << xds_client() << "] xds server "
1003
+ << xds_channel()->server_.server_uri()
1004
+ << ": server returned new version of resource for which we "
1005
+ "previously ignored a deletion: type "
1006
+ << type_url << " name " << resource_name;
1007
+ resource_state.set_ignored_deletion(false);
1008
+ }
1009
+ // Update resource state based on whether the resource is valid.
1010
+ absl::Status status = absl::InvalidArgumentError(
1011
+ absl::StrCat("invalid resource: ", decode_status.ToString()));
1012
+ if (!decode_status.ok()) {
1013
+ if (!resource_state.HasResource()) {
1014
+ xds_client()->NotifyWatchersOnResourceChanged(std::move(status),
1015
+ resource_state.watchers(),
1016
+ context->read_delay_handle);
1017
+ } else {
1018
+ xds_client()->NotifyWatchersOnAmbientError(std::move(status),
1019
+ resource_state.watchers(),
1020
+ context->read_delay_handle);
1021
+ }
1022
+ resource_state.SetNacked(context->version, decode_status.ToString(),
1023
+ context->update_time);
1024
+ ++context->num_invalid_resources;
1025
+ return;
1026
+ }
1027
+ // Resource is valid.
1028
+ ++context->num_valid_resources;
1029
+ // Check if the resource has changed.
1030
+ const bool resource_identical =
1031
+ resource_state.HasResource() &&
1032
+ context->type->ResourcesEqual(resource_state.resource().get(),
1033
+ decode_result.resource->get());
1034
+ // If not changed, keep using the current decoded resource object.
1035
+ // This should avoid wasting memory, since external watchers may be
1036
+ // holding refs to the current object.
1037
+ if (resource_identical) decode_result.resource = resource_state.resource();
1038
+ // Update the resource state.
1039
+ resource_state.SetAcked(std::move(*decode_result.resource),
1040
+ std::string(serialized_resource), context->version,
1041
+ context->update_time);
1042
+ // If the resource didn't change, inhibit watcher notifications.
1043
+ if (resource_identical) {
1044
+ GRPC_TRACE_LOG(xds_client, INFO)
1045
+ << "[xds_client " << xds_client() << "] " << context->type_url
1046
+ << " resource " << resource_name << " identical to current, ignoring.";
1047
+ // If we previously had connectivity problems, notify watchers that
1048
+ // the ambient error has been cleared.
1049
+ if (!xds_channel()->status().ok()) {
1050
+ xds_client()->NotifyWatchersOnAmbientError(absl::OkStatus(),
1051
+ resource_state.watchers(),
1052
+ context->read_delay_handle);
1053
+ }
1054
+ return;
1055
+ }
1056
+ // Notify watchers.
1057
+ xds_client()->NotifyWatchersOnResourceChanged(resource_state.resource(),
1058
+ resource_state.watchers(),
1059
+ context->read_delay_handle);
1060
+ }
1061
+
1062
+ namespace {
1063
+
1064
+ void MaybeLogDiscoveryResponse(
1065
+ const XdsClient* client, upb_DefPool* def_pool,
1066
+ const envoy_service_discovery_v3_DiscoveryResponse* response) {
1067
+ if (GRPC_TRACE_FLAG_ENABLED(xds_client) && ABSL_VLOG_IS_ON(2)) {
1068
+ const upb_MessageDef* msg_type =
1069
+ envoy_service_discovery_v3_DiscoveryResponse_getmsgdef(def_pool);
1070
+ char buf[10240];
1071
+ upb_TextEncode(reinterpret_cast<const upb_Message*>(response), msg_type,
1072
+ nullptr, 0, buf, sizeof(buf));
1073
+ VLOG(2) << "[xds_client " << client << "] received response: " << buf;
1074
+ }
1075
+ }
1076
+
1077
+ } // namespace
1078
+
1079
+ absl::Status XdsClient::XdsChannel::AdsCall::DecodeAdsResponse(
1080
+ absl::string_view encoded_response, DecodeContext* context) {
1081
+ // Decode the response.
1082
+ const envoy_service_discovery_v3_DiscoveryResponse* response =
1083
+ envoy_service_discovery_v3_DiscoveryResponse_parse(
1084
+ encoded_response.data(), encoded_response.size(),
1085
+ context->arena.ptr());
1086
+ // If decoding fails, report a fatal error and return.
1087
+ if (response == nullptr) {
1088
+ return absl::InvalidArgumentError("Can't decode DiscoveryResponse.");
1089
+ }
1090
+ MaybeLogDiscoveryResponse(xds_client(), xds_client()->def_pool_.ptr(),
1091
+ response);
1092
+ // Get the type_url, version, nonce, and number of resources.
1093
+ context->type_url = std::string(absl::StripPrefix(
1094
+ UpbStringToAbsl(
1095
+ envoy_service_discovery_v3_DiscoveryResponse_type_url(response)),
1096
+ "type.googleapis.com/"));
1097
+ context->version = UpbStringToStdString(
1098
+ envoy_service_discovery_v3_DiscoveryResponse_version_info(response));
1099
+ context->nonce = UpbStringToStdString(
1100
+ envoy_service_discovery_v3_DiscoveryResponse_nonce(response));
1101
+ size_t num_resources;
1102
+ const google_protobuf_Any* const* resources =
1103
+ envoy_service_discovery_v3_DiscoveryResponse_resources(response,
1104
+ &num_resources);
1105
+ GRPC_TRACE_LOG(xds_client, INFO)
1106
+ << "[xds_client " << xds_client() << "] xds server "
1107
+ << xds_channel()->server_.server_uri()
1108
+ << ": received ADS response: type_url=" << context->type_url
1109
+ << ", version=" << context->version << ", nonce=" << context->nonce
1110
+ << ", num_resources=" << num_resources;
1111
+ context->type = xds_client()->GetResourceTypeLocked(context->type_url);
1112
+ if (context->type == nullptr) {
1113
+ return absl::InvalidArgumentError(
1114
+ absl::StrCat("unknown resource type ", context->type_url));
1115
+ }
1116
+ context->read_delay_handle = MakeRefCounted<AdsReadDelayHandle>(Ref());
1117
+ // Process each resource.
1118
+ for (size_t i = 0; i < num_resources; ++i) {
1119
+ absl::string_view type_url = absl::StripPrefix(
1120
+ UpbStringToAbsl(google_protobuf_Any_type_url(resources[i])),
1121
+ "type.googleapis.com/");
1122
+ absl::string_view serialized_resource =
1123
+ UpbStringToAbsl(google_protobuf_Any_value(resources[i]));
1124
+ // Unwrap Resource messages, if so wrapped.
1125
+ absl::string_view resource_name;
1126
+ if (type_url == "envoy.service.discovery.v3.Resource") {
1127
+ const auto* resource_wrapper = envoy_service_discovery_v3_Resource_parse(
1128
+ serialized_resource.data(), serialized_resource.size(),
1129
+ context->arena.ptr());
1130
+ if (resource_wrapper == nullptr) {
1131
+ context->errors.emplace_back(absl::StrCat(
1132
+ "resource index ", i, ": Can't decode Resource proto wrapper"));
1133
+ ++context->num_invalid_resources;
1134
+ continue;
1135
+ }
1136
+ const auto* resource =
1137
+ envoy_service_discovery_v3_Resource_resource(resource_wrapper);
1138
+ if (resource == nullptr) {
1139
+ context->errors.emplace_back(
1140
+ absl::StrCat("resource index ", i,
1141
+ ": No resource present in Resource proto wrappe"));
1142
+ ++context->num_invalid_resources;
1143
+ continue;
1144
+ }
1145
+ type_url = absl::StripPrefix(
1146
+ UpbStringToAbsl(google_protobuf_Any_type_url(resource)),
1147
+ "type.googleapis.com/");
1148
+ serialized_resource =
1149
+ UpbStringToAbsl(google_protobuf_Any_value(resource));
1150
+ resource_name = UpbStringToAbsl(
1151
+ envoy_service_discovery_v3_Resource_name(resource_wrapper));
1152
+ }
1153
+ ParseResource(i, type_url, resource_name, serialized_resource, context);
1154
+ }
1155
+ return absl::OkStatus();
1156
+ }
1157
+
1031
1158
  void XdsClient::XdsChannel::AdsCall::OnRecvMessage(absl::string_view payload) {
1032
- // Needs to be destroyed after the mutex is released.
1033
- RefCountedPtr<ReadDelayHandle> read_delay_handle;
1159
+ // context.read_delay_handle needs to be destroyed after the mutex is
1160
+ // released.
1161
+ DecodeContext context;
1034
1162
  {
1035
1163
  MutexLock lock(&xds_client()->mu_);
1036
1164
  if (!IsCurrentCallOnChannel()) return;
1037
1165
  // Parse and validate the response.
1038
- AdsResponseParser parser(this);
1039
- absl::Status status = xds_client()->api_.ParseAdsResponse(payload, &parser);
1040
- // This includes a handle that will trigger an ADS read.
1041
- AdsResponseParser::Result result = parser.TakeResult();
1042
- read_delay_handle = std::move(result.read_delay_handle);
1166
+ absl::Status status = DecodeAdsResponse(payload, &context);
1043
1167
  if (!status.ok()) {
1044
1168
  // Ignore unparsable response.
1045
1169
  LOG(ERROR) << "[xds_client " << xds_client() << "] xds server "
@@ -1050,22 +1174,22 @@ void XdsClient::XdsChannel::AdsCall::OnRecvMessage(absl::string_view payload) {
1050
1174
  seen_response_ = true;
1051
1175
  xds_channel()->SetHealthyLocked();
1052
1176
  // Update nonce.
1053
- auto& state = state_map_[result.type];
1054
- state.nonce = result.nonce;
1177
+ auto& state = state_map_[context.type];
1178
+ state.nonce = context.nonce;
1055
1179
  // If we got an error, set state.status so that we'll NACK the update.
1056
- if (!result.errors.empty()) {
1180
+ if (!context.errors.empty()) {
1057
1181
  state.status = absl::UnavailableError(
1058
1182
  absl::StrCat("xDS response validation errors: [",
1059
- absl::StrJoin(result.errors, "; "), "]"));
1183
+ absl::StrJoin(context.errors, "; "), "]"));
1060
1184
  LOG(ERROR) << "[xds_client " << xds_client() << "] xds server "
1061
1185
  << xds_channel()->server_.server_uri()
1062
1186
  << ": ADS response invalid for resource type "
1063
- << result.type_url << " version " << result.version
1187
+ << context.type_url << " version " << context.version
1064
1188
  << ", will NACK: nonce=" << state.nonce
1065
1189
  << " status=" << state.status;
1066
1190
  }
1067
1191
  // Delete resources not seen in update if needed.
1068
- if (result.type->AllResourcesRequiredInSotW()) {
1192
+ if (context.type->AllResourcesRequiredInSotW()) {
1069
1193
  for (auto& a : xds_client()->authority_state_map_) {
1070
1194
  const std::string& authority = a.first;
1071
1195
  AuthorityState& authority_state = a.second;
@@ -1073,15 +1197,15 @@ void XdsClient::XdsChannel::AdsCall::OnRecvMessage(absl::string_view payload) {
1073
1197
  if (authority_state.xds_channels.back() != xds_channel()) {
1074
1198
  continue;
1075
1199
  }
1076
- auto seen_authority_it = result.resources_seen.find(authority);
1200
+ auto seen_authority_it = context.resources_seen.find(authority);
1077
1201
  // Find this resource type.
1078
- auto type_it = authority_state.resource_map.find(result.type);
1202
+ auto type_it = authority_state.resource_map.find(context.type);
1079
1203
  if (type_it == authority_state.resource_map.end()) continue;
1080
1204
  // Iterate over resource ids.
1081
1205
  for (auto& r : type_it->second) {
1082
1206
  const XdsResourceKey& resource_key = r.first;
1083
1207
  ResourceState& resource_state = r.second;
1084
- if (seen_authority_it == result.resources_seen.end() ||
1208
+ if (seen_authority_it == context.resources_seen.end() ||
1085
1209
  seen_authority_it->second.find(resource_key) ==
1086
1210
  seen_authority_it->second.end()) {
1087
1211
  // If the resource was newly requested but has not yet been
@@ -1091,42 +1215,41 @@ void XdsClient::XdsChannel::AdsCall::OnRecvMessage(absl::string_view payload) {
1091
1215
  // its absence from the response does not necessarily indicate
1092
1216
  // that the resource does not exist. For that case, we rely on
1093
1217
  // the request timeout instead.
1094
- if (resource_state.resource == nullptr) continue;
1218
+ if (!resource_state.HasResource()) continue;
1095
1219
  if (xds_channel()->server_.IgnoreResourceDeletion()) {
1096
- if (!resource_state.ignored_deletion) {
1220
+ if (!resource_state.ignored_deletion()) {
1097
1221
  LOG(ERROR)
1098
1222
  << "[xds_client " << xds_client() << "] xds server "
1099
1223
  << xds_channel()->server_.server_uri()
1100
1224
  << ": ignoring deletion for resource type "
1101
- << result.type_url << " name "
1225
+ << context.type_url << " name "
1102
1226
  << XdsClient::ConstructFullXdsResourceName(
1103
- authority, result.type_url.c_str(), resource_key);
1104
- resource_state.ignored_deletion = true;
1227
+ authority, context.type_url.c_str(), resource_key);
1228
+ resource_state.set_ignored_deletion(true);
1105
1229
  }
1106
1230
  } else {
1107
- resource_state.resource.reset();
1108
- resource_state.meta.client_status =
1109
- XdsApi::ResourceMetadata::DOES_NOT_EXIST;
1110
- xds_client()->NotifyWatchersOnResourceDoesNotExist(
1111
- resource_state.watchers, read_delay_handle);
1231
+ resource_state.SetDoesNotExist();
1232
+ xds_client()->NotifyWatchersOnResourceChanged(
1233
+ absl::NotFoundError("does not exist"),
1234
+ resource_state.watchers(), context.read_delay_handle);
1112
1235
  }
1113
1236
  }
1114
1237
  }
1115
1238
  }
1116
1239
  }
1117
1240
  // If we had valid resources or the update was empty, update the version.
1118
- if (result.num_valid_resources > 0 || result.errors.empty()) {
1119
- xds_channel()->resource_type_version_map_[result.type] =
1120
- std::move(result.version);
1241
+ if (context.num_valid_resources > 0 || context.errors.empty()) {
1242
+ xds_channel()->resource_type_version_map_[context.type] =
1243
+ std::move(context.version);
1121
1244
  }
1122
1245
  // Send ACK or NACK.
1123
- SendMessageLocked(result.type);
1246
+ SendMessageLocked(context.type);
1124
1247
  }
1125
1248
  // Update metrics.
1126
1249
  if (xds_client()->metrics_reporter_ != nullptr) {
1127
1250
  xds_client()->metrics_reporter_->ReportResourceUpdates(
1128
- xds_channel()->server_.server_uri(), result.type_url,
1129
- result.num_valid_resources, result.num_invalid_resources);
1251
+ xds_channel()->server_.server_uri(), context.type_url,
1252
+ context.num_valid_resources, context.num_invalid_resources);
1130
1253
  }
1131
1254
  }
1132
1255
  xds_client()->work_serializer_.DrainQueue();
@@ -1193,6 +1316,98 @@ XdsClient::XdsChannel::AdsCall::ResourceNamesForRequest(
1193
1316
  return resource_names;
1194
1317
  }
1195
1318
 
1319
+ //
1320
+ // XdsClient::ResourceState
1321
+ //
1322
+
1323
+ void XdsClient::ResourceState::SetAcked(
1324
+ std::shared_ptr<const XdsResourceType::ResourceData> resource,
1325
+ std::string serialized_proto, std::string version, Timestamp update_time) {
1326
+ resource_ = std::move(resource);
1327
+ client_status_ = ClientResourceStatus::ACKED;
1328
+ serialized_proto_ = std::move(serialized_proto);
1329
+ update_time_ = update_time;
1330
+ version_ = std::move(version);
1331
+ failed_version_.clear();
1332
+ failed_details_.clear();
1333
+ }
1334
+
1335
+ void XdsClient::ResourceState::SetNacked(const std::string& version,
1336
+ const std::string& details,
1337
+ Timestamp update_time) {
1338
+ client_status_ = ClientResourceStatus::NACKED;
1339
+ failed_version_ = version;
1340
+ failed_details_ = details;
1341
+ failed_update_time_ = update_time;
1342
+ }
1343
+
1344
+ void XdsClient::ResourceState::SetDoesNotExist() {
1345
+ resource_.reset();
1346
+ serialized_proto_.clear();
1347
+ client_status_ = ClientResourceStatus::DOES_NOT_EXIST;
1348
+ failed_version_.clear();
1349
+ }
1350
+
1351
+ absl::string_view XdsClient::ResourceState::CacheStateString() const {
1352
+ switch (client_status_) {
1353
+ case ClientResourceStatus::REQUESTED:
1354
+ return "requested";
1355
+ case ClientResourceStatus::DOES_NOT_EXIST:
1356
+ return "does_not_exist";
1357
+ case ClientResourceStatus::ACKED:
1358
+ return "acked";
1359
+ case ClientResourceStatus::NACKED:
1360
+ return resource_ != nullptr ? "nacked_but_cached" : "nacked";
1361
+ }
1362
+ Crash("unknown resource state");
1363
+ }
1364
+
1365
+ namespace {
1366
+
1367
+ google_protobuf_Timestamp* EncodeTimestamp(Timestamp value, upb_Arena* arena) {
1368
+ google_protobuf_Timestamp* timestamp = google_protobuf_Timestamp_new(arena);
1369
+ gpr_timespec timespec = value.as_timespec(GPR_CLOCK_REALTIME);
1370
+ google_protobuf_Timestamp_set_seconds(timestamp, timespec.tv_sec);
1371
+ google_protobuf_Timestamp_set_nanos(timestamp, timespec.tv_nsec);
1372
+ return timestamp;
1373
+ }
1374
+
1375
+ } // namespace
1376
+
1377
+ void XdsClient::ResourceState::FillGenericXdsConfig(
1378
+ upb_StringView type_url, upb_StringView resource_name, upb_Arena* arena,
1379
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig* entry) const {
1380
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_type_url(entry,
1381
+ type_url);
1382
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_name(entry,
1383
+ resource_name);
1384
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_client_status(
1385
+ entry, client_status_);
1386
+ if (!serialized_proto_.empty()) {
1387
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_version_info(
1388
+ entry, StdStringToUpbString(version_));
1389
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_last_updated(
1390
+ entry, EncodeTimestamp(update_time_, arena));
1391
+ auto* any_field =
1392
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_mutable_xds_config(
1393
+ entry, arena);
1394
+ google_protobuf_Any_set_type_url(any_field, type_url);
1395
+ google_protobuf_Any_set_value(any_field,
1396
+ StdStringToUpbString(serialized_proto_));
1397
+ }
1398
+ if (client_status_ == ClientResourceStatus::NACKED) {
1399
+ auto* update_failure_state = envoy_admin_v3_UpdateFailureState_new(arena);
1400
+ envoy_admin_v3_UpdateFailureState_set_details(
1401
+ update_failure_state, StdStringToUpbString(failed_details_));
1402
+ envoy_admin_v3_UpdateFailureState_set_version_info(
1403
+ update_failure_state, StdStringToUpbString(failed_version_));
1404
+ envoy_admin_v3_UpdateFailureState_set_last_update_attempt(
1405
+ update_failure_state, EncodeTimestamp(failed_update_time_, arena));
1406
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_error_state(
1407
+ entry, update_failure_state);
1408
+ }
1409
+ }
1410
+
1196
1411
  //
1197
1412
  // XdsClient
1198
1413
  //
@@ -1209,11 +1424,11 @@ XdsClient::XdsClient(
1209
1424
  : DualRefCounted<XdsClient>(
1210
1425
  GRPC_TRACE_FLAG_ENABLED(xds_client_refcount) ? "XdsClient" : nullptr),
1211
1426
  bootstrap_(std::move(bootstrap)),
1427
+ user_agent_name_(std::move(user_agent_name)),
1428
+ user_agent_version_(std::move(user_agent_version)),
1212
1429
  transport_factory_(std::move(transport_factory)),
1213
1430
  request_timeout_(resource_request_timeout),
1214
1431
  xds_federation_enabled_(XdsFederationEnabled()),
1215
- api_(this, &xds_client_trace, bootstrap_->node(), &def_pool_,
1216
- std::move(user_agent_name), std::move(user_agent_version)),
1217
1432
  work_serializer_(engine),
1218
1433
  engine_(std::move(engine)),
1219
1434
  metrics_reporter_(std::move(metrics_reporter)) {
@@ -1259,8 +1474,8 @@ RefCountedPtr<XdsClient::XdsChannel> XdsClient::GetOrCreateXdsChannelLocked(
1259
1474
  bool XdsClient::HasUncachedResources(const AuthorityState& authority_state) {
1260
1475
  for (const auto& type_resource : authority_state.resource_map) {
1261
1476
  for (const auto& key_state : type_resource.second) {
1262
- if (key_state.second.meta.client_status ==
1263
- XdsApi::ResourceMetadata::REQUESTED) {
1477
+ if (key_state.second.client_status() ==
1478
+ ResourceState::ClientResourceStatus::REQUESTED) {
1264
1479
  return true;
1265
1480
  }
1266
1481
  }
@@ -1271,24 +1486,20 @@ bool XdsClient::HasUncachedResources(const AuthorityState& authority_state) {
1271
1486
  void XdsClient::WatchResource(const XdsResourceType* type,
1272
1487
  absl::string_view name,
1273
1488
  RefCountedPtr<ResourceWatcherInterface> watcher) {
1274
- ResourceWatcherInterface* w = watcher.get();
1275
1489
  // Lambda for handling failure cases.
1276
1490
  auto fail = [&](absl::Status status) mutable {
1277
1491
  {
1278
1492
  MutexLock lock(&mu_);
1279
1493
  MaybeRegisterResourceTypeLocked(type);
1280
- invalid_watchers_[w] = watcher;
1494
+ invalid_watchers_.insert(watcher);
1281
1495
  }
1282
- work_serializer_.Run(
1283
- [watcher = std::move(watcher), status = std::move(status)]()
1284
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1285
- watcher->OnError(status, ReadDelayHandle::NoWait());
1286
- },
1287
- DEBUG_LOCATION);
1496
+ NotifyWatchersOnResourceChanged(std::move(status), {watcher},
1497
+ ReadDelayHandle::NoWait());
1498
+ work_serializer_.DrainQueue();
1288
1499
  };
1289
1500
  auto resource_name = ParseXdsResourceName(name, type);
1290
1501
  if (!resource_name.ok()) {
1291
- fail(absl::UnavailableError(
1502
+ fail(absl::InvalidArgumentError(
1292
1503
  absl::StrCat("Unable to parse resource name ", name)));
1293
1504
  return;
1294
1505
  }
@@ -1298,7 +1509,7 @@ void XdsClient::WatchResource(const XdsResourceType* type,
1298
1509
  auto* authority =
1299
1510
  bootstrap_->LookupAuthority(std::string(resource_name->authority));
1300
1511
  if (authority == nullptr) {
1301
- fail(absl::UnavailableError(
1512
+ fail(absl::FailedPreconditionError(
1302
1513
  absl::StrCat("authority \"", resource_name->authority,
1303
1514
  "\" not present in bootstrap config")));
1304
1515
  return;
@@ -1309,14 +1520,14 @@ void XdsClient::WatchResource(const XdsResourceType* type,
1309
1520
  {
1310
1521
  MutexLock lock(&mu_);
1311
1522
  MaybeRegisterResourceTypeLocked(type);
1312
-
1313
1523
  AuthorityState& authority_state =
1314
1524
  authority_state_map_[resource_name->authority];
1315
1525
  auto it_is_new = authority_state.resource_map[type].emplace(
1316
1526
  resource_name->key, ResourceState());
1317
1527
  bool first_watcher_for_resource = it_is_new.second;
1318
1528
  ResourceState& resource_state = it_is_new.first->second;
1319
- resource_state.watchers[w] = watcher;
1529
+ resource_state.AddWatcher(watcher);
1530
+ bool notified_watcher = false;
1320
1531
  if (first_watcher_for_resource) {
1321
1532
  // We try to add new channels in 2 cases:
1322
1533
  // - This is the first resource for this authority (i.e., the list
@@ -1346,60 +1557,47 @@ void XdsClient::WatchResource(const XdsResourceType* type,
1346
1557
  } else {
1347
1558
  // If we already have a cached value for the resource, notify the new
1348
1559
  // watcher immediately.
1349
- if (resource_state.resource != nullptr) {
1560
+ if (resource_state.HasResource()) {
1350
1561
  GRPC_TRACE_LOG(xds_client, INFO)
1351
1562
  << "[xds_client " << this << "] returning cached listener data for "
1352
1563
  << name;
1353
- work_serializer_.Schedule(
1354
- [watcher, value = resource_state.resource]()
1355
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1356
- watcher->OnGenericResourceChanged(value,
1357
- ReadDelayHandle::NoWait());
1358
- },
1359
- DEBUG_LOCATION);
1360
- } else if (resource_state.meta.client_status ==
1361
- XdsApi::ResourceMetadata::DOES_NOT_EXIST) {
1564
+ NotifyWatchersOnResourceChanged(resource_state.resource(), {watcher},
1565
+ ReadDelayHandle::NoWait());
1566
+ notified_watcher = true;
1567
+ } else if (resource_state.client_status() ==
1568
+ ResourceState::ClientResourceStatus::DOES_NOT_EXIST) {
1362
1569
  GRPC_TRACE_LOG(xds_client, INFO)
1363
1570
  << "[xds_client " << this
1364
1571
  << "] reporting cached does-not-exist for " << name;
1365
- work_serializer_.Schedule(
1366
- [watcher]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1367
- watcher->OnResourceDoesNotExist(ReadDelayHandle::NoWait());
1368
- },
1369
- DEBUG_LOCATION);
1370
- } else if (resource_state.meta.client_status ==
1371
- XdsApi::ResourceMetadata::NACKED) {
1572
+ NotifyWatchersOnResourceChanged(absl::NotFoundError("does not exist"),
1573
+ {watcher}, ReadDelayHandle::NoWait());
1574
+ notified_watcher = true;
1575
+ } else if (resource_state.client_status() ==
1576
+ ResourceState::ClientResourceStatus::NACKED) {
1372
1577
  GRPC_TRACE_LOG(xds_client, INFO)
1373
1578
  << "[xds_client " << this
1374
1579
  << "] reporting cached validation failure for " << name << ": "
1375
- << resource_state.meta.failed_details;
1376
- std::string details = resource_state.meta.failed_details;
1377
- const auto* node = bootstrap_->node();
1378
- if (node != nullptr) {
1379
- absl::StrAppend(&details, " (node ID:", bootstrap_->node()->id(),
1380
- ")");
1381
- }
1382
- work_serializer_.Schedule(
1383
- [watcher, details = std::move(details)]()
1384
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1385
- watcher->OnError(absl::UnavailableError(absl::StrCat(
1386
- "invalid resource: ", details)),
1387
- ReadDelayHandle::NoWait());
1388
- },
1389
- DEBUG_LOCATION);
1580
+ << resource_state.failed_details();
1581
+ NotifyWatchersOnResourceChanged(
1582
+ absl::InvalidArgumentError(absl::StrCat(
1583
+ "invalid resource: ", resource_state.failed_details())),
1584
+ {watcher}, ReadDelayHandle::NoWait());
1585
+ notified_watcher = true;
1390
1586
  }
1391
1587
  }
1588
+ // If the channel is not connected, report an error to the watcher.
1392
1589
  absl::Status channel_status = authority_state.xds_channels.back()->status();
1393
1590
  if (!channel_status.ok()) {
1394
1591
  GRPC_TRACE_LOG(xds_client, INFO)
1395
1592
  << "[xds_client " << this << "] returning cached channel error for "
1396
1593
  << name << ": " << channel_status;
1397
- work_serializer_.Schedule(
1398
- [watcher = std::move(watcher), status = std::move(channel_status)]()
1399
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) mutable {
1400
- watcher->OnError(std::move(status), ReadDelayHandle::NoWait());
1401
- },
1402
- DEBUG_LOCATION);
1594
+ if (notified_watcher) {
1595
+ NotifyWatchersOnAmbientError(std::move(channel_status), {watcher},
1596
+ ReadDelayHandle::NoWait());
1597
+ } else {
1598
+ NotifyWatchersOnResourceChanged(std::move(channel_status), {watcher},
1599
+ ReadDelayHandle::NoWait());
1600
+ }
1403
1601
  }
1404
1602
  }
1405
1603
  work_serializer_.DrainQueue();
@@ -1428,10 +1626,10 @@ void XdsClient::CancelResourceWatch(const XdsResourceType* type,
1428
1626
  if (resource_it == type_map.end()) return;
1429
1627
  ResourceState& resource_state = resource_it->second;
1430
1628
  // Remove watcher.
1431
- resource_state.watchers.erase(watcher);
1629
+ resource_state.RemoveWatcher(watcher);
1432
1630
  // Clean up empty map entries, if any.
1433
- if (resource_state.watchers.empty()) {
1434
- if (resource_state.ignored_deletion) {
1631
+ if (!resource_state.HasWatchers()) {
1632
+ if (resource_state.ignored_deletion()) {
1435
1633
  LOG(INFO) << "[xds_client " << this
1436
1634
  << "] unsubscribing from a resource for which we "
1437
1635
  << "previously ignored a deletion: type " << type->type_url()
@@ -1520,89 +1718,45 @@ void XdsClient::ResetBackoff() {
1520
1718
  }
1521
1719
  }
1522
1720
 
1523
- void XdsClient::NotifyWatchersOnErrorLocked(
1524
- const std::map<ResourceWatcherInterface*,
1525
- RefCountedPtr<ResourceWatcherInterface>>& watchers,
1526
- absl::Status status, RefCountedPtr<ReadDelayHandle> read_delay_handle) {
1721
+ absl::Status XdsClient::AppendNodeToStatus(const absl::Status& status) const {
1527
1722
  const auto* node = bootstrap_->node();
1528
- if (node != nullptr) {
1529
- status = absl::Status(
1530
- status.code(),
1531
- absl::StrCat(status.message(), " (node ID:", node->id(), ")"));
1532
- }
1723
+ if (node == nullptr) return status;
1724
+ return absl::Status(
1725
+ status.code(), absl::StrCat(status.message(),
1726
+ " (node ID:", bootstrap_->node()->id(), ")"));
1727
+ }
1728
+
1729
+ void XdsClient::NotifyWatchersOnResourceChanged(
1730
+ absl::StatusOr<std::shared_ptr<const XdsResourceType::ResourceData>>
1731
+ resource,
1732
+ WatcherSet watchers, RefCountedPtr<ReadDelayHandle> read_delay_handle) {
1733
+ if (!resource.ok()) resource = AppendNodeToStatus(resource.status());
1533
1734
  work_serializer_.Schedule(
1534
- [watchers, status = std::move(status),
1735
+ [watchers = std::move(watchers), resource = std::move(resource),
1535
1736
  read_delay_handle = std::move(read_delay_handle)]()
1536
1737
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1537
1738
  for (const auto& p : watchers) {
1538
- p.first->OnError(status, read_delay_handle);
1739
+ p->OnGenericResourceChanged(resource, read_delay_handle);
1539
1740
  }
1540
1741
  },
1541
1742
  DEBUG_LOCATION);
1542
1743
  }
1543
1744
 
1544
- void XdsClient::NotifyWatchersOnResourceDoesNotExist(
1545
- const std::map<ResourceWatcherInterface*,
1546
- RefCountedPtr<ResourceWatcherInterface>>& watchers,
1745
+ void XdsClient::NotifyWatchersOnAmbientError(
1746
+ absl::Status status, WatcherSet watchers,
1547
1747
  RefCountedPtr<ReadDelayHandle> read_delay_handle) {
1748
+ if (!status.ok()) status = AppendNodeToStatus(status);
1548
1749
  work_serializer_.Schedule(
1549
- [watchers, read_delay_handle = std::move(read_delay_handle)]()
1750
+ [watchers = std::move(watchers), status = std::move(status),
1751
+ read_delay_handle = std::move(read_delay_handle)]()
1550
1752
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) {
1551
1753
  for (const auto& p : watchers) {
1552
- p.first->OnResourceDoesNotExist(read_delay_handle);
1754
+ p->OnAmbientError(status, read_delay_handle);
1553
1755
  }
1554
1756
  },
1555
1757
  DEBUG_LOCATION);
1556
1758
  }
1557
1759
 
1558
- namespace {
1559
-
1560
- google_protobuf_Timestamp* EncodeTimestamp(Timestamp value, upb_Arena* arena) {
1561
- google_protobuf_Timestamp* timestamp = google_protobuf_Timestamp_new(arena);
1562
- gpr_timespec timespec = value.as_timespec(GPR_CLOCK_REALTIME);
1563
- google_protobuf_Timestamp_set_seconds(timestamp, timespec.tv_sec);
1564
- google_protobuf_Timestamp_set_nanos(timestamp, timespec.tv_nsec);
1565
- return timestamp;
1566
- }
1567
-
1568
- void FillGenericXdsConfig(
1569
- const XdsApi::ResourceMetadata& metadata, upb_StringView type_url,
1570
- upb_StringView resource_name, upb_Arena* arena,
1571
- envoy_service_status_v3_ClientConfig_GenericXdsConfig* entry) {
1572
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_type_url(entry,
1573
- type_url);
1574
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_name(entry,
1575
- resource_name);
1576
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_client_status(
1577
- entry, metadata.client_status);
1578
- if (!metadata.serialized_proto.empty()) {
1579
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_version_info(
1580
- entry, StdStringToUpbString(metadata.version));
1581
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_last_updated(
1582
- entry, EncodeTimestamp(metadata.update_time, arena));
1583
- auto* any_field =
1584
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_mutable_xds_config(
1585
- entry, arena);
1586
- google_protobuf_Any_set_type_url(any_field, type_url);
1587
- google_protobuf_Any_set_value(
1588
- any_field, StdStringToUpbString(metadata.serialized_proto));
1589
- }
1590
- if (metadata.client_status == XdsApi::ResourceMetadata::NACKED) {
1591
- auto* update_failure_state = envoy_admin_v3_UpdateFailureState_new(arena);
1592
- envoy_admin_v3_UpdateFailureState_set_details(
1593
- update_failure_state, StdStringToUpbString(metadata.failed_details));
1594
- envoy_admin_v3_UpdateFailureState_set_version_info(
1595
- update_failure_state, StdStringToUpbString(metadata.failed_version));
1596
- envoy_admin_v3_UpdateFailureState_set_last_update_attempt(
1597
- update_failure_state,
1598
- EncodeTimestamp(metadata.failed_update_time, arena));
1599
- envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_error_state(
1600
- entry, update_failure_state);
1601
- }
1602
- }
1603
-
1604
- } // namespace
1605
-
1606
1760
  void XdsClient::DumpClientConfig(
1607
1761
  std::set<std::string>* string_pool, upb_Arena* arena,
1608
1762
  envoy_service_status_v3_ClientConfig* client_config) {
@@ -1610,7 +1764,8 @@ void XdsClient::DumpClientConfig(
1610
1764
  // Fill-in the node information
1611
1765
  auto* node =
1612
1766
  envoy_service_status_v3_ClientConfig_mutable_node(client_config, arena);
1613
- api_.PopulateNode(node, arena);
1767
+ PopulateXdsNode(bootstrap_->node(), user_agent_name_, user_agent_version_,
1768
+ node, arena);
1614
1769
  // Dump each resource.
1615
1770
  for (const auto& a : authority_state_map_) { // authority
1616
1771
  const std::string& authority = a.first;
@@ -1630,32 +1785,12 @@ void XdsClient::DumpClientConfig(
1630
1785
  envoy_service_status_v3_ClientConfig_GenericXdsConfig* entry =
1631
1786
  envoy_service_status_v3_ClientConfig_add_generic_xds_configs(
1632
1787
  client_config, arena);
1633
- FillGenericXdsConfig(r.second.meta, type_url, resource_name, arena,
1634
- entry);
1788
+ r.second.FillGenericXdsConfig(type_url, resource_name, arena, entry);
1635
1789
  }
1636
1790
  }
1637
1791
  }
1638
1792
  }
1639
1793
 
1640
- namespace {
1641
-
1642
- absl::string_view CacheStateForEntry(const XdsApi::ResourceMetadata& metadata,
1643
- bool resource_cached) {
1644
- switch (metadata.client_status) {
1645
- case XdsApi::ResourceMetadata::REQUESTED:
1646
- return "requested";
1647
- case XdsApi::ResourceMetadata::DOES_NOT_EXIST:
1648
- return "does_not_exist";
1649
- case XdsApi::ResourceMetadata::ACKED:
1650
- return "acked";
1651
- case XdsApi::ResourceMetadata::NACKED:
1652
- return resource_cached ? "nacked_but_cached" : "nacked";
1653
- }
1654
- Crash("unknown resource state");
1655
- }
1656
-
1657
- } // namespace
1658
-
1659
1794
  void XdsClient::ReportResourceCounts(
1660
1795
  absl::FunctionRef<void(const ResourceCountLabels&, uint64_t)> func) {
1661
1796
  ResourceCountLabels labels;
@@ -1666,9 +1801,7 @@ void XdsClient::ReportResourceCounts(
1666
1801
  // Count the number of entries in each state.
1667
1802
  std::map<absl::string_view, uint64_t> counts;
1668
1803
  for (const auto& r : t.second) { // resource id
1669
- absl::string_view cache_state =
1670
- CacheStateForEntry(r.second.meta, r.second.resource != nullptr);
1671
- ++counts[cache_state];
1804
+ ++counts[r.second.CacheStateString()];
1672
1805
  }
1673
1806
  // Report the count for each state.
1674
1807
  for (const auto& c : counts) {