grpc 1.40.0 → 1.46.3

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

Potentially problematic release.


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

Files changed (1941) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +462 -267
  3. data/etc/roots.pem +335 -326
  4. data/include/grpc/byte_buffer.h +1 -1
  5. data/include/grpc/byte_buffer_reader.h +1 -1
  6. data/include/grpc/event_engine/endpoint_config.h +6 -11
  7. data/include/grpc/event_engine/event_engine.h +164 -95
  8. data/include/grpc/event_engine/internal/memory_allocator_impl.h +68 -0
  9. data/include/grpc/event_engine/memory_allocator.h +226 -0
  10. data/include/grpc/event_engine/memory_request.h +57 -0
  11. data/include/grpc/event_engine/port.h +1 -3
  12. data/include/grpc/fork.h +1 -1
  13. data/include/grpc/grpc.h +54 -18
  14. data/include/grpc/grpc_posix.h +22 -18
  15. data/include/grpc/grpc_security.h +328 -193
  16. data/include/grpc/grpc_security_constants.h +2 -14
  17. data/include/grpc/impl/codegen/atm.h +5 -3
  18. data/include/grpc/impl/codegen/atm_gcc_atomic.h +2 -0
  19. data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
  20. data/include/grpc/impl/codegen/atm_windows.h +2 -0
  21. data/include/grpc/impl/codegen/byte_buffer.h +2 -0
  22. data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -0
  23. data/include/grpc/impl/codegen/compression_types.h +2 -2
  24. data/include/grpc/impl/codegen/connectivity_state.h +2 -0
  25. data/include/grpc/impl/codegen/fork.h +2 -0
  26. data/include/grpc/impl/codegen/gpr_slice.h +2 -0
  27. data/include/grpc/impl/codegen/gpr_types.h +2 -0
  28. data/include/grpc/impl/codegen/grpc_types.h +28 -26
  29. data/include/grpc/impl/codegen/log.h +2 -0
  30. data/include/grpc/impl/codegen/port_platform.h +37 -22
  31. data/include/grpc/impl/codegen/propagation_bits.h +2 -0
  32. data/include/grpc/impl/codegen/slice.h +6 -1
  33. data/include/grpc/impl/codegen/status.h +2 -0
  34. data/include/grpc/impl/codegen/sync.h +8 -5
  35. data/include/grpc/impl/codegen/sync_abseil.h +2 -0
  36. data/include/grpc/impl/codegen/sync_custom.h +2 -0
  37. data/include/grpc/impl/codegen/sync_generic.h +3 -0
  38. data/include/grpc/impl/codegen/sync_posix.h +4 -2
  39. data/include/grpc/impl/codegen/sync_windows.h +2 -0
  40. data/include/grpc/slice.h +1 -12
  41. data/include/grpc/status.h +1 -1
  42. data/include/grpc/support/atm.h +1 -1
  43. data/include/grpc/support/atm_gcc_atomic.h +1 -1
  44. data/include/grpc/support/atm_gcc_sync.h +1 -1
  45. data/include/grpc/support/atm_windows.h +1 -1
  46. data/include/grpc/support/log.h +1 -1
  47. data/include/grpc/support/port_platform.h +1 -1
  48. data/include/grpc/support/sync.h +1 -1
  49. data/include/grpc/support/sync_abseil.h +1 -1
  50. data/include/grpc/support/sync_custom.h +1 -1
  51. data/include/grpc/support/sync_generic.h +1 -1
  52. data/include/grpc/support/sync_posix.h +1 -1
  53. data/include/grpc/support/sync_windows.h +1 -1
  54. data/include/grpc/support/time.h +2 -2
  55. data/src/core/ext/filters/census/grpc_context.cc +1 -0
  56. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +309 -0
  57. data/src/core/ext/filters/channel_idle/channel_idle_filter.h +122 -0
  58. data/src/core/ext/filters/channel_idle/idle_filter_state.cc +96 -0
  59. data/src/core/ext/filters/channel_idle/idle_filter_state.h +66 -0
  60. data/src/core/ext/filters/client_channel/backend_metric.cc +24 -27
  61. data/src/core/ext/filters/client_channel/backend_metric.h +4 -3
  62. data/src/core/ext/filters/client_channel/backup_poller.cc +14 -9
  63. data/src/core/ext/filters/client_channel/backup_poller.h +1 -0
  64. data/src/core/ext/filters/client_channel/channel_connectivity.cc +75 -94
  65. data/src/core/ext/filters/client_channel/client_channel.cc +532 -501
  66. data/src/core/ext/filters/client_channel/client_channel.h +115 -64
  67. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +6 -5
  68. data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -1
  69. data/src/core/ext/filters/client_channel/client_channel_factory.cc +2 -1
  70. data/src/core/ext/filters/client_channel/client_channel_factory.h +17 -19
  71. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +18 -24
  72. data/src/core/ext/filters/client_channel/config_selector.cc +2 -1
  73. data/src/core/ext/filters/client_channel/config_selector.h +5 -6
  74. data/src/core/ext/filters/client_channel/connector.h +19 -19
  75. data/src/core/ext/filters/client_channel/dynamic_filters.cc +6 -7
  76. data/src/core/ext/filters/client_channel/dynamic_filters.h +2 -2
  77. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +2 -22
  78. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +3 -16
  79. data/src/core/ext/filters/client_channel/health/health_check_client.cc +128 -582
  80. data/src/core/ext/filters/client_channel/health/health_check_client.h +24 -159
  81. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +30 -34
  82. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +10 -2
  83. data/src/core/ext/filters/client_channel/http_proxy.cc +88 -110
  84. data/src/core/ext/filters/client_channel/http_proxy.h +17 -0
  85. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +4 -3
  86. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +6 -5
  87. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -2
  88. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +6 -18
  89. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +247 -150
  90. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +3 -6
  91. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +1 -1
  92. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +1 -1
  93. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +3 -4
  94. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +4 -4
  95. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +17 -18
  96. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +4 -4
  97. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +73 -39
  98. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +226 -181
  99. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +126 -79
  100. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +2542 -0
  101. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +68 -62
  102. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +18 -13
  103. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +106 -71
  104. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +119 -159
  105. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -1
  106. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +1 -1
  107. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +162 -77
  108. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +29 -19
  109. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +331 -488
  110. data/src/core/ext/filters/client_channel/lb_policy.cc +15 -14
  111. data/src/core/ext/filters/client_channel/lb_policy.h +115 -106
  112. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -0
  113. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -7
  114. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +133 -0
  115. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +296 -324
  116. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +23 -12
  117. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +23 -18
  118. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +37 -55
  119. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +153 -275
  120. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +38 -25
  121. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  122. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +96 -254
  123. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +23 -20
  124. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +2 -1
  125. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +85 -69
  126. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +201 -0
  127. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +106 -0
  128. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +40 -39
  129. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +509 -439
  130. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +11 -15
  131. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +13 -7
  132. data/src/core/ext/filters/client_channel/retry_filter.cc +282 -238
  133. data/src/core/ext/filters/client_channel/retry_service_config.cc +16 -18
  134. data/src/core/ext/filters/client_channel/retry_service_config.h +18 -12
  135. data/src/core/ext/filters/client_channel/retry_throttle.cc +14 -59
  136. data/src/core/ext/filters/client_channel/retry_throttle.h +11 -5
  137. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +51 -37
  138. data/src/core/ext/filters/client_channel/subchannel.cc +132 -197
  139. data/src/core/ext/filters/client_channel/subchannel.h +36 -56
  140. data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +22 -7
  141. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +11 -2
  142. data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +544 -0
  143. data/src/core/ext/filters/client_channel/subchannel_stream_client.h +214 -0
  144. data/src/core/ext/filters/deadline/deadline_filter.cc +31 -33
  145. data/src/core/ext/filters/deadline/deadline_filter.h +3 -2
  146. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +158 -401
  147. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +24 -1
  148. data/src/core/ext/filters/fault_injection/service_config_parser.cc +17 -27
  149. data/src/core/ext/filters/fault_injection/service_config_parser.h +10 -4
  150. data/src/core/ext/filters/http/client/http_client_filter.cc +83 -548
  151. data/src/core/ext/filters/http/client/http_client_filter.h +21 -4
  152. data/src/core/ext/filters/http/client_authority_filter.cc +39 -103
  153. data/src/core/ext/filters/http/client_authority_filter.h +24 -5
  154. data/src/core/ext/filters/http/http_filters_plugin.cc +55 -73
  155. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +49 -140
  156. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +22 -35
  157. data/src/core/ext/filters/http/server/http_server_filter.cc +64 -274
  158. data/src/core/ext/filters/message_size/message_size_filter.cc +49 -58
  159. data/src/core/ext/filters/message_size/message_size_filter.h +10 -3
  160. data/src/core/ext/filters/rbac/rbac_filter.cc +162 -0
  161. data/src/core/ext/filters/rbac/rbac_filter.h +76 -0
  162. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +606 -0
  163. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +75 -0
  164. data/src/core/ext/filters/server_config_selector/server_config_selector.cc +61 -0
  165. data/src/core/ext/filters/server_config_selector/server_config_selector.h +71 -0
  166. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +143 -0
  167. data/src/core/ext/filters/{workarounds/workaround_cronet_compression_filter.h → server_config_selector/server_config_selector_filter.h} +11 -6
  168. data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -1
  169. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +245 -12
  170. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +294 -95
  171. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +3 -1
  172. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -1
  173. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -0
  174. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +368 -349
  175. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +12 -4
  176. data/src/core/ext/transport/chttp2/transport/context_list.cc +2 -3
  177. data/src/core/ext/transport/chttp2/transport/context_list.h +3 -5
  178. data/src/core/ext/transport/chttp2/transport/flow_control.cc +63 -44
  179. data/src/core/ext/transport/chttp2/transport/flow_control.h +18 -12
  180. data/src/core/ext/transport/chttp2/transport/frame_data.cc +11 -12
  181. data/src/core/ext/transport/chttp2/transport/frame_data.h +1 -0
  182. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +6 -4
  183. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -0
  184. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +10 -9
  185. data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -0
  186. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +10 -8
  187. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -0
  188. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +40 -7
  189. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -0
  190. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +12 -7
  191. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +1 -0
  192. data/src/core/ext/transport/chttp2/transport/hpack_constants.h +41 -0
  193. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +516 -749
  194. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +183 -71
  195. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +86 -0
  196. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +71 -0
  197. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +764 -1062
  198. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +75 -178
  199. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +239 -0
  200. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +115 -0
  201. data/src/core/ext/transport/chttp2/transport/internal.h +22 -48
  202. data/src/core/ext/transport/chttp2/transport/parsing.cc +61 -212
  203. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -2
  204. data/src/core/ext/transport/chttp2/transport/varint.cc +7 -3
  205. data/src/core/ext/transport/chttp2/transport/varint.h +39 -28
  206. data/src/core/ext/transport/chttp2/transport/writing.cc +125 -169
  207. data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -4
  208. data/src/core/ext/transport/inproc/inproc_transport.cc +132 -173
  209. data/src/core/ext/transport/inproc/inproc_transport.h +1 -4
  210. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.c +117 -0
  211. data/src/core/ext/upb-generated/envoy/admin/v3/certs.upb.h +482 -0
  212. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.c +121 -0
  213. data/src/core/ext/upb-generated/envoy/admin/v3/clusters.upb.h +553 -0
  214. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +248 -210
  215. data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +1382 -685
  216. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.c +56 -0
  217. data/src/core/ext/upb-generated/envoy/admin/v3/init_dump.upb.h +151 -0
  218. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.c +62 -0
  219. data/src/core/ext/upb-generated/envoy/admin/v3/listeners.upb.h +160 -0
  220. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.c +46 -0
  221. data/src/core/ext/upb-generated/envoy/admin/v3/memory.upb.h +124 -0
  222. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.c +43 -0
  223. data/src/core/ext/upb-generated/envoy/admin/v3/metrics.upb.h +102 -0
  224. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.c +43 -0
  225. data/src/core/ext/upb-generated/envoy/admin/v3/mutex_stats.upb.h +97 -0
  226. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.c +106 -0
  227. data/src/core/ext/upb-generated/envoy/admin/v3/server_info.upb.h +605 -0
  228. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.c +48 -0
  229. data/src/core/ext/upb-generated/envoy/admin/v3/tap.upb.h +103 -0
  230. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +44 -1
  231. data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +52 -1
  232. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +31 -5
  233. data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +57 -18
  234. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +144 -117
  235. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +761 -386
  236. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +240 -200
  237. data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +1376 -667
  238. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +50 -29
  239. data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +224 -95
  240. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +337 -255
  241. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +1901 -790
  242. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +21 -8
  243. data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +50 -24
  244. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +61 -28
  245. data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +280 -99
  246. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.c +299 -0
  247. data/src/core/ext/upb-generated/envoy/config/common/matcher/v3/matcher.upb.h +1381 -0
  248. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +75 -54
  249. data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +398 -190
  250. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +22 -8
  251. data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +53 -25
  252. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +220 -171
  253. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +1224 -567
  254. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +106 -46
  255. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +561 -171
  256. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +20 -7
  257. data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +46 -24
  258. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +17 -23
  259. data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +49 -95
  260. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.c +58 -0
  261. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_method_list.upb.h +151 -0
  262. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +146 -118
  263. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +853 -415
  264. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +142 -92
  265. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +797 -345
  266. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +22 -9
  267. data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +65 -31
  268. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +205 -122
  269. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +1097 -393
  270. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +18 -5
  271. data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +36 -17
  272. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.c +28 -14
  273. data/src/core/ext/upb-generated/envoy/config/core/v3/resolver.upb.h +97 -49
  274. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +23 -10
  275. data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +83 -34
  276. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +27 -14
  277. data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +101 -49
  278. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.c +22 -9
  279. data/src/core/ext/upb-generated/envoy/config/core/v3/udp_socket_config.upb.h +54 -26
  280. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +52 -36
  281. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +214 -109
  282. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +92 -39
  283. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +449 -131
  284. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +71 -54
  285. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +389 -188
  286. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +20 -7
  287. data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +42 -21
  288. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +99 -72
  289. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +541 -259
  290. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +105 -80
  291. data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +610 -307
  292. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.c +32 -17
  293. data/src/core/ext/upb-generated/envoy/config/listener/v3/quic_config.upb.h +112 -49
  294. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +25 -11
  295. data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +79 -40
  296. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +53 -0
  297. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +136 -0
  298. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +83 -62
  299. data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +463 -235
  300. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +93 -60
  301. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +483 -214
  302. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +130 -100
  303. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +628 -282
  304. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +54 -35
  305. data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +291 -142
  306. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +665 -567
  307. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +3977 -1883
  308. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +39 -20
  309. data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +168 -72
  310. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.c +222 -0
  311. data/src/core/ext/upb-generated/envoy/config/tap/v3/common.upb.h +1052 -0
  312. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.c +44 -0
  313. data/src/core/ext/upb-generated/envoy/config/trace/v3/datadog.upb.h +88 -0
  314. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.c +49 -0
  315. data/src/core/ext/upb-generated/envoy/config/trace/v3/dynamic_ot.upb.h +103 -0
  316. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +28 -14
  317. data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +91 -46
  318. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.c +52 -0
  319. data/src/core/ext/upb-generated/envoy/config/trace/v3/lightstep.upb.h +134 -0
  320. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.c +63 -0
  321. data/src/core/ext/upb-generated/envoy/config/trace/v3/opencensus.upb.h +250 -0
  322. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.c +47 -0
  323. data/src/core/ext/upb-generated/envoy/config/trace/v3/service.upb.h +94 -0
  324. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.c +69 -0
  325. data/src/core/ext/upb-generated/envoy/config/trace/v3/skywalking.upb.h +213 -0
  326. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.c +32 -0
  327. data/src/core/ext/upb-generated/envoy/config/trace/v3/trace.upb.h +42 -0
  328. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.c +71 -0
  329. data/src/core/ext/upb-generated/envoy/config/trace/v3/xray.upb.h +218 -0
  330. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.c +54 -0
  331. data/src/core/ext/upb-generated/envoy/config/trace/v3/zipkin.upb.h +146 -0
  332. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +18 -5
  333. data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +42 -24
  334. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +46 -29
  335. data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +219 -112
  336. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +52 -37
  337. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +282 -134
  338. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +64 -0
  339. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +183 -0
  340. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +27 -14
  341. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +94 -43
  342. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +284 -225
  343. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +1673 -738
  344. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +10 -1
  345. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +7 -4
  346. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +113 -54
  347. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +621 -216
  348. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +42 -27
  349. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +176 -87
  350. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +128 -83
  351. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +673 -259
  352. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.c +62 -0
  353. data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upb.h +160 -0
  354. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +16 -3
  355. data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +29 -15
  356. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +92 -73
  357. data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +516 -260
  358. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +32 -18
  359. data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +121 -62
  360. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +74 -57
  361. data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +379 -186
  362. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.c +48 -0
  363. data/src/core/ext/upb-generated/envoy/type/http/v3/cookie.upb.h +112 -0
  364. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.c +35 -19
  365. data/src/core/ext/upb-generated/envoy/type/http/v3/path_transformation.upb.h +149 -81
  366. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.c +74 -0
  367. data/src/core/ext/upb-generated/envoy/type/matcher/v3/http_inputs.upb.h +214 -0
  368. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +29 -14
  369. data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +116 -56
  370. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +22 -9
  371. data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +58 -31
  372. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +21 -8
  373. data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +56 -27
  374. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +20 -7
  375. data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +46 -24
  376. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +36 -21
  377. data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +137 -69
  378. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +32 -18
  379. data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +137 -65
  380. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +27 -13
  381. data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +99 -53
  382. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +38 -23
  383. data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +170 -83
  384. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +51 -32
  385. data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +273 -145
  386. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +54 -37
  387. data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +268 -132
  388. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.c +66 -0
  389. data/src/core/ext/upb-generated/envoy/type/v3/hash_policy.upb.h +201 -0
  390. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.c +10 -1
  391. data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +4 -1
  392. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.c +42 -0
  393. data/src/core/ext/upb-generated/envoy/type/v3/http_status.upb.h +139 -0
  394. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +24 -10
  395. data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +76 -36
  396. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +31 -16
  397. data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +118 -52
  398. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.c +26 -0
  399. data/src/core/ext/upb-generated/envoy/type/v3/ratelimit_unit.upb.h +41 -0
  400. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +20 -7
  401. data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +48 -19
  402. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.c +51 -0
  403. data/src/core/ext/upb-generated/envoy/type/v3/token_bucket.upb.h +127 -0
  404. data/src/core/ext/upb-generated/google/api/annotations.upb.c +23 -1
  405. data/src/core/ext/upb-generated/google/api/annotations.upb.h +24 -1
  406. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +155 -126
  407. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +791 -385
  408. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +159 -127
  409. data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +869 -402
  410. data/src/core/ext/upb-generated/google/api/http.upb.c +44 -29
  411. data/src/core/ext/upb-generated/google/api/http.upb.h +236 -115
  412. data/src/core/ext/upb-generated/google/api/httpbody.upb.c +46 -0
  413. data/src/core/ext/upb-generated/google/api/httpbody.upb.h +111 -0
  414. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +19 -6
  415. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +46 -22
  416. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +374 -283
  417. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +2263 -1053
  418. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +19 -6
  419. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +44 -20
  420. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +16 -3
  421. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +29 -15
  422. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +48 -32
  423. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +197 -93
  424. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +19 -6
  425. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +44 -20
  426. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +58 -37
  427. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +296 -149
  428. data/src/core/ext/upb-generated/google/rpc/status.upb.c +22 -9
  429. data/src/core/ext/upb-generated/google/rpc/status.upb.h +60 -30
  430. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.c +84 -0
  431. data/src/core/ext/upb-generated/opencensus/proto/trace/v1/trace_config.upb.h +319 -0
  432. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +33 -19
  433. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +111 -48
  434. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +136 -108
  435. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +753 -365
  436. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +28 -13
  437. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +90 -41
  438. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +23 -9
  439. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +70 -35
  440. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +82 -62
  441. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +448 -232
  442. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +70 -0
  443. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +208 -0
  444. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.c +175 -0
  445. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls_config.upb.h +764 -0
  446. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +76 -14
  447. data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +213 -57
  448. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +32 -8
  449. data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +62 -18
  450. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +22 -1
  451. data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +17 -1
  452. data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +32 -6
  453. data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +64 -20
  454. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +31 -5
  455. data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +57 -18
  456. data/src/core/ext/upb-generated/validate/validate.upb.c +407 -311
  457. data/src/core/ext/upb-generated/validate/validate.upb.h +2904 -1200
  458. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.c +110 -0
  459. data/src/core/ext/upb-generated/xds/annotations/v3/migrate.upb.h +278 -0
  460. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.c +55 -0
  461. data/src/core/ext/upb-generated/xds/annotations/v3/security.upb.h +108 -0
  462. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.c +38 -0
  463. data/src/core/ext/upb-generated/xds/annotations/v3/sensitive.upb.h +46 -0
  464. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +105 -0
  465. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +290 -0
  466. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.c +53 -0
  467. data/src/core/ext/upb-generated/xds/annotations/v3/versioning.upb.h +99 -0
  468. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +19 -6
  469. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +38 -19
  470. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +32 -18
  471. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +112 -55
  472. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +27 -13
  473. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +61 -30
  474. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.c +46 -0
  475. data/src/core/ext/upb-generated/xds/core/v3/extension.upb.h +103 -0
  476. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +24 -11
  477. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +63 -30
  478. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +35 -21
  479. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +144 -70
  480. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +24 -11
  481. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +66 -30
  482. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +73 -0
  483. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +187 -0
  484. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.c +207 -0
  485. data/src/core/ext/upb-generated/xds/type/matcher/v3/matcher.upb.h +878 -0
  486. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.c +52 -0
  487. data/src/core/ext/upb-generated/xds/type/matcher/v3/regex.upb.h +143 -0
  488. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.c +65 -0
  489. data/src/core/ext/upb-generated/xds/type/matcher/v3/string.upb.h +218 -0
  490. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.c +46 -0
  491. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +103 -0
  492. data/src/core/ext/upbdefs-generated/envoy/admin/v3/certs.upbdefs.c +84 -0
  493. data/src/core/ext/upbdefs-generated/envoy/admin/v3/certs.upbdefs.h +55 -0
  494. data/src/core/ext/upbdefs-generated/envoy/admin/v3/clusters.upbdefs.c +127 -0
  495. data/src/core/ext/upbdefs-generated/envoy/admin/v3/clusters.upbdefs.h +50 -0
  496. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +16 -61
  497. data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +67 -67
  498. data/src/core/ext/upbdefs-generated/envoy/admin/v3/init_dump.upbdefs.c +43 -0
  499. data/src/core/ext/upbdefs-generated/envoy/admin/v3/init_dump.upbdefs.h +40 -0
  500. data/src/core/ext/upbdefs-generated/envoy/admin/v3/listeners.upbdefs.c +53 -0
  501. data/src/core/ext/upbdefs-generated/envoy/admin/v3/listeners.upbdefs.h +40 -0
  502. data/src/core/ext/upbdefs-generated/envoy/admin/v3/memory.upbdefs.c +49 -0
  503. data/src/core/ext/upbdefs-generated/envoy/admin/v3/memory.upbdefs.h +35 -0
  504. data/src/core/ext/upbdefs-generated/envoy/admin/v3/metrics.upbdefs.c +46 -0
  505. data/src/core/ext/upbdefs-generated/envoy/admin/v3/metrics.upbdefs.h +35 -0
  506. data/src/core/ext/upbdefs-generated/envoy/admin/v3/mutex_stats.upbdefs.c +46 -0
  507. data/src/core/ext/upbdefs-generated/envoy/admin/v3/mutex_stats.upbdefs.h +35 -0
  508. data/src/core/ext/upbdefs-generated/envoy/admin/v3/server_info.upbdefs.c +142 -0
  509. data/src/core/ext/upbdefs-generated/envoy/admin/v3/server_info.upbdefs.h +40 -0
  510. data/src/core/ext/upbdefs-generated/envoy/admin/v3/tap.upbdefs.c +51 -0
  511. data/src/core/ext/upbdefs-generated/envoy/admin/v3/tap.upbdefs.h +35 -0
  512. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.c +10 -8
  513. data/src/core/ext/upbdefs-generated/envoy/annotations/deprecation.upbdefs.h +1 -1
  514. data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.c +10 -13
  515. data/src/core/ext/upbdefs-generated/envoy/annotations/resource.upbdefs.h +4 -4
  516. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +22 -52
  517. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +46 -46
  518. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +250 -281
  519. data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +55 -55
  520. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.c +60 -62
  521. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/circuit_breaker.upbdefs.h +10 -10
  522. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +445 -458
  523. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +80 -70
  524. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.c +16 -18
  525. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/filter.upbdefs.h +4 -4
  526. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +25 -23
  527. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.h +4 -4
  528. data/src/core/ext/upbdefs-generated/envoy/config/common/matcher/v3/matcher.upbdefs.c +206 -0
  529. data/src/core/ext/upbdefs-generated/envoy/config/common/matcher/v3/matcher.upbdefs.h +105 -0
  530. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.c +17 -32
  531. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/address.upbdefs.h +22 -22
  532. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.c +17 -19
  533. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/backoff.upbdefs.h +4 -4
  534. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +121 -154
  535. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +75 -70
  536. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +140 -116
  537. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +26 -16
  538. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.c +16 -19
  539. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/event_service_config.upbdefs.h +4 -4
  540. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.c +24 -43
  541. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/extension.upbdefs.h +4 -9
  542. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_method_list.upbdefs.c +53 -0
  543. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_method_list.upbdefs.h +40 -0
  544. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +23 -51
  545. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.h +43 -43
  546. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +179 -184
  547. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.h +30 -25
  548. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.c +16 -19
  549. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/http_uri.upbdefs.h +4 -4
  550. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +263 -252
  551. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +53 -43
  552. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +14 -16
  553. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.h +4 -4
  554. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.c +16 -20
  555. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/resolver.upbdefs.h +7 -7
  556. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.c +16 -18
  557. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/socket_option.upbdefs.h +4 -4
  558. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +20 -22
  559. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.h +4 -4
  560. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.c +15 -18
  561. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/udp_socket_config.upbdefs.h +4 -4
  562. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +20 -28
  563. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.h +13 -13
  564. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +98 -83
  565. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +23 -13
  566. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.c +20 -30
  567. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/load_report.upbdefs.h +16 -16
  568. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.c +16 -18
  569. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/api_listener.upbdefs.h +4 -4
  570. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +54 -62
  571. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.h +19 -19
  572. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +155 -166
  573. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.h +22 -22
  574. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.c +21 -23
  575. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/quic_config.upbdefs.h +4 -4
  576. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +17 -21
  577. data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.h +7 -7
  578. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +69 -0
  579. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.h +35 -0
  580. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +19 -35
  581. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +25 -25
  582. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +40 -47
  583. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +30 -25
  584. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +190 -0
  585. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.h +70 -0
  586. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +38 -38
  587. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.h +10 -10
  588. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +845 -913
  589. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +160 -160
  590. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.c +54 -48
  591. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/scoped_route.upbdefs.h +10 -10
  592. data/src/core/ext/upbdefs-generated/envoy/config/tap/v3/common.upbdefs.c +188 -0
  593. data/src/core/ext/upbdefs-generated/envoy/config/tap/v3/common.upbdefs.h +85 -0
  594. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/datadog.upbdefs.c +54 -0
  595. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/datadog.upbdefs.h +35 -0
  596. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/dynamic_ot.upbdefs.c +57 -0
  597. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/dynamic_ot.upbdefs.h +35 -0
  598. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +17 -21
  599. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.h +7 -7
  600. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/lightstep.upbdefs.c +72 -0
  601. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/lightstep.upbdefs.h +35 -0
  602. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/opencensus.upbdefs.c +99 -0
  603. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/opencensus.upbdefs.h +35 -0
  604. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/service.upbdefs.c +52 -0
  605. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/service.upbdefs.h +35 -0
  606. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/skywalking.upbdefs.c +71 -0
  607. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/skywalking.upbdefs.h +40 -0
  608. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/trace.upbdefs.c +57 -0
  609. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/trace.upbdefs.h +30 -0
  610. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/xray.upbdefs.c +75 -0
  611. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/xray.upbdefs.h +40 -0
  612. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/zipkin.upbdefs.c +77 -0
  613. data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/zipkin.upbdefs.h +35 -0
  614. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +17 -18
  615. data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +4 -4
  616. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +19 -29
  617. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +16 -16
  618. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +20 -26
  619. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +10 -10
  620. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +59 -0
  621. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.h +40 -0
  622. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +19 -20
  623. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +4 -4
  624. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +291 -311
  625. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +63 -58
  626. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +17 -13
  627. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.h +1 -1
  628. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +173 -141
  629. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.h +26 -16
  630. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +21 -27
  631. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +10 -10
  632. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +219 -211
  633. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h +24 -19
  634. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.c +58 -0
  635. data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls_spiffe_validator_config.upbdefs.h +40 -0
  636. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.c +16 -18
  637. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/ads.upbdefs.h +4 -4
  638. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +19 -33
  639. data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +22 -22
  640. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +18 -22
  641. data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.h +7 -7
  642. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +22 -32
  643. data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +16 -16
  644. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/cookie.upbdefs.c +46 -0
  645. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/cookie.upbdefs.h +35 -0
  646. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.c +15 -23
  647. data/src/core/ext/upbdefs-generated/envoy/type/http/v3/path_transformation.upbdefs.h +13 -13
  648. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/http_inputs.upbdefs.c +52 -0
  649. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/http_inputs.upbdefs.h +50 -0
  650. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.c +24 -27
  651. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/metadata.upbdefs.h +7 -7
  652. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +17 -19
  653. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +4 -4
  654. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.c +17 -19
  655. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/number.upbdefs.h +4 -4
  656. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.c +17 -19
  657. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/path.upbdefs.h +4 -4
  658. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +17 -23
  659. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.h +10 -10
  660. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +17 -21
  661. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.h +7 -7
  662. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +16 -21
  663. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +7 -7
  664. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.c +18 -24
  665. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/value.upbdefs.h +10 -10
  666. data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.c +15 -29
  667. data/src/core/ext/upbdefs-generated/envoy/type/metadata/v3/metadata.upbdefs.h +22 -22
  668. data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.c +16 -26
  669. data/src/core/ext/upbdefs-generated/envoy/type/tracing/v3/custom_tag.upbdefs.h +16 -16
  670. data/src/core/ext/upbdefs-generated/envoy/type/v3/hash_policy.upbdefs.c +53 -0
  671. data/src/core/ext/upbdefs-generated/envoy/type/v3/hash_policy.upbdefs.h +45 -0
  672. data/src/core/ext/upbdefs-generated/envoy/type/v3/http.upbdefs.c +12 -10
  673. data/src/core/ext/upbdefs-generated/envoy/type/v3/http.upbdefs.h +1 -1
  674. data/src/core/ext/upbdefs-generated/envoy/type/v3/http_status.upbdefs.c +94 -0
  675. data/src/core/ext/upbdefs-generated/envoy/type/v3/http_status.upbdefs.h +35 -0
  676. data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.c +14 -19
  677. data/src/core/ext/upbdefs-generated/envoy/type/v3/percent.upbdefs.h +7 -7
  678. data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.c +13 -19
  679. data/src/core/ext/upbdefs-generated/envoy/type/v3/range.upbdefs.h +10 -10
  680. data/src/core/ext/upbdefs-generated/envoy/type/v3/ratelimit_unit.upbdefs.c +38 -0
  681. data/src/core/ext/upbdefs-generated/envoy/type/v3/ratelimit_unit.upbdefs.h +30 -0
  682. data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.c +13 -16
  683. data/src/core/ext/upbdefs-generated/envoy/type/v3/semantic_version.upbdefs.h +4 -4
  684. data/src/core/ext/upbdefs-generated/envoy/type/v3/token_bucket.upbdefs.c +57 -0
  685. data/src/core/ext/upbdefs-generated/envoy/type/v3/token_bucket.upbdefs.h +35 -0
  686. data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.c +7 -7
  687. data/src/core/ext/upbdefs-generated/google/api/annotations.upbdefs.h +1 -1
  688. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.c +154 -0
  689. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.h +95 -0
  690. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.c +153 -0
  691. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.h +100 -0
  692. data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.c +5 -14
  693. data/src/core/ext/upbdefs-generated/google/api/http.upbdefs.h +10 -10
  694. data/src/core/ext/upbdefs-generated/google/api/httpbody.upbdefs.c +39 -0
  695. data/src/core/ext/upbdefs-generated/google/api/httpbody.upbdefs.h +35 -0
  696. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +5 -10
  697. data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.h +4 -4
  698. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +107 -164
  699. data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.h +82 -82
  700. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +5 -10
  701. data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.h +4 -4
  702. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +5 -10
  703. data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.h +4 -4
  704. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +5 -16
  705. data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.h +13 -13
  706. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +5 -10
  707. data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.h +4 -4
  708. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +5 -26
  709. data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.h +28 -28
  710. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.c +6 -11
  711. data/src/core/ext/upbdefs-generated/google/rpc/status.upbdefs.h +4 -4
  712. data/src/core/ext/upbdefs-generated/opencensus/proto/trace/v1/trace_config.upbdefs.c +67 -0
  713. data/src/core/ext/upbdefs-generated/opencensus/proto/trace/v1/trace_config.upbdefs.h +50 -0
  714. data/src/core/ext/upbdefs-generated/src/proto/grpc/lookup/v1/rls_config.upbdefs.c +99 -0
  715. data/src/core/ext/upbdefs-generated/src/proto/grpc/lookup/v1/rls_config.upbdefs.h +75 -0
  716. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +10 -18
  717. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.h +10 -10
  718. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +24 -33
  719. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.h +4 -4
  720. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +9 -8
  721. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.h +1 -1
  722. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +10 -13
  723. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.h +4 -4
  724. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +10 -14
  725. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.h +4 -4
  726. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +8 -57
  727. data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.h +70 -70
  728. data/src/core/ext/upbdefs-generated/xds/annotations/v3/migrate.upbdefs.c +63 -0
  729. data/src/core/ext/upbdefs-generated/xds/annotations/v3/migrate.upbdefs.h +45 -0
  730. data/src/core/ext/upbdefs-generated/xds/annotations/v3/security.upbdefs.c +47 -0
  731. data/src/core/ext/upbdefs-generated/xds/annotations/v3/security.upbdefs.h +35 -0
  732. data/src/core/ext/upbdefs-generated/xds/annotations/v3/sensitive.upbdefs.c +35 -0
  733. data/src/core/ext/upbdefs-generated/xds/annotations/v3/sensitive.upbdefs.h +30 -0
  734. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.c +64 -0
  735. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.h +50 -0
  736. data/src/core/ext/upbdefs-generated/xds/annotations/v3/versioning.upbdefs.c +40 -0
  737. data/src/core/ext/upbdefs-generated/xds/annotations/v3/versioning.upbdefs.h +35 -0
  738. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +18 -22
  739. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.h +4 -4
  740. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +32 -38
  741. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.h +7 -7
  742. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +20 -26
  743. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.h +7 -7
  744. data/src/core/ext/upbdefs-generated/xds/core/v3/extension.upbdefs.c +41 -0
  745. data/src/core/ext/upbdefs-generated/xds/core/v3/extension.upbdefs.h +35 -0
  746. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +23 -27
  747. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.h +4 -4
  748. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +39 -45
  749. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.h +7 -7
  750. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +25 -29
  751. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.h +4 -4
  752. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/matcher.upbdefs.c +126 -0
  753. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/matcher.upbdefs.h +80 -0
  754. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/regex.upbdefs.c +40 -0
  755. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/regex.upbdefs.h +40 -0
  756. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/string.upbdefs.c +52 -0
  757. data/src/core/ext/upbdefs-generated/xds/type/matcher/v3/string.upbdefs.h +40 -0
  758. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.c +40 -0
  759. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.h +35 -0
  760. data/src/core/ext/xds/certificate_provider_registry.cc +3 -3
  761. data/src/core/ext/xds/certificate_provider_store.cc +8 -0
  762. data/src/core/ext/xds/certificate_provider_store.h +10 -1
  763. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +4 -4
  764. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +2 -2
  765. data/src/core/ext/xds/upb_utils.h +67 -0
  766. data/src/core/ext/xds/xds_api.cc +214 -3608
  767. data/src/core/ext/xds/xds_api.h +62 -580
  768. data/src/core/ext/xds/xds_bootstrap.cc +241 -167
  769. data/src/core/ext/xds/xds_bootstrap.h +43 -15
  770. data/src/core/ext/xds/xds_certificate_provider.cc +5 -3
  771. data/src/core/ext/xds/xds_certificate_provider.h +10 -2
  772. data/src/core/ext/xds/xds_channel_stack_modifier.cc +109 -0
  773. data/src/core/ext/xds/xds_channel_stack_modifier.h +53 -0
  774. data/src/core/ext/xds/xds_client.cc +872 -899
  775. data/src/core/ext/xds/xds_client.h +132 -159
  776. data/src/core/ext/xds/xds_client_stats.cc +31 -30
  777. data/src/core/ext/xds/xds_client_stats.h +12 -11
  778. data/src/core/ext/xds/xds_cluster.cc +453 -0
  779. data/src/core/ext/xds/xds_cluster.h +108 -0
  780. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +142 -0
  781. data/src/core/ext/xds/xds_cluster_specifier_plugin.h +79 -0
  782. data/src/core/ext/xds/xds_common_types.cc +388 -0
  783. data/src/core/ext/xds/xds_common_types.h +95 -0
  784. data/src/core/ext/xds/xds_endpoint.cc +371 -0
  785. data/src/core/ext/xds/xds_endpoint.h +135 -0
  786. data/src/core/ext/xds/xds_http_fault_filter.cc +11 -10
  787. data/src/core/ext/xds/xds_http_fault_filter.h +6 -5
  788. data/src/core/ext/xds/xds_http_filters.cc +12 -5
  789. data/src/core/ext/xds/xds_http_filters.h +4 -4
  790. data/src/core/ext/xds/xds_http_rbac_filter.cc +563 -0
  791. data/src/core/ext/xds/xds_http_rbac_filter.h +54 -0
  792. data/src/core/ext/xds/xds_listener.cc +1039 -0
  793. data/src/core/ext/xds/xds_listener.h +220 -0
  794. data/src/core/{lib/transport/authority_override.h → ext/xds/xds_resource_type.cc} +11 -15
  795. data/src/core/ext/xds/xds_resource_type.h +98 -0
  796. data/src/core/ext/xds/xds_resource_type_impl.h +87 -0
  797. data/src/core/ext/xds/xds_route_config.cc +1122 -0
  798. data/src/core/ext/xds/xds_route_config.h +218 -0
  799. data/src/core/ext/xds/xds_routing.cc +250 -0
  800. data/src/core/ext/xds/xds_routing.h +101 -0
  801. data/src/core/ext/xds/xds_server_config_fetcher.cc +1057 -289
  802. data/src/core/lib/address_utils/parse_address.cc +26 -8
  803. data/src/core/lib/address_utils/parse_address.h +5 -0
  804. data/src/core/lib/address_utils/sockaddr_utils.cc +33 -36
  805. data/src/core/lib/address_utils/sockaddr_utils.h +1 -16
  806. data/src/core/lib/avl/avl.h +452 -88
  807. data/src/core/lib/backoff/backoff.cc +9 -38
  808. data/src/core/lib/backoff/backoff.h +11 -11
  809. data/src/core/lib/channel/call_finalization.h +86 -0
  810. data/src/core/lib/channel/call_tracer.h +4 -1
  811. data/src/core/lib/channel/channel_args.cc +173 -16
  812. data/src/core/lib/channel/channel_args.h +214 -1
  813. data/src/core/lib/channel/channel_args_preconditioning.cc +42 -0
  814. data/src/core/lib/channel/channel_args_preconditioning.h +61 -0
  815. data/src/core/lib/channel/channel_stack.cc +15 -6
  816. data/src/core/lib/channel/channel_stack.h +39 -6
  817. data/src/core/lib/channel/channel_stack_builder.cc +24 -283
  818. data/src/core/lib/channel/channel_stack_builder.h +118 -157
  819. data/src/core/lib/channel/channel_stack_builder_impl.cc +102 -0
  820. data/src/core/lib/channel/channel_stack_builder_impl.h +48 -0
  821. data/src/core/lib/channel/channel_trace.cc +8 -10
  822. data/src/core/lib/channel/channel_trace.h +2 -1
  823. data/src/core/lib/channel/channelz.cc +44 -39
  824. data/src/core/lib/channel/channelz.h +29 -29
  825. data/src/core/lib/channel/channelz_registry.cc +8 -7
  826. data/src/core/lib/channel/channelz_registry.h +1 -1
  827. data/src/core/lib/channel/connected_channel.cc +10 -6
  828. data/src/core/lib/channel/connected_channel.h +2 -2
  829. data/src/core/lib/channel/context.h +11 -0
  830. data/src/core/lib/channel/handshaker.cc +3 -2
  831. data/src/core/lib/channel/handshaker.h +2 -3
  832. data/src/core/lib/channel/handshaker_factory.h +10 -2
  833. data/src/core/lib/channel/handshaker_registry.cc +15 -70
  834. data/src/core/lib/channel/handshaker_registry.h +29 -12
  835. data/src/core/lib/channel/promise_based_filter.cc +1002 -0
  836. data/src/core/lib/channel/promise_based_filter.h +437 -0
  837. data/src/core/lib/channel/status_util.h +2 -2
  838. data/src/core/lib/compression/compression.cc +22 -114
  839. data/src/core/lib/compression/compression_internal.cc +139 -207
  840. data/src/core/lib/compression/compression_internal.h +64 -69
  841. data/src/core/lib/compression/message_compress.cc +13 -13
  842. data/src/core/lib/compression/message_compress.h +2 -2
  843. data/src/core/lib/config/core_configuration.cc +104 -0
  844. data/src/core/lib/config/core_configuration.h +196 -0
  845. data/src/core/lib/debug/stats.cc +1 -1
  846. data/src/core/lib/debug/stats.h +1 -0
  847. data/src/core/lib/debug/stats_data.cc +17 -20
  848. data/src/core/lib/debug/stats_data.h +19 -21
  849. data/src/core/lib/debug/trace.cc +1 -0
  850. data/src/core/lib/debug/trace.h +4 -3
  851. data/src/core/lib/event_engine/{endpoint_config.cc → channel_args_endpoint_config.cc} +2 -2
  852. data/src/core/lib/event_engine/{endpoint_config_internal.h → channel_args_endpoint_config.h} +3 -3
  853. data/src/core/lib/{iomgr/event_engine/iomgr.h → event_engine/default_event_engine_factory.cc} +11 -8
  854. data/src/core/lib/event_engine/event_engine.cc +21 -19
  855. data/src/core/lib/event_engine/event_engine_factory.h +36 -0
  856. data/src/core/lib/event_engine/memory_allocator.cc +66 -0
  857. data/src/core/lib/event_engine/resolved_address.cc +39 -0
  858. data/src/core/lib/event_engine/sockaddr.cc +3 -3
  859. data/src/core/lib/gpr/alloc.cc +4 -3
  860. data/src/core/lib/gpr/atm.cc +1 -1
  861. data/src/core/lib/gpr/cpu_posix.cc +1 -1
  862. data/src/core/lib/gpr/env_linux.cc +1 -2
  863. data/src/core/lib/gpr/env_posix.cc +2 -3
  864. data/src/core/lib/gpr/log.cc +3 -3
  865. data/src/core/lib/gpr/log_android.cc +3 -2
  866. data/src/core/lib/gpr/log_linux.cc +7 -4
  867. data/src/core/lib/gpr/log_posix.cc +6 -3
  868. data/src/core/lib/gpr/string.cc +2 -2
  869. data/src/core/lib/gpr/string.h +2 -2
  870. data/src/core/lib/gpr/sync.cc +2 -2
  871. data/src/core/lib/gpr/sync_abseil.cc +7 -6
  872. data/src/core/lib/gpr/sync_posix.cc +4 -3
  873. data/src/core/lib/gpr/time.cc +5 -3
  874. data/src/core/lib/gpr/time_windows.cc +3 -2
  875. data/src/core/lib/gpr/tls.h +126 -40
  876. data/src/core/lib/gpr/tmpfile_posix.cc +1 -2
  877. data/src/core/lib/gpr/useful.h +97 -32
  878. data/src/core/lib/gprpp/atomic_utils.h +47 -0
  879. data/src/core/lib/gprpp/bitset.h +207 -0
  880. data/src/core/lib/gprpp/capture.h +76 -0
  881. data/src/core/lib/gprpp/chunked_vector.h +253 -0
  882. data/src/core/lib/{transport/authority_override.cc → gprpp/construct_destruct.h} +16 -17
  883. data/src/core/lib/gprpp/cpp_impl_of.h +49 -0
  884. data/src/core/lib/gprpp/debug_location.h +2 -0
  885. data/src/core/lib/gprpp/dual_ref_counted.h +25 -26
  886. data/src/core/lib/gprpp/fork.cc +14 -12
  887. data/src/core/lib/gprpp/fork.h +4 -4
  888. data/src/core/lib/gprpp/global_config.h +1 -2
  889. data/src/core/lib/gprpp/global_config_env.cc +14 -14
  890. data/src/core/lib/gprpp/global_config_env.h +2 -2
  891. data/src/core/lib/gprpp/global_config_generic.h +2 -2
  892. data/src/core/lib/gprpp/manual_constructor.h +10 -8
  893. data/src/core/lib/gprpp/match.h +73 -0
  894. data/src/core/lib/gprpp/memory.h +9 -3
  895. data/src/core/lib/gprpp/mpscq.cc +7 -7
  896. data/src/core/lib/gprpp/mpscq.h +6 -5
  897. data/src/core/lib/gprpp/orphanable.h +4 -4
  898. data/src/core/lib/gprpp/overload.h +59 -0
  899. data/src/core/lib/gprpp/ref_counted.h +21 -19
  900. data/src/core/lib/gprpp/ref_counted_ptr.h +2 -4
  901. data/src/core/lib/gprpp/single_set_ptr.h +87 -0
  902. data/src/core/lib/gprpp/status_helper.cc +65 -37
  903. data/src/core/lib/gprpp/status_helper.h +14 -16
  904. data/src/core/lib/gprpp/sync.h +3 -1
  905. data/src/core/lib/gprpp/table.h +434 -0
  906. data/src/core/lib/gprpp/thd_posix.cc +5 -5
  907. data/src/core/lib/gprpp/thd_windows.cc +4 -11
  908. data/src/core/lib/gprpp/time.cc +198 -0
  909. data/src/core/lib/gprpp/time.h +292 -0
  910. data/src/core/lib/gprpp/time_util.cc +2 -2
  911. data/src/core/lib/gprpp/time_util.h +2 -2
  912. data/src/core/lib/http/format_request.cc +29 -25
  913. data/src/core/lib/http/format_request.h +8 -6
  914. data/src/core/lib/http/httpcli.cc +298 -208
  915. data/src/core/lib/http/httpcli.h +183 -85
  916. data/src/core/lib/http/httpcli_security_connector.cc +67 -81
  917. data/src/core/lib/http/httpcli_ssl_credentials.h +37 -0
  918. data/src/core/lib/http/parser.cc +82 -11
  919. data/src/core/lib/http/parser.h +16 -2
  920. data/src/core/lib/iomgr/buffer_list.cc +11 -10
  921. data/src/core/lib/iomgr/buffer_list.h +19 -20
  922. data/src/core/lib/iomgr/call_combiner.cc +45 -16
  923. data/src/core/lib/iomgr/cfstream_handle.cc +1 -1
  924. data/src/core/lib/iomgr/closure.h +29 -9
  925. data/src/core/lib/iomgr/combiner.cc +34 -26
  926. data/src/core/lib/iomgr/combiner.h +1 -0
  927. data/src/core/lib/iomgr/dualstack_socket_posix.cc +1 -0
  928. data/src/core/lib/iomgr/endpoint.cc +0 -4
  929. data/src/core/lib/iomgr/endpoint.h +1 -4
  930. data/src/core/lib/iomgr/endpoint_cfstream.cc +15 -42
  931. data/src/core/lib/iomgr/endpoint_cfstream.h +4 -4
  932. data/src/core/lib/iomgr/endpoint_pair.h +1 -0
  933. data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +1 -2
  934. data/src/core/lib/iomgr/endpoint_pair_posix.cc +11 -9
  935. data/src/core/lib/iomgr/endpoint_pair_windows.cc +5 -6
  936. data/src/core/lib/iomgr/error.cc +123 -59
  937. data/src/core/lib/iomgr/error.h +73 -20
  938. data/src/core/lib/iomgr/error_cfstream.cc +7 -2
  939. data/src/core/lib/iomgr/error_internal.h +1 -0
  940. data/src/core/lib/iomgr/ev_apple.cc +6 -5
  941. data/src/core/lib/iomgr/ev_epoll1_linux.cc +25 -31
  942. data/src/core/lib/iomgr/ev_poll_posix.cc +49 -52
  943. data/src/core/lib/iomgr/ev_posix.cc +10 -12
  944. data/src/core/lib/iomgr/ev_posix.h +1 -1
  945. data/src/core/lib/iomgr/event_engine/closure.cc +41 -18
  946. data/src/core/lib/iomgr/event_engine/closure.h +10 -1
  947. data/src/core/lib/iomgr/event_engine/endpoint.cc +7 -27
  948. data/src/core/lib/iomgr/event_engine/endpoint.h +1 -2
  949. data/src/core/lib/iomgr/event_engine/iomgr.cc +10 -30
  950. data/src/core/lib/iomgr/event_engine/pollset.cc +6 -6
  951. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +6 -0
  952. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +2 -0
  953. data/src/core/lib/iomgr/event_engine/resolver.cc +70 -47
  954. data/src/core/lib/iomgr/event_engine/resolver.h +56 -0
  955. data/src/core/lib/iomgr/event_engine/tcp.cc +70 -37
  956. data/src/core/lib/iomgr/event_engine/timer.cc +13 -8
  957. data/src/core/lib/iomgr/exec_ctx.cc +28 -109
  958. data/src/core/lib/iomgr/exec_ctx.h +28 -52
  959. data/src/core/lib/iomgr/executor/mpmcqueue.cc +15 -16
  960. data/src/core/lib/iomgr/executor/mpmcqueue.h +7 -11
  961. data/src/core/lib/iomgr/executor/threadpool.cc +2 -2
  962. data/src/core/lib/iomgr/executor/threadpool.h +2 -1
  963. data/src/core/lib/iomgr/executor.cc +30 -39
  964. data/src/core/lib/iomgr/executor.h +1 -1
  965. data/src/core/lib/iomgr/fork_posix.cc +2 -1
  966. data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +2 -2
  967. data/src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc +2 -2
  968. data/src/core/lib/iomgr/internal_errqueue.cc +3 -2
  969. data/src/core/lib/iomgr/iocp_windows.cc +10 -9
  970. data/src/core/lib/iomgr/iocp_windows.h +1 -1
  971. data/src/core/lib/iomgr/iomgr.cc +3 -1
  972. data/src/core/lib/iomgr/iomgr.h +2 -2
  973. data/src/core/lib/iomgr/iomgr_internal.cc +6 -10
  974. data/src/core/lib/iomgr/iomgr_internal.h +3 -2
  975. data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
  976. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -2
  977. data/src/core/lib/iomgr/iomgr_windows.cc +3 -4
  978. data/src/core/lib/iomgr/load_file.cc +2 -2
  979. data/src/core/lib/iomgr/lockfree_event.cc +18 -0
  980. data/src/core/lib/iomgr/polling_entity.cc +2 -2
  981. data/src/core/lib/iomgr/polling_entity.h +6 -0
  982. data/src/core/lib/iomgr/pollset.cc +1 -1
  983. data/src/core/lib/iomgr/pollset.h +4 -4
  984. data/src/core/lib/iomgr/pollset_set_windows.cc +1 -0
  985. data/src/core/lib/iomgr/pollset_windows.cc +2 -2
  986. data/src/core/lib/iomgr/port.h +6 -16
  987. data/src/core/lib/iomgr/python_util.h +1 -0
  988. data/src/core/lib/iomgr/resolve_address.cc +7 -25
  989. data/src/core/lib/iomgr/resolve_address.h +47 -48
  990. data/src/core/lib/iomgr/resolve_address_impl.h +59 -0
  991. data/src/core/lib/iomgr/resolve_address_posix.cc +90 -78
  992. data/src/core/lib/iomgr/resolve_address_posix.h +47 -0
  993. data/src/core/lib/iomgr/resolve_address_windows.cc +99 -82
  994. data/src/core/lib/iomgr/resolve_address_windows.h +47 -0
  995. data/src/core/lib/iomgr/resolved_address.h +39 -0
  996. data/src/core/lib/iomgr/sockaddr.h +1 -1
  997. data/src/core/lib/iomgr/{socket_utils_uv.cc → sockaddr_utils_posix.cc} +21 -8
  998. data/src/core/lib/iomgr/socket_factory_posix.cc +5 -5
  999. data/src/core/lib/iomgr/socket_factory_posix.h +1 -0
  1000. data/src/core/lib/iomgr/socket_mutator.cc +2 -2
  1001. data/src/core/lib/iomgr/socket_mutator.h +2 -2
  1002. data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -22
  1003. data/src/core/lib/iomgr/socket_utils_linux.cc +4 -4
  1004. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -2
  1005. data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
  1006. data/src/core/lib/iomgr/socket_utils_windows.cc +2 -2
  1007. data/src/core/lib/iomgr/tcp_client.cc +1 -1
  1008. data/src/core/lib/iomgr/tcp_client.h +5 -2
  1009. data/src/core/lib/iomgr/tcp_client_cfstream.cc +8 -24
  1010. data/src/core/lib/iomgr/tcp_client_posix.cc +17 -27
  1011. data/src/core/lib/iomgr/tcp_client_posix.h +4 -2
  1012. data/src/core/lib/iomgr/tcp_client_windows.cc +8 -10
  1013. data/src/core/lib/iomgr/tcp_posix.cc +143 -120
  1014. data/src/core/lib/iomgr/tcp_posix.h +9 -12
  1015. data/src/core/lib/iomgr/tcp_server.h +4 -3
  1016. data/src/core/lib/iomgr/tcp_server_posix.cc +40 -29
  1017. data/src/core/lib/iomgr/tcp_server_utils_posix.h +21 -17
  1018. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +2 -2
  1019. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +4 -4
  1020. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc +4 -4
  1021. data/src/core/lib/iomgr/tcp_server_windows.cc +6 -10
  1022. data/src/core/lib/iomgr/tcp_windows.cc +22 -39
  1023. data/src/core/lib/iomgr/tcp_windows.h +1 -1
  1024. data/src/core/lib/iomgr/timer.cc +3 -2
  1025. data/src/core/lib/iomgr/timer.h +11 -7
  1026. data/src/core/lib/iomgr/timer_generic.cc +113 -124
  1027. data/src/core/lib/iomgr/timer_generic.h +1 -0
  1028. data/src/core/lib/iomgr/timer_heap.cc +2 -3
  1029. data/src/core/lib/iomgr/timer_manager.cc +15 -14
  1030. data/src/core/lib/iomgr/unix_sockets_posix.cc +25 -39
  1031. data/src/core/lib/iomgr/unix_sockets_posix.h +6 -10
  1032. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +6 -15
  1033. data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -0
  1034. data/src/core/lib/iomgr/wakeup_fd_pipe.cc +2 -3
  1035. data/src/core/lib/iomgr/wakeup_fd_posix.cc +1 -0
  1036. data/src/core/lib/iomgr/work_serializer.cc +120 -44
  1037. data/src/core/lib/iomgr/work_serializer.h +17 -5
  1038. data/src/core/lib/json/json_reader.cc +92 -52
  1039. data/src/core/lib/json/json_util.cc +71 -3
  1040. data/src/core/lib/json/json_util.h +67 -117
  1041. data/src/core/lib/json/json_writer.cc +0 -3
  1042. data/src/core/lib/matchers/matchers.cc +1 -1
  1043. data/src/core/lib/matchers/matchers.h +0 -1
  1044. data/src/core/lib/profiling/basic_timers.cc +8 -6
  1045. data/src/core/lib/profiling/stap_timers.cc +2 -2
  1046. data/src/core/lib/promise/activity.cc +121 -0
  1047. data/src/core/lib/promise/activity.h +540 -0
  1048. data/src/core/lib/promise/arena_promise.h +188 -0
  1049. data/src/core/lib/promise/call_push_pull.h +144 -0
  1050. data/src/core/lib/promise/context.h +86 -0
  1051. data/src/core/lib/promise/detail/basic_seq.h +496 -0
  1052. data/src/core/lib/promise/detail/promise_factory.h +189 -0
  1053. data/src/core/lib/promise/detail/promise_like.h +85 -0
  1054. data/src/core/lib/promise/detail/status.h +50 -0
  1055. data/src/core/lib/promise/detail/switch.h +1455 -0
  1056. data/src/core/lib/promise/exec_ctx_wakeup_scheduler.h +48 -0
  1057. data/src/core/lib/promise/intra_activity_waiter.h +49 -0
  1058. data/src/core/lib/promise/latch.h +104 -0
  1059. data/src/core/lib/promise/loop.h +134 -0
  1060. data/src/core/lib/promise/map.h +88 -0
  1061. data/src/core/lib/promise/poll.h +66 -0
  1062. data/src/core/lib/promise/promise.h +95 -0
  1063. data/src/core/lib/promise/race.h +84 -0
  1064. data/src/core/lib/promise/seq.h +89 -0
  1065. data/src/core/lib/promise/sleep.cc +74 -0
  1066. data/src/core/lib/promise/sleep.h +66 -0
  1067. data/src/core/lib/promise/try_seq.h +157 -0
  1068. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.cc +17 -25
  1069. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.h +43 -44
  1070. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_factory.h +32 -29
  1071. data/src/core/lib/resolver/resolver_registry.cc +156 -0
  1072. data/src/core/lib/resolver/resolver_registry.h +113 -0
  1073. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.cc +1 -1
  1074. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.h +5 -5
  1075. data/src/core/lib/resource_quota/api.cc +83 -0
  1076. data/src/core/lib/resource_quota/api.h +40 -0
  1077. data/src/core/lib/{gprpp → resource_quota}/arena.cc +18 -14
  1078. data/src/core/lib/{gprpp → resource_quota}/arena.h +37 -16
  1079. data/src/core/lib/resource_quota/memory_quota.cc +478 -0
  1080. data/src/core/lib/resource_quota/memory_quota.h +457 -0
  1081. data/src/core/lib/resource_quota/resource_quota.cc +33 -0
  1082. data/src/core/lib/resource_quota/resource_quota.h +66 -0
  1083. data/src/core/lib/resource_quota/thread_quota.cc +43 -0
  1084. data/src/core/lib/resource_quota/thread_quota.h +57 -0
  1085. data/src/core/lib/resource_quota/trace.cc +19 -0
  1086. data/src/core/{ext/filters/max_age/max_age_filter.h → lib/resource_quota/trace.h} +6 -8
  1087. data/src/core/lib/security/authorization/authorization_policy_provider.h +12 -4
  1088. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +1 -1
  1089. data/src/core/lib/security/authorization/evaluate_args.cc +39 -36
  1090. data/src/core/lib/security/authorization/evaluate_args.h +3 -2
  1091. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +60 -0
  1092. data/src/core/lib/security/authorization/grpc_authorization_engine.h +62 -0
  1093. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +106 -0
  1094. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +50 -0
  1095. data/src/core/lib/security/authorization/matchers.cc +227 -0
  1096. data/src/core/lib/security/authorization/matchers.h +211 -0
  1097. data/src/core/lib/security/authorization/rbac_policy.cc +442 -0
  1098. data/src/core/lib/security/authorization/rbac_policy.h +171 -0
  1099. data/src/core/lib/security/context/security_context.cc +15 -10
  1100. data/src/core/lib/security/context/security_context.h +9 -2
  1101. data/src/core/lib/security/credentials/alts/alts_credentials.cc +6 -5
  1102. data/src/core/lib/security/credentials/alts/alts_credentials.h +10 -0
  1103. data/src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc +2 -2
  1104. data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
  1105. data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +2 -2
  1106. data/src/core/lib/security/credentials/call_creds_util.cc +87 -0
  1107. data/src/core/lib/security/credentials/call_creds_util.h +42 -0
  1108. data/src/core/lib/security/credentials/channel_creds_registry.h +97 -0
  1109. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +70 -0
  1110. data/src/core/lib/security/credentials/composite/composite_credentials.cc +28 -86
  1111. data/src/core/lib/security/credentials/composite/composite_credentials.h +23 -10
  1112. data/src/core/lib/security/credentials/credentials.cc +11 -10
  1113. data/src/core/lib/security/credentials/credentials.h +81 -82
  1114. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +61 -59
  1115. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +2 -2
  1116. data/src/core/lib/security/credentials/external/aws_request_signer.cc +3 -3
  1117. data/src/core/lib/security/credentials/external/external_account_credentials.cc +112 -68
  1118. data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -9
  1119. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +0 -1
  1120. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +35 -18
  1121. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +1 -0
  1122. data/src/core/lib/security/credentials/fake/fake_credentials.cc +23 -27
  1123. data/src/core/lib/security/credentials/fake/fake_credentials.h +22 -21
  1124. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +1 -2
  1125. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +77 -20
  1126. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +9 -3
  1127. data/src/core/lib/security/credentials/iam/iam_credentials.cc +23 -29
  1128. data/src/core/lib/security/credentials/iam/iam_credentials.h +15 -9
  1129. data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +25 -26
  1130. data/src/core/lib/security/credentials/insecure/insecure_credentials.h +57 -0
  1131. data/src/core/lib/security/credentials/jwt/json_token.cc +5 -7
  1132. data/src/core/lib/security/credentials/jwt/json_token.h +2 -1
  1133. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +56 -51
  1134. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +27 -15
  1135. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +59 -54
  1136. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +4 -4
  1137. data/src/core/lib/security/credentials/local/local_credentials.cc +6 -6
  1138. data/src/core/lib/security/credentials/local/local_credentials.h +10 -0
  1139. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +160 -181
  1140. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +61 -33
  1141. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +98 -156
  1142. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +56 -27
  1143. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +11 -18
  1144. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +14 -4
  1145. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +3 -2
  1146. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +10 -6
  1147. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +13 -13
  1148. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +62 -12
  1149. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +209 -0
  1150. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +145 -0
  1151. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +33 -87
  1152. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +75 -151
  1153. data/src/core/lib/security/credentials/tls/tls_credentials.cc +30 -16
  1154. data/src/core/lib/security/credentials/tls/tls_credentials.h +6 -0
  1155. data/src/core/lib/security/credentials/xds/xds_credentials.cc +51 -58
  1156. data/src/core/lib/security/credentials/xds/xds_credentials.h +37 -6
  1157. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +11 -17
  1158. data/src/core/lib/security/security_connector/alts/alts_security_connector.h +3 -3
  1159. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +13 -24
  1160. data/src/core/lib/security/security_connector/fake/fake_security_connector.h +0 -2
  1161. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +8 -18
  1162. data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +11 -16
  1163. data/src/core/lib/security/security_connector/load_system_roots_fallback.cc +1 -0
  1164. data/src/core/lib/security/security_connector/load_system_roots_linux.cc +4 -5
  1165. data/src/core/lib/security/security_connector/local/local_security_connector.cc +14 -19
  1166. data/src/core/lib/security/security_connector/security_connector.cc +8 -15
  1167. data/src/core/lib/security/security_connector/security_connector.h +26 -22
  1168. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +14 -20
  1169. data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +1 -2
  1170. data/src/core/lib/security/security_connector/ssl_utils.cc +41 -36
  1171. data/src/core/lib/security/security_connector/ssl_utils.h +14 -18
  1172. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +366 -211
  1173. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +69 -48
  1174. data/src/core/lib/security/transport/auth_filters.h +39 -5
  1175. data/src/core/lib/security/transport/client_auth_filter.cc +98 -363
  1176. data/src/core/lib/security/transport/secure_endpoint.cc +202 -143
  1177. data/src/core/lib/security/transport/secure_endpoint.h +2 -1
  1178. data/src/core/lib/security/transport/security_handshaker.cc +95 -54
  1179. data/src/core/lib/security/transport/security_handshaker.h +2 -1
  1180. data/src/core/lib/security/transport/server_auth_filter.cc +41 -37
  1181. data/src/core/lib/security/transport/tsi_error.cc +3 -5
  1182. data/src/core/lib/security/util/json_util.cc +6 -8
  1183. data/src/core/lib/service_config/service_config.h +82 -0
  1184. data/src/core/lib/service_config/service_config_call_data.h +72 -0
  1185. data/src/core/{ext/filters/client_channel/service_config.cc → lib/service_config/service_config_impl.cc} +20 -17
  1186. data/src/core/{ext/filters/client_channel/service_config.h → lib/service_config/service_config_impl.h} +16 -18
  1187. data/src/core/{ext/filters/client_channel → lib/service_config}/service_config_parser.cc +31 -27
  1188. data/src/core/{ext/filters/client_channel → lib/service_config}/service_config_parser.h +39 -28
  1189. data/src/core/lib/slice/percent_encoding.cc +84 -97
  1190. data/src/core/lib/slice/percent_encoding.h +23 -28
  1191. data/src/core/lib/slice/slice.cc +80 -200
  1192. data/src/core/lib/slice/slice.h +384 -0
  1193. data/src/core/lib/{iomgr/is_epollexclusive_available.h → slice/slice_api.cc} +15 -12
  1194. data/src/core/lib/slice/slice_buffer.cc +10 -7
  1195. data/src/core/lib/slice/slice_internal.h +15 -277
  1196. data/src/core/lib/slice/slice_refcount.cc +35 -0
  1197. data/src/core/lib/slice/slice_refcount.h +46 -0
  1198. data/src/core/lib/slice/slice_refcount_base.h +61 -0
  1199. data/src/core/lib/slice/slice_split.cc +100 -0
  1200. data/src/core/lib/slice/slice_split.h +40 -0
  1201. data/src/core/lib/slice/slice_string_helpers.cc +0 -83
  1202. data/src/core/lib/slice/slice_string_helpers.h +0 -11
  1203. data/src/core/lib/surface/api_trace.cc +2 -1
  1204. data/src/core/lib/surface/api_trace.h +1 -0
  1205. data/src/core/lib/surface/builtins.cc +49 -0
  1206. data/src/core/lib/surface/builtins.h +26 -0
  1207. data/src/core/lib/surface/byte_buffer_reader.cc +1 -1
  1208. data/src/core/lib/surface/call.cc +1142 -1247
  1209. data/src/core/lib/surface/call.h +8 -28
  1210. data/src/core/lib/surface/call_details.cc +2 -2
  1211. data/src/core/lib/surface/call_log_batch.cc +2 -2
  1212. data/src/core/lib/surface/channel.cc +72 -103
  1213. data/src/core/lib/surface/channel.h +15 -23
  1214. data/src/core/lib/surface/channel_init.cc +22 -76
  1215. data/src/core/lib/surface/channel_init.h +44 -40
  1216. data/src/core/lib/surface/channel_ping.cc +1 -2
  1217. data/src/core/lib/surface/channel_stack_type.cc +2 -1
  1218. data/src/core/lib/surface/completion_queue.cc +70 -78
  1219. data/src/core/lib/surface/completion_queue_factory.cc +2 -1
  1220. data/src/core/lib/surface/completion_queue_factory.h +1 -0
  1221. data/src/core/lib/surface/event_string.cc +1 -0
  1222. data/src/core/lib/surface/init.cc +81 -57
  1223. data/src/core/lib/surface/init.h +0 -3
  1224. data/src/core/lib/surface/lame_client.cc +47 -32
  1225. data/src/core/lib/surface/lame_client.h +1 -1
  1226. data/src/core/lib/surface/metadata_array.cc +2 -2
  1227. data/src/core/lib/surface/server.cc +71 -118
  1228. data/src/core/lib/surface/server.h +40 -37
  1229. data/src/core/lib/surface/validate_metadata.cc +49 -18
  1230. data/src/core/lib/surface/version.cc +2 -2
  1231. data/src/core/lib/transport/bdp_estimator.cc +11 -12
  1232. data/src/core/lib/transport/bdp_estimator.h +2 -2
  1233. data/src/core/lib/transport/byte_stream.cc +6 -0
  1234. data/src/core/lib/transport/byte_stream.h +1 -0
  1235. data/src/core/lib/transport/connectivity_state.cc +8 -5
  1236. data/src/core/lib/transport/connectivity_state.h +2 -2
  1237. data/src/core/lib/transport/error_utils.cc +48 -20
  1238. data/src/core/lib/transport/error_utils.h +3 -2
  1239. data/src/core/lib/transport/metadata_batch.h +1352 -171
  1240. data/src/core/lib/transport/parsed_metadata.cc +37 -0
  1241. data/src/core/lib/transport/parsed_metadata.h +401 -0
  1242. data/src/core/lib/transport/pid_controller.cc +4 -4
  1243. data/src/core/lib/transport/status_conversion.cc +2 -2
  1244. data/src/core/lib/transport/status_conversion.h +1 -1
  1245. data/src/core/lib/transport/timeout_encoding.cc +204 -67
  1246. data/src/core/lib/transport/timeout_encoding.h +40 -10
  1247. data/src/core/lib/transport/transport.cc +11 -32
  1248. data/src/core/lib/transport/transport.h +103 -4
  1249. data/src/core/lib/transport/transport_impl.h +14 -0
  1250. data/src/core/lib/transport/transport_op_string.cc +7 -29
  1251. data/src/core/lib/uri/uri_parser.cc +237 -63
  1252. data/src/core/lib/uri/uri_parser.h +39 -23
  1253. data/src/core/plugin_registry/grpc_plugin_registry.cc +69 -102
  1254. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +85 -0
  1255. data/src/core/tsi/alts/crypt/aes_gcm.cc +6 -3
  1256. data/src/core/tsi/alts/crypt/gsec.h +2 -3
  1257. data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +13 -12
  1258. data/src/core/tsi/alts/frame_protector/frame_handler.cc +10 -11
  1259. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +31 -27
  1260. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +2 -3
  1261. data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +9 -1
  1262. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +33 -15
  1263. data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +2 -2
  1264. data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +1 -1
  1265. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -2
  1266. data/src/core/tsi/alts/handshaker/transport_security_common_api.h +2 -2
  1267. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +2 -2
  1268. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +1 -1
  1269. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +2 -2
  1270. data/src/core/tsi/fake_transport_security.cc +15 -7
  1271. data/src/core/tsi/local_transport_security.cc +42 -87
  1272. data/src/core/tsi/local_transport_security.h +1 -4
  1273. data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +141 -0
  1274. data/src/core/tsi/ssl/key_logging/ssl_key_logging.h +81 -0
  1275. data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -4
  1276. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +20 -53
  1277. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +6 -7
  1278. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +2 -2
  1279. data/src/core/tsi/ssl_transport_security.cc +229 -62
  1280. data/src/core/tsi/ssl_transport_security.h +50 -9
  1281. data/src/core/tsi/transport_security.cc +15 -3
  1282. data/src/core/tsi/transport_security.h +16 -1
  1283. data/src/core/tsi/transport_security_grpc.h +1 -0
  1284. data/src/core/tsi/transport_security_interface.h +28 -0
  1285. data/src/ruby/ext/grpc/extconf.rb +21 -11
  1286. data/src/ruby/ext/grpc/rb_byte_buffer.c +2 -1
  1287. data/src/ruby/ext/grpc/rb_call.c +5 -5
  1288. data/src/ruby/ext/grpc/rb_call_credentials.c +5 -5
  1289. data/src/ruby/ext/grpc/rb_channel.c +15 -10
  1290. data/src/ruby/ext/grpc/rb_channel_args.c +2 -2
  1291. data/src/ruby/ext/grpc/rb_channel_credentials.c +4 -4
  1292. data/src/ruby/ext/grpc/rb_channel_credentials.h +1 -0
  1293. data/src/ruby/ext/grpc/rb_completion_queue.c +3 -2
  1294. data/src/ruby/ext/grpc/rb_compression_options.c +5 -4
  1295. data/src/ruby/ext/grpc/rb_event_thread.c +4 -4
  1296. data/src/ruby/ext/grpc/rb_grpc.c +5 -4
  1297. data/src/ruby/ext/grpc/rb_grpc.h +1 -0
  1298. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +30 -34
  1299. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +45 -51
  1300. data/src/ruby/ext/grpc/rb_server.c +13 -9
  1301. data/src/ruby/ext/grpc/rb_server_credentials.c +3 -3
  1302. data/src/ruby/ext/grpc/rb_server_credentials.h +1 -0
  1303. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +8 -5
  1304. data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +3 -1
  1305. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +6 -5
  1306. data/src/ruby/ext/grpc/rb_xds_server_credentials.h +3 -1
  1307. data/src/ruby/lib/grpc/generic/active_call.rb +7 -1
  1308. data/src/ruby/lib/grpc/grpc.rb +1 -1
  1309. data/src/ruby/lib/grpc/version.rb +1 -1
  1310. data/src/ruby/pb/generate_proto_ruby.sh +1 -0
  1311. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +1 -0
  1312. data/src/ruby/pb/test/client.rb +769 -0
  1313. data/src/ruby/pb/test/server.rb +252 -0
  1314. data/src/ruby/pb/test/xds_client.rb +415 -0
  1315. data/src/ruby/spec/client_server_spec.rb +1 -1
  1316. data/third_party/abseil-cpp/absl/algorithm/container.h +101 -91
  1317. data/third_party/abseil-cpp/absl/base/attributes.h +64 -31
  1318. data/third_party/abseil-cpp/absl/base/config.h +67 -37
  1319. data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +1 -26
  1320. data/third_party/abseil-cpp/absl/base/internal/fast_type_id.h +48 -0
  1321. data/third_party/abseil-cpp/absl/base/internal/spinlock.h +3 -1
  1322. data/third_party/abseil-cpp/absl/base/internal/spinlock_wait.h +2 -0
  1323. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +69 -0
  1324. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +4 -4
  1325. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +15 -10
  1326. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +16 -0
  1327. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h +4 -4
  1328. data/third_party/abseil-cpp/absl/base/options.h +1 -1
  1329. data/third_party/abseil-cpp/absl/container/fixed_array.h +0 -5
  1330. data/third_party/abseil-cpp/absl/container/inlined_vector.h +105 -97
  1331. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +17 -15
  1332. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +18 -102
  1333. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +37 -78
  1334. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +388 -423
  1335. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +3 -2
  1336. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +14 -8
  1337. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +251 -120
  1338. data/third_party/abseil-cpp/absl/debugging/internal/demangle.cc +11 -1
  1339. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc +12 -11
  1340. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +6 -2
  1341. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h +12 -5
  1342. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_emscripten-inl.inc +110 -0
  1343. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_riscv-inl.inc +234 -0
  1344. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +25 -7
  1345. data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +8 -2
  1346. data/third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc +21 -3
  1347. data/third_party/abseil-cpp/absl/debugging/stacktrace.cc +2 -0
  1348. data/third_party/abseil-cpp/absl/debugging/symbolize.cc +2 -0
  1349. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +14 -0
  1350. data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +72 -0
  1351. data/third_party/abseil-cpp/absl/functional/function_ref.h +4 -1
  1352. data/third_party/abseil-cpp/absl/hash/hash.h +22 -0
  1353. data/third_party/abseil-cpp/absl/hash/internal/hash.cc +15 -16
  1354. data/third_party/abseil-cpp/absl/hash/internal/hash.h +88 -37
  1355. data/third_party/abseil-cpp/absl/hash/internal/{wyhash.cc → low_level_hash.cc} +23 -11
  1356. data/third_party/abseil-cpp/absl/hash/internal/{wyhash.h → low_level_hash.h} +14 -12
  1357. data/third_party/abseil-cpp/absl/memory/memory.h +1 -1
  1358. data/third_party/abseil-cpp/absl/meta/type_traits.h +32 -2
  1359. data/third_party/abseil-cpp/absl/numeric/int128.cc +3 -10
  1360. data/third_party/abseil-cpp/absl/numeric/int128.h +146 -73
  1361. data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +19 -25
  1362. data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +73 -70
  1363. data/third_party/abseil-cpp/absl/{base → profiling}/internal/exponential_biased.cc +4 -4
  1364. data/third_party/abseil-cpp/absl/{base → profiling}/internal/exponential_biased.h +6 -6
  1365. data/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +230 -0
  1366. data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +200 -0
  1367. data/third_party/abseil-cpp/absl/random/beta_distribution.h +427 -0
  1368. data/third_party/abseil-cpp/absl/random/discrete_distribution.cc +98 -0
  1369. data/third_party/abseil-cpp/absl/random/discrete_distribution.h +247 -0
  1370. data/third_party/abseil-cpp/absl/random/distributions.h +452 -0
  1371. data/third_party/abseil-cpp/absl/random/exponential_distribution.h +165 -0
  1372. data/third_party/abseil-cpp/absl/random/gaussian_distribution.cc +104 -0
  1373. data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +275 -0
  1374. data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +92 -0
  1375. data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +268 -0
  1376. data/third_party/abseil-cpp/absl/random/internal/fastmath.h +57 -0
  1377. data/third_party/abseil-cpp/absl/random/internal/generate_real.h +144 -0
  1378. data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +245 -0
  1379. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +150 -0
  1380. data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +308 -0
  1381. data/third_party/abseil-cpp/absl/random/internal/platform.h +171 -0
  1382. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +253 -0
  1383. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +131 -0
  1384. data/third_party/abseil-cpp/absl/random/internal/randen.cc +91 -0
  1385. data/third_party/abseil-cpp/absl/random/internal/randen.h +102 -0
  1386. data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +221 -0
  1387. data/third_party/abseil-cpp/absl/random/internal/randen_detect.h +33 -0
  1388. data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +239 -0
  1389. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +526 -0
  1390. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h +50 -0
  1391. data/third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc +462 -0
  1392. data/third_party/abseil-cpp/absl/random/internal/randen_slow.cc +471 -0
  1393. data/third_party/abseil-cpp/absl/random/internal/randen_slow.h +40 -0
  1394. data/third_party/abseil-cpp/absl/random/internal/randen_traits.h +88 -0
  1395. data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +167 -0
  1396. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +267 -0
  1397. data/third_party/abseil-cpp/absl/random/internal/seed_material.h +104 -0
  1398. data/third_party/abseil-cpp/absl/random/internal/traits.h +101 -0
  1399. data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +244 -0
  1400. data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +111 -0
  1401. data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +257 -0
  1402. data/third_party/abseil-cpp/absl/random/poisson_distribution.h +258 -0
  1403. data/third_party/abseil-cpp/absl/random/random.h +189 -0
  1404. data/third_party/abseil-cpp/absl/random/seed_gen_exception.cc +46 -0
  1405. data/third_party/abseil-cpp/absl/random/seed_gen_exception.h +55 -0
  1406. data/third_party/abseil-cpp/absl/random/seed_sequences.cc +29 -0
  1407. data/third_party/abseil-cpp/absl/random/seed_sequences.h +110 -0
  1408. data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +275 -0
  1409. data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +202 -0
  1410. data/third_party/abseil-cpp/absl/random/zipf_distribution.h +271 -0
  1411. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +5 -5
  1412. data/third_party/abseil-cpp/absl/status/status.cc +9 -17
  1413. data/third_party/abseil-cpp/absl/status/status.h +19 -15
  1414. data/third_party/abseil-cpp/absl/status/statusor.cc +34 -2
  1415. data/third_party/abseil-cpp/absl/status/statusor.h +31 -21
  1416. data/third_party/abseil-cpp/absl/strings/charconv.cc +3 -3
  1417. data/third_party/abseil-cpp/absl/strings/charconv.h +3 -2
  1418. data/third_party/abseil-cpp/absl/strings/cord.cc +453 -359
  1419. data/third_party/abseil-cpp/absl/strings/cord.h +197 -70
  1420. data/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +1 -1
  1421. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +6 -0
  1422. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +140 -63
  1423. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +1128 -0
  1424. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +939 -0
  1425. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +185 -0
  1426. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.h +265 -0
  1427. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.cc +68 -0
  1428. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_reader.h +211 -0
  1429. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc +129 -0
  1430. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.h +50 -0
  1431. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +7 -7
  1432. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.cc +55 -181
  1433. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +42 -24
  1434. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring_reader.h +4 -0
  1435. data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc +96 -0
  1436. data/third_party/abseil-cpp/absl/strings/internal/cordz_functions.h +85 -0
  1437. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc +139 -0
  1438. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +131 -0
  1439. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +445 -0
  1440. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +298 -0
  1441. data/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +87 -0
  1442. data/third_party/abseil-cpp/absl/strings/internal/cordz_update_scope.h +71 -0
  1443. data/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h +121 -0
  1444. data/third_party/abseil-cpp/absl/strings/internal/resize_uninitialized.h +48 -2
  1445. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +8 -0
  1446. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +3 -4
  1447. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +1 -1
  1448. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +6 -6
  1449. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +36 -18
  1450. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +62 -73
  1451. data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +24 -16
  1452. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +35 -35
  1453. data/third_party/abseil-cpp/absl/strings/numbers.cc +1 -1
  1454. data/third_party/abseil-cpp/absl/strings/numbers.h +34 -0
  1455. data/third_party/abseil-cpp/absl/strings/str_cat.cc +4 -4
  1456. data/third_party/abseil-cpp/absl/strings/str_format.h +1 -2
  1457. data/third_party/abseil-cpp/absl/strings/string_view.cc +16 -21
  1458. data/third_party/abseil-cpp/absl/strings/string_view.h +120 -39
  1459. data/third_party/abseil-cpp/absl/strings/substitute.cc +2 -1
  1460. data/third_party/abseil-cpp/absl/strings/substitute.h +99 -74
  1461. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.cc +25 -15
  1462. data/third_party/abseil-cpp/absl/synchronization/blocking_counter.h +5 -3
  1463. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +1 -1
  1464. data/third_party/abseil-cpp/absl/synchronization/mutex.h +3 -3
  1465. data/third_party/abseil-cpp/absl/time/civil_time.cc +1 -3
  1466. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +93 -20
  1467. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +1 -1
  1468. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +2 -1
  1469. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +83 -21
  1470. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +49 -0
  1471. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +1 -1
  1472. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +2 -3
  1473. data/third_party/abseil-cpp/absl/time/time.h +67 -36
  1474. data/third_party/abseil-cpp/absl/types/bad_optional_access.h +1 -1
  1475. data/third_party/abseil-cpp/absl/types/bad_variant_access.h +2 -2
  1476. data/third_party/abseil-cpp/absl/types/span.h +3 -3
  1477. data/third_party/address_sorting/address_sorting_posix.c +1 -0
  1478. data/third_party/boringssl-with-bazel/err_data.c +685 -673
  1479. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +67 -54
  1480. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +21 -22
  1481. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +0 -2
  1482. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +6 -1
  1483. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +16 -23
  1484. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +55 -37
  1485. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_print.c +19 -29
  1486. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/a_strex.c +269 -272
  1487. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +106 -153
  1488. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +4 -4
  1489. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
  1490. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +1 -40
  1491. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utf8.c +1 -1
  1492. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +59 -47
  1493. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.c +1 -1
  1494. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +24 -28
  1495. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/charmap.h +0 -0
  1496. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +5 -0
  1497. data/third_party/boringssl-with-bazel/src/crypto/asn1/{asn1_locl.h → internal.h} +86 -1
  1498. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +57 -281
  1499. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +291 -199
  1500. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +9 -9
  1501. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +10 -14
  1502. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +8 -6
  1503. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +2 -1
  1504. data/third_party/boringssl-with-bazel/src/crypto/asn1/time_support.c +1 -1
  1505. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +24 -8
  1506. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +1 -7
  1507. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +1 -5
  1508. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +0 -4
  1509. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +1 -7
  1510. data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +1 -6
  1511. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +3 -17
  1512. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +4 -6
  1513. data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +3 -1
  1514. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbb.c +9 -0
  1515. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +8 -0
  1516. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +38 -47
  1517. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +45 -65
  1518. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +14 -3
  1519. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +6 -3
  1520. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +21 -0
  1521. data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +2 -2
  1522. data/third_party/boringssl-with-bazel/src/crypto/evp/scrypt.c +32 -34
  1523. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +26 -9
  1524. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.c +3 -2
  1525. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +5 -2
  1526. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/sqrt.c +5 -9
  1527. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +12 -0
  1528. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +10 -0
  1529. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/des.c +10 -11
  1530. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/internal.h +1 -3
  1531. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +2 -0
  1532. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -2
  1533. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +4 -7
  1534. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +4 -7
  1535. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +1 -1
  1536. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +5 -9
  1537. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +2 -2
  1538. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +4 -6
  1539. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +24 -9
  1540. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +4 -2
  1541. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +7 -7
  1542. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +35 -35
  1543. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +11 -10
  1544. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +10 -37
  1545. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +36 -2
  1546. data/third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c +219 -121
  1547. data/third_party/boringssl-with-bazel/src/crypto/hrss/internal.h +9 -2
  1548. data/third_party/boringssl-with-bazel/src/crypto/internal.h +62 -2
  1549. data/third_party/boringssl-with-bazel/src/crypto/lhash/internal.h +253 -0
  1550. data/third_party/boringssl-with-bazel/src/crypto/lhash/lhash.c +28 -23
  1551. data/third_party/boringssl-with-bazel/src/crypto/mem.c +32 -9
  1552. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +7 -3
  1553. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +0 -9
  1554. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_info.c +0 -2
  1555. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +0 -8
  1556. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +0 -2
  1557. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +0 -4
  1558. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +16 -7
  1559. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +38 -4
  1560. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +151 -12
  1561. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +0 -1
  1562. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +1 -1
  1563. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +2 -2
  1564. data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +1 -1
  1565. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +5 -1
  1566. data/third_party/boringssl-with-bazel/src/crypto/pool/pool.c +59 -22
  1567. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +4 -0
  1568. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/fuchsia.c +4 -0
  1569. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +4 -0
  1570. data/third_party/boringssl-with-bazel/src/crypto/siphash/siphash.c +6 -6
  1571. data/third_party/boringssl-with-bazel/src/crypto/x509/a_verify.c +15 -11
  1572. data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +1 -1
  1573. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +2 -18
  1574. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +1 -0
  1575. data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +2 -0
  1576. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +233 -4
  1577. data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +246 -0
  1578. data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +15 -4
  1579. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +10 -5
  1580. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +0 -179
  1581. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +4 -2
  1582. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +6 -23
  1583. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +2 -2
  1584. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +1 -5
  1585. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -0
  1586. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +25 -22
  1587. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +11 -54
  1588. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +1 -1
  1589. data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +1 -0
  1590. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +2 -4
  1591. data/third_party/boringssl-with-bazel/src/crypto/x509/x_algor.c +1 -3
  1592. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +0 -16
  1593. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +9 -11
  1594. data/third_party/boringssl-with-bazel/src/crypto/x509/x_exten.c +2 -0
  1595. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +23 -21
  1596. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +12 -11
  1597. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +232 -11
  1598. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +2 -1
  1599. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +2 -2
  1600. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_lib.c +1 -1
  1601. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_map.c +2 -1
  1602. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_node.c +1 -1
  1603. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +5 -4
  1604. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +24 -5
  1605. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +18 -8
  1606. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -0
  1607. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +1 -0
  1608. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +6 -7
  1609. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_crld.c +4 -2
  1610. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +5 -0
  1611. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +23 -4
  1612. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ncons.c +112 -55
  1613. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pci.c +2 -1
  1614. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -13
  1615. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -1
  1616. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +76 -31
  1617. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +1504 -561
  1618. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +5 -12
  1619. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +10 -6
  1620. data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +8 -0
  1621. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +3 -1
  1622. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +3 -3
  1623. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +9 -0
  1624. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +21 -3
  1625. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +8 -5
  1626. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -12
  1627. data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +3 -0
  1628. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +27 -41
  1629. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +12 -27
  1630. data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +8 -10
  1631. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +35 -55
  1632. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +4 -0
  1633. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +26 -1
  1634. data/third_party/boringssl-with-bazel/src/include/openssl/hrss.h +14 -12
  1635. data/third_party/boringssl-with-bazel/src/include/openssl/lhash.h +4 -205
  1636. data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +12 -3
  1637. data/third_party/boringssl-with-bazel/src/include/openssl/obj.h +5 -4
  1638. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -20
  1639. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +24 -18
  1640. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +6 -1
  1641. data/third_party/boringssl-with-bazel/src/include/openssl/pool.h +7 -1
  1642. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +29 -28
  1643. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +37 -15
  1644. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +110 -26
  1645. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +31 -32
  1646. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +725 -189
  1647. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +16 -695
  1648. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +52 -16
  1649. data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +9 -16
  1650. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +310 -359
  1651. data/third_party/boringssl-with-bazel/src/ssl/{t1_lib.cc → extensions.cc} +110 -159
  1652. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +24 -13
  1653. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +145 -142
  1654. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +106 -99
  1655. data/third_party/boringssl-with-bazel/src/ssl/internal.h +90 -51
  1656. data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +1 -2
  1657. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
  1658. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +11 -5
  1659. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +6 -51
  1660. data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +121 -65
  1661. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +6 -12
  1662. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +4 -0
  1663. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +28 -23
  1664. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +14 -27
  1665. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +210 -212
  1666. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +30 -41
  1667. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +48 -34
  1668. data/third_party/cares/cares/{ares.h → include/ares.h} +73 -1
  1669. data/third_party/cares/cares/{ares_dns.h → include/ares_dns.h} +9 -0
  1670. data/third_party/cares/cares/{ares_rules.h → include/ares_rules.h} +0 -0
  1671. data/third_party/cares/cares/{ares_version.h → include/ares_version.h} +3 -3
  1672. data/third_party/cares/cares/{ares__close_sockets.c → src/lib/ares__close_sockets.c} +2 -2
  1673. data/third_party/cares/cares/{ares__get_hostent.c → src/lib/ares__get_hostent.c} +1 -2
  1674. data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +260 -0
  1675. data/third_party/cares/cares/{ares__read_line.c → src/lib/ares__read_line.c} +0 -0
  1676. data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +264 -0
  1677. data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +499 -0
  1678. data/third_party/cares/cares/{ares__timeval.c → src/lib/ares__timeval.c} +0 -0
  1679. data/third_party/cares/cares/src/lib/ares_android.c +444 -0
  1680. data/third_party/cares/cares/src/lib/ares_android.h +27 -0
  1681. data/third_party/cares/cares/{ares_cancel.c → src/lib/ares_cancel.c} +0 -0
  1682. data/third_party/cares/cares/{ares_create_query.c → src/lib/ares_create_query.c} +8 -17
  1683. data/third_party/cares/cares/{ares_data.c → src/lib/ares_data.c} +18 -0
  1684. data/third_party/cares/cares/{ares_data.h → src/lib/ares_data.h} +2 -0
  1685. data/third_party/cares/cares/{ares_destroy.c → src/lib/ares_destroy.c} +0 -0
  1686. data/third_party/cares/cares/{ares_expand_name.c → src/lib/ares_expand_name.c} +114 -23
  1687. data/third_party/cares/cares/{ares_expand_string.c → src/lib/ares_expand_string.c} +2 -5
  1688. data/third_party/cares/cares/{ares_fds.c → src/lib/ares_fds.c} +0 -0
  1689. data/third_party/cares/cares/{ares_free_hostent.c → src/lib/ares_free_hostent.c} +6 -4
  1690. data/third_party/cares/cares/{ares_free_string.c → src/lib/ares_free_string.c} +0 -0
  1691. data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +59 -0
  1692. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +772 -0
  1693. data/third_party/cares/cares/{ares_getenv.c → src/lib/ares_getenv.c} +0 -2
  1694. data/third_party/cares/cares/{ares_getenv.h → src/lib/ares_getenv.h} +0 -0
  1695. data/third_party/cares/cares/{ares_gethostbyaddr.c → src/lib/ares_gethostbyaddr.c} +2 -9
  1696. data/third_party/cares/cares/{ares_gethostbyname.c → src/lib/ares_gethostbyname.c} +25 -20
  1697. data/third_party/cares/cares/{ares_getnameinfo.c → src/lib/ares_getnameinfo.c} +4 -10
  1698. data/third_party/cares/cares/{ares_getsock.c → src/lib/ares_getsock.c} +0 -0
  1699. data/third_party/cares/cares/{ares_inet_net_pton.h → src/lib/ares_inet_net_pton.h} +0 -0
  1700. data/third_party/cares/cares/{ares_init.c → src/lib/ares_init.c} +79 -40
  1701. data/third_party/cares/cares/{ares_iphlpapi.h → src/lib/ares_iphlpapi.h} +0 -0
  1702. data/third_party/cares/cares/{ares_ipv6.h → src/lib/ares_ipv6.h} +7 -0
  1703. data/third_party/cares/cares/{ares_library_init.c → src/lib/ares_library_init.c} +7 -2
  1704. data/third_party/cares/cares/{ares_library_init.h → src/lib/ares_library_init.h} +1 -1
  1705. data/third_party/cares/cares/{ares_llist.c → src/lib/ares_llist.c} +0 -0
  1706. data/third_party/cares/cares/{ares_llist.h → src/lib/ares_llist.h} +0 -0
  1707. data/third_party/cares/cares/{ares_mkquery.c → src/lib/ares_mkquery.c} +0 -0
  1708. data/third_party/cares/cares/src/lib/ares_nameser.h +482 -0
  1709. data/third_party/cares/cares/{ares_nowarn.c → src/lib/ares_nowarn.c} +0 -0
  1710. data/third_party/cares/cares/{ares_nowarn.h → src/lib/ares_nowarn.h} +0 -0
  1711. data/third_party/cares/cares/{ares_options.c → src/lib/ares_options.c} +0 -0
  1712. data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +209 -0
  1713. data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +212 -0
  1714. data/third_party/cares/cares/src/lib/ares_parse_caa_reply.c +199 -0
  1715. data/third_party/cares/cares/{ares_parse_mx_reply.c → src/lib/ares_parse_mx_reply.c} +2 -8
  1716. data/third_party/cares/cares/{ares_parse_naptr_reply.c → src/lib/ares_parse_naptr_reply.c} +2 -13
  1717. data/third_party/cares/cares/{ares_parse_ns_reply.c → src/lib/ares_parse_ns_reply.c} +5 -11
  1718. data/third_party/cares/cares/{ares_parse_ptr_reply.c → src/lib/ares_parse_ptr_reply.c} +53 -46
  1719. data/third_party/cares/cares/src/lib/ares_parse_soa_reply.c +179 -0
  1720. data/third_party/cares/cares/{ares_parse_srv_reply.c → src/lib/ares_parse_srv_reply.c} +2 -13
  1721. data/third_party/cares/cares/{ares_parse_txt_reply.c → src/lib/ares_parse_txt_reply.c} +3 -9
  1722. data/third_party/cares/cares/{ares_platform.c → src/lib/ares_platform.c} +0 -0
  1723. data/third_party/cares/cares/{ares_platform.h → src/lib/ares_platform.h} +0 -0
  1724. data/third_party/cares/cares/{ares_private.h → src/lib/ares_private.h} +52 -11
  1725. data/third_party/cares/cares/{ares_process.c → src/lib/ares_process.c} +127 -52
  1726. data/third_party/cares/cares/{ares_query.c → src/lib/ares_query.c} +3 -9
  1727. data/third_party/cares/cares/{ares_search.c → src/lib/ares_search.c} +5 -7
  1728. data/third_party/cares/cares/{ares_send.c → src/lib/ares_send.c} +2 -8
  1729. data/third_party/cares/cares/{ares_setup.h → src/lib/ares_setup.h} +4 -1
  1730. data/third_party/cares/cares/{ares_strcasecmp.c → src/lib/ares_strcasecmp.c} +0 -0
  1731. data/third_party/cares/cares/{ares_strcasecmp.h → src/lib/ares_strcasecmp.h} +0 -0
  1732. data/third_party/cares/cares/{ares_strdup.c → src/lib/ares_strdup.c} +0 -0
  1733. data/third_party/cares/cares/{ares_strdup.h → src/lib/ares_strdup.h} +0 -0
  1734. data/third_party/cares/cares/{ares_strerror.c → src/lib/ares_strerror.c} +0 -0
  1735. data/third_party/cares/cares/{ares_strsplit.c → src/lib/ares_strsplit.c} +4 -0
  1736. data/third_party/cares/cares/{ares_strsplit.h → src/lib/ares_strsplit.h} +0 -0
  1737. data/third_party/cares/cares/{ares_timeout.c → src/lib/ares_timeout.c} +0 -0
  1738. data/third_party/cares/cares/{ares_version.c → src/lib/ares_version.c} +0 -0
  1739. data/third_party/cares/cares/{ares_writev.c → src/lib/ares_writev.c} +0 -0
  1740. data/third_party/cares/cares/src/lib/ares_writev.h +36 -0
  1741. data/third_party/cares/cares/{bitncmp.c → src/lib/bitncmp.c} +0 -0
  1742. data/third_party/cares/cares/{bitncmp.h → src/lib/bitncmp.h} +0 -0
  1743. data/third_party/cares/cares/src/lib/config-dos.h +115 -0
  1744. data/third_party/cares/cares/{config-win32.h → src/lib/config-win32.h} +0 -0
  1745. data/third_party/cares/cares/{inet_net_pton.c → src/lib/inet_net_pton.c} +2 -8
  1746. data/third_party/cares/cares/{inet_ntop.c → src/lib/inet_ntop.c} +2 -8
  1747. data/third_party/cares/cares/{setup_once.h → src/lib/setup_once.h} +0 -0
  1748. data/third_party/cares/cares/{windows_port.c → src/lib/windows_port.c} +0 -0
  1749. data/third_party/re2/re2/compile.cc +91 -109
  1750. data/third_party/re2/re2/dfa.cc +27 -39
  1751. data/third_party/re2/re2/filtered_re2.cc +18 -2
  1752. data/third_party/re2/re2/filtered_re2.h +10 -5
  1753. data/third_party/re2/re2/nfa.cc +1 -1
  1754. data/third_party/re2/re2/parse.cc +42 -23
  1755. data/third_party/re2/re2/perl_groups.cc +34 -34
  1756. data/third_party/re2/re2/prefilter.cc +3 -2
  1757. data/third_party/re2/re2/prog.cc +182 -4
  1758. data/third_party/re2/re2/prog.h +28 -9
  1759. data/third_party/re2/re2/re2.cc +87 -118
  1760. data/third_party/re2/re2/re2.h +156 -141
  1761. data/third_party/re2/re2/regexp.cc +12 -5
  1762. data/third_party/re2/re2/regexp.h +8 -2
  1763. data/third_party/re2/re2/set.cc +31 -9
  1764. data/third_party/re2/re2/set.h +9 -4
  1765. data/third_party/re2/re2/simplify.cc +11 -3
  1766. data/third_party/re2/re2/tostring.cc +1 -1
  1767. data/third_party/re2/re2/walker-inl.h +1 -1
  1768. data/third_party/re2/util/mutex.h +2 -2
  1769. data/third_party/re2/util/pcre.h +3 -3
  1770. data/third_party/upb/third_party/utf8_range/naive.c +92 -0
  1771. data/third_party/upb/third_party/utf8_range/range2-neon.c +157 -0
  1772. data/third_party/upb/third_party/utf8_range/range2-sse.c +170 -0
  1773. data/third_party/upb/third_party/utf8_range/utf8_range.h +9 -0
  1774. data/third_party/upb/upb/decode.c +774 -351
  1775. data/third_party/upb/upb/decode.h +66 -12
  1776. data/third_party/upb/upb/decode_fast.c +596 -581
  1777. data/third_party/upb/upb/decode_fast.h +40 -13
  1778. data/third_party/upb/upb/decode_internal.h +211 -0
  1779. data/third_party/upb/upb/def.c +2151 -1068
  1780. data/third_party/upb/upb/def.h +352 -258
  1781. data/third_party/upb/upb/def.hpp +160 -161
  1782. data/third_party/upb/upb/encode.c +291 -165
  1783. data/third_party/upb/upb/encode.h +38 -13
  1784. data/third_party/upb/upb/json_encode.c +776 -0
  1785. data/third_party/upb/upb/json_encode.h +62 -0
  1786. data/third_party/upb/upb/msg.c +274 -102
  1787. data/third_party/upb/upb/msg.h +83 -582
  1788. data/third_party/upb/upb/msg_internal.h +831 -0
  1789. data/third_party/upb/upb/port_def.inc +93 -24
  1790. data/third_party/upb/upb/port_undef.inc +39 -1
  1791. data/third_party/upb/upb/reflection.c +312 -240
  1792. data/third_party/upb/upb/reflection.h +119 -67
  1793. data/third_party/upb/upb/reflection.hpp +37 -0
  1794. data/third_party/upb/upb/table.c +406 -197
  1795. data/third_party/upb/upb/table_internal.h +385 -0
  1796. data/third_party/upb/upb/text_encode.c +141 -90
  1797. data/third_party/upb/upb/text_encode.h +31 -5
  1798. data/third_party/upb/upb/upb.c +164 -66
  1799. data/third_party/upb/upb/upb.h +182 -146
  1800. data/third_party/upb/upb/upb.hpp +50 -23
  1801. data/third_party/upb/upb/upb_internal.h +68 -0
  1802. data/third_party/xxhash/xxhash.h +607 -352
  1803. data/third_party/zlib/crc32.c +966 -292
  1804. data/third_party/zlib/crc32.h +9441 -436
  1805. data/third_party/zlib/deflate.c +78 -30
  1806. data/third_party/zlib/deflate.h +12 -15
  1807. data/third_party/zlib/gzguts.h +3 -2
  1808. data/third_party/zlib/gzlib.c +5 -3
  1809. data/third_party/zlib/gzread.c +5 -7
  1810. data/third_party/zlib/gzwrite.c +25 -13
  1811. data/third_party/zlib/infback.c +2 -1
  1812. data/third_party/zlib/inffast.c +14 -14
  1813. data/third_party/zlib/inflate.c +39 -8
  1814. data/third_party/zlib/inflate.h +3 -2
  1815. data/third_party/zlib/inftrees.c +3 -3
  1816. data/third_party/zlib/trees.c +27 -48
  1817. data/third_party/zlib/zlib.h +123 -100
  1818. data/third_party/zlib/zutil.c +2 -2
  1819. data/third_party/zlib/zutil.h +12 -9
  1820. metadata +559 -260
  1821. data/include/grpc/event_engine/slice_allocator.h +0 -66
  1822. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +0 -44
  1823. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +0 -84
  1824. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +0 -179
  1825. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +0 -38
  1826. data/src/core/ext/filters/client_channel/resolver_registry.cc +0 -197
  1827. data/src/core/ext/filters/client_channel/resolver_registry.h +0 -89
  1828. data/src/core/ext/filters/client_channel/service_config_call_data.h +0 -126
  1829. data/src/core/ext/filters/client_idle/client_idle_filter.cc +0 -441
  1830. data/src/core/ext/filters/max_age/max_age_filter.cc +0 -562
  1831. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +0 -211
  1832. data/src/core/ext/filters/workarounds/workaround_utils.cc +0 -53
  1833. data/src/core/ext/filters/workarounds/workaround_utils.h +0 -39
  1834. data/src/core/ext/transport/chttp2/client/authority.cc +0 -42
  1835. data/src/core/ext/transport/chttp2/client/authority.h +0 -36
  1836. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +0 -125
  1837. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +0 -91
  1838. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +0 -213
  1839. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +0 -54
  1840. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +0 -77
  1841. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +0 -129
  1842. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +0 -37
  1843. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.cc +0 -66
  1844. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +0 -74
  1845. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +0 -243
  1846. data/src/core/ext/transport/chttp2/transport/hpack_table.h +0 -148
  1847. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +0 -66
  1848. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +0 -58
  1849. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +0 -27
  1850. data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +0 -56
  1851. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +0 -27
  1852. data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +0 -56
  1853. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +0 -27
  1854. data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +0 -56
  1855. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +0 -27
  1856. data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +0 -56
  1857. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +0 -27
  1858. data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +0 -56
  1859. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +0 -58
  1860. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +0 -124
  1861. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +0 -33
  1862. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +0 -77
  1863. data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.c +0 -72
  1864. data/src/core/ext/upbdefs-generated/envoy/service/cluster/v3/cds.upbdefs.h +0 -35
  1865. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +0 -73
  1866. data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.h +0 -35
  1867. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +0 -72
  1868. data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.h +0 -35
  1869. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +0 -80
  1870. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.h +0 -35
  1871. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.c +0 -74
  1872. data/src/core/ext/upbdefs-generated/envoy/service/route/v3/srds.upbdefs.h +0 -35
  1873. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +0 -44
  1874. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +0 -35
  1875. data/src/core/lib/avl/avl.cc +0 -306
  1876. data/src/core/lib/compression/algorithm_metadata.h +0 -61
  1877. data/src/core/lib/compression/compression_args.cc +0 -135
  1878. data/src/core/lib/compression/compression_args.h +0 -56
  1879. data/src/core/lib/compression/stream_compression.cc +0 -80
  1880. data/src/core/lib/compression/stream_compression.h +0 -116
  1881. data/src/core/lib/compression/stream_compression_gzip.cc +0 -230
  1882. data/src/core/lib/compression/stream_compression_gzip.h +0 -28
  1883. data/src/core/lib/compression/stream_compression_identity.cc +0 -90
  1884. data/src/core/lib/compression/stream_compression_identity.h +0 -29
  1885. data/src/core/lib/gpr/tls_gcc.h +0 -52
  1886. data/src/core/lib/gpr/tls_msvc.h +0 -54
  1887. data/src/core/lib/gpr/tls_pthread.cc +0 -30
  1888. data/src/core/lib/gpr/tls_pthread.h +0 -56
  1889. data/src/core/lib/gpr/tls_stdcpp.h +0 -48
  1890. data/src/core/lib/gprpp/atomic.h +0 -104
  1891. data/src/core/lib/iomgr/endpoint_pair_uv.cc +0 -40
  1892. data/src/core/lib/iomgr/ev_epollex_linux.cc +0 -1661
  1893. data/src/core/lib/iomgr/ev_epollex_linux.h +0 -30
  1894. data/src/core/lib/iomgr/iomgr_custom.cc +0 -79
  1895. data/src/core/lib/iomgr/iomgr_custom.h +0 -49
  1896. data/src/core/lib/iomgr/iomgr_uv.cc +0 -43
  1897. data/src/core/lib/iomgr/is_epollexclusive_available.cc +0 -119
  1898. data/src/core/lib/iomgr/pollset_custom.cc +0 -106
  1899. data/src/core/lib/iomgr/pollset_custom.h +0 -37
  1900. data/src/core/lib/iomgr/pollset_set_custom.cc +0 -48
  1901. data/src/core/lib/iomgr/pollset_set_custom.h +0 -26
  1902. data/src/core/lib/iomgr/pollset_uv.cc +0 -95
  1903. data/src/core/lib/iomgr/pollset_uv.h +0 -36
  1904. data/src/core/lib/iomgr/resolve_address_custom.cc +0 -169
  1905. data/src/core/lib/iomgr/resolve_address_custom.h +0 -45
  1906. data/src/core/lib/iomgr/resource_quota.cc +0 -1019
  1907. data/src/core/lib/iomgr/resource_quota.h +0 -177
  1908. data/src/core/lib/iomgr/sockaddr_custom.h +0 -54
  1909. data/src/core/lib/iomgr/sys_epoll_wrapper.h +0 -30
  1910. data/src/core/lib/iomgr/tcp_client_custom.cc +0 -160
  1911. data/src/core/lib/iomgr/tcp_custom.cc +0 -389
  1912. data/src/core/lib/iomgr/tcp_custom.h +0 -85
  1913. data/src/core/lib/iomgr/tcp_server_custom.cc +0 -484
  1914. data/src/core/lib/iomgr/tcp_uv.cc +0 -421
  1915. data/src/core/lib/iomgr/timer_custom.cc +0 -96
  1916. data/src/core/lib/iomgr/timer_custom.h +0 -43
  1917. data/src/core/lib/iomgr/timer_uv.cc +0 -66
  1918. data/src/core/lib/iomgr/udp_server.cc +0 -748
  1919. data/src/core/lib/iomgr/udp_server.h +0 -103
  1920. data/src/core/lib/security/credentials/credentials_metadata.cc +0 -62
  1921. data/src/core/lib/slice/slice_intern.cc +0 -373
  1922. data/src/core/lib/slice/slice_utils.h +0 -200
  1923. data/src/core/lib/surface/init_secure.cc +0 -81
  1924. data/src/core/lib/transport/metadata.cc +0 -693
  1925. data/src/core/lib/transport/metadata.h +0 -446
  1926. data/src/core/lib/transport/metadata_batch.cc +0 -430
  1927. data/src/core/lib/transport/static_metadata.cc +0 -1249
  1928. data/src/core/lib/transport/static_metadata.h +0 -604
  1929. data/src/core/lib/transport/status_metadata.cc +0 -62
  1930. data/src/core/lib/transport/status_metadata.h +0 -48
  1931. data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +0 -93
  1932. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_int.h +0 -217
  1933. data/third_party/cares/cares/ares_getopt.c +0 -122
  1934. data/third_party/cares/cares/ares_getopt.h +0 -53
  1935. data/third_party/cares/cares/ares_parse_a_reply.c +0 -264
  1936. data/third_party/cares/cares/ares_parse_aaaa_reply.c +0 -264
  1937. data/third_party/cares/cares/ares_parse_soa_reply.c +0 -133
  1938. data/third_party/upb/third_party/wyhash/wyhash.h +0 -145
  1939. data/third_party/upb/upb/decode.int.h +0 -163
  1940. data/third_party/upb/upb/table.int.h +0 -475
  1941. data/third_party/upb/upb/upb.int.h +0 -29
