grpc 1.71.0 → 1.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (597) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +78 -75
  3. data/include/grpc/event_engine/memory_request.h +3 -3
  4. data/include/grpc/impl/channel_arg_names.h +70 -50
  5. data/include/grpc/support/workaround_list.h +1 -4
  6. data/src/core/{lib/transport → call}/call_arena_allocator.cc +1 -1
  7. data/src/core/{lib/transport → call}/call_arena_allocator.h +3 -3
  8. data/src/core/{lib/transport → call}/call_destination.h +4 -4
  9. data/src/core/{lib/transport → call}/call_filters.cc +2 -2
  10. data/src/core/{lib/transport → call}/call_filters.h +25 -6
  11. data/src/core/{lib/channel → call}/call_finalization.h +3 -3
  12. data/src/core/{lib/transport → call}/call_spine.cc +1 -1
  13. data/src/core/{lib/transport → call}/call_spine.h +68 -26
  14. data/src/core/{lib/transport → call}/call_state.cc +1 -1
  15. data/src/core/{lib/transport → call}/call_state.h +3 -3
  16. data/src/core/{lib/surface → call}/client_call.cc +9 -7
  17. data/src/core/{lib/surface → call}/client_call.h +4 -4
  18. data/src/core/{lib/transport → call}/custom_metadata.h +3 -3
  19. data/src/core/{lib/transport → call}/interception_chain.cc +5 -5
  20. data/src/core/{lib/transport → call}/interception_chain.h +7 -7
  21. data/src/core/{lib/transport → call}/message.cc +1 -1
  22. data/src/core/{lib/transport → call}/message.h +7 -3
  23. data/src/core/{lib/transport → call}/metadata.cc +2 -2
  24. data/src/core/{lib/transport → call}/metadata.h +4 -4
  25. data/src/core/{lib/transport → call}/metadata_batch.cc +1 -1
  26. data/src/core/{lib/transport → call}/metadata_batch.h +7 -7
  27. data/src/core/{lib/transport → call}/metadata_compression_traits.h +3 -3
  28. data/src/core/{lib/transport → call}/metadata_info.cc +27 -9
  29. data/src/core/{lib/transport → call}/metadata_info.h +4 -4
  30. data/src/core/{lib/transport → call}/parsed_metadata.cc +1 -1
  31. data/src/core/{lib/transport → call}/parsed_metadata.h +3 -3
  32. data/src/core/call/request_buffer.h +3 -3
  33. data/src/core/call/security_context.cc +125 -0
  34. data/src/core/call/security_context.h +114 -0
  35. data/src/core/{lib/surface → call}/server_call.cc +3 -3
  36. data/src/core/{lib/surface → call}/server_call.h +5 -5
  37. data/src/core/{lib/transport → call}/simple_slice_based_metadata.h +4 -4
  38. data/src/core/{lib/channel → call}/status_util.cc +1 -1
  39. data/src/core/{lib/channel → call}/status_util.h +3 -3
  40. data/src/core/client_channel/client_channel.cc +24 -16
  41. data/src/core/client_channel/client_channel.h +4 -3
  42. data/src/core/client_channel/client_channel_filter.cc +10 -20
  43. data/src/core/client_channel/client_channel_filter.h +1 -1
  44. data/src/core/client_channel/client_channel_internal.h +1 -1
  45. data/src/core/client_channel/config_selector.h +2 -2
  46. data/src/core/client_channel/direct_channel.cc +2 -2
  47. data/src/core/client_channel/dynamic_filters.cc +0 -1
  48. data/src/core/client_channel/dynamic_filters.h +0 -1
  49. data/src/core/client_channel/lb_metadata.h +1 -1
  50. data/src/core/client_channel/load_balanced_call_destination.cc +1 -1
  51. data/src/core/client_channel/load_balanced_call_destination.h +1 -1
  52. data/src/core/client_channel/retry_filter_legacy_call_data.cc +43 -41
  53. data/src/core/client_channel/retry_filter_legacy_call_data.h +6 -6
  54. data/src/core/client_channel/retry_interceptor.h +1 -1
  55. data/src/core/client_channel/retry_service_config.cc +1 -1
  56. data/src/core/client_channel/retry_service_config.h +1 -1
  57. data/src/core/client_channel/retry_throttle.cc +30 -34
  58. data/src/core/client_channel/retry_throttle.h +10 -2
  59. data/src/core/client_channel/subchannel.cc +7 -8
  60. data/src/core/client_channel/subchannel.h +1 -2
  61. data/src/core/client_channel/subchannel_stream_client.cc +14 -11
  62. data/src/core/client_channel/subchannel_stream_client.h +2 -2
  63. data/src/core/config/core_configuration.h +2 -2
  64. data/src/core/credentials/call/call_credentials.h +157 -0
  65. data/src/core/{lib/security/credentials → credentials/call}/call_creds_util.cc +4 -4
  66. data/src/core/{lib/security/credentials → credentials/call}/call_creds_util.h +4 -4
  67. data/src/core/{lib/security/credentials/composite/composite_credentials.cc → credentials/call/composite/composite_call_credentials.cc} +4 -57
  68. data/src/core/credentials/call/composite/composite_call_credentials.h +82 -0
  69. data/src/core/{lib/security/credentials → credentials/call}/external/aws_external_account_credentials.cc +2 -2
  70. data/src/core/{lib/security/credentials → credentials/call}/external/aws_external_account_credentials.h +5 -5
  71. data/src/core/{lib/security/credentials → credentials/call}/external/aws_request_signer.cc +1 -1
  72. data/src/core/{lib/security/credentials → credentials/call}/external/aws_request_signer.h +3 -3
  73. data/src/core/{lib/security/credentials → credentials/call}/external/external_account_credentials.cc +6 -6
  74. data/src/core/{lib/security/credentials → credentials/call}/external/external_account_credentials.h +5 -5
  75. data/src/core/{lib/security/credentials → credentials/call}/external/file_external_account_credentials.cc +1 -1
  76. data/src/core/{lib/security/credentials → credentials/call}/external/file_external_account_credentials.h +4 -4
  77. data/src/core/{lib/security/credentials → credentials/call}/external/url_external_account_credentials.cc +3 -2
  78. data/src/core/{lib/security/credentials → credentials/call}/external/url_external_account_credentials.h +4 -4
  79. data/src/core/{lib/security/credentials → credentials/call}/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +3 -2
  80. data/src/core/{lib/security/credentials → credentials/call}/gcp_service_account_identity/gcp_service_account_identity_credentials.h +6 -6
  81. data/src/core/{lib/security/credentials → credentials/call}/iam/iam_credentials.cc +2 -2
  82. data/src/core/{lib/security/credentials → credentials/call}/iam/iam_credentials.h +4 -4
  83. data/src/core/{lib/security/util → credentials/call}/json_util.cc +1 -1
  84. data/src/core/{lib/security/util → credentials/call}/json_util.h +3 -3
  85. data/src/core/{lib/security/credentials → credentials/call}/jwt/json_token.cc +2 -2
  86. data/src/core/{lib/security/credentials → credentials/call}/jwt/json_token.h +3 -3
  87. data/src/core/{lib/security/credentials → credentials/call}/jwt/jwt_credentials.cc +3 -3
  88. data/src/core/{lib/security/credentials → credentials/call}/jwt/jwt_credentials.h +5 -5
  89. data/src/core/{lib/security/credentials → credentials/call}/jwt/jwt_verifier.cc +3 -2
  90. data/src/core/{lib/security/credentials → credentials/call}/jwt/jwt_verifier.h +3 -3
  91. data/src/core/{lib/security/credentials → credentials/call}/oauth2/oauth2_credentials.cc +4 -3
  92. data/src/core/{lib/security/credentials → credentials/call}/oauth2/oauth2_credentials.h +5 -5
  93. data/src/core/{lib/security/credentials → credentials/call}/plugin/plugin_credentials.cc +2 -2
  94. data/src/core/{lib/security/credentials → credentials/call}/plugin/plugin_credentials.h +5 -5
  95. data/src/core/{lib/security/credentials → credentials/call}/token_fetcher/token_fetcher_credentials.cc +1 -1
  96. data/src/core/{lib/security/credentials → credentials/call}/token_fetcher/token_fetcher_credentials.h +5 -5
  97. data/src/core/{lib/security/credentials → credentials/transport}/alts/alts_credentials.cc +4 -4
  98. data/src/core/{lib/security/credentials → credentials/transport}/alts/alts_credentials.h +5 -5
  99. data/src/core/{lib/security/security_connector → credentials/transport}/alts/alts_security_connector.cc +4 -4
  100. data/src/core/{lib/security/security_connector → credentials/transport}/alts/alts_security_connector.h +4 -4
  101. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment.cc +1 -1
  102. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment.h +3 -3
  103. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment_linux.cc +1 -1
  104. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment_no_op.cc +1 -1
  105. data/src/core/{lib/security/credentials → credentials/transport}/alts/check_gcp_environment_windows.cc +1 -1
  106. data/src/core/{lib/security/credentials → credentials/transport}/alts/grpc_alts_credentials_client_options.cc +1 -1
  107. data/src/core/{lib/security/credentials → credentials/transport}/alts/grpc_alts_credentials_options.cc +1 -1
  108. data/src/core/{lib/security/credentials → credentials/transport}/alts/grpc_alts_credentials_options.h +3 -3
  109. data/src/core/{lib/security/credentials → credentials/transport}/alts/grpc_alts_credentials_server_options.cc +1 -1
  110. data/src/core/{lib/security/credentials → credentials/transport}/channel_creds_registry.h +4 -4
  111. data/src/core/{lib/security/credentials → credentials/transport}/channel_creds_registry_init.cc +21 -17
  112. data/src/core/credentials/transport/composite/composite_channel_credentials.cc +68 -0
  113. data/src/core/{lib/security/credentials/composite/composite_credentials.h → credentials/transport/composite/composite_channel_credentials.h} +6 -51
  114. data/src/core/{lib/security/credentials → credentials/transport}/fake/fake_credentials.cc +4 -26
  115. data/src/core/{lib/security/credentials → credentials/transport}/fake/fake_credentials.h +5 -37
  116. data/src/core/{lib/security/security_connector → credentials/transport}/fake/fake_security_connector.cc +4 -4
  117. data/src/core/{lib/security/security_connector → credentials/transport}/fake/fake_security_connector.h +4 -4
  118. data/src/core/{lib/security/credentials → credentials/transport}/google_default/credentials_generic.cc +2 -2
  119. data/src/core/{lib/security/credentials → credentials/transport}/google_default/google_default_credentials.cc +31 -19
  120. data/src/core/{lib/security/credentials → credentials/transport}/google_default/google_default_credentials.h +5 -5
  121. data/src/core/{lib/security/credentials → credentials/transport}/insecure/insecure_credentials.cc +2 -2
  122. data/src/core/{lib/security/credentials → credentials/transport}/insecure/insecure_credentials.h +5 -5
  123. data/src/core/{lib/security/security_connector → credentials/transport}/insecure/insecure_security_connector.cc +2 -2
  124. data/src/core/{lib/security/security_connector → credentials/transport}/insecure/insecure_security_connector.h +5 -5
  125. data/src/core/{lib/security/credentials → credentials/transport}/local/local_credentials.cc +2 -2
  126. data/src/core/{lib/security/credentials → credentials/transport}/local/local_credentials.h +5 -5
  127. data/src/core/{lib/security/security_connector → credentials/transport}/local/local_security_connector.cc +4 -4
  128. data/src/core/{lib/security/security_connector → credentials/transport}/local/local_security_connector.h +4 -4
  129. data/src/core/{lib/security/security_connector → credentials/transport}/security_connector.cc +2 -2
  130. data/src/core/{lib/security/security_connector → credentials/transport}/security_connector.h +3 -3
  131. data/src/core/{lib/security/credentials → credentials/transport}/ssl/ssl_credentials.cc +2 -2
  132. data/src/core/{lib/security/credentials → credentials/transport}/ssl/ssl_credentials.h +6 -6
  133. data/src/core/{lib/security/security_connector → credentials/transport}/ssl/ssl_security_connector.cc +5 -5
  134. data/src/core/{lib/security/security_connector → credentials/transport}/ssl/ssl_security_connector.h +4 -4
  135. data/src/core/{lib/security/certificate_provider → credentials/transport/tls}/certificate_provider_factory.h +3 -3
  136. data/src/core/{lib/security/certificate_provider → credentials/transport/tls}/certificate_provider_registry.cc +1 -1
  137. data/src/core/{lib/security/certificate_provider → credentials/transport/tls}/certificate_provider_registry.h +4 -4
  138. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_distributor.cc +1 -1
  139. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_distributor.h +4 -4
  140. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_match.cc +1 -1
  141. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_provider.cc +2 -2
  142. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_provider.h +5 -5
  143. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_verifier.cc +2 -2
  144. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_certificate_verifier.h +3 -3
  145. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_credentials_options.cc +1 -1
  146. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_credentials_options.h +7 -7
  147. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_crl_provider.cc +1 -1
  148. data/src/core/{lib/security/credentials → credentials/transport}/tls/grpc_tls_crl_provider.h +3 -3
  149. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots.h +3 -3
  150. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots_fallback.cc +1 -1
  151. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots_supported.cc +2 -2
  152. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots_supported.h +3 -3
  153. data/src/core/{lib/security/security_connector → credentials/transport/tls}/load_system_roots_windows.cc +1 -1
  154. data/src/core/{lib/security/security_connector → credentials/transport/tls}/ssl_utils.cc +3 -3
  155. data/src/core/{lib/security/security_connector → credentials/transport/tls}/ssl_utils.h +4 -4
  156. data/src/core/{lib/security/credentials → credentials/transport}/tls/tls_credentials.cc +4 -4
  157. data/src/core/{lib/security/credentials → credentials/transport}/tls/tls_credentials.h +5 -5
  158. data/src/core/{lib/security/security_connector → credentials/transport}/tls/tls_security_connector.cc +6 -6
  159. data/src/core/{lib/security/security_connector → credentials/transport}/tls/tls_security_connector.h +6 -6
  160. data/src/core/{lib/security/credentials → credentials/transport}/tls/tls_utils.cc +1 -1
  161. data/src/core/{lib/security/credentials → credentials/transport}/tls/tls_utils.h +3 -3
  162. data/src/core/{lib/security/credentials/credentials.cc → credentials/transport/transport_credentials.cc} +1 -3
  163. data/src/core/{lib/security/credentials/credentials.h → credentials/transport/transport_credentials.h} +5 -121
  164. data/src/core/{lib/security/credentials → credentials/transport}/xds/xds_credentials.cc +5 -5
  165. data/src/core/{lib/security/credentials → credentials/transport}/xds/xds_credentials.h +6 -6
  166. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -1
  167. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +8 -5
  168. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +2 -2
  169. data/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.cc +1 -1
  170. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +2 -2
  171. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +1 -1
  172. data/src/core/ext/filters/http/client/http_client_filter.h +1 -1
  173. data/src/core/ext/filters/http/client_authority_filter.cc +2 -2
  174. data/src/core/ext/filters/http/message_compress/compression_filter.cc +1 -1
  175. data/src/core/ext/filters/http/message_compress/compression_filter.h +1 -1
  176. data/src/core/ext/filters/http/server/http_server_filter.cc +1 -1
  177. data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
  178. data/src/core/ext/filters/rbac/rbac_filter.cc +2 -2
  179. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +1 -1
  180. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +3 -3
  181. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +8 -5
  182. data/src/core/ext/transport/chttp2/server/chttp2_server.h +5 -1
  183. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.cc +2 -2
  184. data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +1 -3
  185. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +58 -57
  186. data/src/core/ext/transport/chttp2/transport/context_list_entry.h +3 -3
  187. data/src/core/ext/transport/chttp2/transport/frame.cc +89 -68
  188. data/src/core/ext/transport/chttp2/transport/frame.h +37 -1
  189. data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -0
  190. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +6 -3
  191. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +4 -2
  192. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -2
  193. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +1 -1
  194. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +2 -2
  195. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +1 -1
  196. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +2 -2
  197. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +10 -8
  198. data/src/core/ext/transport/chttp2/transport/http2_settings.h +2 -2
  199. data/src/core/ext/transport/chttp2/transport/http2_status.h +52 -0
  200. data/src/core/ext/transport/chttp2/transport/internal.h +11 -14
  201. data/src/core/ext/transport/chttp2/transport/parsing.cc +36 -23
  202. data/src/core/ext/transport/chttp2/transport/writing.cc +15 -14
  203. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
  204. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +1 -1
  205. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb.h +65 -65
  206. data/src/core/ext/upb-gen/envoy/admin/v3/clusters.upb_minitable.c +28 -28
  207. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb.h +14 -14
  208. data/src/core/ext/upb-gen/envoy/admin/v3/config_dump_shared.upb_minitable.c +6 -6
  209. data/src/core/ext/upb-gen/envoy/admin/v3/metrics.upb.h +6 -6
  210. data/src/core/ext/upb-gen/envoy/admin/v3/metrics.upb_minitable.c +4 -4
  211. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb.h +133 -133
  212. data/src/core/ext/upb-gen/envoy/admin/v3/server_info.upb_minitable.c +71 -71
  213. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb.h +26 -26
  214. data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb_minitable.c +7 -7
  215. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +216 -218
  216. data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +66 -66
  217. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb.h +27 -27
  218. data/src/core/ext/upb-gen/envoy/config/cluster/v3/circuit_breaker.upb_minitable.c +9 -9
  219. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +326 -328
  220. data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +103 -103
  221. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb.h +58 -58
  222. data/src/core/ext/upb-gen/envoy/config/cluster/v3/outlier_detection.upb_minitable.c +14 -14
  223. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb.h +22 -24
  224. data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.c +3 -3
  225. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +29 -29
  226. data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +16 -16
  227. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb.h +186 -192
  228. data/src/core/ext/upb-gen/envoy/config/core/v3/base.upb_minitable.c +54 -54
  229. data/src/core/ext/upb-gen/envoy/config/core/v3/config_source.upb.h +54 -54
  230. data/src/core/ext/upb-gen/envoy/config/core/v3/config_source.upb_minitable.c +21 -21
  231. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb.h +59 -61
  232. data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.c +15 -15
  233. data/src/core/ext/upb-gen/envoy/config/core/v3/health_check.upb.h +100 -100
  234. data/src/core/ext/upb-gen/envoy/config/core/v3/health_check.upb_minitable.c +34 -34
  235. data/src/core/ext/upb-gen/envoy/config/core/v3/http_uri.upb.h +12 -12
  236. data/src/core/ext/upb-gen/envoy/config/core/v3/http_uri.upb_minitable.c +5 -5
  237. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +118 -118
  238. data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +39 -39
  239. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb.h +19 -19
  240. data/src/core/ext/upb-gen/envoy/config/core/v3/socket_option.upb_minitable.c +9 -9
  241. data/src/core/ext/upb-gen/envoy/config/core/v3/substitution_format_string.upb.h +27 -27
  242. data/src/core/ext/upb-gen/envoy/config/core/v3/substitution_format_string.upb_minitable.c +10 -10
  243. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint.upb.h +12 -14
  244. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint.upb_minitable.c +2 -2
  245. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +41 -41
  246. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +16 -16
  247. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/load_report.upb.h +24 -24
  248. data/src/core/ext/upb-gen/envoy/config/endpoint/v3/load_report.upb_minitable.c +9 -9
  249. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +139 -139
  250. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +46 -46
  251. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb.h +61 -61
  252. data/src/core/ext/upb-gen/envoy/config/listener/v3/listener_components.upb_minitable.c +20 -20
  253. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +3 -3
  254. data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +1 -1
  255. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb.h +6 -6
  256. data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.c +4 -4
  257. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +33 -33
  258. data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +14 -14
  259. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +12 -14
  260. data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +2 -2
  261. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb.h +52 -54
  262. data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.c +10 -10
  263. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +620 -626
  264. data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +215 -215
  265. data/src/core/ext/upb-gen/envoy/config/route/v3/scoped_route.upb.h +13 -13
  266. data/src/core/ext/upb-gen/envoy/config/route/v3/scoped_route.upb_minitable.c +4 -4
  267. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb.h +3 -3
  268. data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.c +2 -2
  269. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +7 -7
  270. data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +3 -3
  271. data/src/core/ext/upb-gen/envoy/config/trace/v3/skywalking.upb.h +15 -15
  272. data/src/core/ext/upb-gen/envoy/config/trace/v3/skywalking.upb_minitable.c +7 -7
  273. data/src/core/ext/upb-gen/envoy/config/trace/v3/xray.upb.h +7 -7
  274. data/src/core/ext/upb-gen/envoy/config/trace/v3/xray.upb_minitable.c +3 -3
  275. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +16 -16
  276. data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +10 -10
  277. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb.h +306 -312
  278. data/src/core/ext/upb-gen/envoy/data/accesslog/v3/accesslog.upb_minitable.c +96 -96
  279. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb.h +61 -61
  280. data/src/core/ext/upb-gen/envoy/extensions/filters/http/fault/v3/fault.upb_minitable.c +27 -27
  281. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h +19 -19
  282. data/src/core/ext/upb-gen/envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.c +6 -6
  283. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +25 -25
  284. data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c +9 -9
  285. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb.h +34 -34
  286. data/src/core/ext/upb-gen/envoy/extensions/filters/http/router/v3/router.upb_minitable.c +9 -9
  287. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +3 -3
  288. data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +2 -2
  289. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +294 -294
  290. data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +105 -105
  291. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +3 -3
  292. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +1 -1
  293. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h +23 -23
  294. data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb_minitable.c +8 -8
  295. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +84 -84
  296. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +28 -28
  297. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +87 -87
  298. data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/tls.upb_minitable.c +31 -31
  299. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +24 -24
  300. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +5 -5
  301. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb.h +130 -132
  302. data/src/core/ext/upb-gen/envoy/service/discovery/v3/discovery.upb_minitable.c +43 -43
  303. data/src/core/ext/upb-gen/envoy/service/load_stats/v3/lrs.upb.h +6 -6
  304. data/src/core/ext/upb-gen/envoy/service/load_stats/v3/lrs.upb_minitable.c +2 -2
  305. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb.h +60 -60
  306. data/src/core/ext/upb-gen/envoy/service/status/v3/csds.upb_minitable.c +26 -26
  307. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb.h +7 -7
  308. data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c +3 -3
  309. data/src/core/ext/upb-gen/envoy/type/matcher/v3/metadata.upb.h +6 -6
  310. data/src/core/ext/upb-gen/envoy/type/matcher/v3/metadata.upb_minitable.c +2 -2
  311. data/src/core/ext/upb-gen/envoy/type/matcher/v3/regex.upb.h +7 -7
  312. data/src/core/ext/upb-gen/envoy/type/matcher/v3/regex.upb_minitable.c +3 -3
  313. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb.h +11 -11
  314. data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.c +4 -4
  315. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb.h +85 -89
  316. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/checked.upb_minitable.c +20 -20
  317. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb.h +80 -83
  318. data/src/core/ext/upb-gen/google/api/expr/v1alpha1/syntax.upb_minitable.c +27 -27
  319. data/src/core/ext/upb-gen/google/api/http.upb.h +51 -51
  320. data/src/core/ext/upb-gen/google/api/http.upb_minitable.c +22 -22
  321. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb.h +327 -301
  322. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.c +97 -85
  323. data/src/core/ext/upb-gen/google/protobuf/descriptor.upb_minitable.h +1 -0
  324. data/src/core/ext/upb-gen/google/protobuf/struct.upb.h +9 -11
  325. data/src/core/ext/upb-gen/src/proto/grpc/gcp/altscontext.upb.h +9 -10
  326. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +110 -113
  327. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +25 -25
  328. data/src/core/ext/upb-gen/src/proto/grpc/lb/v1/load_balancer.upb.h +6 -6
  329. data/src/core/ext/upb-gen/src/proto/grpc/lb/v1/load_balancer.upb_minitable.c +4 -4
  330. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls.upb.h +21 -22
  331. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls.upb_minitable.c +3 -3
  332. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls_config.upb.h +70 -72
  333. data/src/core/ext/upb-gen/src/proto/grpc/lookup/v1/rls_config.upb_minitable.c +17 -17
  334. data/src/core/ext/upb-gen/validate/validate.upb.h +368 -368
  335. data/src/core/ext/upb-gen/validate/validate.upb_minitable.c +117 -117
  336. data/src/core/ext/upb-gen/xds/core/v3/context_params.upb.h +9 -10
  337. data/src/core/ext/upb-gen/xds/core/v3/resource.upb.h +7 -7
  338. data/src/core/ext/upb-gen/xds/core/v3/resource.upb_minitable.c +3 -3
  339. data/src/core/ext/upb-gen/xds/core/v3/resource_locator.upb.h +12 -12
  340. data/src/core/ext/upb-gen/xds/core/v3/resource_locator.upb_minitable.c +2 -2
  341. data/src/core/ext/upb-gen/xds/data/orca/v3/orca_load_report.upb.h +27 -30
  342. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb.h +7 -7
  343. data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.c +3 -3
  344. data/src/core/ext/upb-gen/xds/type/matcher/v3/ip.upb.h +3 -3
  345. data/src/core/ext/upb-gen/xds/type/matcher/v3/ip.upb_minitable.c +1 -1
  346. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb.h +22 -24
  347. data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.c +3 -3
  348. data/src/core/ext/upbdefs-gen/google/protobuf/descriptor.upbdefs.c +98 -87
  349. data/src/core/{lib/security/transport → filter/auth}/auth_filters.h +8 -7
  350. data/src/core/{lib/security/transport → filter/auth}/client_auth_filter.cc +7 -6
  351. data/src/core/{lib/security/transport → filter/auth}/server_auth_filter.cc +5 -4
  352. data/src/core/handshaker/handshaker.cc +0 -8
  353. data/src/core/handshaker/security/security_handshaker.cc +1 -1
  354. data/src/core/handshaker/security/security_handshaker.h +1 -1
  355. data/src/core/lib/channel/channel_args.h +49 -30
  356. data/src/core/lib/channel/channel_stack.h +1 -2
  357. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -1
  358. data/src/core/lib/channel/connected_channel.cc +2 -2
  359. data/src/core/lib/channel/promise_based_filter.h +3 -3
  360. data/src/core/lib/debug/trace_flags.cc +2 -4
  361. data/src/core/lib/debug/trace_flags.h +1 -2
  362. data/src/core/lib/event_engine/default_event_engine_factory.cc +6 -6
  363. data/src/core/lib/event_engine/default_event_engine_factory.h +1 -1
  364. data/src/core/lib/event_engine/extensions/iomgr_compatible.h +39 -0
  365. data/src/core/lib/event_engine/extensions/supports_win_sockets.h +48 -0
  366. data/src/core/lib/event_engine/extensions/tcp_trace.h +1 -1
  367. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +0 -2
  368. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +1 -3
  369. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +26 -0
  370. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +4 -0
  371. data/src/core/lib/event_engine/posix_engine/set_socket_dualstack.cc +64 -0
  372. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +0 -11
  373. data/src/core/lib/event_engine/posix_engine/wakeup_fd_pipe.cc +10 -2
  374. data/src/core/lib/event_engine/shim.cc +9 -16
  375. data/src/core/lib/event_engine/shim.h +11 -0
  376. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +15 -7
  377. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +2 -1
  378. data/src/core/lib/event_engine/windows/win_socket.cc +11 -0
  379. data/src/core/lib/event_engine/windows/win_socket.h +3 -0
  380. data/src/core/lib/event_engine/windows/windows_endpoint.cc +5 -10
  381. data/src/core/lib/event_engine/windows/windows_engine.cc +42 -0
  382. data/src/core/lib/event_engine/windows/windows_engine.h +8 -2
  383. data/src/core/lib/event_engine/windows/windows_listener.cc +5 -6
  384. data/src/core/lib/event_engine/windows/windows_listener.h +9 -4
  385. data/src/core/lib/experiments/experiments.cc +174 -21
  386. data/src/core/lib/experiments/experiments.h +70 -13
  387. data/src/core/lib/iomgr/endpoint_pair_posix.cc +43 -16
  388. data/src/core/lib/iomgr/endpoint_pair_windows.cc +43 -8
  389. data/src/core/lib/iomgr/error.cc +27 -43
  390. data/src/core/lib/iomgr/ev_epoll1_linux.cc +13 -1
  391. data/src/core/lib/iomgr/ev_poll_posix.cc +13 -0
  392. data/src/core/lib/iomgr/polling_entity.cc +2 -7
  393. data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -0
  394. data/src/core/lib/iomgr/socket_utils_posix.cc +22 -11
  395. data/src/core/lib/iomgr/socket_utils_posix.h +12 -2
  396. data/src/core/lib/iomgr/tcp_client_cfstream.cc +8 -9
  397. data/src/core/lib/iomgr/tcp_client_posix.cc +11 -15
  398. data/src/core/lib/iomgr/tcp_client_posix.h +1 -1
  399. data/src/core/lib/iomgr/tcp_posix.cc +58 -31
  400. data/src/core/lib/iomgr/tcp_posix.h +10 -2
  401. data/src/core/lib/iomgr/tcp_server_posix.cc +9 -1
  402. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -4
  403. data/src/core/lib/iomgr/tcp_server_windows.cc +27 -16
  404. data/src/core/lib/iomgr/wakeup_fd_pipe.cc +10 -2
  405. data/src/core/lib/promise/all_ok.h +31 -0
  406. data/src/core/lib/promise/loop.h +8 -5
  407. data/src/core/lib/promise/map.h +65 -2
  408. data/src/core/lib/promise/party.h +5 -1
  409. data/src/core/lib/promise/poll.h +22 -20
  410. data/src/core/lib/promise/promise.h +2 -2
  411. data/src/core/lib/promise/status_flag.h +23 -11
  412. data/src/core/lib/security/authorization/evaluate_args.cc +1 -1
  413. data/src/core/lib/security/authorization/evaluate_args.h +1 -1
  414. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +1 -1
  415. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +1 -1
  416. data/src/core/lib/slice/slice.h +6 -0
  417. data/src/core/lib/surface/call.cc +20 -18
  418. data/src/core/lib/surface/call_utils.cc +3 -3
  419. data/src/core/lib/surface/call_utils.h +3 -3
  420. data/src/core/lib/surface/channel.h +2 -2
  421. data/src/core/lib/surface/channel_init.h +2 -2
  422. data/src/core/lib/surface/completion_queue.cc +77 -17
  423. data/src/core/lib/surface/filter_stack_call.cc +40 -27
  424. data/src/core/lib/surface/filter_stack_call.h +1 -1
  425. data/src/core/lib/surface/init.cc +2 -3
  426. data/src/core/lib/surface/lame_client.cc +1 -1
  427. data/src/core/lib/surface/legacy_channel.cc +27 -23
  428. data/src/core/lib/surface/legacy_channel.h +1 -1
  429. data/src/core/lib/surface/version.cc +2 -2
  430. data/src/core/lib/transport/error_utils.cc +65 -11
  431. data/src/core/lib/transport/error_utils.h +2 -2
  432. data/src/core/lib/transport/status_conversion.cc +16 -14
  433. data/src/core/lib/transport/status_conversion.h +5 -4
  434. data/src/core/lib/transport/transport.h +5 -5
  435. data/src/core/lib/transport/transport_op_string.cc +1 -1
  436. data/src/core/load_balancing/delegating_helper.h +1 -1
  437. data/src/core/load_balancing/grpclb/client_load_reporting_filter.cc +1 -1
  438. data/src/core/load_balancing/grpclb/grpclb.cc +1 -2
  439. data/src/core/load_balancing/pick_first/pick_first.cc +0 -955
  440. data/src/core/load_balancing/rls/rls.cc +31 -37
  441. data/src/core/load_balancing/weighted_target/weighted_target.cc +1 -1
  442. data/src/core/load_balancing/xds/cds.cc +3 -10
  443. data/src/core/load_balancing/xds/xds_cluster_impl.cc +1 -1
  444. data/src/core/plugin_registry/grpc_plugin_registry.cc +2 -0
  445. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -2
  446. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +1 -3
  447. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +4 -0
  448. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +1 -1
  449. data/src/core/resolver/xds/xds_dependency_manager.cc +8 -3
  450. data/src/core/resolver/xds/xds_resolver.cc +2 -2
  451. data/src/core/server/server.cc +7 -4
  452. data/src/core/server/server.h +1 -1
  453. data/src/core/server/server_call_tracer_filter.cc +1 -1
  454. data/src/core/server/server_config_selector.h +1 -1
  455. data/src/core/server/server_config_selector_filter.cc +1 -1
  456. data/src/core/server/xds_server_config_fetcher.cc +5 -5
  457. data/src/core/service_config/service_config_channel_arg_filter.cc +1 -1
  458. data/src/core/telemetry/call_tracer.cc +2 -4
  459. data/src/core/telemetry/call_tracer.h +3 -3
  460. data/src/core/telemetry/metrics.cc +30 -12
  461. data/src/core/telemetry/metrics.h +15 -3
  462. data/src/core/telemetry/stats_data.cc +75 -2
  463. data/src/core/telemetry/stats_data.h +46 -4
  464. data/src/core/telemetry/tcp_tracer.h +90 -84
  465. data/src/core/{lib/security/context/security_context.cc → transport/auth_context.cc} +1 -96
  466. data/src/core/{lib/security/context/security_context.h → transport/auth_context.h} +6 -76
  467. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
  468. data/src/core/tsi/ssl_transport_security.cc +1 -1
  469. data/src/core/util/check_class_size.h +48 -0
  470. data/src/core/util/gcp_metadata_query.cc +1 -1
  471. data/src/core/util/http_client/httpcli.cc +3 -3
  472. data/src/core/util/http_client/httpcli_security_connector.cc +3 -3
  473. data/src/core/util/load_file.cc +26 -14
  474. data/src/core/util/status_helper.cc +86 -63
  475. data/src/core/util/status_helper.h +9 -26
  476. data/src/core/xds/grpc/certificate_provider_store.cc +1 -1
  477. data/src/core/xds/grpc/certificate_provider_store.h +3 -3
  478. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +3 -3
  479. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +1 -1
  480. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +10 -7
  481. data/src/core/xds/grpc/xds_certificate_provider.cc +1 -1
  482. data/src/core/xds/grpc/xds_certificate_provider.h +2 -2
  483. data/src/core/xds/grpc/xds_client_grpc.cc +7 -6
  484. data/src/core/xds/grpc/xds_client_grpc.h +4 -2
  485. data/src/core/xds/grpc/xds_cluster.h +3 -3
  486. data/src/core/xds/grpc/xds_cluster_parser.cc +3 -2
  487. data/src/core/xds/grpc/xds_http_fault_filter.cc +1 -1
  488. data/src/core/xds/grpc/xds_http_filter.h +1 -1
  489. data/src/core/xds/grpc/xds_http_filter_registry.h +1 -1
  490. data/src/core/xds/grpc/xds_route_config.h +1 -1
  491. data/src/core/xds/grpc/xds_route_config_parser.cc +1 -1
  492. data/src/core/xds/grpc/xds_route_config_parser.h +1 -1
  493. data/src/core/xds/grpc/xds_routing.h +1 -1
  494. data/src/core/xds/grpc/xds_server_grpc.cc +60 -48
  495. data/src/core/xds/grpc/xds_server_grpc.h +23 -13
  496. data/src/core/xds/grpc/xds_server_grpc_interface.h +2 -2
  497. data/src/core/xds/grpc/xds_transport_grpc.cc +5 -5
  498. data/src/core/xds/grpc/xds_transport_grpc.h +5 -3
  499. data/src/core/xds/xds_client/lrs_client.cc +6 -5
  500. data/src/core/xds/xds_client/lrs_client.h +7 -7
  501. data/src/core/xds/xds_client/xds_bootstrap.h +16 -1
  502. data/src/core/xds/xds_client/xds_client.cc +25 -23
  503. data/src/core/xds/xds_client/xds_client.h +3 -1
  504. data/src/core/xds/xds_client/xds_resource_type.h +1 -2
  505. data/src/core/xds/xds_client/xds_transport.h +1 -1
  506. data/src/ruby/ext/grpc/extconf.rb +1 -1
  507. data/src/ruby/lib/grpc/version.rb +1 -1
  508. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.cc +0 -2
  509. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_fuchsia.cc +0 -2
  510. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_linux.cc +0 -2
  511. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_openbsd.cc +0 -2
  512. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_sysreg.cc +0 -2
  513. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.cc +0 -2
  514. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_freebsd.cc +0 -1
  515. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.cc +0 -1
  516. data/third_party/boringssl-with-bazel/src/crypto/crypto.cc +0 -2
  517. data/third_party/boringssl-with-bazel/src/crypto/internal.h +20 -3
  518. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +3 -25
  519. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +3 -7
  520. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +1 -1
  521. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  522. data/third_party/boringssl-with-bazel/src/ssl/internal.h +13 -6
  523. data/third_party/boringssl-with-bazel/src/ssl/ssl_credential.cc +2 -1
  524. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +1 -1
  525. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +1 -1
  526. data/third_party/upb/upb/base/internal/log2.h +3 -1
  527. data/third_party/upb/upb/base/string_view.h +10 -0
  528. data/third_party/upb/upb/hash/common.c +5 -1
  529. data/third_party/upb/upb/json/decode.c +2 -2
  530. data/third_party/upb/upb/json/decode.h +0 -1
  531. data/third_party/upb/upb/mem/alloc.h +5 -0
  532. data/third_party/upb/upb/mem/arena.c +296 -142
  533. data/third_party/upb/upb/mem/arena.h +47 -11
  534. data/third_party/upb/upb/mem/arena.hpp +4 -20
  535. data/third_party/upb/upb/mem/internal/arena.h +4 -6
  536. data/third_party/upb/upb/message/accessors.h +41 -0
  537. data/third_party/upb/upb/message/compat.c +11 -14
  538. data/third_party/upb/upb/message/compat.h +4 -3
  539. data/third_party/upb/upb/message/copy.c +35 -30
  540. data/third_party/upb/upb/message/internal/accessors.h +139 -10
  541. data/third_party/upb/upb/message/internal/extension.c +28 -25
  542. data/third_party/upb/upb/message/internal/extension.h +21 -5
  543. data/third_party/upb/upb/message/internal/iterator.c +58 -0
  544. data/third_party/upb/upb/message/internal/iterator.h +29 -0
  545. data/third_party/upb/upb/message/internal/map.h +2 -3
  546. data/third_party/upb/upb/message/internal/map_sorter.h +3 -2
  547. data/third_party/upb/upb/message/internal/message.c +48 -29
  548. data/third_party/upb/upb/message/internal/message.h +154 -24
  549. data/third_party/upb/upb/message/map_sorter.c +20 -8
  550. data/third_party/upb/upb/message/message.c +90 -38
  551. data/third_party/upb/upb/message/message.h +58 -2
  552. data/third_party/upb/upb/message/value.h +9 -0
  553. data/third_party/upb/upb/mini_descriptor/build_enum.c +1 -1
  554. data/third_party/upb/upb/mini_descriptor/decode.c +97 -136
  555. data/third_party/upb/upb/mini_descriptor/decode.h +4 -3
  556. data/third_party/upb/upb/mini_descriptor/internal/encode.hpp +1 -1
  557. data/third_party/upb/upb/mini_table/extension_registry.c +24 -12
  558. data/third_party/upb/upb/mini_table/extension_registry.h +13 -6
  559. data/third_party/upb/upb/mini_table/message.c +21 -13
  560. data/third_party/upb/upb/port/atomic.h +134 -7
  561. data/third_party/upb/upb/port/def.inc +140 -38
  562. data/third_party/upb/upb/port/undef.inc +11 -1
  563. data/third_party/upb/upb/reflection/def.hpp +5 -1
  564. data/third_party/upb/upb/reflection/def_pool.c +10 -3
  565. data/third_party/upb/upb/reflection/descriptor_bootstrap.h +1 -1
  566. data/third_party/upb/upb/reflection/file_def.c +12 -5
  567. data/third_party/upb/upb/reflection/internal/def_builder.c +1 -1
  568. data/third_party/upb/upb/reflection/internal/upb_edition_defaults.h +1 -1
  569. data/third_party/upb/upb/reflection/message.c +19 -16
  570. data/third_party/upb/upb/reflection/message.h +3 -1
  571. data/third_party/upb/upb/text/encode.c +1 -13
  572. data/third_party/upb/upb/text/internal/encode.c +25 -6
  573. data/third_party/upb/upb/text/internal/encode.h +4 -0
  574. data/third_party/upb/upb/wire/decode.c +60 -45
  575. data/third_party/upb/upb/wire/decode.h +4 -2
  576. data/third_party/upb/upb/wire/encode.c +77 -42
  577. data/third_party/upb/upb/wire/encode.h +2 -0
  578. data/third_party/upb/upb/wire/eps_copy_input_stream.h +18 -20
  579. data/third_party/upb/upb/wire/internal/decoder.h +4 -11
  580. data/third_party/utf8_range/utf8_range.c +15 -275
  581. data/third_party/utf8_range/utf8_range_neon.inc +117 -0
  582. data/third_party/utf8_range/utf8_range_sse.inc +272 -0
  583. data/third_party/zlib/deflate.c +40 -15
  584. data/third_party/zlib/deflate.h +33 -2
  585. data/third_party/zlib/gzguts.h +2 -6
  586. data/third_party/zlib/inflate.c +1 -1
  587. data/third_party/zlib/inftrees.c +3 -3
  588. data/third_party/zlib/inftrees.h +2 -2
  589. data/third_party/zlib/trees.c +18 -4
  590. data/third_party/zlib/zconf.h +1 -9
  591. data/third_party/zlib/zlib.h +12 -12
  592. data/third_party/zlib/zutil.h +4 -25
  593. metadata +155 -145
  594. data/include/grpc/grpc_cronet.h +0 -37
  595. data/src/core/lib/transport/http2_errors.h +0 -43
  596. data/third_party/upb/upb/message/internal/compare_unknown.c +0 -289
  597. data/third_party/upb/upb/message/internal/compare_unknown.h +0 -49
