grpc 1.41.1 → 1.42.0.pre1

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 (416) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +55 -43
  3. data/include/grpc/event_engine/event_engine.h +82 -42
  4. data/include/grpc/event_engine/internal/memory_allocator_impl.h +98 -0
  5. data/include/grpc/event_engine/memory_allocator.h +210 -0
  6. data/include/grpc/grpc.h +4 -0
  7. data/include/grpc/grpc_security.h +18 -0
  8. data/include/grpc/grpc_security_constants.h +1 -0
  9. data/include/grpc/impl/codegen/port_platform.h +7 -0
  10. data/src/core/ext/filters/client_channel/backend_metric.cc +18 -19
  11. data/src/core/ext/filters/client_channel/backup_poller.cc +2 -1
  12. data/src/core/ext/filters/client_channel/channel_connectivity.cc +71 -89
  13. data/src/core/ext/filters/client_channel/client_channel.cc +187 -252
  14. data/src/core/ext/filters/client_channel/client_channel.h +74 -27
  15. data/src/core/ext/filters/client_channel/client_channel_factory.cc +1 -1
  16. data/src/core/ext/filters/client_channel/client_channel_factory.h +17 -19
  17. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +8 -14
  18. data/src/core/ext/filters/client_channel/config_selector.cc +1 -1
  19. data/src/core/ext/filters/client_channel/config_selector.h +4 -5
  20. data/src/core/ext/filters/client_channel/connector.h +18 -18
  21. data/src/core/ext/filters/client_channel/dynamic_filters.cc +1 -1
  22. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +0 -1
  23. data/src/core/ext/filters/client_channel/health/health_check_client.cc +12 -11
  24. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +1 -1
  25. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +4 -0
  26. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +6 -15
  27. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +166 -82
  28. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +4 -0
  29. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +1 -1
  30. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +2 -4
  31. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +23 -7
  32. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +15 -10
  33. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +2 -3
  34. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +2502 -0
  35. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +6 -1
  36. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -1
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +6 -2
  38. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +1 -1
  39. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +5 -0
  40. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +8 -1
  41. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +7 -16
  42. data/src/core/ext/filters/client_channel/lb_policy.h +11 -1
  43. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -0
  44. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +139 -0
  45. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +11 -5
  46. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +3 -3
  47. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +12 -39
  48. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +21 -1
  49. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -2
  50. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +3 -1
  51. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +77 -68
  52. data/src/core/ext/filters/client_channel/resolver.h +1 -1
  53. data/src/core/ext/filters/client_channel/resolver_factory.h +2 -0
  54. data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -8
  55. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +1 -1
  56. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +1 -1
  57. data/src/core/ext/filters/client_channel/retry_filter.cc +48 -86
  58. data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
  59. data/src/core/ext/filters/client_channel/retry_throttle.cc +17 -48
  60. data/src/core/ext/filters/client_channel/server_address.h +1 -1
  61. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +49 -36
  62. data/src/core/ext/filters/client_channel/subchannel.cc +85 -143
  63. data/src/core/ext/filters/client_channel/subchannel.h +29 -49
  64. data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +22 -7
  65. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +11 -2
  66. data/src/core/ext/filters/client_idle/client_idle_filter.cc +27 -210
  67. data/src/core/ext/filters/client_idle/idle_filter_state.cc +96 -0
  68. data/src/core/ext/filters/client_idle/idle_filter_state.h +66 -0
  69. data/src/core/ext/filters/deadline/deadline_filter.cc +23 -26
  70. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +19 -19
  71. data/src/core/ext/filters/fault_injection/service_config_parser.cc +0 -1
  72. data/src/core/ext/filters/fault_injection/service_config_parser.h +1 -1
  73. data/src/core/ext/filters/http/client/http_client_filter.cc +41 -44
  74. data/src/core/ext/filters/http/client_authority_filter.cc +14 -15
  75. data/src/core/ext/filters/http/http_filters_plugin.cc +53 -71
  76. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +17 -12
  77. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +1 -1
  78. data/src/core/ext/filters/http/server/http_server_filter.cc +72 -69
  79. data/src/core/ext/filters/max_age/max_age_filter.cc +24 -26
  80. data/src/core/ext/filters/message_size/message_size_filter.cc +19 -16
  81. data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
  82. data/src/core/ext/{filters/client_channel → service_config}/service_config.cc +2 -2
  83. data/src/core/ext/{filters/client_channel → service_config}/service_config.h +4 -4
  84. data/src/core/ext/service_config/service_config_call_data.h +72 -0
  85. data/src/core/ext/{filters/client_channel → service_config}/service_config_parser.cc +3 -3
  86. data/src/core/ext/{filters/client_channel → service_config}/service_config_parser.h +8 -6
  87. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -5
  88. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +19 -24
  89. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +27 -50
  90. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +14 -16
  91. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +59 -58
  92. data/src/core/ext/transport/chttp2/transport/flow_control.cc +19 -16
  93. data/src/core/ext/transport/chttp2/transport/flow_control.h +4 -4
  94. data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -4
  95. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -1
  96. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -1
  97. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -3
  98. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -2
  99. data/src/core/ext/transport/chttp2/transport/hpack_constants.h +1 -1
  100. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +41 -1
  101. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +8 -4
  102. data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +1 -1
  103. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +136 -98
  104. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +27 -8
  105. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +12 -25
  106. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +37 -30
  107. data/src/core/ext/transport/chttp2/transport/internal.h +4 -3
  108. data/src/core/ext/transport/chttp2/transport/parsing.cc +30 -173
  109. data/src/core/ext/transport/chttp2/transport/popularity_count.h +1 -1
  110. data/src/core/ext/transport/chttp2/transport/writing.cc +29 -22
  111. data/src/core/ext/transport/inproc/inproc_transport.cc +105 -109
  112. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +68 -34
  113. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +139 -1
  114. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +16 -4
  115. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +53 -4
  116. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +3 -2
  117. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +15 -0
  118. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +13 -8
  119. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +23 -0
  120. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +0 -1
  121. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +14 -11
  122. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +17 -0
  123. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +15 -12
  124. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +49 -19
  125. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +55 -0
  126. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +154 -0
  127. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +0 -2
  128. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +58 -0
  129. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +182 -0
  130. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +1 -1
  131. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +1 -1
  132. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +1 -1
  133. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +1 -1
  134. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +1 -1
  135. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +1 -1
  136. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +58 -0
  137. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +130 -0
  138. data/src/core/ext/upb-generated/{udpa/type/v1 → xds/type/v3}/typed_struct.upb.c +7 -7
  139. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +83 -0
  140. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +310 -286
  141. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +10 -0
  142. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +101 -88
  143. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +5 -0
  144. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +59 -56
  145. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +59 -46
  146. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +78 -82
  147. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +323 -316
  148. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +5 -4
  149. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +19 -23
  150. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +4 -3
  151. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +5 -3
  152. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +5 -4
  153. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.c +75 -0
  154. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.h +50 -0
  155. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +13 -12
  156. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +25 -24
  157. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +16 -15
  158. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +17 -16
  159. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +33 -32
  160. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +19 -18
  161. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.c +45 -0
  162. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.h +35 -0
  163. data/src/core/ext/xds/xds_api.cc +325 -362
  164. data/src/core/ext/xds/xds_api.h +134 -82
  165. data/src/core/ext/xds/xds_bootstrap.h +10 -0
  166. data/src/core/ext/xds/xds_certificate_provider.cc +3 -3
  167. data/src/core/ext/xds/xds_channel_stack_modifier.cc +113 -0
  168. data/src/core/ext/xds/xds_channel_stack_modifier.h +52 -0
  169. data/src/core/ext/xds/xds_client.cc +527 -314
  170. data/src/core/ext/xds/xds_client.h +42 -37
  171. data/src/core/ext/xds/xds_client_stats.h +1 -1
  172. data/src/core/ext/xds/xds_server_config_fetcher.cc +5 -7
  173. data/src/core/lib/address_utils/parse_address.cc +2 -0
  174. data/src/core/lib/avl/avl.cc +5 -5
  175. data/src/core/lib/backoff/backoff.cc +1 -1
  176. data/src/core/lib/channel/channel_args.cc +24 -6
  177. data/src/core/lib/channel/channel_args.h +9 -0
  178. data/src/core/lib/channel/channel_stack_builder.cc +3 -3
  179. data/src/core/lib/channel/channel_trace.cc +1 -1
  180. data/src/core/lib/channel/channel_trace.h +1 -1
  181. data/src/core/lib/channel/channelz.cc +3 -3
  182. data/src/core/lib/channel/channelz.h +2 -2
  183. data/src/core/lib/channel/channelz_registry.cc +1 -1
  184. data/src/core/lib/channel/channelz_registry.h +1 -1
  185. data/src/core/lib/channel/connected_channel.cc +1 -3
  186. data/src/core/lib/channel/connected_channel.h +1 -2
  187. data/src/core/lib/compression/compression.cc +2 -2
  188. data/src/core/lib/compression/compression_args.cc +6 -4
  189. data/src/core/lib/compression/compression_internal.cc +2 -2
  190. data/src/core/lib/compression/compression_internal.h +1 -1
  191. data/src/core/lib/config/core_configuration.cc +44 -2
  192. data/src/core/lib/config/core_configuration.h +39 -1
  193. data/src/core/lib/debug/stats.cc +1 -1
  194. data/src/core/lib/debug/stats_data.cc +13 -13
  195. data/src/core/lib/gpr/atm.cc +1 -1
  196. data/src/core/lib/gpr/cpu_posix.cc +1 -1
  197. data/src/core/lib/gpr/string.cc +2 -2
  198. data/src/core/lib/gpr/tls.h +1 -1
  199. data/src/core/lib/gpr/useful.h +79 -32
  200. data/src/core/lib/gprpp/arena.h +10 -0
  201. data/src/core/lib/gprpp/bitset.h +38 -16
  202. data/src/core/lib/gprpp/chunked_vector.h +211 -0
  203. data/src/core/lib/gprpp/construct_destruct.h +1 -1
  204. data/src/core/lib/gprpp/match.h +1 -1
  205. data/src/core/lib/gprpp/memory.h +6 -0
  206. data/src/core/lib/gprpp/overload.h +1 -1
  207. data/src/core/lib/gprpp/status_helper.cc +23 -3
  208. data/src/core/lib/gprpp/status_helper.h +12 -1
  209. data/src/core/lib/gprpp/table.h +411 -0
  210. data/src/core/lib/http/httpcli.cc +200 -182
  211. data/src/core/lib/http/parser.cc +2 -2
  212. data/src/core/lib/iomgr/call_combiner.cc +28 -10
  213. data/src/core/lib/iomgr/combiner.cc +6 -21
  214. data/src/core/lib/iomgr/endpoint_cfstream.cc +7 -6
  215. data/src/core/lib/iomgr/error.cc +113 -52
  216. data/src/core/lib/iomgr/error.h +50 -9
  217. data/src/core/lib/iomgr/error_cfstream.cc +5 -0
  218. data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -2
  219. data/src/core/lib/iomgr/ev_epollex_linux.cc +7 -7
  220. data/src/core/lib/iomgr/ev_poll_posix.cc +29 -20
  221. data/src/core/lib/iomgr/event_engine/closure.cc +41 -18
  222. data/src/core/lib/iomgr/event_engine/closure.h +10 -1
  223. data/src/core/lib/iomgr/event_engine/endpoint.cc +3 -3
  224. data/src/core/lib/iomgr/event_engine/iomgr.cc +1 -1
  225. data/src/core/lib/iomgr/event_engine/pollset.cc +5 -4
  226. data/src/core/lib/iomgr/event_engine/resolver.cc +10 -7
  227. data/src/core/lib/iomgr/event_engine/tcp.cc +9 -8
  228. data/src/core/lib/iomgr/event_engine/timer.cc +7 -2
  229. data/src/core/lib/iomgr/exec_ctx.cc +1 -9
  230. data/src/core/lib/iomgr/executor/mpmcqueue.cc +5 -7
  231. data/src/core/lib/iomgr/executor/mpmcqueue.h +3 -8
  232. data/src/core/lib/iomgr/executor.cc +6 -20
  233. data/src/core/lib/iomgr/iomgr.cc +3 -1
  234. data/src/core/lib/iomgr/iomgr_internal.cc +4 -9
  235. data/src/core/lib/iomgr/iomgr_internal.h +3 -2
  236. data/src/core/lib/iomgr/load_file.cc +2 -2
  237. data/src/core/lib/iomgr/lockfree_event.cc +18 -0
  238. data/src/core/lib/iomgr/pollset_custom.cc +1 -1
  239. data/src/core/lib/iomgr/pollset_custom.h +1 -1
  240. data/src/core/lib/iomgr/resolve_address_posix.cc +5 -7
  241. data/src/core/lib/iomgr/resource_quota.cc +13 -11
  242. data/src/core/lib/iomgr/socket_factory_posix.cc +2 -2
  243. data/src/core/lib/iomgr/socket_mutator.cc +2 -2
  244. data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -2
  245. data/src/core/lib/iomgr/tcp_client_cfstream.cc +5 -3
  246. data/src/core/lib/iomgr/tcp_client_custom.cc +1 -1
  247. data/src/core/lib/iomgr/tcp_client_posix.cc +9 -18
  248. data/src/core/lib/iomgr/tcp_client_windows.cc +2 -3
  249. data/src/core/lib/iomgr/tcp_posix.cc +4 -5
  250. data/src/core/lib/iomgr/tcp_server_custom.cc +2 -1
  251. data/src/core/lib/iomgr/tcp_server_posix.cc +3 -4
  252. data/src/core/lib/iomgr/tcp_server_windows.cc +4 -5
  253. data/src/core/lib/iomgr/tcp_windows.cc +2 -2
  254. data/src/core/lib/iomgr/timer_generic.cc +13 -13
  255. data/src/core/lib/iomgr/timer_heap.cc +1 -1
  256. data/src/core/lib/json/json_util.cc +68 -0
  257. data/src/core/lib/json/json_util.h +57 -99
  258. data/src/core/lib/json/json_writer.cc +0 -3
  259. data/src/core/lib/security/authorization/authorization_policy_provider.h +1 -1
  260. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +1 -1
  261. data/src/core/lib/security/authorization/evaluate_args.cc +14 -12
  262. data/src/core/lib/security/authorization/sdk_server_authz_filter.cc +13 -1
  263. data/src/core/lib/security/context/security_context.cc +4 -2
  264. data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
  265. data/src/core/lib/security/credentials/credentials.cc +4 -2
  266. data/src/core/lib/security/credentials/credentials.h +6 -1
  267. data/src/core/lib/security/credentials/external/external_account_credentials.cc +47 -11
  268. data/src/core/lib/security/credentials/external/external_account_credentials.h +1 -0
  269. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -1
  270. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +5 -9
  271. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -2
  272. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +2 -2
  273. data/src/core/lib/security/security_connector/security_connector.cc +9 -4
  274. data/src/core/lib/security/security_connector/security_connector.h +1 -1
  275. data/src/core/lib/security/security_connector/ssl_utils.cc +1 -1
  276. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +1 -0
  277. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +0 -2
  278. data/src/core/lib/security/transport/client_auth_filter.cc +5 -5
  279. data/src/core/lib/security/transport/security_handshaker.cc +73 -43
  280. data/src/core/lib/security/transport/server_auth_filter.cc +3 -5
  281. data/src/core/lib/security/transport/tsi_error.cc +3 -5
  282. data/src/core/lib/slice/slice.cc +0 -16
  283. data/src/core/lib/slice/slice_api.cc +39 -0
  284. data/src/core/lib/slice/slice_buffer.cc +5 -5
  285. data/src/core/lib/slice/slice_intern.cc +8 -13
  286. data/src/core/lib/slice/slice_internal.h +1 -244
  287. data/src/core/lib/slice/slice_refcount.cc +17 -0
  288. data/src/core/lib/slice/slice_refcount.h +121 -0
  289. data/src/core/lib/slice/slice_refcount_base.h +173 -0
  290. data/src/core/lib/slice/slice_split.cc +100 -0
  291. data/src/core/lib/slice/slice_split.h +40 -0
  292. data/src/core/lib/slice/slice_string_helpers.cc +0 -83
  293. data/src/core/lib/slice/slice_string_helpers.h +0 -11
  294. data/src/core/lib/slice/static_slice.cc +529 -0
  295. data/src/core/lib/slice/static_slice.h +331 -0
  296. data/src/core/lib/surface/builtins.cc +49 -0
  297. data/src/core/{ext/filters/workarounds/workaround_cronet_compression_filter.h → lib/surface/builtins.h} +8 -9
  298. data/src/core/lib/surface/call.cc +103 -120
  299. data/src/core/lib/surface/call.h +0 -6
  300. data/src/core/lib/surface/channel.cc +19 -32
  301. data/src/core/lib/surface/channel.h +0 -9
  302. data/src/core/lib/surface/channel_init.cc +23 -76
  303. data/src/core/lib/surface/channel_init.h +52 -44
  304. data/src/core/lib/surface/completion_queue.cc +6 -5
  305. data/src/core/lib/surface/init.cc +0 -39
  306. data/src/core/lib/surface/init_secure.cc +17 -14
  307. data/src/core/lib/surface/lame_client.cc +18 -11
  308. data/src/core/lib/surface/lame_client.h +1 -1
  309. data/src/core/lib/surface/server.cc +25 -17
  310. data/src/core/lib/surface/server.h +17 -10
  311. data/src/core/lib/surface/validate_metadata.cc +5 -2
  312. data/src/core/lib/surface/version.cc +2 -2
  313. data/src/core/lib/transport/bdp_estimator.cc +1 -1
  314. data/src/core/lib/transport/error_utils.cc +42 -17
  315. data/src/core/lib/transport/error_utils.h +1 -1
  316. data/src/core/lib/transport/metadata.cc +31 -10
  317. data/src/core/lib/transport/metadata.h +2 -1
  318. data/src/core/lib/transport/metadata_batch.cc +35 -371
  319. data/src/core/lib/transport/metadata_batch.h +905 -71
  320. data/src/core/lib/transport/parsed_metadata.h +263 -0
  321. data/src/core/lib/transport/pid_controller.cc +4 -4
  322. data/src/core/lib/transport/static_metadata.cc +714 -846
  323. data/src/core/lib/transport/static_metadata.h +115 -379
  324. data/src/core/lib/transport/status_metadata.cc +1 -0
  325. data/src/core/lib/transport/transport.cc +4 -5
  326. data/src/core/lib/transport/transport_op_string.cc +40 -20
  327. data/src/core/plugin_registry/grpc_plugin_registry.cc +64 -43
  328. data/src/core/tsi/alts/crypt/aes_gcm.cc +3 -1
  329. data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +13 -12
  330. data/src/core/tsi/alts/frame_protector/frame_handler.cc +10 -11
  331. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -2
  332. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +12 -2
  333. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +1 -1
  334. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +2 -2
  335. data/src/core/tsi/fake_transport_security.cc +15 -7
  336. data/src/core/tsi/local_transport_security.cc +36 -73
  337. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +16 -50
  338. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -3
  339. data/src/core/tsi/ssl_transport_security.cc +10 -2
  340. data/src/core/tsi/transport_security.cc +12 -0
  341. data/src/core/tsi/transport_security.h +16 -1
  342. data/src/core/tsi/transport_security_interface.h +26 -0
  343. data/src/ruby/ext/grpc/extconf.rb +12 -9
  344. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  345. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  346. data/src/ruby/lib/grpc/version.rb +1 -1
  347. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -2
  348. data/src/ruby/spec/client_server_spec.rb +1 -1
  349. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +4 -4
  350. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +11 -6
  351. data/third_party/address_sorting/address_sorting_posix.c +1 -0
  352. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +20 -21
  353. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +104 -114
  354. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +13 -0
  355. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +4 -6
  356. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +38 -47
  357. data/third_party/boringssl-with-bazel/src/crypto/evp/scrypt.c +32 -34
  358. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/sqrt.c +5 -9
  359. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/des.c +10 -11
  360. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/internal.h +1 -3
  361. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +3 -6
  362. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +4 -7
  363. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +35 -35
  364. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +11 -10
  365. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +10 -37
  366. data/third_party/boringssl-with-bazel/src/crypto/internal.h +39 -0
  367. data/third_party/boringssl-with-bazel/src/crypto/siphash/siphash.c +6 -6
  368. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +0 -1
  369. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +72 -45
  370. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +5 -1
  371. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +2 -2
  372. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +479 -15
  373. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +16 -564
  374. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +0 -1
  375. data/third_party/re2/re2/compile.cc +91 -109
  376. data/third_party/re2/re2/dfa.cc +27 -39
  377. data/third_party/re2/re2/filtered_re2.cc +18 -2
  378. data/third_party/re2/re2/filtered_re2.h +10 -5
  379. data/third_party/re2/re2/nfa.cc +1 -1
  380. data/third_party/re2/re2/parse.cc +42 -23
  381. data/third_party/re2/re2/perl_groups.cc +34 -34
  382. data/third_party/re2/re2/prefilter.cc +3 -2
  383. data/third_party/re2/re2/prog.cc +182 -4
  384. data/third_party/re2/re2/prog.h +28 -9
  385. data/third_party/re2/re2/re2.cc +87 -118
  386. data/third_party/re2/re2/re2.h +156 -141
  387. data/third_party/re2/re2/regexp.cc +12 -5
  388. data/third_party/re2/re2/regexp.h +8 -2
  389. data/third_party/re2/re2/set.cc +31 -9
  390. data/third_party/re2/re2/set.h +9 -4
  391. data/third_party/re2/re2/simplify.cc +11 -3
  392. data/third_party/re2/re2/tostring.cc +1 -1
  393. data/third_party/re2/re2/walker-inl.h +1 -1
  394. data/third_party/re2/util/mutex.h +2 -2
  395. data/third_party/re2/util/pcre.h +3 -3
  396. metadata +78 -66
  397. data/include/grpc/event_engine/slice_allocator.h +0 -71
  398. data/src/core/ext/filters/client_channel/service_config_call_data.h +0 -126
  399. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +0 -211
  400. data/src/core/ext/filters/workarounds/workaround_utils.cc +0 -53
  401. data/src/core/ext/filters/workarounds/workaround_utils.h +0 -39
  402. data/src/core/ext/transport/chttp2/client/authority.cc +0 -42
  403. data/src/core/ext/transport/chttp2/client/authority.h +0 -36
  404. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.cc +0 -67
  405. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +0 -74
  406. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +0 -66
  407. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +0 -58
  408. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +0 -58
  409. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +0 -130
  410. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +0 -83
  411. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +0 -44
  412. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +0 -35
  413. data/src/core/lib/iomgr/udp_server.cc +0 -747
  414. data/src/core/lib/iomgr/udp_server.h +0 -103
  415. data/src/core/lib/transport/authority_override.cc +0 -40
  416. data/src/core/lib/transport/authority_override.h +0 -37