@@ -1,86 +1,42 @@
1
- /*
2
- *
3
- * Copyright 2018 gRPC authors.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- *
17
- */
1
+ //
2
+ // Copyright 2018 gRPC authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
18
16
 
19
17
  #include <grpc/support/port_platform.h>
20
18
 
21
- #include <algorithm>
22
- #include <cctype>
23
- #include <cstdint>
24
- #include <cstdlib>
19
+ #include "src/core/ext/xds/xds_api.h"
20
+
21
+ #include <set>
25
22
  #include <string>
23
+ #include <vector>
26
24
 
27
25
  #include "absl/strings/str_cat.h"
28
- #include "absl/strings/str_format.h"
29
- #include "absl/strings/str_join.h"
30
- #include "absl/strings/str_split.h"
31
26
  #include "envoy/admin/v3/config_dump.upb.h"
32
- #include "envoy/config/cluster/v3/circuit_breaker.upb.h"
33
- #include "envoy/config/cluster/v3/cluster.upb.h"
34
- #include "envoy/config/cluster/v3/cluster.upbdefs.h"
35
- #include "envoy/config/core/v3/address.upb.h"
36
27
  #include "envoy/config/core/v3/base.upb.h"
37
- #include "envoy/config/core/v3/base.upbdefs.h"
38
- #include "envoy/config/core/v3/config_source.upb.h"
39
- #include "envoy/config/core/v3/health_check.upb.h"
40
- #include "envoy/config/core/v3/protocol.upb.h"
41
- #include "envoy/config/endpoint/v3/endpoint.upb.h"
42
- #include "envoy/config/endpoint/v3/endpoint.upbdefs.h"
43
- #include "envoy/config/endpoint/v3/endpoint_components.upb.h"
44
28
  #include "envoy/config/endpoint/v3/load_report.upb.h"