@@ -11,7 +11,8 @@
11
11
  * to be freed. However the Arena does allow users to register cleanup
12
12
  * functions that will run when the arena is destroyed.
13
13
  *
14
- * A upb_Arena is *not* thread-safe.
14
+ * A upb_Arena is *not* thread-safe, although some functions related to its
15
+ * managing its lifetime are, and are documented as such.
15
16
  *
16
17
  * You could write a thread-safe arena allocator that satisfies the
17
18
  * upb_alloc interface, but it would not be as efficient for the
@@ -31,33 +32,67 @@
31
32
 
32
33
  typedef struct upb_Arena upb_Arena;
33
34
 
35
+ typedef void upb_AllocCleanupFunc(upb_alloc* alloc);
36
+
34
37
  #ifdef __cplusplus
35
38
  extern "C" {
36
39
  #endif
37
40
 
38
- // Creates an arena from the given initial block (if any -- n may be 0).
39
- // Additional blocks will be allocated from |alloc|. If |alloc| is NULL, this
40
- // is a fixed-size arena and cannot grow.
41
+ // Creates an arena from the given initial block (if any -- mem may be NULL). If
42
+ // an initial block is specified, the arena's lifetime cannot be extended by
43
+ // |upb_Arena_IncRefFor| or |upb_Arena_Fuse|. Additional blocks will be
44
+ // allocated from |alloc|. If |alloc| is NULL, this is a fixed-size arena and
45
+ // cannot grow. If an initial block is specified, |n| is its length; if there is
46
+ // no initial block, |n| is a hint of the size that should be allocated for the
47
+ // first block of the arena, such that `upb_Arena_Malloc(hint)` will not require
48
+ // another call to |alloc|.
41
49
  UPB_API upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc);
