grpc 1.27.0 → 1.28.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +707 -629
- data/include/grpc/impl/codegen/grpc_types.h +5 -0
- data/include/grpc/impl/codegen/port_platform.h +7 -0
- data/include/grpc/impl/codegen/sync.h +5 -3
- data/include/grpc/impl/codegen/sync_abseil.h +36 -0
- data/include/grpc/module.modulemap +3 -0
- data/include/grpc/support/sync_abseil.h +26 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +47 -29
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +31 -47
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +1 -3
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/http_proxy.cc +4 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +21 -28
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +18 -21
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +9 -13
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +46 -72
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +413 -422
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +3 -3
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +43 -75
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +57 -70
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +3 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +4 -2
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +228 -286
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +2 -2
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +13 -14
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +5 -7
- data/src/core/ext/filters/client_channel/service_config.cc +91 -160
- data/src/core/ext/filters/client_channel/service_config.h +14 -21
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +581 -251
- data/src/core/ext/filters/client_channel/xds/xds_api.h +189 -151
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +133 -350
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +18 -39
- data/src/core/ext/filters/client_channel/xds/xds_channel.h +3 -1
- data/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +12 -9
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +559 -242
- data/src/core/ext/filters/client_channel/xds/xds_client.h +54 -34
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +53 -128
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +105 -132
- data/src/core/ext/filters/message_size/message_size_filter.cc +32 -35
- data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +3 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/writing.cc +1 -1
- data/src/core/ext/transport/inproc/inproc_transport.cc +22 -42
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.c +17 -0
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +30 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +27 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +54 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +46 -21
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +116 -29
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +4 -362
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +14 -1337
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +390 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +1411 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +29 -8
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +60 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +5 -3
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +6 -2
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +48 -5
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +154 -4
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +19 -15
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +46 -32
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +26 -4
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +70 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +42 -25
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +83 -25
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +43 -7
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +115 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +7 -68
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +14 -201
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +240 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +1 -71
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +3 -228
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +258 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.c +30 -0
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.c +104 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +383 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.c +17 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +33 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +144 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +527 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.c +42 -0
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +112 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.c +29 -0
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.c +62 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +199 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.c +17 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +33 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +793 -0
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +2936 -0
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.c +58 -0
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +134 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.c +27 -0
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +53 -0
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +227 -0
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +725 -0
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.c +296 -0
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +1072 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.c +32 -0
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +108 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.c +52 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +133 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.c +87 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +258 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +11 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +27 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.c +28 -0
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +62 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +249 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +30 -27
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +64 -52
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +48 -0
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +104 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.c +17 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +30 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +38 -34
- data/src/core/ext/upb-generated/validate/validate.upb.h +129 -99
- data/src/core/lib/channel/channel_trace.cc +32 -41
- data/src/core/lib/channel/channel_trace.h +3 -3
- data/src/core/lib/channel/channelz.cc +158 -248
- data/src/core/lib/channel/channelz.h +12 -15
- data/src/core/lib/channel/channelz_registry.cc +47 -74
- data/src/core/lib/channel/channelz_registry.h +4 -4
- data/src/core/lib/gpr/sync_abseil.cc +114 -0
- data/src/core/lib/gpr/sync_posix.cc +8 -5
- data/src/core/lib/gpr/sync_windows.cc +4 -2
- data/src/core/lib/gprpp/host_port.cc +1 -1
- data/src/core/lib/gprpp/inlined_vector.h +1 -210
- data/src/core/lib/gprpp/memory.h +2 -6
- data/src/core/lib/gprpp/optional.h +0 -41
- data/src/core/lib/gprpp/string_view.h +5 -114
- data/src/core/lib/iomgr/buffer_list.cc +36 -35
- data/src/core/lib/iomgr/error.h +4 -4
- data/src/core/lib/iomgr/ev_epollex_linux.cc +12 -4
- data/src/core/lib/iomgr/load_file.cc +1 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +17 -17
- data/src/core/lib/iomgr/tcp_client_posix.h +6 -6
- data/src/core/lib/iomgr/tcp_posix.cc +2 -1
- data/src/core/lib/iomgr/work_serializer.cc +155 -0
- data/src/core/lib/iomgr/work_serializer.h +65 -0
- data/src/core/lib/json/json.h +209 -79
- data/src/core/lib/json/json_reader.cc +469 -455
- data/src/core/lib/json/json_writer.cc +173 -169
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +10 -8
- data/src/core/lib/security/credentials/jwt/json_token.cc +26 -56
- data/src/core/lib/security/credentials/jwt/json_token.h +2 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +8 -18
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +149 -159
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +37 -34
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +2 -1
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +5 -7
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +3 -15
- data/src/core/lib/security/security_connector/ssl_utils.cc +3 -1
- data/src/core/lib/security/security_connector/ssl_utils.h +0 -1
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +24 -1
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +5 -1
- data/src/core/lib/security/transport/security_handshaker.cc +2 -2
- data/src/core/lib/security/util/json_util.cc +22 -15
- data/src/core/lib/security/util/json_util.h +2 -2
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +1 -1
- data/src/core/tsi/grpc_shadow_boringssl.h +1333 -1319
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +2 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/abseil-cpp/absl/base/attributes.h +1 -1
- data/third_party/abseil-cpp/absl/base/config.h +10 -4
- data/third_party/abseil-cpp/absl/base/internal/atomic_hook.h +30 -9
- data/third_party/abseil-cpp/absl/base/internal/errno_saver.h +43 -0
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +7 -5
- data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +2 -1
- data/third_party/abseil-cpp/absl/base/internal/spinlock.cc +2 -2
- data/third_party/abseil-cpp/absl/base/internal/spinlock_linux.inc +2 -3
- data/third_party/abseil-cpp/absl/base/internal/spinlock_posix.inc +3 -3
- data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +37 -0
- data/third_party/abseil-cpp/absl/base/options.h +2 -10
- data/third_party/abseil-cpp/absl/strings/charconv.cc +0 -1
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +388 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +432 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +245 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +209 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/checker.h +326 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +51 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +415 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +493 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.h +23 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.cc +72 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/output.h +104 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.cc +334 -0
- data/third_party/abseil-cpp/absl/strings/internal/str_format/parser.h +333 -0
- data/third_party/abseil-cpp/absl/strings/str_format.h +537 -0
- data/third_party/abseil-cpp/absl/strings/string_view.h +19 -11
- data/{src/boringssl → third_party/boringssl-with-bazel}/err_data.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bitstr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_bool.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_d2i_fp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_dup.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_enum.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_gentm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_i2d_fp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_int.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_mbstr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_object.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_octet.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_print.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_strnid.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_time.c +3 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_type.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utctm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/a_utf8.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_lib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_locl.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn1_par.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/asn_pack.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_enum.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_int.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/f_string.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_dec.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_enc.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_fre.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_new.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_typ.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/tasn_utl.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/asn1/time_support.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/base64/base64.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/bio_mem.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/connect.c +3 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/fd.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/file.c +5 -6
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/hexdump.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/pair.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/printf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/socket.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bio/socket_helper.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/bn_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bn_extra/convert.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/buf/buf.c +10 -69
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/asn1_compat.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/ber.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/cbb.c +41 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/cbs.c +60 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/bytestring/unicode.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/chacha/chacha.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/chacha/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/cipher_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/derive_key.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesccm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesctrhmac.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_aesgcmsiv.c +8 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_chacha20poly1305.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_null.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc2.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_rc4.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/e_tls.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cipher_extra/tls_cbc.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cmac/cmac.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/conf_def.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/conf/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-fuchsia.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-aarch64-linux.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm-linux.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm-linux.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-arm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-intel.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/cpu-ppc64le.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/crypto.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/curve25519/spake25519.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/check.c +3 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh.c +1 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/dh_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dh/params.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/digest_extra/digest_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/dsa/dsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ec_extra/ec_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ec_extra/ec_derive.c +2 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ecdh_extra/ecdh_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ecdsa_extra/ecdsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/engine/engine.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/err/err.c +6 -6
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/err/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/digestsign.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/evp_ctx.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_dsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ec.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ec_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ed25519.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_ed25519_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_rsa.c +14 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_rsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_x25519.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/p_x25519_asn1.c +1 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/pbkdf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/print.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/scrypt.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/evp/sign.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/ex_data.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes.c +108 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/aes_nohw.c +1282 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/internal.h +5 -7
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/key_wrap.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/aes/mode_wrappers.c +0 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bcm.c +2 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/add.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/asm/x86_64-gcc.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bn.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/bytes.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/cmp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/ctx.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/div.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/div_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/exponentiation.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/gcd.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/gcd_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/generic.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/jacobi.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/montgomery.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/montgomery_inv.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/mul.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/prime.c +11 -12
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/random.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/rsaz_exp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/rsaz_exp.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/shift.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/bn/sqrt.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/aead.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/cipher.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/e_aes.c +3 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/e_des.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/cipher/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/delocate.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/des.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/des/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/digest.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/digests.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/digest/md32_common.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec_key.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/ec_montgomery.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/felem.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/oct.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p224-64.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64-table.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/p256-x86_64.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/scalar.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/simple.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/simple_mul.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/util.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ec/wnaf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ecdh/ecdh.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/ecdsa/ecdsa.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/fips_shared_support.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/hmac/hmac.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/is_fips.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md4/md4.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md5/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/md5/md5.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/cbc.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/cfb.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/ctr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/gcm.c +45 -193
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +304 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/internal.h +8 -18
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/ofb.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/modes/polyval.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/ctrdrbg.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/rand.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rand/urandom.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/blinding.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/padding.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/rsa.c +7 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/rsa/rsa_impl.c +60 -51
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/self_check/self_check.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1-altivec.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha256.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/sha/sha512.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/fipsmodule/tls/kdf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hkdf/hkdf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hrss/hrss.c +210 -311
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/hrss/internal.h +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/internal.h +21 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/lhash/lhash.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/mem.c +70 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj.c +16 -21
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_dat.h +27 -6
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/obj/obj_xref.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_all.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_info.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_lib.c +7 -7
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_oth.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_pk8.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_pkey.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pem/pem_xaux.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/pkcs7.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs7/pkcs7_x509.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/p5_pbev2.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/pkcs8.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pkcs8/pkcs8_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305.c +2 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305_arm.c +21 -20
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/poly1305/poly1305_vec.c +34 -17
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pool/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/pool/pool.c +1 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/deterministic.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/forkunsafe.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/fuchsia.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/rand_extra.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rand_extra/windows.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rc4/rc4.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_c11.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/refcount_lock.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_asn1.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/rsa_extra/rsa_print.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/siphash/siphash.c +3 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/stack/stack.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_none.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_pthread.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/thread_win.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_digest.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_sign.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_strex.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/a_verify.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/algorithm.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/asn1_gen.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/by_dir.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/by_file.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/charmap.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/i2d_pr.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/rsa_pss.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_crl.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_req.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/t_x509a.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/vpm_int.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_att.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_cmp.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_d2.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_def.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_ext.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_lu.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_obj.c +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_r2x.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_req.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_set.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_trs.c +1 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_txt.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_v3.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_vfy.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509_vpm.c +3 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509cset.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509name.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509rset.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x509spki.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_algor.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_all.c +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_attrib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_crl.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_exten.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_info.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_name.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pkey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_pubkey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_req.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_sig.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_spki.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_val.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509/x_x509a.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/ext_dat.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_cache.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_data.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_int.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_lib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_map.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_node.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/pcy_tree.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_akeya.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_alt.c +3 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bcons.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_bitst.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_conf.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_cpols.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_crld.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_enum.c +2 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_extku.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_genn.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ia5.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_info.c +4 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_int.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_lib.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ncons.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_ocsp.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pci.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcia.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pcons.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pku.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_pmaps.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_prn.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_purp.c +2 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_skey.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_sxnet.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/crypto/x509v3/v3_utl.c +11 -12
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/aead.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/aes.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/arm_arch.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1_mac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/asn1t.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/base.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/base64.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bio.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/blowfish.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bn.h +32 -20
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buf.h +9 -9
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/buffer.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/bytestring.h +34 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cast.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/chacha.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cipher.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cmac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/conf.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/cpu.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/crypto.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/curve25519.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/des.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dh.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/digest.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dsa.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/dtls1.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/e_os2.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ec.h +11 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ec_key.h +4 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ecdh.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ecdsa.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/engine.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/err.h +11 -9
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/evp.h +20 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ex_data.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hkdf.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hmac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/hrss.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/is_boringssl.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/lhash.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/md4.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/md5.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/mem.h +17 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/nid.h +9 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/obj_mac.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/objects.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslconf.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/opensslv.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ossl_typ.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pem.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs12.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs7.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pkcs8.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/poly1305.h +5 -7
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/pool.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rand.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rc4.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ripemd.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/rsa.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/safestack.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/sha.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/siphash.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/span.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/srtp.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ssl.h +10 -20
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/ssl3.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/stack.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/thread.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/tls1.h +0 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/type_check.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509_vfy.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/include/openssl/x509v3.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/bio_ssl.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_both.cc +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_lib.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_pkt.cc +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/d1_srtp.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/dtls_method.cc +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/dtls_record.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handoff.cc +126 -29
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake.cc +5 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake_client.cc +24 -13
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/handshake_server.cc +1 -5
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/internal.h +32 -26
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_both.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_lib.cc +2 -3
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/s3_pkt.cc +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_aead_ctx.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_asn1.cc +1 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_buffer.cc +34 -15
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_cert.cc +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_cipher.cc +0 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_file.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_key_share.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_lib.cc +13 -14
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_privkey.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_session.cc +2 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_stat.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_transcript.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_versions.cc +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/ssl_x509.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/t1_enc.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/t1_lib.cc +11 -171
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_both.cc +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_client.cc +3 -4
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_enc.cc +5 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls13_server.cc +78 -101
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls_method.cc +1 -1
- data/third_party/{boringssl → boringssl-with-bazel/src}/ssl/tls_record.cc +7 -2
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_32.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_64.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/curve25519_tables.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/internal.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/p256.c +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/p256_32.h +0 -0
- data/third_party/{boringssl → boringssl-with-bazel/src}/third_party/fiat/p256_64.h +0 -0
- metadata +562 -491
- data/src/core/lib/iomgr/logical_thread.cc +0 -103
- data/src/core/lib/iomgr/logical_thread.h +0 -52
- data/src/core/lib/json/json.cc +0 -94
- data/third_party/boringssl/crypto/fipsmodule/aes/aes.c +0 -860
@@ -0,0 +1,65 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2019 gRPC authors.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include <grpc/support/port_platform.h>
|
20
|
+
|
21
|
+
#include <functional>
|
22
|
+
|
23
|
+
#include "src/core/lib/debug/trace.h"
|
24
|
+
#include "src/core/lib/gprpp/atomic.h"
|
25
|
+
#include "src/core/lib/gprpp/debug_location.h"
|
26
|
+
#include "src/core/lib/gprpp/mpscq.h"
|
27
|
+
#include "src/core/lib/gprpp/orphanable.h"
|
28
|
+
#include "src/core/lib/gprpp/ref_counted.h"
|
29
|
+
#include "src/core/lib/iomgr/exec_ctx.h"
|
30
|
+
|
31
|
+
#ifndef GRPC_CORE_LIB_IOMGR_WORK_SERIALIZER_H
|
32
|
+
#define GRPC_CORE_LIB_IOMGR_WORK_SERIALIZER_H
|
33
|
+
|
34
|
+
namespace grpc_core {
|
35
|
+
|
36
|
+
// WorkSerializer is a mechanism to schedule callbacks in a synchronized manner.
|
37
|
+
// All callbacks scheduled on a WorkSerializer instance will be executed
|
38
|
+
// serially in a borrowed thread. The API provides a FIFO guarantee to the
|
39
|
+
// execution of callbacks scheduled on the thread.
|
40
|
+
// When a thread calls Run() with a callback, the thread is considered borrowed.
|
41
|
+
// The callback might run inline, or it might run asynchronously in a different
|
42
|
+
// thread that is already inside of Run(). If the callback runs directly inline,
|
43
|
+
// other callbacks from other threads might also be executed before Run()
|
44
|
+
// returns. Since an arbitrary set of callbacks might be executed when Run() is
|
45
|
+
// called, generally no locks should be held while calling Run().
|
46
|
+
class WorkSerializer {
|
47
|
+
public:
|
48
|
+
WorkSerializer();
|
49
|
+
|
50
|
+
~WorkSerializer();
|
51
|
+
|
52
|
+
// TODO(yashkt): Replace grpc_core::DebugLocation with absl::SourceLocation
|
53
|
+
// once we can start using it directly.
|
54
|
+
void Run(std::function<void()> callback,
|
55
|
+
const grpc_core::DebugLocation& location);
|
56
|
+
|
57
|
+
private:
|
58
|
+
class WorkSerializerImpl;
|
59
|
+
|
60
|
+
OrphanablePtr<WorkSerializerImpl> impl_;
|
61
|
+
};
|
62
|
+
|
63
|
+
} /* namespace grpc_core */
|
64
|
+
|
65
|
+
#endif /* GRPC_CORE_LIB_IOMGR_WORK_SERIALIZER_H */
|
data/src/core/lib/json/json.h
CHANGED
@@ -21,89 +21,219 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
-
#include <stdbool.h>
|
25
24
|
#include <stdlib.h>
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
GRPC_JSON_ARRAY,
|
31
|
-
GRPC_JSON_STRING,
|
32
|
-
GRPC_JSON_NUMBER,
|
33
|
-
GRPC_JSON_TRUE,
|
34
|
-
GRPC_JSON_FALSE,
|
35
|
-
GRPC_JSON_NULL,
|
36
|
-
GRPC_JSON_TOP_LEVEL
|
37
|
-
} grpc_json_type;
|
38
|
-
|
39
|
-
/* A tree-like structure to hold json values. The key and value pointers
|
40
|
-
* are not owned by it.
|
41
|
-
*/
|
42
|
-
typedef struct grpc_json {
|
43
|
-
struct grpc_json* next;
|
44
|
-
struct grpc_json* prev;
|
45
|
-
struct grpc_json* child;
|
46
|
-
struct grpc_json* parent;
|
47
|
-
|
48
|
-
grpc_json_type type;
|
49
|
-
const char* key;
|
50
|
-
const char* value;
|
51
|
-
|
52
|
-
/* if set, destructor will free value */
|
53
|
-
bool owns_value;
|
54
|
-
} grpc_json;
|
55
|
-
|
56
|
-
/* The next two functions are going to parse the input string, and
|
57
|
-
* modify it in the process, in order to use its space to store
|
58
|
-
* all of the keys and values for the returned object tree.
|
59
|
-
*
|
60
|
-
* They assume UTF-8 input stream, and will output UTF-8 encoded
|
61
|
-
* strings in the tree. The input stream's UTF-8 isn't validated,
|
62
|
-
* as in, what you input is what you get as an output.
|
63
|
-
*
|
64
|
-
* All the keys and values in the grpc_json objects will be strings
|
65
|
-
* pointing at your input buffer.
|
66
|
-
*
|
67
|
-
* Delete the allocated tree afterward using grpc_json_destroy().
|
68
|
-
*/
|
69
|
-
grpc_json* grpc_json_parse_string_with_len(char* input, size_t size);
|
70
|
-
grpc_json* grpc_json_parse_string(char* input);
|
26
|
+
#include <map>
|
27
|
+
#include <string>
|
28
|
+
#include <vector>
|
71
29
|
|
72
|
-
|
73
|
-
|
74
|
-
* but will be allocated in chunks of 256 bytes.
|
75
|
-
*
|
76
|
-
* The indent parameter controls the way the output is formatted.
|
77
|
-
* If indent is 0, then newlines will be suppressed as well, and the
|
78
|
-
* output will be condensed at its maximum.
|
79
|
-
*/
|
80
|
-
char* grpc_json_dump_to_string(const grpc_json* json, int indent);
|
30
|
+
#include "src/core/lib/gprpp/string_view.h"
|
31
|
+
#include "src/core/lib/iomgr/error.h"
|
81
32
|
|
82
|
-
|
83
|
-
* Deletion is recursive. We will not attempt to free any of the strings
|
84
|
-
* in any of the objects of that tree, unless the boolean, owns_value,
|
85
|
-
* is true.
|
86
|
-
*/
|
87
|
-
grpc_json* grpc_json_create(grpc_json_type type);
|
88
|
-
void grpc_json_destroy(grpc_json* json);
|
33
|
+
namespace grpc_core {
|
89
34
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
35
|
+
// A JSON value, which can be any one of object, array, string,
|
36
|
+
// number, true, false, or null.
|
37
|
+
class Json {
|
38
|
+
public:
|
39
|
+
// TODO(roth): Currently, numbers are stored internally as strings,
|
40
|
+
// which makes the API a bit cumbersome to use. When we have time,
|
41
|
+
// consider whether there's a better alternative (e.g., maybe storing
|
42
|
+
// each numeric type as the native C++ type and automatically converting
|
43
|
+
// to string as needed).
|
44
|
+
enum class Type {
|
45
|
+
JSON_NULL,
|
46
|
+
JSON_TRUE,
|
47
|
+
JSON_FALSE,
|
48
|
+
NUMBER,
|
49
|
+
STRING,
|
50
|
+
OBJECT,
|
51
|
+
ARRAY
|
52
|
+
};
|
53
|
+
|
54
|
+
using Object = std::map<std::string, Json>;
|
55
|
+
using Array = std::vector<Json>;
|
56
|
+
|
57
|
+
// Parses JSON string from json_str. On error, sets *error.
|
58
|
+
static Json Parse(StringView json_str, grpc_error** error);
|
59
|
+
|
60
|
+
Json() = default;
|
61
|
+
|
62
|
+
// Copyable.
|
63
|
+
Json(const Json& other) { CopyFrom(other); }
|
64
|
+
Json& operator=(const Json& other) {
|
65
|
+
CopyFrom(other);
|
66
|
+
return *this;
|
67
|
+
}
|
68
|
+
|
69
|
+
// Moveable.
|
70
|
+
Json(Json&& other) { MoveFrom(std::move(other)); }
|
71
|
+
Json& operator=(Json&& other) {
|
72
|
+
MoveFrom(std::move(other));
|
73
|
+
return *this;
|
74
|
+
}
|
75
|
+
|
76
|
+
// Construct from copying a string.
|
77
|
+
// If is_number is true, the type will be NUMBER instead of STRING.
|
78
|
+
Json(const std::string& string, bool is_number = false)
|
79
|
+
: type_(is_number ? Type::NUMBER : Type::STRING), string_value_(string) {}
|
80
|
+
Json& operator=(const std::string& string) {
|
81
|
+
type_ = Type::STRING;
|
82
|
+
string_value_ = string;
|
83
|
+
return *this;
|
84
|
+
}
|
85
|
+
|
86
|
+
// Same thing for C-style strings, both const and mutable.
|
87
|
+
Json(const char* string, bool is_number = false)
|
88
|
+
: Json(std::string(string), is_number) {}
|
89
|
+
Json& operator=(const char* string) {
|
90
|
+
*this = std::string(string);
|
91
|
+
return *this;
|
92
|
+
}
|
93
|
+
Json(char* string, bool is_number = false)
|
94
|
+
: Json(std::string(string), is_number) {}
|
95
|
+
Json& operator=(char* string) {
|
96
|
+
*this = std::string(string);
|
97
|
+
return *this;
|
98
|
+
}
|
99
|
+
|
100
|
+
// Construct by moving a string.
|
101
|
+
Json(std::string&& string)
|
102
|
+
: type_(Type::STRING), string_value_(std::move(string)) {}
|
103
|
+
Json& operator=(std::string&& string) {
|
104
|
+
type_ = Type::STRING;
|
105
|
+
string_value_ = std::move(string);
|
106
|
+
return *this;
|
107
|
+
}
|
108
|
+
|
109
|
+
// Construct from bool.
|
110
|
+
Json(bool b) : type_(b ? Type::JSON_TRUE : Type::JSON_FALSE) {}
|
111
|
+
Json& operator=(bool b) {
|
112
|
+
type_ = b ? Type::JSON_TRUE : Type::JSON_FALSE;
|
113
|
+
return *this;
|
114
|
+
}
|
115
|
+
|
116
|
+
// Construct from any numeric type.
|
117
|
+
template <typename NumericType>
|
118
|
+
Json(NumericType number)
|
119
|
+
: type_(Type::NUMBER), string_value_(std::to_string(number)) {}
|
120
|
+
template <typename NumericType>
|
121
|
+
Json& operator=(NumericType number) {
|
122
|
+
type_ = Type::NUMBER;
|
123
|
+
string_value_ = std::to_string(number);
|
124
|
+
return *this;
|
125
|
+
}
|
126
|
+
|
127
|
+
// Construct by copying object.
|
128
|
+
Json(const Object& object) : type_(Type::OBJECT), object_value_(object) {}
|
129
|
+
Json& operator=(const Object& object) {
|
130
|
+
type_ = Type::OBJECT;
|
131
|
+
object_value_ = object;
|
132
|
+
return *this;
|
133
|
+
}
|
134
|
+
|
135
|
+
// Construct by moving object.
|
136
|
+
Json(Object&& object)
|
137
|
+
: type_(Type::OBJECT), object_value_(std::move(object)) {}
|
138
|
+
Json& operator=(Object&& object) {
|
139
|
+
type_ = Type::OBJECT;
|
140
|
+
object_value_ = std::move(object);
|
141
|
+
return *this;
|
142
|
+
}
|
143
|
+
|
144
|
+
// Construct by copying array.
|
145
|
+
Json(const Array& array) : type_(Type::ARRAY), array_value_(array) {}
|
146
|
+
Json& operator=(const Array& array) {
|
147
|
+
type_ = Type::ARRAY;
|
148
|
+
array_value_ = array;
|
149
|
+
return *this;
|
150
|
+
}
|
151
|
+
|
152
|
+
// Construct by moving array.
|
153
|
+
Json(Array&& array) : type_(Type::ARRAY), array_value_(std::move(array)) {}
|
154
|
+
Json& operator=(Array&& array) {
|
155
|
+
type_ = Type::ARRAY;
|
156
|
+
array_value_ = std::move(array);
|
157
|
+
return *this;
|
158
|
+
}
|
159
|
+
|
160
|
+
// Dumps JSON from value to string form.
|
161
|
+
std::string Dump(int indent = 0) const;
|
162
|
+
|
163
|
+
// Accessor methods.
|
164
|
+
Type type() const { return type_; }
|
165
|
+
const std::string& string_value() const { return string_value_; }
|
166
|
+
std::string* mutable_string_value() { return &string_value_; }
|
167
|
+
const Object& object_value() const { return object_value_; }
|
168
|
+
Object* mutable_object() { return &object_value_; }
|
169
|
+
const Array& array_value() const { return array_value_; }
|
170
|
+
Array* mutable_array() { return &array_value_; }
|
171
|
+
|
172
|
+
bool operator==(const Json& other) const {
|
173
|
+
if (type_ != other.type_) return false;
|
174
|
+
switch (type_) {
|
175
|
+
case Type::NUMBER:
|
176
|
+
case Type::STRING:
|
177
|
+
if (string_value_ != other.string_value_) return false;
|
178
|
+
break;
|
179
|
+
case Type::OBJECT:
|
180
|
+
if (object_value_ != other.object_value_) return false;
|
181
|
+
break;
|
182
|
+
case Type::ARRAY:
|
183
|
+
if (array_value_ != other.array_value_) return false;
|
184
|
+
break;
|
185
|
+
default:
|
186
|
+
break;
|
187
|
+
}
|
188
|
+
return true;
|
189
|
+
}
|
190
|
+
|
191
|
+
bool operator!=(const Json& other) const { return !(*this == other); }
|
192
|
+
|
193
|
+
private:
|
194
|
+
void CopyFrom(const Json& other) {
|
195
|
+
type_ = other.type_;
|
196
|
+
switch (type_) {
|
197
|
+
case Type::NUMBER:
|
198
|
+
case Type::STRING:
|
199
|
+
string_value_ = other.string_value_;
|
200
|
+
break;
|
201
|
+
case Type::OBJECT:
|
202
|
+
object_value_ = other.object_value_;
|
203
|
+
break;
|
204
|
+
case Type::ARRAY:
|
205
|
+
array_value_ = other.array_value_;
|
206
|
+
break;
|
207
|
+
default:
|
208
|
+
break;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
void MoveFrom(Json&& other) {
|
213
|
+
type_ = other.type_;
|
214
|
+
other.type_ = Type::JSON_NULL;
|
215
|
+
switch (type_) {
|
216
|
+
case Type::NUMBER:
|
217
|
+
case Type::STRING:
|
218
|
+
string_value_ = std::move(other.string_value_);
|
219
|
+
break;
|
220
|
+
case Type::OBJECT:
|
221
|
+
object_value_ = std::move(other.object_value_);
|
222
|
+
break;
|
223
|
+
case Type::ARRAY:
|
224
|
+
array_value_ = std::move(other.array_value_);
|
225
|
+
break;
|
226
|
+
default:
|
227
|
+
break;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
|
231
|
+
Type type_ = Type::JSON_NULL;
|
232
|
+
std::string string_value_;
|
233
|
+
Object object_value_;
|
234
|
+
Array array_value_;
|
235
|
+
};
|
236
|
+
|
237
|
+
} // namespace grpc_core
|
108
238
|
|
109
239
|
#endif /* GRPC_CORE_LIB_JSON_JSON_H */
|
@@ -21,246 +21,264 @@
|
|
21
21
|
#include <string.h>
|
22
22
|
|
23
23
|
#include <grpc/support/log.h>
|
24
|
+
#include <grpc/support/string_util.h>
|
24
25
|
|
25
26
|
#include "src/core/lib/json/json.h"
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
28
|
+
#define GRPC_JSON_MAX_DEPTH 255
|
29
|
+
#define GRPC_JSON_MAX_ERRORS 16
|
30
|
+
|
31
|
+
namespace grpc_core {
|
32
|
+
|
33
|
+
namespace {
|
34
|
+
|
35
|
+
class JsonReader {
|
36
|
+
public:
|
37
|
+
static grpc_error* Parse(StringView input, Json* output);
|
38
|
+
|
39
|
+
private:
|
40
|
+
enum class Status {
|
41
|
+
GRPC_JSON_DONE, /* The parser finished successfully. */
|
42
|
+
GRPC_JSON_PARSE_ERROR, /* The parser found an error in the json stream. */
|
43
|
+
GRPC_JSON_INTERNAL_ERROR /* The parser got an internal error. */
|
44
|
+
};
|
45
|
+
|
46
|
+
enum class State {
|
47
|
+
GRPC_JSON_STATE_OBJECT_KEY_BEGIN,
|
48
|
+
GRPC_JSON_STATE_OBJECT_KEY_STRING,
|
49
|
+
GRPC_JSON_STATE_OBJECT_KEY_END,
|
50
|
+
GRPC_JSON_STATE_VALUE_BEGIN,
|
51
|
+
GRPC_JSON_STATE_VALUE_STRING,
|
52
|
+
GRPC_JSON_STATE_STRING_ESCAPE,
|
53
|
+
GRPC_JSON_STATE_STRING_ESCAPE_U1,
|
54
|
+
GRPC_JSON_STATE_STRING_ESCAPE_U2,
|
55
|
+
GRPC_JSON_STATE_STRING_ESCAPE_U3,
|
56
|
+
GRPC_JSON_STATE_STRING_ESCAPE_U4,
|
57
|
+
GRPC_JSON_STATE_VALUE_NUMBER,
|
58
|
+
GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL,
|
59
|
+
GRPC_JSON_STATE_VALUE_NUMBER_ZERO,
|
60
|
+
GRPC_JSON_STATE_VALUE_NUMBER_DOT,
|
61
|
+
GRPC_JSON_STATE_VALUE_NUMBER_E,
|
62
|
+
GRPC_JSON_STATE_VALUE_NUMBER_EPM,
|
63
|
+
GRPC_JSON_STATE_VALUE_TRUE_R,
|
64
|
+
GRPC_JSON_STATE_VALUE_TRUE_U,
|
65
|
+
GRPC_JSON_STATE_VALUE_TRUE_E,
|
66
|
+
GRPC_JSON_STATE_VALUE_FALSE_A,
|
67
|
+
GRPC_JSON_STATE_VALUE_FALSE_L,
|
68
|
+
GRPC_JSON_STATE_VALUE_FALSE_S,
|
69
|
+
GRPC_JSON_STATE_VALUE_FALSE_E,
|
70
|
+
GRPC_JSON_STATE_VALUE_NULL_U,
|
71
|
+
GRPC_JSON_STATE_VALUE_NULL_L1,
|
72
|
+
GRPC_JSON_STATE_VALUE_NULL_L2,
|
73
|
+
GRPC_JSON_STATE_VALUE_END,
|
74
|
+
GRPC_JSON_STATE_END
|
75
|
+
};
|
76
|
+
|
59
77
|
/* The first non-unicode value is 0x110000. But let's pick
|
60
78
|
* a value high enough to start our error codes from. These
|
61
79
|
* values are safe to return from the read_char function.
|
62
80
|
*/
|
63
|
-
GRPC_JSON_READ_CHAR_EOF = 0x7ffffff0
|
64
|
-
|
65
|
-
|
81
|
+
static constexpr uint32_t GRPC_JSON_READ_CHAR_EOF = 0x7ffffff0;
|
82
|
+
|
83
|
+
explicit JsonReader(StringView input)
|
84
|
+
: original_input_(reinterpret_cast<const uint8_t*>(input.data())),
|
85
|
+
input_(original_input_),
|
86
|
+
remaining_input_(input.size()) {}
|
87
|
+
|
88
|
+
Status Run();
|
89
|
+
uint32_t ReadChar();
|
90
|
+
bool IsComplete();
|
91
|
+
|
92
|
+
size_t CurrentIndex() const { return input_ - original_input_ - 1; }
|
93
|
+
|
94
|
+
void StringAddChar(uint32_t c);
|
95
|
+
void StringAddUtf32(uint32_t c);
|
96
|
+
|
97
|
+
Json* CreateAndLinkValue();
|
98
|
+
bool StartContainer(Json::Type type);
|
99
|
+
void EndContainer();
|
100
|
+
void SetKey();
|
101
|
+
void SetString();
|
102
|
+
bool SetNumber();
|
103
|
+
void SetTrue();
|
104
|
+
void SetFalse();
|
105
|
+
void SetNull();
|
106
|
+
|
107
|
+
const uint8_t* original_input_;
|
108
|
+
const uint8_t* input_;
|
109
|
+
size_t remaining_input_;
|
110
|
+
|
111
|
+
State state_ = State::GRPC_JSON_STATE_VALUE_BEGIN;
|
112
|
+
bool escaped_string_was_key_ = false;
|
113
|
+
bool container_just_begun_ = false;
|
114
|
+
uint16_t unicode_char_ = 0;
|
115
|
+
uint16_t unicode_high_surrogate_ = 0;
|
116
|
+
std::vector<grpc_error*> errors_;
|
117
|
+
bool truncated_errors_ = false;
|
118
|
+
|
119
|
+
Json root_value_;
|
120
|
+
std::vector<Json*> stack_;
|
121
|
+
|
122
|
+
std::string key_;
|
123
|
+
std::string string_;
|
66
124
|
};
|
67
125
|
|
68
|
-
|
69
|
-
|
70
|
-
* The definition is public so you can put it on your stack.
|
71
|
-
*/
|
72
|
-
|
73
|
-
int depth;
|
74
|
-
int in_object;
|
75
|
-
int in_array;
|
76
|
-
int escaped_string_was_key;
|
77
|
-
int container_just_begun;
|
78
|
-
uint16_t unicode_char, unicode_high_surrogate;
|
79
|
-
grpc_json_reader_state state;
|
80
|
-
|
81
|
-
grpc_json* top;
|
82
|
-
grpc_json* current_container;
|
83
|
-
grpc_json* current_value;
|
84
|
-
uint8_t* input;
|
85
|
-
uint8_t* key;
|
86
|
-
uint8_t* string;
|
87
|
-
uint8_t* string_ptr;
|
88
|
-
size_t remaining_input;
|
89
|
-
} grpc_json_reader;
|
90
|
-
|
91
|
-
/* The return type of the parser. */
|
92
|
-
typedef enum {
|
93
|
-
GRPC_JSON_DONE, /* The parser finished successfully. */
|
94
|
-
GRPC_JSON_EAGAIN, /* The parser yields to get more data. */
|
95
|
-
GRPC_JSON_READ_ERROR, /* The parser passes through a read error. */
|
96
|
-
GRPC_JSON_PARSE_ERROR, /* The parser found an error in the json stream. */
|
97
|
-
GRPC_JSON_INTERNAL_ERROR /* The parser got an internal error. */
|
98
|
-
} grpc_json_reader_status;
|
99
|
-
|
100
|
-
static void json_reader_string_clear(grpc_json_reader* reader) {
|
101
|
-
if (reader->string) {
|
102
|
-
GPR_ASSERT(reader->string_ptr < reader->input);
|
103
|
-
*reader->string_ptr++ = 0;
|
104
|
-
}
|
105
|
-
reader->string = reader->string_ptr;
|
106
|
-
}
|
107
|
-
|
108
|
-
static void json_reader_string_add_char(grpc_json_reader* reader, uint32_t c) {
|
109
|
-
GPR_ASSERT(reader->string_ptr < reader->input);
|
110
|
-
GPR_ASSERT(c <= 0xff);
|
111
|
-
*reader->string_ptr++ = static_cast<uint8_t>(c);
|
126
|
+
void JsonReader::StringAddChar(uint32_t c) {
|
127
|
+
string_.push_back(static_cast<uint8_t>(c));
|
112
128
|
}
|
113
129
|
|
114
|
-
|
130
|
+
void JsonReader::StringAddUtf32(uint32_t c) {
|
115
131
|
if (c <= 0x7f) {
|
116
|
-
|
132
|
+
StringAddChar(c);
|
117
133
|
} else if (c <= 0x7ff) {
|
118
134
|
uint32_t b1 = 0xc0 | ((c >> 6) & 0x1f);
|
119
135
|
uint32_t b2 = 0x80 | (c & 0x3f);
|
120
|
-
|
121
|
-
|
136
|
+
StringAddChar(b1);
|
137
|
+
StringAddChar(b2);
|
122
138
|
} else if (c <= 0xffff) {
|
123
139
|
uint32_t b1 = 0xe0 | ((c >> 12) & 0x0f);
|
124
140
|
uint32_t b2 = 0x80 | ((c >> 6) & 0x3f);
|
125
141
|
uint32_t b3 = 0x80 | (c & 0x3f);
|
126
|
-
|
127
|
-
|
128
|
-
|
142
|
+
StringAddChar(b1);
|
143
|
+
StringAddChar(b2);
|
144
|
+
StringAddChar(b3);
|
129
145
|
} else if (c <= 0x1fffff) {
|
130
146
|
uint32_t b1 = 0xf0 | ((c >> 18) & 0x07);
|
131
147
|
uint32_t b2 = 0x80 | ((c >> 12) & 0x3f);
|
132
148
|
uint32_t b3 = 0x80 | ((c >> 6) & 0x3f);
|
133
149
|
uint32_t b4 = 0x80 | (c & 0x3f);
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
StringAddChar(b1);
|
151
|
+
StringAddChar(b2);
|
152
|
+
StringAddChar(b3);
|
153
|
+
StringAddChar(b4);
|
138
154
|
}
|
139
155
|
}
|
140
156
|
|
141
|
-
|
142
|
-
if (
|
143
|
-
uint32_t r = *
|
144
|
-
|
157
|
+
uint32_t JsonReader::ReadChar() {
|
158
|
+
if (remaining_input_ == 0) return GRPC_JSON_READ_CHAR_EOF;
|
159
|
+
const uint32_t r = *input_++;
|
160
|
+
--remaining_input_;
|
145
161
|
if (r == 0) {
|
146
|
-
|
162
|
+
remaining_input_ = 0;
|
147
163
|
return GRPC_JSON_READ_CHAR_EOF;
|
148
164
|
}
|
149
165
|
return r;
|
150
166
|
}
|
151
167
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
168
|
+
Json* JsonReader::CreateAndLinkValue() {
|
169
|
+
Json* value;
|
170
|
+
if (stack_.empty()) {
|
171
|
+
value = &root_value_;
|
172
|
+
} else {
|
173
|
+
Json* parent = stack_.back();
|
174
|
+
if (parent->type() == Json::Type::OBJECT) {
|
175
|
+
if (parent->object_value().find(key_) != parent->object_value().end()) {
|
176
|
+
if (errors_.size() == GRPC_JSON_MAX_ERRORS) {
|
177
|
+
truncated_errors_ = true;
|
178
|
+
} else {
|
179
|
+
char* msg;
|
180
|
+
gpr_asprintf(&msg, "duplicate key \"%s\" at index %" PRIuPTR,
|
181
|
+
key_.c_str(), CurrentIndex());
|
182
|
+
errors_.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
|
183
|
+
gpr_free(msg);
|
184
|
+
}
|
185
|
+
}
|
186
|
+
value = &(*parent->mutable_object())[std::move(key_)];
|
187
|
+
} else {
|
188
|
+
GPR_ASSERT(parent->type() == Json::Type::ARRAY);
|
189
|
+
parent->mutable_array()->emplace_back();
|
190
|
+
value = &parent->mutable_array()->back();
|
170
191
|
}
|
171
192
|
}
|
172
|
-
|
173
|
-
reader->top = json;
|
174
|
-
}
|
175
|
-
return json;
|
193
|
+
return value;
|
176
194
|
}
|
177
195
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
reader->current_value = reader->current_container;
|
191
|
-
reader->current_container = reader->current_container->parent;
|
192
|
-
if (reader->current_container) {
|
193
|
-
container_type = reader->current_container->type;
|
196
|
+
bool JsonReader::StartContainer(Json::Type type) {
|
197
|
+
if (stack_.size() == GRPC_JSON_MAX_DEPTH) {
|
198
|
+
if (errors_.size() == GRPC_JSON_MAX_ERRORS) {
|
199
|
+
truncated_errors_ = true;
|
200
|
+
} else {
|
201
|
+
char* msg;
|
202
|
+
gpr_asprintf(&msg, "exceeded max stack depth (%d) at index %" PRIuPTR,
|
203
|
+
GRPC_JSON_MAX_DEPTH, CurrentIndex());
|
204
|
+
errors_.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
|
205
|
+
gpr_free(msg);
|
206
|
+
}
|
207
|
+
return false;
|
194
208
|
}
|
195
|
-
|
209
|
+
Json* value = CreateAndLinkValue();
|
210
|
+
if (type == Json::Type::OBJECT) {
|
211
|
+
*value = Json::Object();
|
212
|
+
} else {
|
213
|
+
GPR_ASSERT(type == Json::Type::ARRAY);
|
214
|
+
*value = Json::Array();
|
215
|
+
}
|
216
|
+
stack_.push_back(value);
|
217
|
+
return true;
|
196
218
|
}
|
197
219
|
|
198
|
-
|
199
|
-
|
220
|
+
void JsonReader::EndContainer() {
|
221
|
+
GPR_ASSERT(!stack_.empty());
|
222
|
+
stack_.pop_back();
|
200
223
|
}
|
201
224
|
|
202
|
-
|
203
|
-
|
204
|
-
|
225
|
+
void JsonReader::SetKey() {
|
226
|
+
key_ = std::move(string_);
|
227
|
+
string_.clear();
|
205
228
|
}
|
206
229
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
230
|
+
void JsonReader::SetString() {
|
231
|
+
Json* value = CreateAndLinkValue();
|
232
|
+
*value = std::move(string_);
|
233
|
+
string_.clear();
|
211
234
|
}
|
212
235
|
|
213
|
-
|
214
|
-
|
236
|
+
bool JsonReader::SetNumber() {
|
237
|
+
Json* value = CreateAndLinkValue();
|
238
|
+
*value = Json(std::move(string_), /*is_number=*/true);
|
239
|
+
string_.clear();
|
240
|
+
return true;
|
215
241
|
}
|
216
242
|
|
217
|
-
|
218
|
-
|
243
|
+
void JsonReader::SetTrue() {
|
244
|
+
Json* value = CreateAndLinkValue();
|
245
|
+
*value = true;
|
246
|
+
string_.clear();
|
219
247
|
}
|
220
248
|
|
221
|
-
|
222
|
-
|
249
|
+
void JsonReader::SetFalse() {
|
250
|
+
Json* value = CreateAndLinkValue();
|
251
|
+
*value = false;
|
252
|
+
string_.clear();
|
223
253
|
}
|
224
254
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
255
|
+
void JsonReader::SetNull() { CreateAndLinkValue(); }
|
256
|
+
|
257
|
+
bool JsonReader::IsComplete() {
|
258
|
+
return (stack_.empty() && (state_ == State::GRPC_JSON_STATE_END ||
|
259
|
+
state_ == State::GRPC_JSON_STATE_VALUE_END));
|
229
260
|
}
|
230
261
|
|
231
262
|
/* Call this function to start parsing the input. It will return the following:
|
232
263
|
* . GRPC_JSON_DONE if the input got eof, and the parsing finished
|
233
264
|
* successfully.
|
234
|
-
* . GRPC_JSON_EAGAIN if the read_char function returned again. Call the
|
235
|
-
* parser again as needed. It is okay to call the parser in polling mode,
|
236
|
-
* although a bit dull.
|
237
|
-
* . GRPC_JSON_READ_ERROR if the read_char function returned an error. The
|
238
|
-
* state isn't broken however, and the function can be called again if the
|
239
|
-
* error has been corrected. But please use the EAGAIN feature instead for
|
240
|
-
* consistency.
|
241
265
|
* . GRPC_JSON_PARSE_ERROR if the input was somehow invalid.
|
242
266
|
* . GRPC_JSON_INTERNAL_ERROR if the parser somehow ended into an invalid
|
243
267
|
* internal state.
|
244
268
|
*/
|
245
|
-
|
246
|
-
uint32_t c
|
269
|
+
JsonReader::Status JsonReader::Run() {
|
270
|
+
uint32_t c;
|
247
271
|
|
248
272
|
/* This state-machine is a strict implementation of ECMA-404 */
|
249
|
-
|
250
|
-
c =
|
273
|
+
while (true) {
|
274
|
+
c = ReadChar();
|
251
275
|
switch (c) {
|
252
|
-
/* Let's process the error
|
253
|
-
case GRPC_JSON_READ_CHAR_ERROR:
|
254
|
-
return GRPC_JSON_READ_ERROR;
|
255
|
-
|
256
|
-
case GRPC_JSON_READ_CHAR_EAGAIN:
|
257
|
-
return GRPC_JSON_EAGAIN;
|
258
|
-
|
276
|
+
/* Let's process the error case first. */
|
259
277
|
case GRPC_JSON_READ_CHAR_EOF:
|
260
|
-
if (
|
261
|
-
return GRPC_JSON_DONE;
|
278
|
+
if (IsComplete()) {
|
279
|
+
return Status::GRPC_JSON_DONE;
|
262
280
|
} else {
|
263
|
-
return GRPC_JSON_PARSE_ERROR;
|
281
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
264
282
|
}
|
265
283
|
break;
|
266
284
|
|
@@ -269,34 +287,33 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
269
287
|
case '\t':
|
270
288
|
case '\n':
|
271
289
|
case '\r':
|
272
|
-
switch (
|
273
|
-
case GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
|
274
|
-
case GRPC_JSON_STATE_OBJECT_KEY_END:
|
275
|
-
case GRPC_JSON_STATE_VALUE_BEGIN:
|
276
|
-
case GRPC_JSON_STATE_VALUE_END:
|
277
|
-
case GRPC_JSON_STATE_END:
|
278
|
-
break;
|
279
|
-
|
280
|
-
case GRPC_JSON_STATE_OBJECT_KEY_STRING:
|
281
|
-
case GRPC_JSON_STATE_VALUE_STRING:
|
282
|
-
if (c != ' ') return GRPC_JSON_PARSE_ERROR;
|
283
|
-
if (
|
284
|
-
return GRPC_JSON_PARSE_ERROR;
|
285
|
-
|
290
|
+
switch (state_) {
|
291
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
|
292
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_END:
|
293
|
+
case State::GRPC_JSON_STATE_VALUE_BEGIN:
|
294
|
+
case State::GRPC_JSON_STATE_VALUE_END:
|
295
|
+
case State::GRPC_JSON_STATE_END:
|
296
|
+
break;
|
297
|
+
|
298
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_STRING:
|
299
|
+
case State::GRPC_JSON_STATE_VALUE_STRING:
|
300
|
+
if (c != ' ') return Status::GRPC_JSON_PARSE_ERROR;
|
301
|
+
if (unicode_high_surrogate_ != 0) {
|
302
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
303
|
+
}
|
304
|
+
StringAddChar(c);
|
286
305
|
break;
|
287
306
|
|
288
|
-
case GRPC_JSON_STATE_VALUE_NUMBER:
|
289
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
|
290
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
|
291
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_EPM:
|
292
|
-
|
293
|
-
|
294
|
-
json_reader_string_clear(reader);
|
295
|
-
reader->state = GRPC_JSON_STATE_VALUE_END;
|
307
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER:
|
308
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
|
309
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
|
310
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_EPM:
|
311
|
+
if (!SetNumber()) return Status::GRPC_JSON_PARSE_ERROR;
|
312
|
+
state_ = State::GRPC_JSON_STATE_VALUE_END;
|
296
313
|
break;
|
297
314
|
|
298
315
|
default:
|
299
|
-
return GRPC_JSON_PARSE_ERROR;
|
316
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
300
317
|
}
|
301
318
|
break;
|
302
319
|
|
@@ -304,182 +321,171 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
304
321
|
case ',':
|
305
322
|
case '}':
|
306
323
|
case ']':
|
307
|
-
switch (
|
308
|
-
case GRPC_JSON_STATE_OBJECT_KEY_STRING:
|
309
|
-
case GRPC_JSON_STATE_VALUE_STRING:
|
310
|
-
if (
|
311
|
-
return GRPC_JSON_PARSE_ERROR;
|
324
|
+
switch (state_) {
|
325
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_STRING:
|
326
|
+
case State::GRPC_JSON_STATE_VALUE_STRING:
|
327
|
+
if (unicode_high_surrogate_ != 0) {
|
328
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
312
329
|
}
|
313
|
-
|
314
|
-
break;
|
315
|
-
|
316
|
-
case GRPC_JSON_STATE_VALUE_NUMBER:
|
317
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
|
318
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
|
319
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_EPM:
|
320
|
-
if (
|
321
|
-
return GRPC_JSON_PARSE_ERROR;
|
322
|
-
} else if (
|
323
|
-
|
324
|
-
|
325
|
-
return GRPC_JSON_PARSE_ERROR;
|
330
|
+
StringAddChar(c);
|
331
|
+
break;
|
332
|
+
|
333
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER:
|
334
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
|
335
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
|
336
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_EPM:
|
337
|
+
if (stack_.empty()) {
|
338
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
339
|
+
} else if (c == '}' &&
|
340
|
+
stack_.back()->type() != Json::Type::OBJECT) {
|
341
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
342
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
343
|
+
} else if (c == ']' && stack_.back()->type() != Json::Type::ARRAY) {
|
344
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
326
345
|
}
|
327
|
-
|
328
|
-
|
329
|
-
json_reader_string_clear(reader);
|
330
|
-
reader->state = GRPC_JSON_STATE_VALUE_END;
|
346
|
+
if (!SetNumber()) return Status::GRPC_JSON_PARSE_ERROR;
|
347
|
+
state_ = State::GRPC_JSON_STATE_VALUE_END;
|
331
348
|
/* The missing break here is intentional. */
|
332
349
|
/* fallthrough */
|
333
350
|
|
334
|
-
case GRPC_JSON_STATE_VALUE_END:
|
335
|
-
case GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
|
336
|
-
case GRPC_JSON_STATE_VALUE_BEGIN:
|
351
|
+
case State::GRPC_JSON_STATE_VALUE_END:
|
352
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
|
353
|
+
case State::GRPC_JSON_STATE_VALUE_BEGIN:
|
337
354
|
if (c == ',') {
|
338
|
-
if (
|
339
|
-
return GRPC_JSON_PARSE_ERROR;
|
355
|
+
if (state_ != State::GRPC_JSON_STATE_VALUE_END) {
|
356
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
340
357
|
}
|
341
|
-
if (
|
342
|
-
|
343
|
-
|
344
|
-
|
358
|
+
if (!stack_.empty() &&
|
359
|
+
stack_.back()->type() == Json::Type::OBJECT) {
|
360
|
+
state_ = State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN;
|
361
|
+
} else if (!stack_.empty() &&
|
362
|
+
stack_.back()->type() == Json::Type::ARRAY) {
|
363
|
+
state_ = State::GRPC_JSON_STATE_VALUE_BEGIN;
|
345
364
|
} else {
|
346
|
-
return GRPC_JSON_PARSE_ERROR;
|
365
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
347
366
|
}
|
348
367
|
} else {
|
349
|
-
if (
|
350
|
-
|
351
|
-
|
368
|
+
if (stack_.empty()) {
|
369
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
370
|
+
}
|
371
|
+
if (c == '}' && stack_.back()->type() != Json::Type::OBJECT) {
|
372
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
352
373
|
}
|
353
|
-
if (
|
354
|
-
|
355
|
-
!
|
356
|
-
return GRPC_JSON_PARSE_ERROR;
|
374
|
+
if (c == '}' &&
|
375
|
+
state_ == State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN &&
|
376
|
+
!container_just_begun_) {
|
377
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
357
378
|
}
|
358
|
-
if (
|
359
|
-
|
360
|
-
(reader->state == GRPC_JSON_STATE_VALUE_BEGIN) &&
|
361
|
-
!reader->container_just_begun) {
|
362
|
-
return GRPC_JSON_PARSE_ERROR;
|
379
|
+
if (c == ']' && stack_.back()->type() != Json::Type::ARRAY) {
|
380
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
363
381
|
}
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
reader->in_array = 1;
|
373
|
-
break;
|
374
|
-
case GRPC_JSON_TOP_LEVEL:
|
375
|
-
GPR_ASSERT(reader->depth == 0);
|
376
|
-
reader->in_object = 0;
|
377
|
-
reader->in_array = 0;
|
378
|
-
reader->state = GRPC_JSON_STATE_END;
|
379
|
-
break;
|
380
|
-
default:
|
381
|
-
GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
|
382
|
+
if (c == ']' && state_ == State::GRPC_JSON_STATE_VALUE_BEGIN &&
|
383
|
+
!container_just_begun_) {
|
384
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
385
|
+
}
|
386
|
+
state_ = State::GRPC_JSON_STATE_VALUE_END;
|
387
|
+
EndContainer();
|
388
|
+
if (stack_.empty()) {
|
389
|
+
state_ = State::GRPC_JSON_STATE_END;
|
382
390
|
}
|
383
391
|
}
|
384
392
|
break;
|
385
393
|
|
386
394
|
default:
|
387
|
-
return GRPC_JSON_PARSE_ERROR;
|
395
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
388
396
|
}
|
389
397
|
break;
|
390
398
|
|
391
399
|
/* In-string escaping. */
|
392
400
|
case '\\':
|
393
|
-
switch (
|
394
|
-
case GRPC_JSON_STATE_OBJECT_KEY_STRING:
|
395
|
-
|
396
|
-
|
401
|
+
switch (state_) {
|
402
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_STRING:
|
403
|
+
escaped_string_was_key_ = true;
|
404
|
+
state_ = State::GRPC_JSON_STATE_STRING_ESCAPE;
|
397
405
|
break;
|
398
406
|
|
399
|
-
case GRPC_JSON_STATE_VALUE_STRING:
|
400
|
-
|
401
|
-
|
407
|
+
case State::GRPC_JSON_STATE_VALUE_STRING:
|
408
|
+
escaped_string_was_key_ = false;
|
409
|
+
state_ = State::GRPC_JSON_STATE_STRING_ESCAPE;
|
402
410
|
break;
|
403
411
|
|
404
412
|
/* This is the \\ case. */
|
405
|
-
case GRPC_JSON_STATE_STRING_ESCAPE:
|
406
|
-
if (
|
407
|
-
return GRPC_JSON_PARSE_ERROR;
|
408
|
-
|
409
|
-
if (
|
410
|
-
|
413
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE:
|
414
|
+
if (unicode_high_surrogate_ != 0)
|
415
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
416
|
+
StringAddChar('\\');
|
417
|
+
if (escaped_string_was_key_) {
|
418
|
+
state_ = State::GRPC_JSON_STATE_OBJECT_KEY_STRING;
|
411
419
|
} else {
|
412
|
-
|
420
|
+
state_ = State::GRPC_JSON_STATE_VALUE_STRING;
|
413
421
|
}
|
414
422
|
break;
|
415
423
|
|
416
424
|
default:
|
417
|
-
return GRPC_JSON_PARSE_ERROR;
|
425
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
418
426
|
}
|
419
427
|
break;
|
420
428
|
|
421
429
|
default:
|
422
|
-
|
423
|
-
switch (
|
424
|
-
case GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
|
425
|
-
if (c != '"') return GRPC_JSON_PARSE_ERROR;
|
426
|
-
|
430
|
+
container_just_begun_ = false;
|
431
|
+
switch (state_) {
|
432
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN:
|
433
|
+
if (c != '"') return Status::GRPC_JSON_PARSE_ERROR;
|
434
|
+
state_ = State::GRPC_JSON_STATE_OBJECT_KEY_STRING;
|
427
435
|
break;
|
428
436
|
|
429
|
-
case GRPC_JSON_STATE_OBJECT_KEY_STRING:
|
430
|
-
if (
|
431
|
-
return GRPC_JSON_PARSE_ERROR;
|
437
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_STRING:
|
438
|
+
if (unicode_high_surrogate_ != 0) {
|
439
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
432
440
|
}
|
433
441
|
if (c == '"') {
|
434
|
-
|
435
|
-
|
436
|
-
json_reader_string_clear(reader);
|
442
|
+
state_ = State::GRPC_JSON_STATE_OBJECT_KEY_END;
|
443
|
+
SetKey();
|
437
444
|
} else {
|
438
|
-
if (c < 32) return GRPC_JSON_PARSE_ERROR;
|
439
|
-
|
445
|
+
if (c < 32) return Status::GRPC_JSON_PARSE_ERROR;
|
446
|
+
StringAddChar(c);
|
440
447
|
}
|
441
448
|
break;
|
442
449
|
|
443
|
-
case GRPC_JSON_STATE_VALUE_STRING:
|
444
|
-
if (
|
445
|
-
return GRPC_JSON_PARSE_ERROR;
|
450
|
+
case State::GRPC_JSON_STATE_VALUE_STRING:
|
451
|
+
if (unicode_high_surrogate_ != 0) {
|
452
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
446
453
|
}
|
447
454
|
if (c == '"') {
|
448
|
-
|
449
|
-
|
450
|
-
json_reader_string_clear(reader);
|
455
|
+
state_ = State::GRPC_JSON_STATE_VALUE_END;
|
456
|
+
SetString();
|
451
457
|
} else {
|
452
|
-
if (c < 32) return GRPC_JSON_PARSE_ERROR;
|
453
|
-
|
458
|
+
if (c < 32) return Status::GRPC_JSON_PARSE_ERROR;
|
459
|
+
StringAddChar(c);
|
454
460
|
}
|
455
461
|
break;
|
456
462
|
|
457
|
-
case GRPC_JSON_STATE_OBJECT_KEY_END:
|
458
|
-
if (c != ':') return GRPC_JSON_PARSE_ERROR;
|
459
|
-
|
463
|
+
case State::GRPC_JSON_STATE_OBJECT_KEY_END:
|
464
|
+
if (c != ':') return Status::GRPC_JSON_PARSE_ERROR;
|
465
|
+
state_ = State::GRPC_JSON_STATE_VALUE_BEGIN;
|
460
466
|
break;
|
461
467
|
|
462
|
-
case GRPC_JSON_STATE_VALUE_BEGIN:
|
468
|
+
case State::GRPC_JSON_STATE_VALUE_BEGIN:
|
463
469
|
switch (c) {
|
464
470
|
case 't':
|
465
|
-
|
471
|
+
state_ = State::GRPC_JSON_STATE_VALUE_TRUE_R;
|
466
472
|
break;
|
467
473
|
|
468
474
|
case 'f':
|
469
|
-
|
475
|
+
state_ = State::GRPC_JSON_STATE_VALUE_FALSE_A;
|
470
476
|
break;
|
471
477
|
|
472
478
|
case 'n':
|
473
|
-
|
479
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NULL_U;
|
474
480
|
break;
|
475
481
|
|
476
482
|
case '"':
|
477
|
-
|
483
|
+
state_ = State::GRPC_JSON_STATE_VALUE_STRING;
|
478
484
|
break;
|
479
485
|
|
480
486
|
case '0':
|
481
|
-
|
482
|
-
|
487
|
+
StringAddChar(c);
|
488
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_ZERO;
|
483
489
|
break;
|
484
490
|
|
485
491
|
case '1':
|
@@ -492,73 +498,71 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
492
498
|
case '8':
|
493
499
|
case '9':
|
494
500
|
case '-':
|
495
|
-
|
496
|
-
|
501
|
+
StringAddChar(c);
|
502
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NUMBER;
|
497
503
|
break;
|
498
504
|
|
499
505
|
case '{':
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
reader->in_array = 0;
|
506
|
+
container_just_begun_ = true;
|
507
|
+
if (!StartContainer(Json::Type::OBJECT)) {
|
508
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
509
|
+
}
|
510
|
+
state_ = State::GRPC_JSON_STATE_OBJECT_KEY_BEGIN;
|
506
511
|
break;
|
507
512
|
|
508
513
|
case '[':
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
reader->in_array = 1;
|
514
|
+
container_just_begun_ = true;
|
515
|
+
if (!StartContainer(Json::Type::ARRAY)) {
|
516
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
517
|
+
}
|
514
518
|
break;
|
515
519
|
default:
|
516
|
-
return GRPC_JSON_PARSE_ERROR;
|
520
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
517
521
|
}
|
518
522
|
break;
|
519
523
|
|
520
|
-
case GRPC_JSON_STATE_STRING_ESCAPE:
|
521
|
-
if (
|
522
|
-
|
524
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE:
|
525
|
+
if (escaped_string_was_key_) {
|
526
|
+
state_ = State::GRPC_JSON_STATE_OBJECT_KEY_STRING;
|
523
527
|
} else {
|
524
|
-
|
528
|
+
state_ = State::GRPC_JSON_STATE_VALUE_STRING;
|
525
529
|
}
|
526
|
-
if (
|
527
|
-
return GRPC_JSON_PARSE_ERROR;
|
530
|
+
if (unicode_high_surrogate_ && c != 'u') {
|
531
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
528
532
|
}
|
529
533
|
switch (c) {
|
530
534
|
case '"':
|
531
535
|
case '/':
|
532
|
-
|
536
|
+
StringAddChar(c);
|
533
537
|
break;
|
534
538
|
case 'b':
|
535
|
-
|
539
|
+
StringAddChar('\b');
|
536
540
|
break;
|
537
541
|
case 'f':
|
538
|
-
|
542
|
+
StringAddChar('\f');
|
539
543
|
break;
|
540
544
|
case 'n':
|
541
|
-
|
545
|
+
StringAddChar('\n');
|
542
546
|
break;
|
543
547
|
case 'r':
|
544
|
-
|
548
|
+
StringAddChar('\r');
|
545
549
|
break;
|
546
550
|
case 't':
|
547
|
-
|
551
|
+
StringAddChar('\t');
|
548
552
|
break;
|
549
553
|
case 'u':
|
550
|
-
|
551
|
-
|
554
|
+
state_ = State::GRPC_JSON_STATE_STRING_ESCAPE_U1;
|
555
|
+
unicode_char_ = 0;
|
552
556
|
break;
|
553
557
|
default:
|
554
|
-
return GRPC_JSON_PARSE_ERROR;
|
558
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
555
559
|
}
|
556
560
|
break;
|
557
561
|
|
558
|
-
case GRPC_JSON_STATE_STRING_ESCAPE_U1:
|
559
|
-
case GRPC_JSON_STATE_STRING_ESCAPE_U2:
|
560
|
-
case GRPC_JSON_STATE_STRING_ESCAPE_U3:
|
561
|
-
case GRPC_JSON_STATE_STRING_ESCAPE_U4:
|
562
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE_U1:
|
563
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE_U2:
|
564
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE_U3:
|
565
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE_U4:
|
562
566
|
if ((c >= '0') && (c <= '9')) {
|
563
567
|
c -= '0';
|
564
568
|
} else if ((c >= 'A') && (c <= 'F')) {
|
@@ -566,62 +570,60 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
566
570
|
} else if ((c >= 'a') && (c <= 'f')) {
|
567
571
|
c -= 'a' - 10;
|
568
572
|
} else {
|
569
|
-
return GRPC_JSON_PARSE_ERROR;
|
573
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
570
574
|
}
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
case GRPC_JSON_STATE_STRING_ESCAPE_U1:
|
578
|
-
reader->state = GRPC_JSON_STATE_STRING_ESCAPE_U2;
|
575
|
+
unicode_char_ = static_cast<uint16_t>(unicode_char_ << 4);
|
576
|
+
unicode_char_ = static_cast<uint16_t>(unicode_char_ | c);
|
577
|
+
|
578
|
+
switch (state_) {
|
579
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE_U1:
|
580
|
+
state_ = State::GRPC_JSON_STATE_STRING_ESCAPE_U2;
|
579
581
|
break;
|
580
|
-
case GRPC_JSON_STATE_STRING_ESCAPE_U2:
|
581
|
-
|
582
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE_U2:
|
583
|
+
state_ = State::GRPC_JSON_STATE_STRING_ESCAPE_U3;
|
582
584
|
break;
|
583
|
-
case GRPC_JSON_STATE_STRING_ESCAPE_U3:
|
584
|
-
|
585
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE_U3:
|
586
|
+
state_ = State::GRPC_JSON_STATE_STRING_ESCAPE_U4;
|
585
587
|
break;
|
586
|
-
case GRPC_JSON_STATE_STRING_ESCAPE_U4:
|
588
|
+
case State::GRPC_JSON_STATE_STRING_ESCAPE_U4:
|
587
589
|
/* See grpc_json_writer_escape_string to have a description
|
588
590
|
* of what's going on here.
|
589
591
|
*/
|
590
|
-
if ((
|
592
|
+
if ((unicode_char_ & 0xfc00) == 0xd800) {
|
591
593
|
/* high surrogate utf-16 */
|
592
|
-
if (
|
593
|
-
return GRPC_JSON_PARSE_ERROR;
|
594
|
-
|
595
|
-
} else if ((
|
594
|
+
if (unicode_high_surrogate_ != 0)
|
595
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
596
|
+
unicode_high_surrogate_ = unicode_char_;
|
597
|
+
} else if ((unicode_char_ & 0xfc00) == 0xdc00) {
|
596
598
|
/* low surrogate utf-16 */
|
597
599
|
uint32_t utf32;
|
598
|
-
if (
|
599
|
-
return GRPC_JSON_PARSE_ERROR;
|
600
|
+
if (unicode_high_surrogate_ == 0)
|
601
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
600
602
|
utf32 = 0x10000;
|
601
603
|
utf32 += static_cast<uint32_t>(
|
602
|
-
(
|
603
|
-
utf32 += static_cast<uint32_t>(
|
604
|
-
|
605
|
-
|
604
|
+
(unicode_high_surrogate_ - 0xd800) * 0x400);
|
605
|
+
utf32 += static_cast<uint32_t>(unicode_char_ - 0xdc00);
|
606
|
+
StringAddUtf32(utf32);
|
607
|
+
unicode_high_surrogate_ = 0;
|
606
608
|
} else {
|
607
609
|
/* anything else */
|
608
|
-
if (
|
609
|
-
return GRPC_JSON_PARSE_ERROR;
|
610
|
-
|
610
|
+
if (unicode_high_surrogate_ != 0)
|
611
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
612
|
+
StringAddUtf32(unicode_char_);
|
611
613
|
}
|
612
|
-
if (
|
613
|
-
|
614
|
+
if (escaped_string_was_key_) {
|
615
|
+
state_ = State::GRPC_JSON_STATE_OBJECT_KEY_STRING;
|
614
616
|
} else {
|
615
|
-
|
617
|
+
state_ = State::GRPC_JSON_STATE_VALUE_STRING;
|
616
618
|
}
|
617
619
|
break;
|
618
620
|
default:
|
619
|
-
GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
|
621
|
+
GPR_UNREACHABLE_CODE(return Status::GRPC_JSON_INTERNAL_ERROR);
|
620
622
|
}
|
621
623
|
break;
|
622
624
|
|
623
|
-
case GRPC_JSON_STATE_VALUE_NUMBER:
|
624
|
-
|
625
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER:
|
626
|
+
StringAddChar(c);
|
625
627
|
switch (c) {
|
626
628
|
case '0':
|
627
629
|
case '1':
|
@@ -636,18 +638,18 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
636
638
|
break;
|
637
639
|
case 'e':
|
638
640
|
case 'E':
|
639
|
-
|
641
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_E;
|
640
642
|
break;
|
641
643
|
case '.':
|
642
|
-
|
644
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_DOT;
|
643
645
|
break;
|
644
646
|
default:
|
645
|
-
return GRPC_JSON_PARSE_ERROR;
|
647
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
646
648
|
}
|
647
649
|
break;
|
648
650
|
|
649
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
|
650
|
-
|
651
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL:
|
652
|
+
StringAddChar(c);
|
651
653
|
switch (c) {
|
652
654
|
case '0':
|
653
655
|
case '1':
|
@@ -662,21 +664,21 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
662
664
|
break;
|
663
665
|
case 'e':
|
664
666
|
case 'E':
|
665
|
-
|
667
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_E;
|
666
668
|
break;
|
667
669
|
default:
|
668
|
-
return GRPC_JSON_PARSE_ERROR;
|
670
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
669
671
|
}
|
670
672
|
break;
|
671
673
|
|
672
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
|
673
|
-
if (c != '.') return GRPC_JSON_PARSE_ERROR;
|
674
|
-
|
675
|
-
|
674
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_ZERO:
|
675
|
+
if (c != '.') return Status::GRPC_JSON_PARSE_ERROR;
|
676
|
+
StringAddChar(c);
|
677
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_DOT;
|
676
678
|
break;
|
677
679
|
|
678
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_DOT:
|
679
|
-
|
680
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_DOT:
|
681
|
+
StringAddChar(c);
|
680
682
|
switch (c) {
|
681
683
|
case '0':
|
682
684
|
case '1':
|
@@ -688,15 +690,15 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
688
690
|
case '7':
|
689
691
|
case '8':
|
690
692
|
case '9':
|
691
|
-
|
693
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_WITH_DECIMAL;
|
692
694
|
break;
|
693
695
|
default:
|
694
|
-
return GRPC_JSON_PARSE_ERROR;
|
696
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
695
697
|
}
|
696
698
|
break;
|
697
699
|
|
698
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_E:
|
699
|
-
|
700
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_E:
|
701
|
+
StringAddChar(c);
|
700
702
|
switch (c) {
|
701
703
|
case '0':
|
702
704
|
case '1':
|
@@ -710,15 +712,15 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
710
712
|
case '9':
|
711
713
|
case '+':
|
712
714
|
case '-':
|
713
|
-
|
715
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NUMBER_EPM;
|
714
716
|
break;
|
715
717
|
default:
|
716
|
-
return GRPC_JSON_PARSE_ERROR;
|
718
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
717
719
|
}
|
718
720
|
break;
|
719
721
|
|
720
|
-
case GRPC_JSON_STATE_VALUE_NUMBER_EPM:
|
721
|
-
|
722
|
+
case State::GRPC_JSON_STATE_VALUE_NUMBER_EPM:
|
723
|
+
StringAddChar(c);
|
722
724
|
switch (c) {
|
723
725
|
case '0':
|
724
726
|
case '1':
|
@@ -732,110 +734,122 @@ static grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
|
|
732
734
|
case '9':
|
733
735
|
break;
|
734
736
|
default:
|
735
|
-
return GRPC_JSON_PARSE_ERROR;
|
737
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
736
738
|
}
|
737
739
|
break;
|
738
740
|
|
739
|
-
case GRPC_JSON_STATE_VALUE_TRUE_R:
|
740
|
-
if (c != 'r') return GRPC_JSON_PARSE_ERROR;
|
741
|
-
|
741
|
+
case State::GRPC_JSON_STATE_VALUE_TRUE_R:
|
742
|
+
if (c != 'r') return Status::GRPC_JSON_PARSE_ERROR;
|
743
|
+
state_ = State::GRPC_JSON_STATE_VALUE_TRUE_U;
|
742
744
|
break;
|
743
745
|
|
744
|
-
case GRPC_JSON_STATE_VALUE_TRUE_U:
|
745
|
-
if (c != 'u') return GRPC_JSON_PARSE_ERROR;
|
746
|
-
|
746
|
+
case State::GRPC_JSON_STATE_VALUE_TRUE_U:
|
747
|
+
if (c != 'u') return Status::GRPC_JSON_PARSE_ERROR;
|
748
|
+
state_ = State::GRPC_JSON_STATE_VALUE_TRUE_E;
|
747
749
|
break;
|
748
750
|
|
749
|
-
case GRPC_JSON_STATE_VALUE_TRUE_E:
|
750
|
-
if (c != 'e') return GRPC_JSON_PARSE_ERROR;
|
751
|
-
|
752
|
-
|
751
|
+
case State::GRPC_JSON_STATE_VALUE_TRUE_E:
|
752
|
+
if (c != 'e') return Status::GRPC_JSON_PARSE_ERROR;
|
753
|
+
SetTrue();
|
754
|
+
state_ = State::GRPC_JSON_STATE_VALUE_END;
|
753
755
|
break;
|
754
756
|
|
755
|
-
case GRPC_JSON_STATE_VALUE_FALSE_A:
|
756
|
-
if (c != 'a') return GRPC_JSON_PARSE_ERROR;
|
757
|
-
|
757
|
+
case State::GRPC_JSON_STATE_VALUE_FALSE_A:
|
758
|
+
if (c != 'a') return Status::GRPC_JSON_PARSE_ERROR;
|
759
|
+
state_ = State::GRPC_JSON_STATE_VALUE_FALSE_L;
|
758
760
|
break;
|
759
761
|
|
760
|
-
case GRPC_JSON_STATE_VALUE_FALSE_L:
|
761
|
-
if (c != 'l') return GRPC_JSON_PARSE_ERROR;
|
762
|
-
|
762
|
+
case State::GRPC_JSON_STATE_VALUE_FALSE_L:
|
763
|
+
if (c != 'l') return Status::GRPC_JSON_PARSE_ERROR;
|
764
|
+
state_ = State::GRPC_JSON_STATE_VALUE_FALSE_S;
|
763
765
|
break;
|
764
766
|
|
765
|
-
case GRPC_JSON_STATE_VALUE_FALSE_S:
|
766
|
-
if (c != 's') return GRPC_JSON_PARSE_ERROR;
|
767
|
-
|
767
|
+
case State::GRPC_JSON_STATE_VALUE_FALSE_S:
|
768
|
+
if (c != 's') return Status::GRPC_JSON_PARSE_ERROR;
|
769
|
+
state_ = State::GRPC_JSON_STATE_VALUE_FALSE_E;
|
768
770
|
break;
|
769
771
|
|
770
|
-
case GRPC_JSON_STATE_VALUE_FALSE_E:
|
771
|
-
if (c != 'e') return GRPC_JSON_PARSE_ERROR;
|
772
|
-
|
773
|
-
|
772
|
+
case State::GRPC_JSON_STATE_VALUE_FALSE_E:
|
773
|
+
if (c != 'e') return Status::GRPC_JSON_PARSE_ERROR;
|
774
|
+
SetFalse();
|
775
|
+
state_ = State::GRPC_JSON_STATE_VALUE_END;
|
774
776
|
break;
|
775
777
|
|
776
|
-
case GRPC_JSON_STATE_VALUE_NULL_U:
|
777
|
-
if (c != 'u') return GRPC_JSON_PARSE_ERROR;
|
778
|
-
|
778
|
+
case State::GRPC_JSON_STATE_VALUE_NULL_U:
|
779
|
+
if (c != 'u') return Status::GRPC_JSON_PARSE_ERROR;
|
780
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NULL_L1;
|
779
781
|
break;
|
780
782
|
|
781
|
-
case GRPC_JSON_STATE_VALUE_NULL_L1:
|
782
|
-
if (c != 'l') return GRPC_JSON_PARSE_ERROR;
|
783
|
-
|
783
|
+
case State::GRPC_JSON_STATE_VALUE_NULL_L1:
|
784
|
+
if (c != 'l') return Status::GRPC_JSON_PARSE_ERROR;
|
785
|
+
state_ = State::GRPC_JSON_STATE_VALUE_NULL_L2;
|
784
786
|
break;
|
785
787
|
|
786
|
-
case GRPC_JSON_STATE_VALUE_NULL_L2:
|
787
|
-
if (c != 'l') return GRPC_JSON_PARSE_ERROR;
|
788
|
-
|
789
|
-
|
788
|
+
case State::GRPC_JSON_STATE_VALUE_NULL_L2:
|
789
|
+
if (c != 'l') return Status::GRPC_JSON_PARSE_ERROR;
|
790
|
+
SetNull();
|
791
|
+
state_ = State::GRPC_JSON_STATE_VALUE_END;
|
790
792
|
break;
|
791
793
|
|
792
794
|
/* All of the VALUE_END cases are handled in the specialized case
|
793
795
|
* above. */
|
794
|
-
case GRPC_JSON_STATE_VALUE_END:
|
796
|
+
case State::GRPC_JSON_STATE_VALUE_END:
|
795
797
|
switch (c) {
|
796
798
|
case ',':
|
797
799
|
case '}':
|
798
800
|
case ']':
|
799
|
-
GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
|
801
|
+
GPR_UNREACHABLE_CODE(return Status::GRPC_JSON_INTERNAL_ERROR);
|
800
802
|
break;
|
801
803
|
|
802
804
|
default:
|
803
|
-
return GRPC_JSON_PARSE_ERROR;
|
805
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
804
806
|
}
|
805
807
|
break;
|
806
808
|
|
807
|
-
case GRPC_JSON_STATE_END:
|
808
|
-
return GRPC_JSON_PARSE_ERROR;
|
809
|
+
case State::GRPC_JSON_STATE_END:
|
810
|
+
return Status::GRPC_JSON_PARSE_ERROR;
|
809
811
|
}
|
810
812
|
}
|
811
813
|
}
|
812
814
|
|
813
|
-
GPR_UNREACHABLE_CODE(return GRPC_JSON_INTERNAL_ERROR);
|
815
|
+
GPR_UNREACHABLE_CODE(return Status::GRPC_JSON_INTERNAL_ERROR);
|
814
816
|
}
|
815
817
|
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
reader.remaining_input = size;
|
824
|
-
json_reader_string_clear(&reader);
|
825
|
-
reader.state = GRPC_JSON_STATE_VALUE_BEGIN;
|
826
|
-
// Perform read.
|
827
|
-
grpc_json_reader_status status = grpc_json_reader_run(&reader);
|
828
|
-
// Process results.
|
829
|
-
grpc_json* json = reader.top;
|
830
|
-
if ((status != GRPC_JSON_DONE) && json != nullptr) {
|
831
|
-
grpc_json_destroy(json);
|
832
|
-
json = nullptr;
|
818
|
+
grpc_error* JsonReader::Parse(StringView input, Json* output) {
|
819
|
+
JsonReader reader(input);
|
820
|
+
Status status = reader.Run();
|
821
|
+
if (reader.truncated_errors_) {
|
822
|
+
reader.errors_.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
823
|
+
"too many errors encountered during JSON parsing -- fix reported "
|
824
|
+
"errors and try again to see additional errors"));
|
833
825
|
}
|
834
|
-
|
826
|
+
if (status == Status::GRPC_JSON_INTERNAL_ERROR) {
|
827
|
+
char* msg;
|
828
|
+
gpr_asprintf(&msg, "internal error in JSON parser at index %" PRIuPTR,
|
829
|
+
reader.CurrentIndex());
|
830
|
+
reader.errors_.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
|
831
|
+
gpr_free(msg);
|
832
|
+
} else if (status == Status::GRPC_JSON_PARSE_ERROR) {
|
833
|
+
char* msg;
|
834
|
+
gpr_asprintf(&msg, "JSON parse error at index %" PRIuPTR,
|
835
|
+
reader.CurrentIndex());
|
836
|
+
reader.errors_.push_back(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg));
|
837
|
+
gpr_free(msg);
|
838
|
+
}
|
839
|
+
if (!reader.errors_.empty()) {
|
840
|
+
return GRPC_ERROR_CREATE_FROM_VECTOR("JSON parsing failed",
|
841
|
+
&reader.errors_);
|
842
|
+
}
|
843
|
+
*output = std::move(reader.root_value_);
|
844
|
+
return GRPC_ERROR_NONE;
|
835
845
|
}
|
836
846
|
|
837
|
-
|
847
|
+
} // namespace
|
838
848
|
|
839
|
-
|
840
|
-
|
849
|
+
Json Json::Parse(StringView json_str, grpc_error** error) {
|
850
|
+
Json value;
|
851
|
+
*error = JsonReader::Parse(json_str, &value);
|
852
|
+
return value;
|
841
853
|
}
|
854
|
+
|
855
|
+
} // namespace grpc_core
|