grpc 1.43.1 → 1.44.0.pre2

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 (382) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +84 -64
  3. data/include/grpc/grpc_security.h +10 -0
  4. data/include/grpc/impl/codegen/compression_types.h +0 -2
  5. data/include/grpc/impl/codegen/grpc_types.h +6 -0
  6. data/src/core/ext/filters/client_channel/backend_metric.h +1 -1
  7. data/src/core/ext/filters/client_channel/client_channel.cc +62 -68
  8. data/src/core/ext/filters/client_channel/client_channel.h +8 -8
  9. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
  10. data/src/core/ext/filters/client_channel/config_selector.h +4 -4
  11. data/src/core/ext/filters/client_channel/dynamic_filters.h +1 -1
  12. data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -14
  13. data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
  14. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
  15. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +4 -3
  16. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +6 -5
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +3 -7
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +31 -32
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -7
  20. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +1 -1
  21. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -1
  22. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -1
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +43 -29
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -2
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +120 -68
  26. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +60 -48
  27. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +62 -61
  28. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +16 -11
  29. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +11 -5
  30. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +19 -15
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -1
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +14 -12
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +3 -2
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +50 -105
  35. data/src/core/ext/filters/client_channel/lb_policy.cc +15 -14
  36. data/src/core/ext/filters/client_channel/lb_policy.h +19 -3
  37. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +3 -3
  38. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +207 -81
  39. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +22 -12
  40. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +19 -15
  41. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +23 -38
  42. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +118 -207
  43. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +25 -32
  44. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
  45. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +82 -73
  46. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +10 -10
  47. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +2 -1
  48. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +2 -5
  49. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -5
  50. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +157 -67
  51. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +1 -1
  52. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +2 -2
  53. data/src/core/ext/filters/client_channel/retry_filter.cc +37 -64
  54. data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -1
  55. data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
  56. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +1 -1
  57. data/src/core/ext/filters/client_channel/subchannel.cc +12 -16
  58. data/src/core/ext/filters/client_channel/subchannel.h +2 -3
  59. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +37 -48
  60. data/src/core/ext/filters/fault_injection/service_config_parser.cc +6 -8
  61. data/src/core/ext/filters/fault_injection/service_config_parser.h +1 -1
  62. data/src/core/ext/filters/http/client/http_client_filter.cc +51 -122
  63. data/src/core/ext/filters/http/client_authority_filter.cc +8 -24
  64. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +42 -140
  65. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +5 -25
  66. data/src/core/ext/filters/http/server/http_server_filter.cc +50 -135
  67. data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
  68. data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
  69. data/src/core/ext/filters/rbac/rbac_filter.cc +157 -0
  70. data/src/core/ext/filters/rbac/rbac_filter.h +74 -0
  71. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +605 -0
  72. data/src/core/ext/filters/rbac/rbac_service_config_parser.h +70 -0
  73. data/src/core/ext/filters/server_config_selector/server_config_selector.h +3 -2
  74. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +11 -6
  75. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +1 -1
  76. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +1 -1
  77. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +89 -29
  78. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +0 -1
  79. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +45 -186
  80. data/src/core/ext/transport/chttp2/transport/frame_data.cc +0 -1
  81. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +341 -279
  82. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +69 -159
  83. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +1 -1
  84. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +2 -0
  85. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +19 -32
  86. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +0 -1
  87. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +94 -1
  88. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +2 -24
  89. data/src/core/ext/transport/chttp2/transport/internal.h +0 -33
  90. data/src/core/ext/transport/chttp2/transport/parsing.cc +0 -6
  91. data/src/core/ext/transport/chttp2/transport/writing.cc +47 -116
  92. data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -4
  93. data/src/core/ext/transport/inproc/inproc_transport.cc +11 -63
  94. data/src/core/ext/transport/inproc/inproc_transport.h +0 -3
  95. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +61 -0
  96. data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +146 -0
  97. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +188 -0
  98. data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.h +70 -0
  99. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +56 -0
  100. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.h +40 -0
  101. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.c +154 -0
  102. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.h +95 -0
  103. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.c +58 -0
  104. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.h +55 -0
  105. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.c +44 -0
  106. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.h +40 -0
  107. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.c +153 -0
  108. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.h +100 -0
  109. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.c +75 -0
  110. data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.h +55 -0
  111. data/src/core/ext/xds/upb_utils.h +65 -0
  112. data/src/core/ext/xds/xds_api.cc +81 -3458
  113. data/src/core/ext/xds/xds_api.h +56 -611
  114. data/src/core/ext/xds/xds_bootstrap.cc +189 -125
  115. data/src/core/ext/xds/xds_bootstrap.h +20 -15
  116. data/src/core/ext/xds/xds_certificate_provider.h +1 -0
  117. data/src/core/ext/xds/xds_channel_creds.cc +108 -0
  118. data/src/core/ext/xds/xds_channel_creds.h +50 -0
  119. data/src/core/ext/xds/xds_client.cc +584 -994
  120. data/src/core/ext/xds/xds_client.h +78 -135
  121. data/src/core/ext/xds/xds_cluster.cc +451 -0
  122. data/src/core/ext/xds/xds_cluster.h +111 -0
  123. data/src/core/ext/xds/xds_common_types.cc +388 -0
  124. data/src/core/ext/xds/xds_common_types.h +110 -0
  125. data/src/core/ext/xds/xds_endpoint.cc +364 -0
  126. data/src/core/ext/xds/xds_endpoint.h +135 -0
  127. data/src/core/ext/xds/xds_http_filters.cc +5 -0
  128. data/src/core/ext/xds/xds_http_rbac_filter.cc +563 -0
  129. data/src/core/ext/xds/xds_http_rbac_filter.h +54 -0
  130. data/src/core/ext/xds/xds_listener.cc +1036 -0
  131. data/src/core/ext/xds/xds_listener.h +220 -0
  132. data/src/core/ext/{transport/chttp2/transport/hpack_utils.h → xds/xds_resource_type.cc} +12 -9
  133. data/src/core/ext/xds/xds_resource_type.h +98 -0
  134. data/src/core/ext/xds/xds_resource_type_impl.h +87 -0
  135. data/src/core/ext/xds/xds_route_config.cc +993 -0
  136. data/src/core/ext/xds/xds_route_config.h +215 -0
  137. data/src/core/ext/xds/xds_routing.cc +11 -8
  138. data/src/core/ext/xds/xds_routing.h +8 -5
  139. data/src/core/ext/xds/xds_server_config_fetcher.cc +159 -99
  140. data/src/core/lib/address_utils/parse_address.cc +20 -0
  141. data/src/core/lib/address_utils/parse_address.h +5 -0
  142. data/src/core/lib/address_utils/sockaddr_utils.cc +33 -36
  143. data/src/core/lib/address_utils/sockaddr_utils.h +1 -16
  144. data/src/core/lib/backoff/backoff.cc +4 -30
  145. data/src/core/lib/backoff/backoff.h +3 -3
  146. data/src/core/lib/channel/channel_args.cc +0 -1
  147. data/src/core/lib/channel/channel_stack.cc +8 -0
  148. data/src/core/lib/channel/channel_stack.h +1 -1
  149. data/src/core/lib/channel/channel_stack_builder.cc +5 -9
  150. data/src/core/lib/channel/channel_stack_builder.h +4 -7
  151. data/src/core/lib/channel/channelz.cc +1 -0
  152. data/src/core/lib/compression/compression.cc +19 -111
  153. data/src/core/lib/compression/compression_internal.cc +142 -202
  154. data/src/core/lib/compression/compression_internal.h +64 -69
  155. data/src/core/lib/compression/message_compress.cc +11 -11
  156. data/src/core/lib/compression/message_compress.h +2 -2
  157. data/src/core/lib/gpr/useful.h +4 -0
  158. data/src/core/lib/gprpp/bitset.h +7 -0
  159. data/src/core/lib/gprpp/chunked_vector.h +45 -3
  160. data/src/core/lib/gprpp/status_helper.cc +20 -28
  161. data/src/core/lib/gprpp/status_helper.h +6 -19
  162. data/src/core/lib/gprpp/table.h +11 -0
  163. data/src/core/lib/http/httpcli.cc +37 -46
  164. data/src/core/lib/http/httpcli.h +3 -15
  165. data/src/core/lib/iomgr/call_combiner.cc +15 -4
  166. data/src/core/lib/iomgr/closure.h +29 -9
  167. data/src/core/lib/iomgr/combiner.cc +25 -3
  168. data/src/core/lib/iomgr/error.cc +2 -0
  169. data/src/core/lib/iomgr/error.h +3 -0
  170. data/src/core/lib/iomgr/event_engine/iomgr.cc +3 -2
  171. data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +6 -0
  172. data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +2 -0
  173. data/src/core/lib/iomgr/event_engine/resolver.cc +66 -48
  174. data/src/core/lib/iomgr/event_engine/resolver.h +56 -0
  175. data/src/core/lib/iomgr/exec_ctx.cc +22 -9
  176. data/src/core/lib/iomgr/executor.cc +10 -1
  177. data/src/core/lib/iomgr/fork_posix.cc +3 -2
  178. data/src/core/lib/iomgr/iomgr_custom.cc +4 -1
  179. data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
  180. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -2
  181. data/src/core/lib/iomgr/iomgr_windows.cc +2 -2
  182. data/src/core/lib/iomgr/port.h +2 -2
  183. data/src/core/lib/iomgr/resolve_address.cc +5 -24
  184. data/src/core/lib/iomgr/resolve_address.h +47 -44
  185. data/src/core/lib/iomgr/resolve_address_custom.cc +131 -109
  186. data/src/core/lib/iomgr/resolve_address_custom.h +101 -19
  187. data/src/core/lib/iomgr/resolve_address_impl.h +59 -0
  188. data/src/core/lib/iomgr/resolve_address_posix.cc +82 -66
  189. data/src/core/lib/iomgr/resolve_address_posix.h +47 -0
  190. data/src/core/lib/iomgr/resolve_address_windows.cc +93 -74
  191. data/src/core/lib/iomgr/resolve_address_windows.h +47 -0
  192. data/src/core/lib/iomgr/resolved_address.h +39 -0
  193. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -0
  194. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +1 -0
  195. data/src/core/lib/iomgr/unix_sockets_posix.cc +22 -34
  196. data/src/core/lib/iomgr/unix_sockets_posix.h +4 -7
  197. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +6 -15
  198. data/src/core/lib/matchers/matchers.cc +1 -1
  199. data/src/core/lib/promise/activity.h +49 -20
  200. data/src/core/lib/promise/detail/status.h +5 -0
  201. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.cc +17 -25
  202. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.h +43 -44
  203. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_factory.h +10 -5
  204. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.cc +3 -2
  205. data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.h +4 -5
  206. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.cc +1 -1
  207. data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.h +4 -4
  208. data/src/core/lib/resource_quota/api.h +0 -1
  209. data/src/core/lib/{gprpp → resource_quota}/arena.cc +16 -13
  210. data/src/core/lib/{gprpp → resource_quota}/arena.h +24 -13
  211. data/src/core/lib/security/authorization/evaluate_args.cc +30 -15
  212. data/src/core/lib/security/authorization/evaluate_args.h +1 -0
  213. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +60 -0
  214. data/src/core/lib/security/authorization/grpc_authorization_engine.h +62 -0
  215. data/src/core/lib/security/authorization/matchers.cc +227 -0
  216. data/src/core/lib/security/authorization/matchers.h +211 -0
  217. data/src/core/lib/security/authorization/rbac_policy.cc +442 -0
  218. data/src/core/lib/security/authorization/rbac_policy.h +170 -0
  219. data/src/core/lib/security/context/security_context.cc +4 -2
  220. data/src/core/lib/security/context/security_context.h +1 -1
  221. data/src/core/lib/security/credentials/composite/composite_credentials.cc +5 -5
  222. data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -3
  223. data/src/core/lib/security/credentials/credentials.h +10 -20
  224. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +6 -9
  225. data/src/core/lib/security/credentials/external/external_account_credentials.cc +7 -9
  226. data/src/core/lib/security/credentials/external/external_account_credentials.h +2 -7
  227. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +2 -3
  228. data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -4
  229. data/src/core/lib/security/credentials/fake/fake_credentials.h +8 -7
  230. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -5
  231. data/src/core/lib/security/credentials/iam/iam_credentials.cc +16 -19
  232. data/src/core/lib/security/credentials/iam/iam_credentials.h +6 -5
  233. data/src/core/lib/security/credentials/jwt/json_token.cc +4 -6
  234. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +16 -28
  235. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +8 -8
  236. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +6 -13
  237. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +44 -57
  238. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +13 -15
  239. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -7
  240. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +5 -4
  241. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -10
  242. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +6 -0
  243. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +7 -0
  244. data/src/core/lib/security/credentials/xds/xds_credentials.h +1 -1
  245. data/src/core/lib/security/security_connector/security_connector.cc +0 -4
  246. data/src/core/lib/security/security_connector/security_connector.h +5 -1
  247. data/src/core/lib/security/security_connector/ssl_utils.cc +14 -24
  248. data/src/core/lib/security/security_connector/ssl_utils.h +5 -14
  249. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -3
  250. data/src/core/lib/security/transport/auth_filters.h +7 -0
  251. data/src/core/lib/security/transport/client_auth_filter.cc +53 -33
  252. data/src/core/lib/security/transport/server_auth_filter.cc +40 -35
  253. data/src/core/{ext → lib}/service_config/service_config.cc +2 -2
  254. data/src/core/{ext → lib}/service_config/service_config.h +4 -4
  255. data/src/core/{ext → lib}/service_config/service_config_call_data.h +5 -5
  256. data/src/core/{ext → lib}/service_config/service_config_parser.cc +1 -1
  257. data/src/core/{ext → lib}/service_config/service_config_parser.h +3 -3
  258. data/src/core/lib/slice/slice.cc +3 -1
  259. data/src/core/lib/slice/slice.h +43 -13
  260. data/src/core/lib/slice/slice_intern.cc +3 -101
  261. data/src/core/lib/slice/slice_internal.h +1 -2
  262. data/src/core/lib/slice/slice_refcount.h +4 -13
  263. data/src/core/lib/slice/slice_refcount_base.h +0 -16
  264. data/src/core/lib/surface/call.cc +140 -382
  265. data/src/core/lib/surface/call.h +4 -4
  266. data/src/core/lib/surface/channel.cc +42 -44
  267. data/src/core/lib/surface/channel.h +4 -4
  268. data/src/core/lib/surface/init.cc +0 -2
  269. data/src/core/lib/surface/lame_client.cc +0 -1
  270. data/src/core/lib/surface/server.cc +12 -29
  271. data/src/core/lib/surface/server.h +2 -2
  272. data/src/core/lib/surface/version.cc +2 -2
  273. data/src/core/lib/transport/error_utils.h +14 -0
  274. data/src/core/lib/transport/metadata_batch.h +799 -717
  275. data/src/core/lib/transport/parsed_metadata.cc +2 -0
  276. data/src/core/lib/transport/parsed_metadata.h +95 -92
  277. data/src/core/lib/transport/timeout_encoding.cc +200 -66
  278. data/src/core/lib/transport/timeout_encoding.h +40 -10
  279. data/src/core/lib/transport/transport.h +1 -1
  280. data/src/core/lib/transport/transport_op_string.cc +6 -39
  281. data/src/core/lib/uri/uri_parser.cc +223 -53
  282. data/src/core/lib/uri/uri_parser.h +36 -23
  283. data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -3
  284. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  285. data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -4
  286. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -5
  287. data/src/core/tsi/ssl_transport_security.cc +53 -13
  288. data/src/core/tsi/ssl_transport_security.h +18 -6
  289. data/src/ruby/ext/grpc/extconf.rb +10 -3
  290. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  291. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  292. data/src/ruby/lib/grpc/version.rb +1 -1
  293. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -1
  294. data/third_party/abseil-cpp/absl/base/internal/fast_type_id.h +48 -0
  295. data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +200 -0
  296. data/third_party/abseil-cpp/absl/random/beta_distribution.h +427 -0
  297. data/third_party/abseil-cpp/absl/random/discrete_distribution.cc +98 -0
  298. data/third_party/abseil-cpp/absl/random/discrete_distribution.h +247 -0
  299. data/third_party/abseil-cpp/absl/random/distributions.h +452 -0
  300. data/third_party/abseil-cpp/absl/random/exponential_distribution.h +165 -0
  301. data/third_party/abseil-cpp/absl/random/gaussian_distribution.cc +104 -0
  302. data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +275 -0
  303. data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +92 -0
  304. data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +268 -0
  305. data/third_party/abseil-cpp/absl/random/internal/fastmath.h +57 -0
  306. data/third_party/abseil-cpp/absl/random/internal/generate_real.h +144 -0
  307. data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +245 -0
  308. data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +150 -0
  309. data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +308 -0
  310. data/third_party/abseil-cpp/absl/random/internal/platform.h +171 -0
  311. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +253 -0
  312. data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +131 -0
  313. data/third_party/abseil-cpp/absl/random/internal/randen.cc +91 -0
  314. data/third_party/abseil-cpp/absl/random/internal/randen.h +102 -0
  315. data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +221 -0
  316. data/third_party/abseil-cpp/absl/random/internal/randen_detect.h +33 -0
  317. data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +239 -0
  318. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +526 -0
  319. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h +50 -0
  320. data/third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc +462 -0
  321. data/third_party/abseil-cpp/absl/random/internal/randen_slow.cc +471 -0
  322. data/third_party/abseil-cpp/absl/random/internal/randen_slow.h +40 -0
  323. data/third_party/abseil-cpp/absl/random/internal/randen_traits.h +88 -0
  324. data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +167 -0
  325. data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +267 -0
  326. data/third_party/abseil-cpp/absl/random/internal/seed_material.h +104 -0
  327. data/third_party/abseil-cpp/absl/random/internal/traits.h +101 -0
  328. data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +244 -0
  329. data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +111 -0
  330. data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +257 -0
  331. data/third_party/abseil-cpp/absl/random/poisson_distribution.h +258 -0
  332. data/third_party/abseil-cpp/absl/random/random.h +189 -0
  333. data/third_party/abseil-cpp/absl/random/seed_gen_exception.cc +46 -0
  334. data/third_party/abseil-cpp/absl/random/seed_gen_exception.h +55 -0
  335. data/third_party/abseil-cpp/absl/random/seed_sequences.cc +29 -0
  336. data/third_party/abseil-cpp/absl/random/seed_sequences.h +110 -0
  337. data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +275 -0
  338. data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +202 -0
  339. data/third_party/abseil-cpp/absl/random/zipf_distribution.h +271 -0
  340. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +1 -0
  341. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +13 -0
  342. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +21 -0
  343. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +12 -0
  344. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -2
  345. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +2 -2
  346. data/third_party/boringssl-with-bazel/src/crypto/mem.c +1 -1
  347. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +29 -0
  348. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +0 -1
  349. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +1 -1
  350. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
  351. data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +8 -0
  352. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +13 -1
  353. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +10 -0
  354. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
  355. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +9 -4
  356. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +6 -1
  357. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +23 -2
  358. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +4 -0
  359. data/third_party/xxhash/xxhash.h +607 -352
  360. metadata +149 -77
  361. data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +0 -107
  362. data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +0 -46
  363. data/src/core/ext/transport/chttp2/transport/popularity_count.h +0 -60
  364. data/src/core/lib/compression/algorithm_metadata.h +0 -62
  365. data/src/core/lib/compression/compression_args.cc +0 -140
  366. data/src/core/lib/compression/compression_args.h +0 -58
  367. data/src/core/lib/compression/stream_compression.cc +0 -81
  368. data/src/core/lib/compression/stream_compression.h +0 -117
  369. data/src/core/lib/compression/stream_compression_gzip.cc +0 -231
  370. data/src/core/lib/compression/stream_compression_gzip.h +0 -28
  371. data/src/core/lib/compression/stream_compression_identity.cc +0 -91
  372. data/src/core/lib/compression/stream_compression_identity.h +0 -29
  373. data/src/core/lib/security/credentials/credentials_metadata.cc +0 -61
  374. data/src/core/lib/slice/static_slice.cc +0 -377
  375. data/src/core/lib/slice/static_slice.h +0 -300
  376. data/src/core/lib/transport/metadata.cc +0 -714
  377. data/src/core/lib/transport/metadata.h +0 -449
  378. data/src/core/lib/transport/metadata_batch.cc +0 -99
  379. data/src/core/lib/transport/static_metadata.cc +0 -1032
  380. data/src/core/lib/transport/static_metadata.h +0 -322
  381. data/src/core/lib/transport/status_metadata.cc +0 -63
  382. data/src/core/lib/transport/status_metadata.h +0 -48