42
50
 
43
51
  UPB_API void upb_Arena_Free(upb_Arena* a);
44
- UPB_API bool upb_Arena_Fuse(upb_Arena* a, upb_Arena* b);
45
-
46
- bool upb_Arena_IncRefFor(upb_Arena* a, const void* owner);
47
- void upb_Arena_DecRefFor(upb_Arena* a, const void* owner);
48
-
49
- size_t upb_Arena_SpaceAllocated(upb_Arena* a, size_t* fused_count);
50
- uint32_t upb_Arena_DebugRefCount(upb_Arena* a);
52
+ // Sets the cleanup function for the upb_alloc used by the arena. Only one
53
+ // cleanup function can be set, which will be called after all blocks are
54
+ // freed.
55
+ UPB_API void upb_Arena_SetAllocCleanup(upb_Arena* a,
56
+ upb_AllocCleanupFunc* func);
57
+
58
+ // Fuses the lifetime of two arenas, such that no arenas that have been
59
+ // transitively fused together will be freed until all of them have reached a
60
+ // zero refcount. This operation is safe to use concurrently from multiple
61
+ // threads.
62
+ UPB_API bool upb_Arena_Fuse(const upb_Arena* a, const upb_Arena* b);
63
+
64
+ // This operation is safe to use concurrently from multiple threads.
65
+ UPB_API bool upb_Arena_IsFused(const upb_Arena* a, const upb_Arena* b);
66
+
67
+ // Returns the upb_alloc used by the arena.
68
+ UPB_API upb_alloc* upb_Arena_GetUpbAlloc(upb_Arena* a);
69
+
70
+ // This operation is safe to use concurrently from multiple threads.
71
+ bool upb_Arena_IncRefFor(const upb_Arena* a, const void* owner);
72
+ // This operation is safe to use concurrently from multiple threads.
73
+ void upb_Arena_DecRefFor(const upb_Arena* a, const void* owner);
74
+
75
+ // This operation is safe to use concurrently from multiple threads.
76
+ uintptr_t upb_Arena_SpaceAllocated(const upb_Arena* a, size_t* fused_count);
77
+ // This operation is safe to use concurrently from multiple threads.
78
+ uint32_t upb_Arena_DebugRefCount(const upb_Arena* a);
51
79
 
