grpc 1.23.1 → 1.24.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +757 -477
- data/include/grpc/grpc.h +3 -1
- data/include/grpc/grpc_security.h +20 -4
- data/include/grpc/impl/codegen/grpc_types.h +6 -5
- data/include/grpc/impl/codegen/port_platform.h +25 -0
- data/src/core/ext/filters/client_channel/backend_metric.cc +78 -0
- data/src/core/ext/filters/client_channel/backend_metric.h +36 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +16 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +325 -267
- data/src/core/ext/filters/client_channel/client_channel_factory.h +0 -4
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +23 -32
- data/src/core/ext/filters/client_channel/http_proxy.cc +7 -3
- data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +58 -34
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +46 -50
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +9 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +35 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +130 -215
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +34 -21
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +1120 -802
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +8 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +33 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc +151 -40
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h +184 -26
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +389 -245
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +98 -60
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +6 -1
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +89 -0
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +3 -8
- data/src/core/ext/filters/client_channel/server_address.cc +1 -3
- data/src/core/ext/filters/client_channel/server_address.h +1 -1
- data/src/core/ext/filters/client_channel/subchannel.h +2 -1
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +207 -29
- data/src/core/ext/filters/http/client/http_client_filter.cc +10 -8
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +10 -7
- data/src/core/ext/filters/http/server/http_server_filter.cc +52 -26
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +23 -20
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +24 -21
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +37 -24
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +237 -191
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +29 -27
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +19 -4
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +13 -4
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +2 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +0 -2
- data/src/core/ext/transport/chttp2/transport/parsing.cc +99 -71
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +222 -0
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +818 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +314 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1142 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +53 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +158 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +69 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +49 -0
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +240 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +110 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +324 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +235 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +661 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +84 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +274 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +175 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +572 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +150 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +596 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +35 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +80 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +95 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +308 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +128 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +392 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +91 -0
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +236 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +88 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +258 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +111 -0
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +324 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +23 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +50 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +52 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +130 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +39 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +87 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +39 -0
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +85 -0
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +17 -0
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +30 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.c +18 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +30 -0
- data/src/core/ext/upb-generated/google/api/http.upb.c +66 -0
- data/src/core/ext/upb-generated/google/api/http.upb.h +190 -0
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +485 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1690 -0
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +22 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +50 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +79 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +215 -0
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +27 -0
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +58 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +106 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +238 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +33 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +74 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +49 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +126 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +209 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +681 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +42 -0
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +109 -0
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +36 -0
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +84 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +133 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +359 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +58 -0
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +144 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +443 -0
- data/src/core/ext/upb-generated/validate/validate.upb.h +2037 -0
- data/src/core/lib/channel/channel_args.cc +21 -0
- data/src/core/lib/channel/channel_args.h +16 -2
- data/src/core/lib/channel/channel_stack.h +2 -1
- data/src/core/lib/channel/channelz.cc +54 -56
- data/src/core/lib/channel/channelz.h +29 -12
- data/src/core/lib/compression/compression.cc +2 -1
- data/src/core/lib/compression/compression_internal.h +8 -0
- data/src/core/lib/gpr/log_linux.cc +2 -2
- data/src/core/lib/gpr/log_posix.cc +2 -2
- data/src/core/lib/gpr/time_precise.cc +123 -36
- data/src/core/lib/gpr/time_precise.h +37 -0
- data/src/core/lib/gprpp/abstract.h +10 -0
- data/src/core/lib/gprpp/atomic.h +4 -0
- data/src/core/lib/gprpp/inlined_vector.h +20 -4
- data/src/core/lib/gprpp/map.h +109 -6
- data/src/core/lib/gprpp/memory.h +6 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +2 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +29 -54
- data/src/core/lib/iomgr/exec_ctx.cc +27 -17
- data/src/core/lib/iomgr/exec_ctx.h +3 -0
- data/src/core/lib/iomgr/sockaddr_utils.cc +1 -3
- data/src/core/lib/iomgr/tcp_posix.cc +16 -25
- data/src/core/lib/iomgr/tcp_server_custom.cc +1 -1
- data/src/core/lib/iomgr/timer_manager.cc +8 -1
- data/src/core/lib/iomgr/timer_manager.h +2 -0
- data/src/core/lib/security/credentials/credentials.h +8 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -0
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +3 -3
- data/src/core/lib/security/security_connector/ssl_utils.cc +1 -12
- data/src/core/lib/security/security_connector/ssl_utils.h +10 -6
- data/src/core/lib/security/security_connector/ssl_utils_config.cc +32 -0
- data/src/core/lib/security/security_connector/ssl_utils_config.h +30 -0
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +161 -49
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +34 -1
- data/src/core/lib/slice/slice_intern.cc +17 -9
- data/src/core/lib/slice/slice_internal.h +34 -7
- data/src/core/lib/slice/slice_utils.h +7 -3
- data/src/core/lib/surface/call.cc +97 -57
- data/src/core/lib/surface/channel.cc +2 -2
- data/src/core/lib/surface/completion_queue.cc +10 -16
- data/src/core/lib/surface/init.cc +3 -0
- data/src/core/lib/surface/server.cc +11 -14
- data/src/core/lib/surface/validate_metadata.cc +4 -0
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata.cc +4 -4
- data/src/core/lib/transport/metadata_batch.cc +72 -16
- data/src/core/lib/transport/metadata_batch.h +38 -0
- data/src/core/lib/transport/static_metadata.cc +814 -1023
- data/src/core/lib/transport/static_metadata.h +271 -213
- data/src/core/lib/transport/transport.h +12 -0
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +104 -76
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +34 -16
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +10 -6
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +4 -3
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +74 -48
- data/src/core/tsi/alts/handshaker/transport_security_common_api.h +34 -26
- data/src/core/tsi/ssl_transport_security.cc +14 -6
- data/src/core/tsi/ssl_transport_security.h +4 -0
- data/src/ruby/ext/grpc/ext-export.clang +1 -0
- data/src/ruby/ext/grpc/ext-export.gcc +6 -0
- data/src/ruby/ext/grpc/extconf.rb +5 -0
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
- data/src/ruby/ext/grpc/rb_grpc.c +1 -42
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
- data/src/ruby/lib/grpc.rb +2 -0
- data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
- data/src/ruby/lib/grpc/errors.rb +4 -7
- data/src/ruby/lib/grpc/google_rpc_status_utils.rb +9 -4
- data/src/ruby/lib/grpc/structs.rb +15 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/errors_spec.rb +1 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +34 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +53 -29
- data/third_party/upb/upb/decode.c +604 -0
- data/third_party/upb/upb/decode.h +21 -0
- data/third_party/upb/upb/encode.c +378 -0
- data/third_party/upb/upb/encode.h +21 -0
- data/third_party/upb/upb/generated_util.h +105 -0
- data/third_party/upb/upb/msg.c +111 -0
- data/third_party/upb/upb/msg.h +69 -0
- data/third_party/upb/upb/port.c +27 -0
- data/third_party/upb/upb/port_def.inc +152 -0
- data/third_party/upb/upb/port_undef.inc +21 -0
- data/third_party/upb/upb/table.c +911 -0
- data/third_party/upb/upb/table.int.h +507 -0
- data/third_party/upb/upb/upb.c +261 -0
- data/third_party/upb/upb/upb.h +364 -0
- metadata +134 -55
- data/src/core/ext/filters/client_channel/health/health.pb.c +0 -23
- data/src/core/ext/filters/client_channel/health/health.pb.h +0 -73
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +0 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +0 -54
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +0 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +0 -54
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +0 -89
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -164
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +0 -520
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +0 -323
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +0 -145
- data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +0 -149
- data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -47
- data/src/core/tsi/alts/handshaker/altscontext.pb.h +0 -63
- data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -122
- data/src/core/tsi/alts/handshaker/handshaker.pb.h +0 -254
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -49
- data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +0 -78
- data/third_party/nanopb/pb.h +0 -579
- data/third_party/nanopb/pb_common.c +0 -97
- data/third_party/nanopb/pb_common.h +0 -42
- data/third_party/nanopb/pb_decode.c +0 -1347
- data/third_party/nanopb/pb_decode.h +0 -149
- data/third_party/nanopb/pb_encode.c +0 -696
- data/third_party/nanopb/pb_encode.h +0 -154
@@ -1,19 +0,0 @@
|
|
1
|
-
/* Automatically generated nanopb constant definitions */
|
2
|
-
/* Generated by nanopb-0.3.7-dev */
|
3
|
-
|
4
|
-
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h"
|
5
|
-
/* @@protoc_insertion_point(includes) */
|
6
|
-
#if PB_PROTO_HEADER_VERSION != 30
|
7
|
-
#error Regenerate this file with the current version of nanopb generator.
|
8
|
-
#endif
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const pb_field_t google_protobuf_Timestamp_fields[3] = {
|
13
|
-
PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, google_protobuf_Timestamp, seconds, seconds, 0),
|
14
|
-
PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, google_protobuf_Timestamp, nanos, seconds, 0),
|
15
|
-
PB_LAST_FIELD
|
16
|
-
};
|
17
|
-
|
18
|
-
|
19
|
-
/* @@protoc_insertion_point(eof) */
|
@@ -1,54 +0,0 @@
|
|
1
|
-
/* Automatically generated nanopb header */
|
2
|
-
/* Generated by nanopb-0.3.7-dev */
|
3
|
-
|
4
|
-
#ifndef PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED
|
5
|
-
#define PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED
|
6
|
-
#include "pb.h"
|
7
|
-
/* @@protoc_insertion_point(includes) */
|
8
|
-
#if PB_PROTO_HEADER_VERSION != 30
|
9
|
-
#error Regenerate this file with the current version of nanopb generator.
|
10
|
-
#endif
|
11
|
-
|
12
|
-
#ifdef __cplusplus
|
13
|
-
extern "C" {
|
14
|
-
#endif
|
15
|
-
|
16
|
-
/* Struct definitions */
|
17
|
-
typedef struct _google_protobuf_Timestamp {
|
18
|
-
bool has_seconds;
|
19
|
-
int64_t seconds;
|
20
|
-
bool has_nanos;
|
21
|
-
int32_t nanos;
|
22
|
-
/* @@protoc_insertion_point(struct:google_protobuf_Timestamp) */
|
23
|
-
} google_protobuf_Timestamp;
|
24
|
-
|
25
|
-
/* Default values for struct fields */
|
26
|
-
|
27
|
-
/* Initializer values for message structs */
|
28
|
-
#define google_protobuf_Timestamp_init_default {false, 0, false, 0}
|
29
|
-
#define google_protobuf_Timestamp_init_zero {false, 0, false, 0}
|
30
|
-
|
31
|
-
/* Field tags (for use in manual encoding/decoding) */
|
32
|
-
#define google_protobuf_Timestamp_seconds_tag 1
|
33
|
-
#define google_protobuf_Timestamp_nanos_tag 2
|
34
|
-
|
35
|
-
/* Struct field encoding specification for nanopb */
|
36
|
-
extern const pb_field_t google_protobuf_Timestamp_fields[3];
|
37
|
-
|
38
|
-
/* Maximum encoded size of messages (where known) */
|
39
|
-
#define google_protobuf_Timestamp_size 22
|
40
|
-
|
41
|
-
/* Message IDs (where set with "msgid" option) */
|
42
|
-
#ifdef PB_MSGID
|
43
|
-
|
44
|
-
#define TIMESTAMP_MESSAGES \
|
45
|
-
|
46
|
-
|
47
|
-
#endif
|
48
|
-
|
49
|
-
#ifdef __cplusplus
|
50
|
-
} /* extern "C" */
|
51
|
-
#endif
|
52
|
-
/* @@protoc_insertion_point(eof) */
|
53
|
-
|
54
|
-
#endif
|
data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
/* Automatically generated nanopb constant definitions */
|
2
|
-
/* Generated by nanopb-0.3.7-dev */
|
3
|
-
|
4
|
-
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h"
|
5
|
-
/* @@protoc_insertion_point(includes) */
|
6
|
-
#if PB_PROTO_HEADER_VERSION != 30
|
7
|
-
#error Regenerate this file with the current version of nanopb generator.
|
8
|
-
#endif
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3] = {
|
13
|
-
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_LoadBalanceRequest, initial_request, initial_request, &grpc_lb_v1_InitialLoadBalanceRequest_fields),
|
14
|
-
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_LoadBalanceRequest, client_stats, initial_request, &grpc_lb_v1_ClientStats_fields),
|
15
|
-
PB_LAST_FIELD
|
16
|
-
};
|
17
|
-
|
18
|
-
const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2] = {
|
19
|
-
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v1_InitialLoadBalanceRequest, name, name, 0),
|
20
|
-
PB_LAST_FIELD
|
21
|
-
};
|
22
|
-
|
23
|
-
const pb_field_t grpc_lb_v1_ClientStatsPerToken_fields[3] = {
|
24
|
-
PB_FIELD( 1, STRING , OPTIONAL, CALLBACK, FIRST, grpc_lb_v1_ClientStatsPerToken, load_balance_token, load_balance_token, 0),
|
25
|
-
PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStatsPerToken, num_calls, load_balance_token, 0),
|
26
|
-
PB_LAST_FIELD
|
27
|
-
};
|
28
|
-
|
29
|
-
const pb_field_t grpc_lb_v1_ClientStats_fields[7] = {
|
30
|
-
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_ClientStats, timestamp, timestamp, &google_protobuf_Timestamp_fields),
|
31
|
-
PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_started, timestamp, 0),
|
32
|
-
PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished, num_calls_started, 0),
|
33
|
-
PB_FIELD( 6, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_client_failed_to_send, num_calls_finished, 0),
|
34
|
-
PB_FIELD( 7, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_known_received, num_calls_finished_with_client_failed_to_send, 0),
|
35
|
-
PB_FIELD( 8, MESSAGE , REPEATED, CALLBACK, OTHER, grpc_lb_v1_ClientStats, calls_finished_with_drop, num_calls_finished_known_received, &grpc_lb_v1_ClientStatsPerToken_fields),
|
36
|
-
PB_LAST_FIELD
|
37
|
-
};
|
38
|
-
|
39
|
-
const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3] = {
|
40
|
-
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_LoadBalanceResponse, initial_response, initial_response, &grpc_lb_v1_InitialLoadBalanceResponse_fields),
|
41
|
-
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_LoadBalanceResponse, server_list, initial_response, &grpc_lb_v1_ServerList_fields),
|
42
|
-
PB_LAST_FIELD
|
43
|
-
};
|
44
|
-
|
45
|
-
const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3] = {
|
46
|
-
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v1_InitialLoadBalanceResponse, load_balancer_delegate, load_balancer_delegate, 0),
|
47
|
-
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval, load_balancer_delegate, &google_protobuf_Duration_fields),
|
48
|
-
PB_LAST_FIELD
|
49
|
-
};
|
50
|
-
|
51
|
-
const pb_field_t grpc_lb_v1_ServerList_fields[2] = {
|
52
|
-
PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, grpc_lb_v1_ServerList, servers, servers, &grpc_lb_v1_Server_fields),
|
53
|
-
PB_LAST_FIELD
|
54
|
-
};
|
55
|
-
|
56
|
-
const pb_field_t grpc_lb_v1_Server_fields[5] = {
|
57
|
-
PB_FIELD( 1, BYTES , OPTIONAL, STATIC , FIRST, grpc_lb_v1_Server, ip_address, ip_address, 0),
|
58
|
-
PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, port, ip_address, 0),
|
59
|
-
PB_FIELD( 3, STRING , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, load_balance_token, port, 0),
|
60
|
-
PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, drop, load_balance_token, 0),
|
61
|
-
PB_LAST_FIELD
|
62
|
-
};
|
63
|
-
|
64
|
-
|
65
|
-
/* Check that field information fits in pb_field_t */
|
66
|
-
#if !defined(PB_FIELD_32BIT)
|
67
|
-
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
|
68
|
-
* compile-time option. You can do that in pb.h or on compiler command line.
|
69
|
-
*
|
70
|
-
* The reason you need to do this is that some of your messages contain tag
|
71
|
-
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
|
72
|
-
* field descriptors.
|
73
|
-
*/
|
74
|
-
PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStatsPerToken_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
|
75
|
-
#endif
|
76
|
-
|
77
|
-
#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
|
78
|
-
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
|
79
|
-
* compile-time option. You can do that in pb.h or on compiler command line.
|
80
|
-
*
|
81
|
-
* The reason you need to do this is that some of your messages contain tag
|
82
|
-
* numbers or field sizes that are larger than what can fit in the default
|
83
|
-
* 8 bit descriptors.
|
84
|
-
*/
|
85
|
-
PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 256 && pb_membersize(grpc_lb_v1_ClientStats, calls_finished_with_drop) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStatsPerToken_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server)
|
86
|
-
#endif
|
87
|
-
|
88
|
-
|
89
|
-
/* @@protoc_insertion_point(eof) */
|
data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
DELETED
@@ -1,164 +0,0 @@
|
|
1
|
-
/* Automatically generated nanopb header */
|
2
|
-
/* Generated by nanopb-0.3.7-dev */
|
3
|
-
|
4
|
-
#ifndef PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED
|
5
|
-
#define PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED
|
6
|
-
#include "pb.h"
|
7
|
-
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h"
|
8
|
-
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h"
|
9
|
-
/* @@protoc_insertion_point(includes) */
|
10
|
-
#if PB_PROTO_HEADER_VERSION != 30
|
11
|
-
#error Regenerate this file with the current version of nanopb generator.
|
12
|
-
#endif
|
13
|
-
|
14
|
-
#ifdef __cplusplus
|
15
|
-
extern "C" {
|
16
|
-
#endif
|
17
|
-
|
18
|
-
/* Struct definitions */
|
19
|
-
typedef struct _grpc_lb_v1_ServerList {
|
20
|
-
pb_callback_t servers;
|
21
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_ServerList) */
|
22
|
-
} grpc_lb_v1_ServerList;
|
23
|
-
|
24
|
-
typedef struct _grpc_lb_v1_ClientStats {
|
25
|
-
bool has_timestamp;
|
26
|
-
google_protobuf_Timestamp timestamp;
|
27
|
-
bool has_num_calls_started;
|
28
|
-
int64_t num_calls_started;
|
29
|
-
bool has_num_calls_finished;
|
30
|
-
int64_t num_calls_finished;
|
31
|
-
bool has_num_calls_finished_with_client_failed_to_send;
|
32
|
-
int64_t num_calls_finished_with_client_failed_to_send;
|
33
|
-
bool has_num_calls_finished_known_received;
|
34
|
-
int64_t num_calls_finished_known_received;
|
35
|
-
pb_callback_t calls_finished_with_drop;
|
36
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */
|
37
|
-
} grpc_lb_v1_ClientStats;
|
38
|
-
|
39
|
-
typedef struct _grpc_lb_v1_ClientStatsPerToken {
|
40
|
-
pb_callback_t load_balance_token;
|
41
|
-
bool has_num_calls;
|
42
|
-
int64_t num_calls;
|
43
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStatsPerToken) */
|
44
|
-
} grpc_lb_v1_ClientStatsPerToken;
|
45
|
-
|
46
|
-
typedef struct _grpc_lb_v1_InitialLoadBalanceRequest {
|
47
|
-
bool has_name;
|
48
|
-
char name[128];
|
49
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceRequest) */
|
50
|
-
} grpc_lb_v1_InitialLoadBalanceRequest;
|
51
|
-
|
52
|
-
typedef struct _grpc_lb_v1_InitialLoadBalanceResponse {
|
53
|
-
bool has_load_balancer_delegate;
|
54
|
-
char load_balancer_delegate[64];
|
55
|
-
bool has_client_stats_report_interval;
|
56
|
-
google_protobuf_Duration client_stats_report_interval;
|
57
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceResponse) */
|
58
|
-
} grpc_lb_v1_InitialLoadBalanceResponse;
|
59
|
-
|
60
|
-
typedef PB_BYTES_ARRAY_T(16) grpc_lb_v1_Server_ip_address_t;
|
61
|
-
typedef struct _grpc_lb_v1_Server {
|
62
|
-
bool has_ip_address;
|
63
|
-
grpc_lb_v1_Server_ip_address_t ip_address;
|
64
|
-
bool has_port;
|
65
|
-
int32_t port;
|
66
|
-
bool has_load_balance_token;
|
67
|
-
char load_balance_token[50];
|
68
|
-
bool has_drop;
|
69
|
-
bool drop;
|
70
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_Server) */
|
71
|
-
} grpc_lb_v1_Server;
|
72
|
-
|
73
|
-
typedef struct _grpc_lb_v1_LoadBalanceRequest {
|
74
|
-
bool has_initial_request;
|
75
|
-
grpc_lb_v1_InitialLoadBalanceRequest initial_request;
|
76
|
-
bool has_client_stats;
|
77
|
-
grpc_lb_v1_ClientStats client_stats;
|
78
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_LoadBalanceRequest) */
|
79
|
-
} grpc_lb_v1_LoadBalanceRequest;
|
80
|
-
|
81
|
-
typedef struct _grpc_lb_v1_LoadBalanceResponse {
|
82
|
-
bool has_initial_response;
|
83
|
-
grpc_lb_v1_InitialLoadBalanceResponse initial_response;
|
84
|
-
bool has_server_list;
|
85
|
-
grpc_lb_v1_ServerList server_list;
|
86
|
-
/* @@protoc_insertion_point(struct:grpc_lb_v1_LoadBalanceResponse) */
|
87
|
-
} grpc_lb_v1_LoadBalanceResponse;
|
88
|
-
|
89
|
-
/* Default values for struct fields */
|
90
|
-
|
91
|
-
/* Initializer values for message structs */
|
92
|
-
#define grpc_lb_v1_LoadBalanceRequest_init_default {false, grpc_lb_v1_InitialLoadBalanceRequest_init_default, false, grpc_lb_v1_ClientStats_init_default}
|
93
|
-
#define grpc_lb_v1_InitialLoadBalanceRequest_init_default {false, ""}
|
94
|
-
#define grpc_lb_v1_ClientStatsPerToken_init_default {{{NULL}, NULL}, false, 0}
|
95
|
-
#define grpc_lb_v1_ClientStats_init_default {false, google_protobuf_Timestamp_init_default, false, 0, false, 0, false, 0, false, 0, {{NULL}, NULL}}
|
96
|
-
#define grpc_lb_v1_LoadBalanceResponse_init_default {false, grpc_lb_v1_InitialLoadBalanceResponse_init_default, false, grpc_lb_v1_ServerList_init_default}
|
97
|
-
#define grpc_lb_v1_InitialLoadBalanceResponse_init_default {false, "", false, google_protobuf_Duration_init_default}
|
98
|
-
#define grpc_lb_v1_ServerList_init_default {{{NULL}, NULL}}
|
99
|
-
#define grpc_lb_v1_Server_init_default {false, {0, {0}}, false, 0, false, "", false, 0}
|
100
|
-
#define grpc_lb_v1_LoadBalanceRequest_init_zero {false, grpc_lb_v1_InitialLoadBalanceRequest_init_zero, false, grpc_lb_v1_ClientStats_init_zero}
|
101
|
-
#define grpc_lb_v1_InitialLoadBalanceRequest_init_zero {false, ""}
|
102
|
-
#define grpc_lb_v1_ClientStatsPerToken_init_zero {{{NULL}, NULL}, false, 0}
|
103
|
-
#define grpc_lb_v1_ClientStats_init_zero {false, google_protobuf_Timestamp_init_zero, false, 0, false, 0, false, 0, false, 0, {{NULL}, NULL}}
|
104
|
-
#define grpc_lb_v1_LoadBalanceResponse_init_zero {false, grpc_lb_v1_InitialLoadBalanceResponse_init_zero, false, grpc_lb_v1_ServerList_init_zero}
|
105
|
-
#define grpc_lb_v1_InitialLoadBalanceResponse_init_zero {false, "", false, google_protobuf_Duration_init_zero}
|
106
|
-
#define grpc_lb_v1_ServerList_init_zero {{{NULL}, NULL}}
|
107
|
-
#define grpc_lb_v1_Server_init_zero {false, {0, {0}}, false, 0, false, "", false, 0}
|
108
|
-
|
109
|
-
/* Field tags (for use in manual encoding/decoding) */
|
110
|
-
#define grpc_lb_v1_ServerList_servers_tag 1
|
111
|
-
#define grpc_lb_v1_ClientStats_timestamp_tag 1
|
112
|
-
#define grpc_lb_v1_ClientStats_num_calls_started_tag 2
|
113
|
-
#define grpc_lb_v1_ClientStats_num_calls_finished_tag 3
|
114
|
-
#define grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send_tag 6
|
115
|
-
#define grpc_lb_v1_ClientStats_num_calls_finished_known_received_tag 7
|
116
|
-
#define grpc_lb_v1_ClientStats_calls_finished_with_drop_tag 8
|
117
|
-
#define grpc_lb_v1_ClientStatsPerToken_load_balance_token_tag 1
|
118
|
-
#define grpc_lb_v1_ClientStatsPerToken_num_calls_tag 2
|
119
|
-
#define grpc_lb_v1_InitialLoadBalanceRequest_name_tag 1
|
120
|
-
#define grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate_tag 1
|
121
|
-
#define grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval_tag 2
|
122
|
-
#define grpc_lb_v1_Server_ip_address_tag 1
|
123
|
-
#define grpc_lb_v1_Server_port_tag 2
|
124
|
-
#define grpc_lb_v1_Server_load_balance_token_tag 3
|
125
|
-
#define grpc_lb_v1_Server_drop_tag 4
|
126
|
-
#define grpc_lb_v1_LoadBalanceRequest_initial_request_tag 1
|
127
|
-
#define grpc_lb_v1_LoadBalanceRequest_client_stats_tag 2
|
128
|
-
#define grpc_lb_v1_LoadBalanceResponse_initial_response_tag 1
|
129
|
-
#define grpc_lb_v1_LoadBalanceResponse_server_list_tag 2
|
130
|
-
|
131
|
-
/* Struct field encoding specification for nanopb */
|
132
|
-
extern const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3];
|
133
|
-
extern const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2];
|
134
|
-
extern const pb_field_t grpc_lb_v1_ClientStatsPerToken_fields[3];
|
135
|
-
extern const pb_field_t grpc_lb_v1_ClientStats_fields[7];
|
136
|
-
extern const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3];
|
137
|
-
extern const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3];
|
138
|
-
extern const pb_field_t grpc_lb_v1_ServerList_fields[2];
|
139
|
-
extern const pb_field_t grpc_lb_v1_Server_fields[5];
|
140
|
-
|
141
|
-
/* Maximum encoded size of messages (where known) */
|
142
|
-
#define grpc_lb_v1_LoadBalanceRequest_size (140 + grpc_lb_v1_ClientStats_size)
|
143
|
-
#define grpc_lb_v1_InitialLoadBalanceRequest_size 131
|
144
|
-
/* grpc_lb_v1_ClientStatsPerToken_size depends on runtime parameters */
|
145
|
-
/* grpc_lb_v1_ClientStats_size depends on runtime parameters */
|
146
|
-
#define grpc_lb_v1_LoadBalanceResponse_size (98 + grpc_lb_v1_ServerList_size)
|
147
|
-
#define grpc_lb_v1_InitialLoadBalanceResponse_size 90
|
148
|
-
/* grpc_lb_v1_ServerList_size depends on runtime parameters */
|
149
|
-
#define grpc_lb_v1_Server_size 83
|
150
|
-
|
151
|
-
/* Message IDs (where set with "msgid" option) */
|
152
|
-
#ifdef PB_MSGID
|
153
|
-
|
154
|
-
#define LOAD_BALANCER_MESSAGES \
|
155
|
-
|
156
|
-
|
157
|
-
#endif
|
158
|
-
|
159
|
-
#ifdef __cplusplus
|
160
|
-
} /* extern "C" */
|
161
|
-
#endif
|
162
|
-
/* @@protoc_insertion_point(eof) */
|
163
|
-
|
164
|
-
#endif
|
@@ -1,520 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2018 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 "src/core/tsi/alts/handshaker/alts_handshaker_service_api.h"
|
22
|
-
|
23
|
-
#include <stdio.h>
|
24
|
-
#include <stdlib.h>
|
25
|
-
|
26
|
-
#include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
|
27
|
-
|
28
|
-
/* HandshakerReq */
|
29
|
-
grpc_gcp_handshaker_req* grpc_gcp_handshaker_req_create(
|
30
|
-
grpc_gcp_handshaker_req_type type) {
|
31
|
-
grpc_gcp_handshaker_req* req =
|
32
|
-
static_cast<grpc_gcp_handshaker_req*>(gpr_zalloc(sizeof(*req)));
|
33
|
-
switch (type) {
|
34
|
-
case CLIENT_START_REQ:
|
35
|
-
req->has_client_start = true;
|
36
|
-
break;
|
37
|
-
case SERVER_START_REQ:
|
38
|
-
req->has_server_start = true;
|
39
|
-
break;
|
40
|
-
case NEXT_REQ:
|
41
|
-
req->has_next = true;
|
42
|
-
break;
|
43
|
-
}
|
44
|
-
return req;
|
45
|
-
}
|
46
|
-
|
47
|
-
void grpc_gcp_handshaker_req_destroy(grpc_gcp_handshaker_req* req) {
|
48
|
-
if (req == nullptr) {
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
if (req->has_client_start) {
|
52
|
-
/* Destroy client_start request. */
|
53
|
-
destroy_repeated_field_list_identity(
|
54
|
-
static_cast<repeated_field*>(req->client_start.target_identities.arg));
|
55
|
-
destroy_repeated_field_list_string(static_cast<repeated_field*>(
|
56
|
-
req->client_start.application_protocols.arg));
|
57
|
-
destroy_repeated_field_list_string(
|
58
|
-
static_cast<repeated_field*>(req->client_start.record_protocols.arg));
|
59
|
-
if (req->client_start.has_local_identity) {
|
60
|
-
destroy_slice(static_cast<grpc_slice*>(
|
61
|
-
req->client_start.local_identity.hostname.arg));
|
62
|
-
destroy_slice(static_cast<grpc_slice*>(
|
63
|
-
req->client_start.local_identity.service_account.arg));
|
64
|
-
}
|
65
|
-
if (req->client_start.has_local_endpoint) {
|
66
|
-
destroy_slice(static_cast<grpc_slice*>(
|
67
|
-
req->client_start.local_endpoint.ip_address.arg));
|
68
|
-
}
|
69
|
-
if (req->client_start.has_remote_endpoint) {
|
70
|
-
destroy_slice(static_cast<grpc_slice*>(
|
71
|
-
req->client_start.remote_endpoint.ip_address.arg));
|
72
|
-
}
|
73
|
-
destroy_slice(static_cast<grpc_slice*>(req->client_start.target_name.arg));
|
74
|
-
} else if (req->has_server_start) {
|
75
|
-
/* Destroy server_start request. */
|
76
|
-
size_t i = 0;
|
77
|
-
for (i = 0; i < req->server_start.handshake_parameters_count; i++) {
|
78
|
-
destroy_repeated_field_list_identity(
|
79
|
-
static_cast<repeated_field*>(req->server_start.handshake_parameters[i]
|
80
|
-
.value.local_identities.arg));
|
81
|
-
destroy_repeated_field_list_string(
|
82
|
-
static_cast<repeated_field*>(req->server_start.handshake_parameters[i]
|
83
|
-
.value.record_protocols.arg));
|
84
|
-
}
|
85
|
-
destroy_repeated_field_list_string(static_cast<repeated_field*>(
|
86
|
-
req->server_start.application_protocols.arg));
|
87
|
-
if (req->server_start.has_local_endpoint) {
|
88
|
-
destroy_slice(static_cast<grpc_slice*>(
|
89
|
-
req->server_start.local_endpoint.ip_address.arg));
|
90
|
-
}
|
91
|
-
if (req->server_start.has_remote_endpoint) {
|
92
|
-
destroy_slice(static_cast<grpc_slice*>(
|
93
|
-
req->server_start.remote_endpoint.ip_address.arg));
|
94
|
-
}
|
95
|
-
destroy_slice(static_cast<grpc_slice*>(req->server_start.in_bytes.arg));
|
96
|
-
} else {
|
97
|
-
/* Destroy next request. */
|
98
|
-
destroy_slice(static_cast<grpc_slice*>(req->next.in_bytes.arg));
|
99
|
-
}
|
100
|
-
gpr_free(req);
|
101
|
-
}
|
102
|
-
|
103
|
-
bool grpc_gcp_handshaker_req_set_handshake_protocol(
|
104
|
-
grpc_gcp_handshaker_req* req,
|
105
|
-
grpc_gcp_handshake_protocol handshake_protocol) {
|
106
|
-
if (req == nullptr || !req->has_client_start) {
|
107
|
-
gpr_log(GPR_ERROR,
|
108
|
-
"Invalid arguments to "
|
109
|
-
"grpc_gcp_handshaker_req_set_handshake_protocol().");
|
110
|
-
return false;
|
111
|
-
}
|
112
|
-
req->client_start.has_handshake_security_protocol = true;
|
113
|
-
req->client_start.handshake_security_protocol = handshake_protocol;
|
114
|
-
return true;
|
115
|
-
}
|
116
|
-
|
117
|
-
bool grpc_gcp_handshaker_req_set_target_name(grpc_gcp_handshaker_req* req,
|
118
|
-
const char* target_name) {
|
119
|
-
if (req == nullptr || target_name == nullptr || !req->has_client_start) {
|
120
|
-
gpr_log(GPR_ERROR,
|
121
|
-
"Invalid arguments to "
|
122
|
-
"grpc_gcp_handshaker_req_set_target_name().");
|
123
|
-
return false;
|
124
|
-
}
|
125
|
-
grpc_slice* slice = create_slice(target_name, strlen(target_name));
|
126
|
-
req->client_start.target_name.arg = slice;
|
127
|
-
req->client_start.target_name.funcs.encode = encode_string_or_bytes_cb;
|
128
|
-
return true;
|
129
|
-
}
|
130
|
-
|
131
|
-
bool grpc_gcp_handshaker_req_add_application_protocol(
|
132
|
-
grpc_gcp_handshaker_req* req, const char* application_protocol) {
|
133
|
-
if (req == nullptr || application_protocol == nullptr || req->has_next) {
|
134
|
-
gpr_log(GPR_ERROR,
|
135
|
-
"Invalid arguments to "
|
136
|
-
"grpc_gcp_handshaker_req_add_application_protocol().");
|
137
|
-
return false;
|
138
|
-
}
|
139
|
-
grpc_slice* slice =
|
140
|
-
create_slice(application_protocol, strlen(application_protocol));
|
141
|
-
if (req->has_client_start) {
|
142
|
-
add_repeated_field(reinterpret_cast<repeated_field**>(
|
143
|
-
&req->client_start.application_protocols.arg),
|
144
|
-
slice);
|
145
|
-
req->client_start.application_protocols.funcs.encode =
|
146
|
-
encode_repeated_string_cb;
|
147
|
-
} else {
|
148
|
-
add_repeated_field(reinterpret_cast<repeated_field**>(
|
149
|
-
&req->server_start.application_protocols.arg),
|
150
|
-
slice);
|
151
|
-
req->server_start.application_protocols.funcs.encode =
|
152
|
-
encode_repeated_string_cb;
|
153
|
-
}
|
154
|
-
return true;
|
155
|
-
}
|
156
|
-
|
157
|
-
bool grpc_gcp_handshaker_req_add_record_protocol(grpc_gcp_handshaker_req* req,
|
158
|
-
const char* record_protocol) {
|
159
|
-
if (req == nullptr || record_protocol == nullptr || !req->has_client_start) {
|
160
|
-
gpr_log(GPR_ERROR,
|
161
|
-
"Invalid arguments to "
|
162
|
-
"grpc_gcp_handshaker_req_add_record_protocol().");
|
163
|
-
return false;
|
164
|
-
}
|
165
|
-
grpc_slice* slice = create_slice(record_protocol, strlen(record_protocol));
|
166
|
-
add_repeated_field(reinterpret_cast<repeated_field**>(
|
167
|
-
&req->client_start.record_protocols.arg),
|
168
|
-
slice);
|
169
|
-
req->client_start.record_protocols.funcs.encode = encode_repeated_string_cb;
|
170
|
-
return true;
|
171
|
-
}
|
172
|
-
|
173
|
-
static void set_identity_hostname(grpc_gcp_identity* identity,
|
174
|
-
const char* hostname) {
|
175
|
-
grpc_slice* slice = create_slice(hostname, strlen(hostname));
|
176
|
-
identity->hostname.arg = slice;
|
177
|
-
identity->hostname.funcs.encode = encode_string_or_bytes_cb;
|
178
|
-
}
|
179
|
-
|
180
|
-
static void set_identity_service_account(grpc_gcp_identity* identity,
|
181
|
-
const char* service_account) {
|
182
|
-
grpc_slice* slice = create_slice(service_account, strlen(service_account));
|
183
|
-
identity->service_account.arg = slice;
|
184
|
-
identity->service_account.funcs.encode = encode_string_or_bytes_cb;
|
185
|
-
}
|
186
|
-
|
187
|
-
bool grpc_gcp_handshaker_req_add_target_identity_hostname(
|
188
|
-
grpc_gcp_handshaker_req* req, const char* hostname) {
|
189
|
-
if (req == nullptr || hostname == nullptr || !req->has_client_start) {
|
190
|
-
gpr_log(GPR_ERROR,
|
191
|
-
"Invalid nullptr arguments to "
|
192
|
-
"grpc_gcp_handshaker_req_add_target_identity_hostname().");
|
193
|
-
return false;
|
194
|
-
}
|
195
|
-
grpc_gcp_identity* target_identity =
|
196
|
-
static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*target_identity)));
|
197
|
-
set_identity_hostname(target_identity, hostname);
|
198
|
-
req->client_start.target_identities.funcs.encode =
|
199
|
-
encode_repeated_identity_cb;
|
200
|
-
add_repeated_field(reinterpret_cast<repeated_field**>(
|
201
|
-
&req->client_start.target_identities.arg),
|
202
|
-
target_identity);
|
203
|
-
return true;
|
204
|
-
}
|
205
|
-
|
206
|
-
bool grpc_gcp_handshaker_req_add_target_identity_service_account(
|
207
|
-
grpc_gcp_handshaker_req* req, const char* service_account) {
|
208
|
-
if (req == nullptr || service_account == nullptr || !req->has_client_start) {
|
209
|
-
gpr_log(GPR_ERROR,
|
210
|
-
"Invalid nullptr arguments to "
|
211
|
-
"grpc_gcp_handshaker_req_add_target_identity_service_account().");
|
212
|
-
return false;
|
213
|
-
}
|
214
|
-
grpc_gcp_identity* target_identity =
|
215
|
-
static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*target_identity)));
|
216
|
-
set_identity_service_account(target_identity, service_account);
|
217
|
-
req->client_start.target_identities.funcs.encode =
|
218
|
-
encode_repeated_identity_cb;
|
219
|
-
add_repeated_field(reinterpret_cast<repeated_field**>(
|
220
|
-
&req->client_start.target_identities.arg),
|
221
|
-
target_identity);
|
222
|
-
return true;
|
223
|
-
}
|
224
|
-
|
225
|
-
bool grpc_gcp_handshaker_req_set_local_identity_hostname(
|
226
|
-
grpc_gcp_handshaker_req* req, const char* hostname) {
|
227
|
-
if (req == nullptr || hostname == nullptr || !req->has_client_start) {
|
228
|
-
gpr_log(GPR_ERROR,
|
229
|
-
"Invalid nullptr arguments to "
|
230
|
-
"grpc_gcp_handshaker_req_set_local_identity_hostname().");
|
231
|
-
return false;
|
232
|
-
}
|
233
|
-
req->client_start.has_local_identity = true;
|
234
|
-
set_identity_hostname(&req->client_start.local_identity, hostname);
|
235
|
-
return true;
|
236
|
-
}
|
237
|
-
|
238
|
-
bool grpc_gcp_handshaker_req_set_local_identity_service_account(
|
239
|
-
grpc_gcp_handshaker_req* req, const char* service_account) {
|
240
|
-
if (req == nullptr || service_account == nullptr || !req->has_client_start) {
|
241
|
-
gpr_log(GPR_ERROR,
|
242
|
-
"Invalid nullptr arguments to "
|
243
|
-
"grpc_gcp_handshaker_req_set_local_identity_service_account().");
|
244
|
-
return false;
|
245
|
-
}
|
246
|
-
req->client_start.has_local_identity = true;
|
247
|
-
set_identity_service_account(&req->client_start.local_identity,
|
248
|
-
service_account);
|
249
|
-
return true;
|
250
|
-
}
|
251
|
-
|
252
|
-
static void set_endpoint(grpc_gcp_endpoint* endpoint, const char* ip_address,
|
253
|
-
size_t port, grpc_gcp_network_protocol protocol) {
|
254
|
-
grpc_slice* slice = create_slice(ip_address, strlen(ip_address));
|
255
|
-
endpoint->ip_address.arg = slice;
|
256
|
-
endpoint->ip_address.funcs.encode = encode_string_or_bytes_cb;
|
257
|
-
endpoint->has_port = true;
|
258
|
-
endpoint->port = static_cast<int32_t>(port);
|
259
|
-
endpoint->has_protocol = true;
|
260
|
-
endpoint->protocol = protocol;
|
261
|
-
}
|
262
|
-
|
263
|
-
bool grpc_gcp_handshaker_req_set_rpc_versions(grpc_gcp_handshaker_req* req,
|
264
|
-
uint32_t max_major,
|
265
|
-
uint32_t max_minor,
|
266
|
-
uint32_t min_major,
|
267
|
-
uint32_t min_minor) {
|
268
|
-
if (req == nullptr || req->has_next) {
|
269
|
-
gpr_log(GPR_ERROR,
|
270
|
-
"Invalid arguments to "
|
271
|
-
"grpc_gcp_handshaker_req_set_rpc_versions().");
|
272
|
-
return false;
|
273
|
-
}
|
274
|
-
if (req->has_client_start) {
|
275
|
-
req->client_start.has_rpc_versions = true;
|
276
|
-
grpc_gcp_rpc_protocol_versions_set_max(&req->client_start.rpc_versions,
|
277
|
-
max_major, max_minor);
|
278
|
-
grpc_gcp_rpc_protocol_versions_set_min(&req->client_start.rpc_versions,
|
279
|
-
min_major, min_minor);
|
280
|
-
} else {
|
281
|
-
req->server_start.has_rpc_versions = true;
|
282
|
-
grpc_gcp_rpc_protocol_versions_set_max(&req->server_start.rpc_versions,
|
283
|
-
max_major, max_minor);
|
284
|
-
grpc_gcp_rpc_protocol_versions_set_min(&req->server_start.rpc_versions,
|
285
|
-
min_major, min_minor);
|
286
|
-
}
|
287
|
-
return true;
|
288
|
-
}
|
289
|
-
|
290
|
-
bool grpc_gcp_handshaker_req_set_local_endpoint(
|
291
|
-
grpc_gcp_handshaker_req* req, const char* ip_address, size_t port,
|
292
|
-
grpc_gcp_network_protocol protocol) {
|
293
|
-
if (req == nullptr || ip_address == nullptr || port > 65535 ||
|
294
|
-
req->has_next) {
|
295
|
-
gpr_log(GPR_ERROR,
|
296
|
-
"Invalid arguments to "
|
297
|
-
"grpc_gcp_handshaker_req_set_local_endpoint().");
|
298
|
-
return false;
|
299
|
-
}
|
300
|
-
if (req->has_client_start) {
|
301
|
-
req->client_start.has_local_endpoint = true;
|
302
|
-
set_endpoint(&req->client_start.local_endpoint, ip_address, port, protocol);
|
303
|
-
} else {
|
304
|
-
req->server_start.has_local_endpoint = true;
|
305
|
-
set_endpoint(&req->server_start.local_endpoint, ip_address, port, protocol);
|
306
|
-
}
|
307
|
-
return true;
|
308
|
-
}
|
309
|
-
|
310
|
-
bool grpc_gcp_handshaker_req_set_remote_endpoint(
|
311
|
-
grpc_gcp_handshaker_req* req, const char* ip_address, size_t port,
|
312
|
-
grpc_gcp_network_protocol protocol) {
|
313
|
-
if (req == nullptr || ip_address == nullptr || port > 65535 ||
|
314
|
-
req->has_next) {
|
315
|
-
gpr_log(GPR_ERROR,
|
316
|
-
"Invalid arguments to "
|
317
|
-
"grpc_gcp_handshaker_req_set_remote_endpoint().");
|
318
|
-
return false;
|
319
|
-
}
|
320
|
-
if (req->has_client_start) {
|
321
|
-
req->client_start.has_remote_endpoint = true;
|
322
|
-
set_endpoint(&req->client_start.remote_endpoint, ip_address, port,
|
323
|
-
protocol);
|
324
|
-
} else {
|
325
|
-
req->server_start.has_remote_endpoint = true;
|
326
|
-
set_endpoint(&req->server_start.remote_endpoint, ip_address, port,
|
327
|
-
protocol);
|
328
|
-
}
|
329
|
-
return true;
|
330
|
-
}
|
331
|
-
|
332
|
-
bool grpc_gcp_handshaker_req_set_in_bytes(grpc_gcp_handshaker_req* req,
|
333
|
-
const char* in_bytes, size_t size) {
|
334
|
-
if (req == nullptr || in_bytes == nullptr || req->has_client_start) {
|
335
|
-
gpr_log(GPR_ERROR,
|
336
|
-
"Invalid arguments to "
|
337
|
-
"grpc_gcp_handshaker_req_set_in_bytes().");
|
338
|
-
return false;
|
339
|
-
}
|
340
|
-
grpc_slice* slice = create_slice(in_bytes, size);
|
341
|
-
if (req->has_next) {
|
342
|
-
req->next.in_bytes.arg = slice;
|
343
|
-
req->next.in_bytes.funcs.encode = &encode_string_or_bytes_cb;
|
344
|
-
} else {
|
345
|
-
req->server_start.in_bytes.arg = slice;
|
346
|
-
req->server_start.in_bytes.funcs.encode = &encode_string_or_bytes_cb;
|
347
|
-
}
|
348
|
-
return true;
|
349
|
-
}
|
350
|
-
|
351
|
-
static grpc_gcp_server_handshake_parameters* server_start_find_param(
|
352
|
-
grpc_gcp_handshaker_req* req, int32_t key) {
|
353
|
-
size_t i = 0;
|
354
|
-
for (i = 0; i < req->server_start.handshake_parameters_count; i++) {
|
355
|
-
if (req->server_start.handshake_parameters[i].key == key) {
|
356
|
-
return &req->server_start.handshake_parameters[i].value;
|
357
|
-
}
|
358
|
-
}
|
359
|
-
req->server_start
|
360
|
-
.handshake_parameters[req->server_start.handshake_parameters_count]
|
361
|
-
.has_key = true;
|
362
|
-
req->server_start
|
363
|
-
.handshake_parameters[req->server_start.handshake_parameters_count]
|
364
|
-
.has_value = true;
|
365
|
-
req->server_start
|
366
|
-
.handshake_parameters[req->server_start.handshake_parameters_count++]
|
367
|
-
.key = key;
|
368
|
-
return &req->server_start
|
369
|
-
.handshake_parameters
|
370
|
-
[req->server_start.handshake_parameters_count - 1]
|
371
|
-
.value;
|
372
|
-
}
|
373
|
-
|
374
|
-
bool grpc_gcp_handshaker_req_param_add_record_protocol(
|
375
|
-
grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
|
376
|
-
const char* record_protocol) {
|
377
|
-
if (req == nullptr || record_protocol == nullptr || !req->has_server_start) {
|
378
|
-
gpr_log(GPR_ERROR,
|
379
|
-
"Invalid arguments to "
|
380
|
-
"grpc_gcp_handshaker_req_param_add_record_protocol().");
|
381
|
-
return false;
|
382
|
-
}
|
383
|
-
grpc_gcp_server_handshake_parameters* param =
|
384
|
-
server_start_find_param(req, key);
|
385
|
-
grpc_slice* slice = create_slice(record_protocol, strlen(record_protocol));
|
386
|
-
add_repeated_field(
|
387
|
-
reinterpret_cast<repeated_field**>(¶m->record_protocols.arg), slice);
|
388
|
-
param->record_protocols.funcs.encode = &encode_repeated_string_cb;
|
389
|
-
return true;
|
390
|
-
}
|
391
|
-
|
392
|
-
bool grpc_gcp_handshaker_req_param_add_local_identity_hostname(
|
393
|
-
grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
|
394
|
-
const char* hostname) {
|
395
|
-
if (req == nullptr || hostname == nullptr || !req->has_server_start) {
|
396
|
-
gpr_log(GPR_ERROR,
|
397
|
-
"Invalid arguments to "
|
398
|
-
"grpc_gcp_handshaker_req_param_add_local_identity_hostname().");
|
399
|
-
return false;
|
400
|
-
}
|
401
|
-
grpc_gcp_server_handshake_parameters* param =
|
402
|
-
server_start_find_param(req, key);
|
403
|
-
grpc_gcp_identity* local_identity =
|
404
|
-
static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*local_identity)));
|
405
|
-
set_identity_hostname(local_identity, hostname);
|
406
|
-
add_repeated_field(
|
407
|
-
reinterpret_cast<repeated_field**>(¶m->local_identities.arg),
|
408
|
-
local_identity);
|
409
|
-
param->local_identities.funcs.encode = &encode_repeated_identity_cb;
|
410
|
-
return true;
|
411
|
-
}
|
412
|
-
|
413
|
-
bool grpc_gcp_handshaker_req_param_add_local_identity_service_account(
|
414
|
-
grpc_gcp_handshaker_req* req, grpc_gcp_handshake_protocol key,
|
415
|
-
const char* service_account) {
|
416
|
-
if (req == nullptr || service_account == nullptr || !req->has_server_start) {
|
417
|
-
gpr_log(
|
418
|
-
GPR_ERROR,
|
419
|
-
"Invalid arguments to "
|
420
|
-
"grpc_gcp_handshaker_req_param_add_local_identity_service_account().");
|
421
|
-
return false;
|
422
|
-
}
|
423
|
-
grpc_gcp_server_handshake_parameters* param =
|
424
|
-
server_start_find_param(req, key);
|
425
|
-
grpc_gcp_identity* local_identity =
|
426
|
-
static_cast<grpc_gcp_identity*>(gpr_zalloc(sizeof(*local_identity)));
|
427
|
-
set_identity_service_account(local_identity, service_account);
|
428
|
-
add_repeated_field(
|
429
|
-
reinterpret_cast<repeated_field**>(¶m->local_identities.arg),
|
430
|
-
local_identity);
|
431
|
-
param->local_identities.funcs.encode = &encode_repeated_identity_cb;
|
432
|
-
return true;
|
433
|
-
}
|
434
|
-
|
435
|
-
bool grpc_gcp_handshaker_req_encode(grpc_gcp_handshaker_req* req,
|
436
|
-
grpc_slice* slice) {
|
437
|
-
if (req == nullptr || slice == nullptr) {
|
438
|
-
gpr_log(GPR_ERROR,
|
439
|
-
"Invalid nullptr arguments to grpc_gcp_handshaker_req_encode().");
|
440
|
-
return false;
|
441
|
-
}
|
442
|
-
pb_ostream_t size_stream;
|
443
|
-
memset(&size_stream, 0, sizeof(pb_ostream_t));
|
444
|
-
if (!pb_encode(&size_stream, grpc_gcp_HandshakerReq_fields, req)) {
|
445
|
-
gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&size_stream));
|
446
|
-
return false;
|
447
|
-
}
|
448
|
-
size_t encoded_length = size_stream.bytes_written;
|
449
|
-
*slice = grpc_slice_malloc(encoded_length);
|
450
|
-
pb_ostream_t output_stream =
|
451
|
-
pb_ostream_from_buffer(GRPC_SLICE_START_PTR(*slice), encoded_length);
|
452
|
-
if (!pb_encode(&output_stream, grpc_gcp_HandshakerReq_fields, req) != 0) {
|
453
|
-
gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&output_stream));
|
454
|
-
return false;
|
455
|
-
}
|
456
|
-
return true;
|
457
|
-
}
|
458
|
-
|
459
|
-
/* HandshakerResp. */
|
460
|
-
grpc_gcp_handshaker_resp* grpc_gcp_handshaker_resp_create(void) {
|
461
|
-
grpc_gcp_handshaker_resp* resp =
|
462
|
-
static_cast<grpc_gcp_handshaker_resp*>(gpr_zalloc(sizeof(*resp)));
|
463
|
-
return resp;
|
464
|
-
}
|
465
|
-
|
466
|
-
void grpc_gcp_handshaker_resp_destroy(grpc_gcp_handshaker_resp* resp) {
|
467
|
-
if (resp != nullptr) {
|
468
|
-
destroy_slice(static_cast<grpc_slice*>(resp->out_frames.arg));
|
469
|
-
if (resp->has_status) {
|
470
|
-
destroy_slice(static_cast<grpc_slice*>(resp->status.details.arg));
|
471
|
-
}
|
472
|
-
if (resp->has_result) {
|
473
|
-
destroy_slice(
|
474
|
-
static_cast<grpc_slice*>(resp->result.application_protocol.arg));
|
475
|
-
destroy_slice(static_cast<grpc_slice*>(resp->result.record_protocol.arg));
|
476
|
-
destroy_slice(static_cast<grpc_slice*>(resp->result.key_data.arg));
|
477
|
-
if (resp->result.has_local_identity) {
|
478
|
-
destroy_slice(
|
479
|
-
static_cast<grpc_slice*>(resp->result.local_identity.hostname.arg));
|
480
|
-
destroy_slice(static_cast<grpc_slice*>(
|
481
|
-
resp->result.local_identity.service_account.arg));
|
482
|
-
}
|
483
|
-
if (resp->result.has_peer_identity) {
|
484
|
-
destroy_slice(
|
485
|
-
static_cast<grpc_slice*>(resp->result.peer_identity.hostname.arg));
|
486
|
-
destroy_slice(static_cast<grpc_slice*>(
|
487
|
-
resp->result.peer_identity.service_account.arg));
|
488
|
-
}
|
489
|
-
}
|
490
|
-
gpr_free(resp);
|
491
|
-
}
|
492
|
-
}
|
493
|
-
|
494
|
-
bool grpc_gcp_handshaker_resp_decode(grpc_slice encoded_handshaker_resp,
|
495
|
-
grpc_gcp_handshaker_resp* resp) {
|
496
|
-
if (resp == nullptr) {
|
497
|
-
gpr_log(GPR_ERROR,
|
498
|
-
"Invalid nullptr argument to grpc_gcp_handshaker_resp_decode().");
|
499
|
-
return false;
|
500
|
-
}
|
501
|
-
pb_istream_t stream =
|
502
|
-
pb_istream_from_buffer(GRPC_SLICE_START_PTR(encoded_handshaker_resp),
|
503
|
-
GRPC_SLICE_LENGTH(encoded_handshaker_resp));
|
504
|
-
resp->out_frames.funcs.decode = decode_string_or_bytes_cb;
|
505
|
-
resp->status.details.funcs.decode = decode_string_or_bytes_cb;
|
506
|
-
resp->result.application_protocol.funcs.decode = decode_string_or_bytes_cb;
|
507
|
-
resp->result.record_protocol.funcs.decode = decode_string_or_bytes_cb;
|
508
|
-
resp->result.key_data.funcs.decode = decode_string_or_bytes_cb;
|
509
|
-
resp->result.peer_identity.hostname.funcs.decode = decode_string_or_bytes_cb;
|
510
|
-
resp->result.peer_identity.service_account.funcs.decode =
|
511
|
-
decode_string_or_bytes_cb;
|
512
|
-
resp->result.local_identity.hostname.funcs.decode = decode_string_or_bytes_cb;
|
513
|
-
resp->result.local_identity.service_account.funcs.decode =
|
514
|
-
decode_string_or_bytes_cb;
|
515
|
-
if (!pb_decode(&stream, grpc_gcp_HandshakerResp_fields, resp)) {
|
516
|
-
gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
|
517
|
-
return false;
|
518
|
-
}
|
519
|
-
return true;
|
520
|
-
}
|