@@ -42,6 +42,8 @@ typedef struct local_zero_copy_grpc_protector {
42
42
  typedef struct local_tsi_handshaker_result {
43
43
  tsi_handshaker_result base;
44
44
  bool is_client;
45
+ unsigned char* unused_bytes;
46
+ size_t unused_bytes_size;
45
47
  } local_tsi_handshaker_result;
46
48
 
47
49
  /* Main struct for local TSI handshaker. */
@@ -50,83 +52,34 @@ typedef struct local_tsi_handshaker {
50
52
  bool is_client;
51
53
  } local_tsi_handshaker;
52
54
 
53
- /* --- tsi_zero_copy_grpc_protector methods implementation. --- */
55
+ /* --- tsi_handshaker_result methods implementation. --- */
54
56
 
55
- static tsi_result local_zero_copy_grpc_protector_protect(
56
- tsi_zero_copy_grpc_protector* self, grpc_slice_buffer* unprotected_slices,
57
- grpc_slice_buffer* protected_slices) {
58
- if (self == nullptr || unprotected_slices == nullptr ||
59
- protected_slices == nullptr) {
60
- gpr_log(GPR_ERROR, "Invalid nullptr arguments to zero-copy grpc protect.");
61
- return TSI_INVALID_ARGUMENT;
62
- }
63
- grpc_slice_buffer_move_into(unprotected_slices, protected_slices);
57
+ static tsi_result handshaker_result_extract_peer(
58
+ const tsi_handshaker_result* /*self*/, tsi_peer* /*peer*/) {
64
59
  return TSI_OK;
65
60
  }
66
61
 
67
- static tsi_result local_zero_copy_grpc_protector_unprotect(
68
- tsi_zero_copy_grpc_protector* self, grpc_slice_buffer* protected_slices,
69
- grpc_slice_buffer* unprotected_slices) {
70
- if (self == nullptr || unprotected_slices == nullptr ||
71
- protected_slices == nullptr) {
72
- gpr_log(GPR_ERROR,
73
- "Invalid nullptr arguments to zero-copy grpc unprotect.");
74
- return TSI_INVALID_ARGUMENT;
75
- }
76
- grpc_slice_buffer_move_into(protected_slices, unprotected_slices);
62
+ static tsi_result handshaker_result_get_frame_protector_type(
63
+ const tsi_handshaker_result* /*self*/,
64
+ tsi_frame_protector_type* frame_protector_type) {
65
+ *frame_protector_type = TSI_FRAME_PROTECTOR_NONE;
77
66
  return TSI_OK;
78
67
  }
79
68
 
80
- static void local_zero_copy_grpc_protector_destroy(
81
- tsi_zero_copy_grpc_protector* self) {
82
- gpr_free(self);
83
- }
84
-
85
- static const tsi_zero_copy_grpc_protector_vtable
86
- local_zero_copy_grpc_protector_vtable = {
87
- local_zero_copy_grpc_protector_protect,
88
- local_zero_copy_grpc_protector_unprotect,
89
- local_zero_copy_grpc_protector_destroy,
90
- nullptr /* local_zero_copy_grpc_protector_max_frame_size */};
91
-
92
- tsi_result local_zero_copy_grpc_protector_create(
93
- tsi_zero_copy_grpc_protector** protector) {
94
- if (grpc_core::ExecCtx::Get() == nullptr || protector == nullptr) {
95
- gpr_log(
96
- GPR_ERROR,
97
- "Invalid nullptr arguments to local_zero_copy_grpc_protector create.");
69
+ static tsi_result handshaker_result_get_unused_bytes(
70
+ const tsi_handshaker_result* self, const unsigned char** bytes,
71
+ size_t* bytes_size) {
72
+ if (self == nullptr || bytes == nullptr || bytes_size == nullptr) {
73
+ gpr_log(GPR_ERROR, "Invalid arguments to get_unused_bytes()");
98
74
  return TSI_INVALID_ARGUMENT;
99
75
  }
100
- local_zero_copy_grpc_protector* impl =
101
- static_cast<local_zero_copy_grpc_protector*>(gpr_zalloc(sizeof(*impl)));
102
- impl->base.vtable = &local_zero_copy_grpc_protector_vtable;
103
- *protector = &impl->base;
76
+ auto* result = reinterpret_cast<local_tsi_handshaker_result*>(
77
+ const_cast<tsi_handshaker_result*>(self));
78
+ *bytes_size = result->unused_bytes_size;
79
+ *bytes = result->unused_bytes;
104
80
  return TSI_OK;
105
81
  }
106
82
 
107
- /* --- tsi_handshaker_result methods implementation. --- */
108
-
109
- static tsi_result handshaker_result_extract_peer(
110
- const tsi_handshaker_result* /*self*/, tsi_peer* /*peer*/) {
111
- return TSI_OK;
112
- }
113
-
114
- static tsi_result handshaker_result_create_zero_copy_grpc_protector(
115
- const tsi_handshaker_result* self,
116
- size_t* /*max_output_protected_frame_size*/,
117
- tsi_zero_copy_grpc_protector** protector) {
118
- if (self == nullptr || protector == nullptr) {
119
- gpr_log(GPR_ERROR,
120
- "Invalid arguments to create_zero_copy_grpc_protector()");
121
- return TSI_INVALID_ARGUMENT;
122
- }
123
- tsi_result ok = local_zero_copy_grpc_protector_create(protector);
124
- if (ok != TSI_OK) {
125
- gpr_log(GPR_ERROR, "Failed to create zero-copy grpc protector");
126
- }
127
- return ok;
128
- }
129
-
130
83
  static void handshaker_result_destroy(tsi_handshaker_result* self) {
131
84
  if (self == nullptr) {
132
85
  return;
@@ -134,25 +87,35 @@ static void handshaker_result_destroy(tsi_handshaker_result* self) {
134
87
  local_tsi_handshaker_result* result =
135
88
  reinterpret_cast<local_tsi_handshaker_result*>(
136
89
  const_cast<tsi_handshaker_result*>(self));
90
+ gpr_free(result->unused_bytes);
137
91
  gpr_free(result);
138
92
  }
139
93
 
140
94
  static const tsi_handshaker_result_vtable result_vtable = {
141
95
  handshaker_result_extract_peer,
142
- handshaker_result_create_zero_copy_grpc_protector,
96
+ handshaker_result_get_frame_protector_type,
97
+ nullptr, /* handshaker_result_create_zero_copy_grpc_protector */
143
98
  nullptr, /* handshaker_result_create_frame_protector */
144
- nullptr, /* handshaker_result_get_unused_bytes */
99
+ handshaker_result_get_unused_bytes,
145
100
  handshaker_result_destroy};
146
101
 
147
102
  static tsi_result create_handshaker_result(bool is_client,
103
+ const unsigned char* received_bytes,
104
+ size_t received_bytes_size,
148
105
  tsi_handshaker_result** self) {
149
106
  if (self == nullptr) {
150
107
  gpr_log(GPR_ERROR, "Invalid arguments to create_handshaker_result()");
151
108
  return TSI_INVALID_ARGUMENT;
152
109
  }
153
110
  local_tsi_handshaker_result* result =
154
- static_cast<local_tsi_handshaker_result*>(gpr_zalloc(sizeof(*result)));
111
+ grpc_core::Zalloc<local_tsi_handshaker_result>();
155
112
  result->is_client = is_client;
113
+ if (received_bytes_size > 0) {
114
+ result->unused_bytes =
115
+ static_cast<unsigned char*>(gpr_malloc(received_bytes_size));
116
+ memcpy(result->unused_bytes, received_bytes, received_bytes_size);
117
+ }
118
+ result->unused_bytes_size = received_bytes_size;
156
119
  result->base.vtable = &result_vtable;
157
120
  *self = &result->base;
158
121
  return TSI_OK;
@@ -161,8 +124,8 @@ static tsi_result create_handshaker_result(bool is_client,
161
124
  /* --- tsi_handshaker methods implementation. --- */
162
125
 
163
126
  static tsi_result handshaker_next(
164
- tsi_handshaker* self, const unsigned char* /*received_bytes*/,
165
- size_t /*received_bytes_size*/, const unsigned char** /*bytes_to_send*/,
127
+ tsi_handshaker* self, const unsigned char* received_bytes,
128
+ size_t received_bytes_size, const unsigned char** /*bytes_to_send*/,
166
129
  size_t* bytes_to_send_size, tsi_handshaker_result** result,
167
130
  tsi_handshaker_on_next_done_cb /*cb*/, void* /*user_data*/) {
168
131
  if (self == nullptr) {
@@ -175,7 +138,8 @@ static tsi_result handshaker_next(
175
138
  local_tsi_handshaker* handshaker =
176
139
  reinterpret_cast<local_tsi_handshaker*>(self);
177
140
  *bytes_to_send_size = 0;
178
- create_handshaker_result(handshaker->is_client, result);
141
+ create_handshaker_result(handshaker->is_client, received_bytes,
142
+ received_bytes_size, result);
179
143
  return TSI_OK;
180
144
  }
181
145
 
@@ -206,8 +170,7 @@ tsi_result tsi_local_handshaker_create(bool is_client, tsi_handshaker** self) {
206
170
  gpr_log(GPR_ERROR, "Invalid arguments to local_tsi_handshaker_create()");
207
171
  return TSI_INVALID_ARGUMENT;
208
172
  }
209
- local_tsi_handshaker* handshaker =
210
- static_cast<local_tsi_handshaker*>(gpr_zalloc(sizeof(*handshaker)));
173
+ local_tsi_handshaker* handshaker = grpc_core::Zalloc<local_tsi_handshaker>();
211
174
  handshaker->is_client = is_client;
212
175
  handshaker->base.vtable = &handshaker_vtable;
213
176
  *self = &handshaker->base;
@@ -29,41 +29,18 @@
29
29
 
30
30
  namespace tsi {
31
31
 
32
- static void cache_key_avl_destroy(void* /*key*/, void* /*unused*/) {}
33
-
34
- static void* cache_key_avl_copy(void* key, void* /*unused*/) { return key; }
35
-
36
- static long cache_key_avl_compare(void* key1, void* key2, void* /*unused*/) {
37
- return grpc_slice_cmp(*static_cast<grpc_slice*>(key1),
38
- *static_cast<grpc_slice*>(key2));
39
- }
40
-
41
- static void cache_value_avl_destroy(void* /*value*/, void* /*unused*/) {}
42
-
43
- static void* cache_value_avl_copy(void* value, void* /*unused*/) {
44
- return value;
45
- }
46
-
47
- // AVL only stores pointers, ownership belonges to the linked list.
48
- static const grpc_avl_vtable cache_avl_vtable = {
49
- cache_key_avl_destroy, cache_key_avl_copy, cache_key_avl_compare,
50
- cache_value_avl_destroy, cache_value_avl_copy,
51
- };
52
-
53
32
  /// Node for single cached session.
54
33
  class SslSessionLRUCache::Node {
55
34
  public:
56
- Node(const grpc_slice& key, SslSessionPtr session) : key_(key) {
35
+ Node(const std::string& key, SslSessionPtr session) : key_(key) {
57
36
  SetSession(std::move(session));
58
37
  }
59
38
 
60
- ~Node() { grpc_slice_unref_internal(key_); }
61
-
62
39
  // Not copyable nor movable.
63
40
  Node(const Node&) = delete;
64
41
  Node& operator=(const Node&) = delete;
65
42
 
66
- void* AvlKey() { return &key_; }
43
+ const std::string& key() const { return key_; }
67
44
 
68
45
  /// Returns a copy of the node's cache session.
69
46
  SslSessionPtr CopySession() const { return session_->CopySession(); }
@@ -76,7 +53,7 @@ class SslSessionLRUCache::Node {
76
53
  private:
77
54
  friend class SslSessionLRUCache;
78
55
 
79
- grpc_slice key_;
56
+ std::string key_;
80
57
  std::unique_ptr<SslCachedSession> session_;
81
58
 
82
59
  Node* next_ = nullptr;
@@ -85,7 +62,6 @@ class SslSessionLRUCache::Node {
85
62
 
86
63
  SslSessionLRUCache::SslSessionLRUCache(size_t capacity) : capacity_(capacity) {
87
64
  GPR_ASSERT(capacity > 0);
88
- entry_by_key_ = grpc_avl_create(&cache_avl_vtable);
89
65
  }
90
66
 
91
67
  SslSessionLRUCache::~SslSessionLRUCache() {
@@ -95,7 +71,6 @@ SslSessionLRUCache::~SslSessionLRUCache() {
95
71
  delete node;
96
72
  node = next;
97
73
  }
98
- grpc_avl_unref(entry_by_key_, nullptr);
99
74
  }
100
75
 
101
76
  size_t SslSessionLRUCache::Size() {
@@ -104,13 +79,12 @@ size_t SslSessionLRUCache::Size() {
104
79
  }
105
80
 
106
81
  SslSessionLRUCache::Node* SslSessionLRUCache::FindLocked(
107
- const grpc_slice& key) {
108
- void* value =
109
- grpc_avl_get(entry_by_key_, const_cast<grpc_slice*>(&key), nullptr);
110
- if (value == nullptr) {
82
+ const std::string& key) {
83
+ auto it = entry_by_key_.find(key);
84
+ if (it == entry_by_key_.end()) {
111
85
  return nullptr;
112
86
  }
113
- Node* node = static_cast<Node*>(value);
87
+ Node* node = it->second;
114
88
  // Move to the beginning.
115
89
  Remove(node);
116
90
  PushFront(node);
@@ -120,22 +94,21 @@ SslSessionLRUCache::Node* SslSessionLRUCache::FindLocked(
120
94
 
121
95
  void SslSessionLRUCache::Put(const char* key, SslSessionPtr session) {
122
96
  grpc_core::MutexLock lock(&lock_);
123
- Node* node = FindLocked(grpc_slice_from_static_string(key));
97
+ Node* node = FindLocked(key);
124
98
  if (node != nullptr) {
125
99
  node->SetSession(std::move(session));
126
100
  return;
127
101
  }
128
- grpc_slice key_slice = grpc_slice_from_copied_string(key);
129
- node = new Node(key_slice, std::move(session));
102
+ node = new Node(key, std::move(session));
130
103
  PushFront(node);
131
- entry_by_key_ = grpc_avl_add(entry_by_key_, node->AvlKey(), node, nullptr);
104
+ entry_by_key_.emplace(key, node);
132
105
  AssertInvariants();
133
106
  if (use_order_list_size_ > capacity_) {
134
107
  GPR_ASSERT(use_order_list_tail_);
135
108
  node = use_order_list_tail_;
136
109
  Remove(node);
137
110
  // Order matters, key is destroyed after deleting node.
138
- entry_by_key_ = grpc_avl_remove(entry_by_key_, node->AvlKey(), nullptr);
111
+ entry_by_key_.erase(node->key());
139
112
  delete node;
140
113
  AssertInvariants();
141
114
  }
@@ -144,8 +117,7 @@ void SslSessionLRUCache::Put(const char* key, SslSessionPtr session) {
144
117
  SslSessionPtr SslSessionLRUCache::Get(const char* key) {
145
118
  grpc_core::MutexLock lock(&lock_);
146
119
  // Key is only used for lookups.
147
- grpc_slice key_slice = grpc_slice_from_static_string(key);
148
- Node* node = FindLocked(key_slice);
120
+ Node* node = FindLocked(key);
149
121
  if (node == nullptr) {
150
122
  return nullptr;
151
123
  }
@@ -183,13 +155,6 @@ void SslSessionLRUCache::PushFront(SslSessionLRUCache::Node* node) {
183
155
  }
184
156
 
185
157
  #ifndef NDEBUG
186
- static size_t calculate_tree_size(grpc_avl_node* node) {
187
- if (node == nullptr) {
188
- return 0;
189
- }
190
- return 1 + calculate_tree_size(node->left) + calculate_tree_size(node->right);
191
- }
192
-
193
158
  void SslSessionLRUCache::AssertInvariants() {
194
159
  size_t size = 0;
195
160
  Node* prev = nullptr;
@@ -197,14 +162,15 @@ void SslSessionLRUCache::AssertInvariants() {
197
162
  while (current != nullptr) {
198
163
  size++;
199
164
  GPR_ASSERT(current->prev_ == prev);
200
- void* node = grpc_avl_get(entry_by_key_, current->AvlKey(), nullptr);
201
- GPR_ASSERT(node == current);
165
+ auto it = entry_by_key_.find(current->key());
166
+ GPR_ASSERT(it != entry_by_key_.end());
167
+ GPR_ASSERT(it->second == current);
202
168
  prev = current;
203
169
  current = current->next_;
204
170
  }
205
171
  GPR_ASSERT(prev == use_order_list_tail_);
206
172
  GPR_ASSERT(size == use_order_list_size_);
207
- GPR_ASSERT(calculate_tree_size(entry_by_key_.root) == use_order_list_size_);
173
+ GPR_ASSERT(entry_by_key_.size() == use_order_list_size_);
208
174
  }
209
175
  #else
210
176
  void SslSessionLRUCache::AssertInvariants() {}
@@ -28,7 +28,8 @@ extern "C" {
28
28
  #include <openssl/ssl.h>
29
29
  }
30
30
 
31
- #include "src/core/lib/avl/avl.h"
31
+ #include <map>
32
+
32
33
  #include "src/core/lib/gprpp/memory.h"
33
34
  #include "src/core/lib/gprpp/ref_counted.h"
34
35
  #include "src/core/lib/gprpp/sync.h"
@@ -72,7 +73,7 @@ class SslSessionLRUCache : public grpc_core::RefCounted<SslSessionLRUCache> {
72
73
  private:
73
74
  class Node;
74
75
 
75
- Node* FindLocked(const grpc_slice& key);
76
+ Node* FindLocked(const std::string& key);
76
77
  void Remove(Node* node);
77
78
  void PushFront(Node* node);
78
79
  void AssertInvariants();
@@ -83,7 +84,7 @@ class SslSessionLRUCache : public grpc_core::RefCounted<SslSessionLRUCache> {
83
84
  Node* use_order_list_head_ = nullptr;
84
85
  Node* use_order_list_tail_ = nullptr;
85
86
  size_t use_order_list_size_ = 0;
86
- grpc_avl entry_by_key_;
87
+ std::map<std::string, Node*> entry_by_key_;
87
88
  };
88
89
 
89
90
  } // namespace tsi
@@ -1302,6 +1302,13 @@ static tsi_result ssl_handshaker_result_extract_peer(
1302
1302
  return result;
1303
1303
  }
1304
1304
 
1305
+ static tsi_result ssl_handshaker_result_get_frame_protector_type(
1306
+ const tsi_handshaker_result* /*self*/,
1307
+ tsi_frame_protector_type* frame_protector_type) {
1308
+ *frame_protector_type = TSI_FRAME_PROTECTOR_NORMAL;
1309
+ return TSI_OK;
1310
+ }
1311
+
1305
1312
  static tsi_result ssl_handshaker_result_create_frame_protector(
1306
1313
  const tsi_handshaker_result* self, size_t* max_output_protected_frame_size,
1307
1314
  tsi_frame_protector** protector) {
@@ -1368,6 +1375,7 @@ static void ssl_handshaker_result_destroy(tsi_handshaker_result* self) {
1368
1375
 
1369
1376
  static const tsi_handshaker_result_vtable handshaker_result_vtable = {
1370
1377
  ssl_handshaker_result_extract_peer,
1378
+ ssl_handshaker_result_get_frame_protector_type,
1371
1379
  nullptr, /* create_zero_copy_grpc_protector */
1372
1380
  ssl_handshaker_result_create_frame_protector,
1373
1381
  ssl_handshaker_result_get_unused_bytes,
@@ -1382,7 +1390,7 @@ static tsi_result ssl_handshaker_result_create(
1382
1390
  return TSI_INVALID_ARGUMENT;
1383
1391
  }
1384
1392
  tsi_ssl_handshaker_result* result =
1385
- static_cast<tsi_ssl_handshaker_result*>(gpr_zalloc(sizeof(*result)));
1393
+ grpc_core::Zalloc<tsi_ssl_handshaker_result>();
1386
1394
  result->base.vtable = &handshaker_result_vtable;
1387
1395
  /* Transfer ownership of ssl and network_io to the handshaker result. */
1388
1396
  result->ssl = handshaker->ssl;
@@ -1661,7 +1669,7 @@ static tsi_result create_tsi_ssl_handshaker(SSL_CTX* ctx, int is_client,
1661
1669
  SSL_set_accept_state(ssl);
1662
1670
  }
1663
1671
 
1664
- impl = static_cast<tsi_ssl_handshaker*>(gpr_zalloc(sizeof(*impl)));
1672
+ impl = grpc_core::Zalloc<tsi_ssl_handshaker>();
1665
1673
  impl->ssl = ssl;
1666
1674
  impl->network_io = network_io;
1667
1675
  impl->result = TSI_HANDSHAKE_IN_PROGRESS;
@@ -251,6 +251,18 @@ tsi_result tsi_handshaker_result_extract_peer(const tsi_handshaker_result* self,
251
251
  return self->vtable->extract_peer(self, peer);
252
252
  }
253
253
 
254
+ tsi_result tsi_handshaker_result_get_frame_protector_type(
255
+ const tsi_handshaker_result* self,
256
+ tsi_frame_protector_type* frame_protector_type) {
257
+ if (self == nullptr || frame_protector_type == nullptr) {
258
+ return TSI_INVALID_ARGUMENT;
259
+ }
260
+ if (self->vtable->get_frame_protector_type == nullptr) {
261
+ return TSI_UNIMPLEMENTED;
262
+ }
263
+ return self->vtable->get_frame_protector_type(self, frame_protector_type);
264
+ }
265
+
254
266
  tsi_result tsi_handshaker_result_create_frame_protector(
255
267
  const tsi_handshaker_result* self, size_t* max_output_protected_frame_size,
256
268
  tsi_frame_protector** protector) {
@@ -29,7 +29,8 @@
29
29
  extern grpc_core::TraceFlag tsi_tracing_enabled;
30
30
 
31
31
  /* Base for tsi_frame_protector implementations.
32
- See transport_security_interface.h for documentation. */
32
+ See transport_security_interface.h for documentation.
33
+ All methods must be implemented. */
33
34
  struct tsi_frame_protector_vtable {
34
35
  tsi_result (*protect)(tsi_frame_protector* self,
35
36
  const unsigned char* unprotected_bytes,
@@ -54,6 +55,9 @@ struct tsi_frame_protector {
54
55
  /* Base for tsi_handshaker implementations.
55
56
  See transport_security_interface.h for documentation. */
56
57
  struct tsi_handshaker_vtable {
58
+ /* Methods for supporting the old synchronous API.
59
+ These can be null if the TSI impl supports only the new
60
+ async-capable API. */
57
61
  tsi_result (*get_bytes_to_send_to_peer)(tsi_handshaker* self,
58
62
  unsigned char* bytes,
59
63
  size_t* bytes_size);
@@ -65,7 +69,10 @@ struct tsi_handshaker_vtable {
65
69
  tsi_result (*create_frame_protector)(tsi_handshaker* self,
66
70
  size_t* max_protected_frame_size,
67
71
  tsi_frame_protector** protector);
72
+ /* Must be implemented by all TSI impls. */
68
73
  void (*destroy)(tsi_handshaker* self);
74
+ /* Methods for supporting the new async-capable API.
75
+ These can be null if the TSI impl supports only the old sync API. */
69
76
  tsi_result (*next)(tsi_handshaker* self, const unsigned char* received_bytes,
70
77
  size_t received_bytes_size,
71
78
  const unsigned char** bytes_to_send,
@@ -88,13 +95,21 @@ struct tsi_handshaker {
88
95
  API depend on grpc. The create_zero_copy_grpc_protector() method is only used
89
96
  in grpc, where we do need the exec_ctx passed through, but the API still
90
97
  needs to compile in other applications, where grpc_exec_ctx is not defined.
98
+ All methods must be non-null, except where noted below.
91
99
  */
92
100
  struct tsi_handshaker_result_vtable {
93
101
  tsi_result (*extract_peer)(const tsi_handshaker_result* self, tsi_peer* peer);
102
+ tsi_result (*get_frame_protector_type)(
103
+ const tsi_handshaker_result* self,
104
+ tsi_frame_protector_type* frame_protector_type);
105
+ /* May be null if get_frame_protector_type() returns
106
+ TSI_FRAME_PROTECTOR_NORMAL or TSI_FRAME_PROTECTOR_NONE. */
94
107
  tsi_result (*create_zero_copy_grpc_protector)(
95
108
  const tsi_handshaker_result* self,
96
109
  size_t* max_output_protected_frame_size,
97
110
  tsi_zero_copy_grpc_protector** protector);
111
+ /* May be null if get_frame_protector_type() returns
112
+ TSI_FRAME_PROTECTOR_ZERO_COPY or TSI_FRAME_PROTECTOR_NONE. */
98
113
  tsi_result (*create_frame_protector)(const tsi_handshaker_result* self,
99
114
  size_t* max_output_protected_frame_size,
100
115
  tsi_frame_protector** protector);
@@ -64,6 +64,26 @@ typedef enum {
64
64
  TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY,
65
65
  } tsi_client_certificate_request_type;
66
66
 
67
+ typedef enum {
68
+ // TSI implementation provides a normal frame protector. The caller
69
+ // should invoke tsi_handshaker_result_create_frame_protector() to
70
+ // generate the frame protector.
71
+ TSI_FRAME_PROTECTOR_NORMAL,
72
+ // TSI implementation provides a zero-copy frame protector. The caller
73
+ // should invoke tsi_handshaker_result_create_zero_copy_grpc_protector()
74
+ // to generate the frame protector.
75
+ TSI_FRAME_PROTECTOR_ZERO_COPY,
76
+ // TSI implementation provides both normal and zero-copy frame protectors.
77
+ // The caller should invoke either
78
+ // tsi_handshaker_result_create_frame_protector() or
79
+ // tsi_handshaker_result_create_zero_copy_grpc_protector() to generate
80
+ // the frame protector.
81
+ TSI_FRAME_PROTECTOR_NORMAL_OR_ZERO_COPY,
82
+ // TSI implementation does not provide any frame protector. This means
83
+ // that it is safe for the caller to send bytes unprotected on the wire.
84
+ TSI_FRAME_PROTECTOR_NONE,
85
+ } tsi_frame_protector_type;
86
+
67
87
  typedef enum {
68
88
  TSI_TLS1_2,
69
89
  TSI_TLS1_3,
@@ -234,6 +254,12 @@ typedef struct tsi_handshaker_result tsi_handshaker_result;
234
254
  tsi_result tsi_handshaker_result_extract_peer(const tsi_handshaker_result* self,
235
255
  tsi_peer* peer);
236
256
 
257
+ /* This method indicates what type of frame protector is provided by the
258
+ TSI implementation. */
259
+ tsi_result tsi_handshaker_result_get_frame_protector_type(
260
+ const tsi_handshaker_result* self,
261
+ tsi_frame_protector_type* frame_protector_type);
262
+
237
263
  /* This method creates a tsi_frame_protector object. It returns TSI_OK assuming
238
264
  there is no fatal error.
239
265
  The caller is responsible for destroying the protector. */
@@ -17,6 +17,9 @@ require 'mkmf'
17
17
 
18
18
  windows = RUBY_PLATFORM =~ /mingw|mswin/
19
19
  bsd = RUBY_PLATFORM =~ /bsd/
20
+ darwin = RUBY_PLATFORM =~ /darwin/
21
+ linux = RUBY_PLATFORM =~ /linux/
22
+ cross_compiling = ENV['RCD_HOST_RUBY_VERSION'] # set by rake-compiler-dock in build containers
20
23
 
21
24
  grpc_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
22
25
 
@@ -37,17 +40,17 @@ if ENV['LD'].nil? || ENV['LD'].size == 0
37
40
  ENV['LD'] = ENV['CC']
38
41
  end
39
42
 
40
- if RUBY_PLATFORM =~ /darwin/
43
+ if darwin && !cross_compiling
41
44
  ENV['AR'] = 'libtool'
42
45
  ENV['ARFLAGS'] = '-o'
43
- end
46
+ end
44
47
 
45
48
  ENV['EMBED_OPENSSL'] = 'true'
46
49
  ENV['EMBED_ZLIB'] = 'true'
47
50
  ENV['EMBED_CARES'] = 'true'
48
51
 
49
52
  ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
50
- if RUBY_PLATFORM =~ /darwin/
53
+ if darwin && !cross_compiling
51
54
  if RUBY_PLATFORM =~ /arm64/
52
55
  ENV['ARCH_FLAGS'] = '-arch arm64'
53
56
  else
@@ -57,7 +60,7 @@ end
57
60
 
58
61
  ENV['CPPFLAGS'] = '-DGPR_BACKWARDS_COMPATIBILITY_MODE'
59
62
  ENV['CPPFLAGS'] += ' -DGRPC_XDS_USER_AGENT_NAME_SUFFIX="\"RUBY\"" '
60
- ENV['CPPFLAGS'] += ' -DGRPC_XDS_USER_AGENT_VERSION_SUFFIX="\"1.41.1\"" '
63
+ ENV['CPPFLAGS'] += ' -DGRPC_XDS_USER_AGENT_VERSION_SUFFIX="\"1.42.0.pre1\"" '
61
64
 
62
65
  output_dir = File.expand_path(RbConfig::CONFIG['topdir'])
63
66
  grpc_lib_dir = File.join(output_dir, 'libs', grpc_config)
@@ -75,8 +78,8 @@ end
75
78
  $CFLAGS << ' -I' + File.join(grpc_root, 'include')
76
79
 
77
80
  ext_export_file = File.join(grpc_root, 'src', 'ruby', 'ext', 'grpc', 'ext-export')
78
- $LDFLAGS << ' -Wl,--version-script="' + ext_export_file + '.gcc"' if RUBY_PLATFORM =~ /linux/
79
- $LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"' if RUBY_PLATFORM =~ /darwin/
81
+ $LDFLAGS << ' -Wl,--version-script="' + ext_export_file + '.gcc"' if linux
82
+ $LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"' if darwin
80
83
 
81
84
  $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows
82
85
  if grpc_config == 'gcov'
@@ -88,8 +91,8 @@ if grpc_config == 'dbg'
88
91
  $CFLAGS << ' -O0 -ggdb3'
89
92
  end
90
93
 
91
- $LDFLAGS << ' -Wl,-wrap,memcpy' if RUBY_PLATFORM =~ /linux/
92
- $LDFLAGS << ' -static-libgcc -static-libstdc++' if RUBY_PLATFORM =~ /linux/
94
+ $LDFLAGS << ' -Wl,-wrap,memcpy' if linux
95
+ $LDFLAGS << ' -static-libgcc -static-libstdc++' if linux
93
96
  $LDFLAGS << ' -static' if windows
94
97
 
95
98
  $CFLAGS << ' -std=c99 '
@@ -102,7 +105,7 @@ puts 'Generating Makefile for ' + output
102
105
  create_makefile(output)
103
106
 
104
107
  strip_tool = RbConfig::CONFIG['STRIP']
105
- strip_tool = 'strip -x' if RUBY_PLATFORM =~ /darwin/
108
+ strip_tool += ' -x' if darwin
106
109
 
107
110
  if grpc_config == 'opt'
108
111
  File.open('Makefile.new', 'w') do |o|
@@ -73,6 +73,7 @@ grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import;
73
73
  grpc_channel_destroy_type grpc_channel_destroy_import;
74
74
  grpc_call_cancel_type grpc_call_cancel_import;
75
75
  grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import;
76
+ grpc_call_failed_before_recv_message_type grpc_call_failed_before_recv_message_import;
76
77
  grpc_call_ref_type grpc_call_ref_import;
77
78
  grpc_call_unref_type grpc_call_unref_import;
78
79
  grpc_server_request_call_type grpc_server_request_call_import;
@@ -184,6 +185,7 @@ grpc_tls_server_authorization_check_config_release_type grpc_tls_server_authoriz
184
185
  grpc_xds_credentials_create_type grpc_xds_credentials_create_import;
185
186
  grpc_xds_server_credentials_create_type grpc_xds_server_credentials_create_import;
186
187
  grpc_authorization_policy_provider_static_data_create_type grpc_authorization_policy_provider_static_data_create_import;
188
+ grpc_authorization_policy_provider_file_watcher_create_type grpc_authorization_policy_provider_file_watcher_create_import;
187
189
  grpc_authorization_policy_provider_release_type grpc_authorization_policy_provider_release_import;
188
190
  grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
189
191
  grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
@@ -361,6 +363,7 @@ void grpc_rb_load_imports(HMODULE library) {
361
363
  grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy");
362
364
  grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel");
363
365
  grpc_call_cancel_with_status_import = (grpc_call_cancel_with_status_type) GetProcAddress(library, "grpc_call_cancel_with_status");
366
+ grpc_call_failed_before_recv_message_import = (grpc_call_failed_before_recv_message_type) GetProcAddress(library, "grpc_call_failed_before_recv_message");
364
367
  grpc_call_ref_import = (grpc_call_ref_type) GetProcAddress(library, "grpc_call_ref");
365
368
  grpc_call_unref_import = (grpc_call_unref_type) GetProcAddress(library, "grpc_call_unref");
366
369
  grpc_server_request_call_import = (grpc_server_request_call_type) GetProcAddress(library, "grpc_server_request_call");
@@ -472,6 +475,7 @@ void grpc_rb_load_imports(HMODULE library) {
472
475
  grpc_xds_credentials_create_import = (grpc_xds_credentials_create_type) GetProcAddress(library, "grpc_xds_credentials_create");
473
476
  grpc_xds_server_credentials_create_import = (grpc_xds_server_credentials_create_type) GetProcAddress(library, "grpc_xds_server_credentials_create");
474
477
  grpc_authorization_policy_provider_static_data_create_import = (grpc_authorization_policy_provider_static_data_create_type) GetProcAddress(library, "grpc_authorization_policy_provider_static_data_create");
478
+ grpc_authorization_policy_provider_file_watcher_create_import = (grpc_authorization_policy_provider_file_watcher_create_type) GetProcAddress(library, "grpc_authorization_policy_provider_file_watcher_create");
475
479
  grpc_authorization_policy_provider_release_import = (grpc_authorization_policy_provider_release_type) GetProcAddress(library, "grpc_authorization_policy_provider_release");
476
480
  grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create");
477
481
  grpc_raw_compressed_byte_buffer_create_import = (grpc_raw_compressed_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_compressed_byte_buffer_create");
@@ -194,6 +194,9 @@ extern grpc_call_cancel_type grpc_call_cancel_import;
194
194
  typedef grpc_call_error(*grpc_call_cancel_with_status_type)(grpc_call* call, grpc_status_code status, const char* description, void* reserved);
195
195
  extern grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import;
196
196
  #define grpc_call_cancel_with_status grpc_call_cancel_with_status_import
197
+ typedef int(*grpc_call_failed_before_recv_message_type)(const grpc_call* c);
198
+ extern grpc_call_failed_before_recv_message_type grpc_call_failed_before_recv_message_import;
199
+ #define grpc_call_failed_before_recv_message grpc_call_failed_before_recv_message_import
197
200
  typedef void(*grpc_call_ref_type)(grpc_call* call);
198
201
  extern grpc_call_ref_type grpc_call_ref_import;
199
202
  #define grpc_call_ref grpc_call_ref_import
@@ -527,6 +530,9 @@ extern grpc_xds_server_credentials_create_type grpc_xds_server_credentials_creat
527
530
  typedef grpc_authorization_policy_provider*(*grpc_authorization_policy_provider_static_data_create_type)(const char* authz_policy, grpc_status_code* code, const char** error_details);
528
531
  extern grpc_authorization_policy_provider_static_data_create_type grpc_authorization_policy_provider_static_data_create_import;
529
532
  #define grpc_authorization_policy_provider_static_data_create grpc_authorization_policy_provider_static_data_create_import
533
+ typedef grpc_authorization_policy_provider*(*grpc_authorization_policy_provider_file_watcher_create_type)(const char* authz_policy_path, unsigned int refresh_interval_sec, grpc_status_code* code, const char** error_details);
534
+ extern grpc_authorization_policy_provider_file_watcher_create_type grpc_authorization_policy_provider_file_watcher_create_import;
535
+ #define grpc_authorization_policy_provider_file_watcher_create grpc_authorization_policy_provider_file_watcher_create_import
530
536
  typedef void(*grpc_authorization_policy_provider_release_type)(grpc_authorization_policy_provider* provider);
531
537
  extern grpc_authorization_policy_provider_release_type grpc_authorization_policy_provider_release_import;
532
538
  #define grpc_authorization_policy_provider_release grpc_authorization_policy_provider_release_import
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.41.1'
17
+ VERSION = '1.42.0.pre1'
18
18
  end
@@ -1,10 +1,10 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: src/proto/grpc/testing/test.proto
3
3
 
4
- require 'google/protobuf'
5
-
6
4
  require 'src/proto/grpc/testing/empty_pb'
7
5
  require 'src/proto/grpc/testing/messages_pb'
6
+ require 'google/protobuf'
7
+
8
8
  Google::Protobuf::DescriptorPool.generated_pool.build do
9
9
  add_file("src/proto/grpc/testing/test.proto", :syntax => :proto3) do
10
10
  end