52
80
  UPB_API_INLINE upb_Arena* upb_Arena_New(void) {
53
81
  return upb_Arena_Init(NULL, 0, &upb_alloc_global);
54
82
  }
55
83
 
84
+ UPB_API_INLINE upb_Arena* upb_Arena_NewSized(size_t size_hint) {
85
+ return upb_Arena_Init(NULL, size_hint, &upb_alloc_global);
86
+ }
87
+
56
88
  UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size);
57
89
 
58
90
  UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
59
91
  size_t size);
60
92
 
93
+ static const size_t UPB_PRIVATE(kUpbDefaultMaxBlockSize) =
94
+ UPB_DEFAULT_MAX_BLOCK_SIZE;
95
+
61
96
  // Sets the maximum block size for all arenas. This is a global configuration
62
97
  // setting that will affect all existing and future arenas. If
63
98
  // upb_Arena_Malloc() is called with a size larger than this, we will exceed
@@ -65,6 +100,7 @@ UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
65
100
  //
66
101
  // This API is meant for experimentation only. It will likely be removed in
67
102
  // the future.
103
+ // This operation is safe to use concurrently from multiple threads.
68
104
  void upb_Arena_SetMaxBlockSize(size_t max);
69
105
 
70
106
  // Shrinks the last alloc from arena.