@@ -26,7 +26,10 @@
26
26
  #include "src/core/ext/xds/xds_certificate_provider.h"
27
27
  #include "src/core/ext/xds/xds_channel_stack_modifier.h"
28
28
  #include "src/core/ext/xds/xds_client.h"
29
+ #include "src/core/ext/xds/xds_listener.h"
30
+ #include "src/core/ext/xds/xds_route_config.h"
29
31
  #include "src/core/ext/xds/xds_routing.h"
32
+ #include "src/core/lib/address_utils/parse_address.h"
30
33
  #include "src/core/lib/address_utils/sockaddr_utils.h"
31
34
  #include "src/core/lib/channel/channel_args.h"
32
35
  #include "src/core/lib/config/core_configuration.h"
@@ -68,8 +71,8 @@ class XdsServerConfigFetcher : public grpc_server_config_fetcher {
68
71
  private:
69
72
  class ListenerWatcher;
70
73
 
71
- RefCountedPtr<XdsClient> xds_client_;
72
- grpc_server_xds_status_notifier serving_status_notifier_;
74
+ const RefCountedPtr<XdsClient> xds_client_;
75
+ const grpc_server_xds_status_notifier serving_status_notifier_;
73
76
  Mutex mu_;
74
77
  std::map<grpc_server_config_fetcher::WatcherInterface*, ListenerWatcher*>
75
78
  listener_watchers_ ABSL_GUARDED_BY(mu_);
@@ -86,7 +89,7 @@ class XdsServerConfigFetcher : public grpc_server_config_fetcher {
86
89
  // update received was a fatal error (resource does not exist), the server
87
90
  // listener is made to stop listening.
88
91
  class XdsServerConfigFetcher::ListenerWatcher
89
- : public XdsClient::ListenerWatcherInterface {
92
+ : public XdsListenerResourceType::WatcherInterface {
90
93
  public:
91
94
  ListenerWatcher(RefCountedPtr<XdsClient> xds_client,
92
95
  std::unique_ptr<grpc_server_config_fetcher::WatcherInterface>
@@ -94,7 +97,7 @@ class XdsServerConfigFetcher::ListenerWatcher
94
97
  grpc_server_xds_status_notifier serving_status_notifier,
95
98
  std::string listening_address);
96
99
 
97
- void OnListenerChanged(XdsApi::LdsUpdate listener) override;
100
+ void OnResourceChanged(XdsListenerResource listener) override;
98
101
 
99
102
  void OnError(grpc_error_handle error) override;
100
103
 
@@ -140,10 +143,10 @@ class XdsServerConfigFetcher::ListenerWatcher
140
143
  class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager
141
144
  : public grpc_server_config_fetcher::ConnectionManager {
142
145
  public:
143
- FilterChainMatchManager(
144
- RefCountedPtr<XdsClient> xds_client,
145
- XdsApi::LdsUpdate::FilterChainMap filter_chain_map,
146
- absl::optional<XdsApi::LdsUpdate::FilterChainData> default_filter_chain);
146
+ FilterChainMatchManager(RefCountedPtr<XdsClient> xds_client,
147
+ XdsListenerResource::FilterChainMap filter_chain_map,
148
+ absl::optional<XdsListenerResource::FilterChainData>
149
+ default_filter_chain);
147
150
 
148
151
  absl::StatusOr<grpc_channel_args*> UpdateChannelArgsForConnection(
149
152
  grpc_channel_args* args, grpc_endpoint* tcp) override;
@@ -154,11 +157,11 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager
154
157
  void StartRdsWatch(RefCountedPtr<ListenerWatcher> listener_watcher)
155
158
  ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ListenerWatcher::mu_);
156
159
 
157
- const XdsApi::LdsUpdate::FilterChainMap& filter_chain_map() const {
160
+ const XdsListenerResource::FilterChainMap& filter_chain_map() const {
158
161
  return filter_chain_map_;
159
162
  }
160
163
 
161
- const absl::optional<XdsApi::LdsUpdate::FilterChainData>&
164
+ const absl::optional<XdsListenerResource::FilterChainData>&
162
165
  default_filter_chain() const {
163
166
  return default_filter_chain_;
164
167
  }
@@ -176,7 +179,7 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager
176
179
  class RouteConfigWatcher;
177
180
  struct RdsUpdateState {
178
181
  RouteConfigWatcher* watcher;
179
- absl::optional<absl::StatusOr<XdsApi::RdsUpdate>> rds_update;
182
+ absl::optional<absl::StatusOr<XdsRouteConfigResource>> rds_update;
180
183
  };
181
184
 
182
185
  class XdsServerConfigSelector;
@@ -185,12 +188,12 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager
185
188
 
186
189
  absl::StatusOr<RefCountedPtr<XdsCertificateProvider>>
187
190
  CreateOrGetXdsCertificateProviderFromFilterChainData(
188
- const XdsApi::LdsUpdate::FilterChainData* filter_chain);
191
+ const XdsListenerResource::FilterChainData* filter_chain);
189
192
 
190
193
  // Helper functions invoked by RouteConfigWatcher when there are updates to
191
194
  // RDS resources.
192
195
  void OnRouteConfigChanged(const std::string& resource_name,
193
- XdsApi::RdsUpdate route_config);
196
+ XdsRouteConfigResource route_config);
194
197
  void OnError(const std::string& resource_name, grpc_error_handle error);
195
198
  void OnResourceDoesNotExist(const std::string& resource_name);
196
199
 
@@ -198,14 +201,13 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager
198
201
  // This ref is only kept around till the FilterChainMatchManager becomes
199
202
  // ready.
200
203
  RefCountedPtr<ListenerWatcher> listener_watcher_;
201
- const XdsApi::LdsUpdate::FilterChainMap filter_chain_map_;
202
- const absl::optional<XdsApi::LdsUpdate::FilterChainData>
203
- default_filter_chain_;
204
+ XdsListenerResource::FilterChainMap filter_chain_map_;
205
+ absl::optional<XdsListenerResource::FilterChainData> default_filter_chain_;
204
206
  Mutex mu_;
205
207
  size_t rds_resources_yet_to_fetch_ ABSL_GUARDED_BY(mu_) = 0;
206
208
  std::map<std::string /* resource_name */, RdsUpdateState> rds_map_
207
209
  ABSL_GUARDED_BY(mu_);
208
- std::map<const XdsApi::LdsUpdate::FilterChainData*, CertificateProviders>
210
+ std::map<const XdsListenerResource::FilterChainData*, CertificateProviders>
209
211
  certificate_providers_map_ ABSL_GUARDED_BY(mu_);
210
212
  };
211
213
 
@@ -217,7 +219,7 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager
217
219
  // with the latest updates and new connections do not need to wait for the RDS
218
220
  // resources to be fetched.
219
221
  class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
220
- RouteConfigWatcher : public XdsClient::RouteConfigWatcherInterface {
222
+ RouteConfigWatcher : public XdsRouteConfigResourceType::WatcherInterface {
221
223
  public:
222
224
  RouteConfigWatcher(
223
225
  std::string resource_name,
@@ -225,7 +227,7 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
225
227
  : resource_name_(std::move(resource_name)),
226
228
  filter_chain_match_manager_(std::move(filter_chain_match_manager)) {}
227
229
 
228
- void OnRouteConfigChanged(XdsApi::RdsUpdate route_config) override {
230
+ void OnResourceChanged(XdsRouteConfigResource route_config) override {
229
231
  filter_chain_match_manager_->OnRouteConfigChanged(resource_name_,
230
232
  std::move(route_config));
231
233
  }
@@ -251,8 +253,8 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
251
253
  XdsServerConfigSelector : public ServerConfigSelector {
252
254
  public:
253
255
  static absl::StatusOr<RefCountedPtr<XdsServerConfigSelector>> Create(
254
- XdsApi::RdsUpdate rds_update,
255
- const std::vector<XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter>&
256
+ XdsRouteConfigResource rds_update,
257
+ const std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>&
256
258
  http_filters);
257
259
  ~XdsServerConfigSelector() override = default;
258
260
 
@@ -263,7 +265,7 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
263
265
  struct Route {
264
266
  // true if an action other than kNonForwardingAction is configured.
265
267
  bool unsupported_action;
266
- XdsApi::Route::Matchers matchers;
268
+ XdsRouteConfigResource::Route::Matchers matchers;
267
269
  RefCountedPtr<ServiceConfig> method_config;
268
270
  };
269
271
 
@@ -274,7 +276,7 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
274
276
 
275
277
  size_t Size() const override { return routes_->size(); }
276
278
 
277
- const XdsApi::Route::Matchers& GetMatchersForRoute(
279
+ const XdsRouteConfigResource::Route::Matchers& GetMatchersForRoute(
278
280
  size_t index) const override {
279
281
  return (*routes_)[index].matchers;
280
282
  }
@@ -314,8 +316,8 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
314
316
  : public ServerConfigSelectorProvider {
315
317
  public:
316
318
  StaticXdsServerConfigSelectorProvider(
317
- absl::StatusOr<XdsApi::RdsUpdate> static_resource,
318
- std::vector<XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter>
319
+ absl::StatusOr<XdsRouteConfigResource> static_resource,
320
+ std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>
319
321
  http_filters)
320
322
  : static_resource_(std::move(static_resource)),
321
323
  http_filters_(std::move(http_filters)) {}
@@ -332,11 +334,13 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
332
334
  http_filters_);
333
335
  }
334
336
 
337
+ void Orphan() override {}
338
+
335
339
  void CancelWatch() override { watcher_.reset(); }
336
340
 
337
341
  private:
338
- absl::StatusOr<XdsApi::RdsUpdate> static_resource_;
339
- std::vector<XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter>
342
+ absl::StatusOr<XdsRouteConfigResource> static_resource_;
343
+ std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>
340
344
  http_filters_;
341
345
  std::unique_ptr<ServerConfigSelectorProvider::ServerConfigSelectorWatcher>
342
346
  watcher_;
@@ -350,10 +354,12 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
350
354
  public:
351
355
  DynamicXdsServerConfigSelectorProvider(
352
356
  RefCountedPtr<XdsClient> xds_client, std::string resource_name,
353
- absl::StatusOr<XdsApi::RdsUpdate> initial_resource,
354
- std::vector<XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter>
357
+ absl::StatusOr<XdsRouteConfigResource> initial_resource,
358
+ std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>
355
359
  http_filters);
356
360
 
361
+ void Orphan() override;
362
+
357
363
  absl::StatusOr<RefCountedPtr<ServerConfigSelector>> Watch(
358
364
  std::unique_ptr<ServerConfigSelectorProvider::ServerConfigSelectorWatcher>
359
365
  watcher) override;
@@ -362,32 +368,32 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
362
368
  private:
363
369
  class RouteConfigWatcher;
364
370
 
365
- void OnRouteConfigChanged(XdsApi::RdsUpdate rds_update);
371
+ void OnRouteConfigChanged(XdsRouteConfigResource rds_update);
366
372
  void OnError(grpc_error_handle error);
367
373
  void OnResourceDoesNotExist();
368
374
 
369
375
  RefCountedPtr<XdsClient> xds_client_;
370
376
  std::string resource_name_;
371
- std::vector<XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter>
377
+ std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>
372
378
  http_filters_;
373
379
  RouteConfigWatcher* route_config_watcher_ = nullptr;
374
380
  Mutex mu_;
375
381
  std::unique_ptr<ServerConfigSelectorProvider::ServerConfigSelectorWatcher>
376
382
  watcher_ ABSL_GUARDED_BY(mu_);
377
- absl::StatusOr<XdsApi::RdsUpdate> resource_ ABSL_GUARDED_BY(mu_);
383
+ absl::StatusOr<XdsRouteConfigResource> resource_ ABSL_GUARDED_BY(mu_);
378
384
  };
379
385
 
380
386
  // A watcher implementation for updating the RDS resource used by
381
387
  // DynamicXdsServerConfigSelectorProvider
382
388
  class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
383
389
  DynamicXdsServerConfigSelectorProvider::RouteConfigWatcher
384
- : public XdsClient::RouteConfigWatcherInterface {
390
+ : public XdsRouteConfigResourceType::WatcherInterface {
385
391
  public:
386
392
  explicit RouteConfigWatcher(
387
- RefCountedPtr<DynamicXdsServerConfigSelectorProvider> parent)
393
+ WeakRefCountedPtr<DynamicXdsServerConfigSelectorProvider> parent)
388
394
  : parent_(std::move(parent)) {}
389
395
 
390
- void OnRouteConfigChanged(XdsApi::RdsUpdate route_config) override {
396
+ void OnResourceChanged(XdsRouteConfigResource route_config) override {
391
397
  parent_->OnRouteConfigChanged(std::move(route_config));
392
398
  }
393
399
 
@@ -396,7 +402,7 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
396
402
  void OnResourceDoesNotExist() override { parent_->OnResourceDoesNotExist(); }
397
403
 
398
404
  private:
399
- RefCountedPtr<DynamicXdsServerConfigSelectorProvider> parent_;
405
+ WeakRefCountedPtr<DynamicXdsServerConfigSelectorProvider> parent_;
400
406
  };
401
407
 
402
408
  //
@@ -410,6 +416,17 @@ XdsServerConfigFetcher::XdsServerConfigFetcher(
410
416
  GPR_ASSERT(xds_client_ != nullptr);
411
417
  }
412
418
 
419
+ std::string ListenerResourceName(absl::string_view resource_name_template,
420
+ absl::string_view listening_address) {
421
+ std::string tmp;
422
+ if (absl::StartsWith(resource_name_template, "xdstp:")) {
423
+ tmp = URI::PercentEncodePath(listening_address);
424
+ listening_address = tmp;
425
+ }
426
+ return absl::StrReplaceAll(resource_name_template,
427
+ {{"%s", listening_address}});
428
+ }
429
+
413
430
  void XdsServerConfigFetcher::StartWatch(
414
431
  std::string listening_address,
415
432
  std::unique_ptr<grpc_server_config_fetcher::WatcherInterface> watcher) {
@@ -418,10 +435,11 @@ void XdsServerConfigFetcher::StartWatch(
418
435
  xds_client_, std::move(watcher), serving_status_notifier_,
419
436
  listening_address);
420
437
  auto* listener_watcher_ptr = listener_watcher.get();
421
- xds_client_->WatchListenerData(
422
- absl::StrReplaceAll(
438
+ XdsListenerResourceType::StartWatch(
439
+ xds_client_.get(),
440
+ ListenerResourceName(
423
441
  xds_client_->bootstrap().server_listener_resource_name_template(),
424
- {{"%s", listening_address}}),
442
+ listening_address),
425
443
  std::move(listener_watcher));
426
444
  MutexLock lock(&mu_);
427
445
  listener_watchers_.emplace(watcher_ptr, listener_watcher_ptr);
@@ -433,10 +451,11 @@ void XdsServerConfigFetcher::CancelWatch(
433
451
  auto it = listener_watchers_.find(watcher);
434
452
  if (it != listener_watchers_.end()) {
435
453
  // Cancel the watch on the listener before erasing
436
- xds_client_->CancelListenerDataWatch(
437
- absl::StrReplaceAll(
454
+ XdsListenerResourceType::CancelWatch(
455
+ xds_client_.get(),
456
+ ListenerResourceName(
438
457
  xds_client_->bootstrap().server_listener_resource_name_template(),
439
- {{"%s", it->second->listening_address()}}),
458
+ it->second->listening_address()),
440
459
  it->second, false /* delay_unsubscription */);
441
460
  listener_watchers_.erase(it);
442
461
  }
@@ -457,8 +476,8 @@ XdsServerConfigFetcher::ListenerWatcher::ListenerWatcher(
457
476
  serving_status_notifier_(serving_status_notifier),
458
477
  listening_address_(std::move(listening_address)) {}
459
478
 
460
- void XdsServerConfigFetcher::ListenerWatcher::OnListenerChanged(
461
- XdsApi::LdsUpdate listener) {
479
+ void XdsServerConfigFetcher::ListenerWatcher::OnResourceChanged(
480
+ XdsListenerResource listener) {
462
481
  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_server_config_fetcher_trace)) {
463
482
  gpr_log(GPR_INFO,
464
483
  "[ListenerWatcher %p] Received LDS update from xds client %p: %s",
@@ -578,16 +597,20 @@ void XdsServerConfigFetcher::ListenerWatcher::
578
597
  XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
579
598
  FilterChainMatchManager(
580
599
  RefCountedPtr<XdsClient> xds_client,
581
- XdsApi::LdsUpdate::FilterChainMap filter_chain_map,
582
- absl::optional<XdsApi::LdsUpdate::FilterChainData> default_filter_chain)
600
+ XdsListenerResource::FilterChainMap filter_chain_map,
601
+ absl::optional<XdsListenerResource::FilterChainData>
602
+ default_filter_chain)
583
603
  : xds_client_(std::move(xds_client)),
584
604
  filter_chain_map_(std::move(filter_chain_map)),
585
605
  default_filter_chain_(std::move(default_filter_chain)) {}
586
606
 
587
607
  void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
588
608
  StartRdsWatch(RefCountedPtr<ListenerWatcher> listener_watcher) {
589
- // Get the set of RDS resources to watch on
609
+ // Get the set of RDS resources to watch on. Also get the set of
610
+ // FilterChainData so that we can reverse the list of HTTP filters since
611
+ // received data moves *up* the stack in Core.
590
612
  std::set<std::string> resource_names;
613
+ std::set<XdsListenerResource::FilterChainData*> filter_chain_data_set;
591
614
  for (const auto& destination_ip : filter_chain_map_.destination_ip_vector) {
592
615
  for (const auto& source_type : destination_ip.source_types_array) {
593
616
  for (const auto& source_ip : source_type) {
@@ -598,17 +621,34 @@ void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
598
621
  source_port_pair.second.data->http_connection_manager
599
622
  .route_config_name);
600
623
  }
624
+ filter_chain_data_set.insert(source_port_pair.second.data.get());
601
625
  }
602
626
  }
603
627
  }
604
628
  }
605
- if (default_filter_chain_.has_value() &&
606
- !default_filter_chain_->http_connection_manager.route_config_name
607
- .empty()) {
608
- resource_names.insert(
609
- default_filter_chain_->http_connection_manager.route_config_name);
629
+ if (default_filter_chain_.has_value()) {
630
+ if (!default_filter_chain_->http_connection_manager.route_config_name
631
+ .empty()) {
632
+ resource_names.insert(
633
+ default_filter_chain_->http_connection_manager.route_config_name);
634
+ }
635
+ std::reverse(
636
+ default_filter_chain_->http_connection_manager.http_filters.begin(),
637
+ default_filter_chain_->http_connection_manager.http_filters.end());
638
+ }
639
+ // Reverse the lists of HTTP filters in all the filter chains
640
+ for (auto* filter_chain_data : filter_chain_data_set) {
641
+ std::reverse(
642
+ filter_chain_data->http_connection_manager.http_filters.begin(),
643
+ filter_chain_data->http_connection_manager.http_filters.end());
610
644
  }
611
645
  // Start watching on referenced RDS resources
646
+ struct WatcherToStart {
647
+ std::string resource_name;
648
+ RefCountedPtr<RouteConfigWatcher> watcher;
649
+ };
650
+ std::vector<WatcherToStart> watchers_to_start;
651
+ watchers_to_start.reserve(resource_names.size());
612
652
  {
613
653
  MutexLock lock(&mu_);
614
654
  for (const auto& resource_name : resource_names) {
@@ -617,14 +657,19 @@ void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
617
657
  MakeRefCounted<RouteConfigWatcher>(resource_name, WeakRef());
618
658
  rds_map_.emplace(resource_name, RdsUpdateState{route_config_watcher.get(),
619
659
  absl::nullopt});
620
- xds_client_->WatchRouteConfigData(resource_name,
621
- std::move(route_config_watcher));
660
+ watchers_to_start.push_back(
661
+ WatcherToStart{resource_name, std::move(route_config_watcher)});
622
662
  }
623
663
  if (rds_resources_yet_to_fetch_ != 0) {
624
664
  listener_watcher_ = std::move(listener_watcher);
625
665
  listener_watcher = nullptr;
626
666
  }
627
667
  }
668
+ for (auto& watcher_to_start : watchers_to_start) {
669
+ XdsRouteConfigResourceType::StartWatch(xds_client_.get(),
670
+ watcher_to_start.resource_name,
671
+ std::move(watcher_to_start.watcher));
672
+ }
628
673
  // Promote this filter chain match manager if all referenced resources are
629
674
  // fetched.
630
675
  if (listener_watcher != nullptr) {
@@ -637,7 +682,8 @@ void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
637
682
  MutexLock lock(&mu_);
638
683
  // Cancel the RDS watches to clear up the weak refs
639
684
  for (const auto& entry : rds_map_) {
640
- xds_client_->CancelRouteConfigDataWatch(entry.first, entry.second.watcher,
685
+ XdsRouteConfigResourceType::CancelWatch(xds_client_.get(), entry.first,
686
+ entry.second.watcher,
641
687
  false /* delay_unsubscription */);
642
688
  }
643
689
  // Also give up the ref on ListenerWatcher since it won't be needed anymore
@@ -647,7 +693,7 @@ void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
647
693
  absl::StatusOr<RefCountedPtr<XdsCertificateProvider>>
648
694
  XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
649
695
  CreateOrGetXdsCertificateProviderFromFilterChainData(
650
- const XdsApi::LdsUpdate::FilterChainData* filter_chain) {
696
+ const XdsListenerResource::FilterChainData* filter_chain) {
651
697
  MutexLock lock(&mu_);
652
698
  auto it = certificate_providers_map_.find(filter_chain);
653
699
  if (it != certificate_providers_map_.end()) {
@@ -711,7 +757,7 @@ XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
711
757
 
712
758
  void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
713
759
  OnRouteConfigChanged(const std::string& resource_name,
714
- XdsApi::RdsUpdate route_config) {
760
+ XdsRouteConfigResource route_config) {
715
761
  RefCountedPtr<ListenerWatcher> listener_watcher;
716
762
  {
717
763
  MutexLock lock(&mu_);
@@ -777,8 +823,8 @@ void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
777
823
  }
778
824
  }
779
825
 
780
- const XdsApi::LdsUpdate::FilterChainData* FindFilterChainDataForSourcePort(
781
- const XdsApi::LdsUpdate::FilterChainMap::SourcePortsMap& source_ports_map,
826
+ const XdsListenerResource::FilterChainData* FindFilterChainDataForSourcePort(
827
+ const XdsListenerResource::FilterChainMap::SourcePortsMap& source_ports_map,
782
828
  absl::string_view port_str) {
783
829
  int port = 0;
784
830
  if (!absl::SimpleAtoi(port_str, &port)) return nullptr;
@@ -794,10 +840,10 @@ const XdsApi::LdsUpdate::FilterChainData* FindFilterChainDataForSourcePort(
794
840
  return nullptr;
795
841
  }
796
842
 
797
- const XdsApi::LdsUpdate::FilterChainData* FindFilterChainDataForSourceIp(
798
- const XdsApi::LdsUpdate::FilterChainMap::SourceIpVector& source_ip_vector,
843
+ const XdsListenerResource::FilterChainData* FindFilterChainDataForSourceIp(
844
+ const XdsListenerResource::FilterChainMap::SourceIpVector& source_ip_vector,
799
845
  const grpc_resolved_address* source_ip, absl::string_view port) {
800
- const XdsApi::LdsUpdate::FilterChainMap::SourceIp* best_match = nullptr;
846
+ const XdsListenerResource::FilterChainMap::SourceIp* best_match = nullptr;
801
847
  for (const auto& entry : source_ip_vector) {
802
848
  // Special case for catch-all
803
849
  if (!entry.prefix_range.has_value()) {
@@ -840,8 +886,8 @@ bool IsLoopbackIp(const grpc_resolved_address* address) {
840
886
  return false;
841
887
  }
842
888
 
843
- const XdsApi::LdsUpdate::FilterChainData* FindFilterChainDataForSourceType(
844
- const XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceTypesArray&
889
+ const XdsListenerResource::FilterChainData* FindFilterChainDataForSourceType(
890
+ const XdsListenerResource::FilterChainMap::ConnectionSourceTypesArray&
845
891
  source_types_array,
846
892
  grpc_endpoint* tcp, absl::string_view destination_ip) {
847
893
  auto source_uri = URI::Parse(grpc_endpoint_get_peer(tcp));
@@ -865,34 +911,34 @@ const XdsApi::LdsUpdate::FilterChainData* FindFilterChainDataForSourceType(
865
911
  }
866
912
  // Use kAny only if kSameIporLoopback and kExternal are empty
867
913
  if (source_types_array[static_cast<int>(
868
- XdsApi::LdsUpdate::FilterChainMap::
914
+ XdsListenerResource::FilterChainMap::
869
915
  ConnectionSourceType::kSameIpOrLoopback)]
870
916
  .empty() &&
871
- source_types_array[static_cast<int>(XdsApi::LdsUpdate::FilterChainMap::
917
+ source_types_array[static_cast<int>(XdsListenerResource::FilterChainMap::
872
918
  ConnectionSourceType::kExternal)]
873
919
  .empty()) {
874
920
  return FindFilterChainDataForSourceIp(
875
921
  source_types_array[static_cast<int>(
876
- XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceType::kAny)],
922
+ XdsListenerResource::FilterChainMap::ConnectionSourceType::kAny)],
877
923
  &source_addr, port);
878
924
  }
879
925
  if (IsLoopbackIp(&source_addr) || host == destination_ip) {
880
926
  return FindFilterChainDataForSourceIp(
881
927
  source_types_array[static_cast<int>(
882
- XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceType::
928
+ XdsListenerResource::FilterChainMap::ConnectionSourceType::
883
929
  kSameIpOrLoopback)],
884
930
  &source_addr, port);
885
931
  } else {
886
932
  return FindFilterChainDataForSourceIp(
887
933
  source_types_array[static_cast<int>(
888
- XdsApi::LdsUpdate::FilterChainMap::ConnectionSourceType::
934
+ XdsListenerResource::FilterChainMap::ConnectionSourceType::
889
935
  kExternal)],
890
936
  &source_addr, port);
891
937
  }
892
938
  }
893
939
 
894
- const XdsApi::LdsUpdate::FilterChainData* FindFilterChainDataForDestinationIp(
895
- const XdsApi::LdsUpdate::FilterChainMap::DestinationIpVector
940
+ const XdsListenerResource::FilterChainData* FindFilterChainDataForDestinationIp(
941
+ const XdsListenerResource::FilterChainMap::DestinationIpVector
896
942
  destination_ip_vector,
897
943
  grpc_endpoint* tcp) {
898
944
  auto destination_uri = URI::Parse(grpc_endpoint_get_local_address(tcp));
@@ -914,7 +960,8 @@ const XdsApi::LdsUpdate::FilterChainData* FindFilterChainDataForDestinationIp(
914
960
  GRPC_ERROR_UNREF(error);
915
961
  return nullptr;
916
962
  }
917
- const XdsApi::LdsUpdate::FilterChainMap::DestinationIp* best_match = nullptr;
963
+ const XdsListenerResource::FilterChainMap::DestinationIp* best_match =
964
+ nullptr;
918
965
  for (const auto& entry : destination_ip_vector) {
919
966
  // Special case for catch-all
920
967
  if (!entry.prefix_range.has_value()) {
@@ -960,16 +1007,13 @@ absl::StatusOr<grpc_channel_args*> XdsServerConfigFetcher::ListenerWatcher::
960
1007
  std::vector<const grpc_channel_filter*> filters;
961
1008
  // Iterate the list of HTTP filters in reverse since in Core, received data
962
1009
  // flows *up* the stack.
963
- for (auto reverse_iterator =
964
- filter_chain->http_connection_manager.http_filters.rbegin();
965
- reverse_iterator !=
966
- filter_chain->http_connection_manager.http_filters.rend();
967
- ++reverse_iterator) {
1010
+ for (const auto& http_filter :
1011
+ filter_chain->http_connection_manager.http_filters) {
968
1012
  // Find filter. This is guaranteed to succeed, because it's checked
969
1013
  // at config validation time in the XdsApi code.
970
1014
  const XdsHttpFilterImpl* filter_impl =
971
1015
  XdsHttpFilterRegistry::GetFilterForType(
972
- reverse_iterator->config.config_proto_type_name);
1016
+ http_filter.config.config_proto_type_name);
973
1017
  GPR_ASSERT(filter_impl != nullptr);
974
1018
  // Some filters like the router filter are no-op filters and do not have
975
1019
  // an implementation.
@@ -986,7 +1030,7 @@ absl::StatusOr<grpc_channel_args*> XdsServerConfigFetcher::ListenerWatcher::
986
1030
  filter_chain->http_connection_manager.rds_update.value(),
987
1031
  filter_chain->http_connection_manager.http_filters);
988
1032
  } else {
989
- absl::StatusOr<XdsApi::RdsUpdate> initial_resource;
1033
+ absl::StatusOr<XdsRouteConfigResource> initial_resource;
990
1034
  {
991
1035
  MutexLock lock(&mu_);
992
1036
  initial_resource =
@@ -1035,8 +1079,9 @@ absl::StatusOr<
1035
1079
  FilterChainMatchManager::XdsServerConfigSelector>>
1036
1080
  XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
1037
1081
  XdsServerConfigSelector::Create(
1038
- XdsApi::RdsUpdate rds_update,
1039
- const std::vector<XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter>&
1082
+ XdsRouteConfigResource rds_update,
1083
+ const std::vector<
1084
+ XdsListenerResource::HttpConnectionManager::HttpFilter>&
1040
1085
  http_filters) {
1041
1086
  auto config_selector = MakeRefCounted<XdsServerConfigSelector>();
1042
1087
  for (auto& vhost : rds_update.virtual_hosts) {
@@ -1048,8 +1093,8 @@ XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
1048
1093
  auto& config_selector_route = virtual_host.routes.back();
1049
1094
  config_selector_route.matchers = std::move(route.matchers);
1050
1095
  config_selector_route.unsupported_action =
1051
- absl::get_if<XdsApi::Route::NonForwardingAction>(&route.action) ==
1052
- nullptr;
1096
+ absl::get_if<XdsRouteConfigResource::Route::NonForwardingAction>(
1097
+ &route.action) == nullptr;
1053
1098
  XdsRouting::GeneratePerHttpFilterConfigsResult result =
1054
1099
  XdsRouting::GeneratePerHTTPFilterConfigs(http_filters, vhost, route,
1055
1100
  nullptr, nullptr);
@@ -1089,19 +1134,19 @@ ServerConfigSelector::CallConfig XdsServerConfigFetcher::ListenerWatcher::
1089
1134
  FilterChainMatchManager::XdsServerConfigSelector::GetCallConfig(
1090
1135
  grpc_metadata_batch* metadata) {
1091
1136
  CallConfig call_config;
1092
- if (metadata->legacy_index()->named.path == nullptr) {
1137
+ if (metadata->get_pointer(HttpPathMetadata()) == nullptr) {
1093
1138
  call_config.error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("No path found");
1094
1139
  return call_config;
1095
1140
  }
1096
- absl::string_view path = StringViewFromSlice(
1097
- GRPC_MDVALUE(metadata->legacy_index()->named.path->md));
1098
- if (metadata->legacy_index()->named.authority == nullptr) {
1141
+ absl::string_view path =
1142
+ metadata->get_pointer(HttpPathMetadata())->as_string_view();
1143
+ if (metadata->get_pointer(HttpAuthorityMetadata()) == nullptr) {
1099
1144
  call_config.error =
1100
1145
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("No authority found");
1101
1146
  return call_config;
1102
1147
  }
1103
- absl::string_view authority = StringViewFromSlice(
1104
- GRPC_MDVALUE(metadata->legacy_index()->named.authority->md));
1148
+ absl::string_view authority =
1149
+ metadata->get_pointer(HttpAuthorityMetadata())->as_string_view();
1105
1150
  auto vhost_index = XdsRouting::FindVirtualHostForDomain(
1106
1151
  VirtualHostListIterator(&virtual_hosts_), authority);
1107
1152
  if (!vhost_index.has_value()) {
@@ -1146,18 +1191,28 @@ XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
1146
1191
  DynamicXdsServerConfigSelectorProvider::
1147
1192
  DynamicXdsServerConfigSelectorProvider(
1148
1193
  RefCountedPtr<XdsClient> xds_client, std::string resource_name,
1149
- absl::StatusOr<XdsApi::RdsUpdate> initial_resource,
1150
- std::vector<XdsApi::LdsUpdate::HttpConnectionManager::HttpFilter>
1194
+ absl::StatusOr<XdsRouteConfigResource> initial_resource,
1195
+ std::vector<XdsListenerResource::HttpConnectionManager::HttpFilter>
1151
1196
  http_filters)
1152
1197
  : xds_client_(std::move(xds_client)),
1153
1198
  resource_name_(std::move(resource_name)),
1154
1199
  http_filters_(std::move(http_filters)),
1155
1200
  resource_(std::move(initial_resource)) {
1156
1201
  GPR_ASSERT(!resource_name_.empty());
1157
- auto route_config_watcher = MakeRefCounted<RouteConfigWatcher>(Ref());
1202
+ // RouteConfigWatcher is being created here instead of in Watch() to avoid
1203
+ // deadlocks from invoking XdsRouteConfigResourceType::StartWatch whilst in a
1204
+ // critical region.
1205
+ auto route_config_watcher = MakeRefCounted<RouteConfigWatcher>(WeakRef());
1158
1206
  route_config_watcher_ = route_config_watcher.get();
1159
- xds_client_->WatchRouteConfigData(resource_name_,
1160
- std::move(route_config_watcher));
1207
+ XdsRouteConfigResourceType::StartWatch(xds_client_.get(), resource_name_,
1208
+ std::move(route_config_watcher));
1209
+ }
1210
+
1211
+ void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
1212
+ DynamicXdsServerConfigSelectorProvider::Orphan() {
1213
+ XdsRouteConfigResourceType::CancelWatch(xds_client_.get(), resource_name_,
1214
+ route_config_watcher_,
1215
+ false /* delay_unsubscription */);
1161
1216
  }
1162
1217
 
1163
1218
  absl::StatusOr<RefCountedPtr<ServerConfigSelector>>
@@ -1166,7 +1221,7 @@ XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
1166
1221
  std::unique_ptr<
1167
1222
  ServerConfigSelectorProvider::ServerConfigSelectorWatcher>
1168
1223
  watcher) {
1169
- absl::StatusOr<XdsApi::RdsUpdate> resource;
1224
+ absl::StatusOr<XdsRouteConfigResource> resource;
1170
1225
  {
1171
1226
  MutexLock lock(&mu_);
1172
1227
  GPR_ASSERT(watcher_ == nullptr);
@@ -1181,20 +1236,22 @@ XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
1181
1236
 
1182
1237
  void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
1183
1238
  DynamicXdsServerConfigSelectorProvider::CancelWatch() {
1184
- xds_client_->CancelRouteConfigDataWatch(resource_name_, route_config_watcher_,
1185
- false /* delay_unsubscription */);
1186
1239
  MutexLock lock(&mu_);
1187
1240
  watcher_.reset();
1188
1241
  }
1189
1242
 
1190
1243
  void XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager::
1191
1244
  DynamicXdsServerConfigSelectorProvider::OnRouteConfigChanged(
1192
- XdsApi::RdsUpdate rds_update) {
1245
+ XdsRouteConfigResource rds_update) {
1193
1246
  MutexLock lock(&mu_);
1194
1247
  resource_ = std::move(rds_update);
1195
1248
  if (watcher_ == nullptr) {
1196
1249
  return;
1197
1250
  }
1251
+ // Currently server_config_selector_filter does not call into
1252
+ // DynamicXdsServerConfigSelectorProvider while holding a lock, but if that
1253
+ // ever changes, we would want to invoke the update outside the critical
1254
+ // region with the use of a WorkSerializer.
1198
1255
  watcher_->OnServerConfigSelectorUpdate(
1199
1256
  XdsServerConfigSelector::Create(*resource_, http_filters_));
1200
1257
  }
@@ -1235,7 +1292,10 @@ grpc_server_config_fetcher* grpc_server_config_fetcher_xds_create(
1235
1292
  args = grpc_core::CoreConfiguration::Get()
1236
1293
  .channel_args_preconditioning()
1237
1294
  .PreconditionChannelArgs(args);
1238
- GRPC_API_TRACE("grpc_server_config_fetcher_xds_create()", 0, ());
1295
+ GRPC_API_TRACE(
1296
+ "grpc_server_config_fetcher_xds_create(notifier={on_serving_status_"
1297
+ "update=%p, user_data=%p}, args=%p)",
1298
+ 3, (notifier.on_serving_status_update, notifier.user_data, args));
1239
1299
  grpc_error_handle error = GRPC_ERROR_NONE;
1240
1300
  grpc_core::RefCountedPtr<grpc_core::XdsClient> xds_client =
1241
1301
  grpc_core::XdsClient::GetOrCreate(args, &error);