45
- #include "envoy/config/listener/v3/api_listener.upb.h"
46
- #include "envoy/config/listener/v3/listener.upb.h"
47
- #include "envoy/config/listener/v3/listener.upbdefs.h"
48
- #include "envoy/config/listener/v3/listener_components.upb.h"
49
- #include "envoy/config/route/v3/route.upb.h"
50
- #include "envoy/config/route/v3/route.upbdefs.h"
51
- #include "envoy/config/route/v3/route_components.upb.h"
52
- #include "envoy/config/route/v3/route_components.upbdefs.h"
53
- #include "envoy/extensions/clusters/aggregate/v3/cluster.upb.h"
54
- #include "envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h"
55
- #include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h"
56
- #include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h"
57
- #include "envoy/extensions/transport_sockets/tls/v3/common.upb.h"
58
- #include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h"
59
- #include "envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.h"
60
- #include "envoy/service/cluster/v3/cds.upb.h"
61
- #include "envoy/service/cluster/v3/cds.upbdefs.h"
62
29
  #include "envoy/service/discovery/v3/discovery.upb.h"
63
30
  #include "envoy/service/discovery/v3/discovery.upbdefs.h"
64
- #include "envoy/service/endpoint/v3/eds.upb.h"
65
- #include "envoy/service/endpoint/v3/eds.upbdefs.h"
66
- #include "envoy/service/listener/v3/lds.upb.h"
67
31
  #include "envoy/service/load_stats/v3/lrs.upb.h"
68
32
  #include "envoy/service/load_stats/v3/lrs.upbdefs.h"
69
- #include "envoy/service/route/v3/rds.upb.h"
70
- #include "envoy/service/route/v3/rds.upbdefs.h"
71
33
  #include "envoy/service/status/v3/csds.upb.h"
72
34
  #include "envoy/service/status/v3/csds.upbdefs.h"
73
- #include "envoy/type/matcher/v3/regex.upb.h"
74
- #include "envoy/type/matcher/v3/string.upb.h"
75
- #include "envoy/type/v3/percent.upb.h"
76
- #include "envoy/type/v3/range.upb.h"
77
35
  #include "google/protobuf/any.upb.h"