@@ -8,8 +8,10 @@
8
8
  #ifndef UPB_MEM_ARENA_HPP_
9
9
  #define UPB_MEM_ARENA_HPP_
10
10
 
11
+ #include "upb/mem/alloc.h"
11
12
  #ifdef __cplusplus
12
13
 
14
+ #include <cstddef>
13
15
  #include <memory>
14
16
 
15
17
  #include "upb/mem/arena.h"
@@ -23,6 +25,8 @@ class Arena {
23
25
  Arena(char* initial_block, size_t size)
24
26
  : ptr_(upb_Arena_Init(initial_block, size, &upb_alloc_global),
25
27
  upb_Arena_Free) {}
28
+ explicit Arena(size_t size)
29
+ : ptr_(upb_Arena_NewSized(size), upb_Arena_Free) {}
26
30
 
27
31
  upb_Arena* ptr() const { return ptr_.get(); }
28
32
 
@@ -35,26 +39,6 @@ class Arena {
35
39
  protected:
36
40
  std::unique_ptr<upb_Arena, decltype(&upb_Arena_Free)> ptr_;
37
41
  };
38
-
39
- // InlinedArena seeds the arenas with a predefined amount of memory. No heap
40
- // memory will be allocated until the initial block is exceeded.
41
- template <int N>
42
- class InlinedArena : public Arena {
43
- public:
44
- InlinedArena() : Arena(initial_block_, N) {}
45
- ~InlinedArena() {
46
- // Explicitly destroy the arena now so that it does not outlive
47
- // initial_block_.
48
- ptr_.reset();
49
- }
50
-
51
- private:
52
- InlinedArena(const InlinedArena&) = delete;
53
- InlinedArena& operator=(const InlinedArena&) = delete;
54
-
55
- char initial_block_[N];
56
- };
57
-
58
42
  } // namespace upb
