grpc 1.41.0 → 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 (519) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +57 -44
  3. data/etc/roots.pem +335 -326
  4. data/include/grpc/event_engine/event_engine.h +82 -42
  5. data/include/grpc/event_engine/internal/memory_allocator_impl.h +98 -0
  6. data/include/grpc/event_engine/memory_allocator.h +210 -0
  7. data/include/grpc/grpc.h +4 -0
  8. data/include/grpc/grpc_security.h +18 -0
  9. data/include/grpc/grpc_security_constants.h +1 -0
  10. data/include/grpc/impl/codegen/port_platform.h +7 -0
  11. data/src/core/ext/filters/client_channel/backend_metric.cc +18 -19
  12. data/src/core/ext/filters/client_channel/backup_poller.cc +2 -1
  13. data/src/core/ext/filters/client_channel/channel_connectivity.cc +71 -89
  14. data/src/core/ext/filters/client_channel/client_channel.cc +187 -252
  15. data/src/core/ext/filters/client_channel/client_channel.h +74 -27
  16. data/src/core/ext/filters/client_channel/client_channel_factory.cc +1 -1
  17. data/src/core/ext/filters/client_channel/client_channel_factory.h +17 -19
  18. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +8 -14
  19. data/src/core/ext/filters/client_channel/config_selector.cc +1 -1
  20. data/src/core/ext/filters/client_channel/config_selector.h +4 -5
  21. data/src/core/ext/filters/client_channel/connector.h +18 -18
  22. data/src/core/ext/filters/client_channel/dynamic_filters.cc +1 -1
  23. data/src/core/ext/filters/client_channel/global_subchannel_pool.h +0 -1
  24. data/src/core/ext/filters/client_channel/health/health_check_client.cc +12 -11
  25. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +1 -1
  26. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +4 -0
  27. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +6 -15
  28. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +166 -82
  29. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +4 -0
  30. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +1 -1
  31. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +2 -4
  32. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +23 -7
  33. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +15 -10
  34. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +2 -3
  35. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +2502 -0
  36. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +6 -1
  37. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -1
  38. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +6 -2
  39. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +1 -1
  40. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +5 -0
  41. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +8 -1
  42. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +7 -16
  43. data/src/core/ext/filters/client_channel/lb_policy.h +11 -1
  44. data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -0
  45. data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +139 -0
  46. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +11 -5
  47. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +3 -3
  48. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +12 -39
  49. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +21 -1
  50. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -2
  51. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +3 -1
  52. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +77 -68
  53. data/src/core/ext/filters/client_channel/resolver.h +1 -1
  54. data/src/core/ext/filters/client_channel/resolver_factory.h +2 -0
  55. data/src/core/ext/filters/client_channel/resolver_registry.cc +6 -8
  56. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +1 -1
  57. data/src/core/ext/filters/client_channel/resolver_result_parsing.h +1 -1
  58. data/src/core/ext/filters/client_channel/retry_filter.cc +48 -86
  59. data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
  60. data/src/core/ext/filters/client_channel/retry_throttle.cc +17 -48
  61. data/src/core/ext/filters/client_channel/server_address.h +1 -1
  62. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +49 -36
  63. data/src/core/ext/filters/client_channel/subchannel.cc +85 -143
  64. data/src/core/ext/filters/client_channel/subchannel.h +29 -49
  65. data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +22 -7
  66. data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +11 -2
  67. data/src/core/ext/filters/client_idle/client_idle_filter.cc +27 -210
  68. data/src/core/ext/filters/client_idle/idle_filter_state.cc +96 -0
  69. data/src/core/ext/filters/client_idle/idle_filter_state.h +66 -0
  70. data/src/core/ext/filters/deadline/deadline_filter.cc +23 -26
  71. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +19 -19
  72. data/src/core/ext/filters/fault_injection/service_config_parser.cc +0 -1
  73. data/src/core/ext/filters/fault_injection/service_config_parser.h +1 -1
  74. data/src/core/ext/filters/http/client/http_client_filter.cc +41 -44
  75. data/src/core/ext/filters/http/client_authority_filter.cc +14 -15
  76. data/src/core/ext/filters/http/http_filters_plugin.cc +53 -71
  77. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +17 -12
  78. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +1 -1
  79. data/src/core/ext/filters/http/server/http_server_filter.cc +72 -69
  80. data/src/core/ext/filters/max_age/max_age_filter.cc +24 -26
  81. data/src/core/ext/filters/message_size/message_size_filter.cc +19 -16
  82. data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
  83. data/src/core/ext/{filters/client_channel → service_config}/service_config.cc +2 -2
  84. data/src/core/ext/{filters/client_channel → service_config}/service_config.h +4 -4
  85. data/src/core/ext/service_config/service_config_call_data.h +72 -0
  86. data/src/core/ext/{filters/client_channel → service_config}/service_config_parser.cc +3 -3
  87. data/src/core/ext/{filters/client_channel → service_config}/service_config_parser.h +8 -6
  88. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -5
  89. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +19 -24
  90. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +27 -50
  91. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +14 -16
  92. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +59 -58
  93. data/src/core/ext/transport/chttp2/transport/flow_control.cc +19 -16
  94. data/src/core/ext/transport/chttp2/transport/flow_control.h +4 -4
  95. data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -4
  96. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -1
  97. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -1
  98. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -3
  99. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +2 -2
  100. data/src/core/ext/transport/chttp2/transport/hpack_constants.h +1 -1
  101. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +41 -1
  102. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +8 -4
  103. data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +1 -1
  104. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +136 -98
  105. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +27 -8
  106. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +12 -25
  107. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +37 -30
  108. data/src/core/ext/transport/chttp2/transport/internal.h +4 -3
  109. data/src/core/ext/transport/chttp2/transport/parsing.cc +30 -173
  110. data/src/core/ext/transport/chttp2/transport/popularity_count.h +1 -1
  111. data/src/core/ext/transport/chttp2/transport/writing.cc +29 -22
  112. data/src/core/ext/transport/inproc/inproc_transport.cc +105 -109
  113. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +68 -34
  114. data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +139 -1
  115. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +16 -4
  116. data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +53 -4
  117. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +3 -2
  118. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +15 -0
  119. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +13 -8
  120. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +23 -0
  121. data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +0 -1
  122. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +14 -11
  123. data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +17 -0
  124. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +15 -12
  125. data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +49 -19
  126. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.c +55 -0
  127. data/src/core/ext/upb-generated/src/proto/grpc/lookup/v1/rls.upb.h +154 -0
  128. data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +0 -2
  129. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.c +58 -0
  130. data/src/core/ext/upb-generated/xds/annotations/v3/status.upb.h +182 -0
  131. data/src/core/ext/upb-generated/xds/core/v3/authority.upb.c +1 -1
  132. data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +1 -1
  133. data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +1 -1
  134. data/src/core/ext/upb-generated/xds/core/v3/resource.upb.c +1 -1
  135. data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +1 -1
  136. data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +1 -1
  137. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +58 -0
  138. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +130 -0
  139. data/src/core/ext/upb-generated/{udpa/type/v1 → xds/type/v3}/typed_struct.upb.c +7 -7
  140. data/src/core/ext/upb-generated/xds/type/v3/typed_struct.upb.h +83 -0
  141. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +310 -286
  142. data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +10 -0
  143. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +101 -88
  144. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +5 -0
  145. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +59 -56
  146. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +59 -46
  147. data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +78 -82
  148. data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +323 -316
  149. data/src/core/ext/upbdefs-generated/udpa/annotations/migrate.upbdefs.c +5 -4
  150. data/src/core/ext/upbdefs-generated/udpa/annotations/security.upbdefs.c +19 -23
  151. data/src/core/ext/upbdefs-generated/udpa/annotations/sensitive.upbdefs.c +4 -3
  152. data/src/core/ext/upbdefs-generated/udpa/annotations/status.upbdefs.c +5 -3
  153. data/src/core/ext/upbdefs-generated/udpa/annotations/versioning.upbdefs.c +5 -4
  154. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.c +75 -0
  155. data/src/core/ext/upbdefs-generated/xds/annotations/v3/status.upbdefs.h +50 -0
  156. data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +13 -12
  157. data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +25 -24
  158. data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +16 -15
  159. data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +17 -16
  160. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +33 -32
  161. data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +19 -18
  162. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.c +45 -0
  163. data/src/core/ext/upbdefs-generated/xds/type/v3/typed_struct.upbdefs.h +35 -0
  164. data/src/core/ext/xds/xds_api.cc +325 -362
  165. data/src/core/ext/xds/xds_api.h +134 -82
  166. data/src/core/ext/xds/xds_bootstrap.h +10 -0
  167. data/src/core/ext/xds/xds_certificate_provider.cc +3 -3
  168. data/src/core/ext/xds/xds_channel_stack_modifier.cc +113 -0
  169. data/src/core/ext/xds/xds_channel_stack_modifier.h +52 -0
  170. data/src/core/ext/xds/xds_client.cc +527 -314
  171. data/src/core/ext/xds/xds_client.h +42 -37
  172. data/src/core/ext/xds/xds_client_stats.h +1 -1
  173. data/src/core/ext/xds/xds_server_config_fetcher.cc +5 -7
  174. data/src/core/lib/address_utils/parse_address.cc +2 -0
  175. data/src/core/lib/avl/avl.cc +5 -5
  176. data/src/core/lib/backoff/backoff.cc +1 -1
  177. data/src/core/lib/channel/channel_args.cc +24 -6
  178. data/src/core/lib/channel/channel_args.h +9 -0
  179. data/src/core/lib/channel/channel_stack_builder.cc +3 -3
  180. data/src/core/lib/channel/channel_trace.cc +1 -1
  181. data/src/core/lib/channel/channel_trace.h +1 -1
  182. data/src/core/lib/channel/channelz.cc +3 -3
  183. data/src/core/lib/channel/channelz.h +2 -2
  184. data/src/core/lib/channel/channelz_registry.cc +1 -1
  185. data/src/core/lib/channel/channelz_registry.h +1 -1
  186. data/src/core/lib/channel/connected_channel.cc +1 -3
  187. data/src/core/lib/channel/connected_channel.h +1 -2
  188. data/src/core/lib/compression/compression.cc +2 -2
  189. data/src/core/lib/compression/compression_args.cc +6 -4
  190. data/src/core/lib/compression/compression_internal.cc +2 -2
  191. data/src/core/lib/compression/compression_internal.h +1 -1
  192. data/src/core/lib/config/core_configuration.cc +44 -2
  193. data/src/core/lib/config/core_configuration.h +39 -1
  194. data/src/core/lib/debug/stats.cc +1 -1
  195. data/src/core/lib/debug/stats_data.cc +13 -13
  196. data/src/core/lib/gpr/atm.cc +1 -1
  197. data/src/core/lib/gpr/cpu_posix.cc +1 -1
  198. data/src/core/lib/gpr/string.cc +2 -2
  199. data/src/core/lib/gpr/tls.h +1 -1
  200. data/src/core/lib/gpr/useful.h +79 -32
  201. data/src/core/lib/gprpp/arena.h +10 -0
  202. data/src/core/lib/gprpp/bitset.h +38 -16
  203. data/src/core/lib/gprpp/chunked_vector.h +211 -0
  204. data/src/core/lib/gprpp/construct_destruct.h +1 -1
  205. data/src/core/lib/gprpp/match.h +1 -1
  206. data/src/core/lib/gprpp/memory.h +6 -0
  207. data/src/core/lib/gprpp/overload.h +1 -1
  208. data/src/core/lib/gprpp/status_helper.cc +23 -3
  209. data/src/core/lib/gprpp/status_helper.h +12 -1
  210. data/src/core/lib/gprpp/table.h +411 -0
  211. data/src/core/lib/http/httpcli.cc +200 -182
  212. data/src/core/lib/http/parser.cc +2 -2
  213. data/src/core/lib/iomgr/call_combiner.cc +28 -10
  214. data/src/core/lib/iomgr/combiner.cc +6 -21
  215. data/src/core/lib/iomgr/endpoint_cfstream.cc +7 -6
  216. data/src/core/lib/iomgr/error.cc +113 -52
  217. data/src/core/lib/iomgr/error.h +50 -9
  218. data/src/core/lib/iomgr/error_cfstream.cc +5 -0
  219. data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -2
  220. data/src/core/lib/iomgr/ev_epollex_linux.cc +7 -7
  221. data/src/core/lib/iomgr/ev_poll_posix.cc +29 -20
  222. data/src/core/lib/iomgr/event_engine/closure.cc +41 -18
  223. data/src/core/lib/iomgr/event_engine/closure.h +10 -1
  224. data/src/core/lib/iomgr/event_engine/endpoint.cc +3 -3
  225. data/src/core/lib/iomgr/event_engine/iomgr.cc +1 -1
  226. data/src/core/lib/iomgr/event_engine/pollset.cc +5 -4
  227. data/src/core/lib/iomgr/event_engine/resolver.cc +10 -7
  228. data/src/core/lib/iomgr/event_engine/tcp.cc +9 -8
  229. data/src/core/lib/iomgr/event_engine/timer.cc +7 -2
  230. data/src/core/lib/iomgr/exec_ctx.cc +1 -9
  231. data/src/core/lib/iomgr/executor/mpmcqueue.cc +5 -7
  232. data/src/core/lib/iomgr/executor/mpmcqueue.h +3 -8
  233. data/src/core/lib/iomgr/executor.cc +6 -20
  234. data/src/core/lib/iomgr/iomgr.cc +3 -1
  235. data/src/core/lib/iomgr/iomgr_internal.cc +4 -9
  236. data/src/core/lib/iomgr/iomgr_internal.h +3 -2
  237. data/src/core/lib/iomgr/load_file.cc +2 -2
  238. data/src/core/lib/iomgr/lockfree_event.cc +18 -0
  239. data/src/core/lib/iomgr/pollset_custom.cc +1 -1
  240. data/src/core/lib/iomgr/pollset_custom.h +1 -1
  241. data/src/core/lib/iomgr/resolve_address_posix.cc +5 -7
  242. data/src/core/lib/iomgr/resource_quota.cc +13 -11
  243. data/src/core/lib/iomgr/socket_factory_posix.cc +2 -2
  244. data/src/core/lib/iomgr/socket_mutator.cc +2 -2
  245. data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -2
  246. data/src/core/lib/iomgr/tcp_client_cfstream.cc +5 -3
  247. data/src/core/lib/iomgr/tcp_client_custom.cc +1 -1
  248. data/src/core/lib/iomgr/tcp_client_posix.cc +9 -18
  249. data/src/core/lib/iomgr/tcp_client_windows.cc +2 -3
  250. data/src/core/lib/iomgr/tcp_posix.cc +4 -5
  251. data/src/core/lib/iomgr/tcp_server_custom.cc +2 -1
  252. data/src/core/lib/iomgr/tcp_server_posix.cc +3 -4
  253. data/src/core/lib/iomgr/tcp_server_windows.cc +4 -5
  254. data/src/core/lib/iomgr/tcp_windows.cc +2 -2
  255. data/src/core/lib/iomgr/timer_generic.cc +13 -13
  256. data/src/core/lib/iomgr/timer_heap.cc +1 -1
  257. data/src/core/lib/json/json_util.cc +68 -0
  258. data/src/core/lib/json/json_util.h +57 -99
  259. data/src/core/lib/json/json_writer.cc +0 -3
  260. data/src/core/lib/security/authorization/authorization_policy_provider.h +1 -1
  261. data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +1 -1
  262. data/src/core/lib/security/authorization/evaluate_args.cc +14 -12
  263. data/src/core/lib/security/authorization/sdk_server_authz_filter.cc +13 -1
  264. data/src/core/lib/security/context/security_context.cc +4 -2
  265. data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
  266. data/src/core/lib/security/credentials/credentials.cc +4 -2
  267. data/src/core/lib/security/credentials/credentials.h +6 -1
  268. data/src/core/lib/security/credentials/external/external_account_credentials.cc +47 -11
  269. data/src/core/lib/security/credentials/external/external_account_credentials.h +1 -0
  270. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -1
  271. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +5 -9
  272. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -2
  273. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +2 -2
  274. data/src/core/lib/security/security_connector/security_connector.cc +9 -4
  275. data/src/core/lib/security/security_connector/security_connector.h +1 -1
  276. data/src/core/lib/security/security_connector/ssl_utils.cc +1 -1
  277. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +1 -0
  278. data/src/core/lib/security/security_connector/tls/tls_security_connector.h +0 -2
  279. data/src/core/lib/security/transport/client_auth_filter.cc +5 -5
  280. data/src/core/lib/security/transport/security_handshaker.cc +73 -43
  281. data/src/core/lib/security/transport/server_auth_filter.cc +3 -5
  282. data/src/core/lib/security/transport/tsi_error.cc +3 -5
  283. data/src/core/lib/slice/slice.cc +0 -16
  284. data/src/core/lib/slice/slice_api.cc +39 -0
  285. data/src/core/lib/slice/slice_buffer.cc +5 -5
  286. data/src/core/lib/slice/slice_intern.cc +8 -13
  287. data/src/core/lib/slice/slice_internal.h +1 -244
  288. data/src/core/lib/slice/slice_refcount.cc +17 -0
  289. data/src/core/lib/slice/slice_refcount.h +121 -0
  290. data/src/core/lib/slice/slice_refcount_base.h +173 -0
  291. data/src/core/lib/slice/slice_split.cc +100 -0
  292. data/src/core/lib/slice/slice_split.h +40 -0
  293. data/src/core/lib/slice/slice_string_helpers.cc +0 -83
  294. data/src/core/lib/slice/slice_string_helpers.h +0 -11
  295. data/src/core/lib/slice/static_slice.cc +529 -0
  296. data/src/core/lib/slice/static_slice.h +331 -0
  297. data/src/core/lib/surface/builtins.cc +49 -0
  298. data/src/core/{ext/filters/workarounds/workaround_cronet_compression_filter.h → lib/surface/builtins.h} +8 -9
  299. data/src/core/lib/surface/call.cc +103 -120
  300. data/src/core/lib/surface/call.h +0 -6
  301. data/src/core/lib/surface/channel.cc +19 -32
  302. data/src/core/lib/surface/channel.h +0 -9
  303. data/src/core/lib/surface/channel_init.cc +23 -76
  304. data/src/core/lib/surface/channel_init.h +52 -44
  305. data/src/core/lib/surface/completion_queue.cc +6 -5
  306. data/src/core/lib/surface/init.cc +0 -39
  307. data/src/core/lib/surface/init_secure.cc +17 -14
  308. data/src/core/lib/surface/lame_client.cc +18 -11
  309. data/src/core/lib/surface/lame_client.h +1 -1
  310. data/src/core/lib/surface/server.cc +25 -17
  311. data/src/core/lib/surface/server.h +17 -10
  312. data/src/core/lib/surface/validate_metadata.cc +5 -2
  313. data/src/core/lib/surface/version.cc +2 -2
  314. data/src/core/lib/transport/bdp_estimator.cc +1 -1
  315. data/src/core/lib/transport/error_utils.cc +42 -17
  316. data/src/core/lib/transport/error_utils.h +1 -1
  317. data/src/core/lib/transport/metadata.cc +31 -10
  318. data/src/core/lib/transport/metadata.h +2 -1
  319. data/src/core/lib/transport/metadata_batch.cc +35 -371
  320. data/src/core/lib/transport/metadata_batch.h +905 -71
  321. data/src/core/lib/transport/parsed_metadata.h +263 -0
  322. data/src/core/lib/transport/pid_controller.cc +4 -4
  323. data/src/core/lib/transport/static_metadata.cc +714 -846
  324. data/src/core/lib/transport/static_metadata.h +115 -379
  325. data/src/core/lib/transport/status_metadata.cc +1 -0
  326. data/src/core/lib/transport/transport.cc +4 -5
  327. data/src/core/lib/transport/transport_op_string.cc +40 -20
  328. data/src/core/plugin_registry/grpc_plugin_registry.cc +64 -43
  329. data/src/core/tsi/alts/crypt/aes_gcm.cc +3 -1
  330. data/src/core/tsi/alts/frame_protector/alts_frame_protector.cc +13 -12
  331. data/src/core/tsi/alts/frame_protector/frame_handler.cc +10 -11
  332. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -2
  333. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +12 -2
  334. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +1 -1
  335. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +2 -2
  336. data/src/core/tsi/fake_transport_security.cc +15 -7
  337. data/src/core/tsi/local_transport_security.cc +36 -73
  338. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +16 -50
  339. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -3
  340. data/src/core/tsi/ssl_transport_security.cc +10 -2
  341. data/src/core/tsi/transport_security.cc +12 -0
  342. data/src/core/tsi/transport_security.h +16 -1
  343. data/src/core/tsi/transport_security_interface.h +26 -0
  344. data/src/ruby/ext/grpc/extconf.rb +12 -9
  345. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  346. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  347. data/src/ruby/lib/grpc/version.rb +1 -1
  348. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -2
  349. data/src/ruby/spec/client_server_spec.rb +1 -1
  350. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +4 -4
  351. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +11 -6
  352. data/third_party/address_sorting/address_sorting_posix.c +1 -0
  353. data/third_party/boringssl-with-bazel/err_data.c +278 -272
  354. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bool.c +21 -22
  355. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_d2i_fp.c +0 -2
  356. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +5 -0
  357. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +15 -22
  358. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +13 -7
  359. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_print.c +19 -29
  360. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/a_strex.c +268 -271
  361. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +106 -153
  362. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
  363. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +0 -39
  364. data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_par.c +1 -1
  365. data/third_party/boringssl-with-bazel/src/crypto/{x509 → asn1}/charmap.h +0 -0
  366. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +38 -0
  367. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +8 -8
  368. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +289 -198
  369. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +8 -8
  370. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +9 -13
  371. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +1 -0
  372. data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +11 -8
  373. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +1 -7
  374. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +1 -5
  375. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +0 -4
  376. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +1 -7
  377. data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +1 -6
  378. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +3 -17
  379. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +4 -6
  380. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbb.c +9 -0
  381. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +8 -0
  382. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +38 -47
  383. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +45 -65
  384. data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +1 -0
  385. data/third_party/boringssl-with-bazel/src/crypto/evp/scrypt.c +32 -34
  386. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +21 -3
  387. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd_extra.c +3 -2
  388. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +5 -2
  389. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/sqrt.c +5 -9
  390. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/e_aes.c +10 -0
  391. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/des.c +10 -11
  392. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/des/internal.h +1 -3
  393. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +4 -7
  394. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +4 -7
  395. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +1 -1
  396. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +1 -1
  397. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +24 -9
  398. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +4 -2
  399. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +35 -35
  400. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +11 -10
  401. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +10 -37
  402. data/third_party/boringssl-with-bazel/src/crypto/internal.h +39 -0
  403. data/third_party/boringssl-with-bazel/src/crypto/mem.c +12 -9
  404. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_all.c +0 -9
  405. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_info.c +0 -2
  406. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +0 -8
  407. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pk8.c +0 -2
  408. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_pkey.c +0 -4
  409. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/internal.h +16 -7
  410. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +9 -4
  411. data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +151 -12
  412. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
  413. data/third_party/boringssl-with-bazel/src/crypto/siphash/siphash.c +6 -6
  414. data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +2 -0
  415. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +181 -1
  416. data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +246 -0
  417. data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +11 -2
  418. data/third_party/boringssl-with-bazel/src/crypto/x509/t_crl.c +0 -2
  419. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +0 -179
  420. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +4 -2
  421. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +0 -5
  422. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_obj.c +1 -0
  423. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +11 -50
  424. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +1 -1
  425. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +2 -4
  426. data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +0 -16
  427. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +22 -18
  428. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +11 -8
  429. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +16 -0
  430. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_cache.c +1 -0
  431. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_data.c +1 -1
  432. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_int.h +1 -1
  433. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_map.c +1 -0
  434. data/third_party/boringssl-with-bazel/src/crypto/x509v3/pcy_tree.c +4 -3
  435. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +24 -5
  436. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +17 -8
  437. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -0
  438. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +6 -6
  439. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_crld.c +4 -0
  440. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +5 -0
  441. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ncons.c +112 -55
  442. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_pci.c +2 -1
  443. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +0 -2
  444. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -1
  445. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +71 -26
  446. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +366 -227
  447. data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +2 -9
  448. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +10 -4
  449. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +3 -1
  450. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +3 -3
  451. data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +9 -0
  452. data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +8 -2
  453. data/third_party/boringssl-with-bazel/src/include/openssl/hkdf.h +4 -0
  454. data/third_party/boringssl-with-bazel/src/include/openssl/mem.h +9 -3
  455. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -20
  456. data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +12 -5
  457. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +5 -0
  458. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +37 -15
  459. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +28 -14
  460. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +31 -32
  461. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +529 -91
  462. data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +16 -695
  463. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +48 -8
  464. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +266 -357
  465. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +90 -152
  466. data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +15 -13
  467. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +75 -79
  468. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +96 -97
  469. data/third_party/boringssl-with-bazel/src/ssl/internal.h +63 -43
  470. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
  471. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +2 -2
  472. data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +6 -12
  473. data/third_party/boringssl-with-bazel/src/ssl/ssl_x509.cc +14 -17
  474. data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +14 -27
  475. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +203 -203
  476. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +30 -41
  477. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +47 -33
  478. data/third_party/re2/re2/compile.cc +91 -109
  479. data/third_party/re2/re2/dfa.cc +27 -39
  480. data/third_party/re2/re2/filtered_re2.cc +18 -2
  481. data/third_party/re2/re2/filtered_re2.h +10 -5
  482. data/third_party/re2/re2/nfa.cc +1 -1
  483. data/third_party/re2/re2/parse.cc +42 -23
  484. data/third_party/re2/re2/perl_groups.cc +34 -34
  485. data/third_party/re2/re2/prefilter.cc +3 -2
  486. data/third_party/re2/re2/prog.cc +182 -4
  487. data/third_party/re2/re2/prog.h +28 -9
  488. data/third_party/re2/re2/re2.cc +87 -118
  489. data/third_party/re2/re2/re2.h +156 -141
  490. data/third_party/re2/re2/regexp.cc +12 -5
  491. data/third_party/re2/re2/regexp.h +8 -2
  492. data/third_party/re2/re2/set.cc +31 -9
  493. data/third_party/re2/re2/set.h +9 -4
  494. data/third_party/re2/re2/simplify.cc +11 -3
  495. data/third_party/re2/re2/tostring.cc +1 -1
  496. data/third_party/re2/re2/walker-inl.h +1 -1
  497. data/third_party/re2/util/mutex.h +2 -2
  498. data/third_party/re2/util/pcre.h +3 -3
  499. metadata +83 -70
  500. data/include/grpc/event_engine/slice_allocator.h +0 -71
  501. data/src/core/ext/filters/client_channel/service_config_call_data.h +0 -126
  502. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +0 -211
  503. data/src/core/ext/filters/workarounds/workaround_utils.cc +0 -53
  504. data/src/core/ext/filters/workarounds/workaround_utils.h +0 -39
  505. data/src/core/ext/transport/chttp2/client/authority.cc +0 -42
  506. data/src/core/ext/transport/chttp2/client/authority.h +0 -36
  507. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.cc +0 -67
  508. data/src/core/ext/transport/chttp2/transport/chttp2_slice_allocator.h +0 -74
  509. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +0 -66
  510. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +0 -58
  511. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +0 -58
  512. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +0 -130
  513. data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +0 -83
  514. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +0 -44
  515. data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +0 -35
  516. data/src/core/lib/iomgr/udp_server.cc +0 -747
  517. data/src/core/lib/iomgr/udp_server.h +0 -103
  518. data/src/core/lib/transport/authority_override.cc +0 -40
  519. 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.0\"" '
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.0'
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