78
- #include "google/protobuf/duration.upb.h"
79
36
  #include "google/protobuf/struct.upb.h"
80
37
  #include "google/protobuf/timestamp.upb.h"
81
38
  #include "google/protobuf/wrappers.upb.h"
82
39
  #include "google/rpc/status.upb.h"
83
- #include "udpa/type/v1/typed_struct.upb.h"
84
40
  #include "upb/text_encode.h"
85
41
  #include "upb/upb.h"
86
42
  #include "upb/upb.hpp"
@@ -89,778 +45,23 @@
89
45
  #include <grpc/support/alloc.h>
90
46
  #include <grpc/support/string_util.h>
91
47
 
92
- #include "src/core/ext/xds/xds_api.h"
48
+ #include "src/core/ext/xds/upb_utils.h"
49
+ #include "src/core/ext/xds/xds_common_types.h"
50
+ #include "src/core/ext/xds/xds_resource_type.h"
51
+ #include "src/core/ext/xds/xds_routing.h"
52
+ #include "src/core/lib/address_utils/parse_address.h"
93
53
  #include "src/core/lib/address_utils/sockaddr_utils.h"
94
54
  #include "src/core/lib/gpr/env.h"
95
55
  #include "src/core/lib/gpr/string.h"
96
- #include "src/core/lib/gpr/useful.h"
97
56
  #include "src/core/lib/gprpp/host_port.h"
98
57
  #include "src/core/lib/iomgr/error.h"
99
58
  #include "src/core/lib/iomgr/sockaddr.h"
100
59
  #include "src/core/lib/iomgr/socket_utils.h"
101
- #include "src/core/lib/slice/slice_utils.h"
60
+ #include "src/core/lib/slice/slice_internal.h"
61
+ #include "src/core/lib/uri/uri_parser.h"
102
62
 