59
43
 
60
44
  #endif // __cplusplus
@@ -20,7 +20,7 @@
20
20
  //
21
21
  // We need this because the decoder inlines a upb_Arena for performance but
22
22
  // the full struct is not visible outside of arena.c. Yes, I know, it's awful.
23
- #define UPB_ARENA_SIZE_HACK 7
23
+ #define UPB_ARENA_SIZE_HACK (9 + UPB_TSAN_PUBLISH)
24
24
 
25
25
  // LINT.IfChange(upb_Arena)
26
26
 
@@ -40,16 +40,12 @@ void UPB_PRIVATE(_upb_Arena_SwapIn)(struct upb_Arena* des,
40
40
  void UPB_PRIVATE(_upb_Arena_SwapOut)(struct upb_Arena* des,
41
41
  const struct upb_Arena* src);
42
42
 
43
- // Returns whether |ptr| was allocated directly by |a| (so care must be used
44
- // with fused arenas).
45
- UPB_API bool UPB_ONLYBITS(_upb_Arena_Contains)(const struct upb_Arena* a,
46
- void* ptr);
47
-
48
43
  UPB_INLINE size_t UPB_PRIVATE(_upb_ArenaHas)(const struct upb_Arena* a) {
49
44
  return (size_t)(a->UPB_ONLYBITS(end) - a->UPB_ONLYBITS(ptr));
50
45
  }
51
46
 
52
47
  UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) {
48
+ UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr));
53
49
  void* UPB_PRIVATE(_upb_Arena_SlowMalloc)(struct upb_Arena * a, size_t size);
54
50
 
55
51
  size = UPB_ALIGN_MALLOC(size);
@@ -71,6 +67,7 @@ UPB_API_INLINE void* upb_Arena_Malloc(struct upb_Arena* a, size_t size) {
71
67
 
72
68
  UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr,
73
69
  size_t oldsize, size_t size) {
70
+ UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr));
74
71
  oldsize = UPB_ALIGN_MALLOC(oldsize);
75
72
  size = UPB_ALIGN_MALLOC(size);
76
73
  bool is_most_recent_alloc =
@@ -97,6 +94,7 @@ UPB_API_INLINE void* upb_Arena_Realloc(struct upb_Arena* a, void* ptr,
97
94
 
98
95
  UPB_API_INLINE void upb_Arena_ShrinkLast(struct upb_Arena* a, void* ptr,
99
96
  size_t oldsize, size_t size) {
97
+ UPB_TSAN_CHECK_WRITE(a->UPB_ONLYBITS(ptr));
100
98
  oldsize = UPB_ALIGN_MALLOC(oldsize);
101
99
  size = UPB_ALIGN_MALLOC(size);
102
100
  // Must be the last alloc.
@@ -168,6 +168,47 @@ UPB_API_INLINE void upb_Message_SetBaseFieldUInt64(struct upb_Message* msg,
168
168
  const upb_MiniTableField* f,
169
169
  uint64_t value);
170
170
 
171
+ // Extension Getters ///////////////////////////////////////////////////////////
172
+ UPB_API_INLINE bool upb_Message_GetExtensionBool(
173
+ const upb_Message* msg, const upb_MiniTableExtension* f, bool default_val);
174
+
175
+ UPB_API_INLINE double upb_Message_GetExtensionDouble(
176
+ const upb_Message* msg, const upb_MiniTableExtension* f,
177
+ double default_val);
178
+
179
+ UPB_API_INLINE float upb_Message_GetExtensionFloat(
180
+ const upb_Message* msg, const upb_MiniTableExtension* f, float default_val);
181
+
182
+ UPB_API_INLINE int32_t upb_Message_GetExtensionInt32(
183
+ const upb_Message* msg, const upb_MiniTableExtension* f,
184
+ int32_t default_val);
185
+
186
+ UPB_API_INLINE int64_t upb_Message_GetExtensionInt64(
187
+ const upb_Message* msg, const upb_MiniTableExtension* f,
188
+ int64_t default_val);
189
+
190
+ UPB_API_INLINE uint32_t upb_Message_GetExtensionUInt32(
191
+ const upb_Message* msg, const upb_MiniTableExtension* f,
192
+ uint32_t default_val);
193
+
194
+ UPB_API_INLINE uint64_t upb_Message_GetExtensionUInt64(
195
+ const upb_Message* msg, const upb_MiniTableExtension* f,
196
+ uint64_t default_val);
197
+
198
+ UPB_API_INLINE upb_StringView upb_Message_GetExtensionString(
199
+ const upb_Message* msg, const upb_MiniTableExtension* f,
200
+ upb_StringView default_val);
201
+
202
+ UPB_API_INLINE upb_Message* upb_Message_GetExtensionMessage(
203
+ const upb_Message* msg, const upb_MiniTableExtension* f,
204
+ struct upb_Message* default_val);
205
+
206
+ UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray(
207
+ const upb_Message* msg, const upb_MiniTableExtension* f);
208
+
209
+ UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray(
210
+ upb_Message* msg, const upb_MiniTableExtension* f);
211
+
171
212
  // Extension Setters ///////////////////////////////////////////////////////////
172
213
 
173
214
  UPB_API_INLINE bool upb_Message_SetExtension(upb_Message* msg,
@@ -10,30 +10,27 @@
10
10
  #include <stddef.h>
11
11
  #include <stdint.h>
12
12
 
13
- #include "upb/message/internal/extension.h"
14
13
  #include "upb/message/message.h"
14
+ #include "upb/message/value.h"
15
15
  #include "upb/mini_table/extension.h"
16
16
 
17
17
  // Must be last.
18
18
  #include "upb/port/def.inc"
19
19
 
20
- const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
21
- const upb_Message* msg, size_t index) {
22
- size_t count;
23
- const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
24
-
25
- UPB_ASSERT(index < count);
26
- return ext[index].ext;
20
+ bool upb_Message_NextExtensionReverse(const upb_Message* msg,
21
+ const upb_MiniTableExtension** result,
22
+ uintptr_t* iter) {
23
+ upb_MessageValue val;
24
+ return UPB_PRIVATE(_upb_Message_NextExtensionReverse)(msg, result, &val,
25
+ iter);
27
26
  }
28
27
 
29
28
  const upb_MiniTableExtension* upb_Message_FindExtensionByNumber(
30
29
  const upb_Message* msg, uint32_t field_number) {
31
- size_t count;
32
- const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
33
-
34
- for (; count--; ext++) {
35
- const upb_MiniTableExtension* e = ext->ext;
36
- if (upb_MiniTableExtension_Number(e) == field_number) return e;
30
+ uintptr_t iter = kUpb_Message_ExtensionBegin;
31
+ const upb_MiniTableExtension* result;
32
+ while (upb_Message_NextExtensionReverse(msg, &result, &iter)) {
33
+ if (upb_MiniTableExtension_Number(result) == field_number) return result;
37
34
  }
38
35
  return NULL;
39
36
  }
@@ -25,9 +25,10 @@
25
25
  extern "C" {
26
26
  #endif
27
27
 
28
- const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
29
- const upb_Message* msg, size_t index);
30
-
28
+ // Same as upb_Message_NextExtension but iterates in reverse wire order
29
+ bool upb_Message_NextExtensionReverse(const upb_Message* msg,
30
+ const upb_MiniTableExtension** result,
31
+ uintptr_t* iter);
31
32
  // Returns the minitable with the given field number, or NULL on failure.
32
33
  const upb_MiniTableExtension* upb_Message_FindExtensionByNumber(
33
34
  const upb_Message* msg, uint32_t field_number);
@@ -8,6 +8,7 @@
8
8
  #include "upb/message/copy.h"
9
9
 
10
10
  #include <stdbool.h>
11
+ #include <stdint.h>
11
12
  #include <string.h>
12
13
 
13
14
  #include "upb/base/descriptor_constants.h"
@@ -19,6 +20,7 @@
19
20
  #include "upb/message/internal/array.h"
20
21
  #include "upb/message/internal/extension.h"
21
22
  #include "upb/message/internal/map.h"
23
+ #include "upb/message/internal/message.h"
22
24
  #include "upb/message/map.h"
23
25
  #include "upb/message/message.h"
24
26
  #include "upb/message/tagged_ptr.h"
@@ -150,7 +152,7 @@ upb_Array* upb_Array_DeepClone(const upb_Array* array, upb_CType value_type,
150
152
  for (size_t i = 0; i < size; ++i) {
151
153
  upb_MessageValue val = upb_Array_Get(array, i);
152
154
  if (!upb_Clone_MessageValue(&val, value_type, sub, arena)) {
153
- return false;
155
+ return NULL;
154
156
  }
155
157
  upb_Array_Set(cloned_array, i, val);
156
158
  }
@@ -254,41 +256,44 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
254
256
  }
255
257
  }
256
258
  // Clone extensions.
257
- size_t ext_count;
258
- const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(src, &ext_count);
259
- for (size_t i = 0; i < ext_count; ++i) {
260
- const upb_Extension* msg_ext = &ext[i];
261
- const upb_MiniTableField* field = &msg_ext->ext->UPB_PRIVATE(field);
262
- upb_Extension* dst_ext = UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
263
- dst, msg_ext->ext, arena);
264
- if (!dst_ext) return NULL;
265
- if (upb_MiniTableField_IsScalar(field)) {
266
- if (!upb_Clone_ExtensionValue(msg_ext->ext, msg_ext, dst_ext, arena)) {
267
- return NULL;
259
+ upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(src);
260
+ if (!in) return dst;
261
+
262
+ for (size_t i = 0; i < in->size; i++) {
263
+ upb_TaggedAuxPtr tagged_ptr = in->aux_data[i];
264
+ if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) {
265
+ // Clone extension
266
+ const upb_Extension* msg_ext = upb_TaggedAuxPtr_Extension(tagged_ptr);
267
+ const upb_MiniTableField* field = &msg_ext->ext->UPB_PRIVATE(field);
268
+ upb_Extension* dst_ext = UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
269
+ dst, msg_ext->ext, arena);
270
+ if (!dst_ext) return NULL;
271
+ if (upb_MiniTableField_IsScalar(field)) {
272
+ if (!upb_Clone_ExtensionValue(msg_ext->ext, msg_ext, dst_ext, arena)) {
273
+ return NULL;
274
+ }
275
+ } else {
276
+ upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val;
277
+ UPB_ASSERT(msg_array);
278
+ upb_Array* cloned_array = upb_Array_DeepClone(
279
+ msg_array, upb_MiniTableField_CType(field),
280
+ upb_MiniTableExtension_GetSubMessage(msg_ext->ext), arena);
281
+ if (!cloned_array) {
282
+ return NULL;
283
+ }
284
+ dst_ext->data.array_val = cloned_array;
268
285
  }
269
- } else {
270
- upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val;
271
- UPB_ASSERT(msg_array);
272
- upb_Array* cloned_array = upb_Array_DeepClone(
273
- msg_array, upb_MiniTableField_CType(field),
274
- upb_MiniTableExtension_GetSubMessage(msg_ext->ext), arena);
275
- if (!cloned_array) {
286
+ } else if (upb_TaggedAuxPtr_IsUnknown(tagged_ptr)) {
287
+ // Clone unknown
288
+ upb_StringView* unknown = upb_TaggedAuxPtr_UnknownData(tagged_ptr);
289
+ // Make a copy into destination arena.
290
+ if (!UPB_PRIVATE(_upb_Message_AddUnknown)(dst, unknown->data,
291
+ unknown->size, arena, false)) {
276
292
  return NULL;
277
293
  }
278
- dst_ext->data.array_val = cloned_array;
279
294
  }
280
295
  }
281
296
 
282
- // Clone unknowns.
283
- size_t unknown_size = 0;
284
- const char* ptr = upb_Message_GetUnknown(src, &unknown_size);
285
- if (unknown_size != 0) {
286
- UPB_ASSERT(ptr);
287
- // Make a copy into destination arena.
288
- if (!UPB_PRIVATE(_upb_Message_AddUnknown)(dst, ptr, unknown_size, arena)) {
289
- return NULL;
290
- }
291
- }
292
297
  return dst;
293
298
  }
294
299
 
@@ -163,7 +163,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_Message_SetPresence)(
163
163
  }
164
164
  }
165
165
 
166
- UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)(
166
+ UPB_INLINE_IF_NOT_GCC void UPB_PRIVATE(_upb_MiniTableField_DataCopy)(
167
167
  const upb_MiniTableField* f, void* to, const void* from) {
168
168
  switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) {
169
169
  case kUpb_FieldRep_1Byte:
@@ -183,7 +183,7 @@ UPB_INLINE void UPB_PRIVATE(_upb_MiniTableField_DataCopy)(
183
183
  UPB_UNREACHABLE();
184
184
  }
185
185
 
186
- UPB_INLINE bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)(
186
+ UPB_INLINE_IF_NOT_GCC bool UPB_PRIVATE(_upb_MiniTableField_DataEquals)(
187
187
  const upb_MiniTableField* f, const void* a, const void* b) {
188
188
  switch (UPB_PRIVATE(_upb_MiniTableField_GetRep)(f)) {
189
189
  case kUpb_FieldRep_1Byte:
@@ -856,9 +856,7 @@ UPB_API_INLINE void upb_Message_Clear(struct upb_Message* msg,
856
856
  memset(msg, 0, m->UPB_PRIVATE(size));
857
857
  if (in) {
858
858
  // Reset the internal buffer to empty.
859
- in->unknown_end = sizeof(upb_Message_Internal);
860
- in->ext_begin = in->size;
861
- UPB_PRIVATE(_upb_Message_SetInternal)(msg, in);
859
+ in->size = 0;
862
860
  }
863
861
  }
864
862
 
@@ -882,11 +880,15 @@ UPB_API_INLINE void upb_Message_ClearExtension(
882
880
  UPB_ASSERT(!upb_Message_IsFrozen(msg));
883
881
  upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
884
882
  if (!in) return;
885
- const upb_Extension* base = UPB_PTR_AT(in, in->ext_begin, upb_Extension);
886
- upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
887
- if (ext) {
888
- *ext = *base;
889
- in->ext_begin += sizeof(upb_Extension);
883
+ for (size_t i = 0; i < in->size; i++) {
884
+ upb_TaggedAuxPtr tagged_ptr = in->aux_data[i];
885
+ if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) {
886
+ const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr);
887
+ if (ext->ext == e) {
888
+ in->aux_data[i] = upb_TaggedAuxPtr_Null();
889
+ return;
890
+ }
891
+ }
890
892
  }
891
893
  }
892
894
 
@@ -916,6 +918,133 @@ UPB_API_INLINE void* upb_Message_ResizeArrayUninitialized(
916
918
  return upb_Array_MutableDataPtr(arr);
917
919
  }
918
920
 
921
+ UPB_API_INLINE bool upb_Message_GetExtensionBool(
922
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
923
+ bool default_val) {
924
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Bool);
925
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
926
+ kUpb_FieldRep_1Byte);
927
+ bool ret;
928
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
929
+ return ret;
930
+ }
931
+
932
+ UPB_API_INLINE double upb_Message_GetExtensionDouble(
933
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
934
+ double default_val) {
935
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Double);
936
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
937
+ kUpb_FieldRep_8Byte);
938
+ double ret;
939
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
940
+ return ret;
941
+ }
942
+
943
+ UPB_API_INLINE float upb_Message_GetExtensionFloat(
944
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
945
+ float default_val) {
946
+ float ret;
947
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Float);
948
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
949
+ kUpb_FieldRep_4Byte);
950
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
951
+ return ret;
952
+ }
953
+
954
+ UPB_API_INLINE int32_t upb_Message_GetExtensionInt32(
955
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
956
+ int32_t default_val) {
957
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Int32 ||
958
+ upb_MiniTableExtension_CType(e) == kUpb_CType_Enum);
959
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
960
+ kUpb_FieldRep_4Byte);
961
+ int32_t ret;
962
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
963
+ return ret;
964
+ }
965
+
966
+ UPB_API_INLINE int64_t upb_Message_GetExtensionInt64(
967
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
968
+ int64_t default_val) {
969
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Int64);
970
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
971
+ kUpb_FieldRep_8Byte);
972
+ int64_t ret;
973
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
974
+ return ret;
975
+ }
976
+
977
+ UPB_API_INLINE uint32_t upb_Message_GetExtensionUInt32(
978
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
979
+ uint32_t default_val) {
980
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_UInt32);
981
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
982
+ kUpb_FieldRep_4Byte);
983
+ uint32_t ret;
984
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
985
+ return ret;
986
+ }
987
+
988
+ UPB_API_INLINE uint64_t upb_Message_GetExtensionUInt64(
989
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
990
+ uint64_t default_val) {
991
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_UInt64);
992
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
993
+ kUpb_FieldRep_8Byte);
994
+ uint64_t ret;
995
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
996
+ return ret;
997
+ }
998
+
999
+ UPB_API_INLINE upb_StringView upb_Message_GetExtensionString(
1000
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
1001
+ upb_StringView default_val) {
1002
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_String ||
1003
+ upb_MiniTableExtension_CType(e) == kUpb_CType_Bytes);
1004
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
1005
+ kUpb_FieldRep_StringView);
1006
+ upb_StringView ret;
1007
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
1008
+ return ret;
1009
+ }
1010
+
1011
+ UPB_API_INLINE struct upb_Message* upb_Message_GetExtensionMessage(
1012
+ const struct upb_Message* msg, const upb_MiniTableExtension* e,
1013
+ struct upb_Message* default_val) {
1014
+ UPB_ASSUME(upb_MiniTableExtension_CType(e) == kUpb_CType_Message);
1015
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableExtension_GetRep)(e) ==
1016
+ UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte));
1017
+ struct upb_Message* ret;
1018
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
1019
+ return ret;
1020
+ }
1021
+
1022
+ // Repeated
1023
+ UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray(
1024
+ const struct upb_Message* msg, const upb_MiniTableExtension* e) {
1025
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) ==
1026
+ kUpb_FieldRep_NativePointer);
1027
+ UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field)));
1028
+ UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0);
1029
+ upb_Array* ret;
1030
+ const upb_Array* default_val = NULL;
1031
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
1032
+ return ret;
1033
+ }
1034
+
1035
+ UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray(
1036
+ struct upb_Message* msg, const upb_MiniTableExtension* e) {
1037
+ UPB_ASSERT(!upb_Message_IsFrozen(msg));
1038
+ UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) ==
1039
+ kUpb_FieldRep_NativePointer);
1040
+ UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field)));
1041
+ UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0);
1042
+ upb_Array* ret;
1043
+ upb_Array* default_val = NULL;
1044
+ _upb_Message_GetExtensionField(msg, e, &default_val, &ret);
1045
+ return ret;
1046
+ }
1047
+
919
1048
  #ifdef __cplusplus