103
63
  namespace grpc_core {
104
64
 
105
- // TODO(donnadionne): Check to see if cluster types aggregate_cluster and
106
- // logical_dns are enabled, this will be
107
- // removed once the cluster types are fully integration-tested and enabled by
108
- // default.
109
- bool XdsAggregateAndLogicalDnsClusterEnabled() {
110
- char* value = gpr_getenv(
111
- "GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER");
112
- bool parsed_value;
113
- bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
114
- gpr_free(value);
115
- return parse_succeeded && parsed_value;
116
- }
117
-
118
- // TODO(yashykt): Check to see if xDS security is enabled. This will be
119
- // removed once this feature is fully integration-tested and enabled by
120
- // default.
121
- bool XdsSecurityEnabled() {
122
- char* value = gpr_getenv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT");
123
- bool parsed_value;
124
- bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
125
- gpr_free(value);
126
- return parse_succeeded && parsed_value;
127
- }
128
-
129
- //
130
- // XdsApi::Route::HashPolicy
131
- //
132
-
133
- XdsApi::Route::HashPolicy::HashPolicy(const HashPolicy& other)
134
- : type(other.type),
135
- header_name(other.header_name),
136
- regex_substitution(other.regex_substitution) {
137
- if (other.regex != nullptr) {
138
- regex =
139
- absl::make_unique<RE2>(other.regex->pattern(), other.regex->options());
140
- }
141
- }
142
-
143
- XdsApi::Route::HashPolicy& XdsApi::Route::HashPolicy::operator=(
144
- const HashPolicy& other) {
145
- type = other.type;
146
- header_name = other.header_name;
147
- if (other.regex != nullptr) {
148
- regex =
149
- absl::make_unique<RE2>(other.regex->pattern(), other.regex->options());
150
- }
151
- regex_substitution = other.regex_substitution;
152
- return *this;
153
- }
154
-
155
- XdsApi::Route::HashPolicy::HashPolicy(HashPolicy&& other) noexcept
156
- : type(other.type),
157
- header_name(std::move(other.header_name)),
158
- regex(std::move(other.regex)),
159
- regex_substitution(std::move(other.regex_substitution)) {}
160
-
161
- XdsApi::Route::HashPolicy& XdsApi::Route::HashPolicy::operator=(
162
- HashPolicy&& other) noexcept {
163
- type = other.type;
164
- header_name = std::move(other.header_name);
165
- regex = std::move(other.regex);
166
- regex_substitution = std::move(other.regex_substitution);
167
- return *this;
168
- }
169
-
170
- bool XdsApi::Route::HashPolicy::HashPolicy::operator==(
171
- const HashPolicy& other) const {
172
- if (type != other.type) return false;
173
- if (type == Type::HEADER) {
174
- if (regex == nullptr) {
175
- if (other.regex != nullptr) return false;
176
- } else {
177
- if (other.regex == nullptr) return false;
178
- return header_name == other.header_name &&
179
- regex->pattern() == other.regex->pattern() &&
180
- regex_substitution == other.regex_substitution;
181
- }
182
- }
183
- return true;
184
- }
185
-
186
- std::string XdsApi::Route::HashPolicy::ToString() const {
187
- std::vector<std::string> contents;
188
- switch (type) {
189
- case Type::HEADER:
190
- contents.push_back("type=HEADER");
191
- break;
192
- case Type::CHANNEL_ID:
193
- contents.push_back("type=CHANNEL_ID");
194
- break;
195
- }
196
- contents.push_back(
197
- absl::StrFormat("terminal=%s", terminal ? "true" : "false"));
198
- if (type == Type::HEADER) {
199
- contents.push_back(absl::StrFormat(
200
- "Header %s:/%s/%s", header_name,
201
- (regex == nullptr) ? "" : regex->pattern(), regex_substitution));
202
- }
203
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
204
- }
205
-
206
- //
207
- // XdsApi::Route::RetryPolicy
208
- //
209
- std::string XdsApi::Route::RetryPolicy::RetryBackOff::ToString() const {
210
- std::vector<std::string> contents;
211
- contents.push_back(
212
- absl::StrCat("RetryBackOff Base: ", base_interval.ToString()));
213
- contents.push_back(
214
- absl::StrCat("RetryBackOff max: ", max_interval.ToString()));
215
- return absl::StrJoin(contents, ",");
216
- }
217
-
218
- std::string XdsApi::Route::RetryPolicy::ToString() const {
219
- std::vector<std::string> contents;
220
- contents.push_back(absl::StrFormat("num_retries=%d", num_retries));
221
- contents.push_back(retry_back_off.ToString());
222
- return absl::StrJoin(contents, ",");
223
- }
224
-
225
- //
226
- // XdsApi::Route
227
- //
228
-
229
- std::string XdsApi::Route::Matchers::ToString() const {
230
- std::vector<std::string> contents;
231
- contents.push_back(
232
- absl::StrFormat("PathMatcher{%s}", path_matcher.ToString()));
233
- for (const HeaderMatcher& header_matcher : header_matchers) {
234
- contents.push_back(header_matcher.ToString());
235
- }
236
- if (fraction_per_million.has_value()) {
237
- contents.push_back(absl::StrFormat("Fraction Per Million %d",
238
- fraction_per_million.value()));
239
- }
240
- return absl::StrJoin(contents, "\n");
241
- }
242
-
243
- std::string XdsApi::Route::ClusterWeight::ToString() const {
244
- std::vector<std::string> contents;
245
- contents.push_back(absl::StrCat("cluster=", name));
246
- contents.push_back(absl::StrCat("weight=", weight));
247
- if (!typed_per_filter_config.empty()) {
248
- std::vector<std::string> parts;
249
- for (const auto& p : typed_per_filter_config) {
250
- const std::string& key = p.first;
251
- const auto& config = p.second;
252
- parts.push_back(absl::StrCat(key, "=", config.ToString()));
253
- }
254
- contents.push_back(absl::StrCat("typed_per_filter_config={",
255
- absl::StrJoin(parts, ", "), "}"));
256
- }
257
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
258
- }
259
-
260
- std::string XdsApi::Route::ToString() const {
261
- std::vector<std::string> contents;
262
- contents.push_back(matchers.ToString());
263
- for (const HashPolicy& hash_policy : hash_policies) {
264
- contents.push_back(absl::StrCat("hash_policy=", hash_policy.ToString()));
265
- }
266
- if (retry_policy.has_value()) {
267
- contents.push_back(
268
- absl::StrCat("retry_policy={", retry_policy->ToString(), "}"));
269
- }
270
- if (!cluster_name.empty()) {
271
- contents.push_back(absl::StrFormat("Cluster name: %s", cluster_name));
272
- }
273
- for (const ClusterWeight& cluster_weight : weighted_clusters) {
274
- contents.push_back(cluster_weight.ToString());
275
- }
276
- if (max_stream_duration.has_value()) {
277
- contents.push_back(max_stream_duration->ToString());
278
- }
279
- if (!typed_per_filter_config.empty()) {
280
- contents.push_back("typed_per_filter_config={");
281
- for (const auto& p : typed_per_filter_config) {
282
- const std::string& name = p.first;
283
- const auto& config = p.second;
284
- contents.push_back(absl::StrCat(" ", name, "=", config.ToString()));
285
- }
286
- contents.push_back("}");
287
- }
288
- return absl::StrJoin(contents, "\n");
289
- }
290
-
291
- //
292
- // XdsApi::RdsUpdate
293
- //
294
-
295
- std::string XdsApi::RdsUpdate::ToString() const {
296
- std::vector<std::string> vhosts;
297
- for (const VirtualHost& vhost : virtual_hosts) {
298
- vhosts.push_back(
299
- absl::StrCat("vhost={\n"
300
- " domains=[",
301
- absl::StrJoin(vhost.domains, ", "),
302
- "]\n"
303
- " routes=[\n"));
304
- for (const XdsApi::Route& route : vhost.routes) {
305
- vhosts.push_back(" {\n");
306
- vhosts.push_back(route.ToString());
307
- vhosts.push_back("\n }\n");
308
- }
309
- vhosts.push_back(" ]\n");
310
- vhosts.push_back(" typed_per_filter_config={\n");
311
- for (const auto& p : vhost.typed_per_filter_config) {
312
- const std::string& name = p.first;
313
- const auto& config = p.second;
314
- vhosts.push_back(
315
- absl::StrCat(" ", name, "=", config.ToString(), "\n"));
316
- }
317
- vhosts.push_back(" }\n");
318
- vhosts.push_back("]\n");
319
- }
320
- return absl::StrJoin(vhosts, "");
321
- }
322
-
323
- namespace {
324
-
325
- // Better match type has smaller value.
326
- enum MatchType {
327
- EXACT_MATCH,
328
- SUFFIX_MATCH,
329
- PREFIX_MATCH,
330
- UNIVERSE_MATCH,
331
- INVALID_MATCH,
332
- };
333
-
334
- // Returns true if match succeeds.
335
- bool DomainMatch(MatchType match_type, const std::string& domain_pattern_in,
336
- const std::string& expected_host_name_in) {
337
- // Normalize the args to lower-case. Domain matching is case-insensitive.
338
- std::string domain_pattern = domain_pattern_in;
339
- std::string expected_host_name = expected_host_name_in;
340
- std::transform(domain_pattern.begin(), domain_pattern.end(),
341
- domain_pattern.begin(),
342
- [](unsigned char c) { return std::tolower(c); });
343
- std::transform(expected_host_name.begin(), expected_host_name.end(),
344
- expected_host_name.begin(),
345
- [](unsigned char c) { return std::tolower(c); });
346
- if (match_type == EXACT_MATCH) {
347
- return domain_pattern == expected_host_name;
348
- } else if (match_type == SUFFIX_MATCH) {
349
- // Asterisk must match at least one char.
350
- if (expected_host_name.size() < domain_pattern.size()) return false;
351
- absl::string_view pattern_suffix(domain_pattern.c_str() + 1);
352
- absl::string_view host_suffix(expected_host_name.c_str() +
353
- expected_host_name.size() -
354
- pattern_suffix.size());
355
- return pattern_suffix == host_suffix;
356
- } else if (match_type == PREFIX_MATCH) {
357
- // Asterisk must match at least one char.
358
- if (expected_host_name.size() < domain_pattern.size()) return false;
359
- absl::string_view pattern_prefix(domain_pattern.c_str(),
360
- domain_pattern.size() - 1);
361
- absl::string_view host_prefix(expected_host_name.c_str(),
362
- pattern_prefix.size());
363
- return pattern_prefix == host_prefix;
364
- } else {
365
- return match_type == UNIVERSE_MATCH;
366
- }
367
- }
368
-
369
- MatchType DomainPatternMatchType(const std::string& domain_pattern) {
370
- if (domain_pattern.empty()) return INVALID_MATCH;
371
- if (domain_pattern.find('*') == std::string::npos) return EXACT_MATCH;
372
- if (domain_pattern == "*") return UNIVERSE_MATCH;
373
- if (domain_pattern[0] == '*') return SUFFIX_MATCH;
374
- if (domain_pattern[domain_pattern.size() - 1] == '*') return PREFIX_MATCH;
375
- return INVALID_MATCH;
376
- }
377
-
378
- } // namespace
379
-
380
- XdsApi::RdsUpdate::VirtualHost* XdsApi::RdsUpdate::FindVirtualHostForDomain(
381
- const std::string& domain) {
382
- // Find the best matched virtual host.
383
- // The search order for 4 groups of domain patterns:
384
- // 1. Exact match.
385
- // 2. Suffix match (e.g., "*ABC").
386
- // 3. Prefix match (e.g., "ABC*").
387
- // 4. Universe match (i.e., "*").
388
- // Within each group, longest match wins.
389
- // If the same best matched domain pattern appears in multiple virtual hosts,
390
- // the first matched virtual host wins.
391
- VirtualHost* target_vhost = nullptr;
392
- MatchType best_match_type = INVALID_MATCH;
393
- size_t longest_match = 0;
394
- // Check each domain pattern in each virtual host to determine the best
395
- // matched virtual host.
396
- for (VirtualHost& vhost : virtual_hosts) {
397
- for (const std::string& domain_pattern : vhost.domains) {
398
- // Check the match type first. Skip the pattern if it's not better than
399
- // current match.
400
- const MatchType match_type = DomainPatternMatchType(domain_pattern);
401
- // This should be caught by RouteConfigParse().
402
- GPR_ASSERT(match_type != INVALID_MATCH);
403
- if (match_type > best_match_type) continue;
404
- if (match_type == best_match_type &&
405
- domain_pattern.size() <= longest_match) {
406
- continue;
407
- }
408
- // Skip if match fails.
409
- if (!DomainMatch(match_type, domain_pattern, domain)) continue;
410
- // Choose this match.
411
- target_vhost = &vhost;
412
- best_match_type = match_type;
413
- longest_match = domain_pattern.size();
414
- if (best_match_type == EXACT_MATCH) break;
415
- }
416
- if (best_match_type == EXACT_MATCH) break;
417
- }
418
- return target_vhost;
419
- }
420
-
421
- //
422
- // XdsApi::CommonTlsContext::CertificateValidationContext
423
- //
424
-
425
- std::string XdsApi::CommonTlsContext::CertificateValidationContext::ToString()
426
- const {
427
- std::vector<std::string> contents;
428
- for (const auto& match : match_subject_alt_names) {
429
- contents.push_back(match.ToString());
430
- }
431
- return absl::StrFormat("{match_subject_alt_names=[%s]}",
432
- absl::StrJoin(contents, ", "));
433
- }
434
-
435
- bool XdsApi::CommonTlsContext::CertificateValidationContext::Empty() const {
436
- return match_subject_alt_names.empty();
437
- }
438
-
439
- //
440
- // XdsApi::CommonTlsContext::CertificateValidationContext
441
- //
442
-
443
- std::string XdsApi::CommonTlsContext::CertificateProviderInstance::ToString()
444
- const {
445
- absl::InlinedVector<std::string, 2> contents;
446
- if (!instance_name.empty()) {
447
- contents.push_back(absl::StrFormat("instance_name=%s", instance_name));
448
- }
449
- if (!certificate_name.empty()) {
450
- contents.push_back(
451
- absl::StrFormat("certificate_name=%s", certificate_name));
452
- }
453
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
454
- }
455
-
456
- bool XdsApi::CommonTlsContext::CertificateProviderInstance::Empty() const {
457
- return instance_name.empty() && certificate_name.empty();
458
- }
459
-
460
- //
461
- // XdsApi::CommonTlsContext::CombinedCertificateValidationContext
462
- //
463
-
464
- std::string
465
- XdsApi::CommonTlsContext::CombinedCertificateValidationContext::ToString()
466
- const {
467
- absl::InlinedVector<std::string, 2> contents;
468
- if (!default_validation_context.Empty()) {
469
- contents.push_back(absl::StrFormat("default_validation_context=%s",
470
- default_validation_context.ToString()));
471
- }
472
- if (!validation_context_certificate_provider_instance.Empty()) {
473
- contents.push_back(absl::StrFormat(
474
- "validation_context_certificate_provider_instance=%s",
475
- validation_context_certificate_provider_instance.ToString()));
476
- }
477
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
478
- }
479
-
480
- bool XdsApi::CommonTlsContext::CombinedCertificateValidationContext::Empty()
481
- const {
482
- return default_validation_context.Empty() &&
483
- validation_context_certificate_provider_instance.Empty();
484
- }
485
-
486
- //
487
- // XdsApi::CommonTlsContext
488
- //
489
-
490
- std::string XdsApi::CommonTlsContext::ToString() const {
491
- absl::InlinedVector<std::string, 2> contents;
492
- if (!tls_certificate_certificate_provider_instance.Empty()) {
493
- contents.push_back(absl::StrFormat(
494
- "tls_certificate_certificate_provider_instance=%s",
495
- tls_certificate_certificate_provider_instance.ToString()));
496
- }
497
- if (!combined_validation_context.Empty()) {
498
- contents.push_back(absl::StrFormat("combined_validation_context=%s",
499
- combined_validation_context.ToString()));
500
- }
501
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
502
- }
503
-
504
- bool XdsApi::CommonTlsContext::Empty() const {
505
- return tls_certificate_certificate_provider_instance.Empty() &&
506
- combined_validation_context.Empty();
507
- }
508
-
509
- //
510
- // XdsApi::DownstreamTlsContext
511
- //
512
-
513
- std::string XdsApi::DownstreamTlsContext::ToString() const {
514
- return absl::StrFormat("common_tls_context=%s, require_client_certificate=%s",
515
- common_tls_context.ToString(),
516
- require_client_certificate ? "true" : "false");
517
- }
518
-
519
- bool XdsApi::DownstreamTlsContext::Empty() const {
520
- return common_tls_context.Empty();
521
- }
522
-
523
- //
524
- // XdsApi::LdsUpdate::HttpConnectionManager
525
- //
526
-
527
- std::string XdsApi::LdsUpdate::HttpConnectionManager::ToString() const {
528
- absl::InlinedVector<std::string, 4> contents;
529
- contents.push_back(absl::StrFormat(
530
- "route_config_name=%s",
531
- !route_config_name.empty() ? route_config_name.c_str() : "<inlined>"));
532
- contents.push_back(absl::StrFormat("http_max_stream_duration=%s",
533
- http_max_stream_duration.ToString()));
534
- if (rds_update.has_value()) {
535
- contents.push_back(
536
- absl::StrFormat("rds_update=%s", rds_update->ToString()));
537
- }
538
- if (!http_filters.empty()) {
539
- std::vector<std::string> filter_strings;
540
- for (const auto& http_filter : http_filters) {
541
- filter_strings.push_back(http_filter.ToString());
542
- }
543
- contents.push_back(absl::StrCat("http_filters=[",
544
- absl::StrJoin(filter_strings, ", "), "]"));
545
- }
546
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
547
- }
548
-
549
- //
550
- // XdsApi::LdsUpdate::HttpFilter
551
- //
552
-
553
- std::string XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter::ToString()
554
- const {
555
- return absl::StrCat("{name=", name, ", config=", config.ToString(), "}");
556
- }
557
-
558
- //
559
- // XdsApi::LdsUpdate::FilterChainData
560
- //
561
-
562
- std::string XdsApi::LdsUpdate::FilterChainData::ToString() const {
563
- return absl::StrCat(
564
- "{downstream_tls_context=", downstream_tls_context.ToString(),
565
- " http_connection_manager=", http_connection_manager.ToString(), "}");
566
- }
567
-
568
- //
569
- // XdsApi::LdsUpdate::FilterChainMap::CidrRange
570
- //
571
-
572
- std::string XdsApi::LdsUpdate::FilterChainMap::CidrRange::ToString() const {
573
- return absl::StrCat(
574
- "{address_prefix=", grpc_sockaddr_to_string(&address, false),
575
- ", prefix_len=", prefix_len, "}");
576
- }
577
-
578
- //
579
- // FilterChain
580
- //
581
-
582
- struct FilterChain {
583
- struct FilterChainMatch {
584
- uint32_t destination_port = 0;
585
- std::vector<XdsApi::LdsUpdate::FilterChainMap::CidrRange> prefix_ranges;
586
- XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceType source_type =
587
- XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceType::kAny;
588
- std::vector<XdsApi::LdsUpdate::FilterChainMap::CidrRange>
589
- source_prefix_ranges;
590
- std::vector<uint32_t> source_ports;
591
- std::vector<std::string> server_names;
592
- std::string transport_protocol;
593
- std::vector<std::string> application_protocols;
594
-
595
- std::string ToString() const;
596
- } filter_chain_match;
597
-
598
- std::shared_ptr<XdsApi::LdsUpdate::FilterChainData> filter_chain_data;
599
- };
600
-
601
- std::string FilterChain::FilterChainMatch::ToString() const {
602
- absl::InlinedVector<std::string, 8> contents;
603
- if (destination_port != 0) {
604
- contents.push_back(absl::StrCat("destination_port=", destination_port));
605
- }
606
- if (!prefix_ranges.empty()) {
607
- std::vector<std::string> prefix_ranges_content;
608
- for (const auto& range : prefix_ranges) {
609
- prefix_ranges_content.push_back(range.ToString());
610
- }
611
- contents.push_back(absl::StrCat(
612
- "prefix_ranges={", absl::StrJoin(prefix_ranges_content, ", "), "}"));
613
- }
614
- if (source_type == XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceType::
615
- kSameIpOrLoopback) {
616
- contents.push_back("source_type=SAME_IP_OR_LOOPBACK");
617
- } else if (source_type == XdsApi::LdsUpdate::FilterChainMap::
618
- ConnectionSourceType::kExternal) {
619
- contents.push_back("source_type=EXTERNAL");
620
- }
621
- if (!source_prefix_ranges.empty()) {
622
- std::vector<std::string> source_prefix_ranges_content;
623
- for (const auto& range : source_prefix_ranges) {
624
- source_prefix_ranges_content.push_back(range.ToString());
625
- }
626
- contents.push_back(
627
- absl::StrCat("source_prefix_ranges={",
628
- absl::StrJoin(source_prefix_ranges_content, ", "), "}"));
629
- }
630
- if (!source_ports.empty()) {
631
- contents.push_back(
632
- absl::StrCat("source_ports={", absl::StrJoin(source_ports, ", "), "}"));
633
- }
634
- if (!server_names.empty()) {
635
- contents.push_back(
636
- absl::StrCat("server_names={", absl::StrJoin(server_names, ", "), "}"));
637
- }
638
- if (!transport_protocol.empty()) {
639
- contents.push_back(absl::StrCat("transport_protocol=", transport_protocol));
640
- }
641
- if (!application_protocols.empty()) {
642
- contents.push_back(absl::StrCat("application_protocols={",
643
- absl::StrJoin(application_protocols, ", "),
644
- "}"));
645
- }
646
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
647
- }
648
-
649
- //
650
- // XdsApi::LdsUpdate::FilterChainMap
651
- //
652
-
653
- std::string XdsApi::LdsUpdate::FilterChainMap::ToString() const {
654
- std::vector<std::string> contents;
655
- for (const auto& destination_ip : destination_ip_vector) {
656
- for (int source_type = 0; source_type < 3; ++source_type) {
657
- for (const auto& source_ip :
658
- destination_ip.source_types_array[source_type]) {
659
- for (const auto& source_port_pair : source_ip.ports_map) {
660
- FilterChain::FilterChainMatch filter_chain_match;
661
- if (destination_ip.prefix_range.has_value()) {
662
- filter_chain_match.prefix_ranges.push_back(
663
- *destination_ip.prefix_range);
664
- }
665
- filter_chain_match.source_type = static_cast<
666
- XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceType>(
667
- source_type);
668
- if (source_ip.prefix_range.has_value()) {
669
- filter_chain_match.source_prefix_ranges.push_back(
670
- *source_ip.prefix_range);
671
- }
672
- if (source_port_pair.first != 0) {
673
- filter_chain_match.source_ports.push_back(source_port_pair.first);
674
- }
675
- contents.push_back(absl::StrCat(
676
- "{filter_chain_match=", filter_chain_match.ToString(),
677
- ", filter_chain=", source_port_pair.second.data->ToString(),
678
- "}"));
679
- }
680
- }
681
- }
682
- }
683
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
684
- }
685
-
686
- //
687
- // XdsApi::LdsUpdate
688
- //
689
-
690
- std::string XdsApi::LdsUpdate::ToString() const {
691
- absl::InlinedVector<std::string, 4> contents;
692
- if (type == ListenerType::kTcpListener) {
693
- contents.push_back(absl::StrCat("address=", address));
694
- contents.push_back(
695
- absl::StrCat("filter_chain_map=", filter_chain_map.ToString()));
696
- if (default_filter_chain.has_value()) {
697
- contents.push_back(absl::StrCat("default_filter_chain=",
698
- default_filter_chain->ToString()));
699
- }
700
- } else if (type == ListenerType::kHttpApiListener) {
701
- contents.push_back(absl::StrFormat("http_connection_manager=%s",
702
- http_connection_manager.ToString()));
703
- }
704
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
705
- }
706
-
707
- //
708
- // XdsApi::CdsUpdate
709
- //
710
-
711
- std::string XdsApi::CdsUpdate::ToString() const {
712
- absl::InlinedVector<std::string, 8> contents;
713
- switch (cluster_type) {
714
- case EDS:
715
- contents.push_back("cluster_type=EDS");
716
- if (!eds_service_name.empty()) {
717
- contents.push_back(
718
- absl::StrFormat("eds_service_name=%s", eds_service_name));
719
- }
720
- break;
721
- case LOGICAL_DNS:
722
- contents.push_back("cluster_type=LOGICAL_DNS");
723
- contents.push_back(absl::StrFormat("dns_hostname=%s", dns_hostname));
724
- break;
725
- case AGGREGATE:
726
- contents.push_back("cluster_type=AGGREGATE");
727
- contents.push_back(
728
- absl::StrFormat("prioritized_cluster_names=[%s]",
729
- absl::StrJoin(prioritized_cluster_names, ", ")));
730
- }
731
- if (!common_tls_context.Empty()) {
732
- contents.push_back(absl::StrFormat("common_tls_context=%s",
733
- common_tls_context.ToString()));
734
- }
735
- if (lrs_load_reporting_server_name.has_value()) {
736
- contents.push_back(absl::StrFormat("lrs_load_reporting_server_name=%s",
737
- lrs_load_reporting_server_name.value()));
738
- }
739
- contents.push_back(absl::StrCat("lb_policy=", lb_policy));
740
- if (lb_policy == "RING_HASH") {
741
- contents.push_back(absl::StrCat("min_ring_size=", min_ring_size));
742
- contents.push_back(absl::StrCat("max_ring_size=", max_ring_size));
743
- }
744
- contents.push_back(
745
- absl::StrFormat("max_concurrent_requests=%d", max_concurrent_requests));
746
- return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
747
- }
748
-
749
- //
750
- // XdsApi::EdsUpdate
751
- //
752
-
753
- std::string XdsApi::EdsUpdate::Priority::Locality::ToString() const {
754
- std::vector<std::string> endpoint_strings;
755
- for (const ServerAddress& endpoint : endpoints) {
756
- endpoint_strings.emplace_back(endpoint.ToString());
757
- }
758
- return absl::StrCat("{name=", name->AsHumanReadableString(),
759
- ", lb_weight=", lb_weight, ", endpoints=[",
760
- absl::StrJoin(endpoint_strings, ", "), "]}");
761
- }
762
-
763
- bool XdsApi::EdsUpdate::Priority::operator==(const Priority& other) const {
764
- if (localities.size() != other.localities.size()) return false;
765
- auto it1 = localities.begin();
766
- auto it2 = other.localities.begin();
767
- while (it1 != localities.end()) {
768
- if (*it1->first != *it2->first) return false;
769
- if (it1->second != it2->second) return false;
770
- ++it1;
771
- ++it2;
772
- }
773
- return true;
774
- }
775
-
776
- std::string XdsApi::EdsUpdate::Priority::ToString() const {
777
- std::vector<std::string> locality_strings;
778
- for (const auto& p : localities) {
779
- locality_strings.emplace_back(p.second.ToString());
780
- }
781
- return absl::StrCat("[", absl::StrJoin(locality_strings, ", "), "]");
782
- }
783
-
784
- bool XdsApi::EdsUpdate::DropConfig::ShouldDrop(
785
- const std::string** category_name) const {
786
- for (size_t i = 0; i < drop_category_list_.size(); ++i) {
787
- const auto& drop_category = drop_category_list_[i];
788
- // Generate a random number in [0, 1000000).
789
- const uint32_t random = static_cast<uint32_t>(rand()) % 1000000;
790
- if (random < drop_category.parts_per_million) {
791
- *category_name = &drop_category.name;
792
- return true;
793
- }
794
- }
795
- return false;
796
- }
797
-
798
- std::string XdsApi::EdsUpdate::DropConfig::ToString() const {
799
- std::vector<std::string> category_strings;
800
- for (const DropCategory& category : drop_category_list_) {
801
- category_strings.emplace_back(
802
- absl::StrCat(category.name, "=", category.parts_per_million));
803
- }
804
- return absl::StrCat("{[", absl::StrJoin(category_strings, ", "),
805
- "], drop_all=", drop_all_, "}");
806
- }
807
-
808
- std::string XdsApi::EdsUpdate::ToString() const {
809
- std::vector<std::string> priority_strings;
810
- for (size_t i = 0; i < priorities.size(); ++i) {
811
- const Priority& priority = priorities[i];
812
- priority_strings.emplace_back(
813
- absl::StrCat("priority ", i, ": ", priority.ToString()));
814
- }
815
- return absl::StrCat("priorities=[", absl::StrJoin(priority_strings, ", "),
816
- "], drop_config=", drop_config->ToString());
817
- }
818
-
819
- //
820
- // XdsApi
821
- //
822
-
823
- const char* XdsApi::kLdsTypeUrl =
824
- "type.googleapis.com/envoy.config.listener.v3.Listener";
825
- const char* XdsApi::kRdsTypeUrl =
826
- "type.googleapis.com/envoy.config.route.v3.RouteConfiguration";
827
- const char* XdsApi::kCdsTypeUrl =
828
- "type.googleapis.com/envoy.config.cluster.v3.Cluster";
829
- const char* XdsApi::kEdsTypeUrl =
830
- "type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment";
831
-
832
- namespace {
833
-
834
- const char* kLdsV2TypeUrl = "type.googleapis.com/envoy.api.v2.Listener";
835
- const char* kRdsV2TypeUrl =
836
- "type.googleapis.com/envoy.api.v2.RouteConfiguration";
837
- const char* kCdsV2TypeUrl = "type.googleapis.com/envoy.api.v2.Cluster";
838
- const char* kEdsV2TypeUrl =
839
- "type.googleapis.com/envoy.api.v2.ClusterLoadAssignment";
840
-
841
- bool IsLds(absl::string_view type_url, bool* is_v2 = nullptr) {
842
- if (type_url == XdsApi::kLdsTypeUrl) return true;
843
- if (type_url == kLdsV2TypeUrl) {
844
- if (is_v2 != nullptr) *is_v2 = true;
845
- return true;
846
- }
847
- return false;
848
- }
849
-
850
- bool IsRds(absl::string_view type_url) {
851
- return type_url == XdsApi::kRdsTypeUrl || type_url == kRdsV2TypeUrl;
852
- }
853
-
854
- bool IsCds(absl::string_view type_url) {
855
- return type_url == XdsApi::kCdsTypeUrl || type_url == kCdsV2TypeUrl;
856
- }
857
-
858
- bool IsEds(absl::string_view type_url) {
859
- return type_url == XdsApi::kEdsTypeUrl || type_url == kEdsV2TypeUrl;
860
- }
861
-
862
- } // namespace
863
-
864
65
  // If gRPC is built with -DGRPC_XDS_USER_AGENT_NAME_SUFFIX="...", that string
865
66
  // will be appended to the user agent name reported to the xDS server.
866
67
  #ifdef GRPC_XDS_USER_AGENT_NAME_SUFFIX
@@ -882,11 +83,13 @@ bool IsEds(absl::string_view type_url) {
882
83
  XdsApi::XdsApi(XdsClient* client, TraceFlag* tracer,
883
84
  const XdsBootstrap::Node* node,
884
85
  const CertificateProviderStore::PluginDefinitionMap*
885
- certificate_provider_definition_map)
86
+ certificate_provider_definition_map,
87
+ upb::SymbolTable* symtab)
886
88
  : client_(client),
887
89
  tracer_(tracer),
888
90
  node_(node),
889
91
  certificate_provider_definition_map_(certificate_provider_definition_map),
92
+ symtab_(symtab),
890
93
  build_version_(absl::StrCat("gRPC C-core ", GPR_PLATFORM_STRING, " ",
891
94
  grpc_version_string(),
892
95
  GRPC_XDS_USER_AGENT_NAME_SUFFIX_STRING,
@@ -896,47 +99,14 @@ XdsApi::XdsApi(XdsClient* client, TraceFlag* tracer,
896
99
  user_agent_version_(
897
100
  absl::StrCat("C-core ", grpc_version_string(),
898
101
  GRPC_XDS_USER_AGENT_NAME_SUFFIX_STRING,
899
- GRPC_XDS_USER_AGENT_VERSION_SUFFIX_STRING)) {
900
- // Populate upb symtab with xDS proto messages that we want to print
901
- // properly in logs.
902
- // Note: This won't actually work properly until upb adds support for
903
- // Any fields in textproto printing (internal b/178821188).
904
- envoy_config_listener_v3_Listener_getmsgdef(symtab_.ptr());
905
- envoy_config_route_v3_RouteConfiguration_getmsgdef(symtab_.ptr());
906
- envoy_config_cluster_v3_Cluster_getmsgdef(symtab_.ptr());
907
- envoy_extensions_clusters_aggregate_v3_ClusterConfig_getmsgdef(symtab_.ptr());
908
- envoy_config_cluster_v3_Cluster_getmsgdef(symtab_.ptr());
909
- envoy_config_endpoint_v3_ClusterLoadAssignment_getmsgdef(symtab_.ptr());
910
- envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_getmsgdef(
911
- symtab_.ptr());
912
- envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_getmsgdef(
913
- symtab_.ptr());
914
- // Load HTTP filter proto messages into the upb symtab.
915
- XdsHttpFilterRegistry::PopulateSymtab(symtab_.ptr());
916
- }
102
+ GRPC_XDS_USER_AGENT_VERSION_SUFFIX_STRING)) {}
917
103
 
918
104
  namespace {
919
105
 
920
- struct EncodingContext {
921
- XdsClient* client; // Used only for logging. Unsafe for dereferencing.
922
- TraceFlag* tracer;
923
- upb_symtab* symtab;
924
- upb_arena* arena;
925
- bool use_v3;
926
- const CertificateProviderStore::PluginDefinitionMap*
927
- certificate_provider_definition_map;
928
- };
929
-
930
- // Works for both std::string and absl::string_view.
931
- template <typename T>
932
- inline upb_strview StdStringToUpbString(const T& str) {
933
- return upb_strview_make(str.data(), str.size());
934
- }
935
-
936
- void PopulateMetadataValue(const EncodingContext& context,
106
+ void PopulateMetadataValue(const XdsEncodingContext& context,
937
107
  google_protobuf_Value* value_pb, const Json& value);
938
108
 
939
- void PopulateListValue(const EncodingContext& context,
109
+ void PopulateListValue(const XdsEncodingContext& context,
940
110
  google_protobuf_ListValue* list_value,
941
111
  const Json::Array& values) {
942
112
  for (const auto& value : values) {
@@ -946,7 +116,7 @@ void PopulateListValue(const EncodingContext& context,
946
116
  }
947
117
  }
948
118
 
949
- void PopulateMetadata(const EncodingContext& context,
119
+ void PopulateMetadata(const XdsEncodingContext& context,
950
120
  google_protobuf_Struct* metadata_pb,
951
121
  const Json::Object& metadata) {
952
122
  for (const auto& p : metadata) {
@@ -957,7 +127,7 @@ void PopulateMetadata(const EncodingContext& context,
957
127
  }
958
128
  }
959
129
 
960
- void PopulateMetadataValue(const EncodingContext& context,
130
+ void PopulateMetadataValue(const XdsEncodingContext& context,
961
131
  google_protobuf_Value* value_pb, const Json& value) {
962
132
  switch (value.type()) {
963
133
  case Json::Type::JSON_NULL:
@@ -1013,19 +183,19 @@ std::string EncodeStringField(uint32_t field_number, const std::string& str) {
1013
183
  EncodeVarint(str.size()) + str;
1014
184
  }
1015
185
 
1016
- void PopulateBuildVersion(const EncodingContext& context,
186
+ void PopulateBuildVersion(const XdsEncodingContext& context,
1017
187
  envoy_config_core_v3_Node* node_msg,
1018
188
  const std::string& build_version) {
1019
189
  std::string encoded_build_version = EncodeStringField(5, build_version);
1020
- // TODO(roth): This should use upb_msg_addunknown(), but that API is
190
+ // TODO(roth): This should use upb_Message_AddUnknown(), but that API is
1021
191
  // broken in the current version of upb, so we're using the internal
1022
192
  // API for now. Change this once we upgrade to a version of upb that
1023
193
  // fixes this bug.
1024
- _upb_msg_addunknown(node_msg, encoded_build_version.data(),
1025
- encoded_build_version.size(), context.arena);
194
+ _upb_Message_AddUnknown(node_msg, encoded_build_version.data(),
195
+ encoded_build_version.size(), context.arena);
1026
196
  }
1027
197
 
1028
- void PopulateNode(const EncodingContext& context,
198
+ void PopulateNode(const XdsEncodingContext& context,
1029
199
  const XdsBootstrap::Node* node,
1030
200
  const std::string& build_version,
1031
201
  const std::string& user_agent_name,
@@ -1071,34 +241,27 @@ void PopulateNode(const EncodingContext& context,
1071
241
  envoy_config_core_v3_Node_set_user_agent_version(
1072
242
  node_msg, StdStringToUpbString(user_agent_version));
1073
243
  envoy_config_core_v3_Node_add_client_features(
1074
- node_msg, upb_strview_makez("envoy.lb.does_not_support_overprovisioning"),
244
+ node_msg,
245
+ upb_StringView_FromString("envoy.lb.does_not_support_overprovisioning"),
1075
246
  context.arena);
1076
247
  }
1077
248
 
1078
- inline absl::string_view UpbStringToAbsl(const upb_strview& str) {
1079
- return absl::string_view(str.data, str.size);
1080
- }
1081
-
1082
- inline std::string UpbStringToStdString(const upb_strview& str) {
1083
- return std::string(str.data, str.size);
1084
- }
1085
-
1086
249
  void MaybeLogDiscoveryRequest(
1087
- const EncodingContext& context,
250
+ const XdsEncodingContext& context,
1088
251
  const envoy_service_discovery_v3_DiscoveryRequest* request) {
1089
252
  if (GRPC_TRACE_FLAG_ENABLED(*context.tracer) &&
1090
253
  gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
1091
- const upb_msgdef* msg_type =
254
+ const upb_MessageDef* msg_type =
1092
255
  envoy_service_discovery_v3_DiscoveryRequest_getmsgdef(context.symtab);
1093
256
  char buf[10240];
1094
- upb_text_encode(request, msg_type, nullptr, 0, buf, sizeof(buf));
257
+ upb_TextEncode(request, msg_type, nullptr, 0, buf, sizeof(buf));
1095
258
  gpr_log(GPR_DEBUG, "[xds_client %p] constructed ADS request: %s",
1096
259
  context.client, buf);
1097
260
  }
1098
261
  }
1099
262
 
1100
263
  grpc_slice SerializeDiscoveryRequest(
1101
- const EncodingContext& context,
264
+ const XdsEncodingContext& context,
1102
265
  envoy_service_discovery_v3_DiscoveryRequest* request) {
1103
266
  size_t output_length;
1104
267
  char* output = envoy_service_discovery_v3_DiscoveryRequest_serialize(
@@ -1106,47 +269,28 @@ grpc_slice SerializeDiscoveryRequest(
1106
269
  return grpc_slice_from_copied_buffer(output, output_length);
1107
270
  }
1108
271
 
1109
- absl::string_view TypeUrlExternalToInternal(bool use_v3,
1110
- const std::string& type_url) {
1111
- if (!use_v3) {
1112
- if (type_url == XdsApi::kLdsTypeUrl) {
1113
- return kLdsV2TypeUrl;
1114
- }
1115
- if (type_url == XdsApi::kRdsTypeUrl) {
1116
- return kRdsV2TypeUrl;
1117
- }
1118
- if (type_url == XdsApi::kCdsTypeUrl) {
1119
- return kCdsV2TypeUrl;
1120
- }
1121
- if (type_url == XdsApi::kEdsTypeUrl) {
1122
- return kEdsV2TypeUrl;
1123
- }
1124
- }
1125
- return type_url;
1126
- }
1127
-
1128
272
  } // namespace
1129
273
 
1130
274
  grpc_slice XdsApi::CreateAdsRequest(
1131
- const XdsBootstrap::XdsServer& server, const std::string& type_url,
1132
- const std::set<absl::string_view>& resource_names,
1133
- const std::string& version, const std::string& nonce,
1134
- grpc_error_handle error, bool populate_node) {
275
+ const XdsBootstrap::XdsServer& server, absl::string_view type_url,
276
+ absl::string_view version, absl::string_view nonce,
277
+ const std::vector<std::string>& resource_names, grpc_error_handle error,
278
+ bool populate_node) {
1135
279
  upb::Arena arena;
1136
- const EncodingContext context = {client_,
1137
- tracer_,
1138
- symtab_.ptr(),
1139
- arena.ptr(),
1140
- server.ShouldUseV3(),
1141
- certificate_provider_definition_map_};
280
+ const XdsEncodingContext context = {client_,
281
+ server,
282
+ tracer_,
283
+ symtab_->ptr(),
284
+ arena.ptr(),
285
+ server.ShouldUseV3(),
286
+ certificate_provider_definition_map_};
1142
287
  // Create a request.
1143
288
  envoy_service_discovery_v3_DiscoveryRequest* request =
1144
289
  envoy_service_discovery_v3_DiscoveryRequest_new(arena.ptr());
1145
290
  // Set type_url.
1146
- absl::string_view real_type_url =
1147
- TypeUrlExternalToInternal(server.ShouldUseV3(), type_url);
291
+ std::string type_url_str = absl::StrCat("type.googleapis.com/", type_url);
1148
292
  envoy_service_discovery_v3_DiscoveryRequest_set_type_url(
1149
- request, StdStringToUpbString(real_type_url));
293
+ request, StdStringToUpbString(type_url_str));
1150
294
  // Set version_info.
1151
295
  if (!version.empty()) {
1152
296
  envoy_service_discovery_v3_DiscoveryRequest_set_version_info(
@@ -1170,7 +314,8 @@ grpc_slice XdsApi::CreateAdsRequest(
1170
314
  google_rpc_Status_set_code(error_detail, GRPC_STATUS_INVALID_ARGUMENT);
1171
315
  // Error description comes from the error that was passed in.
1172
316
  error_string_storage = grpc_error_std_string(error);
1173
- upb_strview error_description = StdStringToUpbString(error_string_storage);
317
+ upb_StringView error_description =
318
+ StdStringToUpbString(error_string_storage);
1174
319
  google_rpc_Status_set_message(error_detail, error_description);
1175
320
  GRPC_ERROR_UNREF(error);
1176
321
  }
@@ -1181,9 +326,12 @@ grpc_slice XdsApi::CreateAdsRequest(
1181
326
  arena.ptr());
1182
327
  PopulateNode(context, node_, build_version_, user_agent_name_,
1183
328
  user_agent_version_, node_msg);
329
+ envoy_config_core_v3_Node_add_client_features(
330
+ node_msg, upb_StringView_FromString("xds.config.resource-in-sotw"),
331
+ context.arena);
1184
332
  }
1185
333
  // Add resource_names.
1186
- for (const auto& resource_name : resource_names) {
334
+ for (const std::string& resource_name : resource_names) {
1187
335
  envoy_service_discovery_v3_DiscoveryRequest_add_resource_names(
1188
336
  request, StdStringToUpbString(resource_name), arena.ptr());
1189
337
  }
@@ -1194,2470 +342,106 @@ grpc_slice XdsApi::CreateAdsRequest(
1194
342
  namespace {
1195
343
 
1196
344
  void MaybeLogDiscoveryResponse(
1197
- const EncodingContext& context,
345
+ const XdsEncodingContext& context,
1198
346
  const envoy_service_discovery_v3_DiscoveryResponse* response) {
1199
347
  if (GRPC_TRACE_FLAG_ENABLED(*context.tracer) &&
1200
348
  gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
1201
- const upb_msgdef* msg_type =
349
+ const upb_MessageDef* msg_type =
1202
350
  envoy_service_discovery_v3_DiscoveryResponse_getmsgdef(context.symtab);
1203
351
  char buf[10240];
1204
- upb_text_encode(response, msg_type, nullptr, 0, buf, sizeof(buf));
352
+ upb_TextEncode(response, msg_type, nullptr, 0, buf, sizeof(buf));
1205
353
  gpr_log(GPR_DEBUG, "[xds_client %p] received response: %s", context.client,
1206
354
  buf);
1207
355
  }
1208
356
  }
1209
357
 
1210
- void MaybeLogHttpConnectionManager(
1211
- const EncodingContext& context,
1212
- const envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager*
1213
- http_connection_manager_config) {
1214
- if (GRPC_TRACE_FLAG_ENABLED(*context.tracer) &&
1215
- gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
1216
- const upb_msgdef* msg_type =
1217
- envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_getmsgdef(
1218
- context.symtab);
1219
- char buf[10240];
1220
- upb_text_encode(http_connection_manager_config, msg_type, nullptr, 0, buf,
1221
- sizeof(buf));
1222
- gpr_log(GPR_DEBUG, "[xds_client %p] HttpConnectionManager: %s",
1223
- context.client, buf);
1224
- }
1225
- }
358
+ } // namespace
1226
359
 
1227
- void MaybeLogRouteConfiguration(
1228
- const EncodingContext& context,
1229
- const envoy_config_route_v3_RouteConfiguration* route_config) {
1230
- if (GRPC_TRACE_FLAG_ENABLED(*context.tracer) &&
1231
- gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
1232
- const upb_msgdef* msg_type =
1233
- envoy_config_route_v3_RouteConfiguration_getmsgdef(context.symtab);
1234
- char buf[10240];
1235
- upb_text_encode(route_config, msg_type, nullptr, 0, buf, sizeof(buf));
1236
- gpr_log(GPR_DEBUG, "[xds_client %p] RouteConfiguration: %s", context.client,
1237
- buf);
1238
- }
1239
- }
1240
-
1241
- void MaybeLogCluster(const EncodingContext& context,
1242
- const envoy_config_cluster_v3_Cluster* cluster) {
1243
- if (GRPC_TRACE_FLAG_ENABLED(*context.tracer) &&
1244
- gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
1245
- const upb_msgdef* msg_type =
1246
- envoy_config_cluster_v3_Cluster_getmsgdef(context.symtab);
1247
- char buf[10240];
1248
- upb_text_encode(cluster, msg_type, nullptr, 0, buf, sizeof(buf));
1249
- gpr_log(GPR_DEBUG, "[xds_client %p] Cluster: %s", context.client, buf);
1250
- }
1251
- }
1252
-
1253
- void MaybeLogClusterLoadAssignment(
1254
- const EncodingContext& context,
1255
- const envoy_config_endpoint_v3_ClusterLoadAssignment* cla) {
1256
- if (GRPC_TRACE_FLAG_ENABLED(*context.tracer) &&
1257
- gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
1258
- const upb_msgdef* msg_type =
1259
- envoy_config_endpoint_v3_ClusterLoadAssignment_getmsgdef(
1260
- context.symtab);
1261
- char buf[10240];
1262
- upb_text_encode(cla, msg_type, nullptr, 0, buf, sizeof(buf));
1263
- gpr_log(GPR_DEBUG, "[xds_client %p] ClusterLoadAssignment: %s",
1264
- context.client, buf);
1265
- }
1266
- }
1267
-
1268
- grpc_error_handle RoutePathMatchParse(
1269
- const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route,
1270
- bool* ignore_route) {
1271
- auto* case_sensitive_ptr =
1272
- envoy_config_route_v3_RouteMatch_case_sensitive(match);
1273
- bool case_sensitive = true;
1274
- if (case_sensitive_ptr != nullptr) {
1275
- case_sensitive = google_protobuf_BoolValue_value(case_sensitive_ptr);
1276
- }
1277
- StringMatcher::Type type;
1278
- std::string match_string;
1279
- if (envoy_config_route_v3_RouteMatch_has_prefix(match)) {
1280
- absl::string_view prefix =
1281
- UpbStringToAbsl(envoy_config_route_v3_RouteMatch_prefix(match));
1282
- // Empty prefix "" is accepted.
1283
- if (!prefix.empty()) {
1284
- // Prefix "/" is accepted.
1285
- if (prefix[0] != '/') {
1286
- // Prefix which does not start with a / will never match anything, so
1287
- // ignore this route.
1288
- *ignore_route = true;
1289
- return GRPC_ERROR_NONE;
1290
- }
1291
- std::vector<absl::string_view> prefix_elements =
1292
- absl::StrSplit(prefix.substr(1), absl::MaxSplits('/', 2));
1293
- if (prefix_elements.size() > 2) {
1294
- // Prefix cannot have more than 2 slashes.
1295
- *ignore_route = true;
1296
- return GRPC_ERROR_NONE;
1297
- } else if (prefix_elements.size() == 2 && prefix_elements[0].empty()) {
1298
- // Prefix contains empty string between the 2 slashes
1299
- *ignore_route = true;
1300
- return GRPC_ERROR_NONE;
1301
- }
1302
- }
1303
- type = StringMatcher::Type::kPrefix;
1304
- match_string = std::string(prefix);
1305
- } else if (envoy_config_route_v3_RouteMatch_has_path(match)) {
1306
- absl::string_view path =
1307
- UpbStringToAbsl(envoy_config_route_v3_RouteMatch_path(match));
1308
- if (path.empty()) {
1309
- // Path that is empty will never match anything, so ignore this route.
1310
- *ignore_route = true;
1311
- return GRPC_ERROR_NONE;
1312
- }
1313
- if (path[0] != '/') {
1314
- // Path which does not start with a / will never match anything, so
1315
- // ignore this route.
1316
- *ignore_route = true;
1317
- return GRPC_ERROR_NONE;
1318
- }
1319
- std::vector<absl::string_view> path_elements =
1320
- absl::StrSplit(path.substr(1), absl::MaxSplits('/', 2));
1321
- if (path_elements.size() != 2) {
1322
- // Path not in the required format of /service/method will never match
1323
- // anything, so ignore this route.
1324
- *ignore_route = true;
1325
- return GRPC_ERROR_NONE;
1326
- } else if (path_elements[0].empty()) {
1327
- // Path contains empty service name will never match anything, so ignore
1328
- // this route.
1329
- *ignore_route = true;
1330
- return GRPC_ERROR_NONE;
1331
- } else if (path_elements[1].empty()) {
1332
- // Path contains empty method name will never match anything, so ignore
1333
- // this route.
1334
- *ignore_route = true;
1335
- return GRPC_ERROR_NONE;
1336
- }
1337
- type = StringMatcher::Type::kExact;
1338
- match_string = std::string(path);
1339
- } else if (envoy_config_route_v3_RouteMatch_has_safe_regex(match)) {
1340
- const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
1341
- envoy_config_route_v3_RouteMatch_safe_regex(match);
1342
- GPR_ASSERT(regex_matcher != nullptr);
1343
- type = StringMatcher::Type::kSafeRegex;
1344
- match_string = UpbStringToStdString(
1345
- envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
1346
- } else {
1347
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1348
- "Invalid route path specifier specified.");
1349
- }
1350
- absl::StatusOr<StringMatcher> string_matcher =
1351
- StringMatcher::Create(type, match_string, case_sensitive);
1352
- if (!string_matcher.ok()) {
1353
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1354
- absl::StrCat("path matcher: ", string_matcher.status().message())
1355
- .c_str());
1356
- ;
1357
- }
1358
- route->matchers.path_matcher = std::move(string_matcher.value());
1359
- return GRPC_ERROR_NONE;
1360
- }
1361
-
1362
- grpc_error_handle RouteHeaderMatchersParse(
1363
- const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route) {
1364
- size_t size;
1365
- const envoy_config_route_v3_HeaderMatcher* const* headers =
1366
- envoy_config_route_v3_RouteMatch_headers(match, &size);
1367
- for (size_t i = 0; i < size; ++i) {
1368
- const envoy_config_route_v3_HeaderMatcher* header = headers[i];
1369
- const std::string name =
1370
- UpbStringToStdString(envoy_config_route_v3_HeaderMatcher_name(header));
1371
- HeaderMatcher::Type type;
1372
- std::string match_string;
1373
- int64_t range_start = 0;
1374
- int64_t range_end = 0;
1375
- bool present_match = false;
1376
- if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) {
1377
- type = HeaderMatcher::Type::kExact;
1378
- match_string = UpbStringToStdString(
1379
- envoy_config_route_v3_HeaderMatcher_exact_match(header));
1380
- } else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(
1381
- header)) {
1382
- const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
1383
- envoy_config_route_v3_HeaderMatcher_safe_regex_match(header);
1384
- GPR_ASSERT(regex_matcher != nullptr);
1385
- type = HeaderMatcher::Type::kSafeRegex;
1386
- match_string = UpbStringToStdString(
1387
- envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
1388
- } else if (envoy_config_route_v3_HeaderMatcher_has_range_match(header)) {
1389
- type = HeaderMatcher::Type::kRange;
1390
- const envoy_type_v3_Int64Range* range_matcher =
1391
- envoy_config_route_v3_HeaderMatcher_range_match(header);
1392
- range_start = envoy_type_v3_Int64Range_start(range_matcher);
1393
- range_end = envoy_type_v3_Int64Range_end(range_matcher);
1394
- } else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) {
1395
- type = HeaderMatcher::Type::kPresent;
1396
- present_match = envoy_config_route_v3_HeaderMatcher_present_match(header);
1397
- } else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) {
1398
- type = HeaderMatcher::Type::kPrefix;
1399
- match_string = UpbStringToStdString(
1400
- envoy_config_route_v3_HeaderMatcher_prefix_match(header));
1401
- } else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) {
1402
- type = HeaderMatcher::Type::kSuffix;
1403
- match_string = UpbStringToStdString(
1404
- envoy_config_route_v3_HeaderMatcher_suffix_match(header));
1405
- } else if (envoy_config_route_v3_HeaderMatcher_has_contains_match(header)) {
1406
- type = HeaderMatcher::Type::kContains;
1407
- match_string = UpbStringToStdString(
1408
- envoy_config_route_v3_HeaderMatcher_contains_match(header));
1409
- } else {
1410
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1411
- "Invalid route header matcher specified.");
1412
- }
1413
- bool invert_match =
1414
- envoy_config_route_v3_HeaderMatcher_invert_match(header);
1415
- absl::StatusOr<HeaderMatcher> header_matcher =
1416
- HeaderMatcher::Create(name, type, match_string, range_start, range_end,
1417
- present_match, invert_match);
1418
- if (!header_matcher.ok()) {
1419
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1420
- absl::StrCat("header matcher: ", header_matcher.status().message())
1421
- .c_str());
1422
- }
1423
- route->matchers.header_matchers.emplace_back(
1424
- std::move(header_matcher.value()));
1425
- }
1426
- return GRPC_ERROR_NONE;
1427
- }
1428
-
1429
- grpc_error_handle RouteRuntimeFractionParse(
1430
- const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route) {
1431
- const envoy_config_core_v3_RuntimeFractionalPercent* runtime_fraction =
1432
- envoy_config_route_v3_RouteMatch_runtime_fraction(match);
1433
- if (runtime_fraction != nullptr) {
1434
- const envoy_type_v3_FractionalPercent* fraction =
1435
- envoy_config_core_v3_RuntimeFractionalPercent_default_value(
1436
- runtime_fraction);
1437
- if (fraction != nullptr) {
1438
- uint32_t numerator = envoy_type_v3_FractionalPercent_numerator(fraction);
1439
- const auto denominator =
1440
- static_cast<envoy_type_v3_FractionalPercent_DenominatorType>(
1441
- envoy_type_v3_FractionalPercent_denominator(fraction));
1442
- // Normalize to million.
1443
- switch (denominator) {
1444
- case envoy_type_v3_FractionalPercent_HUNDRED:
1445
- numerator *= 10000;
1446
- break;
1447
- case envoy_type_v3_FractionalPercent_TEN_THOUSAND:
1448
- numerator *= 100;
1449
- break;
1450
- case envoy_type_v3_FractionalPercent_MILLION:
1451
- break;
1452
- default:
1453
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1454
- "Unknown denominator type");
1455
- }
1456
- route->matchers.fraction_per_million = numerator;
1457
- }
1458
- }
1459
- return GRPC_ERROR_NONE;
1460
- }
1461
-
1462
- grpc_error_handle ExtractHttpFilterTypeName(const EncodingContext& context,
1463
- const google_protobuf_Any* any,
1464
- absl::string_view* filter_type) {
1465
- *filter_type = UpbStringToAbsl(google_protobuf_Any_type_url(any));
1466
- if (*filter_type == "type.googleapis.com/udpa.type.v1.TypedStruct") {
1467
- upb_strview any_value = google_protobuf_Any_value(any);
1468
- const auto* typed_struct = udpa_type_v1_TypedStruct_parse(
1469
- any_value.data, any_value.size, context.arena);
1470
- if (typed_struct == nullptr) {
1471
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1472
- "could not parse TypedStruct from filter config");
1473
- }
1474
- *filter_type =
1475
- UpbStringToAbsl(udpa_type_v1_TypedStruct_type_url(typed_struct));
1476
- }
1477
- *filter_type = absl::StripPrefix(*filter_type, "type.googleapis.com/");
1478
- return GRPC_ERROR_NONE;
1479
- }
1480
-
1481
- template <typename ParentType, typename EntryType>
1482
- grpc_error_handle ParseTypedPerFilterConfig(
1483
- const EncodingContext& context, const ParentType* parent,
1484
- const EntryType* (*entry_func)(const ParentType*, size_t*),
1485
- upb_strview (*key_func)(const EntryType*),
1486
- const google_protobuf_Any* (*value_func)(const EntryType*),
1487
- XdsApi::TypedPerFilterConfig* typed_per_filter_config) {
1488
- size_t filter_it = UPB_MAP_BEGIN;
1489
- while (true) {
1490
- const auto* filter_entry = entry_func(parent, &filter_it);
1491
- if (filter_entry == nullptr) break;
1492
- absl::string_view key = UpbStringToAbsl(key_func(filter_entry));
1493
- if (key.empty()) {
1494
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("empty filter name in map");
1495
- }
1496
- const google_protobuf_Any* any = value_func(filter_entry);
1497
- GPR_ASSERT(any != nullptr);
1498
- absl::string_view filter_type =
1499
- UpbStringToAbsl(google_protobuf_Any_type_url(any));
1500
- if (filter_type.empty()) {
1501
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1502
- absl::StrCat("no filter config specified for filter name ", key)
1503
- .c_str());
1504
- }
1505
- bool is_optional = false;
1506
- if (filter_type ==
1507
- "type.googleapis.com/envoy.config.route.v3.FilterConfig") {
1508
- upb_strview any_value = google_protobuf_Any_value(any);
1509
- const auto* filter_config = envoy_config_route_v3_FilterConfig_parse(
1510
- any_value.data, any_value.size, context.arena);
1511
- if (filter_config == nullptr) {
1512
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1513
- absl::StrCat("could not parse FilterConfig wrapper for ", key)
1514
- .c_str());
1515
- }
1516
- is_optional =
1517
- envoy_config_route_v3_FilterConfig_is_optional(filter_config);
1518
- any = envoy_config_route_v3_FilterConfig_config(filter_config);
1519
- if (any == nullptr) {
1520
- if (is_optional) continue;
1521
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1522
- absl::StrCat("no filter config specified for filter name ", key)
1523
- .c_str());
1524
- }
1525
- }
1526
- grpc_error_handle error =
1527
- ExtractHttpFilterTypeName(context, any, &filter_type);
1528
- if (error != GRPC_ERROR_NONE) return error;
1529
- const XdsHttpFilterImpl* filter_impl =
1530
- XdsHttpFilterRegistry::GetFilterForType(filter_type);
1531
- if (filter_impl == nullptr) {
1532
- if (is_optional) continue;
1533
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1534
- absl::StrCat("no filter registered for config type ", filter_type)
1535
- .c_str());
1536
- }
1537
- absl::StatusOr<XdsHttpFilterImpl::FilterConfig> filter_config =
1538
- filter_impl->GenerateFilterConfigOverride(
1539
- google_protobuf_Any_value(any), context.arena);
1540
- if (!filter_config.ok()) {
1541
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1542
- absl::StrCat("filter config for type ", filter_type,
1543
- " failed to parse: ", filter_config.status().ToString())
1544
- .c_str());
1545
- }
1546
- (*typed_per_filter_config)[std::string(key)] = std::move(*filter_config);
1547
- }
1548
- return GRPC_ERROR_NONE;
1549
- }
1550
-
1551
- XdsApi::Duration DurationParse(const google_protobuf_Duration* proto_duration) {
1552
- XdsApi::Duration duration;
1553
- duration.seconds = google_protobuf_Duration_seconds(proto_duration);
1554
- duration.nanos = google_protobuf_Duration_nanos(proto_duration);
1555
- return duration;
1556
- }
1557
-
1558
- grpc_error_handle RetryPolicyParse(
1559
- const EncodingContext& context,
1560
- const envoy_config_route_v3_RetryPolicy* retry_policy,
1561
- absl::optional<XdsApi::Route::RetryPolicy>* retry) {
1562
- std::vector<grpc_error_handle> errors;
1563
- XdsApi::Route::RetryPolicy retry_to_return;
1564
- auto retry_on = UpbStringToStdString(
1565
- envoy_config_route_v3_RetryPolicy_retry_on(retry_policy));
1566
- std::vector<absl::string_view> codes = absl::StrSplit(retry_on, ',');
1567
- for (const auto& code : codes) {
1568
- if (code == "cancelled") {
1569
- retry_to_return.retry_on.Add(GRPC_STATUS_CANCELLED);
1570
- } else if (code == "deadline-exceeded") {
1571
- retry_to_return.retry_on.Add(GRPC_STATUS_DEADLINE_EXCEEDED);
1572
- } else if (code == "internal") {
1573
- retry_to_return.retry_on.Add(GRPC_STATUS_INTERNAL);
1574
- } else if (code == "resource-exhausted") {
1575
- retry_to_return.retry_on.Add(GRPC_STATUS_RESOURCE_EXHAUSTED);
1576
- } else if (code == "unavailable") {
1577
- retry_to_return.retry_on.Add(GRPC_STATUS_UNAVAILABLE);
1578
- } else {
1579
- if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
1580
- gpr_log(GPR_INFO, "Unsupported retry_on policy %s.",
1581
- std::string(code).c_str());
1582
- }
1583
- }
1584
- }
1585
- // TODO(donnadionne): when we add support for per_try_timeout, we will need to
1586
- // return a policy if per_try_timeout is set even if retry_on specified no
1587
- // supported policies.
1588
- if (retry_to_return.retry_on.Empty()) return GRPC_ERROR_NONE;
1589
- const google_protobuf_UInt32Value* num_retries =
1590
- envoy_config_route_v3_RetryPolicy_num_retries(retry_policy);
1591
- if (num_retries != nullptr) {
1592
- uint32_t num_retries_value = google_protobuf_UInt32Value_value(num_retries);
1593
- if (num_retries_value == 0) {
1594
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1595
- "RouteAction RetryPolicy num_retries set to invalid value 0."));
1596
- } else {
1597
- retry_to_return.num_retries = num_retries_value;
1598
- }
1599
- } else {
1600
- retry_to_return.num_retries = 1;
1601
- }
1602
- const envoy_config_route_v3_RetryPolicy_RetryBackOff* backoff =
1603
- envoy_config_route_v3_RetryPolicy_retry_back_off(retry_policy);
1604
- if (backoff != nullptr) {
1605
- const google_protobuf_Duration* base_interval =
1606
- envoy_config_route_v3_RetryPolicy_RetryBackOff_base_interval(backoff);
1607
- if (base_interval == nullptr) {
1608
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1609
- "RouteAction RetryPolicy RetryBackoff missing base interval."));
1610
- } else {
1611
- retry_to_return.retry_back_off.base_interval =
1612
- DurationParse(base_interval);
1613
- }
1614
- const google_protobuf_Duration* max_interval =
1615
- envoy_config_route_v3_RetryPolicy_RetryBackOff_max_interval(backoff);
1616
- XdsApi::Duration max;
1617
- if (max_interval != nullptr) {
1618
- max = DurationParse(max_interval);
1619
- } else {
1620
- // if max interval is not set, it is 10x the base, if the value in nanos
1621
- // can yield another second, adjust the value in seconds accordingly.
1622
- max.seconds = retry_to_return.retry_back_off.base_interval.seconds * 10;
1623
- max.nanos = retry_to_return.retry_back_off.base_interval.nanos * 10;
1624
- if (max.nanos > 1000000000) {
1625
- max.seconds += max.nanos / 1000000000;
1626
- max.nanos = max.nanos % 1000000000;
1627
- }
1628
- }
1629
- retry_to_return.retry_back_off.max_interval = max;
1630
- } else {
1631
- retry_to_return.retry_back_off.base_interval.seconds = 0;
1632
- retry_to_return.retry_back_off.base_interval.nanos = 25000000;
1633
- retry_to_return.retry_back_off.max_interval.seconds = 0;
1634
- retry_to_return.retry_back_off.max_interval.nanos = 250000000;
1635
- }
1636
- if (errors.empty()) {
1637
- *retry = retry_to_return;
1638
- return GRPC_ERROR_NONE;
1639
- } else {
1640
- return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing retry policy",
1641
- &errors);
1642
- }
1643
- }
1644
-
1645
- grpc_error_handle RouteActionParse(const EncodingContext& context,
1646
- const envoy_config_route_v3_Route* route_msg,
1647
- XdsApi::Route* route, bool* ignore_route) {
1648
- if (!envoy_config_route_v3_Route_has_route(route_msg)) {
1649
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1650
- "No RouteAction found in route.");
1651
- }
1652
- const envoy_config_route_v3_RouteAction* route_action =
1653
- envoy_config_route_v3_Route_route(route_msg);
1654
- // Get the cluster or weighted_clusters in the RouteAction.
1655
- if (envoy_config_route_v3_RouteAction_has_cluster(route_action)) {
1656
- route->cluster_name = UpbStringToStdString(
1657
- envoy_config_route_v3_RouteAction_cluster(route_action));
1658
- if (route->cluster_name.empty()) {
1659
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1660
- "RouteAction cluster contains empty cluster name.");
1661
- }
1662
- } else if (envoy_config_route_v3_RouteAction_has_weighted_clusters(
1663
- route_action)) {
1664
- const envoy_config_route_v3_WeightedCluster* weighted_cluster =
1665
- envoy_config_route_v3_RouteAction_weighted_clusters(route_action);
1666
- uint32_t total_weight = 100;
1667
- const google_protobuf_UInt32Value* weight =
1668
- envoy_config_route_v3_WeightedCluster_total_weight(weighted_cluster);
1669
- if (weight != nullptr) {
1670
- total_weight = google_protobuf_UInt32Value_value(weight);
1671
- }
1672
- size_t clusters_size;
1673
- const envoy_config_route_v3_WeightedCluster_ClusterWeight* const* clusters =
1674
- envoy_config_route_v3_WeightedCluster_clusters(weighted_cluster,
1675
- &clusters_size);
1676
- uint32_t sum_of_weights = 0;
1677
- for (size_t j = 0; j < clusters_size; ++j) {
1678
- const envoy_config_route_v3_WeightedCluster_ClusterWeight*
1679
- cluster_weight = clusters[j];
1680
- XdsApi::Route::ClusterWeight cluster;
1681
- cluster.name = UpbStringToStdString(
1682
- envoy_config_route_v3_WeightedCluster_ClusterWeight_name(
1683
- cluster_weight));
1684
- if (cluster.name.empty()) {
1685
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1686
- "RouteAction weighted_cluster cluster contains empty cluster "
1687
- "name.");
1688
- }
1689
- const google_protobuf_UInt32Value* weight =
1690
- envoy_config_route_v3_WeightedCluster_ClusterWeight_weight(
1691
- cluster_weight);
1692
- if (weight == nullptr) {
1693
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1694
- "RouteAction weighted_cluster cluster missing weight");
1695
- }
1696
- cluster.weight = google_protobuf_UInt32Value_value(weight);
1697
- if (cluster.weight == 0) continue;
1698
- sum_of_weights += cluster.weight;
1699
- if (context.use_v3) {
1700
- grpc_error_handle error = ParseTypedPerFilterConfig<
1701
- envoy_config_route_v3_WeightedCluster_ClusterWeight,
1702
- envoy_config_route_v3_WeightedCluster_ClusterWeight_TypedPerFilterConfigEntry>(
1703
- context, cluster_weight,
1704
- envoy_config_route_v3_WeightedCluster_ClusterWeight_typed_per_filter_config_next,
1705
- envoy_config_route_v3_WeightedCluster_ClusterWeight_TypedPerFilterConfigEntry_key,
1706
- envoy_config_route_v3_WeightedCluster_ClusterWeight_TypedPerFilterConfigEntry_value,
1707
- &cluster.typed_per_filter_config);
1708
- if (error != GRPC_ERROR_NONE) return error;
1709
- }
1710
- route->weighted_clusters.emplace_back(std::move(cluster));
1711
- }
1712
- if (total_weight != sum_of_weights) {
1713
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1714
- "RouteAction weighted_cluster has incorrect total weight");
1715
- }
1716
- if (route->weighted_clusters.empty()) {
1717
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1718
- "RouteAction weighted_cluster has no valid clusters specified.");
1719
- }
1720
- } else {
1721
- // No cluster or weighted_clusters found in RouteAction, ignore this route.
1722
- *ignore_route = true;
1723
- }
1724
- if (!*ignore_route) {
1725
- const envoy_config_route_v3_RouteAction_MaxStreamDuration*
1726
- max_stream_duration =
1727
- envoy_config_route_v3_RouteAction_max_stream_duration(route_action);
1728
- if (max_stream_duration != nullptr) {
1729
- const google_protobuf_Duration* duration =
1730
- envoy_config_route_v3_RouteAction_MaxStreamDuration_grpc_timeout_header_max(
1731
- max_stream_duration);
1732
- if (duration == nullptr) {
1733
- duration =
1734
- envoy_config_route_v3_RouteAction_MaxStreamDuration_max_stream_duration(
1735
- max_stream_duration);
1736
- }
1737
- if (duration != nullptr) {
1738
- route->max_stream_duration = DurationParse(duration);
1739
- }
1740
- }
1741
- }
1742
- // Get HashPolicy from RouteAction
1743
- size_t size = 0;
1744
- const envoy_config_route_v3_RouteAction_HashPolicy* const* hash_policies =
1745
- envoy_config_route_v3_RouteAction_hash_policy(route_action, &size);
1746
- for (size_t i = 0; i < size; ++i) {
1747
- const envoy_config_route_v3_RouteAction_HashPolicy* hash_policy =
1748
- hash_policies[i];
1749
- XdsApi::Route::HashPolicy policy;
1750
- policy.terminal =
1751
- envoy_config_route_v3_RouteAction_HashPolicy_terminal(hash_policy);
1752
- const envoy_config_route_v3_RouteAction_HashPolicy_Header* header;
1753
- const envoy_config_route_v3_RouteAction_HashPolicy_FilterState*
1754
- filter_state;
1755
- if ((header = envoy_config_route_v3_RouteAction_HashPolicy_header(
1756
- hash_policy)) != nullptr) {
1757
- policy.type = XdsApi::Route::HashPolicy::Type::HEADER;
1758
- policy.header_name = UpbStringToStdString(
1759
- envoy_config_route_v3_RouteAction_HashPolicy_Header_header_name(
1760
- header));
1761
- const struct envoy_type_matcher_v3_RegexMatchAndSubstitute*
1762
- regex_rewrite =
1763
- envoy_config_route_v3_RouteAction_HashPolicy_Header_regex_rewrite(
1764
- header);
1765
- if (regex_rewrite != nullptr) {
1766
- const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
1767
- envoy_type_matcher_v3_RegexMatchAndSubstitute_pattern(
1768
- regex_rewrite);
1769
- if (regex_matcher == nullptr) {
1770
- gpr_log(
1771
- GPR_DEBUG,
1772
- "RouteAction HashPolicy contains policy specifier Header with "
1773
- "RegexMatchAndSubstitution but RegexMatcher pattern is "
1774
- "missing");
1775
- continue;
1776
- }
1777
- RE2::Options options;
1778
- policy.regex = absl::make_unique<RE2>(
1779
- UpbStringToStdString(
1780
- envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher)),
1781
- options);
1782
- if (!policy.regex->ok()) {
1783
- gpr_log(
1784
- GPR_DEBUG,
1785
- "RouteAction HashPolicy contains policy specifier Header with "
1786
- "RegexMatchAndSubstitution but RegexMatcher pattern does not "
1787
- "compile");
1788
- continue;
1789
- }
1790
- policy.regex_substitution = UpbStringToStdString(
1791
- envoy_type_matcher_v3_RegexMatchAndSubstitute_substitution(
1792
- regex_rewrite));
1793
- }
1794
- } else if ((filter_state =
1795
- envoy_config_route_v3_RouteAction_HashPolicy_filter_state(
1796
- hash_policy)) != nullptr) {
1797
- std::string key = UpbStringToStdString(
1798
- envoy_config_route_v3_RouteAction_HashPolicy_FilterState_key(
1799
- filter_state));
1800
- if (key == "io.grpc.channel_id") {
1801
- policy.type = XdsApi::Route::HashPolicy::Type::CHANNEL_ID;
1802
- } else {
1803
- gpr_log(GPR_DEBUG,
1804
- "RouteAction HashPolicy contains policy specifier "
1805
- "FilterState but "
1806
- "key is not io.grpc.channel_id.");
1807
- continue;
1808
- }
1809
- } else {
1810
- gpr_log(GPR_DEBUG,
1811
- "RouteAction HashPolicy contains unsupported policy specifier.");
1812
- continue;
1813
- }
1814
- route->hash_policies.emplace_back(std::move(policy));
1815
- }
1816
- // Get retry policy
1817
- const envoy_config_route_v3_RetryPolicy* retry_policy =
1818
- envoy_config_route_v3_RouteAction_retry_policy(route_action);
1819
- if (retry_policy != nullptr) {
1820
- absl::optional<XdsApi::Route::RetryPolicy> retry;
1821
- grpc_error_handle error = RetryPolicyParse(context, retry_policy, &retry);
1822
- if (error != GRPC_ERROR_NONE) return error;
1823
- route->retry_policy = retry;
1824
- }
1825
- return GRPC_ERROR_NONE;
1826
- }
1827
-
1828
- grpc_error_handle RouteConfigParse(
1829
- const EncodingContext& context,
1830
- const envoy_config_route_v3_RouteConfiguration* route_config,
1831
- XdsApi::RdsUpdate* rds_update) {
1832
- MaybeLogRouteConfiguration(context, route_config);
1833
- // Get the virtual hosts.
1834
- size_t num_virtual_hosts;
1835
- const envoy_config_route_v3_VirtualHost* const* virtual_hosts =
1836
- envoy_config_route_v3_RouteConfiguration_virtual_hosts(
1837
- route_config, &num_virtual_hosts);
1838
- for (size_t i = 0; i < num_virtual_hosts; ++i) {
1839
- rds_update->virtual_hosts.emplace_back();
1840
- XdsApi::RdsUpdate::VirtualHost& vhost = rds_update->virtual_hosts.back();
1841
- // Parse domains.
1842
- size_t domain_size;
1843
- upb_strview const* domains = envoy_config_route_v3_VirtualHost_domains(
1844
- virtual_hosts[i], &domain_size);
1845
- for (size_t j = 0; j < domain_size; ++j) {
1846
- std::string domain_pattern = UpbStringToStdString(domains[j]);
1847
- const MatchType match_type = DomainPatternMatchType(domain_pattern);
1848
- if (match_type == INVALID_MATCH) {
1849
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1850
- absl::StrCat("Invalid domain pattern \"", domain_pattern, "\".")
1851
- .c_str());
1852
- }
1853
- vhost.domains.emplace_back(std::move(domain_pattern));
1854
- }
1855
- if (vhost.domains.empty()) {
1856
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("VirtualHost has no domains");
1857
- }
1858
- // Parse typed_per_filter_config.
1859
- if (context.use_v3) {
1860
- grpc_error_handle error = ParseTypedPerFilterConfig<
1861
- envoy_config_route_v3_VirtualHost,
1862
- envoy_config_route_v3_VirtualHost_TypedPerFilterConfigEntry>(
1863
- context, virtual_hosts[i],
1864
- envoy_config_route_v3_VirtualHost_typed_per_filter_config_next,
1865
- envoy_config_route_v3_VirtualHost_TypedPerFilterConfigEntry_key,
1866
- envoy_config_route_v3_VirtualHost_TypedPerFilterConfigEntry_value,
1867
- &vhost.typed_per_filter_config);
1868
- if (error != GRPC_ERROR_NONE) return error;
1869
- }
1870
- // Parse retry policy.
1871
- absl::optional<XdsApi::Route::RetryPolicy> virtual_host_retry_policy;
1872
- const envoy_config_route_v3_RetryPolicy* retry_policy =
1873
- envoy_config_route_v3_VirtualHost_retry_policy(virtual_hosts[i]);
1874
- if (retry_policy != nullptr) {
1875
- grpc_error_handle error =
1876
- RetryPolicyParse(context, retry_policy, &virtual_host_retry_policy);
1877
- if (error != GRPC_ERROR_NONE) return error;
1878
- }
1879
- // Parse routes.
1880
- size_t num_routes;
1881
- const envoy_config_route_v3_Route* const* routes =
1882
- envoy_config_route_v3_VirtualHost_routes(virtual_hosts[i], &num_routes);
1883
- if (num_routes < 1) {
1884
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1885
- "No route found in the virtual host.");
1886
- }
1887
- // Loop over the whole list of routes
1888
- for (size_t j = 0; j < num_routes; ++j) {
1889
- const envoy_config_route_v3_RouteMatch* match =
1890
- envoy_config_route_v3_Route_match(routes[j]);
1891
- if (match == nullptr) {
1892
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Match can't be null.");
1893
- }
1894
- size_t query_parameters_size;
1895
- static_cast<void>(envoy_config_route_v3_RouteMatch_query_parameters(
1896
- match, &query_parameters_size));
1897
- if (query_parameters_size > 0) {
1898
- continue;
1899
- }
1900
- XdsApi::Route route;
1901
- bool ignore_route = false;
1902
- grpc_error_handle error =
1903
- RoutePathMatchParse(match, &route, &ignore_route);
1904
- if (error != GRPC_ERROR_NONE) return error;
1905
- if (ignore_route) continue;
1906
- error = RouteHeaderMatchersParse(match, &route);
1907
- if (error != GRPC_ERROR_NONE) return error;
1908
- error = RouteRuntimeFractionParse(match, &route);
1909
- if (error != GRPC_ERROR_NONE) return error;
1910
- error = RouteActionParse(context, routes[j], &route, &ignore_route);
1911
- if (error != GRPC_ERROR_NONE) return error;
1912
- if (ignore_route) continue;
1913
- if (route.retry_policy == absl::nullopt && retry_policy != nullptr) {
1914
- route.retry_policy = virtual_host_retry_policy;
1915
- }
1916
- if (context.use_v3) {
1917
- grpc_error_handle error = ParseTypedPerFilterConfig<
1918
- envoy_config_route_v3_Route,
1919
- envoy_config_route_v3_Route_TypedPerFilterConfigEntry>(
1920
- context, routes[j],
1921
- envoy_config_route_v3_Route_typed_per_filter_config_next,
1922
- envoy_config_route_v3_Route_TypedPerFilterConfigEntry_key,
1923
- envoy_config_route_v3_Route_TypedPerFilterConfigEntry_value,
1924
- &route.typed_per_filter_config);
1925
- if (error != GRPC_ERROR_NONE) return error;
1926
- }
1927
- vhost.routes.emplace_back(std::move(route));
1928
- }
1929
- if (vhost.routes.empty()) {
1930
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No valid routes specified.");
1931
- }
1932
- }
1933
- return GRPC_ERROR_NONE;
1934
- }
1935
-
1936
- grpc_error_handle CertificateProviderInstanceParse(
1937
- const EncodingContext& context,
1938
- const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance*
1939
- certificate_provider_instance_proto,
1940
- XdsApi::CommonTlsContext::CertificateProviderInstance*
1941
- certificate_provider_instance) {
1942
- *certificate_provider_instance = {
1943
- UpbStringToStdString(
1944
- envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_instance_name(
1945
- certificate_provider_instance_proto)),
1946
- UpbStringToStdString(
1947
- envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_certificate_name(
1948
- certificate_provider_instance_proto))};
1949
- if (context.certificate_provider_definition_map->find(
1950
- certificate_provider_instance->instance_name) ==
1951
- context.certificate_provider_definition_map->end()) {
1952
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
1953
- absl::StrCat("Unrecognized certificate provider instance name: ",
1954
- certificate_provider_instance->instance_name)
1955
- .c_str());
1956
- }
1957
- return GRPC_ERROR_NONE;
1958
- }
1959
-
1960
- grpc_error_handle CommonTlsContextParse(
1961
- const EncodingContext& context,
1962
- const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext*
1963
- common_tls_context_proto,
1964
- XdsApi::CommonTlsContext* common_tls_context) {
1965
- auto* combined_validation_context =
1966
- envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_combined_validation_context(
1967
- common_tls_context_proto);
1968
- if (combined_validation_context != nullptr) {
1969
- auto* default_validation_context =
1970
- envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CombinedCertificateValidationContext_default_validation_context(
1971
- combined_validation_context);
1972
- if (default_validation_context != nullptr) {
1973
- size_t len = 0;
1974
- auto* subject_alt_names_matchers =
1975
- envoy_extensions_transport_sockets_tls_v3_CertificateValidationContext_match_subject_alt_names(
1976
- default_validation_context, &len);
1977
- for (size_t i = 0; i < len; ++i) {
1978
- StringMatcher::Type type;
1979
- std::string matcher;
1980
- if (envoy_type_matcher_v3_StringMatcher_has_exact(
1981
- subject_alt_names_matchers[i])) {
1982
- type = StringMatcher::Type::kExact;
1983
- matcher =
1984
- UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_exact(
1985
- subject_alt_names_matchers[i]));
1986
- } else if (envoy_type_matcher_v3_StringMatcher_has_prefix(
1987
- subject_alt_names_matchers[i])) {
1988
- type = StringMatcher::Type::kPrefix;
1989
- matcher =
1990
- UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_prefix(
1991
- subject_alt_names_matchers[i]));
1992
- } else if (envoy_type_matcher_v3_StringMatcher_has_suffix(
1993
- subject_alt_names_matchers[i])) {
1994
- type = StringMatcher::Type::kSuffix;
1995
- matcher =
1996
- UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_suffix(
1997
- subject_alt_names_matchers[i]));
1998
- } else if (envoy_type_matcher_v3_StringMatcher_has_contains(
1999
- subject_alt_names_matchers[i])) {
2000
- type = StringMatcher::Type::kContains;
2001
- matcher =
2002
- UpbStringToStdString(envoy_type_matcher_v3_StringMatcher_contains(
2003
- subject_alt_names_matchers[i]));
2004
- } else if (envoy_type_matcher_v3_StringMatcher_has_safe_regex(
2005
- subject_alt_names_matchers[i])) {
2006
- type = StringMatcher::Type::kSafeRegex;
2007
- auto* regex_matcher = envoy_type_matcher_v3_StringMatcher_safe_regex(
2008
- subject_alt_names_matchers[i]);
2009
- matcher = UpbStringToStdString(
2010
- envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher));
2011
- } else {
2012
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2013
- "Invalid StringMatcher specified");
2014
- }
2015
- bool ignore_case = envoy_type_matcher_v3_StringMatcher_ignore_case(
2016
- subject_alt_names_matchers[i]);
2017
- absl::StatusOr<StringMatcher> string_matcher =
2018
- StringMatcher::Create(type, matcher,
2019
- /*case_sensitive=*/!ignore_case);
2020
- if (!string_matcher.ok()) {
2021
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2022
- absl::StrCat("string matcher: ",
2023
- string_matcher.status().message())
2024
- .c_str());
2025
- }
2026
- if (type == StringMatcher::Type::kSafeRegex && ignore_case) {
2027
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2028
- "StringMatcher: ignore_case has no effect for SAFE_REGEX.");
2029
- }
2030
- common_tls_context->combined_validation_context
2031
- .default_validation_context.match_subject_alt_names.push_back(
2032
- std::move(string_matcher.value()));
2033
- }
2034
- }
2035
- auto* validation_context_certificate_provider_instance =
2036
- envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CombinedCertificateValidationContext_validation_context_certificate_provider_instance(
2037
- combined_validation_context);
2038
- if (validation_context_certificate_provider_instance != nullptr) {
2039
- grpc_error_handle error = CertificateProviderInstanceParse(
2040
- context, validation_context_certificate_provider_instance,
2041
- &common_tls_context->combined_validation_context
2042
- .validation_context_certificate_provider_instance);
2043
- if (error != GRPC_ERROR_NONE) return error;
2044
- }
2045
- }
2046
- auto* tls_certificate_certificate_provider_instance =
2047
- envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_certificate_provider_instance(
2048
- common_tls_context_proto);
2049
- if (tls_certificate_certificate_provider_instance != nullptr) {
2050
- grpc_error_handle error = CertificateProviderInstanceParse(
2051
- context, tls_certificate_certificate_provider_instance,
2052
- &common_tls_context->tls_certificate_certificate_provider_instance);
2053
- if (error != GRPC_ERROR_NONE) return error;
2054
- }
2055
- return GRPC_ERROR_NONE;
2056
- }
2057
-
2058
- grpc_error_handle HttpConnectionManagerParse(
2059
- bool is_client, const EncodingContext& context,
2060
- const envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager*
2061
- http_connection_manager_proto,
2062
- bool is_v2,
2063
- XdsApi::LdsUpdate::HttpConnectionManager* http_connection_manager) {
2064
- MaybeLogHttpConnectionManager(context, http_connection_manager_proto);
2065
- // Obtain max_stream_duration from Http Protocol Options.
2066
- const envoy_config_core_v3_HttpProtocolOptions* options =
2067
- envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_common_http_protocol_options(
2068
- http_connection_manager_proto);
2069
- if (options != nullptr) {
2070
- const google_protobuf_Duration* duration =
2071
- envoy_config_core_v3_HttpProtocolOptions_max_stream_duration(options);
2072
- if (duration != nullptr) {
2073
- http_connection_manager->http_max_stream_duration =
2074
- DurationParse(duration);
2075
- }
2076
- }
2077
- // Parse filters.
2078
- if (!is_v2) {
2079
- size_t num_filters = 0;
2080
- const auto* http_filters =
2081
- envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_http_filters(
2082
- http_connection_manager_proto, &num_filters);
2083
- std::set<absl::string_view> names_seen;
2084
- for (size_t i = 0; i < num_filters; ++i) {
2085
- const auto* http_filter = http_filters[i];
2086
- absl::string_view name = UpbStringToAbsl(
2087
- envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter_name(
2088
- http_filter));
2089
- if (name.empty()) {
2090
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2091
- absl::StrCat("empty filter name at index ", i).c_str());
2092
- }
2093
- if (names_seen.find(name) != names_seen.end()) {
2094
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2095
- absl::StrCat("duplicate HTTP filter name: ", name).c_str());
2096
- }
2097
- names_seen.insert(name);
2098
- const bool is_optional =
2099
- envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter_is_optional(
2100
- http_filter);
2101
- const google_protobuf_Any* any =
2102
- envoy_extensions_filters_network_http_connection_manager_v3_HttpFilter_typed_config(
2103
- http_filter);
2104
- if (any == nullptr) {
2105
- if (is_optional) continue;
2106
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2107
- absl::StrCat("no filter config specified for filter name ", name)
2108
- .c_str());
2109
- }
2110
- absl::string_view filter_type;
2111
- grpc_error_handle error =
2112
- ExtractHttpFilterTypeName(context, any, &filter_type);
2113
- if (error != GRPC_ERROR_NONE) return error;
2114
- const XdsHttpFilterImpl* filter_impl =
2115
- XdsHttpFilterRegistry::GetFilterForType(filter_type);
2116
- if (filter_impl == nullptr) {
2117
- if (is_optional) continue;
2118
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2119
- absl::StrCat("no filter registered for config type ", filter_type)
2120
- .c_str());
2121
- }
2122
- if ((is_client && !filter_impl->IsSupportedOnClients()) ||
2123
- (!is_client && !filter_impl->IsSupportedOnServers())) {
2124
- if (is_optional) continue;
2125
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2126
- absl::StrFormat("Filter %s is not supported on %s", filter_type,
2127
- is_client ? "clients" : "servers")
2128
- .c_str());
2129
- }
2130
- if (i < num_filters - 1) {
2131
- // Filters before the last filter must not be terminal.
2132
- if (filter_impl->IsTerminalFilter()) {
2133
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2134
- absl::StrCat("terminal filter for config type ", filter_type,
2135
- " must be the last filter in the chain")
2136
- .c_str());
2137
- }
2138
- } else {
2139
- // The last filter must be terminal.
2140
- if (!filter_impl->IsTerminalFilter()) {
2141
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2142
- absl::StrCat("non-terminal filter for config type ", filter_type,
2143
- " is the last filter in the chain")
2144
- .c_str());
2145
- }
2146
- }
2147
- absl::StatusOr<XdsHttpFilterImpl::FilterConfig> filter_config =
2148
- filter_impl->GenerateFilterConfig(google_protobuf_Any_value(any),
2149
- context.arena);
2150
- if (!filter_config.ok()) {
2151
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2152
- absl::StrCat(
2153
- "filter config for type ", filter_type,
2154
- " failed to parse: ", filter_config.status().ToString())
2155
- .c_str());
2156
- }
2157
- http_connection_manager->http_filters.emplace_back(
2158
- XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter{
2159
- std::string(name), std::move(*filter_config)});
2160
- }
2161
- } else {
2162
- // If using a v2 config, we just hard-code a list containing only the
2163
- // router filter without actually looking at the config. This ensures
2164
- // that the right thing happens in the xds resolver without having
2165
- // to expose whether the resource we received was v2 or v3.
2166
- http_connection_manager->http_filters.emplace_back(
2167
- XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter{
2168
- "router", {kXdsHttpRouterFilterConfigName, Json()}});
2169
- }
2170
- if (is_client) {
2171
- // Found inlined route_config. Parse it to find the cluster_name.
2172
- if (envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_has_route_config(
2173
- http_connection_manager_proto)) {
2174
- const envoy_config_route_v3_RouteConfiguration* route_config =
2175
- envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_route_config(
2176
- http_connection_manager_proto);
2177
- XdsApi::RdsUpdate rds_update;
2178
- grpc_error_handle error =
2179
- RouteConfigParse(context, route_config, &rds_update);
2180
- if (error != GRPC_ERROR_NONE) return error;
2181
- http_connection_manager->rds_update = std::move(rds_update);
2182
- return GRPC_ERROR_NONE;
2183
- }
2184
- // Validate that RDS must be used to get the route_config dynamically.
2185
- const envoy_extensions_filters_network_http_connection_manager_v3_Rds* rds =
2186
- envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_rds(
2187
- http_connection_manager_proto);
2188
- if (rds == nullptr) {
2189
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2190
- "HttpConnectionManager neither has inlined route_config nor RDS.");
2191
- }
2192
- // Check that the ConfigSource specifies ADS.
2193
- const envoy_config_core_v3_ConfigSource* config_source =
2194
- envoy_extensions_filters_network_http_connection_manager_v3_Rds_config_source(
2195
- rds);
2196
- if (config_source == nullptr) {
2197
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2198
- "HttpConnectionManager missing config_source for RDS.");
2199
- }
2200
- if (!envoy_config_core_v3_ConfigSource_has_ads(config_source)) {
2201
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2202
- "HttpConnectionManager ConfigSource for RDS does not specify ADS.");
2203
- }
2204
- // Get the route_config_name.
2205
- http_connection_manager->route_config_name = UpbStringToStdString(
2206
- envoy_extensions_filters_network_http_connection_manager_v3_Rds_route_config_name(
2207
- rds));
2208
- }
2209
- return GRPC_ERROR_NONE;
2210
- }
2211
-
2212
- grpc_error_handle LdsResponseParseClient(
2213
- const EncodingContext& context,
2214
- const envoy_config_listener_v3_ApiListener* api_listener, bool is_v2,
2215
- XdsApi::LdsUpdate* lds_update) {
2216
- lds_update->type = XdsApi::LdsUpdate::ListenerType::kHttpApiListener;
2217
- const upb_strview encoded_api_listener = google_protobuf_Any_value(
2218
- envoy_config_listener_v3_ApiListener_api_listener(api_listener));
2219
- const auto* http_connection_manager =
2220
- envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_parse(
2221
- encoded_api_listener.data, encoded_api_listener.size, context.arena);
2222
- if (http_connection_manager == nullptr) {
2223
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2224
- "Could not parse HttpConnectionManager config from ApiListener");
2225
- }
2226
- return HttpConnectionManagerParse(true /* is_client */, context,
2227
- http_connection_manager, is_v2,
2228
- &lds_update->http_connection_manager);
2229
- }
2230
-
2231
- grpc_error_handle DownstreamTlsContextParse(
2232
- const EncodingContext& context,
2233
- const envoy_config_core_v3_TransportSocket* transport_socket,
2234
- XdsApi::DownstreamTlsContext* downstream_tls_context) {
2235
- absl::string_view name = UpbStringToAbsl(
2236
- envoy_config_core_v3_TransportSocket_name(transport_socket));
2237
- if (name != "envoy.transport_sockets.tls") {
2238
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2239
- absl::StrCat("Unrecognized transport socket: ", name).c_str());
2240
- }
2241
- auto* typed_config =
2242
- envoy_config_core_v3_TransportSocket_typed_config(transport_socket);
2243
- if (typed_config != nullptr) {
2244
- const upb_strview encoded_downstream_tls_context =
2245
- google_protobuf_Any_value(typed_config);
2246
- auto* downstream_tls_context_proto =
2247
- envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_parse(
2248
- encoded_downstream_tls_context.data,
2249
- encoded_downstream_tls_context.size, context.arena);
2250
- if (downstream_tls_context_proto == nullptr) {
2251
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2252
- "Can't decode downstream tls context.");
2253
- }
2254
- auto* common_tls_context =
2255
- envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_common_tls_context(
2256
- downstream_tls_context_proto);
2257
- if (common_tls_context != nullptr) {
2258
- grpc_error_handle error =
2259
- CommonTlsContextParse(context, common_tls_context,
2260
- &downstream_tls_context->common_tls_context);
2261
- if (error != GRPC_ERROR_NONE) return error;
2262
- }
2263
- auto* require_client_certificate =
2264
- envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_require_client_certificate(
2265
- downstream_tls_context_proto);
2266
- if (require_client_certificate != nullptr) {
2267
- downstream_tls_context->require_client_certificate =
2268
- google_protobuf_BoolValue_value(require_client_certificate);
2269
- }
2270
- }
2271
- if (downstream_tls_context->common_tls_context
2272
- .tls_certificate_certificate_provider_instance.instance_name
2273
- .empty()) {
2274
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2275
- "TLS configuration provided but no "
2276
- "tls_certificate_certificate_provider_instance found.");
2277
- }
2278
- if (downstream_tls_context->require_client_certificate &&
2279
- downstream_tls_context->common_tls_context.combined_validation_context
2280
- .validation_context_certificate_provider_instance.instance_name
2281
- .empty()) {
2282
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2283
- "TLS configuration requires client certificates but no certificate "
2284
- "provider instance specified for validation.");
2285
- }
2286
- return GRPC_ERROR_NONE;
2287
- }
2288
-
2289
- grpc_error_handle CidrRangeParse(
2290
- const envoy_config_core_v3_CidrRange* cidr_range_proto,
2291
- XdsApi::LdsUpdate::FilterChainMap::CidrRange* cidr_range) {
2292
- std::string address_prefix = UpbStringToStdString(
2293
- envoy_config_core_v3_CidrRange_address_prefix(cidr_range_proto));
2294
- grpc_error_handle error =
2295
- grpc_string_to_sockaddr(&cidr_range->address, address_prefix.c_str(), 0);
2296
- if (error != GRPC_ERROR_NONE) return error;
2297
- cidr_range->prefix_len = 0;
2298
- auto* prefix_len_proto =
2299
- envoy_config_core_v3_CidrRange_prefix_len(cidr_range_proto);
2300
- if (prefix_len_proto != nullptr) {
2301
- cidr_range->prefix_len = std::min(
2302
- google_protobuf_UInt32Value_value(prefix_len_proto),
2303
- (reinterpret_cast<const grpc_sockaddr*>(cidr_range->address.addr))
2304
- ->sa_family == GRPC_AF_INET
2305
- ? uint32_t(32)
2306
- : uint32_t(128));
2307
- }
2308
- // Normalize the network address by masking it with prefix_len
2309
- grpc_sockaddr_mask_bits(&cidr_range->address, cidr_range->prefix_len);
2310
- return GRPC_ERROR_NONE;
2311
- }
2312
-
2313
- grpc_error_handle FilterChainMatchParse(
2314
- const envoy_config_listener_v3_FilterChainMatch* filter_chain_match_proto,
2315
- FilterChain::FilterChainMatch* filter_chain_match) {
2316
- auto* destination_port =
2317
- envoy_config_listener_v3_FilterChainMatch_destination_port(
2318
- filter_chain_match_proto);
2319
- if (destination_port != nullptr) {
2320
- filter_chain_match->destination_port =
2321
- google_protobuf_UInt32Value_value(destination_port);
2322
- }
2323
- size_t size = 0;
2324
- auto* prefix_ranges = envoy_config_listener_v3_FilterChainMatch_prefix_ranges(
2325
- filter_chain_match_proto, &size);
2326
- filter_chain_match->prefix_ranges.reserve(size);
2327
- for (size_t i = 0; i < size; i++) {
2328
- XdsApi::LdsUpdate::FilterChainMap::CidrRange cidr_range;
2329
- grpc_error_handle error = CidrRangeParse(prefix_ranges[i], &cidr_range);
2330
- if (error != GRPC_ERROR_NONE) return error;
2331
- filter_chain_match->prefix_ranges.push_back(cidr_range);
2332
- }
2333
- filter_chain_match->source_type =
2334
- static_cast<XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceType>(
2335
- envoy_config_listener_v3_FilterChainMatch_source_type(
2336
- filter_chain_match_proto));
2337
- auto* source_prefix_ranges =
2338
- envoy_config_listener_v3_FilterChainMatch_source_prefix_ranges(
2339
- filter_chain_match_proto, &size);
2340
- filter_chain_match->source_prefix_ranges.reserve(size);
2341
- for (size_t i = 0; i < size; i++) {
2342
- XdsApi::LdsUpdate::FilterChainMap::CidrRange cidr_range;
2343
- grpc_error_handle error =
2344
- CidrRangeParse(source_prefix_ranges[i], &cidr_range);
2345
- if (error != GRPC_ERROR_NONE) return error;
2346
- filter_chain_match->source_prefix_ranges.push_back(cidr_range);
2347
- }
2348
- auto* source_ports = envoy_config_listener_v3_FilterChainMatch_source_ports(
2349
- filter_chain_match_proto, &size);
2350
- filter_chain_match->source_ports.reserve(size);
2351
- for (size_t i = 0; i < size; i++) {
2352
- filter_chain_match->source_ports.push_back(source_ports[i]);
2353
- }
2354
- auto* server_names = envoy_config_listener_v3_FilterChainMatch_server_names(
2355
- filter_chain_match_proto, &size);
2356
- for (size_t i = 0; i < size; i++) {
2357
- filter_chain_match->server_names.push_back(
2358
- UpbStringToStdString(server_names[i]));
2359
- }
2360
- filter_chain_match->transport_protocol = UpbStringToStdString(
2361
- envoy_config_listener_v3_FilterChainMatch_transport_protocol(
2362
- filter_chain_match_proto));
2363
- auto* application_protocols =
2364
- envoy_config_listener_v3_FilterChainMatch_application_protocols(
2365
- filter_chain_match_proto, &size);
2366
- for (size_t i = 0; i < size; i++) {
2367
- filter_chain_match->application_protocols.push_back(
2368
- UpbStringToStdString(application_protocols[i]));
2369
- }
2370
- return GRPC_ERROR_NONE;
2371
- }
2372
-
2373
- grpc_error_handle FilterChainParse(
2374
- const EncodingContext& context,
2375
- const envoy_config_listener_v3_FilterChain* filter_chain_proto, bool is_v2,
2376
- FilterChain* filter_chain) {
2377
- grpc_error_handle error = GRPC_ERROR_NONE;
2378
- auto* filter_chain_match =
2379
- envoy_config_listener_v3_FilterChain_filter_chain_match(
2380
- filter_chain_proto);
2381
- if (filter_chain_match != nullptr) {
2382
- error = FilterChainMatchParse(filter_chain_match,
2383
- &filter_chain->filter_chain_match);
2384
- if (error != GRPC_ERROR_NONE) return error;
2385
- }
2386
- // Parse the filters list. Currently we only support HttpConnectionManager.
2387
- size_t size = 0;
2388
- auto* filters =
2389
- envoy_config_listener_v3_FilterChain_filters(filter_chain_proto, &size);
2390
- if (size != 1) {
2391
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2392
- "FilterChain should have exactly one filter: HttpConnectionManager; no "
2393
- "other filter is supported at the moment");
2394
- }
2395
- auto* typed_config = envoy_config_listener_v3_Filter_typed_config(filters[0]);
2396
- if (typed_config == nullptr) {
2397
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2398
- "No typed_config found in filter.");
2399
- }
2400
- absl::string_view type_url =
2401
- UpbStringToAbsl(google_protobuf_Any_type_url(typed_config));
2402
- if (type_url !=
2403
- "type.googleapis.com/"
2404
- "envoy.extensions.filters.network.http_connection_manager.v3."
2405
- "HttpConnectionManager") {
2406
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2407
- absl::StrCat("Unsupported filter type ", type_url).c_str());
2408
- }
2409
- const upb_strview encoded_http_connection_manager =
2410
- google_protobuf_Any_value(typed_config);
2411
- const auto* http_connection_manager =
2412
- envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_parse(
2413
- encoded_http_connection_manager.data,
2414
- encoded_http_connection_manager.size, context.arena);
2415
- if (http_connection_manager == nullptr) {
2416
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2417
- "Could not parse HttpConnectionManager config from filter "
2418
- "typed_config");
2419
- }
2420
- filter_chain->filter_chain_data =
2421
- std::make_shared<XdsApi::LdsUpdate::FilterChainData>();
2422
- error = HttpConnectionManagerParse(
2423
- false /* is_client */, context, http_connection_manager, is_v2,
2424
- &filter_chain->filter_chain_data->http_connection_manager);
2425
- if (error != GRPC_ERROR_NONE) return error;
2426
- // Get the DownstreamTlsContext for the filter chain
2427
- if (XdsSecurityEnabled()) {
2428
- auto* transport_socket =
2429
- envoy_config_listener_v3_FilterChain_transport_socket(
2430
- filter_chain_proto);
2431
- if (transport_socket != nullptr) {
2432
- error = DownstreamTlsContextParse(
2433
- context, transport_socket,
2434
- &filter_chain->filter_chain_data->downstream_tls_context);
2435
- }
2436
- }
2437
- return error;
2438
- }
2439
-
2440
- grpc_error_handle AddressParse(
2441
- const envoy_config_core_v3_Address* address_proto, std::string* address) {
2442
- const auto* socket_address =
2443
- envoy_config_core_v3_Address_socket_address(address_proto);
2444
- if (socket_address == nullptr) {
2445
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2446
- "Address does not have socket_address");
2447
- }
2448
- if (envoy_config_core_v3_SocketAddress_protocol(socket_address) !=
2449
- envoy_config_core_v3_SocketAddress_TCP) {
2450
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2451
- "SocketAddress protocol is not TCP");
2452
- }
2453
- uint32_t port = envoy_config_core_v3_SocketAddress_port_value(socket_address);
2454
- if (port > 65535) {
2455
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid port");
2456
- }
2457
- *address = JoinHostPort(
2458
- UpbStringToAbsl(
2459
- envoy_config_core_v3_SocketAddress_address(socket_address)),
2460
- port);
2461
- return GRPC_ERROR_NONE;
2462
- }
2463
-
2464
- // An intermediate map for filter chains that we create to validate the list of
2465
- // filter chains received from the control plane and to finally create
2466
- // XdsApi::LdsUpdate::FilterChainMap
2467
- struct InternalFilterChainMap {
2468
- using SourceIpMap =
2469
- std::map<std::string, XdsApi::LdsUpdate::FilterChainMap::SourceIp>;
2470
- using ConnectionSourceTypesArray = std::array<SourceIpMap, 3>;
2471
- struct DestinationIp {
2472
- absl::optional<XdsApi::LdsUpdate::FilterChainMap::CidrRange> prefix_range;
2473
- bool transport_protocol_raw_buffer_provided = false;
2474
- ConnectionSourceTypesArray source_types_array;
2475
- };
2476
- using DestinationIpMap = std::map<std::string, DestinationIp>;
2477
- DestinationIpMap destination_ip_map;
2478
- };
2479
-
2480
- grpc_error_handle AddFilterChainDataForSourcePort(
2481
- const FilterChain& filter_chain,
2482
- XdsApi::LdsUpdate::FilterChainMap::SourcePortsMap* ports_map,
2483
- uint32_t port) {
2484
- auto insert_result = ports_map->emplace(
2485
- port, XdsApi::LdsUpdate::FilterChainMap::FilterChainDataSharedPtr{
2486
- filter_chain.filter_chain_data});
2487
- if (!insert_result.second) {
2488
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2489
- absl::StrCat(
2490
- "Duplicate matching rules detected when adding filter chain: ",
2491
- filter_chain.filter_chain_match.ToString())
2492
- .c_str());
2493
- }
2494
- return GRPC_ERROR_NONE;
2495
- }
2496
-
2497
- grpc_error_handle AddFilterChainDataForSourcePorts(
2498
- const FilterChain& filter_chain,
2499
- XdsApi::LdsUpdate::FilterChainMap::SourcePortsMap* ports_map) {
2500
- if (filter_chain.filter_chain_match.source_ports.empty()) {
2501
- return AddFilterChainDataForSourcePort(filter_chain, ports_map, 0);
2502
- } else {
2503
- for (uint32_t port : filter_chain.filter_chain_match.source_ports) {
2504
- grpc_error_handle error =
2505
- AddFilterChainDataForSourcePort(filter_chain, ports_map, port);
2506
- if (error != GRPC_ERROR_NONE) return error;
2507
- }
2508
- }
2509
- return GRPC_ERROR_NONE;
2510
- }
2511
-
2512
- grpc_error_handle AddFilterChainDataForSourceIpRange(
2513
- const FilterChain& filter_chain,
2514
- InternalFilterChainMap::SourceIpMap* source_ip_map) {
2515
- if (filter_chain.filter_chain_match.source_prefix_ranges.empty()) {
2516
- auto insert_result = source_ip_map->emplace(
2517
- "", XdsApi::LdsUpdate::FilterChainMap::SourceIp());
2518
- return AddFilterChainDataForSourcePorts(
2519
- filter_chain, &insert_result.first->second.ports_map);
2520
- } else {
2521
- for (const auto& prefix_range :
2522
- filter_chain.filter_chain_match.source_prefix_ranges) {
2523
- auto insert_result = source_ip_map->emplace(
2524
- absl::StrCat(grpc_sockaddr_to_string(&prefix_range.address, false),
2525
- "/", prefix_range.prefix_len),
2526
- XdsApi::LdsUpdate::FilterChainMap::SourceIp());
2527
- if (insert_result.second) {
2528
- insert_result.first->second.prefix_range.emplace(prefix_range);
2529
- }
2530
- grpc_error_handle error = AddFilterChainDataForSourcePorts(
2531
- filter_chain, &insert_result.first->second.ports_map);
2532
- if (error != GRPC_ERROR_NONE) return error;
2533
- }
2534
- }
2535
- return GRPC_ERROR_NONE;
2536
- }
2537
-
2538
- grpc_error_handle AddFilterChainDataForSourceType(
2539
- const FilterChain& filter_chain,
2540
- InternalFilterChainMap::DestinationIp* destination_ip) {
2541
- GPR_ASSERT(static_cast<unsigned int>(
2542
- filter_chain.filter_chain_match.source_type) < 3);
2543
- return AddFilterChainDataForSourceIpRange(
2544
- filter_chain, &destination_ip->source_types_array[static_cast<int>(
2545
- filter_chain.filter_chain_match.source_type)]);
2546
- }
2547
-
2548
- grpc_error_handle AddFilterChainDataForApplicationProtocols(
2549
- const FilterChain& filter_chain,
2550
- InternalFilterChainMap::DestinationIp* destination_ip) {
2551
- // Only allow filter chains that do not mention application protocols
2552
- if (!filter_chain.filter_chain_match.application_protocols.empty()) {
2553
- return GRPC_ERROR_NONE;
2554
- }
2555
- return AddFilterChainDataForSourceType(filter_chain, destination_ip);
2556
- }
2557
-
2558
- grpc_error_handle AddFilterChainDataForTransportProtocol(
2559
- const FilterChain& filter_chain,
2560
- InternalFilterChainMap::DestinationIp* destination_ip) {
2561
- const std::string& transport_protocol =
2562
- filter_chain.filter_chain_match.transport_protocol;
2563
- // Only allow filter chains with no transport protocol or "raw_buffer"
2564
- if (!transport_protocol.empty() && transport_protocol != "raw_buffer") {
2565
- return GRPC_ERROR_NONE;
2566
- }
2567
- // If for this configuration, we've already seen filter chains that mention
2568
- // the transport protocol as "raw_buffer", we will never match filter chains
2569
- // that do not mention it.
2570
- if (destination_ip->transport_protocol_raw_buffer_provided &&
2571
- transport_protocol.empty()) {
2572
- return GRPC_ERROR_NONE;
2573
- }
2574
- if (!transport_protocol.empty() &&
2575
- !destination_ip->transport_protocol_raw_buffer_provided) {
2576
- destination_ip->transport_protocol_raw_buffer_provided = true;
2577
- // Clear out the previous entries if any since those entries did not mention
2578
- // "raw_buffer"
2579
- destination_ip->source_types_array =
2580
- InternalFilterChainMap::ConnectionSourceTypesArray();
2581
- }
2582
- return AddFilterChainDataForApplicationProtocols(filter_chain,
2583
- destination_ip);
2584
- }
2585
-
2586
- grpc_error_handle AddFilterChainDataForServerNames(
2587
- const FilterChain& filter_chain,
2588
- InternalFilterChainMap::DestinationIp* destination_ip) {
2589
- // Don't continue adding filter chains with server names mentioned
2590
- if (!filter_chain.filter_chain_match.server_names.empty()) {
2591
- return GRPC_ERROR_NONE;
2592
- }
2593
- return AddFilterChainDataForTransportProtocol(filter_chain, destination_ip);
2594
- }
2595
-
2596
- grpc_error_handle AddFilterChainDataForDestinationIpRange(
2597
- const FilterChain& filter_chain,
2598
- InternalFilterChainMap::DestinationIpMap* destination_ip_map) {
2599
- if (filter_chain.filter_chain_match.prefix_ranges.empty()) {
2600
- auto insert_result = destination_ip_map->emplace(
2601
- "", InternalFilterChainMap::DestinationIp());
2602
- return AddFilterChainDataForServerNames(filter_chain,
2603
- &insert_result.first->second);
2604
- } else {
2605
- for (const auto& prefix_range :
2606
- filter_chain.filter_chain_match.prefix_ranges) {
2607
- auto insert_result = destination_ip_map->emplace(
2608
- absl::StrCat(grpc_sockaddr_to_string(&prefix_range.address, false),
2609
- "/", prefix_range.prefix_len),
2610
- InternalFilterChainMap::DestinationIp());
2611
- if (insert_result.second) {
2612
- insert_result.first->second.prefix_range.emplace(prefix_range);
2613
- }
2614
- grpc_error_handle error = AddFilterChainDataForServerNames(
2615
- filter_chain, &insert_result.first->second);
2616
- if (error != GRPC_ERROR_NONE) return error;
2617
- }
2618
- }
2619
- return GRPC_ERROR_NONE;
2620
- }
2621
-
2622
- XdsApi::LdsUpdate::FilterChainMap BuildFromInternalFilterChainMap(
2623
- InternalFilterChainMap* internal_filter_chain_map) {
2624
- XdsApi::LdsUpdate::FilterChainMap filter_chain_map;
2625
- for (auto& destination_ip_pair :
2626
- internal_filter_chain_map->destination_ip_map) {
2627
- XdsApi::LdsUpdate::FilterChainMap::DestinationIp destination_ip;
2628
- destination_ip.prefix_range = destination_ip_pair.second.prefix_range;
2629
- for (int i = 0; i < 3; i++) {
2630
- auto& source_ip_map = destination_ip_pair.second.source_types_array[i];
2631
- for (auto& source_ip_pair : source_ip_map) {
2632
- destination_ip.source_types_array[i].push_back(
2633
- std::move(source_ip_pair.second));
2634
- }
2635
- }
2636
- filter_chain_map.destination_ip_vector.push_back(std::move(destination_ip));
2637
- }
2638
- return filter_chain_map;
2639
- }
2640
-
2641
- grpc_error_handle BuildFilterChainMap(
2642
- const std::vector<FilterChain>& filter_chains,
2643
- XdsApi::LdsUpdate::FilterChainMap* filter_chain_map) {
2644
- InternalFilterChainMap internal_filter_chain_map;
2645
- for (const auto& filter_chain : filter_chains) {
2646
- // Discard filter chain entries that specify destination port
2647
- if (filter_chain.filter_chain_match.destination_port != 0) continue;
2648
- grpc_error_handle error = AddFilterChainDataForDestinationIpRange(
2649
- filter_chain, &internal_filter_chain_map.destination_ip_map);
2650
- if (error != GRPC_ERROR_NONE) return error;
2651
- }
2652
- *filter_chain_map =
2653
- BuildFromInternalFilterChainMap(&internal_filter_chain_map);
2654
- return GRPC_ERROR_NONE;
2655
- }
2656
-
2657
- grpc_error_handle LdsResponseParseServer(
2658
- const EncodingContext& context,
2659
- const envoy_config_listener_v3_Listener* listener, bool is_v2,
2660
- XdsApi::LdsUpdate* lds_update) {
2661
- lds_update->type = XdsApi::LdsUpdate::ListenerType::kTcpListener;
2662
- grpc_error_handle error =
2663
- AddressParse(envoy_config_listener_v3_Listener_address(listener),
2664
- &lds_update->address);
2665
- if (error != GRPC_ERROR_NONE) return error;
2666
- const auto* use_original_dst =
2667
- envoy_config_listener_v3_Listener_use_original_dst(listener);
2668
- if (use_original_dst != nullptr) {
2669
- if (google_protobuf_BoolValue_value(use_original_dst)) {
2670
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2671
- "Field \'use_original_dst\' is not supported.");
2672
- }
2673
- }
2674
- size_t size = 0;
2675
- auto* filter_chains =
2676
- envoy_config_listener_v3_Listener_filter_chains(listener, &size);
2677
- std::vector<FilterChain> parsed_filter_chains;
2678
- parsed_filter_chains.reserve(size);
2679
- for (size_t i = 0; i < size; i++) {
2680
- FilterChain filter_chain;
2681
- error = FilterChainParse(context, filter_chains[i], is_v2, &filter_chain);
2682
- if (error != GRPC_ERROR_NONE) return error;
2683
- parsed_filter_chains.push_back(std::move(filter_chain));
2684
- }
2685
- error =
2686
- BuildFilterChainMap(parsed_filter_chains, &lds_update->filter_chain_map);
2687
- if (error != GRPC_ERROR_NONE) return error;
2688
- auto* default_filter_chain =
2689
- envoy_config_listener_v3_Listener_default_filter_chain(listener);
2690
- if (default_filter_chain != nullptr) {
2691
- FilterChain filter_chain;
2692
- error =
2693
- FilterChainParse(context, default_filter_chain, is_v2, &filter_chain);
2694
- if (error != GRPC_ERROR_NONE) return error;
2695
- if (filter_chain.filter_chain_data != nullptr) {
2696
- lds_update->default_filter_chain =
2697
- std::move(*filter_chain.filter_chain_data);
2698
- }
2699
- }
2700
- if (size == 0 && default_filter_chain == nullptr) {
2701
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No filter chain provided.");
2702
- }
2703
- return GRPC_ERROR_NONE;
2704
- }
2705
-
2706
- grpc_error_handle LdsResponseParse(
2707
- const EncodingContext& context,
2708
- const envoy_service_discovery_v3_DiscoveryResponse* response,
2709
- const std::set<absl::string_view>& expected_listener_names,
2710
- XdsApi::LdsUpdateMap* lds_update_map,
2711
- std::set<std::string>* resource_names_failed) {
2712
- std::vector<grpc_error_handle> errors;
2713
- // Get the resources from the response.
2714
- size_t size;
2715
- const google_protobuf_Any* const* resources =
2716
- envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
2717
- for (size_t i = 0; i < size; ++i) {
2718
- // Check the type_url of the resource.
2719
- absl::string_view type_url =
2720
- UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
2721
- bool is_v2 = false;
2722
- if (!IsLds(type_url, &is_v2)) {
2723
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2724
- absl::StrCat("resource index ", i, ": Resource is not LDS.")
2725
- .c_str()));
2726
- continue;
2727
- }
2728
- // Decode the listener.
2729
- const upb_strview encoded_listener =
2730
- google_protobuf_Any_value(resources[i]);
2731
- const envoy_config_listener_v3_Listener* listener =
2732
- envoy_config_listener_v3_Listener_parse(
2733
- encoded_listener.data, encoded_listener.size, context.arena);
2734
- if (listener == nullptr) {
2735
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2736
- absl::StrCat("resource index ", i, ": Can't decode listener.")
2737
- .c_str()));
2738
- continue;
2739
- }
2740
- // Check listener name. Ignore unexpected listeners.
2741
- std::string listener_name =
2742
- UpbStringToStdString(envoy_config_listener_v3_Listener_name(listener));
2743
- if (expected_listener_names.find(listener_name) ==
2744
- expected_listener_names.end()) {
2745
- continue;
2746
- }
2747
- // Fail if listener name is duplicated.
2748
- if (lds_update_map->find(listener_name) != lds_update_map->end()) {
2749
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2750
- absl::StrCat("duplicate listener name \"", listener_name, "\"")
2751
- .c_str()));
2752
- resource_names_failed->insert(listener_name);
2753
- continue;
2754
- }
2755
- // Serialize into JSON and store it in the LdsUpdateMap
2756
- XdsApi::LdsResourceData& lds_resource_data =
2757
- (*lds_update_map)[listener_name];
2758
- XdsApi::LdsUpdate& lds_update = lds_resource_data.resource;
2759
- lds_resource_data.serialized_proto = UpbStringToStdString(encoded_listener);
2760
- // Check whether it's a client or server listener.
2761
- const envoy_config_listener_v3_ApiListener* api_listener =
2762
- envoy_config_listener_v3_Listener_api_listener(listener);
2763
- const envoy_config_core_v3_Address* address =
2764
- envoy_config_listener_v3_Listener_address(listener);
2765
- if (api_listener != nullptr && address != nullptr) {
2766
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2767
- absl::StrCat(listener_name,
2768
- ": Listener has both address and ApiListener")
2769
- .c_str()));
2770
- resource_names_failed->insert(listener_name);
2771
- continue;
2772
- }
2773
- if (api_listener == nullptr && address == nullptr) {
2774
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2775
- absl::StrCat(listener_name,
2776
- ": Listener has neither address nor ApiListener")
2777
- .c_str()));
2778
- resource_names_failed->insert(listener_name);
2779
- continue;
2780
- }
2781
- grpc_error_handle error = GRPC_ERROR_NONE;
2782
- if (api_listener != nullptr) {
2783
- error = LdsResponseParseClient(context, api_listener, is_v2, &lds_update);
2784
- } else {
2785
- error = LdsResponseParseServer(context, listener, is_v2, &lds_update);
2786
- }
2787
- if (error != GRPC_ERROR_NONE) {
2788
- errors.push_back(grpc_error_add_child(
2789
- GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2790
- absl::StrCat(listener_name, ": validation error").c_str()),
2791
- error));
2792
- resource_names_failed->insert(listener_name);
2793
- }
2794
- }
2795
- return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing LDS response", &errors);
2796
- }
2797
-
2798
- grpc_error_handle RdsResponseParse(
2799
- const EncodingContext& context,
2800
- const envoy_service_discovery_v3_DiscoveryResponse* response,
2801
- const std::set<absl::string_view>& expected_route_configuration_names,
2802
- XdsApi::RdsUpdateMap* rds_update_map,
2803
- std::set<std::string>* resource_names_failed) {
2804
- std::vector<grpc_error_handle> errors;
2805
- // Get the resources from the response.
2806
- size_t size;
2807
- const google_protobuf_Any* const* resources =
2808
- envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
2809
- for (size_t i = 0; i < size; ++i) {
2810
- // Check the type_url of the resource.
2811
- absl::string_view type_url =
2812
- UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
2813
- if (!IsRds(type_url)) {
2814
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2815
- absl::StrCat("resource index ", i, ": Resource is not RDS.")
2816
- .c_str()));
2817
- continue;
2818
- }
2819
- // Decode the route_config.
2820
- const upb_strview encoded_route_config =
2821
- google_protobuf_Any_value(resources[i]);
2822
- const envoy_config_route_v3_RouteConfiguration* route_config =
2823
- envoy_config_route_v3_RouteConfiguration_parse(
2824
- encoded_route_config.data, encoded_route_config.size,
2825
- context.arena);
2826
- if (route_config == nullptr) {
2827
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2828
- absl::StrCat("resource index ", i, ": Can't decode route_config.")
2829
- .c_str()));
2830
- continue;
2831
- }
2832
- // Check route_config_name. Ignore unexpected route_config.
2833
- std::string route_config_name = UpbStringToStdString(
2834
- envoy_config_route_v3_RouteConfiguration_name(route_config));
2835
- if (expected_route_configuration_names.find(route_config_name) ==
2836
- expected_route_configuration_names.end()) {
2837
- continue;
2838
- }
2839
- // Fail if route config name is duplicated.
2840
- if (rds_update_map->find(route_config_name) != rds_update_map->end()) {
2841
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2842
- absl::StrCat("duplicate route config name \"", route_config_name,
2843
- "\"")
2844
- .c_str()));
2845
- resource_names_failed->insert(route_config_name);
2846
- continue;
2847
- }
2848
- // Serialize into JSON and store it in the RdsUpdateMap
2849
- XdsApi::RdsResourceData& rds_resource_data =
2850
- (*rds_update_map)[route_config_name];
2851
- XdsApi::RdsUpdate& rds_update = rds_resource_data.resource;
2852
- rds_resource_data.serialized_proto =
2853
- UpbStringToStdString(encoded_route_config);
2854
- // Parse the route_config.
2855
- grpc_error_handle error =
2856
- RouteConfigParse(context, route_config, &rds_update);
2857
- if (error != GRPC_ERROR_NONE) {
2858
- errors.push_back(grpc_error_add_child(
2859
- GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2860
- absl::StrCat(route_config_name, ": validation error").c_str()),
2861
- error));
2862
- resource_names_failed->insert(route_config_name);
2863
- }
2864
- }
2865
- return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing RDS response", &errors);
2866
- }
2867
-
2868
- grpc_error_handle UpstreamTlsContextParse(
2869
- const EncodingContext& context,
2870
- const envoy_config_core_v3_TransportSocket* transport_socket,
2871
- XdsApi::CommonTlsContext* common_tls_context) {
2872
- // Record Upstream tls context
2873
- absl::string_view name = UpbStringToAbsl(
2874
- envoy_config_core_v3_TransportSocket_name(transport_socket));
2875
- if (name != "envoy.transport_sockets.tls") {
2876
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2877
- absl::StrCat("Unrecognized transport socket: ", name).c_str());
2878
- }
2879
- auto* typed_config =
2880
- envoy_config_core_v3_TransportSocket_typed_config(transport_socket);
2881
- if (typed_config != nullptr) {
2882
- const upb_strview encoded_upstream_tls_context =
2883
- google_protobuf_Any_value(typed_config);
2884
- auto* upstream_tls_context =
2885
- envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_parse(
2886
- encoded_upstream_tls_context.data,
2887
- encoded_upstream_tls_context.size, context.arena);
2888
- if (upstream_tls_context == nullptr) {
2889
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2890
- "Can't decode upstream tls context.");
2891
- }
2892
- auto* common_tls_context_proto =
2893
- envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_common_tls_context(
2894
- upstream_tls_context);
2895
- if (common_tls_context_proto != nullptr) {
2896
- grpc_error_handle error = CommonTlsContextParse(
2897
- context, common_tls_context_proto, common_tls_context);
2898
- if (error != GRPC_ERROR_NONE) {
2899
- return grpc_error_add_child(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
2900
- "Error parsing UpstreamTlsContext"),
2901
- error);
2902
- }
2903
- }
2904
- }
2905
- if (common_tls_context->combined_validation_context
2906
- .validation_context_certificate_provider_instance.instance_name
2907
- .empty()) {
2908
- return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2909
- "UpstreamTlsContext: TLS configuration provided but no "
2910
- "validation_context_certificate_provider_instance "
2911
- "found.");
2912
- }
2913
- return GRPC_ERROR_NONE;
2914
- }
2915
-
2916
- grpc_error_handle CdsResponseParse(
2917
- const EncodingContext& context,
2918
- const envoy_service_discovery_v3_DiscoveryResponse* response,
2919
- const std::set<absl::string_view>& expected_cluster_names,
2920
- XdsApi::CdsUpdateMap* cds_update_map,
2921
- std::set<std::string>* resource_names_failed) {
2922
- std::vector<grpc_error_handle> errors;
2923
- // Get the resources from the response.
2924
- size_t size;
2925
- const google_protobuf_Any* const* resources =
2926
- envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
2927
- // Parse all the resources in the CDS response.
2928
- for (size_t i = 0; i < size; ++i) {
2929
- // Check the type_url of the resource.
2930
- absl::string_view type_url =
2931
- UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
2932
- if (!IsCds(type_url)) {
2933
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2934
- absl::StrCat("resource index ", i, ": Resource is not CDS.")
2935
- .c_str()));
2936
- continue;
2937
- }
2938
- // Decode the cluster.
2939
- const upb_strview encoded_cluster = google_protobuf_Any_value(resources[i]);
2940
- const envoy_config_cluster_v3_Cluster* cluster =
2941
- envoy_config_cluster_v3_Cluster_parse(
2942
- encoded_cluster.data, encoded_cluster.size, context.arena);
2943
- if (cluster == nullptr) {
2944
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2945
- absl::StrCat("resource index ", i, ": Can't decode cluster.")
2946
- .c_str()));
2947
- continue;
2948
- }
2949
- MaybeLogCluster(context, cluster);
2950
- // Ignore unexpected cluster names.
2951
- std::string cluster_name =
2952
- UpbStringToStdString(envoy_config_cluster_v3_Cluster_name(cluster));
2953
- if (expected_cluster_names.find(cluster_name) ==
2954
- expected_cluster_names.end()) {
2955
- continue;
2956
- }
2957
- // Fail on duplicate resources.
2958
- if (cds_update_map->find(cluster_name) != cds_update_map->end()) {
2959
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2960
- absl::StrCat("duplicate resource name \"", cluster_name, "\"")
2961
- .c_str()));
2962
- resource_names_failed->insert(cluster_name);
2963
- continue;
2964
- }
2965
- // Add the cluster to cds_update_map.
2966
- XdsApi::CdsResourceData& cds_resource_data =
2967
- (*cds_update_map)[cluster_name];
2968
- XdsApi::CdsUpdate& cds_update = cds_resource_data.resource;
2969
- // Store serialized proto.
2970
- cds_resource_data.serialized_proto = UpbStringToStdString(encoded_cluster);
2971
- // Check the cluster_discovery_type.
2972
- if (!envoy_config_cluster_v3_Cluster_has_type(cluster) &&
2973
- !envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
2974
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2975
- absl::StrCat(cluster_name, ": DiscoveryType not found.").c_str()));
2976
- resource_names_failed->insert(cluster_name);
2977
- continue;
2978
- }
2979
- if (envoy_config_cluster_v3_Cluster_type(cluster) ==
2980
- envoy_config_cluster_v3_Cluster_EDS) {
2981
- cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::EDS;
2982
- // Check the EDS config source.
2983
- const envoy_config_cluster_v3_Cluster_EdsClusterConfig*
2984
- eds_cluster_config =
2985
- envoy_config_cluster_v3_Cluster_eds_cluster_config(cluster);
2986
- const envoy_config_core_v3_ConfigSource* eds_config =
2987
- envoy_config_cluster_v3_Cluster_EdsClusterConfig_eds_config(
2988
- eds_cluster_config);
2989
- if (!envoy_config_core_v3_ConfigSource_has_ads(eds_config)) {
2990
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
2991
- absl::StrCat(cluster_name, ": EDS ConfigSource is not ADS.")
2992
- .c_str()));
2993
- resource_names_failed->insert(cluster_name);
2994
- continue;
2995
- }
2996
- // Record EDS service_name (if any).
2997
- upb_strview service_name =
2998
- envoy_config_cluster_v3_Cluster_EdsClusterConfig_service_name(
2999
- eds_cluster_config);
3000
- if (service_name.size != 0) {
3001
- cds_update.eds_service_name = UpbStringToStdString(service_name);
3002
- }
3003
- } else if (!XdsAggregateAndLogicalDnsClusterEnabled()) {
3004
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3005
- absl::StrCat(cluster_name, ": DiscoveryType is not valid.").c_str()));
3006
- resource_names_failed->insert(cluster_name);
3007
- continue;
3008
- } else if (envoy_config_cluster_v3_Cluster_type(cluster) ==
3009
- envoy_config_cluster_v3_Cluster_LOGICAL_DNS) {
3010
- cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::LOGICAL_DNS;
3011
- const auto* load_assignment =
3012
- envoy_config_cluster_v3_Cluster_load_assignment(cluster);
3013
- if (load_assignment == nullptr) {
3014
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3015
- absl::StrCat(
3016
- cluster_name,
3017
- ": load_assignment not present for LOGICAL_DNS cluster")
3018
- .c_str()));
3019
- resource_names_failed->insert(cluster_name);
3020
- continue;
3021
- }
3022
- size_t num_localities;
3023
- const auto* const* localities =
3024
- envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(
3025
- load_assignment, &num_localities);
3026
- if (num_localities != 1) {
3027
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3028
- absl::StrCat(cluster_name,
3029
- ": load_assignment for LOGICAL_DNS cluster must have "
3030
- "exactly one locality, found ",
3031
- num_localities)
3032
- .c_str()));
3033
- resource_names_failed->insert(cluster_name);
3034
- continue;
3035
- }
3036
- size_t num_endpoints;
3037
- const auto* const* endpoints =
3038
- envoy_config_endpoint_v3_LocalityLbEndpoints_lb_endpoints(
3039
- localities[0], &num_endpoints);
3040
- if (num_endpoints != 1) {
3041
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3042
- absl::StrCat(cluster_name,
3043
- ": locality for LOGICAL_DNS cluster must have "
3044
- "exactly one endpoint, found ",
3045
- num_endpoints)
3046
- .c_str()));
3047
- resource_names_failed->insert(cluster_name);
3048
- continue;
3049
- }
3050
- const auto* endpoint =
3051
- envoy_config_endpoint_v3_LbEndpoint_endpoint(endpoints[0]);
3052
- if (endpoint == nullptr) {
3053
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3054
- absl::StrCat(cluster_name, ": LbEndpoint endpoint field not set")
3055
- .c_str()));
3056
- resource_names_failed->insert(cluster_name);
3057
- continue;
3058
- }
3059
- const auto* address = envoy_config_endpoint_v3_Endpoint_address(endpoint);
3060
- if (address == nullptr) {
3061
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3062
- absl::StrCat(cluster_name, ": Endpoint address field not set")
3063
- .c_str()));
3064
- resource_names_failed->insert(cluster_name);
3065
- continue;
3066
- }
3067
- const auto* socket_address =
3068
- envoy_config_core_v3_Address_socket_address(address);
3069
- if (socket_address == nullptr) {
3070
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3071
- absl::StrCat(cluster_name, ": Address socket_address field not set")
3072
- .c_str()));
3073
- resource_names_failed->insert(cluster_name);
3074
- continue;
3075
- }
3076
- if (envoy_config_core_v3_SocketAddress_resolver_name(socket_address)
3077
- .size != 0) {
3078
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3079
- absl::StrCat(
3080
- cluster_name,
3081
- ": LOGICAL_DNS clusters must NOT have a custom resolver "
3082
- "name set")
3083
- .c_str()));
3084
- resource_names_failed->insert(cluster_name);
3085
- continue;
3086
- }
3087
- absl::string_view address_str = UpbStringToAbsl(
3088
- envoy_config_core_v3_SocketAddress_address(socket_address));
3089
- if (address_str.empty()) {
3090
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3091
- absl::StrCat(cluster_name, ": SocketAddress address field not set")
3092
- .c_str()));
3093
- resource_names_failed->insert(cluster_name);
3094
- continue;
3095
- }
3096
- if (!envoy_config_core_v3_SocketAddress_has_port_value(socket_address)) {
3097
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3098
- absl::StrCat(cluster_name,
3099
- ": SocketAddress port_value field not set")
3100
- .c_str()));
3101
- resource_names_failed->insert(cluster_name);
3102
- continue;
3103
- }
3104
- cds_update.dns_hostname = JoinHostPort(
3105
- address_str,
3106
- envoy_config_core_v3_SocketAddress_port_value(socket_address));
3107
- } else {
3108
- if (envoy_config_cluster_v3_Cluster_has_cluster_type(cluster)) {
3109
- const envoy_config_cluster_v3_Cluster_CustomClusterType*
3110
- custom_cluster_type =
3111
- envoy_config_cluster_v3_Cluster_cluster_type(cluster);
3112
- upb_strview type_name =
3113
- envoy_config_cluster_v3_Cluster_CustomClusterType_name(
3114
- custom_cluster_type);
3115
- if (UpbStringToAbsl(type_name) == "envoy.clusters.aggregate") {
3116
- cds_update.cluster_type = XdsApi::CdsUpdate::ClusterType::AGGREGATE;
3117
- // Retrieve aggregate clusters.
3118
- const google_protobuf_Any* typed_config =
3119
- envoy_config_cluster_v3_Cluster_CustomClusterType_typed_config(
3120
- custom_cluster_type);
3121
- const upb_strview aggregate_cluster_config_upb_strview =
3122
- google_protobuf_Any_value(typed_config);
3123
- const envoy_extensions_clusters_aggregate_v3_ClusterConfig*
3124
- aggregate_cluster_config =
3125
- envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse(
3126
- aggregate_cluster_config_upb_strview.data,
3127
- aggregate_cluster_config_upb_strview.size, context.arena);
3128
- if (aggregate_cluster_config == nullptr) {
3129
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3130
- absl::StrCat(cluster_name, ": Can't parse aggregate cluster.")
3131
- .c_str()));
3132
- resource_names_failed->insert(cluster_name);
3133
- continue;
3134
- }
3135
- size_t size;
3136
- const upb_strview* clusters =
3137
- envoy_extensions_clusters_aggregate_v3_ClusterConfig_clusters(
3138
- aggregate_cluster_config, &size);
3139
- for (size_t i = 0; i < size; ++i) {
3140
- const upb_strview cluster = clusters[i];
3141
- cds_update.prioritized_cluster_names.emplace_back(
3142
- UpbStringToStdString(cluster));
3143
- }
3144
- } else {
3145
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3146
- absl::StrCat(cluster_name, ": DiscoveryType is not valid.")
3147
- .c_str()));
3148
- resource_names_failed->insert(cluster_name);
3149
- continue;
3150
- }
3151
- } else {
3152
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3153
- absl::StrCat(cluster_name, ": DiscoveryType is not valid.")
3154
- .c_str()));
3155
- resource_names_failed->insert(cluster_name);
3156
- continue;
3157
- }
3158
- }
3159
- // Check the LB policy.
3160
- if (envoy_config_cluster_v3_Cluster_lb_policy(cluster) ==
3161
- envoy_config_cluster_v3_Cluster_ROUND_ROBIN) {
3162
- cds_update.lb_policy = "ROUND_ROBIN";
3163
- } else if (envoy_config_cluster_v3_Cluster_lb_policy(cluster) ==
3164
- envoy_config_cluster_v3_Cluster_RING_HASH) {
3165
- cds_update.lb_policy = "RING_HASH";
3166
- // Record ring hash lb config
3167
- auto* ring_hash_config =
3168
- envoy_config_cluster_v3_Cluster_ring_hash_lb_config(cluster);
3169
- if (ring_hash_config != nullptr) {
3170
- const google_protobuf_UInt64Value* max_ring_size =
3171
- envoy_config_cluster_v3_Cluster_RingHashLbConfig_maximum_ring_size(
3172
- ring_hash_config);
3173
- if (max_ring_size != nullptr) {
3174
- cds_update.max_ring_size =
3175
- google_protobuf_UInt64Value_value(max_ring_size);
3176
- if (cds_update.max_ring_size > 8388608 ||
3177
- cds_update.max_ring_size == 0) {
3178
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3179
- absl::StrCat(
3180
- cluster_name,
3181
- ": max_ring_size is not in the range of 1 to 8388608.")
3182
- .c_str()));
3183
- resource_names_failed->insert(cluster_name);
3184
- continue;
3185
- }
3186
- }
3187
- const google_protobuf_UInt64Value* min_ring_size =
3188
- envoy_config_cluster_v3_Cluster_RingHashLbConfig_minimum_ring_size(
3189
- ring_hash_config);
3190
- if (min_ring_size != nullptr) {
3191
- cds_update.min_ring_size =
3192
- google_protobuf_UInt64Value_value(min_ring_size);
3193
- if (cds_update.min_ring_size > 8388608 ||
3194
- cds_update.min_ring_size == 0) {
3195
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3196
- absl::StrCat(
3197
- cluster_name,
3198
- ": min_ring_size is not in the range of 1 to 8388608.")
3199
- .c_str()));
3200
- resource_names_failed->insert(cluster_name);
3201
- continue;
3202
- }
3203
- if (cds_update.min_ring_size > cds_update.max_ring_size) {
3204
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3205
- absl::StrCat(
3206
- cluster_name,
3207
- ": min_ring_size cannot be greater than max_ring_size.")
3208
- .c_str()));
3209
- resource_names_failed->insert(cluster_name);
3210
- continue;
3211
- }
3212
- }
3213
- if (envoy_config_cluster_v3_Cluster_RingHashLbConfig_hash_function(
3214
- ring_hash_config) !=
3215
- envoy_config_cluster_v3_Cluster_RingHashLbConfig_XX_HASH) {
3216
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3217
- absl::StrCat(cluster_name,
3218
- ": ring hash lb config has invalid hash function.")
3219
- .c_str()));
3220
- resource_names_failed->insert(cluster_name);
3221
- continue;
3222
- }
3223
- }
3224
- } else {
3225
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3226
- absl::StrCat(cluster_name, ": LB policy is not supported.").c_str()));
3227
- resource_names_failed->insert(cluster_name);
3228
- continue;
3229
- }
3230
- if (XdsSecurityEnabled()) {
3231
- auto* transport_socket =
3232
- envoy_config_cluster_v3_Cluster_transport_socket(cluster);
3233
- if (transport_socket != nullptr) {
3234
- grpc_error_handle error = UpstreamTlsContextParse(
3235
- context, transport_socket, &cds_update.common_tls_context);
3236
- if (error != GRPC_ERROR_NONE) {
3237
- errors.push_back(grpc_error_add_child(
3238
- GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3239
- absl::StrCat(
3240
- "Error parsing security configuration for cluster: ",
3241
- cluster_name)
3242
- .c_str()),
3243
- error));
3244
- resource_names_failed->insert(cluster_name);
3245
- continue;
3246
- }
3247
- }
3248
- }
3249
- // Record LRS server name (if any).
3250
- const envoy_config_core_v3_ConfigSource* lrs_server =
3251
- envoy_config_cluster_v3_Cluster_lrs_server(cluster);
3252
- if (lrs_server != nullptr) {
3253
- if (!envoy_config_core_v3_ConfigSource_has_self(lrs_server)) {
3254
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3255
- absl::StrCat(cluster_name, ": LRS ConfigSource is not self.")
3256
- .c_str()));
3257
- resource_names_failed->insert(cluster_name);
3258
- continue;
3259
- }
3260
- cds_update.lrs_load_reporting_server_name.emplace("");
3261
- }
3262
- // The Cluster resource encodes the circuit breaking parameters in a list of
3263
- // Thresholds messages, where each message specifies the parameters for a
3264
- // particular RoutingPriority. we will look only at the first entry in the
3265
- // list for priority DEFAULT and default to 1024 if not found.
3266
- if (envoy_config_cluster_v3_Cluster_has_circuit_breakers(cluster)) {
3267
- const envoy_config_cluster_v3_CircuitBreakers* circuit_breakers =
3268
- envoy_config_cluster_v3_Cluster_circuit_breakers(cluster);
3269
- size_t num_thresholds;
3270
- const envoy_config_cluster_v3_CircuitBreakers_Thresholds* const*
3271
- thresholds = envoy_config_cluster_v3_CircuitBreakers_thresholds(
3272
- circuit_breakers, &num_thresholds);
3273
- for (size_t i = 0; i < num_thresholds; ++i) {
3274
- const auto* threshold = thresholds[i];
3275
- if (envoy_config_cluster_v3_CircuitBreakers_Thresholds_priority(
3276
- threshold) == envoy_config_core_v3_DEFAULT) {
3277
- const google_protobuf_UInt32Value* max_requests =
3278
- envoy_config_cluster_v3_CircuitBreakers_Thresholds_max_requests(
3279
- threshold);
3280
- if (max_requests != nullptr) {
3281
- cds_update.max_concurrent_requests =
3282
- google_protobuf_UInt32Value_value(max_requests);
3283
- }
3284
- break;
3285
- }
3286
- }
3287
- }
3288
- }
3289
- return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing CDS response", &errors);
3290
- }
3291
-
3292
- grpc_error_handle ServerAddressParseAndAppend(
3293
- const envoy_config_endpoint_v3_LbEndpoint* lb_endpoint,
3294
- ServerAddressList* list) {
3295
- // If health_status is not HEALTHY or UNKNOWN, skip this endpoint.
3296
- const int32_t health_status =
3297
- envoy_config_endpoint_v3_LbEndpoint_health_status(lb_endpoint);
3298
- if (health_status != envoy_config_core_v3_UNKNOWN &&
3299
- health_status != envoy_config_core_v3_HEALTHY) {
3300
- return GRPC_ERROR_NONE;
3301
- }
3302
- // Find the ip:port.
3303
- const envoy_config_endpoint_v3_Endpoint* endpoint =
3304
- envoy_config_endpoint_v3_LbEndpoint_endpoint(lb_endpoint);
3305
- const envoy_config_core_v3_Address* address =
3306
- envoy_config_endpoint_v3_Endpoint_address(endpoint);
3307
- const envoy_config_core_v3_SocketAddress* socket_address =
3308
- envoy_config_core_v3_Address_socket_address(address);
3309
- std::string address_str = UpbStringToStdString(
3310
- envoy_config_core_v3_SocketAddress_address(socket_address));
3311
- uint32_t port = envoy_config_core_v3_SocketAddress_port_value(socket_address);
3312
- if (GPR_UNLIKELY(port >> 16) != 0) {
3313
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid port.");
3314
- }
3315
- // Find load_balancing_weight for the endpoint.
3316
- const google_protobuf_UInt32Value* load_balancing_weight =
3317
- envoy_config_endpoint_v3_LbEndpoint_load_balancing_weight(lb_endpoint);
3318
- const int32_t weight =
3319
- load_balancing_weight != nullptr
3320
- ? google_protobuf_UInt32Value_value(load_balancing_weight)
3321
- : 500;
3322
- if (weight == 0) {
3323
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
3324
- "Invalid endpoint weight of 0.");
3325
- }
3326
- // Populate grpc_resolved_address.
3327
- grpc_resolved_address addr;
3328
- grpc_error_handle error =
3329
- grpc_string_to_sockaddr(&addr, address_str.c_str(), port);
3330
- if (error != GRPC_ERROR_NONE) return error;
3331
- // Append the address to the list.
3332
- std::map<const char*, std::unique_ptr<ServerAddress::AttributeInterface>>
3333
- attributes;
3334
- attributes[ServerAddressWeightAttribute::kServerAddressWeightAttributeKey] =
3335
- absl::make_unique<ServerAddressWeightAttribute>(weight);
3336
- list->emplace_back(addr, nullptr, std::move(attributes));
3337
- return GRPC_ERROR_NONE;
3338
- }
3339
-
3340
- grpc_error_handle LocalityParse(
3341
- const envoy_config_endpoint_v3_LocalityLbEndpoints* locality_lb_endpoints,
3342
- XdsApi::EdsUpdate::Priority::Locality* output_locality, size_t* priority) {
3343
- // Parse LB weight.
3344
- const google_protobuf_UInt32Value* lb_weight =
3345
- envoy_config_endpoint_v3_LocalityLbEndpoints_load_balancing_weight(
3346
- locality_lb_endpoints);
3347
- // If LB weight is not specified, it means this locality is assigned no load.
3348
- // TODO(juanlishen): When we support CDS to configure the inter-locality
3349
- // policy, we should change the LB weight handling.
3350
- output_locality->lb_weight =
3351
- lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0;
3352
- if (output_locality->lb_weight == 0) return GRPC_ERROR_NONE;
3353
- // Parse locality name.
3354
- const envoy_config_core_v3_Locality* locality =
3355
- envoy_config_endpoint_v3_LocalityLbEndpoints_locality(
3356
- locality_lb_endpoints);
3357
- if (locality == nullptr) {
3358
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty locality.");
3359
- }
3360
- std::string region =
3361
- UpbStringToStdString(envoy_config_core_v3_Locality_region(locality));
3362
- std::string zone =
3363
- UpbStringToStdString(envoy_config_core_v3_Locality_region(locality));
3364
- std::string sub_zone =
3365
- UpbStringToStdString(envoy_config_core_v3_Locality_sub_zone(locality));
3366
- output_locality->name = MakeRefCounted<XdsLocalityName>(
3367
- std::move(region), std::move(zone), std::move(sub_zone));
3368
- // Parse the addresses.
3369
- size_t size;
3370
- const envoy_config_endpoint_v3_LbEndpoint* const* lb_endpoints =
3371
- envoy_config_endpoint_v3_LocalityLbEndpoints_lb_endpoints(
3372
- locality_lb_endpoints, &size);
3373
- for (size_t i = 0; i < size; ++i) {
3374
- grpc_error_handle error = ServerAddressParseAndAppend(
3375
- lb_endpoints[i], &output_locality->endpoints);
3376
- if (error != GRPC_ERROR_NONE) return error;
3377
- }
3378
- // Parse the priority.
3379
- *priority = envoy_config_endpoint_v3_LocalityLbEndpoints_priority(
3380
- locality_lb_endpoints);
3381
- return GRPC_ERROR_NONE;
3382
- }
3383
-
3384
- grpc_error_handle DropParseAndAppend(
3385
- const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload*
3386
- drop_overload,
3387
- XdsApi::EdsUpdate::DropConfig* drop_config) {
3388
- // Get the category.
3389
- std::string category = UpbStringToStdString(
3390
- envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload_category(
3391
- drop_overload));
3392
- if (category.empty()) {
3393
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty drop category name");
3394
- }
3395
- // Get the drop rate (per million).
3396
- const envoy_type_v3_FractionalPercent* drop_percentage =
3397
- envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload_drop_percentage(
3398
- drop_overload);
3399
- uint32_t numerator =
3400
- envoy_type_v3_FractionalPercent_numerator(drop_percentage);
3401
- const auto denominator =
3402
- static_cast<envoy_type_v3_FractionalPercent_DenominatorType>(
3403
- envoy_type_v3_FractionalPercent_denominator(drop_percentage));
3404
- // Normalize to million.
3405
- switch (denominator) {
3406
- case envoy_type_v3_FractionalPercent_HUNDRED:
3407
- numerator *= 10000;
3408
- break;
3409
- case envoy_type_v3_FractionalPercent_TEN_THOUSAND:
3410
- numerator *= 100;
3411
- break;
3412
- case envoy_type_v3_FractionalPercent_MILLION:
3413
- break;
3414
- default:
3415
- return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unknown denominator type");
3416
- }
3417
- // Cap numerator to 1000000.
3418
- numerator = GPR_MIN(numerator, 1000000);
3419
- drop_config->AddCategory(std::move(category), numerator);
3420
- return GRPC_ERROR_NONE;
3421
- }
3422
-
3423
- grpc_error_handle EdsResponseParse(
3424
- const EncodingContext& context,
3425
- const envoy_service_discovery_v3_DiscoveryResponse* response,
3426
- const std::set<absl::string_view>& expected_eds_service_names,
3427
- XdsApi::EdsUpdateMap* eds_update_map,
3428
- std::set<std::string>* resource_names_failed) {
3429
- std::vector<grpc_error_handle> errors;
3430
- // Get the resources from the response.
3431
- size_t size;
3432
- const google_protobuf_Any* const* resources =
3433
- envoy_service_discovery_v3_DiscoveryResponse_resources(response, &size);
3434
- for (size_t i = 0; i < size; ++i) {
3435
- // Check the type_url of the resource.
3436
- absl::string_view type_url =
3437
- UpbStringToAbsl(google_protobuf_Any_type_url(resources[i]));
3438
- if (!IsEds(type_url)) {
3439
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3440
- absl::StrCat("resource index ", i, ": Resource is not EDS.")
3441
- .c_str()));
3442
- continue;
3443
- }
3444
- // Get the cluster_load_assignment.
3445
- upb_strview encoded_cluster_load_assignment =
3446
- google_protobuf_Any_value(resources[i]);
3447
- envoy_config_endpoint_v3_ClusterLoadAssignment* cluster_load_assignment =
3448
- envoy_config_endpoint_v3_ClusterLoadAssignment_parse(
3449
- encoded_cluster_load_assignment.data,
3450
- encoded_cluster_load_assignment.size, context.arena);
3451
- if (cluster_load_assignment == nullptr) {
3452
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3453
- absl::StrCat("resource index ", i,
3454
- ": Can't parse cluster_load_assignment.")
3455
- .c_str()));
3456
- continue;
3457
- }
3458
- MaybeLogClusterLoadAssignment(context, cluster_load_assignment);
3459
- // Check the EDS service name. Ignore unexpected names.
3460
- std::string eds_service_name = UpbStringToStdString(
3461
- envoy_config_endpoint_v3_ClusterLoadAssignment_cluster_name(
3462
- cluster_load_assignment));
3463
- if (expected_eds_service_names.find(eds_service_name) ==
3464
- expected_eds_service_names.end()) {
3465
- continue;
3466
- }
3467
- // Fail on duplicate resources.
3468
- if (eds_update_map->find(eds_service_name) != eds_update_map->end()) {
3469
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3470
- absl::StrCat("duplicate resource name \"", eds_service_name, "\"")
3471
- .c_str()));
3472
- resource_names_failed->insert(eds_service_name);
3473
- continue;
3474
- }
3475
- // Serialize into JSON and store it in the EdsUpdateMap
3476
- XdsApi::EdsResourceData& eds_resource_data =
3477
- (*eds_update_map)[eds_service_name];
3478
- XdsApi::EdsUpdate& eds_update = eds_resource_data.resource;
3479
- eds_resource_data.serialized_proto =
3480
- UpbStringToStdString(encoded_cluster_load_assignment);
3481
- // Get the endpoints.
3482
- size_t locality_size;
3483
- const envoy_config_endpoint_v3_LocalityLbEndpoints* const* endpoints =
3484
- envoy_config_endpoint_v3_ClusterLoadAssignment_endpoints(
3485
- cluster_load_assignment, &locality_size);
3486
- grpc_error_handle error = GRPC_ERROR_NONE;
3487
- for (size_t j = 0; j < locality_size; ++j) {
3488
- size_t priority;
3489
- XdsApi::EdsUpdate::Priority::Locality locality;
3490
- error = LocalityParse(endpoints[j], &locality, &priority);
3491
- if (error != GRPC_ERROR_NONE) break;
3492
- // Filter out locality with weight 0.
3493
- if (locality.lb_weight == 0) continue;
3494
- // Make sure prorities is big enough. Note that they might not
3495
- // arrive in priority order.
3496
- while (eds_update.priorities.size() < priority + 1) {
3497
- eds_update.priorities.emplace_back();
3498
- }
3499
- eds_update.priorities[priority].localities.emplace(locality.name.get(),
3500
- std::move(locality));
3501
- }
3502
- if (error != GRPC_ERROR_NONE) {
3503
- errors.push_back(grpc_error_add_child(
3504
- GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3505
- absl::StrCat(eds_service_name, ": locality validation error")
3506
- .c_str()),
3507
- error));
3508
- resource_names_failed->insert(eds_service_name);
3509
- continue;
3510
- }
3511
- for (const auto& priority : eds_update.priorities) {
3512
- if (priority.localities.empty()) {
3513
- errors.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3514
- absl::StrCat(eds_service_name, ": sparse priority list").c_str()));
3515
- resource_names_failed->insert(eds_service_name);
3516
- continue;
3517
- }
3518
- }
3519
- // Get the drop config.
3520
- eds_update.drop_config = MakeRefCounted<XdsApi::EdsUpdate::DropConfig>();
3521
- const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy* policy =
3522
- envoy_config_endpoint_v3_ClusterLoadAssignment_policy(
3523
- cluster_load_assignment);
3524
- if (policy != nullptr) {
3525
- size_t drop_size;
3526
- const envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_DropOverload* const*
3527
- drop_overload =
3528
- envoy_config_endpoint_v3_ClusterLoadAssignment_Policy_drop_overloads(
3529
- policy, &drop_size);
3530
- for (size_t j = 0; j < drop_size; ++j) {
3531
- error =
3532
- DropParseAndAppend(drop_overload[j], eds_update.drop_config.get());
3533
- if (error != GRPC_ERROR_NONE) break;
3534
- }
3535
- if (error != GRPC_ERROR_NONE) {
3536
- errors.push_back(grpc_error_add_child(
3537
- GRPC_ERROR_CREATE_FROM_COPIED_STRING(
3538
- absl::StrCat(eds_service_name, ": drop config validation error")
3539
- .c_str()),
3540
- error));
3541
- resource_names_failed->insert(eds_service_name);
3542
- continue;
3543
- }
3544
- }
3545
- }
3546
- return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing EDS response", &errors);
3547
- }
3548
-
3549
- std::string TypeUrlInternalToExternal(absl::string_view type_url) {
3550
- if (type_url == kLdsV2TypeUrl) {
3551
- return XdsApi::kLdsTypeUrl;
3552
- } else if (type_url == kRdsV2TypeUrl) {
3553
- return XdsApi::kRdsTypeUrl;
3554
- } else if (type_url == kCdsV2TypeUrl) {
3555
- return XdsApi::kCdsTypeUrl;
3556
- } else if (type_url == kEdsV2TypeUrl) {
3557
- return XdsApi::kEdsTypeUrl;
3558
- }
3559
- return std::string(type_url);
3560
- }
3561
-
3562
- template <typename UpdateMap>
3563
- void MoveUpdatesToFailedSet(UpdateMap* update_map,
3564
- std::set<std::string>* resource_names_failed) {
3565
- for (const auto& p : *update_map) {
3566
- resource_names_failed->insert(p.first);
3567
- }
3568
- update_map->clear();
3569
- }
3570
-
3571
- } // namespace
3572
-
3573
- XdsApi::AdsParseResult XdsApi::ParseAdsResponse(
3574
- const XdsBootstrap::XdsServer& server, const grpc_slice& encoded_response,
3575
- const std::set<absl::string_view>& expected_listener_names,
3576
- const std::set<absl::string_view>& expected_route_configuration_names,
3577
- const std::set<absl::string_view>& expected_cluster_names,
3578
- const std::set<absl::string_view>& expected_eds_service_names) {
3579
- AdsParseResult result;
360
+ absl::Status XdsApi::ParseAdsResponse(const XdsBootstrap::XdsServer& server,
361
+ const grpc_slice& encoded_response,
362
+ AdsResponseParserInterface* parser) {
3580
363
  upb::Arena arena;
3581
- const EncodingContext context = {client_,
3582
- tracer_,
3583
- symtab_.ptr(),
3584
- arena.ptr(),
3585
- server.ShouldUseV3(),
3586
- certificate_provider_definition_map_};
364
+ const XdsEncodingContext context = {client_,
365
+ server,
366
+ tracer_,
367
+ symtab_->ptr(),
368
+ arena.ptr(),
369
+ server.ShouldUseV3(),
370
+ certificate_provider_definition_map_};
3587
371
  // Decode the response.
3588
372
  const envoy_service_discovery_v3_DiscoveryResponse* response =
3589
373
  envoy_service_discovery_v3_DiscoveryResponse_parse(
3590
374
  reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(encoded_response)),
3591
375
  GRPC_SLICE_LENGTH(encoded_response), arena.ptr());
3592
- // If decoding fails, output an empty type_url and return.
376
+ // If decoding fails, report a fatal error and return.
3593
377
  if (response == nullptr) {
3594
- result.parse_error =
3595
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Can't decode DiscoveryResponse.");
3596
- return result;
378
+ return absl::InvalidArgumentError("Can't decode DiscoveryResponse.");
3597
379
  }
3598
380
  MaybeLogDiscoveryResponse(context, response);
3599
- // Record the type_url, the version_info, and the nonce of the response.
3600
- result.type_url = TypeUrlInternalToExternal(UpbStringToAbsl(
3601
- envoy_service_discovery_v3_DiscoveryResponse_type_url(response)));
3602
- result.version = UpbStringToStdString(
381
+ // Report the type_url, version, nonce, and number of resources to the parser.
382
+ AdsResponseParserInterface::AdsResponseFields fields;
383
+ fields.type_url = std::string(absl::StripPrefix(
384
+ UpbStringToAbsl(
385
+ envoy_service_discovery_v3_DiscoveryResponse_type_url(response)),
386
+ "type.googleapis.com/"));
387
+ fields.version = UpbStringToStdString(
3603
388
  envoy_service_discovery_v3_DiscoveryResponse_version_info(response));
3604
- result.nonce = UpbStringToStdString(
389
+ fields.nonce = UpbStringToStdString(
3605
390
  envoy_service_discovery_v3_DiscoveryResponse_nonce(response));
3606
- // Parse the response according to the resource type.
3607
- if (IsLds(result.type_url)) {
3608
- result.parse_error =
3609
- LdsResponseParse(context, response, expected_listener_names,
3610
- &result.lds_update_map, &result.resource_names_failed);
3611
- if (result.parse_error != GRPC_ERROR_NONE) {
3612
- MoveUpdatesToFailedSet(&result.lds_update_map,
3613
- &result.resource_names_failed);
3614
- }
3615
- } else if (IsRds(result.type_url)) {
3616
- result.parse_error =
3617
- RdsResponseParse(context, response, expected_route_configuration_names,
3618
- &result.rds_update_map, &result.resource_names_failed);
3619
- if (result.parse_error != GRPC_ERROR_NONE) {
3620
- MoveUpdatesToFailedSet(&result.rds_update_map,
3621
- &result.resource_names_failed);
3622
- }
3623
- } else if (IsCds(result.type_url)) {
3624
- result.parse_error =
3625
- CdsResponseParse(context, response, expected_cluster_names,
3626
- &result.cds_update_map, &result.resource_names_failed);
3627
- if (result.parse_error != GRPC_ERROR_NONE) {
3628
- MoveUpdatesToFailedSet(&result.cds_update_map,
3629
- &result.resource_names_failed);
3630
- }
3631
- } else if (IsEds(result.type_url)) {
3632
- result.parse_error =
3633
- EdsResponseParse(context, response, expected_eds_service_names,
3634
- &result.eds_update_map, &result.resource_names_failed);
3635
- if (result.parse_error != GRPC_ERROR_NONE) {
3636
- MoveUpdatesToFailedSet(&result.eds_update_map,
3637
- &result.resource_names_failed);
3638
- }
3639
- }
3640
- return result;
391
+ size_t num_resources;
392
+ const google_protobuf_Any* const* resources =
393
+ envoy_service_discovery_v3_DiscoveryResponse_resources(response,
394
+ &num_resources);
395
+ fields.num_resources = num_resources;
396
+ absl::Status status = parser->ProcessAdsResponseFields(std::move(fields));
397
+ if (!status.ok()) return status;
398
+ // Process each resource.
399
+ for (size_t i = 0; i < num_resources; ++i) {
400
+ absl::string_view type_url = absl::StripPrefix(
401
+ UpbStringToAbsl(google_protobuf_Any_type_url(resources[i])),
402
+ "type.googleapis.com/");
403
+ absl::string_view serialized_resource =
404
+ UpbStringToAbsl(google_protobuf_Any_value(resources[i]));
405
+ // Unwrap Resource messages, if so wrapped.
406
+ if (type_url == "envoy.api.v2.Resource" ||
407
+ type_url == "envoy.service.discovery.v3.Resource") {
408
+ const auto* resource_wrapper = envoy_service_discovery_v3_Resource_parse(
409
+ serialized_resource.data(), serialized_resource.size(), arena.ptr());
410
+ if (resource_wrapper == nullptr) {
411
+ return absl::InvalidArgumentError(
412
+ "Can't decode Resource proto wrapper");
413
+ }
414
+ const auto* resource =
415
+ envoy_service_discovery_v3_Resource_resource(resource_wrapper);
416
+ type_url = absl::StripPrefix(
417
+ UpbStringToAbsl(google_protobuf_Any_type_url(resource)),
418
+ "type.googleapis.com/");
419
+ serialized_resource =
420
+ UpbStringToAbsl(google_protobuf_Any_value(resource));
421
+ }
422
+ parser->ParseResource(context, i, type_url, serialized_resource);
423
+ }
424
+ return absl::OkStatus();
3641
425
  }
3642
426
 
3643
427
  namespace {
3644
428
 
3645
429
  void MaybeLogLrsRequest(
3646
- const EncodingContext& context,
430
+ const XdsEncodingContext& context,
3647
431
  const envoy_service_load_stats_v3_LoadStatsRequest* request) {
3648
432
  if (GRPC_TRACE_FLAG_ENABLED(*context.tracer) &&
3649
433
  gpr_should_log(GPR_LOG_SEVERITY_DEBUG)) {
3650
- const upb_msgdef* msg_type =
434
+ const upb_MessageDef* msg_type =
3651
435
  envoy_service_load_stats_v3_LoadStatsRequest_getmsgdef(context.symtab);
3652
436
  char buf[10240];
3653
- upb_text_encode(request, msg_type, nullptr, 0, buf, sizeof(buf));
437
+ upb_TextEncode(request, msg_type, nullptr, 0, buf, sizeof(buf));
3654
438
  gpr_log(GPR_DEBUG, "[xds_client %p] constructed LRS request: %s",
3655
439
  context.client, buf);
3656
440
  }
3657
441
  }
3658
442
 
3659
443
  grpc_slice SerializeLrsRequest(
3660
- const EncodingContext& context,
444
+ const XdsEncodingContext& context,
3661
445
  const envoy_service_load_stats_v3_LoadStatsRequest* request) {
3662
446
  size_t output_length;
3663
447
  char* output = envoy_service_load_stats_v3_LoadStatsRequest_serialize(
@@ -3670,12 +454,13 @@ grpc_slice SerializeLrsRequest(
3670
454
  grpc_slice XdsApi::CreateLrsInitialRequest(
3671
455
  const XdsBootstrap::XdsServer& server) {
3672
456
  upb::Arena arena;
3673
- const EncodingContext context = {client_,
3674
- tracer_,
3675
- symtab_.ptr(),
3676
- arena.ptr(),
3677
- server.ShouldUseV3(),
3678
- certificate_provider_definition_map_};
457
+ const XdsEncodingContext context = {client_,
458
+ server,
459
+ tracer_,
460
+ symtab_->ptr(),
461
+ arena.ptr(),
462
+ server.ShouldUseV3(),
463
+ certificate_provider_definition_map_};
3679
464
  // Create a request.
3680
465
  envoy_service_load_stats_v3_LoadStatsRequest* request =
3681
466
  envoy_service_load_stats_v3_LoadStatsRequest_new(arena.ptr());
@@ -3686,7 +471,8 @@ grpc_slice XdsApi::CreateLrsInitialRequest(
3686
471
  PopulateNode(context, node_, build_version_, user_agent_name_,
3687
472
  user_agent_version_, node_msg);
3688
473
  envoy_config_core_v3_Node_add_client_features(
3689
- node_msg, upb_strview_makez("envoy.lrs.supports_send_all_clusters"),
474
+ node_msg,
475
+ upb_StringView_FromString("envoy.lrs.supports_send_all_clusters"),
3690
476
  arena.ptr());
3691
477
  MaybeLogLrsRequest(context, request);
3692
478
  return SerializeLrsRequest(context, request);
@@ -3695,7 +481,7 @@ grpc_slice XdsApi::CreateLrsInitialRequest(
3695
481
  namespace {
3696
482
 
3697
483
  void LocalityStatsPopulate(
3698
- const EncodingContext& context,
484
+ const XdsEncodingContext& context,
3699
485
  envoy_config_endpoint_v3_UpstreamLocalityStats* output,
3700
486
  const XdsLocalityName& locality_name,
3701
487
  const XdsClusterLocalityStats::Snapshot& snapshot) {
@@ -3745,9 +531,16 @@ void LocalityStatsPopulate(
3745
531
  grpc_slice XdsApi::CreateLrsRequest(
3746
532
  ClusterLoadReportMap cluster_load_report_map) {
3747
533
  upb::Arena arena;
3748
- const EncodingContext context = {
3749
- client_, tracer_, symtab_.ptr(),
3750
- arena.ptr(), false, certificate_provider_definition_map_};
534
+ // The xDS server info is not actually needed here, so we seed it with an
535
+ // empty value.
536
+ XdsBootstrap::XdsServer empty_server;
537
+ const XdsEncodingContext context = {client_,
538
+ empty_server,
539
+ tracer_,
540
+ symtab_->ptr(),
541
+ arena.ptr(),
542
+ false,
543
+ certificate_provider_definition_map_};
3751
544
  // Create a request.
3752
545
  envoy_service_load_stats_v3_LoadStatsRequest* request =
3753
546
  envoy_service_load_stats_v3_LoadStatsRequest_new(arena.ptr());
@@ -3795,8 +588,7 @@ grpc_slice XdsApi::CreateLrsRequest(
3795
588
  envoy_config_endpoint_v3_ClusterStats_set_total_dropped_requests(
3796
589
  cluster_stats, total_dropped_requests);
3797
590
  // Set real load report interval.
3798
- gpr_timespec timespec =
3799
- grpc_millis_to_timespec(load_report.load_report_interval, GPR_TIMESPAN);
591
+ gpr_timespec timespec = load_report.load_report_interval.as_timespec();
3800
592
  google_protobuf_Duration* load_report_interval =
3801
593
  envoy_config_endpoint_v3_ClusterStats_mutable_load_report_interval(
3802
594
  cluster_stats, arena.ptr());
@@ -3807,10 +599,10 @@ grpc_slice XdsApi::CreateLrsRequest(
3807
599
  return SerializeLrsRequest(context, request);
3808
600
  }
3809
601
 
3810
- grpc_error_handle XdsApi::ParseLrsResponse(
3811
- const grpc_slice& encoded_response, bool* send_all_clusters,
3812
- std::set<std::string>* cluster_names,
3813
- grpc_millis* load_reporting_interval) {
602
+ grpc_error_handle XdsApi::ParseLrsResponse(const grpc_slice& encoded_response,
603
+ bool* send_all_clusters,
604
+ std::set<std::string>* cluster_names,
605
+ Duration* load_reporting_interval) {
3814
606
  upb::Arena arena;
3815
607
  // Decode the response.
3816
608
  const envoy_service_load_stats_v3_LoadStatsResponse* decoded_response =
@@ -3828,7 +620,7 @@ grpc_error_handle XdsApi::ParseLrsResponse(
3828
620
  } else {
3829
621
  // Store the cluster names.
3830
622
  size_t size;
3831
- const upb_strview* clusters =
623
+ const upb_StringView* clusters =
3832
624
  envoy_service_load_stats_v3_LoadStatsResponse_clusters(decoded_response,
3833
625
  &size);
3834
626
  for (size_t i = 0; i < size; ++i) {
@@ -3839,237 +631,24 @@ grpc_error_handle XdsApi::ParseLrsResponse(
3839
631
  const google_protobuf_Duration* load_reporting_interval_duration =
3840
632
  envoy_service_load_stats_v3_LoadStatsResponse_load_reporting_interval(
3841
633
  decoded_response);
3842
- gpr_timespec timespec{
634
+ *load_reporting_interval = Duration::FromSecondsAndNanoseconds(
3843
635
  google_protobuf_Duration_seconds(load_reporting_interval_duration),
3844
- google_protobuf_Duration_nanos(load_reporting_interval_duration),
3845
- GPR_TIMESPAN};
3846
- *load_reporting_interval = gpr_time_to_millis(timespec);
636
+ google_protobuf_Duration_nanos(load_reporting_interval_duration));
3847
637
  return GRPC_ERROR_NONE;
3848
638
  }
3849
639
 
3850
640
  namespace {
3851
- google_protobuf_Timestamp* GrpcMillisToTimestamp(const EncodingContext& context,
3852
- grpc_millis value) {
641
+
642
+ google_protobuf_Timestamp* EncodeTimestamp(const XdsEncodingContext& context,
643
+ Timestamp value) {
3853
644
  google_protobuf_Timestamp* timestamp =
3854
645
  google_protobuf_Timestamp_new(context.arena);
3855
- gpr_timespec timespec = grpc_millis_to_timespec(value, GPR_CLOCK_REALTIME);
646
+ gpr_timespec timespec = value.as_timespec(GPR_CLOCK_REALTIME);
3856
647
  google_protobuf_Timestamp_set_seconds(timestamp, timespec.tv_sec);
3857
648
  google_protobuf_Timestamp_set_nanos(timestamp, timespec.tv_nsec);
3858
649
  return timestamp;
3859
650
  }
3860
651
 
3861
- envoy_admin_v3_UpdateFailureState* CreateUpdateFailureStateUpb(
3862
- const EncodingContext& context,
3863
- const XdsApi::ResourceMetadata* resource_metadata) {
3864
- auto* update_failure_state =
3865
- envoy_admin_v3_UpdateFailureState_new(context.arena);
3866
- envoy_admin_v3_UpdateFailureState_set_details(
3867
- update_failure_state,
3868
- StdStringToUpbString(resource_metadata->failed_details));
3869
- envoy_admin_v3_UpdateFailureState_set_version_info(
3870
- update_failure_state,
3871
- StdStringToUpbString(resource_metadata->failed_version));
3872
- envoy_admin_v3_UpdateFailureState_set_last_update_attempt(
3873
- update_failure_state,
3874
- GrpcMillisToTimestamp(context, resource_metadata->failed_update_time));
3875
- return update_failure_state;
3876
- }
3877
-
3878
- void DumpLdsConfig(const EncodingContext& context,
3879
- const XdsApi::ResourceTypeMetadata& resource_type_metadata,
3880
- envoy_service_status_v3_PerXdsConfig* per_xds_config) {
3881
- upb_strview kLdsTypeUrlUpb = upb_strview_makez(XdsApi::kLdsTypeUrl);
3882
- auto* listener_config_dump =
3883
- envoy_service_status_v3_PerXdsConfig_mutable_listener_config(
3884
- per_xds_config, context.arena);
3885
- envoy_admin_v3_ListenersConfigDump_set_version_info(
3886
- listener_config_dump,
3887
- StdStringToUpbString(resource_type_metadata.version));
3888
- for (auto& p : resource_type_metadata.resource_metadata_map) {
3889
- absl::string_view name = p.first;
3890
- const XdsApi::ResourceMetadata* meta = p.second;
3891
- const upb_strview name_upb = StdStringToUpbString(name);
3892
- auto* dynamic_listener =
3893
- envoy_admin_v3_ListenersConfigDump_add_dynamic_listeners(
3894
- listener_config_dump, context.arena);
3895
- envoy_admin_v3_ListenersConfigDump_DynamicListener_set_name(
3896
- dynamic_listener, name_upb);
3897
- envoy_admin_v3_ListenersConfigDump_DynamicListener_set_client_status(
3898
- dynamic_listener, meta->client_status);
3899
- if (!meta->serialized_proto.empty()) {
3900
- // Set in-effective listeners
3901
- auto* dynamic_listener_state =
3902
- envoy_admin_v3_ListenersConfigDump_DynamicListener_mutable_active_state(
3903
- dynamic_listener, context.arena);
3904
- envoy_admin_v3_ListenersConfigDump_DynamicListenerState_set_version_info(
3905
- dynamic_listener_state, StdStringToUpbString(meta->version));
3906
- envoy_admin_v3_ListenersConfigDump_DynamicListenerState_set_last_updated(
3907
- dynamic_listener_state,
3908
- GrpcMillisToTimestamp(context, meta->update_time));
3909
- auto* listener_any =
3910
- envoy_admin_v3_ListenersConfigDump_DynamicListenerState_mutable_listener(
3911
- dynamic_listener_state, context.arena);
3912
- google_protobuf_Any_set_type_url(listener_any, kLdsTypeUrlUpb);
3913
- google_protobuf_Any_set_value(
3914
- listener_any, StdStringToUpbString(meta->serialized_proto));
3915
- }
3916
- if (meta->client_status == XdsApi::ResourceMetadata::NACKED) {
3917
- // Set error_state if NACKED
3918
- envoy_admin_v3_ListenersConfigDump_DynamicListener_set_error_state(
3919
- dynamic_listener, CreateUpdateFailureStateUpb(context, meta));
3920
- }
3921
- }
3922
- }
3923
-
3924
- void DumpRdsConfig(const EncodingContext& context,
3925
- const XdsApi::ResourceTypeMetadata& resource_type_metadata,
3926
- envoy_service_status_v3_PerXdsConfig* per_xds_config) {
3927
- upb_strview kRdsTypeUrlUpb = upb_strview_makez(XdsApi::kRdsTypeUrl);
3928
- auto* route_config_dump =
3929
- envoy_service_status_v3_PerXdsConfig_mutable_route_config(per_xds_config,
3930
- context.arena);
3931
- for (auto& p : resource_type_metadata.resource_metadata_map) {
3932
- absl::string_view name = p.first;
3933
- const XdsApi::ResourceMetadata* meta = p.second;
3934
- const upb_strview name_upb = StdStringToUpbString(name);
3935
- auto* dynamic_route_config =
3936
- envoy_admin_v3_RoutesConfigDump_add_dynamic_route_configs(
3937
- route_config_dump, context.arena);
3938
- envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig_set_client_status(
3939
- dynamic_route_config, meta->client_status);
3940
- auto* route_config_any =
3941
- envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig_mutable_route_config(
3942
- dynamic_route_config, context.arena);
3943
- if (!meta->serialized_proto.empty()) {
3944
- // Set in-effective route configs
3945
- envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig_set_version_info(
3946
- dynamic_route_config, StdStringToUpbString(meta->version));
3947
- envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig_set_last_updated(
3948
- dynamic_route_config,
3949
- GrpcMillisToTimestamp(context, meta->update_time));
3950
- google_protobuf_Any_set_type_url(route_config_any, kRdsTypeUrlUpb);
3951
- google_protobuf_Any_set_value(
3952
- route_config_any, StdStringToUpbString(meta->serialized_proto));
3953
- } else {
3954
- // If there isn't a working route config, we still need to print the
3955
- // name.
3956
- auto* route_config =
3957
- envoy_config_route_v3_RouteConfiguration_new(context.arena);
3958
- envoy_config_route_v3_RouteConfiguration_set_name(route_config, name_upb);
3959
- size_t length;
3960
- char* bytes = envoy_config_route_v3_RouteConfiguration_serialize(
3961
- route_config, context.arena, &length);
3962
- google_protobuf_Any_set_type_url(route_config_any, kRdsTypeUrlUpb);
3963
- google_protobuf_Any_set_value(route_config_any,
3964
- upb_strview_make(bytes, length));
3965
- }
3966
- if (meta->client_status == XdsApi::ResourceMetadata::NACKED) {
3967
- // Set error_state if NACKED
3968
- envoy_admin_v3_RoutesConfigDump_DynamicRouteConfig_set_error_state(
3969
- dynamic_route_config, CreateUpdateFailureStateUpb(context, meta));
3970
- }
3971
- }
3972
- }
3973
-
3974
- void DumpCdsConfig(const EncodingContext& context,
3975
- const XdsApi::ResourceTypeMetadata& resource_type_metadata,
3976
- envoy_service_status_v3_PerXdsConfig* per_xds_config) {
3977
- upb_strview kCdsTypeUrlUpb = upb_strview_makez(XdsApi::kCdsTypeUrl);
3978
- auto* cluster_config_dump =
3979
- envoy_service_status_v3_PerXdsConfig_mutable_cluster_config(
3980
- per_xds_config, context.arena);
3981
- envoy_admin_v3_ClustersConfigDump_set_version_info(
3982
- cluster_config_dump,
3983
- StdStringToUpbString(resource_type_metadata.version));
3984
- for (auto& p : resource_type_metadata.resource_metadata_map) {
3985
- absl::string_view name = p.first;
3986
- const XdsApi::ResourceMetadata* meta = p.second;
3987
- const upb_strview name_upb = StdStringToUpbString(name);
3988
- auto* dynamic_cluster =
3989
- envoy_admin_v3_ClustersConfigDump_add_dynamic_active_clusters(
3990
- cluster_config_dump, context.arena);
3991
- envoy_admin_v3_ClustersConfigDump_DynamicCluster_set_client_status(
3992
- dynamic_cluster, meta->client_status);
3993
- auto* cluster_any =
3994
- envoy_admin_v3_ClustersConfigDump_DynamicCluster_mutable_cluster(
3995
- dynamic_cluster, context.arena);
3996
- if (!meta->serialized_proto.empty()) {
3997
- // Set in-effective clusters
3998
- envoy_admin_v3_ClustersConfigDump_DynamicCluster_set_version_info(
3999
- dynamic_cluster, StdStringToUpbString(meta->version));
4000
- envoy_admin_v3_ClustersConfigDump_DynamicCluster_set_last_updated(
4001
- dynamic_cluster, GrpcMillisToTimestamp(context, meta->update_time));
4002
- google_protobuf_Any_set_type_url(cluster_any, kCdsTypeUrlUpb);
4003
- google_protobuf_Any_set_value(
4004
- cluster_any, StdStringToUpbString(meta->serialized_proto));
4005
- } else {
4006
- // If there isn't a working cluster, we still need to print the name.
4007
- auto* cluster = envoy_config_cluster_v3_Cluster_new(context.arena);
4008
- envoy_config_cluster_v3_Cluster_set_name(cluster, name_upb);
4009
- size_t length;
4010
- char* bytes = envoy_config_cluster_v3_Cluster_serialize(
4011
- cluster, context.arena, &length);
4012
- google_protobuf_Any_set_type_url(cluster_any, kCdsTypeUrlUpb);
4013
- google_protobuf_Any_set_value(cluster_any,
4014
- upb_strview_make(bytes, length));
4015
- }
4016
- if (meta->client_status == XdsApi::ResourceMetadata::NACKED) {
4017
- // Set error_state if NACKED
4018
- envoy_admin_v3_ClustersConfigDump_DynamicCluster_set_error_state(
4019
- dynamic_cluster, CreateUpdateFailureStateUpb(context, meta));
4020
- }
4021
- }
4022
- }
4023
-
4024
- void DumpEdsConfig(const EncodingContext& context,
4025
- const XdsApi::ResourceTypeMetadata& resource_type_metadata,
4026
- envoy_service_status_v3_PerXdsConfig* per_xds_config) {
4027
- upb_strview kEdsTypeUrlUpb = upb_strview_makez(XdsApi::kEdsTypeUrl);
4028
- auto* endpoint_config_dump =
4029
- envoy_service_status_v3_PerXdsConfig_mutable_endpoint_config(
4030
- per_xds_config, context.arena);
4031
- for (auto& p : resource_type_metadata.resource_metadata_map) {
4032
- absl::string_view name = p.first;
4033
- const XdsApi::ResourceMetadata* meta = p.second;
4034
- const upb_strview name_upb = StdStringToUpbString(name);
4035
- auto* dynamic_endpoint =
4036
- envoy_admin_v3_EndpointsConfigDump_add_dynamic_endpoint_configs(
4037
- endpoint_config_dump, context.arena);
4038
- envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig_set_client_status(
4039
- dynamic_endpoint, meta->client_status);
4040
- auto* endpoint_any =
4041
- envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig_mutable_endpoint_config(
4042
- dynamic_endpoint, context.arena);
4043
- if (!meta->serialized_proto.empty()) {
4044
- // Set in-effective endpoints
4045
- envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig_set_version_info(
4046
- dynamic_endpoint, StdStringToUpbString(meta->version));
4047
- envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig_set_last_updated(
4048
- dynamic_endpoint, GrpcMillisToTimestamp(context, meta->update_time));
4049
- google_protobuf_Any_set_type_url(endpoint_any, kEdsTypeUrlUpb);
4050
- google_protobuf_Any_set_value(
4051
- endpoint_any, StdStringToUpbString(meta->serialized_proto));
4052
- } else {
4053
- // If there isn't a working endpoint, we still need to print the name.
4054
- auto* cluster_load_assignment =
4055
- envoy_config_endpoint_v3_ClusterLoadAssignment_new(context.arena);
4056
- envoy_config_endpoint_v3_ClusterLoadAssignment_set_cluster_name(
4057
- cluster_load_assignment, name_upb);
4058
- size_t length;
4059
- char* bytes = envoy_config_endpoint_v3_ClusterLoadAssignment_serialize(
4060
- cluster_load_assignment, context.arena, &length);
4061
- google_protobuf_Any_set_type_url(endpoint_any, kEdsTypeUrlUpb);
4062
- google_protobuf_Any_set_value(endpoint_any,
4063
- upb_strview_make(bytes, length));
4064
- }
4065
- if (meta->client_status == XdsApi::ResourceMetadata::NACKED) {
4066
- // Set error_state if NACKED
4067
- envoy_admin_v3_EndpointsConfigDump_DynamicEndpointConfig_set_error_state(
4068
- dynamic_endpoint, CreateUpdateFailureStateUpb(context, meta));
4069
- }
4070
- }
4071
- }
4072
-
4073
652
  } // namespace
4074
653
 
4075
654
  std::string XdsApi::AssembleClientConfig(
@@ -4080,38 +659,65 @@ std::string XdsApi::AssembleClientConfig(
4080
659
  // Fill-in the node information
4081
660
  auto* node = envoy_service_status_v3_ClientConfig_mutable_node(client_config,
4082
661
  arena.ptr());
4083
- const EncodingContext context = {
4084
- client_, tracer_, symtab_.ptr(),
4085
- arena.ptr(), true, certificate_provider_definition_map_};
662
+ // The xDS server info is not actually needed here, so we seed it with an
663
+ // empty value.
664
+ XdsBootstrap::XdsServer empty_server;
665
+ const XdsEncodingContext context = {client_,
666
+ empty_server,
667
+ tracer_,
668
+ symtab_->ptr(),
669
+ arena.ptr(),
670
+ true,
671
+ certificate_provider_definition_map_};
4086
672
  PopulateNode(context, node_, build_version_, user_agent_name_,
4087
673
  user_agent_version_, node);
4088
- // Dump each xDS-type config into PerXdsConfig
4089
- for (auto& p : resource_type_metadata_map) {
674
+ // Dump each resource.
675
+ std::vector<std::string> type_url_storage;
676
+ for (const auto& p : resource_type_metadata_map) {
4090
677
  absl::string_view type_url = p.first;
4091
- const ResourceTypeMetadata& resource_type_metadata = p.second;
4092
- if (type_url == kLdsTypeUrl) {
4093
- auto* per_xds_config =
4094
- envoy_service_status_v3_ClientConfig_add_xds_config(client_config,
4095
- context.arena);
4096
- DumpLdsConfig(context, resource_type_metadata, per_xds_config);
4097
- } else if (type_url == kRdsTypeUrl) {
4098
- auto* per_xds_config =
4099
- envoy_service_status_v3_ClientConfig_add_xds_config(client_config,
4100
- context.arena);
4101
- DumpRdsConfig(context, resource_type_metadata, per_xds_config);
4102
- } else if (type_url == kCdsTypeUrl) {
4103
- auto* per_xds_config =
4104
- envoy_service_status_v3_ClientConfig_add_xds_config(client_config,
4105
- context.arena);
4106
- DumpCdsConfig(context, resource_type_metadata, per_xds_config);
4107
- } else if (type_url == kEdsTypeUrl) {
4108
- auto* per_xds_config =
4109
- envoy_service_status_v3_ClientConfig_add_xds_config(client_config,
4110
- context.arena);
4111
- DumpEdsConfig(context, resource_type_metadata, per_xds_config);
4112
- } else {
4113
- gpr_log(GPR_ERROR, "invalid type_url %s", std::string(type_url).c_str());
4114
- return "";
678
+ const ResourceMetadataMap& resource_metadata_map = p.second;
679
+ type_url_storage.emplace_back(
680
+ absl::StrCat("type.googleapis.com/", type_url));
681
+ for (const auto& q : resource_metadata_map) {
682
+ absl::string_view resource_name = q.first;
683
+ const ResourceMetadata& metadata = *q.second;
684
+ auto* entry =
685
+ envoy_service_status_v3_ClientConfig_add_generic_xds_configs(
686
+ client_config, context.arena);
687
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_type_url(
688
+ entry, StdStringToUpbString(type_url_storage.back()));
689
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_name(
690
+ entry, StdStringToUpbString(resource_name));
691
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_client_status(
692
+ entry, metadata.client_status);
693
+ if (!metadata.serialized_proto.empty()) {
694
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_version_info(
695
+ entry, StdStringToUpbString(metadata.version));
696
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_last_updated(
697
+ entry, EncodeTimestamp(context, metadata.update_time));
698
+ auto* any_field =
699
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_mutable_xds_config(
700
+ entry, context.arena);
701
+ google_protobuf_Any_set_type_url(
702
+ any_field, StdStringToUpbString(type_url_storage.back()));
703
+ google_protobuf_Any_set_value(
704
+ any_field, StdStringToUpbString(metadata.serialized_proto));
705
+ }
706
+ if (metadata.client_status == XdsApi::ResourceMetadata::NACKED) {
707
+ auto* update_failure_state =
708
+ envoy_admin_v3_UpdateFailureState_new(context.arena);
709
+ envoy_admin_v3_UpdateFailureState_set_details(
710
+ update_failure_state,
711
+ StdStringToUpbString(metadata.failed_details));
712
+ envoy_admin_v3_UpdateFailureState_set_version_info(
713
+ update_failure_state,
714
+ StdStringToUpbString(metadata.failed_version));
715
+ envoy_admin_v3_UpdateFailureState_set_last_update_attempt(
716
+ update_failure_state,
717
+ EncodeTimestamp(context, metadata.failed_update_time));
718
+ envoy_service_status_v3_ClientConfig_GenericXdsConfig_set_error_state(
719
+ entry, update_failure_state);
720
+ }
4115
721
  }
4116
722
  }
4117
723
  // Serialize the upb message to bytes