920
1049
  } /* extern "C" */
921
1050
  #endif
@@ -7,6 +7,7 @@
7
7
 
8
8
  #include "upb/message/internal/extension.h"
9
9
 
10
+ #include <stdint.h>
10
11
  #include <string.h>
11
12
 
12
13
  #include "upb/mem/arena.h"
@@ -20,44 +21,46 @@
20
21
 
21
22
  const upb_Extension* UPB_PRIVATE(_upb_Message_Getext)(
22
23
  const struct upb_Message* msg, const upb_MiniTableExtension* e) {
23
- size_t n;
24
- const upb_Extension* ext = UPB_PRIVATE(_upb_Message_Getexts)(msg, &n);
25
-
26
- // For now we use linear search exclusively to find extensions.
27
- // If this becomes an issue due to messages with lots of extensions,
28
- // we can introduce a table of some sort.
29
- for (size_t i = 0; i < n; i++) {
30
- if (ext[i].ext == e) {
31
- return &ext[i];
24
+ upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
25
+ if (!in) return NULL;
26
+
27
+ for (size_t i = 0; i < in->size; i++) {
28
+ upb_TaggedAuxPtr tagged_ptr = in->aux_data[i];
29
+ if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) {
30
+ const upb_Extension* ext = upb_TaggedAuxPtr_Extension(tagged_ptr);
31
+ if (ext->ext == e) {
32
+ return ext;
33
+ }
32
34
  }
33
35
  }
34
36
 
35
37
  return NULL;
36
38
  }
37
39
 
38
- const upb_Extension* UPB_PRIVATE(_upb_Message_Getexts)(
39
- const struct upb_Message* msg, size_t* count) {
40
- upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
41
- if (in) {
42
- *count = (in->size - in->ext_begin) / sizeof(upb_Extension);
43
- return UPB_PTR_AT(in, in->ext_begin, void);
44
- } else {
45
- *count = 0;
46
- return NULL;
47
- }
48
- }
49
-
50
40
  upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
51
41
  struct upb_Message* msg, const upb_MiniTableExtension* e, upb_Arena* a) {
52
42
  UPB_ASSERT(!upb_Message_IsFrozen(msg));
53
43
  upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
54
44
  if (ext) return ext;
55
- if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, sizeof(upb_Extension), a))
56
- return NULL;
45
+
46
+ if (!UPB_PRIVATE(_upb_Message_ReserveSlot)(msg, a)) return NULL;
57
47
  upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
58
- in->ext_begin -= sizeof(upb_Extension);
59
- ext = UPB_PTR_AT(in, in->ext_begin, void);
48
+ ext = upb_Arena_Malloc(a, sizeof(upb_Extension));
49
+ if (!ext) return NULL;
60
50
  memset(ext, 0, sizeof(upb_Extension));
61
51
  ext->ext = e;
52
+ in->aux_data[in->size++] = upb_TaggedAuxPtr_MakeExtension(ext);
62
53
  return ext;
63
54
  }
55
+
56
+ void upb_Message_ReplaceUnknownWithExtension(struct upb_Message* msg,
57
+ uintptr_t iter,
58
+ const upb_Extension* ext) {
59
+ UPB_ASSERT(iter != 0);
60
+ upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
61
+ UPB_ASSERT(in);
62
+ size_t index = iter - 1;
63
+ upb_TaggedAuxPtr tagged_ptr = in->aux_data[index];
64
+ UPB_ASSERT(upb_TaggedAuxPtr_IsUnknown(tagged_ptr));
65
+ in->aux_data[index] = upb_TaggedAuxPtr_MakeExtension(ext);
66
+ }