diff --git a/.gitmodules b/.gitmodules index f4690a2687f..6443f8362aa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -42,8 +42,8 @@ path = third_party/libcxx url = https://github.com/llvm-mirror/libcxx.git branch = release_60 -[submodule "third_party/data-plane-api"] - path = third_party/data-plane-api +[submodule "third_party/envoy-api"] + path = third_party/envoy-api url = https://github.com/envoyproxy/data-plane-api.git [submodule "third_party/googleapis"] path = third_party/googleapis @@ -53,4 +53,4 @@ url = https://github.com/envoyproxy/protoc-gen-validate.git [submodule "third_party/upb"] path = third_party/upb - url = https://github.com/google/upb.git + url = https://github.com/protocolbuffers/upb.git diff --git a/BUILD b/BUILD index 474fc053ad6..6b51f07b82f 100644 --- a/BUILD +++ b/BUILD @@ -30,6 +30,7 @@ load( "//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_generate_one_off_targets", + "grpc_upb_proto_library", ) config_setting( @@ -136,7 +137,7 @@ GRPCXX_SRCS = [ "src/cpp/common/resource_quota_cc.cc", "src/cpp/common/rpc_method.cc", "src/cpp/common/version_cc.cc", - "src/cpp/common/validate_service_config.cc", + "src/cpp/common/validate_service_config.cc", "src/cpp/server/async_generic_service.cc", "src/cpp/server/channel_argument_option.cc", "src/cpp/server/create_default_thread_pool.cc", @@ -292,7 +293,7 @@ GRPCXX_PUBLIC_HDRS = [ "include/grpcpp/support/sync_stream.h", "include/grpcpp/support/sync_stream_impl.h", "include/grpcpp/support/time.h", - "include/grpcpp/support/validate_service_config.h", + "include/grpcpp/support/validate_service_config.h", ] grpc_cc_library( @@ -341,20 +342,6 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "grpc_cronet", - srcs = [ - "src/core/lib/surface/init.cc", - "src/core/plugin_registry/grpc_cronet_plugin_registry.cc", - ], - language = "c++", - deps = [ - "grpc_base", - "grpc_http_filters", - "grpc_transport_chttp2_client_secure", - "grpc_transport_cronet_client_secure", - ], -) grpc_cc_library( name = "grpc++_public_hdrs", @@ -998,6 +985,7 @@ grpc_cc_library( "grpc_client_authority_filter", "grpc_lb_policy_pick_first", "grpc_lb_policy_round_robin", + "grpc_client_idle_filter", "grpc_max_age_filter", "grpc_message_size_filter", "grpc_resolver_dns_ares", @@ -1085,6 +1073,17 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "grpc_client_idle_filter", + srcs = [ + "src/core/ext/filters/client_idle/client_idle_filter.cc", + ], + language = "c++", + deps = [ + "grpc_base", + ], +) + grpc_cc_library( name = "grpc_max_age_filter", srcs = [ @@ -1823,29 +1822,6 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "grpc_transport_cronet_client_secure", - srcs = [ - "src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc", - "src/core/ext/transport/cronet/transport/cronet_api_dummy.cc", - "src/core/ext/transport/cronet/transport/cronet_transport.cc", - ], - hdrs = [ - "src/core/ext/transport/cronet/transport/cronet_transport.h", - "third_party/objective_c/Cronet/bidirectional_stream_c.h", - ], - language = "c++", - public_hdrs = [ - "include/grpc/grpc_cronet.h", - "include/grpc/grpc_security.h", - "include/grpc/grpc_security_constants.h", - ], - deps = [ - "grpc_base", - "grpc_transport_chttp2", - ], -) - grpc_cc_library( name = "grpc_transport_inproc", srcs = [ @@ -2300,166 +2276,60 @@ grpc_cc_library( ], ) +grpc_upb_proto_library( + name = "upb_load_report", + deps = ["@envoy_api//envoy/api/v2/endpoint:load_report_export"] +) + +grpc_upb_proto_library( + name = "upb_lrs", + deps = ["@envoy_api//envoy/service/load_stats/v2:lrs_export"] +) + +grpc_upb_proto_library( + name = "upb_cds", + deps = ["@envoy_api//envoy/api/v2:cds_export"] +) + #TODO: Get this into build.yaml once we start using it. grpc_cc_library( name = "envoy_lrs_upb", - srcs = [ - "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c", - "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c", - ], - hdrs = [ - "src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h", - "src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h", - ], language = "c++", external_deps = [ "upb_lib", ], deps = [ - ":envoy_core_upb", - ":google_api_upb", - ":proto_gen_validate_upb", + ":upb_load_report", + ":upb_lrs" ], tags = ["no_windows"], ) grpc_cc_library( name = "envoy_ads_upb", - srcs = [ - "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/cds.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/eds.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c", - "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c", - ], - hdrs = [ - "src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cds.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/eds.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h", - "src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h", - ], external_deps = [ "upb_lib", ], language = "c++", deps = [ - ":envoy_core_upb", - ":envoy_type_upb", - ":google_api_upb", - ":proto_gen_validate_upb", + ":upb_cds", ], tags = ["no_windows"], ) -grpc_cc_library( - name = "envoy_core_upb", - srcs = [ - "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c", - "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c", - ], - hdrs = [ - "src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h", - "src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h", - ], - external_deps = [ - "upb_lib", - ], - language = "c++", - tags = ["no_windows"], - deps = [ - ":envoy_type_upb", - ":google_api_upb", - ":proto_gen_validate_upb", - ], -) - -grpc_cc_library( - name = "envoy_type_upb", - srcs = [ - "src/core/ext/upb-generated/envoy/type/percent.upb.c", - "src/core/ext/upb-generated/envoy/type/range.upb.c", - ], - hdrs = [ - "src/core/ext/upb-generated/envoy/type/percent.upb.h", - "src/core/ext/upb-generated/envoy/type/range.upb.h", - ], - external_deps = [ - "upb_lib", - ], - language = "c++", - tags = ["no_windows"], - deps = [ - ":google_api_upb", - ":proto_gen_validate_upb", - ], +grpc_upb_proto_library( + name = "grpc_health_upb", + deps = ["//src/proto/grpc/health/v1:health_proto_descriptor"] ) -grpc_cc_library( - name = "proto_gen_validate_upb", - srcs = [ - "src/core/ext/upb-generated/gogoproto/gogo.upb.c", - "src/core/ext/upb-generated/validate/validate.upb.c", - ], - hdrs = [ - "src/core/ext/upb-generated/gogoproto/gogo.upb.h", - "src/core/ext/upb-generated/validate/validate.upb.h", - ], - external_deps = [ - "upb_lib", - ], - language = "c++", - tags = ["no_windows"], - deps = [ - ":google_api_upb", - ], +grpc_upb_proto_library( + name = "grpc_lb_upb", + deps = ["//src/proto/grpc/lb/v1:load_balancer_proto_descriptor"] ) -grpc_cc_library( - name = "google_api_upb", - srcs = [ - "src/core/ext/upb-generated/google/api/annotations.upb.c", - "src/core/ext/upb-generated/google/api/http.upb.c", - "src/core/ext/upb-generated/google/protobuf/any.upb.c", - "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", - "src/core/ext/upb-generated/google/protobuf/duration.upb.c", - "src/core/ext/upb-generated/google/protobuf/empty.upb.c", - "src/core/ext/upb-generated/google/protobuf/struct.upb.c", - "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", - "src/core/ext/upb-generated/google/rpc/status.upb.c", - ], - hdrs = [ - "src/core/ext/upb-generated/google/api/annotations.upb.h", - "src/core/ext/upb-generated/google/api/http.upb.h", - "src/core/ext/upb-generated/google/protobuf/any.upb.h", - "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", - "src/core/ext/upb-generated/google/protobuf/duration.upb.h", - "src/core/ext/upb-generated/google/protobuf/empty.upb.h", - "src/core/ext/upb-generated/google/protobuf/struct.upb.h", - "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", - "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h", - "src/core/ext/upb-generated/google/rpc/status.upb.h", - ], - external_deps = [ - "upb_lib", - ], - language = "c++", - tags = ["no_windows"], +grpc_upb_proto_library( + name = "alts_upb", + deps = ["//src/proto/grpc/gcp:alts_handshaker_proto"] ) grpc_generate_one_off_targets() diff --git a/BUILD.gn b/BUILD.gn index 9dacd14bb45..83cc1ec4bda 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -348,6 +348,7 @@ config("grpc_config") { "src/core/ext/filters/client_channel/subchannel_interface.h", "src/core/ext/filters/client_channel/subchannel_pool_interface.cc", "src/core/ext/filters/client_channel/subchannel_pool_interface.h", + "src/core/ext/filters/client_idle/client_idle_filter.cc", "src/core/ext/filters/deadline/deadline_filter.cc", "src/core/ext/filters/deadline/deadline_filter.h", "src/core/ext/filters/http/client/http_client_filter.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 23305ce6fd9..12b2707f951 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,6 +595,9 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx bm_pollset) endif() if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) +add_dependencies(buildtests_cxx bm_threadpool) +endif() +if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx bm_timer) endif() add_dependencies(buildtests_cxx byte_stream_test) @@ -1326,6 +1329,7 @@ add_library(grpc src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc src/core/ext/filters/census/grpc_context.cc + src/core/ext/filters/client_idle/client_idle_filter.cc src/core/ext/filters/max_age/max_age_filter.cc src/core/ext/filters/message_size/message_size_filter.cc src/core/ext/filters/http/client_authority_filter.cc @@ -1433,6 +1437,7 @@ endif() add_library(grpc_cronet + src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc src/core/lib/surface/init.cc src/core/lib/avl/avl.cc src/core/lib/backoff/backoff.cc @@ -1734,7 +1739,6 @@ add_library(grpc_cronet src/core/tsi/ssl/session_cache/ssl_session_openssl.cc src/core/tsi/ssl_transport_security.cc src/core/tsi/transport_security_grpc.cc - src/core/plugin_registry/grpc_cronet_plugin_registry.cc ) if(WIN32 AND MSVC) @@ -2757,6 +2761,7 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc src/core/ext/filters/census/grpc_context.cc + src/core/ext/filters/client_idle/client_idle_filter.cc src/core/ext/filters/max_age/max_age_filter.cc src/core/ext/filters/message_size/message_size_filter.cc src/core/ext/filters/http/client_authority_filter.cc @@ -2959,800 +2964,167 @@ add_library(bm_callback_test_service_impl ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_mock.grpc.pb.h - test/cpp/microbenchmarks/callback_test_service.cc -) - -if(WIN32 AND MSVC) - set_target_properties(bm_callback_test_service_impl PROPERTIES COMPILE_PDB_NAME "bm_callback_test_service_impl" - COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" - ) - if (gRPC_INSTALL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bm_callback_test_service_impl.pdb - DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL - ) - endif() -endif() - -protobuf_generate_grpc_cpp( - src/proto/grpc/testing/echo.proto -) - -target_include_directories(bm_callback_test_service_impl - PUBLIC $ $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE third_party/googletest/googletest/include - PRIVATE third_party/googletest/googletest - PRIVATE third_party/googletest/googlemock/include - PRIVATE third_party/googletest/googlemock - PRIVATE ${_gRPC_PROTO_GENS_DIR} -) -target_link_libraries(bm_callback_test_service_impl - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc_benchmark - ${_gRPC_BENCHMARK_LIBRARIES} - grpc++_test_util_unsecure - grpc_test_util_unsecure - grpc++_unsecure - grpc_unsecure - gpr - grpc++_test_config - ${_gRPC_GFLAGS_LIBRARIES} -) - -endif (gRPC_BUILD_CODEGEN) - -endif (gRPC_BUILD_TESTS) -if (gRPC_BUILD_TESTS) - -add_library(dns_test_util - test/cpp/naming/dns_test_util.cc -) - -if(WIN32 AND MSVC) - set_target_properties(dns_test_util PROPERTIES COMPILE_PDB_NAME "dns_test_util" - COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" - ) - if (gRPC_INSTALL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dns_test_util.pdb - DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL - ) - endif() -endif() - - -target_include_directories(dns_test_util - PUBLIC $ $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE third_party/googletest/googletest/include - PRIVATE third_party/googletest/googletest - PRIVATE third_party/googletest/googlemock/include - PRIVATE third_party/googletest/googlemock - PRIVATE ${_gRPC_PROTO_GENS_DIR} -) -target_link_libraries(dns_test_util - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - ${_gRPC_GFLAGS_LIBRARIES} -) - - -endif (gRPC_BUILD_TESTS) - -add_library(grpc++ - src/cpp/client/insecure_credentials.cc - src/cpp/client/secure_credentials.cc - src/cpp/common/auth_property_iterator.cc - src/cpp/common/secure_auth_context.cc - src/cpp/common/secure_channel_arguments.cc - src/cpp/common/secure_create_auth_context.cc - src/cpp/server/insecure_server_credentials.cc - src/cpp/server/secure_server_credentials.cc - src/cpp/client/channel_cc.cc - src/cpp/client/client_context.cc - src/cpp/client/client_interceptor.cc - src/cpp/client/create_channel.cc - src/cpp/client/create_channel_internal.cc - src/cpp/client/create_channel_posix.cc - src/cpp/client/credentials_cc.cc - src/cpp/client/generic_stub.cc - src/cpp/common/alarm.cc - src/cpp/common/channel_arguments.cc - src/cpp/common/channel_filter.cc - src/cpp/common/completion_queue_cc.cc - src/cpp/common/core_codegen.cc - src/cpp/common/resource_quota_cc.cc - src/cpp/common/rpc_method.cc - src/cpp/common/validate_service_config.cc - src/cpp/common/version_cc.cc - src/cpp/server/async_generic_service.cc - src/cpp/server/channel_argument_option.cc - src/cpp/server/create_default_thread_pool.cc - src/cpp/server/dynamic_thread_pool.cc - src/cpp/server/external_connection_acceptor_impl.cc - src/cpp/server/health/default_health_check_service.cc - src/cpp/server/health/health_check_service.cc - src/cpp/server/health/health_check_service_server_builder_option.cc - src/cpp/server/server_builder.cc - src/cpp/server/server_cc.cc - src/cpp/server/server_context.cc - src/cpp/server/server_credentials.cc - src/cpp/server/server_posix.cc - src/cpp/thread_manager/thread_manager.cc - src/cpp/util/byte_buffer_cc.cc - src/cpp/util/status.cc - src/cpp/util/string_ref.cc - src/cpp/util/time_cc.cc - src/core/ext/filters/client_channel/health/health.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c - src/cpp/codegen/codegen_init.cc -) - -if(WIN32 AND MSVC) - set_target_properties(grpc++ PROPERTIES COMPILE_PDB_NAME "grpc++" - COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" - ) - if (gRPC_INSTALL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++.pdb - DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL - ) - endif() -endif() - - -target_include_directories(grpc++ - PUBLIC $ $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTO_GENS_DIR} -) -target_link_libraries(grpc++ - ${_gRPC_BASELIB_LIBRARIES} - ${_gRPC_SSL_LIBRARIES} - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc - gpr -) - -foreach(_hdr - include/grpc++/alarm.h - include/grpc++/channel.h - include/grpc++/client_context.h - include/grpc++/completion_queue.h - include/grpc++/create_channel.h - include/grpc++/create_channel_posix.h - include/grpc++/ext/health_check_service_server_builder_option.h - include/grpc++/generic/async_generic_service.h - include/grpc++/generic/generic_stub.h - include/grpc++/grpc++.h - include/grpc++/health_check_service_interface.h - include/grpc++/impl/call.h - include/grpc++/impl/channel_argument_option.h - include/grpc++/impl/client_unary_call.h - include/grpc++/impl/codegen/core_codegen.h - include/grpc++/impl/grpc_library.h - include/grpc++/impl/method_handler_impl.h - include/grpc++/impl/rpc_method.h - include/grpc++/impl/rpc_service_method.h - include/grpc++/impl/serialization_traits.h - include/grpc++/impl/server_builder_option.h - include/grpc++/impl/server_builder_plugin.h - include/grpc++/impl/server_initializer.h - include/grpc++/impl/service_type.h - include/grpc++/resource_quota.h - include/grpc++/security/auth_context.h - include/grpc++/security/auth_metadata_processor.h - include/grpc++/security/credentials.h - include/grpc++/security/server_credentials.h - include/grpc++/server.h - include/grpc++/server_builder.h - include/grpc++/server_context.h - include/grpc++/server_posix.h - include/grpc++/support/async_stream.h - include/grpc++/support/async_unary_call.h - include/grpc++/support/byte_buffer.h - include/grpc++/support/channel_arguments.h - include/grpc++/support/config.h - include/grpc++/support/slice.h - include/grpc++/support/status.h - include/grpc++/support/status_code_enum.h - include/grpc++/support/string_ref.h - include/grpc++/support/stub_options.h - include/grpc++/support/sync_stream.h - include/grpc++/support/time.h - include/grpcpp/alarm.h - include/grpcpp/alarm_impl.h - include/grpcpp/channel.h - include/grpcpp/channel_impl.h - include/grpcpp/client_context.h - include/grpcpp/completion_queue.h - include/grpcpp/completion_queue_impl.h - include/grpcpp/create_channel.h - include/grpcpp/create_channel_impl.h - include/grpcpp/create_channel_posix.h - include/grpcpp/create_channel_posix_impl.h - include/grpcpp/ext/health_check_service_server_builder_option.h - include/grpcpp/generic/async_generic_service.h - include/grpcpp/generic/generic_stub.h - include/grpcpp/generic/generic_stub_impl.h - include/grpcpp/grpcpp.h - include/grpcpp/health_check_service_interface.h - include/grpcpp/health_check_service_interface_impl.h - include/grpcpp/impl/call.h - include/grpcpp/impl/channel_argument_option.h - include/grpcpp/impl/client_unary_call.h - include/grpcpp/impl/codegen/core_codegen.h - include/grpcpp/impl/grpc_library.h - include/grpcpp/impl/method_handler_impl.h - include/grpcpp/impl/rpc_method.h - include/grpcpp/impl/rpc_service_method.h - include/grpcpp/impl/serialization_traits.h - include/grpcpp/impl/server_builder_option.h - include/grpcpp/impl/server_builder_option_impl.h - include/grpcpp/impl/server_builder_plugin.h - include/grpcpp/impl/server_initializer.h - include/grpcpp/impl/server_initializer_impl.h - include/grpcpp/impl/service_type.h - include/grpcpp/resource_quota.h - include/grpcpp/resource_quota_impl.h - include/grpcpp/security/auth_context.h - include/grpcpp/security/auth_metadata_processor.h - include/grpcpp/security/auth_metadata_processor_impl.h - include/grpcpp/security/credentials.h - include/grpcpp/security/credentials_impl.h - include/grpcpp/security/server_credentials.h - include/grpcpp/security/server_credentials_impl.h - include/grpcpp/server.h - include/grpcpp/server_builder.h - include/grpcpp/server_builder_impl.h - include/grpcpp/server_context.h - include/grpcpp/server_impl.h - include/grpcpp/server_posix.h - include/grpcpp/server_posix_impl.h - include/grpcpp/support/async_stream.h - include/grpcpp/support/async_stream_impl.h - include/grpcpp/support/async_unary_call.h - include/grpcpp/support/async_unary_call_impl.h - include/grpcpp/support/byte_buffer.h - include/grpcpp/support/channel_arguments.h - include/grpcpp/support/channel_arguments_impl.h - include/grpcpp/support/client_callback.h - include/grpcpp/support/client_callback_impl.h - include/grpcpp/support/client_interceptor.h - include/grpcpp/support/config.h - include/grpcpp/support/interceptor.h - include/grpcpp/support/message_allocator.h - include/grpcpp/support/proto_buffer_reader.h - include/grpcpp/support/proto_buffer_writer.h - include/grpcpp/support/server_callback.h - include/grpcpp/support/server_callback_impl.h - include/grpcpp/support/server_interceptor.h - include/grpcpp/support/slice.h - include/grpcpp/support/status.h - include/grpcpp/support/status_code_enum.h - include/grpcpp/support/string_ref.h - include/grpcpp/support/stub_options.h - include/grpcpp/support/sync_stream.h - include/grpcpp/support/sync_stream_impl.h - include/grpcpp/support/time.h - include/grpcpp/support/validate_service_config.h - include/grpc/support/alloc.h - include/grpc/support/atm.h - include/grpc/support/atm_gcc_atomic.h - include/grpc/support/atm_gcc_sync.h - include/grpc/support/atm_windows.h - include/grpc/support/cpu.h - include/grpc/support/log.h - include/grpc/support/log_windows.h - include/grpc/support/port_platform.h - include/grpc/support/string_util.h - include/grpc/support/sync.h - include/grpc/support/sync_custom.h - include/grpc/support/sync_generic.h - include/grpc/support/sync_posix.h - include/grpc/support/sync_windows.h - include/grpc/support/thd_id.h - include/grpc/support/time.h - include/grpc/impl/codegen/atm.h - include/grpc/impl/codegen/atm_gcc_atomic.h - include/grpc/impl/codegen/atm_gcc_sync.h - include/grpc/impl/codegen/atm_windows.h - include/grpc/impl/codegen/fork.h - include/grpc/impl/codegen/gpr_slice.h - include/grpc/impl/codegen/gpr_types.h - include/grpc/impl/codegen/log.h - include/grpc/impl/codegen/port_platform.h - include/grpc/impl/codegen/sync.h - include/grpc/impl/codegen/sync_custom.h - include/grpc/impl/codegen/sync_generic.h - include/grpc/impl/codegen/sync_posix.h - include/grpc/impl/codegen/sync_windows.h - include/grpc/byte_buffer.h - include/grpc/byte_buffer_reader.h - include/grpc/compression.h - include/grpc/fork.h - include/grpc/grpc.h - include/grpc/grpc_posix.h - include/grpc/grpc_security_constants.h - include/grpc/load_reporting.h - include/grpc/slice.h - include/grpc/slice_buffer.h - include/grpc/status.h - include/grpc/support/workaround_list.h - include/grpc/impl/codegen/byte_buffer.h - include/grpc/impl/codegen/byte_buffer_reader.h - include/grpc/impl/codegen/compression_types.h - include/grpc/impl/codegen/connectivity_state.h - include/grpc/impl/codegen/grpc_types.h - include/grpc/impl/codegen/propagation_bits.h - include/grpc/impl/codegen/slice.h - include/grpc/impl/codegen/status.h - include/grpc++/impl/codegen/async_stream.h - include/grpc++/impl/codegen/async_unary_call.h - include/grpc++/impl/codegen/byte_buffer.h - include/grpc++/impl/codegen/call.h - include/grpc++/impl/codegen/call_hook.h - include/grpc++/impl/codegen/channel_interface.h - include/grpc++/impl/codegen/client_context.h - include/grpc++/impl/codegen/client_unary_call.h - include/grpc++/impl/codegen/completion_queue.h - include/grpc++/impl/codegen/completion_queue_tag.h - include/grpc++/impl/codegen/config.h - include/grpc++/impl/codegen/core_codegen_interface.h - include/grpc++/impl/codegen/create_auth_context.h - include/grpc++/impl/codegen/grpc_library.h - include/grpc++/impl/codegen/metadata_map.h - include/grpc++/impl/codegen/method_handler_impl.h - include/grpc++/impl/codegen/rpc_method.h - include/grpc++/impl/codegen/rpc_service_method.h - include/grpc++/impl/codegen/security/auth_context.h - include/grpc++/impl/codegen/serialization_traits.h - include/grpc++/impl/codegen/server_context.h - include/grpc++/impl/codegen/server_interface.h - include/grpc++/impl/codegen/service_type.h - include/grpc++/impl/codegen/slice.h - include/grpc++/impl/codegen/status.h - include/grpc++/impl/codegen/status_code_enum.h - include/grpc++/impl/codegen/string_ref.h - include/grpc++/impl/codegen/stub_options.h - include/grpc++/impl/codegen/sync_stream.h - include/grpc++/impl/codegen/time.h - include/grpcpp/impl/codegen/async_generic_service.h - include/grpcpp/impl/codegen/async_stream.h - include/grpcpp/impl/codegen/async_stream_impl.h - include/grpcpp/impl/codegen/async_unary_call.h - include/grpcpp/impl/codegen/async_unary_call_impl.h - include/grpcpp/impl/codegen/byte_buffer.h - include/grpcpp/impl/codegen/call.h - include/grpcpp/impl/codegen/call_hook.h - include/grpcpp/impl/codegen/call_op_set.h - include/grpcpp/impl/codegen/call_op_set_interface.h - include/grpcpp/impl/codegen/callback_common.h - include/grpcpp/impl/codegen/channel_interface.h - include/grpcpp/impl/codegen/client_callback.h - include/grpcpp/impl/codegen/client_callback_impl.h - include/grpcpp/impl/codegen/client_context.h - include/grpcpp/impl/codegen/client_context_impl.h - include/grpcpp/impl/codegen/client_interceptor.h - include/grpcpp/impl/codegen/client_unary_call.h - include/grpcpp/impl/codegen/completion_queue.h - include/grpcpp/impl/codegen/completion_queue_impl.h - include/grpcpp/impl/codegen/completion_queue_tag.h - include/grpcpp/impl/codegen/config.h - include/grpcpp/impl/codegen/core_codegen_interface.h - include/grpcpp/impl/codegen/create_auth_context.h - include/grpcpp/impl/codegen/grpc_library.h - include/grpcpp/impl/codegen/intercepted_channel.h - include/grpcpp/impl/codegen/interceptor.h - include/grpcpp/impl/codegen/interceptor_common.h - include/grpcpp/impl/codegen/message_allocator.h - include/grpcpp/impl/codegen/metadata_map.h - include/grpcpp/impl/codegen/method_handler_impl.h - include/grpcpp/impl/codegen/rpc_method.h - include/grpcpp/impl/codegen/rpc_service_method.h - include/grpcpp/impl/codegen/security/auth_context.h - include/grpcpp/impl/codegen/serialization_traits.h - include/grpcpp/impl/codegen/server_callback.h - include/grpcpp/impl/codegen/server_callback_impl.h - include/grpcpp/impl/codegen/server_context.h - include/grpcpp/impl/codegen/server_context_impl.h - include/grpcpp/impl/codegen/server_interceptor.h - include/grpcpp/impl/codegen/server_interface.h - include/grpcpp/impl/codegen/service_type.h - include/grpcpp/impl/codegen/slice.h - include/grpcpp/impl/codegen/status.h - include/grpcpp/impl/codegen/status_code_enum.h - include/grpcpp/impl/codegen/string_ref.h - include/grpcpp/impl/codegen/stub_options.h - include/grpcpp/impl/codegen/sync_stream.h - include/grpcpp/impl/codegen/sync_stream_impl.h - include/grpcpp/impl/codegen/time.h - include/grpcpp/impl/codegen/sync.h - include/grpc++/impl/codegen/proto_utils.h - include/grpcpp/impl/codegen/proto_buffer_reader.h - include/grpcpp/impl/codegen/proto_buffer_writer.h - include/grpcpp/impl/codegen/proto_utils.h - include/grpc++/impl/codegen/config_protobuf.h - include/grpcpp/impl/codegen/config_protobuf.h -) - string(REPLACE "include/" "" _path ${_hdr}) - get_filename_component(_path ${_path} PATH) - install(FILES ${_hdr} - DESTINATION "${gRPC_INSTALL_INCLUDEDIR}/${_path}" - ) -endforeach() - - -if (gRPC_INSTALL) - install(TARGETS grpc++ EXPORT gRPCTargets - RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} - LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} - ) -endif() - -if (gRPC_BUILD_TESTS) - -if (gRPC_BUILD_CODEGEN) -add_library(grpc++_core_stats - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/core/stats.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/core/stats.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/core/stats.pb.h - ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/core/stats.grpc.pb.h - src/cpp/util/core_stats.cc -) - -if(WIN32 AND MSVC) - set_target_properties(grpc++_core_stats PROPERTIES COMPILE_PDB_NAME "grpc++_core_stats" - COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" - ) - if (gRPC_INSTALL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_core_stats.pdb - DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL - ) - endif() -endif() - -protobuf_generate_grpc_cpp( - src/proto/grpc/core/stats.proto -) - -target_include_directories(grpc++_core_stats - PUBLIC $ $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE ${_gRPC_SSL_INCLUDE_DIR} - PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} - PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} - PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} - PRIVATE ${_gRPC_CARES_INCLUDE_DIR} - PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} - PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} - PRIVATE third_party/googletest/googletest/include - PRIVATE third_party/googletest/googletest - PRIVATE third_party/googletest/googlemock/include - PRIVATE third_party/googletest/googlemock - PRIVATE ${_gRPC_PROTO_GENS_DIR} -) -target_link_libraries(grpc++_core_stats - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc++ - ${_gRPC_GFLAGS_LIBRARIES} -) - -endif (gRPC_BUILD_CODEGEN) - -endif (gRPC_BUILD_TESTS) - -add_library(grpc++_cronet - src/cpp/client/cronet_credentials.cc - src/cpp/client/insecure_credentials.cc - src/cpp/common/insecure_create_auth_context.cc - src/cpp/server/insecure_server_credentials.cc - src/cpp/client/channel_cc.cc - src/cpp/client/client_context.cc - src/cpp/client/client_interceptor.cc - src/cpp/client/create_channel.cc - src/cpp/client/create_channel_internal.cc - src/cpp/client/create_channel_posix.cc - src/cpp/client/credentials_cc.cc - src/cpp/client/generic_stub.cc - src/cpp/common/alarm.cc - src/cpp/common/channel_arguments.cc - src/cpp/common/channel_filter.cc - src/cpp/common/completion_queue_cc.cc - src/cpp/common/core_codegen.cc - src/cpp/common/resource_quota_cc.cc - src/cpp/common/rpc_method.cc - src/cpp/common/validate_service_config.cc - src/cpp/common/version_cc.cc - src/cpp/server/async_generic_service.cc - src/cpp/server/channel_argument_option.cc - src/cpp/server/create_default_thread_pool.cc - src/cpp/server/dynamic_thread_pool.cc - src/cpp/server/external_connection_acceptor_impl.cc - src/cpp/server/health/default_health_check_service.cc - src/cpp/server/health/health_check_service.cc - src/cpp/server/health/health_check_service_server_builder_option.cc - src/cpp/server/server_builder.cc - src/cpp/server/server_cc.cc - src/cpp/server/server_context.cc - src/cpp/server/server_credentials.cc - src/cpp/server/server_posix.cc - src/cpp/thread_manager/thread_manager.cc - src/cpp/util/byte_buffer_cc.cc - src/cpp/util/status.cc - src/cpp/util/string_ref.cc - src/cpp/util/time_cc.cc - src/core/ext/filters/client_channel/health/health.pb.c - third_party/nanopb/pb_common.c - third_party/nanopb/pb_decode.c - third_party/nanopb/pb_encode.c - src/cpp/codegen/codegen_init.cc - src/core/ext/transport/chttp2/client/insecure/channel_create.cc - src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc - src/core/ext/transport/chttp2/client/authority.cc - src/core/ext/transport/chttp2/client/chttp2_connector.cc - src/core/ext/transport/chttp2/transport/bin_decoder.cc - src/core/ext/transport/chttp2/transport/bin_encoder.cc - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc - src/core/ext/transport/chttp2/transport/chttp2_transport.cc - src/core/ext/transport/chttp2/transport/context_list.cc - src/core/ext/transport/chttp2/transport/flow_control.cc - src/core/ext/transport/chttp2/transport/frame_data.cc - src/core/ext/transport/chttp2/transport/frame_goaway.cc - src/core/ext/transport/chttp2/transport/frame_ping.cc - src/core/ext/transport/chttp2/transport/frame_rst_stream.cc - src/core/ext/transport/chttp2/transport/frame_settings.cc - src/core/ext/transport/chttp2/transport/frame_window_update.cc - src/core/ext/transport/chttp2/transport/hpack_encoder.cc - src/core/ext/transport/chttp2/transport/hpack_parser.cc - src/core/ext/transport/chttp2/transport/hpack_table.cc - src/core/ext/transport/chttp2/transport/http2_settings.cc - src/core/ext/transport/chttp2/transport/huffsyms.cc - src/core/ext/transport/chttp2/transport/incoming_metadata.cc - src/core/ext/transport/chttp2/transport/parsing.cc - src/core/ext/transport/chttp2/transport/stream_lists.cc - src/core/ext/transport/chttp2/transport/stream_map.cc - src/core/ext/transport/chttp2/transport/varint.cc - src/core/ext/transport/chttp2/transport/writing.cc - src/core/lib/avl/avl.cc - src/core/lib/backoff/backoff.cc - src/core/lib/channel/channel_args.cc - src/core/lib/channel/channel_stack.cc - src/core/lib/channel/channel_stack_builder.cc - src/core/lib/channel/channel_trace.cc - src/core/lib/channel/channelz.cc - src/core/lib/channel/channelz_registry.cc - src/core/lib/channel/connected_channel.cc - src/core/lib/channel/handshaker.cc - src/core/lib/channel/handshaker_registry.cc - src/core/lib/channel/status_util.cc - src/core/lib/compression/compression.cc - src/core/lib/compression/compression_args.cc - src/core/lib/compression/compression_internal.cc - src/core/lib/compression/message_compress.cc - src/core/lib/compression/stream_compression.cc - src/core/lib/compression/stream_compression_gzip.cc - src/core/lib/compression/stream_compression_identity.cc - src/core/lib/debug/stats.cc - src/core/lib/debug/stats_data.cc - src/core/lib/http/format_request.cc - src/core/lib/http/httpcli.cc - src/core/lib/http/parser.cc - src/core/lib/iomgr/buffer_list.cc - src/core/lib/iomgr/call_combiner.cc - src/core/lib/iomgr/cfstream_handle.cc - src/core/lib/iomgr/combiner.cc - src/core/lib/iomgr/endpoint.cc - src/core/lib/iomgr/endpoint_cfstream.cc - src/core/lib/iomgr/endpoint_pair_posix.cc - src/core/lib/iomgr/endpoint_pair_uv.cc - src/core/lib/iomgr/endpoint_pair_windows.cc - src/core/lib/iomgr/error.cc - src/core/lib/iomgr/error_cfstream.cc - src/core/lib/iomgr/ev_epoll1_linux.cc - src/core/lib/iomgr/ev_epollex_linux.cc - src/core/lib/iomgr/ev_poll_posix.cc - src/core/lib/iomgr/ev_posix.cc - src/core/lib/iomgr/ev_windows.cc - src/core/lib/iomgr/exec_ctx.cc - src/core/lib/iomgr/executor.cc - src/core/lib/iomgr/executor/mpmcqueue.cc - src/core/lib/iomgr/executor/threadpool.cc - src/core/lib/iomgr/fork_posix.cc - src/core/lib/iomgr/fork_windows.cc - src/core/lib/iomgr/gethostname_fallback.cc - src/core/lib/iomgr/gethostname_host_name_max.cc - src/core/lib/iomgr/gethostname_sysconf.cc - src/core/lib/iomgr/grpc_if_nametoindex_posix.cc - src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc - src/core/lib/iomgr/internal_errqueue.cc - src/core/lib/iomgr/iocp_windows.cc - src/core/lib/iomgr/iomgr.cc - src/core/lib/iomgr/iomgr_custom.cc - src/core/lib/iomgr/iomgr_internal.cc - src/core/lib/iomgr/iomgr_posix.cc - src/core/lib/iomgr/iomgr_posix_cfstream.cc - src/core/lib/iomgr/iomgr_uv.cc - src/core/lib/iomgr/iomgr_windows.cc - src/core/lib/iomgr/is_epollexclusive_available.cc - src/core/lib/iomgr/load_file.cc - src/core/lib/iomgr/lockfree_event.cc - src/core/lib/iomgr/polling_entity.cc - src/core/lib/iomgr/pollset.cc - src/core/lib/iomgr/pollset_custom.cc - src/core/lib/iomgr/pollset_set.cc - src/core/lib/iomgr/pollset_set_custom.cc - src/core/lib/iomgr/pollset_set_windows.cc - src/core/lib/iomgr/pollset_uv.cc - src/core/lib/iomgr/pollset_windows.cc - src/core/lib/iomgr/resolve_address.cc - src/core/lib/iomgr/resolve_address_custom.cc - src/core/lib/iomgr/resolve_address_posix.cc - src/core/lib/iomgr/resolve_address_windows.cc - src/core/lib/iomgr/resource_quota.cc - src/core/lib/iomgr/sockaddr_utils.cc - src/core/lib/iomgr/socket_factory_posix.cc - src/core/lib/iomgr/socket_mutator.cc - src/core/lib/iomgr/socket_utils_common_posix.cc - src/core/lib/iomgr/socket_utils_linux.cc - src/core/lib/iomgr/socket_utils_posix.cc - src/core/lib/iomgr/socket_utils_uv.cc - src/core/lib/iomgr/socket_utils_windows.cc - src/core/lib/iomgr/socket_windows.cc - src/core/lib/iomgr/tcp_client.cc - src/core/lib/iomgr/tcp_client_cfstream.cc - src/core/lib/iomgr/tcp_client_custom.cc - src/core/lib/iomgr/tcp_client_posix.cc - src/core/lib/iomgr/tcp_client_windows.cc - src/core/lib/iomgr/tcp_custom.cc - src/core/lib/iomgr/tcp_posix.cc - src/core/lib/iomgr/tcp_server.cc - src/core/lib/iomgr/tcp_server_custom.cc - src/core/lib/iomgr/tcp_server_posix.cc - src/core/lib/iomgr/tcp_server_utils_posix_common.cc - src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc - src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc - src/core/lib/iomgr/tcp_server_windows.cc - src/core/lib/iomgr/tcp_uv.cc - src/core/lib/iomgr/tcp_windows.cc - src/core/lib/iomgr/time_averaged_stats.cc - src/core/lib/iomgr/timer.cc - src/core/lib/iomgr/timer_custom.cc - src/core/lib/iomgr/timer_generic.cc - src/core/lib/iomgr/timer_heap.cc - src/core/lib/iomgr/timer_manager.cc - src/core/lib/iomgr/timer_uv.cc - src/core/lib/iomgr/udp_server.cc - src/core/lib/iomgr/unix_sockets_posix.cc - src/core/lib/iomgr/unix_sockets_posix_noop.cc - src/core/lib/iomgr/wakeup_fd_eventfd.cc - src/core/lib/iomgr/wakeup_fd_nospecial.cc - src/core/lib/iomgr/wakeup_fd_pipe.cc - src/core/lib/iomgr/wakeup_fd_posix.cc - src/core/lib/json/json.cc - src/core/lib/json/json_reader.cc - src/core/lib/json/json_string.cc - src/core/lib/json/json_writer.cc - src/core/lib/slice/b64.cc - src/core/lib/slice/percent_encoding.cc - src/core/lib/slice/slice.cc - src/core/lib/slice/slice_buffer.cc - src/core/lib/slice/slice_intern.cc - src/core/lib/slice/slice_string_helpers.cc - src/core/lib/surface/api_trace.cc - src/core/lib/surface/byte_buffer.cc - src/core/lib/surface/byte_buffer_reader.cc - src/core/lib/surface/call.cc - src/core/lib/surface/call_details.cc - src/core/lib/surface/call_log_batch.cc - src/core/lib/surface/channel.cc - src/core/lib/surface/channel_init.cc - src/core/lib/surface/channel_ping.cc - src/core/lib/surface/channel_stack_type.cc - src/core/lib/surface/completion_queue.cc - src/core/lib/surface/completion_queue_factory.cc - src/core/lib/surface/event_string.cc - src/core/lib/surface/lame_client.cc - src/core/lib/surface/metadata_array.cc - src/core/lib/surface/server.cc - src/core/lib/surface/validate_metadata.cc - src/core/lib/surface/version.cc - src/core/lib/transport/bdp_estimator.cc - src/core/lib/transport/byte_stream.cc - src/core/lib/transport/connectivity_state.cc - src/core/lib/transport/error_utils.cc - src/core/lib/transport/metadata.cc - src/core/lib/transport/metadata_batch.cc - src/core/lib/transport/pid_controller.cc - src/core/lib/transport/static_metadata.cc - src/core/lib/transport/status_conversion.cc - src/core/lib/transport/status_metadata.cc - src/core/lib/transport/timeout_encoding.cc - src/core/lib/transport/transport.cc - src/core/lib/transport/transport_op_string.cc - src/core/lib/uri/uri_parser.cc - src/core/lib/debug/trace.cc - src/core/ext/transport/chttp2/alpn/alpn.cc - src/core/ext/filters/http/client/http_client_filter.cc - src/core/ext/filters/http/http_filters_plugin.cc - src/core/ext/filters/http/message_compress/message_compress_filter.cc - src/core/ext/filters/http/server/http_server_filter.cc - src/core/ext/filters/client_channel/backup_poller.cc - src/core/ext/filters/client_channel/channel_connectivity.cc - src/core/ext/filters/client_channel/client_channel.cc - src/core/ext/filters/client_channel/client_channel_channelz.cc - src/core/ext/filters/client_channel/client_channel_factory.cc - src/core/ext/filters/client_channel/client_channel_plugin.cc - src/core/ext/filters/client_channel/connector.cc - src/core/ext/filters/client_channel/global_subchannel_pool.cc - src/core/ext/filters/client_channel/health/health_check_client.cc - src/core/ext/filters/client_channel/http_connect_handshaker.cc - src/core/ext/filters/client_channel/http_proxy.cc - src/core/ext/filters/client_channel/lb_policy.cc - src/core/ext/filters/client_channel/lb_policy_registry.cc - src/core/ext/filters/client_channel/local_subchannel_pool.cc - src/core/ext/filters/client_channel/parse_address.cc - src/core/ext/filters/client_channel/proxy_mapper.cc - src/core/ext/filters/client_channel/proxy_mapper_registry.cc - src/core/ext/filters/client_channel/resolver.cc - src/core/ext/filters/client_channel/resolver_registry.cc - src/core/ext/filters/client_channel/resolver_result_parsing.cc - src/core/ext/filters/client_channel/resolving_lb_policy.cc - src/core/ext/filters/client_channel/retry_throttle.cc - src/core/ext/filters/client_channel/server_address.cc - src/core/ext/filters/client_channel/service_config.cc - src/core/ext/filters/client_channel/subchannel.cc - src/core/ext/filters/client_channel/subchannel_pool_interface.cc - src/core/ext/filters/deadline/deadline_filter.cc - src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc - src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc - src/core/ext/transport/chttp2/server/chttp2_server.cc - src/core/ext/filters/census/grpc_context.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_mock.grpc.pb.h + test/cpp/microbenchmarks/callback_test_service.cc +) + +if(WIN32 AND MSVC) + set_target_properties(bm_callback_test_service_impl PROPERTIES COMPILE_PDB_NAME "bm_callback_test_service_impl" + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" + ) + if (gRPC_INSTALL) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bm_callback_test_service_impl.pdb + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL + ) + endif() +endif() + +protobuf_generate_grpc_cpp( + src/proto/grpc/testing/echo.proto +) + +target_include_directories(bm_callback_test_service_impl + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) +target_link_libraries(bm_callback_test_service_impl + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_benchmark + ${_gRPC_BENCHMARK_LIBRARIES} + grpc++_test_util_unsecure + grpc_test_util_unsecure + grpc++_unsecure + grpc_unsecure + gpr + grpc++_test_config + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_CODEGEN) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_library(dns_test_util + test/cpp/naming/dns_test_util.cc +) + +if(WIN32 AND MSVC) + set_target_properties(dns_test_util PROPERTIES COMPILE_PDB_NAME "dns_test_util" + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" + ) + if (gRPC_INSTALL) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dns_test_util.pdb + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL + ) + endif() +endif() + + +target_include_directories(dns_test_util + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) +target_link_libraries(dns_test_util + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + ${_gRPC_GFLAGS_LIBRARIES} +) + + +endif (gRPC_BUILD_TESTS) + +add_library(grpc++ + src/cpp/client/insecure_credentials.cc + src/cpp/client/secure_credentials.cc + src/cpp/common/auth_property_iterator.cc + src/cpp/common/secure_auth_context.cc + src/cpp/common/secure_channel_arguments.cc + src/cpp/common/secure_create_auth_context.cc + src/cpp/server/insecure_server_credentials.cc + src/cpp/server/secure_server_credentials.cc + src/cpp/client/channel_cc.cc + src/cpp/client/client_context.cc + src/cpp/client/client_interceptor.cc + src/cpp/client/create_channel.cc + src/cpp/client/create_channel_internal.cc + src/cpp/client/create_channel_posix.cc + src/cpp/client/credentials_cc.cc + src/cpp/client/generic_stub.cc + src/cpp/common/alarm.cc + src/cpp/common/channel_arguments.cc + src/cpp/common/channel_filter.cc + src/cpp/common/completion_queue_cc.cc + src/cpp/common/core_codegen.cc + src/cpp/common/resource_quota_cc.cc + src/cpp/common/rpc_method.cc + src/cpp/common/validate_service_config.cc + src/cpp/common/version_cc.cc + src/cpp/server/async_generic_service.cc + src/cpp/server/channel_argument_option.cc + src/cpp/server/create_default_thread_pool.cc + src/cpp/server/dynamic_thread_pool.cc + src/cpp/server/external_connection_acceptor_impl.cc + src/cpp/server/health/default_health_check_service.cc + src/cpp/server/health/health_check_service.cc + src/cpp/server/health/health_check_service_server_builder_option.cc + src/cpp/server/server_builder.cc + src/cpp/server/server_cc.cc + src/cpp/server/server_context.cc + src/cpp/server/server_credentials.cc + src/cpp/server/server_posix.cc + src/cpp/thread_manager/thread_manager.cc + src/cpp/util/byte_buffer_cc.cc + src/cpp/util/status.cc + src/cpp/util/string_ref.cc + src/cpp/util/time_cc.cc + src/core/ext/filters/client_channel/health/health.pb.c + third_party/nanopb/pb_common.c + third_party/nanopb/pb_decode.c + third_party/nanopb/pb_encode.c + src/cpp/codegen/codegen_init.cc ) if(WIN32 AND MSVC) - set_target_properties(grpc++_cronet PROPERTIES COMPILE_PDB_NAME "grpc++_cronet" + set_target_properties(grpc++ PROPERTIES COMPILE_PDB_NAME "grpc++" COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) if (gRPC_INSTALL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_cronet.pdb + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++.pdb DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL ) endif() endif() -target_include_directories(grpc++_cronet +target_include_directories(grpc++ PUBLIC $ $ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${_gRPC_SSL_INCLUDE_DIR} @@ -3765,18 +3137,14 @@ target_include_directories(grpc++_cronet PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} PRIVATE ${_gRPC_PROTO_GENS_DIR} ) -target_link_libraries(grpc++_cronet +target_link_libraries(grpc++ ${_gRPC_BASELIB_LIBRARIES} ${_gRPC_SSL_LIBRARIES} ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} - gpr - grpc_cronet grpc + gpr ) -if (_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) - target_link_libraries(grpc++_cronet "-framework CoreFoundation") -endif() foreach(_hdr include/grpc++/alarm.h @@ -4032,7 +3400,12 @@ foreach(_hdr include/grpcpp/impl/codegen/sync_stream_impl.h include/grpcpp/impl/codegen/time.h include/grpcpp/impl/codegen/sync.h - include/grpc/census.h + include/grpc++/impl/codegen/proto_utils.h + include/grpcpp/impl/codegen/proto_buffer_reader.h + include/grpcpp/impl/codegen/proto_buffer_writer.h + include/grpcpp/impl/codegen/proto_utils.h + include/grpc++/impl/codegen/config_protobuf.h + include/grpcpp/impl/codegen/config_protobuf.h ) string(REPLACE "include/" "" _path ${_hdr}) get_filename_component(_path ${_path} PATH) @@ -4043,13 +3416,66 @@ endforeach() if (gRPC_INSTALL) - install(TARGETS grpc++_cronet EXPORT gRPCTargets + install(TARGETS grpc++ EXPORT gRPCTargets RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR} ) endif() +if (gRPC_BUILD_TESTS) + +if (gRPC_BUILD_CODEGEN) +add_library(grpc++_core_stats + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/core/stats.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/core/stats.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/core/stats.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/core/stats.grpc.pb.h + src/cpp/util/core_stats.cc +) + +if(WIN32 AND MSVC) + set_target_properties(grpc++_core_stats PROPERTIES COMPILE_PDB_NAME "grpc++_core_stats" + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" + ) + if (gRPC_INSTALL) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_core_stats.pdb + DESTINATION ${gRPC_INSTALL_LIBDIR} OPTIONAL + ) + endif() +endif() + +protobuf_generate_grpc_cpp( + src/proto/grpc/core/stats.proto +) + +target_include_directories(grpc++_core_stats + PUBLIC $ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) +target_link_libraries(grpc++_core_stats + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc++ + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_CODEGEN) + +endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_CODEGEN) add_library(grpc++_error_details @@ -12449,6 +11875,51 @@ target_link_libraries(bm_pollset ) +endif() +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) +if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) + +add_executable(bm_threadpool + test/cpp/microbenchmarks/bm_threadpool.cc + third_party/googletest/googletest/src/gtest-all.cc + third_party/googletest/googlemock/src/gmock-all.cc +) + + +target_include_directories(bm_threadpool + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${_gRPC_SSL_INCLUDE_DIR} + PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR} + PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR} + PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR} + PRIVATE ${_gRPC_CARES_INCLUDE_DIR} + PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR} + PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} + PRIVATE ${_gRPC_NANOPB_INCLUDE_DIR} + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE third_party/googletest/googlemock/include + PRIVATE third_party/googletest/googlemock + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(bm_threadpool + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_benchmark + ${_gRPC_BENCHMARK_LIBRARIES} + grpc++_test_util_unsecure + grpc_test_util_unsecure + grpc++_unsecure + grpc_unsecure + gpr + grpc++_test_config + ${_gRPC_GFLAGS_LIBRARIES} +) + + endif() endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) diff --git a/Makefile b/Makefile index 4755955de7d..0107f145204 100644 --- a/Makefile +++ b/Makefile @@ -370,7 +370,7 @@ CPPFLAGS += -fPIC LDFLAGS += -fPIC endif -INCLUDES = . include $(GENDIR) +INCLUDES = . include $(GENDIR) third_party/upb third_party/upb/generated_for_cmake LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) @@ -462,7 +462,7 @@ endif CORE_VERSION = 7.0.0 CPP_VERSION = 1.23.0-dev -CSHARP_VERSION = 1.23.0-dev +CSHARP_VERSION = 2.23.0-dev CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) @@ -512,7 +512,7 @@ SHARED_EXT_CSHARP = dll SHARED_PREFIX = SHARED_VERSION_CORE = -7 SHARED_VERSION_CPP = -1 -SHARED_VERSION_CSHARP = -1 +SHARED_VERSION_CSHARP = -2 else ifeq ($(SYSTEM),Darwin) EXECUTABLE_SUFFIX = SHARED_EXT_CORE = dylib @@ -1181,6 +1181,7 @@ bm_fullstack_trickle: $(BINDIR)/$(CONFIG)/bm_fullstack_trickle bm_fullstack_unary_ping_pong: $(BINDIR)/$(CONFIG)/bm_fullstack_unary_ping_pong bm_metadata: $(BINDIR)/$(CONFIG)/bm_metadata bm_pollset: $(BINDIR)/$(CONFIG)/bm_pollset +bm_threadpool: $(BINDIR)/$(CONFIG)/bm_threadpool bm_timer: $(BINDIR)/$(CONFIG)/bm_timer byte_stream_test: $(BINDIR)/$(CONFIG)/byte_stream_test channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test @@ -1398,14 +1399,14 @@ static: static_c static_cxx static_c: pc_c pc_c_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc_cronet.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a -static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpcpp_channelz.a +static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpcpp_channelz.a static_csharp: static_c $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.a shared: shared_c shared_cxx shared_c: pc_c pc_c_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) +shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpcpp_channelz$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) shared_csharp: shared_c $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) grpc_csharp_ext: shared_csharp @@ -1660,6 +1661,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/bm_fullstack_unary_ping_pong \ $(BINDIR)/$(CONFIG)/bm_metadata \ $(BINDIR)/$(CONFIG)/bm_pollset \ + $(BINDIR)/$(CONFIG)/bm_threadpool \ $(BINDIR)/$(CONFIG)/bm_timer \ $(BINDIR)/$(CONFIG)/byte_stream_test \ $(BINDIR)/$(CONFIG)/channel_arguments_test \ @@ -1826,6 +1828,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/bm_fullstack_unary_ping_pong \ $(BINDIR)/$(CONFIG)/bm_metadata \ $(BINDIR)/$(CONFIG)/bm_pollset \ + $(BINDIR)/$(CONFIG)/bm_threadpool \ $(BINDIR)/$(CONFIG)/bm_timer \ $(BINDIR)/$(CONFIG)/byte_stream_test \ $(BINDIR)/$(CONFIG)/channel_arguments_test \ @@ -2299,6 +2302,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/bm_metadata || ( echo test bm_metadata failed ; exit 1 ) $(E) "[RUN] Testing bm_pollset" $(Q) $(BINDIR)/$(CONFIG)/bm_pollset || ( echo test bm_pollset failed ; exit 1 ) + $(E) "[RUN] Testing bm_threadpool" + $(Q) $(BINDIR)/$(CONFIG)/bm_threadpool || ( echo test bm_threadpool failed ; exit 1 ) $(E) "[RUN] Testing bm_timer" $(Q) $(BINDIR)/$(CONFIG)/bm_timer || ( echo test bm_timer failed ; exit 1 ) $(E) "[RUN] Testing byte_stream_test" @@ -2563,8 +2568,6 @@ strip-static_cxx: static_cxx ifeq ($(CONFIG),opt) $(E) "[STRIP] Stripping libgrpc++.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++.a - $(E) "[STRIP] Stripping libgrpc++_cronet.a" - $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a $(E) "[STRIP] Stripping libgrpc++_error_details.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(E) "[STRIP] Stripping libgrpc++_reflection.a" @@ -2593,8 +2596,6 @@ strip-shared_cxx: shared_cxx ifeq ($(CONFIG),opt) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) - $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" - $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -3071,9 +3072,6 @@ install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx $(E) "[INSTALL] Installing libgrpc++.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(prefix)/lib/libgrpc++.a - $(E) "[INSTALL] Installing libgrpc++_cronet.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a $(prefix)/lib/libgrpc++_cronet.a $(E) "[INSTALL] Installing libgrpc++_error_details.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(prefix)/lib/libgrpc++_error_details.a @@ -3151,15 +3149,6 @@ ifeq ($(SYSTEM),MINGW32) else ifneq ($(SYSTEM),Darwin) $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so -endif - $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_cronet.a -else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(Q) $(INSTALL) -d $(prefix)/lib @@ -3211,7 +3200,7 @@ install-shared_csharp: shared_csharp strip-shared_csharp ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a $(prefix)/lib/libgrpc_csharp_ext.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.1 + $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so endif ifneq ($(SYSTEM),MINGW32) @@ -3843,6 +3832,7 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \ src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \ src/core/ext/filters/census/grpc_context.cc \ + src/core/ext/filters/client_idle/client_idle_filter.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ src/core/ext/filters/http/client_authority_filter.cc \ @@ -3941,6 +3931,7 @@ endif LIBGRPC_CRONET_SRC = \ + src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc \ src/core/lib/surface/init.cc \ src/core/lib/avl/avl.cc \ src/core/lib/backoff/backoff.cc \ @@ -4242,7 +4233,6 @@ LIBGRPC_CRONET_SRC = \ src/core/tsi/ssl/session_cache/ssl_session_openssl.cc \ src/core/tsi/ssl_transport_security.cc \ src/core/tsi/transport_security_grpc.cc \ - src/core/plugin_registry/grpc_cronet_plugin_registry.cc \ PUBLIC_HEADERS_C += \ include/grpc/impl/codegen/byte_buffer.h \ @@ -5210,6 +5200,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \ src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc \ src/core/ext/filters/census/grpc_context.cc \ + src/core/ext/filters/client_idle/client_idle_filter.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ src/core/ext/filters/http/client_authority_filter.cc \ @@ -5371,796 +5362,154 @@ endif LIBBM_CALLBACK_TEST_SERVICE_IMPL_SRC = \ $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc \ - test/cpp/microbenchmarks/callback_test_service.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_SRC)))) - -$(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX - -ifeq ($(NO_SECURE),true) - -# You can't build secure libraries if you don't have OpenSSL. - -$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: openssl_dep_error - - -else - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a -endif - - - - -endif - -endif - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS:.o=.dep) -endif -endif -$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/callback_test_service.o: $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc - - -LIBDNS_TEST_UTIL_SRC = \ - test/cpp/naming/dns_test_util.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBDNS_TEST_UTIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBDNS_TEST_UTIL_SRC)))) - - -ifeq ($(NO_SECURE),true) - -# You can't build secure libraries if you don't have OpenSSL. - -$(LIBDIR)/$(CONFIG)/libdns_test_util.a: openssl_dep_error - - -else - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libdns_test_util.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libdns_test_util.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBDNS_TEST_UTIL_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libdns_test_util.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libdns_test_util.a $(LIBDNS_TEST_UTIL_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libdns_test_util.a -endif - - - - -endif - -endif - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(LIBDNS_TEST_UTIL_OBJS:.o=.dep) -endif -endif - - -LIBGRPC++_SRC = \ - src/cpp/client/insecure_credentials.cc \ - src/cpp/client/secure_credentials.cc \ - src/cpp/common/auth_property_iterator.cc \ - src/cpp/common/secure_auth_context.cc \ - src/cpp/common/secure_channel_arguments.cc \ - src/cpp/common/secure_create_auth_context.cc \ - src/cpp/server/insecure_server_credentials.cc \ - src/cpp/server/secure_server_credentials.cc \ - src/cpp/client/channel_cc.cc \ - src/cpp/client/client_context.cc \ - src/cpp/client/client_interceptor.cc \ - src/cpp/client/create_channel.cc \ - src/cpp/client/create_channel_internal.cc \ - src/cpp/client/create_channel_posix.cc \ - src/cpp/client/credentials_cc.cc \ - src/cpp/client/generic_stub.cc \ - src/cpp/common/alarm.cc \ - src/cpp/common/channel_arguments.cc \ - src/cpp/common/channel_filter.cc \ - src/cpp/common/completion_queue_cc.cc \ - src/cpp/common/core_codegen.cc \ - src/cpp/common/resource_quota_cc.cc \ - src/cpp/common/rpc_method.cc \ - src/cpp/common/validate_service_config.cc \ - src/cpp/common/version_cc.cc \ - src/cpp/server/async_generic_service.cc \ - src/cpp/server/channel_argument_option.cc \ - src/cpp/server/create_default_thread_pool.cc \ - src/cpp/server/dynamic_thread_pool.cc \ - src/cpp/server/external_connection_acceptor_impl.cc \ - src/cpp/server/health/default_health_check_service.cc \ - src/cpp/server/health/health_check_service.cc \ - src/cpp/server/health/health_check_service_server_builder_option.cc \ - src/cpp/server/server_builder.cc \ - src/cpp/server/server_cc.cc \ - src/cpp/server/server_context.cc \ - src/cpp/server/server_credentials.cc \ - src/cpp/server/server_posix.cc \ - src/cpp/thread_manager/thread_manager.cc \ - src/cpp/util/byte_buffer_cc.cc \ - src/cpp/util/status.cc \ - src/cpp/util/string_ref.cc \ - src/cpp/util/time_cc.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ - src/cpp/codegen/codegen_init.cc \ - -PUBLIC_HEADERS_CXX += \ - include/grpc++/alarm.h \ - include/grpc++/channel.h \ - include/grpc++/client_context.h \ - include/grpc++/completion_queue.h \ - include/grpc++/create_channel.h \ - include/grpc++/create_channel_posix.h \ - include/grpc++/ext/health_check_service_server_builder_option.h \ - include/grpc++/generic/async_generic_service.h \ - include/grpc++/generic/generic_stub.h \ - include/grpc++/grpc++.h \ - include/grpc++/health_check_service_interface.h \ - include/grpc++/impl/call.h \ - include/grpc++/impl/channel_argument_option.h \ - include/grpc++/impl/client_unary_call.h \ - include/grpc++/impl/codegen/core_codegen.h \ - include/grpc++/impl/grpc_library.h \ - include/grpc++/impl/method_handler_impl.h \ - include/grpc++/impl/rpc_method.h \ - include/grpc++/impl/rpc_service_method.h \ - include/grpc++/impl/serialization_traits.h \ - include/grpc++/impl/server_builder_option.h \ - include/grpc++/impl/server_builder_plugin.h \ - include/grpc++/impl/server_initializer.h \ - include/grpc++/impl/service_type.h \ - include/grpc++/resource_quota.h \ - include/grpc++/security/auth_context.h \ - include/grpc++/security/auth_metadata_processor.h \ - include/grpc++/security/credentials.h \ - include/grpc++/security/server_credentials.h \ - include/grpc++/server.h \ - include/grpc++/server_builder.h \ - include/grpc++/server_context.h \ - include/grpc++/server_posix.h \ - include/grpc++/support/async_stream.h \ - include/grpc++/support/async_unary_call.h \ - include/grpc++/support/byte_buffer.h \ - include/grpc++/support/channel_arguments.h \ - include/grpc++/support/config.h \ - include/grpc++/support/slice.h \ - include/grpc++/support/status.h \ - include/grpc++/support/status_code_enum.h \ - include/grpc++/support/string_ref.h \ - include/grpc++/support/stub_options.h \ - include/grpc++/support/sync_stream.h \ - include/grpc++/support/time.h \ - include/grpcpp/alarm.h \ - include/grpcpp/alarm_impl.h \ - include/grpcpp/channel.h \ - include/grpcpp/channel_impl.h \ - include/grpcpp/client_context.h \ - include/grpcpp/completion_queue.h \ - include/grpcpp/completion_queue_impl.h \ - include/grpcpp/create_channel.h \ - include/grpcpp/create_channel_impl.h \ - include/grpcpp/create_channel_posix.h \ - include/grpcpp/create_channel_posix_impl.h \ - include/grpcpp/ext/health_check_service_server_builder_option.h \ - include/grpcpp/generic/async_generic_service.h \ - include/grpcpp/generic/generic_stub.h \ - include/grpcpp/generic/generic_stub_impl.h \ - include/grpcpp/grpcpp.h \ - include/grpcpp/health_check_service_interface.h \ - include/grpcpp/health_check_service_interface_impl.h \ - include/grpcpp/impl/call.h \ - include/grpcpp/impl/channel_argument_option.h \ - include/grpcpp/impl/client_unary_call.h \ - include/grpcpp/impl/codegen/core_codegen.h \ - include/grpcpp/impl/grpc_library.h \ - include/grpcpp/impl/method_handler_impl.h \ - include/grpcpp/impl/rpc_method.h \ - include/grpcpp/impl/rpc_service_method.h \ - include/grpcpp/impl/serialization_traits.h \ - include/grpcpp/impl/server_builder_option.h \ - include/grpcpp/impl/server_builder_option_impl.h \ - include/grpcpp/impl/server_builder_plugin.h \ - include/grpcpp/impl/server_initializer.h \ - include/grpcpp/impl/server_initializer_impl.h \ - include/grpcpp/impl/service_type.h \ - include/grpcpp/resource_quota.h \ - include/grpcpp/resource_quota_impl.h \ - include/grpcpp/security/auth_context.h \ - include/grpcpp/security/auth_metadata_processor.h \ - include/grpcpp/security/auth_metadata_processor_impl.h \ - include/grpcpp/security/credentials.h \ - include/grpcpp/security/credentials_impl.h \ - include/grpcpp/security/server_credentials.h \ - include/grpcpp/security/server_credentials_impl.h \ - include/grpcpp/server.h \ - include/grpcpp/server_builder.h \ - include/grpcpp/server_builder_impl.h \ - include/grpcpp/server_context.h \ - include/grpcpp/server_impl.h \ - include/grpcpp/server_posix.h \ - include/grpcpp/server_posix_impl.h \ - include/grpcpp/support/async_stream.h \ - include/grpcpp/support/async_stream_impl.h \ - include/grpcpp/support/async_unary_call.h \ - include/grpcpp/support/async_unary_call_impl.h \ - include/grpcpp/support/byte_buffer.h \ - include/grpcpp/support/channel_arguments.h \ - include/grpcpp/support/channel_arguments_impl.h \ - include/grpcpp/support/client_callback.h \ - include/grpcpp/support/client_callback_impl.h \ - include/grpcpp/support/client_interceptor.h \ - include/grpcpp/support/config.h \ - include/grpcpp/support/interceptor.h \ - include/grpcpp/support/message_allocator.h \ - include/grpcpp/support/proto_buffer_reader.h \ - include/grpcpp/support/proto_buffer_writer.h \ - include/grpcpp/support/server_callback.h \ - include/grpcpp/support/server_callback_impl.h \ - include/grpcpp/support/server_interceptor.h \ - include/grpcpp/support/slice.h \ - include/grpcpp/support/status.h \ - include/grpcpp/support/status_code_enum.h \ - include/grpcpp/support/string_ref.h \ - include/grpcpp/support/stub_options.h \ - include/grpcpp/support/sync_stream.h \ - include/grpcpp/support/sync_stream_impl.h \ - include/grpcpp/support/time.h \ - include/grpcpp/support/validate_service_config.h \ - include/grpc/support/alloc.h \ - include/grpc/support/atm.h \ - include/grpc/support/atm_gcc_atomic.h \ - include/grpc/support/atm_gcc_sync.h \ - include/grpc/support/atm_windows.h \ - include/grpc/support/cpu.h \ - include/grpc/support/log.h \ - include/grpc/support/log_windows.h \ - include/grpc/support/port_platform.h \ - include/grpc/support/string_util.h \ - include/grpc/support/sync.h \ - include/grpc/support/sync_custom.h \ - include/grpc/support/sync_generic.h \ - include/grpc/support/sync_posix.h \ - include/grpc/support/sync_windows.h \ - include/grpc/support/thd_id.h \ - include/grpc/support/time.h \ - include/grpc/impl/codegen/atm.h \ - include/grpc/impl/codegen/atm_gcc_atomic.h \ - include/grpc/impl/codegen/atm_gcc_sync.h \ - include/grpc/impl/codegen/atm_windows.h \ - include/grpc/impl/codegen/fork.h \ - include/grpc/impl/codegen/gpr_slice.h \ - include/grpc/impl/codegen/gpr_types.h \ - include/grpc/impl/codegen/log.h \ - include/grpc/impl/codegen/port_platform.h \ - include/grpc/impl/codegen/sync.h \ - include/grpc/impl/codegen/sync_custom.h \ - include/grpc/impl/codegen/sync_generic.h \ - include/grpc/impl/codegen/sync_posix.h \ - include/grpc/impl/codegen/sync_windows.h \ - include/grpc/byte_buffer.h \ - include/grpc/byte_buffer_reader.h \ - include/grpc/compression.h \ - include/grpc/fork.h \ - include/grpc/grpc.h \ - include/grpc/grpc_posix.h \ - include/grpc/grpc_security_constants.h \ - include/grpc/load_reporting.h \ - include/grpc/slice.h \ - include/grpc/slice_buffer.h \ - include/grpc/status.h \ - include/grpc/support/workaround_list.h \ - include/grpc/impl/codegen/byte_buffer.h \ - include/grpc/impl/codegen/byte_buffer_reader.h \ - include/grpc/impl/codegen/compression_types.h \ - include/grpc/impl/codegen/connectivity_state.h \ - include/grpc/impl/codegen/grpc_types.h \ - include/grpc/impl/codegen/propagation_bits.h \ - include/grpc/impl/codegen/slice.h \ - include/grpc/impl/codegen/status.h \ - include/grpc++/impl/codegen/async_stream.h \ - include/grpc++/impl/codegen/async_unary_call.h \ - include/grpc++/impl/codegen/byte_buffer.h \ - include/grpc++/impl/codegen/call.h \ - include/grpc++/impl/codegen/call_hook.h \ - include/grpc++/impl/codegen/channel_interface.h \ - include/grpc++/impl/codegen/client_context.h \ - include/grpc++/impl/codegen/client_unary_call.h \ - include/grpc++/impl/codegen/completion_queue.h \ - include/grpc++/impl/codegen/completion_queue_tag.h \ - include/grpc++/impl/codegen/config.h \ - include/grpc++/impl/codegen/core_codegen_interface.h \ - include/grpc++/impl/codegen/create_auth_context.h \ - include/grpc++/impl/codegen/grpc_library.h \ - include/grpc++/impl/codegen/metadata_map.h \ - include/grpc++/impl/codegen/method_handler_impl.h \ - include/grpc++/impl/codegen/rpc_method.h \ - include/grpc++/impl/codegen/rpc_service_method.h \ - include/grpc++/impl/codegen/security/auth_context.h \ - include/grpc++/impl/codegen/serialization_traits.h \ - include/grpc++/impl/codegen/server_context.h \ - include/grpc++/impl/codegen/server_interface.h \ - include/grpc++/impl/codegen/service_type.h \ - include/grpc++/impl/codegen/slice.h \ - include/grpc++/impl/codegen/status.h \ - include/grpc++/impl/codegen/status_code_enum.h \ - include/grpc++/impl/codegen/string_ref.h \ - include/grpc++/impl/codegen/stub_options.h \ - include/grpc++/impl/codegen/sync_stream.h \ - include/grpc++/impl/codegen/time.h \ - include/grpcpp/impl/codegen/async_generic_service.h \ - include/grpcpp/impl/codegen/async_stream.h \ - include/grpcpp/impl/codegen/async_stream_impl.h \ - include/grpcpp/impl/codegen/async_unary_call.h \ - include/grpcpp/impl/codegen/async_unary_call_impl.h \ - include/grpcpp/impl/codegen/byte_buffer.h \ - include/grpcpp/impl/codegen/call.h \ - include/grpcpp/impl/codegen/call_hook.h \ - include/grpcpp/impl/codegen/call_op_set.h \ - include/grpcpp/impl/codegen/call_op_set_interface.h \ - include/grpcpp/impl/codegen/callback_common.h \ - include/grpcpp/impl/codegen/channel_interface.h \ - include/grpcpp/impl/codegen/client_callback.h \ - include/grpcpp/impl/codegen/client_callback_impl.h \ - include/grpcpp/impl/codegen/client_context.h \ - include/grpcpp/impl/codegen/client_context_impl.h \ - include/grpcpp/impl/codegen/client_interceptor.h \ - include/grpcpp/impl/codegen/client_unary_call.h \ - include/grpcpp/impl/codegen/completion_queue.h \ - include/grpcpp/impl/codegen/completion_queue_impl.h \ - include/grpcpp/impl/codegen/completion_queue_tag.h \ - include/grpcpp/impl/codegen/config.h \ - include/grpcpp/impl/codegen/core_codegen_interface.h \ - include/grpcpp/impl/codegen/create_auth_context.h \ - include/grpcpp/impl/codegen/grpc_library.h \ - include/grpcpp/impl/codegen/intercepted_channel.h \ - include/grpcpp/impl/codegen/interceptor.h \ - include/grpcpp/impl/codegen/interceptor_common.h \ - include/grpcpp/impl/codegen/message_allocator.h \ - include/grpcpp/impl/codegen/metadata_map.h \ - include/grpcpp/impl/codegen/method_handler_impl.h \ - include/grpcpp/impl/codegen/rpc_method.h \ - include/grpcpp/impl/codegen/rpc_service_method.h \ - include/grpcpp/impl/codegen/security/auth_context.h \ - include/grpcpp/impl/codegen/serialization_traits.h \ - include/grpcpp/impl/codegen/server_callback.h \ - include/grpcpp/impl/codegen/server_callback_impl.h \ - include/grpcpp/impl/codegen/server_context.h \ - include/grpcpp/impl/codegen/server_context_impl.h \ - include/grpcpp/impl/codegen/server_interceptor.h \ - include/grpcpp/impl/codegen/server_interface.h \ - include/grpcpp/impl/codegen/service_type.h \ - include/grpcpp/impl/codegen/slice.h \ - include/grpcpp/impl/codegen/status.h \ - include/grpcpp/impl/codegen/status_code_enum.h \ - include/grpcpp/impl/codegen/string_ref.h \ - include/grpcpp/impl/codegen/stub_options.h \ - include/grpcpp/impl/codegen/sync_stream.h \ - include/grpcpp/impl/codegen/sync_stream_impl.h \ - include/grpcpp/impl/codegen/time.h \ - include/grpcpp/impl/codegen/sync.h \ - include/grpc++/impl/codegen/proto_utils.h \ - include/grpcpp/impl/codegen/proto_buffer_reader.h \ - include/grpcpp/impl/codegen/proto_buffer_writer.h \ - include/grpcpp/impl/codegen/proto_utils.h \ - include/grpc++/impl/codegen/config_protobuf.h \ - include/grpcpp/impl/codegen/config_protobuf.h \ - -LIBGRPC++_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_SRC)))) - - -ifeq ($(NO_SECURE),true) - -# You can't build secure libraries if you don't have OpenSSL. - -$(LIBDIR)/$(CONFIG)/libgrpc++.a: openssl_dep_error - -$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): openssl_dep_error - -else - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libgrpc++.a: protobuf_dep_error - -$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): protobuf_dep_error - -else - -$(LIBDIR)/$(CONFIG)/libgrpc++.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_OBJS) $(LIBGPR_OBJS) $(ZLIB_MERGE_OBJS) $(CARES_MERGE_OBJS) $(ADDRESS_SORTING_MERGE_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc++.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBGRPC++_OBJS) $(LIBGPR_OBJS) $(ZLIB_MERGE_OBJS) $(CARES_MERGE_OBJS) $(ADDRESS_SORTING_MERGE_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc++.a -endif - - - -ifeq ($(SYSTEM),MINGW32) -$(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(OPENSSL_DEP) - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc$(SHARED_VERSION_CORE)-dll -lgpr$(SHARED_VERSION_CORE)-dll -else -$(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT_CORE) $(OPENSSL_DEP) - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` -ifeq ($(SYSTEM),Darwin) - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc -lgpr -else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc -lgpr - $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so -endif -endif - -endif - -endif - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(LIBGRPC++_OBJS:.o=.dep) -endif -endif - - -LIBGRPC++_CORE_STATS_SRC = \ - $(GENDIR)/src/proto/grpc/core/stats.pb.cc $(GENDIR)/src/proto/grpc/core/stats.grpc.pb.cc \ - src/cpp/util/core_stats.cc \ - -PUBLIC_HEADERS_CXX += \ - -LIBGRPC++_CORE_STATS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_CORE_STATS_SRC)))) - - -ifeq ($(NO_SECURE),true) - -# You can't build secure libraries if you don't have OpenSSL. - -$(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a: openssl_dep_error - - -else - -ifeq ($(NO_PROTOBUF),true) - -# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. - -$(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a: protobuf_dep_error - - -else - -$(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_CORE_STATS_OBJS) - $(E) "[AR] Creating $@" - $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a $(LIBGRPC++_CORE_STATS_OBJS) -ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a -endif - - - - -endif - -endif - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(LIBGRPC++_CORE_STATS_OBJS:.o=.dep) -endif -endif -$(OBJDIR)/$(CONFIG)/src/cpp/util/core_stats.o: $(GENDIR)/src/proto/grpc/core/stats.pb.cc $(GENDIR)/src/proto/grpc/core/stats.grpc.pb.cc - - -LIBGRPC++_CRONET_SRC = \ - src/cpp/client/cronet_credentials.cc \ - src/cpp/client/insecure_credentials.cc \ - src/cpp/common/insecure_create_auth_context.cc \ - src/cpp/server/insecure_server_credentials.cc \ - src/cpp/client/channel_cc.cc \ - src/cpp/client/client_context.cc \ - src/cpp/client/client_interceptor.cc \ - src/cpp/client/create_channel.cc \ - src/cpp/client/create_channel_internal.cc \ - src/cpp/client/create_channel_posix.cc \ - src/cpp/client/credentials_cc.cc \ - src/cpp/client/generic_stub.cc \ - src/cpp/common/alarm.cc \ - src/cpp/common/channel_arguments.cc \ - src/cpp/common/channel_filter.cc \ - src/cpp/common/completion_queue_cc.cc \ - src/cpp/common/core_codegen.cc \ - src/cpp/common/resource_quota_cc.cc \ - src/cpp/common/rpc_method.cc \ - src/cpp/common/validate_service_config.cc \ - src/cpp/common/version_cc.cc \ - src/cpp/server/async_generic_service.cc \ - src/cpp/server/channel_argument_option.cc \ - src/cpp/server/create_default_thread_pool.cc \ - src/cpp/server/dynamic_thread_pool.cc \ - src/cpp/server/external_connection_acceptor_impl.cc \ - src/cpp/server/health/default_health_check_service.cc \ - src/cpp/server/health/health_check_service.cc \ - src/cpp/server/health/health_check_service_server_builder_option.cc \ - src/cpp/server/server_builder.cc \ - src/cpp/server/server_cc.cc \ - src/cpp/server/server_context.cc \ - src/cpp/server/server_credentials.cc \ - src/cpp/server/server_posix.cc \ - src/cpp/thread_manager/thread_manager.cc \ - src/cpp/util/byte_buffer_cc.cc \ - src/cpp/util/status.cc \ - src/cpp/util/string_ref.cc \ - src/cpp/util/time_cc.cc \ - src/core/ext/filters/client_channel/health/health.pb.c \ - third_party/nanopb/pb_common.c \ - third_party/nanopb/pb_decode.c \ - third_party/nanopb/pb_encode.c \ - src/cpp/codegen/codegen_init.cc \ - src/core/ext/transport/chttp2/client/insecure/channel_create.cc \ - src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc \ - src/core/ext/transport/chttp2/client/authority.cc \ - src/core/ext/transport/chttp2/client/chttp2_connector.cc \ - src/core/ext/transport/chttp2/transport/bin_decoder.cc \ - src/core/ext/transport/chttp2/transport/bin_encoder.cc \ - src/core/ext/transport/chttp2/transport/chttp2_plugin.cc \ - src/core/ext/transport/chttp2/transport/chttp2_transport.cc \ - src/core/ext/transport/chttp2/transport/context_list.cc \ - src/core/ext/transport/chttp2/transport/flow_control.cc \ - src/core/ext/transport/chttp2/transport/frame_data.cc \ - src/core/ext/transport/chttp2/transport/frame_goaway.cc \ - src/core/ext/transport/chttp2/transport/frame_ping.cc \ - src/core/ext/transport/chttp2/transport/frame_rst_stream.cc \ - src/core/ext/transport/chttp2/transport/frame_settings.cc \ - src/core/ext/transport/chttp2/transport/frame_window_update.cc \ - src/core/ext/transport/chttp2/transport/hpack_encoder.cc \ - src/core/ext/transport/chttp2/transport/hpack_parser.cc \ - src/core/ext/transport/chttp2/transport/hpack_table.cc \ - src/core/ext/transport/chttp2/transport/http2_settings.cc \ - src/core/ext/transport/chttp2/transport/huffsyms.cc \ - src/core/ext/transport/chttp2/transport/incoming_metadata.cc \ - src/core/ext/transport/chttp2/transport/parsing.cc \ - src/core/ext/transport/chttp2/transport/stream_lists.cc \ - src/core/ext/transport/chttp2/transport/stream_map.cc \ - src/core/ext/transport/chttp2/transport/varint.cc \ - src/core/ext/transport/chttp2/transport/writing.cc \ - src/core/lib/avl/avl.cc \ - src/core/lib/backoff/backoff.cc \ - src/core/lib/channel/channel_args.cc \ - src/core/lib/channel/channel_stack.cc \ - src/core/lib/channel/channel_stack_builder.cc \ - src/core/lib/channel/channel_trace.cc \ - src/core/lib/channel/channelz.cc \ - src/core/lib/channel/channelz_registry.cc \ - src/core/lib/channel/connected_channel.cc \ - src/core/lib/channel/handshaker.cc \ - src/core/lib/channel/handshaker_registry.cc \ - src/core/lib/channel/status_util.cc \ - src/core/lib/compression/compression.cc \ - src/core/lib/compression/compression_args.cc \ - src/core/lib/compression/compression_internal.cc \ - src/core/lib/compression/message_compress.cc \ - src/core/lib/compression/stream_compression.cc \ - src/core/lib/compression/stream_compression_gzip.cc \ - src/core/lib/compression/stream_compression_identity.cc \ - src/core/lib/debug/stats.cc \ - src/core/lib/debug/stats_data.cc \ - src/core/lib/http/format_request.cc \ - src/core/lib/http/httpcli.cc \ - src/core/lib/http/parser.cc \ - src/core/lib/iomgr/buffer_list.cc \ - src/core/lib/iomgr/call_combiner.cc \ - src/core/lib/iomgr/cfstream_handle.cc \ - src/core/lib/iomgr/combiner.cc \ - src/core/lib/iomgr/endpoint.cc \ - src/core/lib/iomgr/endpoint_cfstream.cc \ - src/core/lib/iomgr/endpoint_pair_posix.cc \ - src/core/lib/iomgr/endpoint_pair_uv.cc \ - src/core/lib/iomgr/endpoint_pair_windows.cc \ - src/core/lib/iomgr/error.cc \ - src/core/lib/iomgr/error_cfstream.cc \ - src/core/lib/iomgr/ev_epoll1_linux.cc \ - src/core/lib/iomgr/ev_epollex_linux.cc \ - src/core/lib/iomgr/ev_poll_posix.cc \ - src/core/lib/iomgr/ev_posix.cc \ - src/core/lib/iomgr/ev_windows.cc \ - src/core/lib/iomgr/exec_ctx.cc \ - src/core/lib/iomgr/executor.cc \ - src/core/lib/iomgr/executor/mpmcqueue.cc \ - src/core/lib/iomgr/executor/threadpool.cc \ - src/core/lib/iomgr/fork_posix.cc \ - src/core/lib/iomgr/fork_windows.cc \ - src/core/lib/iomgr/gethostname_fallback.cc \ - src/core/lib/iomgr/gethostname_host_name_max.cc \ - src/core/lib/iomgr/gethostname_sysconf.cc \ - src/core/lib/iomgr/grpc_if_nametoindex_posix.cc \ - src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc \ - src/core/lib/iomgr/internal_errqueue.cc \ - src/core/lib/iomgr/iocp_windows.cc \ - src/core/lib/iomgr/iomgr.cc \ - src/core/lib/iomgr/iomgr_custom.cc \ - src/core/lib/iomgr/iomgr_internal.cc \ - src/core/lib/iomgr/iomgr_posix.cc \ - src/core/lib/iomgr/iomgr_posix_cfstream.cc \ - src/core/lib/iomgr/iomgr_uv.cc \ - src/core/lib/iomgr/iomgr_windows.cc \ - src/core/lib/iomgr/is_epollexclusive_available.cc \ - src/core/lib/iomgr/load_file.cc \ - src/core/lib/iomgr/lockfree_event.cc \ - src/core/lib/iomgr/polling_entity.cc \ - src/core/lib/iomgr/pollset.cc \ - src/core/lib/iomgr/pollset_custom.cc \ - src/core/lib/iomgr/pollset_set.cc \ - src/core/lib/iomgr/pollset_set_custom.cc \ - src/core/lib/iomgr/pollset_set_windows.cc \ - src/core/lib/iomgr/pollset_uv.cc \ - src/core/lib/iomgr/pollset_windows.cc \ - src/core/lib/iomgr/resolve_address.cc \ - src/core/lib/iomgr/resolve_address_custom.cc \ - src/core/lib/iomgr/resolve_address_posix.cc \ - src/core/lib/iomgr/resolve_address_windows.cc \ - src/core/lib/iomgr/resource_quota.cc \ - src/core/lib/iomgr/sockaddr_utils.cc \ - src/core/lib/iomgr/socket_factory_posix.cc \ - src/core/lib/iomgr/socket_mutator.cc \ - src/core/lib/iomgr/socket_utils_common_posix.cc \ - src/core/lib/iomgr/socket_utils_linux.cc \ - src/core/lib/iomgr/socket_utils_posix.cc \ - src/core/lib/iomgr/socket_utils_uv.cc \ - src/core/lib/iomgr/socket_utils_windows.cc \ - src/core/lib/iomgr/socket_windows.cc \ - src/core/lib/iomgr/tcp_client.cc \ - src/core/lib/iomgr/tcp_client_cfstream.cc \ - src/core/lib/iomgr/tcp_client_custom.cc \ - src/core/lib/iomgr/tcp_client_posix.cc \ - src/core/lib/iomgr/tcp_client_windows.cc \ - src/core/lib/iomgr/tcp_custom.cc \ - src/core/lib/iomgr/tcp_posix.cc \ - src/core/lib/iomgr/tcp_server.cc \ - src/core/lib/iomgr/tcp_server_custom.cc \ - src/core/lib/iomgr/tcp_server_posix.cc \ - src/core/lib/iomgr/tcp_server_utils_posix_common.cc \ - src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc \ - src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc \ - src/core/lib/iomgr/tcp_server_windows.cc \ - src/core/lib/iomgr/tcp_uv.cc \ - src/core/lib/iomgr/tcp_windows.cc \ - src/core/lib/iomgr/time_averaged_stats.cc \ - src/core/lib/iomgr/timer.cc \ - src/core/lib/iomgr/timer_custom.cc \ - src/core/lib/iomgr/timer_generic.cc \ - src/core/lib/iomgr/timer_heap.cc \ - src/core/lib/iomgr/timer_manager.cc \ - src/core/lib/iomgr/timer_uv.cc \ - src/core/lib/iomgr/udp_server.cc \ - src/core/lib/iomgr/unix_sockets_posix.cc \ - src/core/lib/iomgr/unix_sockets_posix_noop.cc \ - src/core/lib/iomgr/wakeup_fd_eventfd.cc \ - src/core/lib/iomgr/wakeup_fd_nospecial.cc \ - src/core/lib/iomgr/wakeup_fd_pipe.cc \ - src/core/lib/iomgr/wakeup_fd_posix.cc \ - src/core/lib/json/json.cc \ - src/core/lib/json/json_reader.cc \ - src/core/lib/json/json_string.cc \ - src/core/lib/json/json_writer.cc \ - src/core/lib/slice/b64.cc \ - src/core/lib/slice/percent_encoding.cc \ - src/core/lib/slice/slice.cc \ - src/core/lib/slice/slice_buffer.cc \ - src/core/lib/slice/slice_intern.cc \ - src/core/lib/slice/slice_string_helpers.cc \ - src/core/lib/surface/api_trace.cc \ - src/core/lib/surface/byte_buffer.cc \ - src/core/lib/surface/byte_buffer_reader.cc \ - src/core/lib/surface/call.cc \ - src/core/lib/surface/call_details.cc \ - src/core/lib/surface/call_log_batch.cc \ - src/core/lib/surface/channel.cc \ - src/core/lib/surface/channel_init.cc \ - src/core/lib/surface/channel_ping.cc \ - src/core/lib/surface/channel_stack_type.cc \ - src/core/lib/surface/completion_queue.cc \ - src/core/lib/surface/completion_queue_factory.cc \ - src/core/lib/surface/event_string.cc \ - src/core/lib/surface/lame_client.cc \ - src/core/lib/surface/metadata_array.cc \ - src/core/lib/surface/server.cc \ - src/core/lib/surface/validate_metadata.cc \ - src/core/lib/surface/version.cc \ - src/core/lib/transport/bdp_estimator.cc \ - src/core/lib/transport/byte_stream.cc \ - src/core/lib/transport/connectivity_state.cc \ - src/core/lib/transport/error_utils.cc \ - src/core/lib/transport/metadata.cc \ - src/core/lib/transport/metadata_batch.cc \ - src/core/lib/transport/pid_controller.cc \ - src/core/lib/transport/static_metadata.cc \ - src/core/lib/transport/status_conversion.cc \ - src/core/lib/transport/status_metadata.cc \ - src/core/lib/transport/timeout_encoding.cc \ - src/core/lib/transport/transport.cc \ - src/core/lib/transport/transport_op_string.cc \ - src/core/lib/uri/uri_parser.cc \ - src/core/lib/debug/trace.cc \ - src/core/ext/transport/chttp2/alpn/alpn.cc \ - src/core/ext/filters/http/client/http_client_filter.cc \ - src/core/ext/filters/http/http_filters_plugin.cc \ - src/core/ext/filters/http/message_compress/message_compress_filter.cc \ - src/core/ext/filters/http/server/http_server_filter.cc \ - src/core/ext/filters/client_channel/backup_poller.cc \ - src/core/ext/filters/client_channel/channel_connectivity.cc \ - src/core/ext/filters/client_channel/client_channel.cc \ - src/core/ext/filters/client_channel/client_channel_channelz.cc \ - src/core/ext/filters/client_channel/client_channel_factory.cc \ - src/core/ext/filters/client_channel/client_channel_plugin.cc \ - src/core/ext/filters/client_channel/connector.cc \ - src/core/ext/filters/client_channel/global_subchannel_pool.cc \ - src/core/ext/filters/client_channel/health/health_check_client.cc \ - src/core/ext/filters/client_channel/http_connect_handshaker.cc \ - src/core/ext/filters/client_channel/http_proxy.cc \ - src/core/ext/filters/client_channel/lb_policy.cc \ - src/core/ext/filters/client_channel/lb_policy_registry.cc \ - src/core/ext/filters/client_channel/local_subchannel_pool.cc \ - src/core/ext/filters/client_channel/parse_address.cc \ - src/core/ext/filters/client_channel/proxy_mapper.cc \ - src/core/ext/filters/client_channel/proxy_mapper_registry.cc \ - src/core/ext/filters/client_channel/resolver.cc \ - src/core/ext/filters/client_channel/resolver_registry.cc \ - src/core/ext/filters/client_channel/resolver_result_parsing.cc \ - src/core/ext/filters/client_channel/resolving_lb_policy.cc \ - src/core/ext/filters/client_channel/retry_throttle.cc \ - src/core/ext/filters/client_channel/server_address.cc \ - src/core/ext/filters/client_channel/service_config.cc \ - src/core/ext/filters/client_channel/subchannel.cc \ - src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ - src/core/ext/filters/deadline/deadline_filter.cc \ - src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc \ - src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc \ - src/core/ext/transport/chttp2/server/chttp2_server.cc \ - src/core/ext/filters/census/grpc_context.cc \ + test/cpp/microbenchmarks/callback_test_service.cc \ + +PUBLIC_HEADERS_CXX += \ + +LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_SRC)))) + +$(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX + +ifeq ($(NO_SECURE),true) + +# You can't build secure libraries if you don't have OpenSSL. + +$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: openssl_dep_error + + +else + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libbm_callback_test_service_impl.a +endif + + + + +endif + +endif + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(LIBBM_CALLBACK_TEST_SERVICE_IMPL_OBJS:.o=.dep) +endif +endif +$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/callback_test_service.o: $(GENDIR)/src/proto/grpc/testing/echo.pb.cc $(GENDIR)/src/proto/grpc/testing/echo.grpc.pb.cc + + +LIBDNS_TEST_UTIL_SRC = \ + test/cpp/naming/dns_test_util.cc \ + +PUBLIC_HEADERS_CXX += \ + +LIBDNS_TEST_UTIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBDNS_TEST_UTIL_SRC)))) + + +ifeq ($(NO_SECURE),true) + +# You can't build secure libraries if you don't have OpenSSL. + +$(LIBDIR)/$(CONFIG)/libdns_test_util.a: openssl_dep_error + + +else + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libdns_test_util.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libdns_test_util.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBDNS_TEST_UTIL_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libdns_test_util.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libdns_test_util.a $(LIBDNS_TEST_UTIL_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libdns_test_util.a +endif + + + + +endif + +endif + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(LIBDNS_TEST_UTIL_OBJS:.o=.dep) +endif +endif + + +LIBGRPC++_SRC = \ + src/cpp/client/insecure_credentials.cc \ + src/cpp/client/secure_credentials.cc \ + src/cpp/common/auth_property_iterator.cc \ + src/cpp/common/secure_auth_context.cc \ + src/cpp/common/secure_channel_arguments.cc \ + src/cpp/common/secure_create_auth_context.cc \ + src/cpp/server/insecure_server_credentials.cc \ + src/cpp/server/secure_server_credentials.cc \ + src/cpp/client/channel_cc.cc \ + src/cpp/client/client_context.cc \ + src/cpp/client/client_interceptor.cc \ + src/cpp/client/create_channel.cc \ + src/cpp/client/create_channel_internal.cc \ + src/cpp/client/create_channel_posix.cc \ + src/cpp/client/credentials_cc.cc \ + src/cpp/client/generic_stub.cc \ + src/cpp/common/alarm.cc \ + src/cpp/common/channel_arguments.cc \ + src/cpp/common/channel_filter.cc \ + src/cpp/common/completion_queue_cc.cc \ + src/cpp/common/core_codegen.cc \ + src/cpp/common/resource_quota_cc.cc \ + src/cpp/common/rpc_method.cc \ + src/cpp/common/validate_service_config.cc \ + src/cpp/common/version_cc.cc \ + src/cpp/server/async_generic_service.cc \ + src/cpp/server/channel_argument_option.cc \ + src/cpp/server/create_default_thread_pool.cc \ + src/cpp/server/dynamic_thread_pool.cc \ + src/cpp/server/external_connection_acceptor_impl.cc \ + src/cpp/server/health/default_health_check_service.cc \ + src/cpp/server/health/health_check_service.cc \ + src/cpp/server/health/health_check_service_server_builder_option.cc \ + src/cpp/server/server_builder.cc \ + src/cpp/server/server_cc.cc \ + src/cpp/server/server_context.cc \ + src/cpp/server/server_credentials.cc \ + src/cpp/server/server_posix.cc \ + src/cpp/thread_manager/thread_manager.cc \ + src/cpp/util/byte_buffer_cc.cc \ + src/cpp/util/status.cc \ + src/cpp/util/string_ref.cc \ + src/cpp/util/time_cc.cc \ + src/core/ext/filters/client_channel/health/health.pb.c \ + third_party/nanopb/pb_common.c \ + third_party/nanopb/pb_decode.c \ + third_party/nanopb/pb_encode.c \ + src/cpp/codegen/codegen_init.cc \ PUBLIC_HEADERS_CXX += \ include/grpc++/alarm.h \ @@ -6416,18 +5765,23 @@ PUBLIC_HEADERS_CXX += \ include/grpcpp/impl/codegen/sync_stream_impl.h \ include/grpcpp/impl/codegen/time.h \ include/grpcpp/impl/codegen/sync.h \ - include/grpc/census.h \ + include/grpc++/impl/codegen/proto_utils.h \ + include/grpcpp/impl/codegen/proto_buffer_reader.h \ + include/grpcpp/impl/codegen/proto_buffer_writer.h \ + include/grpcpp/impl/codegen/proto_utils.h \ + include/grpc++/impl/codegen/config_protobuf.h \ + include/grpcpp/impl/codegen/config_protobuf.h \ -LIBGRPC++_CRONET_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_CRONET_SRC)))) +LIBGRPC++_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_SRC)))) ifeq ($(NO_SECURE),true) # You can't build secure libraries if you don't have OpenSSL. -$(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a: openssl_dep_error +$(LIBDIR)/$(CONFIG)/libgrpc++.a: openssl_dep_error -$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): openssl_dep_error +$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): openssl_dep_error else @@ -6435,50 +5789,101 @@ ifeq ($(NO_PROTOBUF),true) # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. -$(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/libgrpc++.a: protobuf_dep_error -$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): protobuf_dep_error +$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): protobuf_dep_error else -$(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_CRONET_OBJS) $(LIBGPR_OBJS) $(ZLIB_MERGE_OBJS) $(CARES_MERGE_OBJS) $(ADDRESS_SORTING_MERGE_OBJS) $(OPENSSL_MERGE_OBJS) +$(LIBDIR)/$(CONFIG)/libgrpc++.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_OBJS) $(LIBGPR_OBJS) $(ZLIB_MERGE_OBJS) $(CARES_MERGE_OBJS) $(ADDRESS_SORTING_MERGE_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` - $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a - $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a $(LIBGRPC++_CRONET_OBJS) $(LIBGPR_OBJS) $(ZLIB_MERGE_OBJS) $(CARES_MERGE_OBJS) $(ADDRESS_SORTING_MERGE_OBJS) $(OPENSSL_MERGE_OBJS) + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc++.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBGRPC++_OBJS) $(LIBGPR_OBJS) $(ZLIB_MERGE_OBJS) $(CARES_MERGE_OBJS) $(ADDRESS_SORTING_MERGE_OBJS) ifeq ($(SYSTEM),Darwin) - $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc++.a endif ifeq ($(SYSTEM),MINGW32) -$(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_CRONET_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(OPENSSL_DEP) +$(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr$(SHARED_VERSION_CORE)-dll -lgrpc_cronet$(SHARED_VERSION_CORE)-dll -lgrpc$(SHARED_VERSION_CORE)-dll + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc$(SHARED_VERSION_CORE)-dll -lgpr$(SHARED_VERSION_CORE)-dll else -$(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_CRONET_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT_CORE) $(OPENSSL_DEP) +$(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT_CORE) $(OPENSSL_DEP) $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` ifeq ($(SYSTEM),Darwin) - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_cronet -lgrpc + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc -lgpr else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_cronet.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_cronet -lgrpc - $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so.1 - $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc -lgpr + $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so.1 + $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so +endif +endif + +endif + endif + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(LIBGRPC++_OBJS:.o=.dep) +endif +endif + + +LIBGRPC++_CORE_STATS_SRC = \ + $(GENDIR)/src/proto/grpc/core/stats.pb.cc $(GENDIR)/src/proto/grpc/core/stats.grpc.pb.cc \ + src/cpp/util/core_stats.cc \ + +PUBLIC_HEADERS_CXX += \ + +LIBGRPC++_CORE_STATS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_CORE_STATS_SRC)))) + + +ifeq ($(NO_SECURE),true) + +# You can't build secure libraries if you don't have OpenSSL. + +$(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a: openssl_dep_error + + +else + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a: protobuf_dep_error + + +else + +$(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_CORE_STATS_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a $(LIBGRPC++_CORE_STATS_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc++_core_stats.a endif + + + endif endif ifneq ($(NO_SECURE),true) ifneq ($(NO_DEPS),true) --include $(LIBGRPC++_CRONET_OBJS:.o=.dep) +-include $(LIBGRPC++_CORE_STATS_OBJS:.o=.dep) endif endif +$(OBJDIR)/$(CONFIG)/src/cpp/util/core_stats.o: $(GENDIR)/src/proto/grpc/core/stats.pb.cc $(GENDIR)/src/proto/grpc/core/stats.grpc.pb.cc LIBGRPC++_ERROR_DETAILS_SRC = \ @@ -8097,8 +7502,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHA ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.1 + $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.2 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.2 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so endif endif @@ -8490,7 +7895,7 @@ endif LIBUPB_SRC = \ - third_party/upb/google/protobuf/descriptor.upb.c \ + third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c \ third_party/upb/upb/decode.c \ third_party/upb/upb/def.c \ third_party/upb/upb/encode.c \ @@ -8505,7 +7910,7 @@ PUBLIC_HEADERS_C += \ LIBUPB_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBUPB_SRC)))) -$(LIBUPB_OBJS): CFLAGS += -Ithird_party/upb -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers +$(LIBUPB_OBJS): CFLAGS += -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers $(LIBDIR)/$(CONFIG)/libupb.a: $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBUPB_OBJS) $(E) "[AR] Creating $@" @@ -15451,6 +14856,50 @@ endif endif +BM_THREADPOOL_SRC = \ + test/cpp/microbenchmarks/bm_threadpool.cc \ + +BM_THREADPOOL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(BM_THREADPOOL_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/bm_threadpool: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. + +$(BINDIR)/$(CONFIG)/bm_threadpool: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/bm_threadpool: $(PROTOBUF_DEP) $(BM_THREADPOOL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(BM_THREADPOOL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_threadpool + +endif + +endif + +$(BM_THREADPOOL_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX +$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_threadpool.o: $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a + +deps_bm_threadpool: $(BM_THREADPOOL_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(BM_THREADPOOL_OBJS:.o=.dep) +endif +endif + + BM_TIMER_SRC = \ test/cpp/microbenchmarks/bm_timer.cc \ @@ -22918,6 +22367,7 @@ src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc: $(OPENS src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc: $(OPENSSL_DEP) src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc: $(OPENSSL_DEP) +src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/transport/cronet_api_dummy.cc: $(OPENSSL_DEP) src/core/ext/transport/cronet/transport/cronet_transport.cc: $(OPENSSL_DEP) src/core/lib/http/httpcli_security_connector.cc: $(OPENSSL_DEP) @@ -22963,7 +22413,6 @@ src/core/lib/security/transport/target_authority_table.cc: $(OPENSSL_DEP) src/core/lib/security/transport/tsi_error.cc: $(OPENSSL_DEP) src/core/lib/security/util/json_util.cc: $(OPENSSL_DEP) src/core/lib/surface/init_secure.cc: $(OPENSSL_DEP) -src/core/plugin_registry/grpc_cronet_plugin_registry.cc: $(OPENSSL_DEP) src/core/plugin_registry/grpc_plugin_registry.cc: $(OPENSSL_DEP) src/core/tsi/alts/crypt/aes_gcm.cc: $(OPENSSL_DEP) src/core/tsi/alts/crypt/gsec.cc: $(OPENSSL_DEP) @@ -22997,7 +22446,6 @@ src/core/tsi/ssl/session_cache/ssl_session_openssl.cc: $(OPENSSL_DEP) src/core/tsi/ssl_transport_security.cc: $(OPENSSL_DEP) src/core/tsi/transport_security.cc: $(OPENSSL_DEP) src/core/tsi/transport_security_grpc.cc: $(OPENSSL_DEP) -src/cpp/client/cronet_credentials.cc: $(OPENSSL_DEP) src/cpp/client/secure_credentials.cc: $(OPENSSL_DEP) src/cpp/common/auth_property_iterator.cc: $(OPENSSL_DEP) src/cpp/common/secure_auth_context.cc: $(OPENSSL_DEP) diff --git a/WORKSPACE b/WORKSPACE index 60582d1a0f5..e8ec470efec 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -15,7 +15,7 @@ register_execution_platforms( ) register_toolchains( - "//third_party/toolchains/bazel_0.23.2_rbe_windows:cc-toolchain-x64_windows", + "//third_party/toolchains/bazel_0.26.0_rbe_windows:cc-toolchain-x64_windows", ) git_repository( @@ -65,3 +65,14 @@ rbe_autoconfig( }, ), ) + + +load("@upb//bazel:workspace_deps.bzl", "upb_deps") +upb_deps() + +load("@envoy_api//bazel:repositories.bzl", "api_dependencies") +api_dependencies() + +load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains") +go_rules_dependencies() +go_register_toolchains() diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 5f8477d7325..9fc4b1a26db 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -24,6 +24,7 @@ # load("//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library") # The set of pollers to test against if a test exercises polling POLLERS = ["epollex", "epoll1", "poll"] @@ -51,22 +52,12 @@ def _get_external_deps(external_deps): "//:grpc_no_ares": [], "//conditions:default": ["//external:cares"], }) + elif dep == "cronet_c_for_grpc": + ret += ["//third_party/objective_c/Cronet:cronet_c_for_grpc"] else: ret += ["//external:" + dep] return ret -def _maybe_update_cc_library_hdrs(hdrs): - ret = [] - hdrs_to_update = { - "third_party/objective_c/Cronet/bidirectional_stream_c.h": "//third_party:objective_c/Cronet/bidirectional_stream_c.h", - } - for h in hdrs: - if h in hdrs_to_update.keys(): - ret.append(hdrs_to_update[h]) - else: - ret.append(h) - return ret - def grpc_cc_library( name, srcs = [], @@ -106,7 +97,7 @@ def grpc_cc_library( "//:grpc_disallow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=0"], "//conditions:default": [], }), - hdrs = _maybe_update_cc_library_hdrs(hdrs + public_hdrs), + hdrs = hdrs + public_hdrs, deps = deps + _get_external_deps(external_deps), copts = copts, visibility = visibility, @@ -248,3 +239,7 @@ def grpc_package(name, visibility = "private", features = []): default_visibility = visibility, features = features, ) + +def grpc_upb_proto_library(name, deps): + upb_proto_library(name = name, deps = deps) + diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 49def4f82c1..b8df184f734 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -172,9 +172,9 @@ def grpc_deps(): if "com_google_absl" not in native.existing_rules(): http_archive( name = "com_google_absl", - sha256 = "7ddf863ddced6fa5bf7304103f9c7aa619c20a2fcf84475512c8d3834b9d14fa", - strip_prefix = "abseil-cpp-61c9bf3e3e1c28a4aa6d7f1be4b37fd473bb5529", - url = "https://github.com/abseil/abseil-cpp/archive/61c9bf3e3e1c28a4aa6d7f1be4b37fd473bb5529.tar.gz", + sha256 = "fd4edc10767c28b23bf9f41114c6bcd9625c165a31baa0e6939f01058029a912", + strip_prefix = "abseil-cpp-74d91756c11bc22f9b0108b94da9326f7f9e376f", + url = "https://github.com/abseil/abseil-cpp/archive/74d91756c11bc22f9b0108b94da9326f7f9e376f.tar.gz", ) if "bazel_toolchains" not in native.existing_rules(): @@ -203,15 +203,27 @@ def grpc_deps(): strip_prefix = "opencensus-cpp-c9a4da319bc669a772928ffc55af4a61be1a1176", url = "https://github.com/census-instrumentation/opencensus-cpp/archive/c9a4da319bc669a772928ffc55af4a61be1a1176.tar.gz", ) - if "upb" not in native.existing_rules(): http_archive( name = "upb", - sha256 = "0e749a8973968397f849a3b42e28ee9c85dc418c2477954c2a6a4495f323241d", - strip_prefix = "upb-ed9faae0993704b033c594b072d65e1bf19207fa", - url = "https://github.com/google/upb/archive/ed9faae0993704b033c594b072d65e1bf19207fa.tar.gz", + sha256 = "73deded75313f80779eba109c32f3c59a813addf5064bf6e7c213fca1e7d8e32", + strip_prefix = "upb-423ea5ca9ce8da69611e6e95559efcb3a1ba8ad8", + url = "https://github.com/protocolbuffers/upb/archive/423ea5ca9ce8da69611e6e95559efcb3a1ba8ad8.tar.gz", + ) + if "envoy_api" not in native.existing_rules(): + http_archive( + name = "envoy_api", + sha256 = "a2c6e854fa9653b0ed6510e31ec7c51eac43d578b54cd75c0bc1898f7515c60d", + strip_prefix = "data-plane-api-a83394157ad97f4dadbc8ed81f56ad5b3a72e542", + url = "https://github.com/envoyproxy/data-plane-api/archive/a83394157ad97f4dadbc8ed81f56ad5b3a72e542.tar.gz", ) + if "io_bazel_rules_go" not in native.existing_rules(): + http_archive( + name = "io_bazel_rules_go", + urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz"], + sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329", + ) # TODO: move some dependencies from "grpc_deps" here? def grpc_test_only_deps(): """Internal, not intended for use by packages that are consuming grpc. diff --git a/build.yaml b/build.yaml index 7b4a396b19c..999c761056f 100644 --- a/build.yaml +++ b/build.yaml @@ -13,6 +13,7 @@ settings: '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here core_version: 7.0.0 + csharp_major_version: 2 g_stands_for: gangnam version: 1.23.0-dev filegroups: @@ -70,6 +71,15 @@ filegroups: - tsi_interface - tsi - grpc_shadow_boringssl +- name: alts_upb + headers: + - src/core/ext/upb-generated/altscontext.upb.h + - src/core/ext/upb-generated/handshaker.upb.h + - src/core/ext/upb-generated/transport_security_common.upb.h + src: + - src/core/ext/upb-generated/altscontext.upb.c + - src/core/ext/upb-generated/handshaker.upb.c + - src/core/ext/upb-generated/transport_security_common.upb.c - name: alts_util public_headers: - include/grpc/grpc_security.h @@ -111,6 +121,23 @@ filegroups: - test/core/util/cmdline.cc uses: - gpr_base_headers +- name: google_api_upb + headers: + - src/core/ext/upb-generated/google/protobuf/any.upb.h + - src/core/ext/upb-generated/google/protobuf/descriptor.upb.h + - src/core/ext/upb-generated/google/protobuf/duration.upb.h + - src/core/ext/upb-generated/google/protobuf/empty.upb.h + - src/core/ext/upb-generated/google/protobuf/struct.upb.h + - src/core/ext/upb-generated/google/protobuf/timestamp.upb.h + - src/core/ext/upb-generated/google/protobuf/wrappers.upb.h + src: + - src/core/ext/upb-generated/google/protobuf/any.upb.c + - src/core/ext/upb-generated/google/protobuf/descriptor.upb.c + - src/core/ext/upb-generated/google/protobuf/duration.upb.c + - src/core/ext/upb-generated/google/protobuf/empty.upb.c + - src/core/ext/upb-generated/google/protobuf/struct.upb.c + - src/core/ext/upb-generated/google/protobuf/timestamp.upb.c + - src/core/ext/upb-generated/google/protobuf/wrappers.upb.c - name: gpr_base src: - src/core/lib/gpr/alloc.cc @@ -634,6 +661,12 @@ filegroups: - grpc_base - grpc_deadline_filter - health_proto +- name: grpc_client_idle_filter + src: + - src/core/ext/filters/client_idle/client_idle_filter.cc + plugin: grpc_client_idle_filter + uses: + - grpc_base - name: grpc_codegen public_headers: - include/grpc/impl/codegen/byte_buffer.h @@ -654,6 +687,11 @@ filegroups: plugin: grpc_deadline_filter uses: - grpc_base +- name: grpc_health_upb + headers: + - src/core/ext/upb-generated/grpc/health/v1/health.upb.c + src: + - src/core/ext/upb-generated/grpc/health/v1/health.upb.h - name: grpc_http_filters headers: - src/core/ext/filters/http/client/http_client_filter.h @@ -767,6 +805,13 @@ filegroups: uses: - grpc_base - grpc_client_channel +- name: grpc_lb_upb + headers: + - src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h + src: + - src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c + uses: + - google_api_upb - name: grpc_max_age_filter headers: - src/core/ext/filters/max_age/max_age_filter.h @@ -1113,6 +1158,7 @@ filegroups: - include/grpc/grpc_security.h - include/grpc/grpc_security_constants.h headers: + - src/core/ext/transport/cronet/client/secure/cronet_channel_create.h - src/core/ext/transport/cronet/transport/cronet_transport.h - third_party/objective_c/Cronet/bidirectional_stream_c.h src: @@ -1606,6 +1652,7 @@ libs: - grpc_resolver_fake - grpc_secure - census + - grpc_client_idle_filter - grpc_max_age_filter - grpc_message_size_filter - grpc_deadline_filter @@ -1618,6 +1665,7 @@ libs: build: all language: c src: + - src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc - src/core/lib/surface/init.cc baselib: true deps_linkage: static @@ -1626,7 +1674,6 @@ libs: - grpc_base - grpc_transport_cronet_client_secure - grpc_transport_chttp2_client_secure - generate_plugin_registry: true platforms: - linux secure: true @@ -1679,6 +1726,7 @@ libs: - grpc_lb_policy_pick_first - grpc_lb_policy_round_robin - census + - grpc_client_idle_filter - grpc_max_age_filter - grpc_message_size_filter - grpc_deadline_filter @@ -1773,29 +1821,6 @@ libs: - src/cpp/util/core_stats.cc deps: - grpc++ -- name: grpc++_cronet - build: all - language: c++ - src: - - src/cpp/client/cronet_credentials.cc - - src/cpp/client/insecure_credentials.cc - - src/cpp/common/insecure_create_auth_context.cc - - src/cpp/server/insecure_server_credentials.cc - deps: - - gpr - - grpc_cronet - baselib: true - dll: true - filegroups: - - grpc++_base - - grpc++_codegen_base - - grpc++_codegen_base_src - - grpc_transport_chttp2_client_insecure - - grpc_transport_chttp2_server_insecure - - census - platforms: - - linux - secure: true - name: grpc++_error_details build: all language: c++ @@ -4458,6 +4483,27 @@ targets: - mac - linux - posix +- name: bm_threadpool + build: test + language: c++ + src: + - test/cpp/microbenchmarks/bm_threadpool.cc + deps: + - grpc_benchmark + - benchmark + - grpc++_test_util_unsecure + - grpc_test_util_unsecure + - grpc++_unsecure + - grpc_unsecure + - gpr + - grpc++_test_config + benchmark: true + defaults: benchmark + platforms: + - mac + - linux + - posix + uses_polling: false - name: bm_timer build: test language: c++ @@ -6141,7 +6187,7 @@ defaults: CXXFLAGS: -Wnon-virtual-dtor LDFLAGS: -g upb: - CFLAGS: -Ithird_party/upb -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough + CFLAGS: -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers zlib: CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration diff --git a/config.m4 b/config.m4 index 50b789bb7bb..6eeeafce9a5 100644 --- a/config.m4 +++ b/config.m4 @@ -417,6 +417,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \ src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \ src/core/ext/filters/census/grpc_context.cc \ + src/core/ext/filters/client_idle/client_idle_filter.cc \ src/core/ext/filters/max_age/max_age_filter.cc \ src/core/ext/filters/message_size/message_size_filter.cc \ src/core/ext/filters/http/client_authority_filter.cc \ @@ -702,6 +703,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/native) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/fake) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/sockaddr) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_idle) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/deadline) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/client) diff --git a/config.w32 b/config.w32 index 7048f83facf..fd7920f72fd 100644 --- a/config.w32 +++ b/config.w32 @@ -392,6 +392,7 @@ if (PHP_GRPC != "no") { "src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native\\dns_resolver.cc " + "src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr\\sockaddr_resolver.cc " + "src\\core\\ext\\filters\\census\\grpc_context.cc " + + "src\\core\\ext\\filters\\client_idle\\client_idle_filter.cc " + "src\\core\\ext\\filters\\max_age\\max_age_filter.cc " + "src\\core\\ext\\filters\\message_size\\message_size_filter.cc " + "src\\core\\ext\\filters\\http\\client_authority_filter.cc " + @@ -712,6 +713,7 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\fake"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_idle"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\deadline"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http\\client"); diff --git a/doc/command_line_tool.md b/doc/command_line_tool.md index a373cbea627..4f40481927e 100644 --- a/doc/command_line_tool.md +++ b/doc/command_line_tool.md @@ -70,6 +70,8 @@ guides for , [C++](https://github.com/grpc/grpc/blob/master/doc/server_reflection_tutorial.md) and [Go](https://github.com/grpc/grpc-go/blob/master/Documentation/server-reflection-tutorial.md) +Local proto files can be used as an alternative. See instructions [below](#Call-a-remote-method). + ## Usage ### List services @@ -185,6 +187,10 @@ We can send RPCs to a server and get responses using `grpc_cli call` command. If the proto file is not under the current directory, you can use `--proto_path` to specify a new search root. + Note that the tool will always attempt to use the reflection service first, + falling back to local proto files if the service is not found. Use + `--noremotedb` to avoid attempting to use the reflection service. + - Send non-proto rpc For using gRPC with protocols other than protobuf, you will need the exact diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index d2680ee5d03..56d6f5b3edb 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -205,7 +205,9 @@ Pod::Spec.new do |s| 'include/grpcpp/impl/codegen/sync_stream.h', 'include/grpcpp/impl/codegen/sync_stream_impl.h', 'include/grpcpp/impl/codegen/time.h', - 'include/grpcpp/impl/codegen/sync.h' + 'include/grpcpp/impl/codegen/sync.h', + 'include/grpcpp/security/cronet_credentials.h', + 'include/grpcpp/security/cronet_credentials_impl.h' end s.subspec 'Implementation' do |ss| @@ -269,6 +271,7 @@ Pod::Spec.new do |s| 'src/cpp/util/string_ref.cc', 'src/cpp/util/time_cc.cc', 'src/cpp/codegen/codegen_init.cc', + 'src/cpp/client/cronet_credentials.cc', 'src/core/lib/gpr/alloc.h', 'src/core/lib/gpr/arena.h', 'src/core/lib/gpr/env.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 9583f7f0740..a682504ff0f 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -880,6 +880,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', 'src/core/ext/filters/census/grpc_context.cc', + 'src/core/ext/filters/client_idle/client_idle_filter.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', 'src/core/ext/filters/http/client_authority_filter.cc', @@ -1232,6 +1233,7 @@ Pod::Spec.new do |s| 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', + 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.h', 'src/core/ext/transport/cronet/transport/cronet_transport.h', 'third_party/objective_c/Cronet/bidirectional_stream_c.h', 'third_party/nanopb/pb.h', diff --git a/grpc.gemspec b/grpc.gemspec index 1f4cf237ada..eda96081c73 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -816,6 +816,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc ) s.files += %w( src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc ) s.files += %w( src/core/ext/filters/census/grpc_context.cc ) + s.files += %w( src/core/ext/filters/client_idle/client_idle_filter.cc ) s.files += %w( src/core/ext/filters/max_age/max_age_filter.cc ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.cc ) s.files += %w( src/core/ext/filters/http/client_authority_filter.cc ) diff --git a/grpc.gyp b/grpc.gyp index 5eeab74d4c7..2f6eb8fbd40 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -599,6 +599,7 @@ 'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', 'src/core/ext/filters/census/grpc_context.cc', + 'src/core/ext/filters/client_idle/client_idle_filter.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', 'src/core/ext/filters/http/client_authority_filter.cc', @@ -1380,6 +1381,7 @@ 'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc', 'src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc', 'src/core/ext/filters/census/grpc_context.cc', + 'src/core/ext/filters/client_idle/client_idle_filter.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', 'src/core/ext/filters/http/client_authority_filter.cc', @@ -2158,7 +2160,7 @@ 'dependencies': [ ], 'sources': [ - 'third_party/upb/google/protobuf/descriptor.upb.c', + 'third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c', 'third_party/upb/upb/decode.c', 'third_party/upb/upb/def.c', 'third_party/upb/upb/encode.c', diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 65582e6e85d..ab29e917ed8 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -157,8 +157,9 @@ typedef struct { /** Maximum message length that the channel can send. Int valued, bytes. -1 means unlimited. */ #define GRPC_ARG_MAX_SEND_MESSAGE_LENGTH "grpc.max_send_message_length" -/** Maximum time that a channel may have no outstanding rpcs. Int valued, - milliseconds. INT_MAX means unlimited. */ +/** Maximum time that a channel may have no outstanding rpcs, after which the + * server will close the connection. Int valued, milliseconds. INT_MAX means + * unlimited. */ #define GRPC_ARG_MAX_CONNECTION_IDLE_MS "grpc.max_connection_idle_ms" /** Maximum time that a channel may exist. Int valued, milliseconds. * INT_MAX means unlimited. */ @@ -166,6 +167,14 @@ typedef struct { /** Grace period after the channel reaches its max age. Int valued, milliseconds. INT_MAX means unlimited. */ #define GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS "grpc.max_connection_age_grace_ms" +/** Timeout after the last RPC finishes on the client channel at which the + * channel goes back into IDLE state. Int valued, milliseconds. INT_MAX means + * unlimited. */ +/** TODO(qianchengz): Currently the default value is INT_MAX, which means the + * client idle filter is disabled by default. After the client idle filter + * proves no perfomance issue, we will change the default value to a reasonable + * value. */ +#define GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS "grpc.client_idle_timeout_ms" /** Enable/disable support for per-message compression. Defaults to 1, unless GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */ #define GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION "grpc.per_message_compression" diff --git a/include/grpcpp/security/credentials.h b/include/grpcpp/security/credentials.h index 5190b1b3393..4df69f996f8 100644 --- a/include/grpcpp/security/credentials.h +++ b/include/grpcpp/security/credentials.h @@ -91,11 +91,6 @@ InsecureChannelCredentials() { return ::grpc_impl::InsecureChannelCredentials(); } -static inline std::shared_ptr -CronetChannelCredentials(void* engine) { - return ::grpc_impl::CronetChannelCredentials(engine); -} - typedef ::grpc_impl::MetadataCredentialsPlugin MetadataCredentialsPlugin; static inline std::shared_ptr diff --git a/include/grpcpp/security/credentials_impl.h b/include/grpcpp/security/credentials_impl.h index e236512f43e..bd79f30ae12 100644 --- a/include/grpcpp/security/credentials_impl.h +++ b/include/grpcpp/security/credentials_impl.h @@ -228,9 +228,6 @@ std::shared_ptr CompositeCallCredentials( /// Credentials for an unencrypted, unauthenticated channel std::shared_ptr InsecureChannelCredentials(); -/// Credentials for a channel using Cronet. -std::shared_ptr CronetChannelCredentials(void* engine); - /// User defined metadata credentials. class MetadataCredentialsPlugin { public: diff --git a/include/grpcpp/security/cronet_credentials.h b/include/grpcpp/security/cronet_credentials.h new file mode 100644 index 00000000000..008570b8cdf --- /dev/null +++ b/include/grpcpp/security/cronet_credentials.h @@ -0,0 +1,33 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SECURITY_CRONET_CREDENTIALS_H +#define GRPCPP_SECURITY_CRONET_CREDENTIALS_H + +#include + +namespace grpc { + +static inline std::shared_ptr +CronetChannelCredentials(void* engine) { + return ::grpc_impl::CronetChannelCredentials(engine); +} + +} // namespace grpc + +#endif // GRPCPP_SECURITY_CRONET_CREDENTIALS_H diff --git a/include/grpcpp/security/cronet_credentials_impl.h b/include/grpcpp/security/cronet_credentials_impl.h new file mode 100644 index 00000000000..e9211581348 --- /dev/null +++ b/include/grpcpp/security/cronet_credentials_impl.h @@ -0,0 +1,33 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPCPP_SECURITY_CRONET_CREDENTIALS_IMPL_H +#define GRPCPP_SECURITY_CRONET_CREDENTIALS_IMPL_H + +#include + +namespace grpc_impl { + +class ChannelCredentials; + +/// Credentials for a channel using Cronet. +std::shared_ptr CronetChannelCredentials(void* engine); + +} // namespace grpc_impl + +#endif // GRPCPP_SECURITY_CRONET_CREDENTIALS_IMPL_H diff --git a/package.xml b/package.xml index 584c6510a60..cb221ff932d 100644 --- a/package.xml +++ b/package.xml @@ -821,6 +821,7 @@ + diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index a45408a4cb8..d7ba4f2636a 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -437,8 +437,8 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor* service, "/// The channel to use to make remote " "calls.\n", "servicename", GetServiceClassName(service)); - out->Print("public $name$(grpc::Channel channel) : base(channel)\n", "name", - GetClientClassName(service)); + out->Print("public $name$(grpc::ChannelBase channel) : base(channel)\n", + "name", GetClientClassName(service)); out->Print("{\n"); out->Print("}\n"); } diff --git a/src/compiler/objective_c_generator_helpers.h b/src/compiler/objective_c_generator_helpers.h index a284da97f4b..0ed27738c2e 100644 --- a/src/compiler/objective_c_generator_helpers.h +++ b/src/compiler/objective_c_generator_helpers.h @@ -45,6 +45,16 @@ inline ::grpc::string LocalImport(const ::grpc::string& import) { return ::grpc::string("#import \"" + import + "\"\n"); } +inline ::grpc::string FrameworkImport(const ::grpc::string& import, + const ::grpc::string& framework) { + // Flattens the directory structure: grab the file name only + std::size_t pos = import.rfind("/"); + // If pos is npos, pos + 1 is 0, which gives us the entire string, + // so there's no need to check that + ::grpc::string filename = import.substr(pos + 1, import.size() - (pos + 1)); + return ::grpc::string("#import <" + framework + "/" + filename + ">\n"); +} + inline ::grpc::string SystemImport(const ::grpc::string& import) { return ::grpc::string("#import <" + import + ">\n"); } diff --git a/src/compiler/objective_c_plugin.cc b/src/compiler/objective_c_plugin.cc index 87977095d05..f398033f6db 100644 --- a/src/compiler/objective_c_plugin.cc +++ b/src/compiler/objective_c_plugin.cc @@ -29,6 +29,7 @@ using ::google::protobuf::compiler::objectivec:: IsProtobufLibraryBundledProtoFile; using ::google::protobuf::compiler::objectivec::ProtobufLibraryFrameworkName; +using ::grpc_objective_c_generator::FrameworkImport; using ::grpc_objective_c_generator::LocalImport; using ::grpc_objective_c_generator::PreprocIfElse; using ::grpc_objective_c_generator::PreprocIfNot; @@ -37,11 +38,16 @@ using ::grpc_objective_c_generator::SystemImport; namespace { inline ::grpc::string ImportProtoHeaders( - const grpc::protobuf::FileDescriptor* dep, const char* indent) { + const grpc::protobuf::FileDescriptor* dep, const char* indent, + const ::grpc::string& framework) { ::grpc::string header = grpc_objective_c_generator::MessageHeaderName(dep); if (!IsProtobufLibraryBundledProtoFile(dep)) { - return indent + LocalImport(header); + if (framework.empty()) { + return indent + LocalImport(header); + } else { + return indent + FrameworkImport(header, framework); + } } ::grpc::string base_name = header; @@ -74,6 +80,28 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { return true; } + ::grpc::string framework; + std::vector<::grpc::string> params_list = + grpc_generator::tokenize(parameter, ","); + for (auto param_str = params_list.begin(); param_str != params_list.end(); + ++param_str) { + std::vector<::grpc::string> param = + grpc_generator::tokenize(*param_str, "="); + if (param[0] == "generate_for_named_framework") { + if (param.size() != 2) { + *error = + grpc::string("Format: generate_for_named_framework="); + return false; + } else if (param[1].empty()) { + *error = grpc::string( + "Name of framework cannot be empty for parameter: ") + + param[0]; + return false; + } + framework = param[1]; + } + } + static const ::grpc::string kNonNullBegin = "NS_ASSUME_NONNULL_BEGIN\n"; static const ::grpc::string kNonNullEnd = "NS_ASSUME_NONNULL_END\n"; static const ::grpc::string kProtocolOnly = "GPB_GRPC_PROTOCOL_ONLY"; @@ -86,7 +114,12 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { { // Generate .pbrpc.h - ::grpc::string imports = LocalImport(file_name + ".pbobjc.h"); + ::grpc::string imports; + if (framework.empty()) { + imports = LocalImport(file_name + ".pbobjc.h"); + } else { + imports = FrameworkImport(file_name + ".pbobjc.h", framework); + } ::grpc::string system_imports = SystemImport("ProtoRPC/ProtoService.h") + SystemImport("ProtoRPC/ProtoRPC.h") + @@ -106,7 +139,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ::grpc::string class_imports; for (int i = 0; i < file->dependency_count(); i++) { - class_imports += ImportProtoHeaders(file->dependency(i), " "); + class_imports += + ImportProtoHeaders(file->dependency(i), " ", framework); } ::grpc::string ng_protocols; @@ -141,14 +175,22 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { { // Generate .pbrpc.m - ::grpc::string imports = LocalImport(file_name + ".pbrpc.h") + - LocalImport(file_name + ".pbobjc.h") + - SystemImport("ProtoRPC/ProtoRPC.h") + - SystemImport("RxLibrary/GRXWriter+Immediate.h"); + ::grpc::string imports; + if (framework.empty()) { + imports = LocalImport(file_name + ".pbrpc.h") + + LocalImport(file_name + ".pbobjc.h") + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriter+Immediate.h"); + } else { + imports = FrameworkImport(file_name + ".pbrpc.h", framework) + + FrameworkImport(file_name + ".pbobjc.h", framework) + + SystemImport("ProtoRPC/ProtoRPC.h") + + SystemImport("RxLibrary/GRXWriter+Immediate.h"); + } ::grpc::string class_imports; for (int i = 0; i < file->dependency_count(); i++) { - class_imports += ImportProtoHeaders(file->dependency(i), ""); + class_imports += ImportProtoHeaders(file->dependency(i), "", framework); } ::grpc::string definitions; diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 9aeb4be76d8..7aafca6f8ae 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -147,6 +147,9 @@ class ChannelData { return service_config_; } + RefCountedPtr GetConnectedSubchannelInDataPlane( + SubchannelInterface* subchannel) const; + grpc_connectivity_state CheckConnectivityState(bool try_to_connect); void AddExternalConnectivityWatcher(grpc_polling_entity pollent, grpc_connectivity_state* state, @@ -161,9 +164,9 @@ class ChannelData { } private: + class SubchannelWrapper; class ConnectivityStateAndPickerSetter; class ServiceConfigSetter; - class GrpcSubchannel; class ClientChannelControlHelper; class ExternalConnectivityWatcher { @@ -268,7 +271,14 @@ class ChannelData { UniquePtr health_check_service_name_; RefCountedPtr saved_service_config_; bool received_first_resolver_result_ = false; + // The number of SubchannelWrapper instances referencing a given Subchannel. Map subchannel_refcount_map_; + // Pending ConnectedSubchannel updates for each SubchannelWrapper. + // Updates are queued here in the control plane combiner and then applied + // in the data plane combiner when the picker is updated. + Map, RefCountedPtr, + RefCountedPtrLess> + pending_subchannel_updates_; // // Fields accessed from both data plane and control plane combiners. @@ -310,6 +320,54 @@ class CallData { private: class QueuedPickCanceller; + class Metadata : public LoadBalancingPolicy::MetadataInterface { + public: + Metadata(CallData* calld, grpc_metadata_batch* batch) + : calld_(calld), batch_(batch) {} + + void Add(StringView key, StringView value) override { + grpc_linked_mdelem* linked_mdelem = static_cast( + calld_->arena_->Alloc(sizeof(grpc_linked_mdelem))); + linked_mdelem->md = grpc_mdelem_from_slices( + grpc_core::ExternallyManagedSlice(key.data(), key.size()), + grpc_core::ExternallyManagedSlice(value.data(), value.size())); + GPR_ASSERT(grpc_metadata_batch_link_tail(batch_, linked_mdelem) == + GRPC_ERROR_NONE); + } + + Iterator Begin() const override { + static_assert(sizeof(grpc_linked_mdelem*) <= sizeof(Iterator), + "iterator size too large"); + return reinterpret_cast(batch_->list.head); + } + bool IsEnd(Iterator it) const override { + return reinterpret_cast(it) == nullptr; + } + void Next(Iterator* it) const override { + *it = reinterpret_cast( + reinterpret_cast(*it)->next); + } + StringView Key(Iterator it) const override { + return StringView( + GRPC_MDKEY(reinterpret_cast(it)->md)); + } + StringView Value(Iterator it) const override { + return StringView( + GRPC_MDVALUE(reinterpret_cast(it)->md)); + } + + void Erase(Iterator* it) override { + grpc_linked_mdelem* linked_mdelem = + reinterpret_cast(*it); + *it = reinterpret_cast(linked_mdelem->next); + grpc_metadata_batch_remove(batch_, linked_mdelem); + } + + private: + CallData* calld_; + grpc_metadata_batch* batch_; + }; + class LbCallState : public LoadBalancingPolicy::CallState { public: explicit LbCallState(CallData* calld) : calld_(calld) {} @@ -650,7 +708,8 @@ class CallData { LbCallState lb_call_state_; RefCountedPtr connected_subchannel_; void (*lb_recv_trailing_metadata_ready_)( - void* user_data, grpc_metadata_batch* recv_trailing_metadata, + void* user_data, + LoadBalancingPolicy::MetadataInterface* recv_trailing_metadata, LoadBalancingPolicy::CallState* call_state) = nullptr; void* lb_recv_trailing_metadata_ready_user_data_ = nullptr; grpc_closure pick_closure_; @@ -712,6 +771,247 @@ class CallData { grpc_metadata_batch send_trailing_metadata_; }; +// +// ChannelData::SubchannelWrapper +// + +// This class is a wrapper for Subchannel that hides details of the +// channel's implementation (such as the health check service name and +// connected subchannel) from the LB policy API. +// +// Note that no synchronization is needed here, because even if the +// underlying subchannel is shared between channels, this wrapper will only +// be used within one channel, so it will always be synchronized by the +// control plane combiner. +class ChannelData::SubchannelWrapper : public SubchannelInterface { + public: + SubchannelWrapper(ChannelData* chand, Subchannel* subchannel, + UniquePtr health_check_service_name) + : SubchannelInterface(&grpc_client_channel_routing_trace), + chand_(chand), + subchannel_(subchannel), + health_check_service_name_(std::move(health_check_service_name)) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { + gpr_log(GPR_INFO, + "chand=%p: creating subchannel wrapper %p for subchannel %p", + chand, this, subchannel_); + } + GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "SubchannelWrapper"); + auto* subchannel_node = subchannel_->channelz_node(); + if (subchannel_node != nullptr) { + intptr_t subchannel_uuid = subchannel_node->uuid(); + auto it = chand_->subchannel_refcount_map_.find(subchannel_); + if (it == chand_->subchannel_refcount_map_.end()) { + chand_->channelz_node_->AddChildSubchannel(subchannel_uuid); + it = chand_->subchannel_refcount_map_.emplace(subchannel_, 0).first; + } + ++it->second; + } + } + + ~SubchannelWrapper() { + if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { + gpr_log(GPR_INFO, + "chand=%p: destroying subchannel wrapper %p for subchannel %p", + chand_, this, subchannel_); + } + auto* subchannel_node = subchannel_->channelz_node(); + if (subchannel_node != nullptr) { + intptr_t subchannel_uuid = subchannel_node->uuid(); + auto it = chand_->subchannel_refcount_map_.find(subchannel_); + GPR_ASSERT(it != chand_->subchannel_refcount_map_.end()); + --it->second; + if (it->second == 0) { + chand_->channelz_node_->RemoveChildSubchannel(subchannel_uuid); + chand_->subchannel_refcount_map_.erase(it); + } + } + GRPC_SUBCHANNEL_UNREF(subchannel_, "unref from LB"); + GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "SubchannelWrapper"); + } + + grpc_connectivity_state CheckConnectivityState() override { + RefCountedPtr connected_subchannel; + grpc_connectivity_state connectivity_state = + subchannel_->CheckConnectivityState(health_check_service_name_.get(), + &connected_subchannel); + MaybeUpdateConnectedSubchannel(std::move(connected_subchannel)); + return connectivity_state; + } + + void WatchConnectivityState( + grpc_connectivity_state initial_state, + UniquePtr watcher) override { + auto& watcher_wrapper = watcher_map_[watcher.get()]; + GPR_ASSERT(watcher_wrapper == nullptr); + watcher_wrapper = New( + std::move(watcher), Ref(DEBUG_LOCATION, "WatcherWrapper")); + subchannel_->WatchConnectivityState( + initial_state, + UniquePtr(gpr_strdup(health_check_service_name_.get())), + OrphanablePtr( + watcher_wrapper)); + } + + void CancelConnectivityStateWatch( + ConnectivityStateWatcherInterface* watcher) override { + auto it = watcher_map_.find(watcher); + GPR_ASSERT(it != watcher_map_.end()); + subchannel_->CancelConnectivityStateWatch(health_check_service_name_.get(), + it->second); + watcher_map_.erase(it); + } + + void AttemptToConnect() override { subchannel_->AttemptToConnect(); } + + void ResetBackoff() override { subchannel_->ResetBackoff(); } + + const grpc_channel_args* channel_args() override { + return subchannel_->channel_args(); + } + + // Caller must be holding the control-plane combiner. + ConnectedSubchannel* connected_subchannel() const { + return connected_subchannel_.get(); + } + + // Caller must be holding the data-plane combiner. + ConnectedSubchannel* connected_subchannel_in_data_plane() const { + return connected_subchannel_in_data_plane_.get(); + } + void set_connected_subchannel_in_data_plane( + RefCountedPtr connected_subchannel) { + connected_subchannel_in_data_plane_ = std::move(connected_subchannel); + } + + private: + // Subchannel and SubchannelInterface have different interfaces for + // their respective ConnectivityStateWatcherInterface classes. + // The one in Subchannel updates the ConnectedSubchannel along with + // the state, whereas the one in SubchannelInterface does not expose + // the ConnectedSubchannel. + // + // This wrapper provides a bridge between the two. It implements + // Subchannel::ConnectivityStateWatcherInterface and wraps + // the instance of SubchannelInterface::ConnectivityStateWatcherInterface + // that was passed in by the LB policy. We pass an instance of this + // class to the underlying Subchannel, and when we get updates from + // the subchannel, we pass those on to the wrapped watcher to return + // the update to the LB policy. This allows us to set the connected + // subchannel before passing the result back to the LB policy. + class WatcherWrapper : public Subchannel::ConnectivityStateWatcherInterface { + public: + WatcherWrapper( + UniquePtr + watcher, + RefCountedPtr parent) + : watcher_(std::move(watcher)), parent_(std::move(parent)) {} + + ~WatcherWrapper() { parent_.reset(DEBUG_LOCATION, "WatcherWrapper"); } + + void Orphan() override { Unref(); } + + void OnConnectivityStateChange( + grpc_connectivity_state new_state, + RefCountedPtr connected_subchannel) override { + if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { + gpr_log(GPR_INFO, + "chand=%p: connectivity change for subchannel wrapper %p " + "subchannel %p (connected_subchannel=%p state=%s); " + "hopping into combiner", + parent_->chand_, parent_.get(), parent_->subchannel_, + connected_subchannel.get(), + grpc_connectivity_state_name(new_state)); + } + // Will delete itself. + New(Ref(), new_state, std::move(connected_subchannel)); + } + + grpc_pollset_set* interested_parties() override { + return watcher_->interested_parties(); + } + + private: + class Updater { + public: + Updater(RefCountedPtr parent, + grpc_connectivity_state new_state, + RefCountedPtr connected_subchannel) + : parent_(std::move(parent)), + state_(new_state), + connected_subchannel_(std::move(connected_subchannel)) { + GRPC_CLOSURE_INIT( + &closure_, ApplyUpdateInControlPlaneCombiner, this, + grpc_combiner_scheduler(parent_->parent_->chand_->combiner_)); + GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE); + } + + private: + static void ApplyUpdateInControlPlaneCombiner(void* arg, + grpc_error* error) { + Updater* self = static_cast(arg); + if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { + gpr_log(GPR_INFO, + "chand=%p: processing connectivity change in combiner " + "for subchannel wrapper %p subchannel %p " + "(connected_subchannel=%p state=%s)", + self->parent_->parent_->chand_, self->parent_->parent_.get(), + self->parent_->parent_->subchannel_, + self->connected_subchannel_.get(), + grpc_connectivity_state_name(self->state_)); + } + self->parent_->parent_->MaybeUpdateConnectedSubchannel( + std::move(self->connected_subchannel_)); + self->parent_->watcher_->OnConnectivityStateChange(self->state_); + Delete(self); + } + + RefCountedPtr parent_; + grpc_connectivity_state state_; + RefCountedPtr connected_subchannel_; + grpc_closure closure_; + }; + + UniquePtr watcher_; + RefCountedPtr parent_; + }; + + void MaybeUpdateConnectedSubchannel( + RefCountedPtr connected_subchannel) { + // Update the connected subchannel only if the channel is not shutting + // down. This is because once the channel is shutting down, we + // ignore picker updates from the LB policy, which means that + // ConnectivityStateAndPickerSetter will never process the entries + // in chand_->pending_subchannel_updates_. So we don't want to add + // entries there that will never be processed, since that would + // leave dangling refs to the channel and prevent its destruction. + grpc_error* disconnect_error = chand_->disconnect_error(); + if (disconnect_error != GRPC_ERROR_NONE) return; + // Not shutting down, so do the update. + if (connected_subchannel_ != connected_subchannel) { + connected_subchannel_ = std::move(connected_subchannel); + // Record the new connected subchannel so that it can be updated + // in the data plane combiner the next time the picker is updated. + chand_->pending_subchannel_updates_[Ref( + DEBUG_LOCATION, "ConnectedSubchannelUpdate")] = connected_subchannel_; + } + } + + ChannelData* chand_; + Subchannel* subchannel_; + UniquePtr health_check_service_name_; + // Maps from the address of the watcher passed to us by the LB policy + // to the address of the WrapperWatcher that we passed to the underlying + // subchannel. This is needed so that when the LB policy calls + // CancelConnectivityStateWatch() with its watcher, we know the + // corresponding WrapperWatcher to cancel on the underlying subchannel. + Map watcher_map_; + // To be accessed only in the control plane combiner. + RefCountedPtr connected_subchannel_; + // To be accessed only in the data plane combiner. + RefCountedPtr connected_subchannel_in_data_plane_; +}; + // // ChannelData::ConnectivityStateAndPickerSetter // @@ -726,6 +1026,13 @@ class ChannelData::ConnectivityStateAndPickerSetter { ChannelData* chand, grpc_connectivity_state state, const char* reason, UniquePtr picker) : chand_(chand), picker_(std::move(picker)) { + // Clean the control plane when entering IDLE, while holding control plane + // combiner. + if (picker_ == nullptr) { + chand->health_check_service_name_.reset(); + chand->saved_service_config_.reset(); + chand->received_first_resolver_result_ = false; + } // Update connectivity state here, while holding control plane combiner. grpc_connectivity_state_set(&chand->state_tracker_, state, reason); if (chand->channelz_node_ != nullptr) { @@ -736,25 +1043,56 @@ class ChannelData::ConnectivityStateAndPickerSetter { channelz::ChannelNode::GetChannelConnectivityStateChangeString( state))); } + // Grab any pending subchannel updates. + pending_subchannel_updates_ = + std::move(chand_->pending_subchannel_updates_); // Bounce into the data plane combiner to reset the picker. GRPC_CHANNEL_STACK_REF(chand->owning_stack_, "ConnectivityStateAndPickerSetter"); - GRPC_CLOSURE_INIT(&closure_, SetPicker, this, + GRPC_CLOSURE_INIT(&closure_, SetPickerInDataPlane, this, grpc_combiner_scheduler(chand->data_plane_combiner_)); GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE); } private: - static void SetPicker(void* arg, grpc_error* ignored) { + static void SetPickerInDataPlane(void* arg, grpc_error* ignored) { auto* self = static_cast(arg); - // Update picker. - self->chand_->picker_ = std::move(self->picker_); + // Handle subchannel updates. + for (auto& p : self->pending_subchannel_updates_) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { + gpr_log(GPR_INFO, + "chand=%p: updating subchannel wrapper %p data plane " + "connected_subchannel to %p", + self->chand_, p.first.get(), p.second.get()); + } + p.first->set_connected_subchannel_in_data_plane(std::move(p.second)); + } + // Swap out the picker. We hang on to the old picker so that it can + // be deleted in the control-plane combiner, since that's where we need + // to unref the subchannel wrappers that are reffed by the picker. + self->picker_.swap(self->chand_->picker_); + // Clean the data plane if the updated picker is nullptr. + if (self->chand_->picker_ == nullptr) { + self->chand_->received_service_config_data_ = false; + self->chand_->retry_throttle_data_.reset(); + self->chand_->service_config_.reset(); + } // Re-process queued picks. for (QueuedPick* pick = self->chand_->queued_picks_; pick != nullptr; pick = pick->next) { CallData::StartPickLocked(pick->elem, GRPC_ERROR_NONE); } - // Clean up. + // Pop back into the control plane combiner to delete ourself, so + // that we make sure to unref subchannel wrappers there. This + // includes both the ones reffed by the old picker (now stored in + // self->picker_) and the ones in self->pending_subchannel_updates_. + GRPC_CLOSURE_INIT(&self->closure_, CleanUpInControlPlane, self, + grpc_combiner_scheduler(self->chand_->combiner_)); + GRPC_CLOSURE_SCHED(&self->closure_, GRPC_ERROR_NONE); + } + + static void CleanUpInControlPlane(void* arg, grpc_error* ignored) { + auto* self = static_cast(arg); GRPC_CHANNEL_STACK_UNREF(self->chand_->owning_stack_, "ConnectivityStateAndPickerSetter"); Delete(self); @@ -762,6 +1100,9 @@ class ChannelData::ConnectivityStateAndPickerSetter { ChannelData* chand_; UniquePtr picker_; + Map, RefCountedPtr, + RefCountedPtrLess> + pending_subchannel_updates_; grpc_closure closure_; }; @@ -936,89 +1277,6 @@ void ChannelData::ExternalConnectivityWatcher::WatchConnectivityStateLocked( &self->chand_->state_tracker_, self->state_, &self->my_closure_); } -// -// ChannelData::GrpcSubchannel -// - -// This class is a wrapper for Subchannel that hides details of the -// channel's implementation (such as the health check service name) from -// the LB policy API. -// -// Note that no synchronization is needed here, because even if the -// underlying subchannel is shared between channels, this wrapper will only -// be used within one channel, so it will always be synchronized by the -// control plane combiner. -class ChannelData::GrpcSubchannel : public SubchannelInterface { - public: - GrpcSubchannel(ChannelData* chand, Subchannel* subchannel, - UniquePtr health_check_service_name) - : chand_(chand), - subchannel_(subchannel), - health_check_service_name_(std::move(health_check_service_name)) { - GRPC_CHANNEL_STACK_REF(chand_->owning_stack_, "GrpcSubchannel"); - auto* subchannel_node = subchannel_->channelz_node(); - if (subchannel_node != nullptr) { - intptr_t subchannel_uuid = subchannel_node->uuid(); - auto it = chand_->subchannel_refcount_map_.find(subchannel_); - if (it == chand_->subchannel_refcount_map_.end()) { - chand_->channelz_node_->AddChildSubchannel(subchannel_uuid); - it = chand_->subchannel_refcount_map_.emplace(subchannel_, 0).first; - } - ++it->second; - } - } - - ~GrpcSubchannel() { - auto* subchannel_node = subchannel_->channelz_node(); - if (subchannel_node != nullptr) { - intptr_t subchannel_uuid = subchannel_node->uuid(); - auto it = chand_->subchannel_refcount_map_.find(subchannel_); - GPR_ASSERT(it != chand_->subchannel_refcount_map_.end()); - --it->second; - if (it->second == 0) { - chand_->channelz_node_->RemoveChildSubchannel(subchannel_uuid); - chand_->subchannel_refcount_map_.erase(it); - } - } - GRPC_SUBCHANNEL_UNREF(subchannel_, "unref from LB"); - GRPC_CHANNEL_STACK_UNREF(chand_->owning_stack_, "GrpcSubchannel"); - } - - grpc_connectivity_state CheckConnectivityState( - RefCountedPtr* connected_subchannel) - override { - RefCountedPtr tmp; - auto retval = subchannel_->CheckConnectivityState( - health_check_service_name_.get(), &tmp); - *connected_subchannel = std::move(tmp); - return retval; - } - - void WatchConnectivityState( - grpc_connectivity_state initial_state, - UniquePtr watcher) override { - subchannel_->WatchConnectivityState( - initial_state, - UniquePtr(gpr_strdup(health_check_service_name_.get())), - std::move(watcher)); - } - - void CancelConnectivityStateWatch( - ConnectivityStateWatcher* watcher) override { - subchannel_->CancelConnectivityStateWatch(health_check_service_name_.get(), - watcher); - } - - void AttemptToConnect() override { subchannel_->AttemptToConnect(); } - - void ResetBackoff() override { subchannel_->ResetBackoff(); } - - private: - ChannelData* chand_; - Subchannel* subchannel_; - UniquePtr health_check_service_name_; -}; - // // ChannelData::ClientChannelControlHelper // @@ -1056,8 +1314,8 @@ class ChannelData::ClientChannelControlHelper chand_->client_channel_factory_->CreateSubchannel(new_args); grpc_channel_args_destroy(new_args); if (subchannel == nullptr) return nullptr; - return MakeRefCounted(chand_, subchannel, - std::move(health_check_service_name)); + return MakeRefCounted( + chand_, subchannel, std::move(health_check_service_name)); } grpc_channel* CreateChannel(const char* target, @@ -1068,8 +1326,7 @@ class ChannelData::ClientChannelControlHelper void UpdateState( grpc_connectivity_state state, UniquePtr picker) override { - grpc_error* disconnect_error = - chand_->disconnect_error_.Load(MemoryOrder::ACQUIRE); + grpc_error* disconnect_error = chand_->disconnect_error(); if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { const char* extra = disconnect_error == GRPC_ERROR_NONE ? "" @@ -1443,9 +1700,13 @@ grpc_error* ChannelData::DoPingLocked(grpc_transport_op* op) { } LoadBalancingPolicy::PickResult result = picker_->Pick(LoadBalancingPolicy::PickArgs()); - if (result.connected_subchannel != nullptr) { - ConnectedSubchannel* connected_subchannel = - static_cast(result.connected_subchannel.get()); + ConnectedSubchannel* connected_subchannel = nullptr; + if (result.subchannel != nullptr) { + SubchannelWrapper* subchannel = + static_cast(result.subchannel.get()); + connected_subchannel = subchannel->connected_subchannel(); + } + if (connected_subchannel != nullptr) { connected_subchannel->Ping(op->send_ping.on_initiate, op->send_ping.on_ack); } else { if (result.error == GRPC_ERROR_NONE) { @@ -1486,19 +1747,35 @@ void ChannelData::StartTransportOpLocked(void* arg, grpc_error* ignored) { chand->resolving_lb_policy_->ResetBackoffLocked(); } } - // Disconnect. + // Disconnect or enter IDLE. if (op->disconnect_with_error != GRPC_ERROR_NONE) { - grpc_error* error = GRPC_ERROR_NONE; - GPR_ASSERT(chand->disconnect_error_.CompareExchangeStrong( - &error, op->disconnect_with_error, MemoryOrder::ACQ_REL, - MemoryOrder::ACQUIRE)); + if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) { + gpr_log(GPR_INFO, "chand=%p: disconnect_with_error: %s", chand, + grpc_error_string(op->disconnect_with_error)); + } chand->DestroyResolvingLoadBalancingPolicyLocked(); - // Will delete itself. - New( - chand, GRPC_CHANNEL_SHUTDOWN, "shutdown from API", - UniquePtr( - New( - GRPC_ERROR_REF(op->disconnect_with_error)))); + intptr_t value; + if (grpc_error_get_int(op->disconnect_with_error, + GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, &value) && + static_cast(value) == GRPC_CHANNEL_IDLE) { + if (chand->disconnect_error() == GRPC_ERROR_NONE) { + // Enter IDLE state. + New(chand, GRPC_CHANNEL_IDLE, + "channel entering IDLE", nullptr); + } + GRPC_ERROR_UNREF(op->disconnect_with_error); + } else { + // Disconnect. + GPR_ASSERT(chand->disconnect_error_.Load(MemoryOrder::RELAXED) == + GRPC_ERROR_NONE); + chand->disconnect_error_.Store(op->disconnect_with_error, + MemoryOrder::RELEASE); + New( + chand, GRPC_CHANNEL_SHUTDOWN, "shutdown from API", + UniquePtr( + New( + GRPC_ERROR_REF(op->disconnect_with_error)))); + } } GRPC_CHANNEL_STACK_UNREF(chand->owning_stack_, "start_transport_op"); GRPC_CLOSURE_SCHED(op->on_consumed, GRPC_ERROR_NONE); @@ -1559,6 +1836,17 @@ void ChannelData::RemoveQueuedPick(QueuedPick* to_remove, } } +RefCountedPtr +ChannelData::GetConnectedSubchannelInDataPlane( + SubchannelInterface* subchannel) const { + SubchannelWrapper* subchannel_wrapper = + static_cast(subchannel); + ConnectedSubchannel* connected_subchannel = + subchannel_wrapper->connected_subchannel_in_data_plane(); + if (connected_subchannel == nullptr) return nullptr; + return connected_subchannel->Ref(); +} + void ChannelData::TryToConnectLocked(void* arg, grpc_error* error_ignored) { auto* chand = static_cast(arg); if (chand->resolving_lb_policy_ != nullptr) { @@ -1870,9 +2158,10 @@ void CallData::RecvTrailingMetadataReadyForLoadBalancingPolicy( void* arg, grpc_error* error) { CallData* calld = static_cast(arg); // Invoke callback to LB policy. + Metadata trailing_metadata(calld, calld->recv_trailing_metadata_); calld->lb_recv_trailing_metadata_ready_( - calld->lb_recv_trailing_metadata_ready_user_data_, - calld->recv_trailing_metadata_, &calld->lb_call_state_); + calld->lb_recv_trailing_metadata_ready_user_data_, &trailing_metadata, + &calld->lb_call_state_); // Chain to original callback. GRPC_CLOSURE_RUN(calld->original_recv_trailing_metadata_ready_, GRPC_ERROR_REF(error)); @@ -3477,11 +3766,13 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { // attempt) to the LB policy instead the one from the parent channel. LoadBalancingPolicy::PickArgs pick_args; pick_args.call_state = &calld->lb_call_state_; - pick_args.initial_metadata = + Metadata initial_metadata( + calld, calld->seen_send_initial_metadata_ ? &calld->send_initial_metadata_ : calld->pending_batches_[0] - .batch->payload->send_initial_metadata.send_initial_metadata; + .batch->payload->send_initial_metadata.send_initial_metadata); + pick_args.initial_metadata = &initial_metadata; // Grab initial metadata flags so that we can check later if the call has // wait_for_ready enabled. const uint32_t send_initial_metadata_flags = @@ -3497,10 +3788,9 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { auto result = chand->picker()->Pick(pick_args); if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) { gpr_log(GPR_INFO, - "chand=%p calld=%p: LB pick returned %s (connected_subchannel=%p, " - "error=%s)", + "chand=%p calld=%p: LB pick returned %s (subchannel=%p, error=%s)", chand, calld, PickResultTypeName(result.type), - result.connected_subchannel.get(), grpc_error_string(result.error)); + result.subchannel.get(), grpc_error_string(result.error)); } switch (result.type) { case LoadBalancingPolicy::PickResult::PICK_TRANSIENT_FAILURE: { @@ -3542,11 +3832,16 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) { break; default: // PICK_COMPLETE // Handle drops. - if (GPR_UNLIKELY(result.connected_subchannel == nullptr)) { + if (GPR_UNLIKELY(result.subchannel == nullptr)) { result.error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Call dropped by load balancing policy"); + } else { + // Grab a ref to the connected subchannel while we're still + // holding the data plane combiner. + calld->connected_subchannel_ = + chand->GetConnectedSubchannelInDataPlane(result.subchannel.get()); + GPR_ASSERT(calld->connected_subchannel_ != nullptr); } - calld->connected_subchannel_ = std::move(result.connected_subchannel); calld->lb_recv_trailing_metadata_ready_ = result.recv_trailing_metadata_ready; calld->lb_recv_trailing_metadata_ready_user_data_ = diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.cc b/src/core/ext/filters/client_channel/client_channel_channelz.cc index a489685df40..87a76601f02 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.cc +++ b/src/core/ext/filters/client_channel/client_channel_channelz.cc @@ -32,7 +32,8 @@ namespace channelz { SubchannelNode::SubchannelNode(const char* target_address, size_t channel_tracer_max_nodes) - : BaseNode(EntityType::kSubchannel), + : BaseNode(EntityType::kSubchannel, + UniquePtr(gpr_strdup(target_address))), target_(UniquePtr(gpr_strdup(target_address))), trace_(channel_tracer_max_nodes) {} @@ -42,8 +43,9 @@ void SubchannelNode::UpdateConnectivityState(grpc_connectivity_state state) { connectivity_state_.Store(state, MemoryOrder::RELAXED); } -void SubchannelNode::SetChildSocketUuid(intptr_t uuid) { - child_socket_uuid_.Store(uuid, MemoryOrder::RELAXED); +void SubchannelNode::SetChildSocket(RefCountedPtr socket) { + MutexLock lock(&socket_mu_); + child_socket_ = std::move(socket); } void SubchannelNode::PopulateConnectivityState(grpc_json* json) { @@ -88,14 +90,20 @@ grpc_json* SubchannelNode::RenderJson() { call_counter_.PopulateCallCounts(json); json = top_level_json; // populate the child socket. - intptr_t socket_uuid = child_socket_uuid_.Load(MemoryOrder::RELAXED); - if (socket_uuid != 0) { + RefCountedPtr child_socket; + { + MutexLock lock(&socket_mu_); + child_socket = child_socket_; + } + if (child_socket != nullptr && child_socket->uuid() != 0) { grpc_json* array_parent = grpc_json_create_child( nullptr, json, "socketRef", nullptr, GRPC_JSON_ARRAY, false); json_iterator = grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr, GRPC_JSON_OBJECT, false); - grpc_json_add_number_string_child(json_iterator, nullptr, "socketId", - socket_uuid); + grpc_json* sibling_iterator = grpc_json_add_number_string_child( + json_iterator, nullptr, "socketId", child_socket->uuid()); + grpc_json_create_child(sibling_iterator, json_iterator, "name", + child_socket->name(), GRPC_JSON_STRING, false); } return top_level_json; } diff --git a/src/core/ext/filters/client_channel/client_channel_channelz.h b/src/core/ext/filters/client_channel/client_channel_channelz.h index 80a6fd230c8..5a1a1adcd1b 100644 --- a/src/core/ext/filters/client_channel/client_channel_channelz.h +++ b/src/core/ext/filters/client_channel/client_channel_channelz.h @@ -40,11 +40,10 @@ class SubchannelNode : public BaseNode { // Sets the subchannel's connectivity state without health checking. void UpdateConnectivityState(grpc_connectivity_state state); - // Used when the subchannel's child socket uuid changes. This should be set - // when the subchannel's transport is created and set to 0 when the subchannel - // unrefs the transport. A uuid of 0 indicates that the child socket is no - // longer associated with this subchannel. - void SetChildSocketUuid(intptr_t uuid); + // Used when the subchannel's child socket changes. This should be set when + // the subchannel's transport is created and set to nullptr when the + // subchannel unrefs the transport. + void SetChildSocket(RefCountedPtr socket); grpc_json* RenderJson() override; @@ -66,7 +65,8 @@ class SubchannelNode : public BaseNode { void PopulateConnectivityState(grpc_json* json); Atomic connectivity_state_{GRPC_CHANNEL_IDLE}; - Atomic child_socket_uuid_{0}; + Mutex socket_mu_; + RefCountedPtr child_socket_; UniquePtr target_; CallCountingHelper call_counter_; ChannelTrace trace_; diff --git a/src/core/ext/filters/client_channel/connector.h b/src/core/ext/filters/client_channel/connector.h index ea34dcdab57..2bd5ff26e3e 100644 --- a/src/core/ext/filters/client_channel/connector.h +++ b/src/core/ext/filters/client_channel/connector.h @@ -22,6 +22,7 @@ #include #include "src/core/lib/channel/channel_stack.h" +#include "src/core/lib/channel/channelz.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/transport/transport.h" @@ -48,8 +49,15 @@ typedef struct { /** channel arguments (to be passed to the filters) */ grpc_channel_args* channel_args; - /** socket uuid of the connected transport. 0 if not available */ - intptr_t socket_uuid; + /** channelz socket node of the connected transport. nullptr if not available + */ + grpc_core::RefCountedPtr socket; + + void reset() { + transport = nullptr; + channel_args = nullptr; + socket = nullptr; + } } grpc_connect_out_args; struct grpc_connector_vtable { diff --git a/src/core/ext/filters/client_channel/lb_policy.cc b/src/core/ext/filters/client_channel/lb_policy.cc index 3e4d3703c82..3207f888044 100644 --- a/src/core/ext/filters/client_channel/lb_policy.cc +++ b/src/core/ext/filters/client_channel/lb_policy.cc @@ -43,23 +43,8 @@ LoadBalancingPolicy::~LoadBalancingPolicy() { } void LoadBalancingPolicy::Orphan() { - // Invoke ShutdownAndUnrefLocked() inside of the combiner. - // TODO(roth): Is this actually needed? We should already be in the - // combiner here. Note that if we directly call ShutdownLocked(), - // then we can probably remove the hack whereby the helper is - // destroyed at shutdown instead of at destruction. - GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_CREATE(&LoadBalancingPolicy::ShutdownAndUnrefLocked, this, - grpc_combiner_scheduler(combiner_)), - GRPC_ERROR_NONE); -} - -void LoadBalancingPolicy::ShutdownAndUnrefLocked(void* arg, - grpc_error* ignored) { - LoadBalancingPolicy* policy = static_cast(arg); - policy->ShutdownLocked(); - policy->channel_control_helper_.reset(); - policy->Unref(); + ShutdownLocked(); + Unref(); } // diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h index f98a41dee07..a205d333ae8 100644 --- a/src/core/ext/filters/client_channel/lb_policy.h +++ b/src/core/ext/filters/client_channel/lb_policy.h @@ -27,10 +27,10 @@ #include "src/core/lib/gprpp/abstract.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" +#include "src/core/lib/gprpp/string_view.h" #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/transport/connectivity_state.h" -#include "src/core/lib/transport/metadata_batch.h" namespace grpc_core { @@ -92,14 +92,44 @@ class LoadBalancingPolicy : public InternallyRefCounted { GRPC_ABSTRACT_BASE_CLASS }; + /// Interface for accessing metadata. + class MetadataInterface { + public: + // Implementations whose iterators fit in intptr_t may internally + // cast this directly to their iterator type. Otherwise, they may + // dynamically allocate their iterators and store the address here. + typedef intptr_t Iterator; + + virtual ~MetadataInterface() = default; + + /// Adds a key/value pair. + /// Does NOT take ownership of \a key or \a value. + /// Implementations must ensure that the key and value remain alive + /// until the call ends. If desired, they may be allocated via + /// CallState::Alloc(). + virtual void Add(StringView key, StringView value) GRPC_ABSTRACT; + + /// Iteration interface. + virtual Iterator Begin() const GRPC_ABSTRACT; + virtual bool IsEnd(Iterator it) const GRPC_ABSTRACT; + virtual void Next(Iterator* it) const GRPC_ABSTRACT; + virtual StringView Key(Iterator it) const GRPC_ABSTRACT; + virtual StringView Value(Iterator it) const GRPC_ABSTRACT; + + /// Removes the element pointed to by \a it, which is modified to + /// point to the next element. + virtual void Erase(Iterator* it) GRPC_ABSTRACT; + + GRPC_ABSTRACT_BASE_CLASS + }; + /// Arguments used when picking a subchannel for an RPC. struct PickArgs { /// Initial metadata associated with the picking call. /// The LB policy may use the existing metadata to influence its routing /// decision, and it may add new metadata elements to be sent with the /// call to the chosen backend. - // TODO(roth): Provide a more generic metadata API here. - grpc_metadata_batch* initial_metadata = nullptr; + MetadataInterface* initial_metadata; /// An interface for accessing call state. Can be used to allocate /// data associated with the call in an efficient way. CallState* call_state; @@ -128,7 +158,7 @@ class LoadBalancingPolicy : public InternallyRefCounted { /// Used only if type is PICK_COMPLETE. Will be set to the selected /// subchannel, or nullptr if the LB policy decides to drop the call. - RefCountedPtr connected_subchannel; + RefCountedPtr subchannel; /// Used only if type is PICK_TRANSIENT_FAILURE. /// Error to be set when returning a transient failure. @@ -145,7 +175,7 @@ class LoadBalancingPolicy : public InternallyRefCounted { /// however, so any data that needs to be used after returning must /// be copied. void (*recv_trailing_metadata_ready)( - void* user_data, grpc_metadata_batch* recv_trailing_metadata, + void* user_data, MetadataInterface* recv_trailing_metadata, CallState* call_state) = nullptr; void* recv_trailing_metadata_ready_user_data = nullptr; }; @@ -282,6 +312,7 @@ class LoadBalancingPolicy : public InternallyRefCounted { grpc_pollset_set* interested_parties() const { return interested_parties_; } + // Note: This must be invoked while holding the combiner. void Orphan() override; // A picker that returns PICK_QUEUE for all picks. @@ -322,7 +353,6 @@ class LoadBalancingPolicy : public InternallyRefCounted { // Note: LB policies MUST NOT call any method on the helper from their // constructor. - // Note: This will return null after ShutdownLocked() has been called. ChannelControlHelper* channel_control_helper() const { return channel_control_helper_.get(); } @@ -331,8 +361,6 @@ class LoadBalancingPolicy : public InternallyRefCounted { virtual void ShutdownLocked() GRPC_ABSTRACT; private: - static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored); - /// Combiner under which LB policy actions take place. grpc_combiner* combiner_; /// Owned pointer to interested parties in load balancing decisions. diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc index 3bb31fe3b08..3057b26d315 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc @@ -20,9 +20,12 @@ #include "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h" +#include + #include #include +#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h" #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/profiling/timers.h" @@ -95,22 +98,33 @@ static void start_transport_stream_op_batch( GPR_TIMER_SCOPE("clr_start_transport_stream_op_batch", 0); // Handle send_initial_metadata. if (batch->send_initial_metadata) { - // Grab client stats object from user_data for LB token metadata. - grpc_linked_mdelem* lb_token = - batch->payload->send_initial_metadata.send_initial_metadata->idx.named - .lb_token; - if (lb_token != nullptr) { + // Grab client stats object from metadata. + grpc_linked_mdelem* client_stats_md = + batch->payload->send_initial_metadata.send_initial_metadata->list.head; + for (; client_stats_md != nullptr; + client_stats_md = client_stats_md->next) { + if (GRPC_SLICE_START_PTR(GRPC_MDKEY(client_stats_md->md)) == + static_cast(grpc_core::kGrpcLbClientStatsMetadataKey)) { + break; + } + } + if (client_stats_md != nullptr) { grpc_core::GrpcLbClientStats* client_stats = - static_cast(grpc_mdelem_get_user_data( - lb_token->md, grpc_core::GrpcLbClientStats::Destroy)); + const_cast( + reinterpret_cast( + GRPC_SLICE_START_PTR(GRPC_MDVALUE(client_stats_md->md)))); if (client_stats != nullptr) { - calld->client_stats = client_stats->Ref(); + calld->client_stats.reset(client_stats); // Intercept completion. calld->original_on_complete_for_send = batch->on_complete; GRPC_CLOSURE_INIT(&calld->on_complete_for_send, on_complete_for_send, calld, grpc_schedule_on_exec_ctx); batch->on_complete = &calld->on_complete_for_send; } + // Remove metadata so it doesn't go out on the wire. + grpc_metadata_batch_remove( + batch->payload->send_initial_metadata.send_initial_metadata, + client_stats_md); } } // Intercept completion of recv_initial_metadata. diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 71e8e248770..bc4b63b74ec 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -108,11 +108,15 @@ #define GRPC_GRPCLB_DEFAULT_FALLBACK_TIMEOUT_MS 10000 #define GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN "grpc.grpclb_address_lb_token" +#define GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS "grpc.grpclb_address_client_stats" namespace grpc_core { TraceFlag grpc_lb_glb_trace(false, "glb"); +const char kGrpcLbClientStatsMetadataKey[] = "grpclb_client_stats"; +const char kGrpcLbLbTokenMetadataKey[] = "lb-token"; + namespace { constexpr char kGrpclb[] = "grpclb"; @@ -445,24 +449,44 @@ UniquePtr GrpcLb::Serverlist::AsText() const { return result; } -// vtable for LB token channel arg. +// vtables for channel args for LB token and client stats. void* lb_token_copy(void* token) { - return token == nullptr - ? nullptr - : (void*)GRPC_MDELEM_REF(grpc_mdelem{(uintptr_t)token}).payload; + return gpr_strdup(static_cast(token)); } -void lb_token_destroy(void* token) { - if (token != nullptr) { - GRPC_MDELEM_UNREF(grpc_mdelem{(uintptr_t)token}); - } +void lb_token_destroy(void* token) { gpr_free(token); } +void* client_stats_copy(void* p) { + GrpcLbClientStats* client_stats = static_cast(p); + client_stats->Ref().release(); + return p; +} +void client_stats_destroy(void* p) { + GrpcLbClientStats* client_stats = static_cast(p); + client_stats->Unref(); } -int lb_token_cmp(void* token1, void* token2) { +int equal_cmp(void* p1, void* p2) { // Always indicate a match, since we don't want this channel arg to // affect the subchannel's key in the index. + // TODO(roth): Is this right? This does prevent us from needlessly + // recreating the subchannel whenever the LB token or client stats + // changes (i.e., when the balancer call is terminated and reestablished). + // However, it means that we don't actually recreate the subchannel, + // which means that we won't ever switch over to using the new LB + // token or client stats. A better approach might be to find somewhere + // other than the subchannel args to store the LB token and client + // stats. They could be stored in a map and then looked up for each + // call (although we'd need to make sure our Map<> implementation is + // performant enough). Or we could do something more complicated whereby + // we create our own subchannel wrapper to store them, although that would + // involve a lot of refcounting overhead. + // Given that we're trying to move from grpclb to xds at this point, + // and that no one has actually reported any problems with this, we + // probably won't bother fixing this at this point. return 0; } const grpc_arg_pointer_vtable lb_token_arg_vtable = { - lb_token_copy, lb_token_destroy, lb_token_cmp}; + lb_token_copy, lb_token_destroy, equal_cmp}; +const grpc_arg_pointer_vtable client_stats_arg_vtable = { + client_stats_copy, client_stats_destroy, equal_cmp}; bool IsServerValid(const grpc_grpclb_server* server, size_t idx, bool log) { if (server->drop) return false; @@ -498,20 +522,14 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList( grpc_resolved_address addr; ParseServer(server, &addr); // LB token processing. - grpc_mdelem lb_token; + char lb_token[GPR_ARRAY_SIZE(server->load_balance_token) + 1]; if (server->has_load_balance_token) { const size_t lb_token_max_length = GPR_ARRAY_SIZE(server->load_balance_token); const size_t lb_token_length = strnlen(server->load_balance_token, lb_token_max_length); - grpc_slice lb_token_mdstr = grpc_slice_from_copied_buffer( - server->load_balance_token, lb_token_length); - lb_token = grpc_mdelem_from_slices(GRPC_MDSTR_LB_TOKEN, lb_token_mdstr); - if (client_stats != nullptr) { - GPR_ASSERT(grpc_mdelem_set_user_data( - lb_token, GrpcLbClientStats::Destroy, - client_stats->Ref().release()) == client_stats); - } + memcpy(lb_token, server->load_balance_token, lb_token_length); + lb_token[lb_token_length] = '\0'; } else { char* uri = grpc_sockaddr_to_uri(&addr); gpr_log(GPR_INFO, @@ -519,16 +537,21 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList( "be used instead", uri); gpr_free(uri); - lb_token = GRPC_MDELEM_LB_TOKEN_EMPTY; + lb_token[0] = '\0'; } // Add address. - grpc_arg arg = grpc_channel_arg_pointer_create( - const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), - (void*)lb_token.payload, &lb_token_arg_vtable); - grpc_channel_args* args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); + InlinedVector args_to_add; + args_to_add.emplace_back(grpc_channel_arg_pointer_create( + const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token, + &lb_token_arg_vtable)); + if (client_stats != nullptr) { + args_to_add.emplace_back(grpc_channel_arg_pointer_create( + const_cast(GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS), client_stats, + &client_stats_arg_vtable)); + } + grpc_channel_args* args = grpc_channel_args_copy_and_add( + nullptr, args_to_add.data(), args_to_add.size()); addresses.emplace_back(addr, args); - // Clean up. - GRPC_MDELEM_UNREF(lb_token); } return addresses; } @@ -572,27 +595,36 @@ GrpcLb::PickResult GrpcLb::Picker::Pick(PickArgs args) { result = child_picker_->Pick(args); // If pick succeeded, add LB token to initial metadata. if (result.type == PickResult::PICK_COMPLETE && - result.connected_subchannel != nullptr) { - const grpc_arg* arg = grpc_channel_args_find( - result.connected_subchannel->args(), GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN); + result.subchannel != nullptr) { + // Encode client stats object into metadata for use by + // client_load_reporting filter. + const grpc_arg* arg = + grpc_channel_args_find(result.subchannel->channel_args(), + GRPC_ARG_GRPCLB_ADDRESS_CLIENT_STATS); + if (arg != nullptr && arg->type == GRPC_ARG_POINTER && + arg->value.pointer.p != nullptr) { + GrpcLbClientStats* client_stats = + static_cast(arg->value.pointer.p); + client_stats->Ref().release(); // Ref passed via metadata. + // The metadata value is a hack: we pretend the pointer points to + // a string and rely on the client_load_reporting filter to know + // how to interpret it. + args.initial_metadata->Add( + kGrpcLbClientStatsMetadataKey, + StringView(reinterpret_cast(client_stats), 0)); + // Update calls-started. + client_stats->AddCallStarted(); + } + // Encode the LB token in metadata. + arg = grpc_channel_args_find(result.subchannel->channel_args(), + GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN); if (arg == nullptr) { - gpr_log(GPR_ERROR, - "[grpclb %p picker %p] No LB token for connected subchannel %p", - parent_, this, result.connected_subchannel.get()); + gpr_log(GPR_ERROR, "[grpclb %p picker %p] No LB token for subchannel %p", + parent_, this, result.subchannel.get()); abort(); } - grpc_mdelem lb_token = {reinterpret_cast(arg->value.pointer.p)}; - GPR_ASSERT(!GRPC_MDISNULL(lb_token)); - grpc_linked_mdelem* mdelem_storage = static_cast( - args.call_state->Alloc(sizeof(grpc_linked_mdelem))); - GPR_ASSERT(grpc_metadata_batch_add_tail( - args.initial_metadata, mdelem_storage, - GRPC_MDELEM_REF(lb_token)) == GRPC_ERROR_NONE); - GrpcLbClientStats* client_stats = static_cast( - grpc_mdelem_get_user_data(lb_token, GrpcLbClientStats::Destroy)); - if (client_stats != nullptr) { - client_stats->AddCallStarted(); - } + args.initial_metadata->Add(kGrpcLbLbTokenMetadataKey, + static_cast(arg->value.pointer.p)); } return result; } @@ -1412,10 +1444,10 @@ void GrpcLb::UpdateLocked(UpdateArgs args) { // Returns the backend addresses extracted from the given addresses. ServerAddressList ExtractBackendAddresses(const ServerAddressList& addresses) { - void* lb_token = (void*)GRPC_MDELEM_LB_TOKEN_EMPTY.payload; + static const char* lb_token = ""; grpc_arg arg = grpc_channel_arg_pointer_create( - const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token, - &lb_token_arg_vtable); + const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), + const_cast(lb_token), &lb_token_arg_vtable); ServerAddressList backend_addresses; for (size_t i = 0; i < addresses.size(); ++i) { if (!addresses[i].IsBalancer()) { @@ -1827,7 +1859,12 @@ bool maybe_add_client_load_reporting_filter(grpc_channel_stack_builder* builder, grpc_channel_args_find(args, GRPC_ARG_LB_POLICY_NAME); if (channel_arg != nullptr && channel_arg->type == GRPC_ARG_STRING && strcmp(channel_arg->value.string, "grpclb") == 0) { - return grpc_channel_stack_builder_append_filter( + // TODO(roth): When we get around to re-attempting + // https://github.com/grpc/grpc/pull/16214, we should try to keep + // this filter at the very top of the subchannel stack, since that + // will minimize the number of metadata elements that the filter + // needs to iterate through to find the ClientStats object. + return grpc_channel_stack_builder_prepend_filter( builder, (const grpc_channel_filter*)arg, nullptr, nullptr); } return true; diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h index 4d39c4d504b..a032b5dbf1d 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h @@ -32,5 +32,12 @@ #define GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER \ "grpc.address_is_backend_from_grpclb_load_balancer" +namespace grpc_core { + +extern const char kGrpcLbClientStatsMetadataKey[]; +extern const char kGrpcLbLbTokenMetadataKey[]; + +} // namespace grpc_core + #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_H \ */ diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index 411d528354a..b40b0325421 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -28,7 +28,6 @@ #include "src/core/ext/filters/client_channel/subchannel.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/sync.h" -#include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/transport/connectivity_state.h" @@ -85,9 +84,8 @@ class PickFirst : public LoadBalancingPolicy { public: PickFirstSubchannelList(PickFirst* policy, TraceFlag* tracer, const ServerAddressList& addresses, - grpc_combiner* combiner, const grpc_channel_args& args) - : SubchannelList(policy, tracer, addresses, combiner, + : SubchannelList(policy, tracer, addresses, policy->channel_control_helper(), args) { // Need to maintain a ref to the LB policy as long as we maintain // any references to subchannels, since the subchannels' @@ -111,19 +109,18 @@ class PickFirst : public LoadBalancingPolicy { class Picker : public SubchannelPicker { public: - explicit Picker( - RefCountedPtr connected_subchannel) - : connected_subchannel_(std::move(connected_subchannel)) {} + explicit Picker(RefCountedPtr subchannel) + : subchannel_(std::move(subchannel)) {} PickResult Pick(PickArgs args) override { PickResult result; result.type = PickResult::PICK_COMPLETE; - result.connected_subchannel = connected_subchannel_; + result.subchannel = subchannel_; return result; } private: - RefCountedPtr connected_subchannel_; + RefCountedPtr subchannel_; }; void ShutdownLocked() override; @@ -170,6 +167,9 @@ void PickFirst::ShutdownLocked() { void PickFirst::ExitIdleLocked() { if (shutdown_) return; if (idle_) { + if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) { + gpr_log(GPR_INFO, "Pick First %p exiting idle", this); + } idle_ = false; AttemptToConnectUsingLatestUpdateArgsLocked(); } @@ -186,7 +186,7 @@ void PickFirst::AttemptToConnectUsingLatestUpdateArgsLocked() { // Create a subchannel list from the latest_update_args_. auto subchannel_list = MakeOrphanable( this, &grpc_lb_pick_first_trace, latest_update_args_.addresses, - combiner(), *latest_update_args_.args); + *latest_update_args_.args); // Empty update or no valid subchannels. if (subchannel_list->num_subchannels() == 0) { // Unsubscribe from all current subchannels. @@ -347,8 +347,8 @@ void PickFirst::PickFirstSubchannelData::ProcessConnectivityChangeLocked( // some connectivity state notifications. if (connectivity_state == GRPC_CHANNEL_READY) { p->channel_control_helper()->UpdateState( - GRPC_CHANNEL_READY, UniquePtr(New( - connected_subchannel()->Ref()))); + GRPC_CHANNEL_READY, + UniquePtr(New(subchannel()->Ref()))); } else { // CONNECTING p->channel_control_helper()->UpdateState( connectivity_state, UniquePtr(New( @@ -443,13 +443,13 @@ void PickFirst::PickFirstSubchannelData::ProcessUnselectedReadyLocked() { p->subchannel_list_ = std::move(p->latest_pending_subchannel_list_); } // Cases 1 and 2. - p->selected_ = this; - p->channel_control_helper()->UpdateState( - GRPC_CHANNEL_READY, - UniquePtr(New(connected_subchannel()->Ref()))); if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_pick_first_trace)) { gpr_log(GPR_INFO, "Pick First %p selected subchannel %p", p, subchannel()); } + p->selected_ = this; + p->channel_control_helper()->UpdateState( + GRPC_CHANNEL_READY, + UniquePtr(New(subchannel()->Ref()))); for (size_t i = 0; i < subchannel_list()->num_subchannels(); ++i) { if (i != Index()) { subchannel_list()->subchannel(i)->ShutdownLocked(); diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc index c6655c7d9bb..04308ee254c 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc @@ -38,7 +38,6 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/sync.h" -#include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/static_metadata.h" @@ -106,9 +105,8 @@ class RoundRobin : public LoadBalancingPolicy { public: RoundRobinSubchannelList(RoundRobin* policy, TraceFlag* tracer, const ServerAddressList& addresses, - grpc_combiner* combiner, const grpc_channel_args& args) - : SubchannelList(policy, tracer, addresses, combiner, + : SubchannelList(policy, tracer, addresses, policy->channel_control_helper(), args) { // Need to maintain a ref to the LB policy as long as we maintain // any references to subchannels, since the subchannels' @@ -155,7 +153,7 @@ class RoundRobin : public LoadBalancingPolicy { RoundRobin* parent_; size_t last_picked_index_; - InlinedVector, 10> subchannels_; + InlinedVector, 10> subchannels_; }; void ShutdownLocked() override; @@ -180,10 +178,9 @@ RoundRobin::Picker::Picker(RoundRobin* parent, RoundRobinSubchannelList* subchannel_list) : parent_(parent) { for (size_t i = 0; i < subchannel_list->num_subchannels(); ++i) { - auto* connected_subchannel = - subchannel_list->subchannel(i)->connected_subchannel(); - if (connected_subchannel != nullptr) { - subchannels_.push_back(connected_subchannel->Ref()); + RoundRobinSubchannelData* sd = subchannel_list->subchannel(i); + if (sd->connectivity_state() == GRPC_CHANNEL_READY) { + subchannels_.push_back(sd->subchannel()->Ref()); } } // For discussion on why we generate a random starting index for @@ -204,14 +201,13 @@ RoundRobin::PickResult RoundRobin::Picker::Pick(PickArgs args) { last_picked_index_ = (last_picked_index_ + 1) % subchannels_.size(); if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_round_robin_trace)) { gpr_log(GPR_INFO, - "[RR %p picker %p] returning index %" PRIuPTR - ", connected_subchannel=%p", + "[RR %p picker %p] returning index %" PRIuPTR ", subchannel=%p", parent_, this, last_picked_index_, subchannels_[last_picked_index_].get()); } PickResult result; result.type = PickResult::PICK_COMPLETE; - result.connected_subchannel = subchannels_[last_picked_index_]; + result.subchannel = subchannels_[last_picked_index_]; return result; } @@ -424,7 +420,7 @@ void RoundRobin::UpdateLocked(UpdateArgs args) { } } latest_pending_subchannel_list_ = MakeOrphanable( - this, &grpc_lb_round_robin_trace, args.addresses, combiner(), *args.args); + this, &grpc_lb_round_robin_trace, args.addresses, *args.args); if (latest_pending_subchannel_list_->num_subchannels() == 0) { // If the new list is empty, immediately promote the new list to the // current list and transition to TRANSIENT_FAILURE. diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h index 7d70928a83c..34cd0f549fe 100644 --- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -39,7 +39,6 @@ #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/closure.h" -#include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/sockaddr_utils.h" #include "src/core/lib/transport/connectivity_state.h" @@ -64,8 +63,7 @@ class MySubchannelList }; */ -// All methods with a Locked() suffix must be called from within the -// client_channel combiner. +// All methods will be called from within the client_channel combiner. namespace grpc_core { @@ -93,20 +91,13 @@ class SubchannelData { // Returns a pointer to the subchannel. SubchannelInterface* subchannel() const { return subchannel_.get(); } - // Returns the connected subchannel. Will be null if the subchannel - // is not connected. - ConnectedSubchannelInterface* connected_subchannel() const { - return connected_subchannel_.get(); - } - // Synchronously checks the subchannel's connectivity state. // Must not be called while there is a connectivity notification // pending (i.e., between calling StartConnectivityWatchLocked() and // calling CancelConnectivityWatchLocked()). grpc_connectivity_state CheckConnectivityStateLocked() { GPR_ASSERT(pending_watcher_ == nullptr); - connectivity_state_ = - subchannel()->CheckConnectivityState(&connected_subchannel_); + connectivity_state_ = subchannel_->CheckConnectivityState(); return connectivity_state_; } @@ -144,7 +135,8 @@ class SubchannelData { private: // Watcher for subchannel connectivity state. - class Watcher : public SubchannelInterface::ConnectivityStateWatcher { + class Watcher + : public SubchannelInterface::ConnectivityStateWatcherInterface { public: Watcher( SubchannelData* subchannel_data, @@ -154,42 +146,13 @@ class SubchannelData { ~Watcher() { subchannel_list_.reset(DEBUG_LOCATION, "Watcher dtor"); } - void OnConnectivityStateChange(grpc_connectivity_state new_state, - RefCountedPtr - connected_subchannel) override; + void OnConnectivityStateChange(grpc_connectivity_state new_state) override; grpc_pollset_set* interested_parties() override { return subchannel_list_->policy()->interested_parties(); } private: - // A fire-and-forget class that bounces into the combiner to process - // a connectivity state update. - class Updater { - public: - Updater( - SubchannelData* - subchannel_data, - RefCountedPtr> - subchannel_list, - grpc_connectivity_state state, - RefCountedPtr connected_subchannel); - - ~Updater() { - subchannel_list_.reset(DEBUG_LOCATION, "Watcher::Updater dtor"); - } - - private: - static void OnUpdateLocked(void* arg, grpc_error* error); - - SubchannelData* subchannel_data_; - RefCountedPtr> - subchannel_list_; - const grpc_connectivity_state state_; - RefCountedPtr connected_subchannel_; - grpc_closure closure_; - }; - SubchannelData* subchannel_data_; RefCountedPtr subchannel_list_; }; @@ -202,10 +165,10 @@ class SubchannelData { // The subchannel. RefCountedPtr subchannel_; // Will be non-null when the subchannel's state is being watched. - SubchannelInterface::ConnectivityStateWatcher* pending_watcher_ = nullptr; + SubchannelInterface::ConnectivityStateWatcherInterface* pending_watcher_ = + nullptr; // Data updated by the watcher. grpc_connectivity_state connectivity_state_; - RefCountedPtr connected_subchannel_; }; // A list of subchannels. @@ -232,7 +195,6 @@ class SubchannelList : public InternallyRefCounted { // the backoff code out of subchannels and into LB policies. void ResetBackoffLocked(); - // Note: Caller must ensure that this is invoked inside of the combiner. void Orphan() override { ShutdownLocked(); InternallyRefCounted::Unref(DEBUG_LOCATION, "shutdown"); @@ -242,7 +204,7 @@ class SubchannelList : public InternallyRefCounted { protected: SubchannelList(LoadBalancingPolicy* policy, TraceFlag* tracer, - const ServerAddressList& addresses, grpc_combiner* combiner, + const ServerAddressList& addresses, LoadBalancingPolicy::ChannelControlHelper* helper, const grpc_channel_args& args); @@ -263,8 +225,6 @@ class SubchannelList : public InternallyRefCounted { TraceFlag* tracer_; - grpc_combiner* combiner_; - // The list of subchannels. SubchannelVector subchannels_; @@ -284,59 +244,26 @@ class SubchannelList : public InternallyRefCounted { template void SubchannelData::Watcher:: - OnConnectivityStateChange( - grpc_connectivity_state new_state, - RefCountedPtr connected_subchannel) { - // Will delete itself. - New(subchannel_data_, - subchannel_list_->Ref(DEBUG_LOCATION, "Watcher::Updater"), - new_state, std::move(connected_subchannel)); -} - -template -SubchannelData::Watcher::Updater:: - Updater( - SubchannelData* subchannel_data, - RefCountedPtr> - subchannel_list, - grpc_connectivity_state state, - RefCountedPtr connected_subchannel) - : subchannel_data_(subchannel_data), - subchannel_list_(std::move(subchannel_list)), - state_(state), - connected_subchannel_(std::move(connected_subchannel)) { - GRPC_CLOSURE_INIT(&closure_, &OnUpdateLocked, this, - grpc_combiner_scheduler(subchannel_list_->combiner_)); - GRPC_CLOSURE_SCHED(&closure_, GRPC_ERROR_NONE); -} - -template -void SubchannelData::Watcher::Updater:: - OnUpdateLocked(void* arg, grpc_error* error) { - Updater* self = static_cast(arg); - SubchannelData* sd = self->subchannel_data_; - if (GRPC_TRACE_FLAG_ENABLED(*sd->subchannel_list_->tracer())) { + OnConnectivityStateChange(grpc_connectivity_state new_state) { + if (GRPC_TRACE_FLAG_ENABLED(*subchannel_list_->tracer())) { gpr_log(GPR_INFO, "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR " (subchannel %p): connectivity changed: state=%s, " - "connected_subchannel=%p, shutting_down=%d, pending_watcher=%p", - sd->subchannel_list_->tracer()->name(), - sd->subchannel_list_->policy(), sd->subchannel_list_, sd->Index(), - sd->subchannel_list_->num_subchannels(), sd->subchannel_.get(), - grpc_connectivity_state_name(self->state_), - self->connected_subchannel_.get(), - sd->subchannel_list_->shutting_down(), sd->pending_watcher_); + "shutting_down=%d, pending_watcher=%p", + subchannel_list_->tracer()->name(), subchannel_list_->policy(), + subchannel_list_.get(), subchannel_data_->Index(), + subchannel_list_->num_subchannels(), + subchannel_data_->subchannel_.get(), + grpc_connectivity_state_name(new_state), + subchannel_list_->shutting_down(), + subchannel_data_->pending_watcher_); } - if (!sd->subchannel_list_->shutting_down() && - sd->pending_watcher_ != nullptr) { - sd->connectivity_state_ = self->state_; - // Get or release ref to connected subchannel. - sd->connected_subchannel_ = std::move(self->connected_subchannel_); + if (!subchannel_list_->shutting_down() && + subchannel_data_->pending_watcher_ != nullptr) { + subchannel_data_->connectivity_state_ = new_state; // Call the subclass's ProcessConnectivityChangeLocked() method. - sd->ProcessConnectivityChangeLocked(sd->connectivity_state_); + subchannel_data_->ProcessConnectivityChangeLocked(new_state); } - // Clean up. - Delete(self); } // @@ -371,7 +298,6 @@ void SubchannelData:: subchannel_.get()); } subchannel_.reset(); - connected_subchannel_.reset(); } } @@ -400,7 +326,7 @@ void SubchannelData(this, subchannel_list()->Ref(DEBUG_LOCATION, "Watcher")); subchannel_->WatchConnectivityState( connectivity_state_, - UniquePtr( + UniquePtr( pending_watcher_)); } @@ -434,13 +360,12 @@ void SubchannelData::ShutdownLocked() { template SubchannelList::SubchannelList( LoadBalancingPolicy* policy, TraceFlag* tracer, - const ServerAddressList& addresses, grpc_combiner* combiner, + const ServerAddressList& addresses, LoadBalancingPolicy::ChannelControlHelper* helper, const grpc_channel_args& args) : InternallyRefCounted(tracer), policy_(policy), - tracer_(tracer), - combiner_(GRPC_COMBINER_REF(combiner, "subchannel_list")) { + tracer_(tracer) { if (GRPC_TRACE_FLAG_ENABLED(*tracer_)) { gpr_log(GPR_INFO, "[%s %p] Creating subchannel list %p for %" PRIuPTR " subchannels", @@ -509,7 +434,6 @@ SubchannelList::~SubchannelList() { gpr_log(GPR_INFO, "[%s %p] Destroying subchannel_list %p", tracer_->name(), policy_, this); } - GRPC_COMBINER_UNREF(combiner_, "subchannel_list"); } template diff --git a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc index ca9ea9e31cc..9721972511a 100644 --- a/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +++ b/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc @@ -567,7 +567,7 @@ XdsLb::PickResult XdsLb::Picker::Pick(PickArgs args) { PickResult result = PickFromLocality(key, args); // If pick succeeded, add client stats. if (result.type == PickResult::PICK_COMPLETE && - result.connected_subchannel != nullptr && client_stats_ != nullptr) { + result.subchannel != nullptr && client_stats_ != nullptr) { // TODO(roth): Add support for client stats. } return result; @@ -1986,6 +1986,9 @@ void XdsLb::LocalityMap::LocalityEntry::ShutdownLocked() { parent_->interested_parties()); pending_child_policy_.reset(); } + // Drop our ref to the child's picker, in case it's holding a ref to + // the child. + picker_ref_.reset(); } void XdsLb::LocalityMap::LocalityEntry::ResetBackoffLocked() { diff --git a/src/core/ext/filters/client_channel/resolver.h b/src/core/ext/filters/client_channel/resolver.h index 87a4442d75b..829a860040a 100644 --- a/src/core/ext/filters/client_channel/resolver.h +++ b/src/core/ext/filters/client_channel/resolver.h @@ -117,12 +117,10 @@ class Resolver : public InternallyRefCounted { /// implementations. At that point, this method can go away. virtual void ResetBackoffLocked() {} + // Note: This must be invoked while holding the combiner. void Orphan() override { - // Invoke ShutdownAndUnrefLocked() inside of the combiner. - GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_CREATE(&Resolver::ShutdownAndUnrefLocked, this, - grpc_combiner_scheduler(combiner_)), - GRPC_ERROR_NONE); + ShutdownLocked(); + Unref(); } GRPC_ABSTRACT_BASE_CLASS @@ -147,12 +145,6 @@ class Resolver : public InternallyRefCounted { ResultHandler* result_handler() const { return result_handler_.get(); } private: - static void ShutdownAndUnrefLocked(void* arg, grpc_error* ignored) { - Resolver* resolver = static_cast(arg); - resolver->ShutdownLocked(); - resolver->Unref(); - } - UniquePtr result_handler_; grpc_combiner* combiner_; }; diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc index 761b27292da..443a709ea6c 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc @@ -60,7 +60,13 @@ class FakeResolver : public Resolver { virtual ~FakeResolver(); - void ShutdownLocked() override { active_ = false; } + void ShutdownLocked() override { + shutdown_ = true; + if (response_generator_ != nullptr) { + response_generator_->SetFakeResolver(nullptr); + response_generator_.reset(); + } + } void MaybeSendResultLocked(); @@ -68,6 +74,7 @@ class FakeResolver : public Resolver { // passed-in parameters grpc_channel_args* channel_args_ = nullptr; + RefCountedPtr response_generator_; // If has_next_result_ is true, next_result_ is the next resolution result // to be returned. bool has_next_result_ = false; @@ -76,8 +83,10 @@ class FakeResolver : public Resolver { // RequestReresolutionLocked(). bool has_reresolution_result_ = false; Result reresolution_result_; - // True between the calls to StartLocked() ShutdownLocked(). - bool active_ = false; + // True after the call to StartLocked(). + bool started_ = false; + // True after the call to ShutdownLocked(). + bool shutdown_ = false; // if true, return failure bool return_failure_ = false; // pending re-resolution @@ -86,11 +95,11 @@ class FakeResolver : public Resolver { }; FakeResolver::FakeResolver(ResolverArgs args) - : Resolver(args.combiner, std::move(args.result_handler)) { + : Resolver(args.combiner, std::move(args.result_handler)), + response_generator_( + FakeResolverResponseGenerator::GetFromArgs(args.args)) { GRPC_CLOSURE_INIT(&reresolution_closure_, ReturnReresolutionResult, this, grpc_combiner_scheduler(combiner())); - FakeResolverResponseGenerator* response_generator = - FakeResolverResponseGenerator::GetFromArgs(args.args); // Channels sharing the same subchannels may have different resolver response // generators. If we don't remove this arg, subchannel pool will create new // subchannels for the same address instead of reusing existing ones because @@ -98,19 +107,15 @@ FakeResolver::FakeResolver(ResolverArgs args) const char* args_to_remove[] = {GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR}; channel_args_ = grpc_channel_args_copy_and_remove( args.args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove)); - if (response_generator != nullptr) { - response_generator->resolver_ = this; - if (response_generator->has_result_) { - response_generator->SetResponse(std::move(response_generator->result_)); - response_generator->has_result_ = false; - } + if (response_generator_ != nullptr) { + response_generator_->SetFakeResolver(Ref()); } } FakeResolver::~FakeResolver() { grpc_channel_args_destroy(channel_args_); } void FakeResolver::StartLocked() { - active_ = true; + started_ = true; MaybeSendResultLocked(); } @@ -130,7 +135,7 @@ void FakeResolver::RequestReresolutionLocked() { } void FakeResolver::MaybeSendResultLocked() { - if (!active_) return; + if (!started_ || shutdown_) return; if (return_failure_) { // TODO(roth): Change resolver result generator to be able to inject // the error to be returned. @@ -165,9 +170,13 @@ void FakeResolver::ReturnReresolutionResult(void* arg, grpc_error* error) { // FakeResolverResponseGenerator // +FakeResolverResponseGenerator::FakeResolverResponseGenerator() {} + +FakeResolverResponseGenerator::~FakeResolverResponseGenerator() {} + struct SetResponseClosureArg { grpc_closure set_response_closure; - FakeResolverResponseGenerator* generator; + RefCountedPtr resolver; Resolver::Result result; bool has_result = false; bool immediate = true; @@ -176,97 +185,146 @@ struct SetResponseClosureArg { void FakeResolverResponseGenerator::SetResponseLocked(void* arg, grpc_error* error) { SetResponseClosureArg* closure_arg = static_cast(arg); - FakeResolver* resolver = closure_arg->generator->resolver_; - resolver->next_result_ = std::move(closure_arg->result); - resolver->has_next_result_ = true; - resolver->MaybeSendResultLocked(); - closure_arg->generator->Unref(); + auto& resolver = closure_arg->resolver; + if (!resolver->shutdown_) { + resolver->next_result_ = std::move(closure_arg->result); + resolver->has_next_result_ = true; + resolver->MaybeSendResultLocked(); + } Delete(closure_arg); } void FakeResolverResponseGenerator::SetResponse(Resolver::Result result) { - if (resolver_ != nullptr) { - Ref().release(); // ref to be held by closure - SetResponseClosureArg* closure_arg = New(); - closure_arg->generator = this; - closure_arg->result = std::move(result); - GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetResponseLocked, - closure_arg, - grpc_combiner_scheduler(resolver_->combiner())), - GRPC_ERROR_NONE); - } else { - has_result_ = true; - result_ = std::move(result); + RefCountedPtr resolver; + { + MutexLock lock(&mu_); + if (resolver_ == nullptr) { + has_result_ = true; + result_ = std::move(result); + return; + } + resolver = resolver_->Ref(); } + SetResponseClosureArg* closure_arg = New(); + closure_arg->resolver = std::move(resolver); + closure_arg->result = std::move(result); + GRPC_CLOSURE_SCHED( + GRPC_CLOSURE_INIT( + &closure_arg->set_response_closure, SetResponseLocked, closure_arg, + grpc_combiner_scheduler(closure_arg->resolver->combiner())), + GRPC_ERROR_NONE); } void FakeResolverResponseGenerator::SetReresolutionResponseLocked( void* arg, grpc_error* error) { SetResponseClosureArg* closure_arg = static_cast(arg); - FakeResolver* resolver = closure_arg->generator->resolver_; - resolver->reresolution_result_ = std::move(closure_arg->result); - resolver->has_reresolution_result_ = closure_arg->has_result; + auto& resolver = closure_arg->resolver; + if (!resolver->shutdown_) { + resolver->reresolution_result_ = std::move(closure_arg->result); + resolver->has_reresolution_result_ = closure_arg->has_result; + } Delete(closure_arg); } void FakeResolverResponseGenerator::SetReresolutionResponse( Resolver::Result result) { - GPR_ASSERT(resolver_ != nullptr); + RefCountedPtr resolver; + { + MutexLock lock(&mu_); + GPR_ASSERT(resolver_ != nullptr); + resolver = resolver_->Ref(); + } SetResponseClosureArg* closure_arg = New(); - closure_arg->generator = this; + closure_arg->resolver = std::move(resolver); closure_arg->result = std::move(result); closure_arg->has_result = true; GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, - SetReresolutionResponseLocked, closure_arg, - grpc_combiner_scheduler(resolver_->combiner())), + GRPC_CLOSURE_INIT( + &closure_arg->set_response_closure, SetReresolutionResponseLocked, + closure_arg, + grpc_combiner_scheduler(closure_arg->resolver->combiner())), GRPC_ERROR_NONE); } void FakeResolverResponseGenerator::UnsetReresolutionResponse() { - GPR_ASSERT(resolver_ != nullptr); + RefCountedPtr resolver; + { + MutexLock lock(&mu_); + GPR_ASSERT(resolver_ != nullptr); + resolver = resolver_->Ref(); + } SetResponseClosureArg* closure_arg = New(); - closure_arg->generator = this; + closure_arg->resolver = std::move(resolver); GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, - SetReresolutionResponseLocked, closure_arg, - grpc_combiner_scheduler(resolver_->combiner())), + GRPC_CLOSURE_INIT( + &closure_arg->set_response_closure, SetReresolutionResponseLocked, + closure_arg, + grpc_combiner_scheduler(closure_arg->resolver->combiner())), GRPC_ERROR_NONE); } void FakeResolverResponseGenerator::SetFailureLocked(void* arg, grpc_error* error) { SetResponseClosureArg* closure_arg = static_cast(arg); - FakeResolver* resolver = closure_arg->generator->resolver_; - resolver->return_failure_ = true; - if (closure_arg->immediate) resolver->MaybeSendResultLocked(); + auto& resolver = closure_arg->resolver; + if (!resolver->shutdown_) { + resolver->return_failure_ = true; + if (closure_arg->immediate) resolver->MaybeSendResultLocked(); + } Delete(closure_arg); } void FakeResolverResponseGenerator::SetFailure() { - GPR_ASSERT(resolver_ != nullptr); + RefCountedPtr resolver; + { + MutexLock lock(&mu_); + GPR_ASSERT(resolver_ != nullptr); + resolver = resolver_->Ref(); + } SetResponseClosureArg* closure_arg = New(); - closure_arg->generator = this; + closure_arg->resolver = std::move(resolver); GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetFailureLocked, - closure_arg, - grpc_combiner_scheduler(resolver_->combiner())), + GRPC_CLOSURE_INIT( + &closure_arg->set_response_closure, SetFailureLocked, closure_arg, + grpc_combiner_scheduler(closure_arg->resolver->combiner())), GRPC_ERROR_NONE); } void FakeResolverResponseGenerator::SetFailureOnReresolution() { - GPR_ASSERT(resolver_ != nullptr); + RefCountedPtr resolver; + { + MutexLock lock(&mu_); + GPR_ASSERT(resolver_ != nullptr); + resolver = resolver_->Ref(); + } SetResponseClosureArg* closure_arg = New(); - closure_arg->generator = this; + closure_arg->resolver = std::move(resolver); closure_arg->immediate = false; GRPC_CLOSURE_SCHED( - GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetFailureLocked, - closure_arg, - grpc_combiner_scheduler(resolver_->combiner())), + GRPC_CLOSURE_INIT( + &closure_arg->set_response_closure, SetFailureLocked, closure_arg, + grpc_combiner_scheduler(closure_arg->resolver->combiner())), GRPC_ERROR_NONE); } +void FakeResolverResponseGenerator::SetFakeResolver( + RefCountedPtr resolver) { + MutexLock lock(&mu_); + resolver_ = std::move(resolver); + if (resolver_ == nullptr) return; + if (has_result_) { + SetResponseClosureArg* closure_arg = New(); + closure_arg->resolver = resolver_->Ref(); + closure_arg->result = std::move(result_); + GRPC_CLOSURE_SCHED( + GRPC_CLOSURE_INIT(&closure_arg->set_response_closure, SetResponseLocked, + closure_arg, + grpc_combiner_scheduler(resolver_->combiner())), + GRPC_ERROR_NONE); + has_result_ = false; + } +} + namespace { static void* response_generator_arg_copy(void* p) { @@ -304,12 +362,13 @@ grpc_arg FakeResolverResponseGenerator::MakeChannelArg( return arg; } -FakeResolverResponseGenerator* FakeResolverResponseGenerator::GetFromArgs( - const grpc_channel_args* args) { +RefCountedPtr +FakeResolverResponseGenerator::GetFromArgs(const grpc_channel_args* args) { const grpc_arg* arg = grpc_channel_args_find(args, GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR); if (arg == nullptr || arg->type != GRPC_ARG_POINTER) return nullptr; - return static_cast(arg->value.pointer.p); + return static_cast(arg->value.pointer.p) + ->Ref(); } // diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h index 3b1ea8e8909..c04c7c38e17 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h @@ -42,7 +42,8 @@ class FakeResolver; class FakeResolverResponseGenerator : public RefCounted { public: - FakeResolverResponseGenerator() {} + FakeResolverResponseGenerator(); + ~FakeResolverResponseGenerator(); // Instructs the fake resolver associated with the response generator // instance to trigger a new resolution with the specified result. If the @@ -71,17 +72,21 @@ class FakeResolverResponseGenerator static grpc_arg MakeChannelArg(FakeResolverResponseGenerator* generator); // Returns the response generator in \a args, or null if not found. - static FakeResolverResponseGenerator* GetFromArgs( + static RefCountedPtr GetFromArgs( const grpc_channel_args* args); private: friend class FakeResolver; + // Set the corresponding FakeResolver to this generator. + void SetFakeResolver(RefCountedPtr resolver); static void SetResponseLocked(void* arg, grpc_error* error); static void SetReresolutionResponseLocked(void* arg, grpc_error* error); static void SetFailureLocked(void* arg, grpc_error* error); - FakeResolver* resolver_ = nullptr; // Do not own. + // Mutex protecting the members below. + Mutex mu_; + RefCountedPtr resolver_; Resolver::Result result_; bool has_result_ = false; }; diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index 5e6cbccd93f..e30d915d03c 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -85,7 +85,7 @@ DebugOnlyTraceFlag grpc_trace_subchannel_refcount(false, "subchannel_refcount"); ConnectedSubchannel::ConnectedSubchannel( grpc_channel_stack* channel_stack, const grpc_channel_args* args, RefCountedPtr channelz_subchannel) - : ConnectedSubchannelInterface(&grpc_trace_subchannel_refcount), + : RefCounted(&grpc_trace_subchannel_refcount), channel_stack_(channel_stack), args_(grpc_channel_args_copy(args)), channelz_subchannel_(std::move(channelz_subchannel)) {} @@ -349,7 +349,7 @@ class Subchannel::ConnectedSubchannelStateWatcher { } c->connected_subchannel_.reset(); if (c->channelz_node() != nullptr) { - c->channelz_node()->SetChildSocketUuid(0); + c->channelz_node()->SetChildSocket(nullptr); } c->SetConnectivityStateLocked(GRPC_CHANNEL_TRANSIENT_FAILURE); c->backoff_begun_ = false; @@ -385,12 +385,12 @@ class Subchannel::ConnectedSubchannelStateWatcher { // void Subchannel::ConnectivityStateWatcherList::AddWatcherLocked( - UniquePtr watcher) { + OrphanablePtr watcher) { watchers_.insert(MakePair(watcher.get(), std::move(watcher))); } void Subchannel::ConnectivityStateWatcherList::RemoveWatcherLocked( - ConnectivityStateWatcher* watcher) { + ConnectivityStateWatcherInterface* watcher) { watchers_.erase(watcher); } @@ -445,8 +445,9 @@ class Subchannel::HealthWatcherMap::HealthWatcher grpc_connectivity_state state() const { return state_; } - void AddWatcherLocked(grpc_connectivity_state initial_state, - UniquePtr watcher) { + void AddWatcherLocked( + grpc_connectivity_state initial_state, + OrphanablePtr watcher) { if (state_ != initial_state) { RefCountedPtr connected_subchannel; if (state_ == GRPC_CHANNEL_READY) { @@ -458,7 +459,7 @@ class Subchannel::HealthWatcherMap::HealthWatcher watcher_list_.AddWatcherLocked(std::move(watcher)); } - void RemoveWatcherLocked(ConnectivityStateWatcher* watcher) { + void RemoveWatcherLocked(ConnectivityStateWatcherInterface* watcher) { watcher_list_.RemoveWatcherLocked(watcher); } @@ -534,7 +535,7 @@ class Subchannel::HealthWatcherMap::HealthWatcher void Subchannel::HealthWatcherMap::AddWatcherLocked( Subchannel* subchannel, grpc_connectivity_state initial_state, UniquePtr health_check_service_name, - UniquePtr watcher) { + OrphanablePtr watcher) { // If the health check service name is not already present in the map, // add it. auto it = map_.find(health_check_service_name.get()); @@ -553,7 +554,8 @@ void Subchannel::HealthWatcherMap::AddWatcherLocked( } void Subchannel::HealthWatcherMap::RemoveWatcherLocked( - const char* health_check_service_name, ConnectivityStateWatcher* watcher) { + const char* health_check_service_name, + ConnectivityStateWatcherInterface* watcher) { auto it = map_.find(health_check_service_name); GPR_ASSERT(it != map_.end()); it->second->RemoveWatcherLocked(watcher); @@ -817,7 +819,7 @@ grpc_connectivity_state Subchannel::CheckConnectivityState( void Subchannel::WatchConnectivityState( grpc_connectivity_state initial_state, UniquePtr health_check_service_name, - UniquePtr watcher) { + OrphanablePtr watcher) { MutexLock lock(&mu_); grpc_pollset_set* interested_parties = watcher->interested_parties(); if (interested_parties != nullptr) { @@ -836,7 +838,8 @@ void Subchannel::WatchConnectivityState( } void Subchannel::CancelConnectivityStateWatch( - const char* health_check_service_name, ConnectivityStateWatcher* watcher) { + const char* health_check_service_name, + ConnectivityStateWatcherInterface* watcher) { MutexLock lock(&mu_); grpc_pollset_set* interested_parties = watcher->interested_parties(); if (interested_parties != nullptr) { @@ -1069,8 +1072,9 @@ bool Subchannel::PublishTransportLocked() { GRPC_ERROR_UNREF(error); return false; } - intptr_t socket_uuid = connecting_result_.socket_uuid; - memset(&connecting_result_, 0, sizeof(connecting_result_)); + RefCountedPtr socket = + std::move(connecting_result_.socket); + connecting_result_.reset(); if (disconnected_) { grpc_channel_stack_destroy(stk); gpr_free(stk); @@ -1082,7 +1086,7 @@ bool Subchannel::PublishTransportLocked() { gpr_log(GPR_INFO, "New connected subchannel at %p for subchannel %p", connected_subchannel_.get(), this); if (channelz_node_ != nullptr) { - channelz_node_->SetChildSocketUuid(socket_uuid); + channelz_node_->SetChildSocket(std::move(socket)); } // Instantiate state watcher. Will clean itself up. New(this); diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h index d1c4b7d1073..d745bc8ddc2 100644 --- a/src/core/ext/filters/client_channel/subchannel.h +++ b/src/core/ext/filters/client_channel/subchannel.h @@ -23,7 +23,6 @@ #include "src/core/ext/filters/client_channel/client_channel_channelz.h" #include "src/core/ext/filters/client_channel/connector.h" -#include "src/core/ext/filters/client_channel/subchannel_interface.h" #include "src/core/ext/filters/client_channel/subchannel_pool_interface.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_stack.h" @@ -70,7 +69,7 @@ namespace grpc_core { class SubchannelCall; -class ConnectedSubchannel : public ConnectedSubchannelInterface { +class ConnectedSubchannel : public RefCounted { public: ConnectedSubchannel( grpc_channel_stack* channel_stack, const grpc_channel_args* args, @@ -83,7 +82,7 @@ class ConnectedSubchannel : public ConnectedSubchannelInterface { void Ping(grpc_closure* on_initiate, grpc_closure* on_ack); grpc_channel_stack* channel_stack() const { return channel_stack_; } - const grpc_channel_args* args() const override { return args_; } + const grpc_channel_args* args() const { return args_; } channelz::SubchannelNode* channelz_subchannel() const { return channelz_subchannel_.get(); } @@ -169,10 +168,35 @@ class SubchannelCall { // A subchannel that knows how to connect to exactly one target address. It // provides a target for load balancing. +// +// Note that this is the "real" subchannel implementation, whose API is +// different from the SubchannelInterface that is exposed to LB policy +// implementations. The client channel provides an adaptor class +// (SubchannelWrapper) that "converts" between the two. class Subchannel { public: - typedef SubchannelInterface::ConnectivityStateWatcher - ConnectivityStateWatcher; + class ConnectivityStateWatcherInterface + : public InternallyRefCounted { + public: + virtual ~ConnectivityStateWatcherInterface() = default; + + // Will be invoked whenever the subchannel's connectivity state + // changes. There will be only one invocation of this method on a + // given watcher instance at any given time. + // + // When the state changes to READY, connected_subchannel will + // contain a ref to the connected subchannel. When it changes from + // READY to some other state, the implementation must release its + // ref to the connected subchannel. + virtual void OnConnectivityStateChange( + grpc_connectivity_state new_state, + RefCountedPtr connected_subchannel) // NOLINT + GRPC_ABSTRACT; + + virtual grpc_pollset_set* interested_parties() GRPC_ABSTRACT; + + GRPC_ABSTRACT_BASE_CLASS + }; // The ctor and dtor are not intended to use directly. Subchannel(SubchannelKey* key, grpc_connector* connector, @@ -197,6 +221,8 @@ class Subchannel { // Caller doesn't take ownership. const char* GetTargetAddress(); + const grpc_channel_args* channel_args() const { return args_; } + channelz::SubchannelNode* channelz_node(); // Returns the current connectivity state of the subchannel. @@ -216,14 +242,15 @@ class Subchannel { // changes. // The watcher will be destroyed either when the subchannel is // destroyed or when CancelConnectivityStateWatch() is called. - void WatchConnectivityState(grpc_connectivity_state initial_state, - UniquePtr health_check_service_name, - UniquePtr watcher); + void WatchConnectivityState( + grpc_connectivity_state initial_state, + UniquePtr health_check_service_name, + OrphanablePtr watcher); // Cancels a connectivity state watch. // If the watcher has already been destroyed, this is a no-op. void CancelConnectivityStateWatch(const char* health_check_service_name, - ConnectivityStateWatcher* watcher); + ConnectivityStateWatcherInterface* watcher); // Attempt to connect to the backend. Has no effect if already connected. void AttemptToConnect(); @@ -248,14 +275,15 @@ class Subchannel { grpc_resolved_address* addr); private: - // A linked list of ConnectivityStateWatchers that are monitoring the - // subchannel's state. + // A linked list of ConnectivityStateWatcherInterfaces that are monitoring + // the subchannel's state. class ConnectivityStateWatcherList { public: ~ConnectivityStateWatcherList() { Clear(); } - void AddWatcherLocked(UniquePtr watcher); - void RemoveWatcherLocked(ConnectivityStateWatcher* watcher); + void AddWatcherLocked( + OrphanablePtr watcher); + void RemoveWatcherLocked(ConnectivityStateWatcherInterface* watcher); // Notifies all watchers in the list about a change to state. void NotifyLocked(Subchannel* subchannel, grpc_connectivity_state state); @@ -267,12 +295,13 @@ class Subchannel { private: // TODO(roth): This could be a set instead of a map if we had a set // implementation. - Map> + Map> watchers_; }; - // A map that tracks ConnectivityStateWatchers using a particular health - // check service name. + // A map that tracks ConnectivityStateWatcherInterfaces using a particular + // health check service name. // // There is one entry in the map for each health check service name. // Entries exist only as long as there are watchers using the @@ -282,12 +311,12 @@ class Subchannel { // state READY. class HealthWatcherMap { public: - void AddWatcherLocked(Subchannel* subchannel, - grpc_connectivity_state initial_state, - UniquePtr health_check_service_name, - UniquePtr watcher); + void AddWatcherLocked( + Subchannel* subchannel, grpc_connectivity_state initial_state, + UniquePtr health_check_service_name, + OrphanablePtr watcher); void RemoveWatcherLocked(const char* health_check_service_name, - ConnectivityStateWatcher* watcher); + ConnectivityStateWatcherInterface* watcher); // Notifies the watcher when the subchannel's state changes. void NotifyLocked(grpc_connectivity_state state); diff --git a/src/core/ext/filters/client_channel/subchannel_interface.h b/src/core/ext/filters/client_channel/subchannel_interface.h index 10b1bf124c2..2e448dc5a64 100644 --- a/src/core/ext/filters/client_channel/subchannel_interface.h +++ b/src/core/ext/filters/client_channel/subchannel_interface.h @@ -21,42 +21,22 @@ #include -#include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" namespace grpc_core { -// TODO(roth): In a subsequent PR, remove this from this API. -class ConnectedSubchannelInterface - : public RefCounted { - public: - virtual const grpc_channel_args* args() const GRPC_ABSTRACT; - - protected: - template - explicit ConnectedSubchannelInterface(TraceFlagT* trace_flag = nullptr) - : RefCounted(trace_flag) {} -}; - +// The interface for subchannels that is exposed to LB policy implementations. class SubchannelInterface : public RefCounted { public: - class ConnectivityStateWatcher { + class ConnectivityStateWatcherInterface { public: - virtual ~ConnectivityStateWatcher() = default; + virtual ~ConnectivityStateWatcherInterface() = default; // Will be invoked whenever the subchannel's connectivity state // changes. There will be only one invocation of this method on a // given watcher instance at any given time. - // - // When the state changes to READY, connected_subchannel will - // contain a ref to the connected subchannel. When it changes from - // READY to some other state, the implementation must release its - // ref to the connected subchannel. - virtual void OnConnectivityStateChange( - grpc_connectivity_state new_state, - RefCountedPtr - connected_subchannel) // NOLINT + virtual void OnConnectivityStateChange(grpc_connectivity_state new_state) GRPC_ABSTRACT; // TODO(roth): Remove this as soon as we move to EventManager-based @@ -66,12 +46,14 @@ class SubchannelInterface : public RefCounted { GRPC_ABSTRACT_BASE_CLASS }; + template + explicit SubchannelInterface(TraceFlagT* trace_flag = nullptr) + : RefCounted(trace_flag) {} + virtual ~SubchannelInterface() = default; // Returns the current connectivity state of the subchannel. - virtual grpc_connectivity_state CheckConnectivityState( - RefCountedPtr* connected_subchannel) - GRPC_ABSTRACT; + virtual grpc_connectivity_state CheckConnectivityState() GRPC_ABSTRACT; // Starts watching the subchannel's connectivity state. // The first callback to the watcher will be delivered when the @@ -86,12 +68,12 @@ class SubchannelInterface : public RefCounted { // the previous watcher using CancelConnectivityStateWatch(). virtual void WatchConnectivityState( grpc_connectivity_state initial_state, - UniquePtr watcher) GRPC_ABSTRACT; + UniquePtr watcher) GRPC_ABSTRACT; // Cancels a connectivity state watch. // If the watcher has already been destroyed, this is a no-op. - virtual void CancelConnectivityStateWatch(ConnectivityStateWatcher* watcher) - GRPC_ABSTRACT; + virtual void CancelConnectivityStateWatch( + ConnectivityStateWatcherInterface* watcher) GRPC_ABSTRACT; // Attempt to connect to the backend. Has no effect if already connected. // If the subchannel is currently in backoff delay due to a previously @@ -105,6 +87,9 @@ class SubchannelInterface : public RefCounted { // attempt will be started as soon as AttemptToConnect() is called. virtual void ResetBackoff() GRPC_ABSTRACT; + // TODO(roth): Need a better non-grpc-specific abstraction here. + virtual const grpc_channel_args* channel_args() GRPC_ABSTRACT; + GRPC_ABSTRACT_BASE_CLASS }; diff --git a/src/core/ext/filters/client_idle/client_idle_filter.cc b/src/core/ext/filters/client_idle/client_idle_filter.cc new file mode 100644 index 00000000000..d2b23a9d20f --- /dev/null +++ b/src/core/ext/filters/client_idle/client_idle_filter.cc @@ -0,0 +1,264 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +#include + +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/channel/channel_stack_builder.h" +#include "src/core/lib/gprpp/atomic.h" +#include "src/core/lib/iomgr/timer.h" +#include "src/core/lib/surface/channel_init.h" +#include "src/core/lib/transport/http2_errors.h" + +// The idle filter is disabled in client channel by default. +// To enable the idle filte, set GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS to [0, INT_MAX) +// in channel args. +// TODO(qianchengz): Find a reasonable default value. Maybe check what deault +// value Java uses. +#define DEFAULT_IDLE_TIMEOUT_MS INT_MAX + +namespace grpc_core { + +TraceFlag grpc_trace_client_idle_filter(false, "client_idle_filter"); + +#define GRPC_IDLE_FILTER_LOG(format, ...) \ + do { \ + if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_client_idle_filter)) { \ + gpr_log(GPR_INFO, "(client idle filter) " format, ##__VA_ARGS__); \ + } \ + } while (0) + +namespace { + +grpc_millis GetClientIdleTimeout(const grpc_channel_args* args) { + return grpc_channel_arg_get_integer( + grpc_channel_args_find(args, GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS), + {DEFAULT_IDLE_TIMEOUT_MS, 0, INT_MAX}); +} + +class ChannelData { + public: + static grpc_error* Init(grpc_channel_element* elem, + grpc_channel_element_args* args); + static void Destroy(grpc_channel_element* elem); + + static void StartTransportOp(grpc_channel_element* elem, + grpc_transport_op* op); + + void IncreaseCallCount(); + + void DecreaseCallCount(); + + private: + ChannelData(grpc_channel_element* elem, grpc_channel_element_args* args, + grpc_error** error); + ~ChannelData() = default; + + static void IdleTimerCallback(void* arg, grpc_error* error); + static void IdleTransportOpCompleteCallback(void* arg, grpc_error* error); + + void StartIdleTimer(); + + void EnterIdle(); + + grpc_channel_element* elem_; + // The channel stack to which we take refs for pending callbacks. + grpc_channel_stack* channel_stack_; + // Timeout after the last RPC finishes on the client channel at which the + // channel goes back into IDLE state. + const grpc_millis client_idle_timeout_; + + // Member data used to track the state of channel. + Mutex call_count_mu_; + size_t call_count_; + + // Idle timer and its callback closure. + grpc_timer idle_timer_; + grpc_closure idle_timer_callback_; + + // The transport op telling the client channel to enter IDLE. + grpc_transport_op idle_transport_op_; + grpc_closure idle_transport_op_complete_callback_; +}; + +grpc_error* ChannelData::Init(grpc_channel_element* elem, + grpc_channel_element_args* args) { + grpc_error* error = GRPC_ERROR_NONE; + new (elem->channel_data) ChannelData(elem, args, &error); + return error; +} + +void ChannelData::Destroy(grpc_channel_element* elem) { + ChannelData* chand = static_cast(elem->channel_data); + chand->~ChannelData(); +} + +void ChannelData::StartTransportOp(grpc_channel_element* elem, + grpc_transport_op* op) { + ChannelData* chand = static_cast(elem->channel_data); + // Catch the disconnect_with_error transport op. + if (op->disconnect_with_error != nullptr) { + // Disconnect. Cancel the timer if we set it before. + // IncreaseCallCount() introduces a dummy call. It will cancel the timer and + // prevent the timer from being reset by other threads. + chand->IncreaseCallCount(); + } + // Pass the op to the next filter. + grpc_channel_next_op(elem, op); +} + +void ChannelData::IncreaseCallCount() { + MutexLock lock(&call_count_mu_); + if (call_count_++ == 0) { + grpc_timer_cancel(&idle_timer_); + } + GRPC_IDLE_FILTER_LOG("call counter has increased to %" PRIuPTR, call_count_); +} + +void ChannelData::DecreaseCallCount() { + MutexLock lock(&call_count_mu_); + if (call_count_-- == 1) { + StartIdleTimer(); + } + GRPC_IDLE_FILTER_LOG("call counter has decreased to %" PRIuPTR, call_count_); +} + +ChannelData::ChannelData(grpc_channel_element* elem, + grpc_channel_element_args* args, grpc_error** error) + : elem_(elem), + channel_stack_(args->channel_stack), + client_idle_timeout_(GetClientIdleTimeout(args->channel_args)), + call_count_(0) { + // If the idle filter is explicitly disabled in channel args, this ctor should + // not get called. + GPR_ASSERT(client_idle_timeout_ != GRPC_MILLIS_INF_FUTURE); + GRPC_IDLE_FILTER_LOG("created with max_leisure_time = %" PRId64 " ms", + client_idle_timeout_); + // Initialize the idle timer without setting it. + grpc_timer_init_unset(&idle_timer_); + // Initialize the idle timer callback closure. + GRPC_CLOSURE_INIT(&idle_timer_callback_, IdleTimerCallback, this, + grpc_schedule_on_exec_ctx); + // Initialize the idle transport op complete callback. + GRPC_CLOSURE_INIT(&idle_transport_op_complete_callback_, + IdleTransportOpCompleteCallback, this, + grpc_schedule_on_exec_ctx); +} + +void ChannelData::IdleTimerCallback(void* arg, grpc_error* error) { + GRPC_IDLE_FILTER_LOG("timer alarms"); + ChannelData* chand = static_cast(arg); + { + MutexLock lock(&chand->call_count_mu_); + if (error == GRPC_ERROR_NONE && chand->call_count_ == 0) { + chand->EnterIdle(); + } + } + GRPC_IDLE_FILTER_LOG("timer finishes"); + GRPC_CHANNEL_STACK_UNREF(chand->channel_stack_, "max idle timer callback"); +} + +void ChannelData::IdleTransportOpCompleteCallback(void* arg, + grpc_error* error) { + ChannelData* chand = static_cast(arg); + GRPC_CHANNEL_STACK_UNREF(chand->channel_stack_, "idle transport op"); +} + +void ChannelData::StartIdleTimer() { + GRPC_IDLE_FILTER_LOG("timer has started"); + // Hold a ref to the channel stack for the timer callback. + GRPC_CHANNEL_STACK_REF(channel_stack_, "max idle timer callback"); + grpc_timer_init(&idle_timer_, ExecCtx::Get()->Now() + client_idle_timeout_, + &idle_timer_callback_); +} + +void ChannelData::EnterIdle() { + GRPC_IDLE_FILTER_LOG("the channel will enter IDLE"); + // Hold a ref to the channel stack for the transport op. + GRPC_CHANNEL_STACK_REF(channel_stack_, "idle transport op"); + // Initialize the transport op. + memset(&idle_transport_op_, 0, sizeof(idle_transport_op_)); + idle_transport_op_.disconnect_with_error = grpc_error_set_int( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("enter idle"), + GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, GRPC_CHANNEL_IDLE); + idle_transport_op_.on_consumed = &idle_transport_op_complete_callback_; + // Pass the transport op down to the channel stack. + grpc_channel_next_op(elem_, &idle_transport_op_); +} + +class CallData { + public: + static grpc_error* Init(grpc_call_element* elem, + const grpc_call_element_args* args); + static void Destroy(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* then_schedule_closure); +}; + +grpc_error* CallData::Init(grpc_call_element* elem, + const grpc_call_element_args* args) { + ChannelData* chand = static_cast(elem->channel_data); + chand->IncreaseCallCount(); + return GRPC_ERROR_NONE; +} + +void CallData::Destroy(grpc_call_element* elem, + const grpc_call_final_info* final_info, + grpc_closure* ignored) { + ChannelData* chand = static_cast(elem->channel_data); + chand->DecreaseCallCount(); +} + +const grpc_channel_filter grpc_client_idle_filter = { + grpc_call_next_op, + ChannelData::StartTransportOp, + sizeof(CallData), + CallData::Init, + grpc_call_stack_ignore_set_pollset_or_pollset_set, + CallData::Destroy, + sizeof(ChannelData), + ChannelData::Init, + ChannelData::Destroy, + grpc_channel_next_get_info, + "client_idle"}; + +static bool MaybeAddClientIdleFilter(grpc_channel_stack_builder* builder, + void* arg) { + const grpc_channel_args* channel_args = + grpc_channel_stack_builder_get_channel_arguments(builder); + if (!grpc_channel_args_want_minimal_stack(channel_args) && + GetClientIdleTimeout(channel_args) != INT_MAX) { + return grpc_channel_stack_builder_prepend_filter( + builder, &grpc_client_idle_filter, nullptr, nullptr); + } else { + return true; + } +} + +} // namespace +} // namespace grpc_core + +void grpc_client_idle_filter_init(void) { + grpc_channel_init_register_stage( + GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + grpc_core::MaybeAddClientIdleFilter, nullptr); +} + +void grpc_client_idle_filter_shutdown(void) {} diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc index d014460b34e..9ec7aaf4ec8 100644 --- a/src/core/ext/filters/http/client/http_client_filter.cc +++ b/src/core/ext/filters/http/client/http_client_filter.cc @@ -304,7 +304,7 @@ static grpc_error* update_path_for_get(grpc_call_element* elem, estimated_len += grpc_base64_estimate_encoded_size( batch->payload->send_message.send_message->length(), true /* url_safe */, false /* multi_line */); - grpc_slice path_with_query_slice = GRPC_SLICE_MALLOC(estimated_len); + grpc_core::UnmanagedMemorySlice path_with_query_slice(estimated_len); /* memcopy individual pieces into this slice */ char* write_ptr = reinterpret_cast GRPC_SLICE_START_PTR(path_with_query_slice); @@ -514,13 +514,12 @@ static size_t max_payload_size_from_args(const grpc_channel_args* args) { return kMaxPayloadSizeForGet; } -static grpc_slice user_agent_from_args(const grpc_channel_args* args, - const char* transport_name) { +static grpc_core::ManagedMemorySlice user_agent_from_args( + const grpc_channel_args* args, const char* transport_name) { gpr_strvec v; size_t i; int is_first = 1; char* tmp; - grpc_slice result; gpr_strvec_init(&v); @@ -558,7 +557,7 @@ static grpc_slice user_agent_from_args(const grpc_channel_args* args, tmp = gpr_strvec_flatten(&v, nullptr); gpr_strvec_destroy(&v); - result = grpc_slice_intern(grpc_slice_from_static_string_internal(tmp)); + grpc_core::ManagedMemorySlice result(tmp); gpr_free(tmp); return result; diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index 4bd666ecfee..13c6ce58fec 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -44,7 +44,7 @@ struct call_data { }; struct channel_data { - grpc_slice default_authority; + grpc_core::ManagedMemorySlice default_authority; grpc_mdelem default_authority_mdelem; }; @@ -101,8 +101,8 @@ grpc_error* init_channel_elem(grpc_channel_element* elem, return GRPC_ERROR_CREATE_FROM_STATIC_STRING( "GRPC_ARG_DEFAULT_AUTHORITY channel arg. must be a string"); } - chand->default_authority = grpc_slice_intern( - grpc_slice_from_static_string_internal(default_authority_str)); + chand->default_authority = + grpc_core::ManagedMemorySlice(default_authority_str); chand->default_authority_mdelem = grpc_mdelem_create( GRPC_MDSTR_AUTHORITY, chand->default_authority, nullptr); GPR_ASSERT(!args->is_last); diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.cc b/src/core/ext/filters/http/message_compress/message_compress_filter.cc index 3ce79b305df..0e0be6e9cff 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.cc +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.cc @@ -72,29 +72,31 @@ struct call_data { GRPC_CLOSURE_INIT(&start_send_message_batch_in_call_combiner, start_send_message_batch, elem, grpc_schedule_on_exec_ctx); - grpc_slice_buffer_init(&slices); - GRPC_CLOSURE_INIT(&send_message_on_complete, ::send_message_on_complete, - elem, grpc_schedule_on_exec_ctx); - GRPC_CLOSURE_INIT(&on_send_message_next_done, ::on_send_message_next_done, - elem, grpc_schedule_on_exec_ctx); } ~call_data() { - grpc_slice_buffer_destroy_internal(&slices); + if (state_initialized) { + grpc_slice_buffer_destroy_internal(&slices); + } GRPC_ERROR_UNREF(cancel_error); } grpc_core::CallCombiner* call_combiner; - grpc_linked_mdelem message_compression_algorithm_storage; - grpc_linked_mdelem stream_compression_algorithm_storage; - grpc_linked_mdelem accept_encoding_storage; - grpc_linked_mdelem accept_stream_encoding_storage; grpc_message_compression_algorithm message_compression_algorithm = GRPC_MESSAGE_COMPRESS_NONE; - bool seen_initial_metadata = false; grpc_error* cancel_error = GRPC_ERROR_NONE; - grpc_closure start_send_message_batch_in_call_combiner; grpc_transport_stream_op_batch* send_message_batch = nullptr; + bool seen_initial_metadata = false; + /* Set to true, if the fields below are initialized. */ + bool state_initialized = false; + grpc_closure start_send_message_batch_in_call_combiner; + /* The fields below are only initialized when we compress the payload. + * Keep them at the bottom of the struct, so they don't pollute the + * cache-lines. */ + grpc_linked_mdelem message_compression_algorithm_storage; + grpc_linked_mdelem stream_compression_algorithm_storage; + grpc_linked_mdelem accept_encoding_storage; + grpc_linked_mdelem accept_stream_encoding_storage; grpc_slice_buffer slices; /**< Buffers up input slices to be compressed */ grpc_core::ManualConstructor replacement_stream; @@ -157,6 +159,18 @@ static grpc_compression_algorithm find_compression_algorithm( return GRPC_COMPRESS_NONE; } +static void initialize_state(grpc_call_element* elem, call_data* calld) { + GPR_DEBUG_ASSERT(!calld->state_initialized); + calld->state_initialized = true; + grpc_slice_buffer_init(&calld->slices); + GRPC_CLOSURE_INIT(&calld->send_message_on_complete, + ::send_message_on_complete, elem, + grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&calld->on_send_message_next_done, + ::on_send_message_next_done, elem, + grpc_schedule_on_exec_ctx); +} + static grpc_error* process_send_initial_metadata( grpc_call_element* elem, grpc_metadata_batch* initial_metadata) GRPC_MUST_USE_RESULT; @@ -177,11 +191,13 @@ static grpc_error* process_send_initial_metadata( // Hint compression algorithm. grpc_error* error = GRPC_ERROR_NONE; if (calld->message_compression_algorithm != GRPC_MESSAGE_COMPRESS_NONE) { + initialize_state(elem, calld); error = grpc_metadata_batch_add_tail( initial_metadata, &calld->message_compression_algorithm_storage, grpc_message_compression_encoding_mdelem( calld->message_compression_algorithm)); } else if (stream_compression_algorithm != GRPC_STREAM_COMPRESS_NONE) { + initialize_state(elem, calld); error = grpc_metadata_batch_add_tail( initial_metadata, &calld->stream_compression_algorithm_storage, grpc_stream_compression_encoding_mdelem(stream_compression_algorithm)); @@ -225,6 +241,8 @@ static void send_message_batch_continue(grpc_call_element* elem) { static void finish_send_message(grpc_call_element* elem) { call_data* calld = static_cast(elem->call_data); + GPR_DEBUG_ASSERT(calld->message_compression_algorithm != + GRPC_MESSAGE_COMPRESS_NONE); // Compress the data if appropriate. grpc_slice_buffer tmp; grpc_slice_buffer_init(&tmp); diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc index 1d373c5b994..f48b0f4fdcf 100644 --- a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +++ b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc @@ -18,12 +18,15 @@ #include +#include + #include #include #include #include #include +#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h" #include "src/core/ext/filters/client_channel/parse_address.h" #include "src/core/ext/filters/load_reporting/registered_opencensus_objects.h" #include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h" @@ -225,7 +228,8 @@ grpc_filtered_mdelem ServerLoadReportingCallData::RecvInitialMetadataFilter( calld->target_host_[i] = static_cast( tolower(GRPC_SLICE_START_PTR(target_host_slice)[i])); } - } else if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_LB_TOKEN)) { + } else if (grpc_slice_str_cmp(GRPC_MDKEY(md), + grpc_core::kGrpcLbLbTokenMetadataKey) == 0) { if (calld->client_ip_and_lr_token_ == nullptr) { calld->StoreClientIpAndLrToken( reinterpret_cast GRPC_SLICE_START_PTR(GRPC_MDVALUE(md)), diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc index f2308581c13..96f2f02056f 100644 --- a/src/core/ext/filters/max_age/max_age_filter.cc +++ b/src/core/ext/filters/max_age/max_age_filter.cc @@ -47,7 +47,7 @@ namespace { struct channel_data { - /* We take a reference to the channel stack for the timer callback */ + /* The channel stack to which we take refs for pending callbacks. */ grpc_channel_stack* channel_stack; /* Guards access to max_age_timer, max_age_timer_pending, max_age_grace_timer and max_age_grace_timer_pending */ @@ -122,8 +122,8 @@ struct channel_data { MAX_IDLE_STATE_SEEN_ENTER_IDLE: The state after the timer is set and the at least one call has arrived after the timer is set, BUT the channel - currently has 1 or 1+ active calls. If the timer is fired in this state, we - will reschudle it. + currently has 0 active calls. If the timer is fired in this state, we will + reschudle it. max_idle_timer will not be cancelled (unless the channel is shutting down). If the timer callback is called when the max_idle_timer is valid (i.e. diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.cc b/src/core/ext/transport/chttp2/client/chttp2_connector.cc index c324c2c9243..6b6d299b6e2 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.cc +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.cc @@ -111,15 +111,14 @@ static void on_handshake_done(void* arg, grpc_error* error) { } else { error = GRPC_ERROR_REF(error); } - memset(c->result, 0, sizeof(*c->result)); + c->result->reset(); } else { grpc_endpoint_delete_from_pollset_set(args->endpoint, c->args.interested_parties); c->result->transport = grpc_create_chttp2_transport(args->args, args->endpoint, true); - grpc_core::RefCountedPtr socket_node = + c->result->socket = grpc_chttp2_transport_get_socket_node(c->result->transport); - c->result->socket_uuid = socket_node == nullptr ? 0 : socket_node->uuid(); GPR_ASSERT(c->result->transport); // TODO(roth): We ideally want to wait until we receive HTTP/2 // settings from the server before we consider the connection @@ -180,7 +179,7 @@ static void connected(void* arg, grpc_error* error) { } else { error = GRPC_ERROR_REF(error); } - memset(c->result, 0, sizeof(*c->result)); + c->result->reset(); grpc_closure* notify = c->notify; c->notify = nullptr; GRPC_CLOSURE_SCHED(notify, error); diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index dc60ec2487b..5e9cd77d18a 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -317,7 +317,7 @@ static grpc_error* chttp2_server_add_acceptor(grpc_server* server, *arg_val = grpc_tcp_server_create_fd_handler(tcp_server); grpc_server_add_listener(server, state, server_start_listener, - server_destroy_listener, /* socket_uuid */ 0); + server_destroy_listener, /* node */ nullptr); return err; /* Error path: cleanup and return */ @@ -345,7 +345,6 @@ grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr, grpc_error** errors = nullptr; size_t naddrs = 0; const grpc_arg* arg = nullptr; - intptr_t socket_uuid = 0; *port_num = -1; @@ -413,15 +412,18 @@ grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr, arg = grpc_channel_args_find(args, GRPC_ARG_ENABLE_CHANNELZ); if (grpc_channel_arg_get_bool(arg, GRPC_ENABLE_CHANNELZ_DEFAULT)) { + char* socket_name = nullptr; + gpr_asprintf(&socket_name, "chttp2 listener %s", addr); state->channelz_listen_socket = grpc_core::MakeRefCounted( - grpc_core::UniquePtr(gpr_strdup(addr))); - socket_uuid = state->channelz_listen_socket->uuid(); + grpc_core::UniquePtr(gpr_strdup(addr)), + grpc_core::UniquePtr(socket_name)); } /* Register with the server only upon success */ grpc_server_add_listener(server, state, server_start_listener, - server_destroy_listener, socket_uuid); + server_destroy_listener, + state->channelz_listen_socket); goto done; /* Error path: cleanup and return */ diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 43f2db1309f..16146569886 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -378,10 +378,13 @@ static bool read_channel_args(grpc_chttp2_transport* t, if (channelz_enabled) { // TODO(ncteisen): add an API to endpoint to query for local addr, and pass // it in here, so SocketNode knows its own address. + char* socket_name = nullptr; + gpr_asprintf(&socket_name, "%s %s", get_vtable()->name, t->peer_string); t->channelz_socket = grpc_core::MakeRefCounted( grpc_core::UniquePtr(), - grpc_core::UniquePtr(gpr_strdup(t->peer_string))); + grpc_core::UniquePtr(gpr_strdup(t->peer_string)), + grpc_core::UniquePtr(socket_name)); } return enable_bdp; } @@ -782,12 +785,6 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs, GRPC_ERROR_NONE); } -grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t, - uint32_t id) { - return static_cast( - grpc_chttp2_stream_map_find(&t->stream_map, id)); -} - grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t, uint32_t id) { if (t->channel_callback.accept_stream == nullptr) { @@ -2066,7 +2063,7 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id, grpc_error* error) { grpc_chttp2_stream* s = static_cast( grpc_chttp2_stream_map_delete(&t->stream_map, id)); - GPR_ASSERT(s); + GPR_DEBUG_ASSERT(s); if (t->incoming_stream == s) { t->incoming_stream = nullptr; grpc_chttp2_parsing_become_skip_parser(t); @@ -2152,7 +2149,7 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s, &s->metadata_buffer[1], grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_STATUS, - grpc_slice_from_copied_string(status_string)))); + grpc_core::UnmanagedMemorySlice(status_string)))); if (!GRPC_SLICE_IS_EMPTY(slice)) { GRPC_LOG_IF_ERROR( "add_status_message", diff --git a/src/core/ext/transport/chttp2/transport/context_list.cc b/src/core/ext/transport/chttp2/transport/context_list.cc index df09809067d..245e8135833 100644 --- a/src/core/ext/transport/chttp2/transport/context_list.cc +++ b/src/core/ext/transport/chttp2/transport/context_list.cc @@ -46,7 +46,9 @@ void ContextList::Execute(void* arg, grpc_core::Timestamps* ts, ContextList* to_be_freed; while (head != nullptr) { if (write_timestamps_callback_g) { - ts->byte_offset = static_cast(head->byte_offset_); + if (ts) { + ts->byte_offset = static_cast(head->byte_offset_); + } write_timestamps_callback_g(head->trace_context_, ts, error); } to_be_freed = head; diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index 2b40b7b03ed..e46504d9b30 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -604,8 +604,8 @@ static void deadline_enc(grpc_chttp2_hpack_compressor* c, grpc_millis deadline, grpc_mdelem mdelem; grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(), timeout_str); - mdelem = grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TIMEOUT, - grpc_slice_from_copied_string(timeout_str)); + mdelem = grpc_mdelem_from_slices( + GRPC_MDSTR_GRPC_TIMEOUT, grpc_core::UnmanagedMemorySlice(timeout_str)); hpack_enc(c, mdelem, st); GRPC_MDELEM_UNREF(mdelem); } diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 32848929363..724c6c1bffc 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -660,24 +660,32 @@ static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md) { return GRPC_ERROR_NONE; } -static grpc_slice take_string(grpc_chttp2_hpack_parser* p, - grpc_chttp2_hpack_parser_string* str, - bool intern) { - grpc_slice s; +static grpc_core::UnmanagedMemorySlice take_string_extern( + grpc_chttp2_hpack_parser* p, grpc_chttp2_hpack_parser_string* str) { + grpc_core::UnmanagedMemorySlice s; if (!str->copied) { - if (intern) { - s = grpc_slice_intern(str->data.referenced); - grpc_slice_unref_internal(str->data.referenced); - } else { - s = str->data.referenced; - } + GPR_DEBUG_ASSERT(!grpc_slice_is_interned(str->data.referenced)); + s = static_cast(str->data.referenced); + str->copied = true; + str->data.referenced = grpc_core::UnmanagedMemorySlice(); + } else { + s = grpc_core::UnmanagedMemorySlice(str->data.copied.str, + str->data.copied.length); + } + str->data.copied.length = 0; + return s; +} + +static grpc_core::ManagedMemorySlice take_string_intern( + grpc_chttp2_hpack_parser* p, grpc_chttp2_hpack_parser_string* str) { + grpc_core::ManagedMemorySlice s; + if (!str->copied) { + s = grpc_core::ManagedMemorySlice(&str->data.referenced); + grpc_slice_unref_internal(str->data.referenced); str->copied = true; str->data.referenced = grpc_empty_slice(); - } else if (intern) { - s = grpc_slice_intern(grpc_slice_from_static_buffer_internal( - str->data.copied.str, str->data.copied.length)); } else { - s = grpc_slice_from_copied_buffer(str->data.copied.str, + s = grpc_core::ManagedMemorySlice(str->data.copied.str, str->data.copied.length); } str->data.copied.length = 0; @@ -812,6 +820,12 @@ static grpc_mdelem get_precomputed_md_for_idx(grpc_chttp2_hpack_parser* p) { return md; } +static const grpc_core::ManagedMemorySlice& get_indexed_key(grpc_mdelem md) { + GPR_DEBUG_ASSERT(GRPC_MDELEM_IS_INTERNED(md)); + return static_cast( + grpc_slice_ref_internal(GRPC_MDKEY(md))); +} + /* finish a literal header with incremental indexing */ static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p, const uint8_t* cur, @@ -819,8 +833,8 @@ static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p, GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX(); grpc_mdelem md = get_precomputed_md_for_idx(p); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)), - take_string(p, &p->value, true))); + p, grpc_mdelem_from_slices(get_indexed_key(md), + take_string_intern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -830,9 +844,9 @@ static grpc_error* finish_lithdr_incidx_v(grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end) { GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX_V(); - grpc_error* err = - on_hdr(p, grpc_mdelem_from_slices(take_string(p, &p->key, true), - take_string(p, &p->value, true))); + grpc_error* err = on_hdr( + p, grpc_mdelem_from_slices(take_string_intern(p, &p->key), + take_string_intern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -883,8 +897,8 @@ static grpc_error* finish_lithdr_notidx(grpc_chttp2_hpack_parser* p, GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX(); grpc_mdelem md = get_precomputed_md_for_idx(p); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)), - take_string(p, &p->value, false))); + p, grpc_mdelem_from_slices(get_indexed_key(md), + take_string_extern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -895,8 +909,8 @@ static grpc_error* finish_lithdr_notidx_v(grpc_chttp2_hpack_parser* p, const uint8_t* end) { GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX_V(); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(take_string(p, &p->key, true), - take_string(p, &p->value, false))); + p, grpc_mdelem_from_slices(take_string_intern(p, &p->key), + take_string_extern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -947,8 +961,8 @@ static grpc_error* finish_lithdr_nvridx(grpc_chttp2_hpack_parser* p, GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX(); grpc_mdelem md = get_precomputed_md_for_idx(p); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)), - take_string(p, &p->value, false))); + p, grpc_mdelem_from_slices(get_indexed_key(md), + take_string_extern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -959,8 +973,8 @@ static grpc_error* finish_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p, const uint8_t* end) { GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX_V(); grpc_error* err = on_hdr( - p, grpc_mdelem_from_slices(take_string(p, &p->key, true), - take_string(p, &p->value, false))); + p, grpc_mdelem_from_slices(take_string_intern(p, &p->key), + take_string_extern(p, &p->value))); if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err); return parse_begin(p, cur, end); } @@ -1510,13 +1524,12 @@ static grpc_error* parse_key_string(grpc_chttp2_hpack_parser* p, static bool is_binary_literal_header(grpc_chttp2_hpack_parser* p) { /* We know that either argument here is a reference counter slice. - * 1. If a result of grpc_slice_from_static_buffer_internal, the refcount is - * set to kNoopRefcount. + * 1. If it is a grpc_core::StaticSlice, the refcount is set to kNoopRefcount. * 2. If it's p->key.data.referenced, then p->key.copied was set to false, * which occurs in begin_parse_string() - where the refcount is set to * p->current_slice_refcount, which is not null. */ return grpc_is_refcounted_slice_binary_header( - p->key.copied ? grpc_slice_from_static_buffer_internal( + p->key.copied ? grpc_core::ExternallyManagedSlice( p->key.data.copied.str, p->key.data.copied.length) : p->key.data.referenced); } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 732bc38a0ac..643cd25b8bd 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -745,8 +745,11 @@ void grpc_chttp2_act_on_flowctl_action( /********* End of Flow Control ***************/ -grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t, - uint32_t id); +inline grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream( + grpc_chttp2_transport* t, uint32_t id) { + return static_cast( + grpc_chttp2_stream_map_find(&t->stream_map, id)); +} grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t, uint32_t id); diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 1aa6d971684..4e6ff60caf8 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -394,6 +394,32 @@ error_handler: static void free_timeout(void* p) { gpr_free(p); } +static bool md_key_cmp(grpc_mdelem md, const grpc_slice& reference) { + GPR_DEBUG_ASSERT(grpc_slice_is_interned(GRPC_MDKEY(md))); + return GRPC_MDKEY(md).refcount == reference.refcount; +} + +static bool md_cmp(grpc_mdelem md, grpc_mdelem ref_md, + const grpc_slice& ref_key) { + if (GPR_LIKELY(GRPC_MDELEM_IS_INTERNED(md))) { + return md.payload == ref_md.payload; + } + if (md_key_cmp(md, ref_key)) { + return grpc_slice_eq_static_interned(GRPC_MDVALUE(md), + GRPC_MDVALUE(ref_md)); + } + return false; +} + +static bool is_nonzero_status(grpc_mdelem md) { + // If md.payload == GRPC_MDELEM_GRPC_STATUS_1 or GRPC_MDELEM_GRPC_STATUS_2, + // then we have seen an error. In fact, if it is a GRPC_STATUS and it's + // not equal to GRPC_MDELEM_GRPC_STATUS_0, then we have seen an error. + // TODO(ctiller): check for a status like " 0" + return md_key_cmp(md, GRPC_MDSTR_GRPC_STATUS) && + !md_cmp(md, GRPC_MDELEM_GRPC_STATUS_0, GRPC_MDSTR_GRPC_STATUS); +} + static void on_initial_header(void* tp, grpc_mdelem md) { GPR_TIMER_SCOPE("on_initial_header", 0); @@ -411,15 +437,9 @@ static void on_initial_header(void* tp, grpc_mdelem md) { gpr_free(value); } - // If md.payload == GRPC_MDELEM_GRPC_STATUS_1 or GRPC_MDELEM_GRPC_STATUS_2, - // then we have seen an error. In fact, if it is a GRPC_STATUS and it's - // not equal to GRPC_MDELEM_GRPC_STATUS_0, then we have seen an error. - if (grpc_slice_eq_static_interned(GRPC_MDKEY(md), GRPC_MDSTR_GRPC_STATUS) && - !grpc_mdelem_static_value_eq(md, GRPC_MDELEM_GRPC_STATUS_0)) { - /* TODO(ctiller): check for a status like " 0" */ + if (is_nonzero_status(md)) { // not GRPC_MDELEM_GRPC_STATUS_0? s->seen_error = true; - } else if (grpc_slice_eq_static_interned(GRPC_MDKEY(md), - GRPC_MDSTR_GRPC_TIMEOUT)) { + } else if (md_key_cmp(md, GRPC_MDSTR_GRPC_TIMEOUT)) { grpc_millis* cached_timeout = static_cast(grpc_mdelem_get_user_data(md, free_timeout)); grpc_millis timeout; @@ -496,12 +516,7 @@ static void on_trailing_header(void* tp, grpc_mdelem md) { gpr_free(value); } - // If md.payload == GRPC_MDELEM_GRPC_STATUS_1 or GRPC_MDELEM_GRPC_STATUS_2, - // then we have seen an error. In fact, if it is a GRPC_STATUS and it's - // not equal to GRPC_MDELEM_GRPC_STATUS_0, then we have seen an error. - if (grpc_slice_eq_static_interned(GRPC_MDKEY(md), GRPC_MDSTR_GRPC_STATUS) && - !grpc_mdelem_static_value_eq(md, GRPC_MDELEM_GRPC_STATUS_0)) { - /* TODO(ctiller): check for a status like " 0" */ + if (is_nonzero_status(md)) { // not GRPC_MDELEM_GRPC_STATUS_0? s->seen_error = true; } diff --git a/src/core/ext/transport/chttp2/transport/stream_map.cc b/src/core/ext/transport/chttp2/transport/stream_map.cc index f300e2356c9..647214b94a0 100644 --- a/src/core/ext/transport/chttp2/transport/stream_map.cc +++ b/src/core/ext/transport/chttp2/transport/stream_map.cc @@ -27,7 +27,7 @@ void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map, size_t initial_capacity) { - GPR_ASSERT(initial_capacity > 1); + GPR_DEBUG_ASSERT(initial_capacity > 1); map->keys = static_cast(gpr_malloc(sizeof(uint32_t) * initial_capacity)); map->values = @@ -63,9 +63,17 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key, uint32_t* keys = map->keys; void** values = map->values; + // The first assertion ensures that the table is monotonically increasing. GPR_ASSERT(count == 0 || keys[count - 1] < key); - GPR_ASSERT(value); - GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr); + GPR_DEBUG_ASSERT(value); + // Asserting that the key is not already in the map can be a debug assertion. + // Why: we're already checking that the map elements are monotonically + // increasing. If we re-add a key, i.e. if the key is already present, then + // either it is the most recently added key in the map (in which case the + // first assertion fails due to key == last_key) or there is a more recently + // added (larger) key at the end of the map: in which case the first assertion + // still fails due to key < last_key. + GPR_DEBUG_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr); if (count == capacity) { if (map->free > capacity / 4) { @@ -74,7 +82,7 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key, } else { /* resize when less than 25% of the table is free, because compaction won't help much */ - map->capacity = capacity = 3 * capacity / 2; + map->capacity = capacity = 2 * capacity; map->keys = keys = static_cast( gpr_realloc(keys, capacity * sizeof(uint32_t))); map->values = values = @@ -87,6 +95,7 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key, map->count = count + 1; } +template static void** find(grpc_chttp2_stream_map* map, uint32_t key) { size_t min_idx = 0; size_t max_idx = map->count; @@ -95,7 +104,8 @@ static void** find(grpc_chttp2_stream_map* map, uint32_t key) { void** values = map->values; uint32_t mid_key; - if (max_idx == 0) return nullptr; + GPR_DEBUG_ASSERT(!strict_find || max_idx > 0); + if (!strict_find && max_idx == 0) return nullptr; while (min_idx < max_idx) { /* find the midpoint, avoiding overflow */ @@ -112,28 +122,28 @@ static void** find(grpc_chttp2_stream_map* map, uint32_t key) { } } + GPR_DEBUG_ASSERT(!strict_find); return nullptr; } void* grpc_chttp2_stream_map_delete(grpc_chttp2_stream_map* map, uint32_t key) { - void** pvalue = find(map, key); - void* out = nullptr; - if (pvalue != nullptr) { - out = *pvalue; - *pvalue = nullptr; - map->free += (out != nullptr); - /* recognize complete emptyness and ensure we can skip - * defragmentation later */ - if (map->free == map->count) { - map->free = map->count = 0; - } - GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr); + void** pvalue = find(map, key); + GPR_DEBUG_ASSERT(pvalue != nullptr); + void* out = *pvalue; + GPR_DEBUG_ASSERT(out != nullptr); + *pvalue = nullptr; + map->free++; + /* recognize complete emptyness and ensure we can skip + defragmentation later */ + if (map->free == map->count) { + map->free = map->count = 0; } + GPR_DEBUG_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr); return out; } void* grpc_chttp2_stream_map_find(grpc_chttp2_stream_map* map, uint32_t key) { - void** pvalue = find(map, key); + void** pvalue = find(map, key); return pvalue != nullptr ? *pvalue : nullptr; } diff --git a/src/core/ext/transport/cronet/BUILD b/src/core/ext/transport/cronet/BUILD new file mode 100644 index 00000000000..c77bf19af1f --- /dev/null +++ b/src/core/ext/transport/cronet/BUILD @@ -0,0 +1,65 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2016 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load( + "//bazel:grpc_build_system.bzl", + "grpc_cc_library", +) + +licenses(["notice"]) # Apache v2 + +package( + default_visibility = ["//visibility:public"], + features = [ + "-layering_check", + "-parse_headers", + ], +) + +grpc_cc_library( + name = "grpc_transport_cronet_client_secure", + srcs = [ + "client/secure/cronet_channel_create.cc", + "transport/cronet_api_dummy.cc", + "transport/cronet_transport.cc", + "transport/cronet_transport.h", + ], + external_deps = [ + "cronet_c_for_grpc", + ], + language = "c++", + public_hdrs = [ + "client/secure/cronet_channel_create.h", + ], + deps = [ + "//:grpc_base", + "//:grpc_transport_chttp2", + ], +) + +grpc_cc_library( + name = "grpc_cronet_plugin_registry", + srcs = [ + "plugin_registry/grpc_cronet_plugin_registry.cc", + ], + language = "c++", + deps = [ + ":grpc_transport_cronet_client_secure", + "//:grpc_base", + "//:grpc_http_filters", + "//:grpc_transport_chttp2_client_secure", + ], +) diff --git a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc index 6e08d27b21d..c3fc25630e7 100644 --- a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc +++ b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc @@ -21,11 +21,10 @@ #include #include -#include - #include #include +#include "src/core/ext/transport/cronet/client/secure/cronet_channel_create.h" #include "src/core/ext/transport/cronet/transport/cronet_transport.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/transport/transport_impl.h" diff --git a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.h b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.h new file mode 100644 index 00000000000..7427f9fb21d --- /dev/null +++ b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.h @@ -0,0 +1,39 @@ +/* + * + * Copyright 2016 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_EXT_TRANSPORT_CRONET_CLIENT_SECURE_CRONET_CHANNEL_CREATE_H +#define GRPC_CORE_EXT_TRANSPORT_CRONET_CLIENT_SECURE_CRONET_CHANNEL_CREATE_H + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +GRPCAPI grpc_channel* grpc_cronet_secure_channel_create( + void* engine, const char* target, const grpc_channel_args* args, + void* reserved); + +#ifdef __cplusplus +} +#endif + +#endif /* GRPC_CORE_EXT_TRANSPORT_CRONET_CLIENT_SECURE_CRONET_CHANNEL_CREATE_H \ + */ diff --git a/src/core/plugin_registry/grpc_cronet_plugin_registry.cc b/src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc similarity index 78% rename from src/core/plugin_registry/grpc_cronet_plugin_registry.cc rename to src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc index 92085d31d70..8df100f17a3 100644 --- a/src/core/plugin_registry/grpc_cronet_plugin_registry.cc +++ b/src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc @@ -30,12 +30,9 @@ void grpc_client_channel_init(void); void grpc_client_channel_shutdown(void); void grpc_register_built_in_plugins(void) { - grpc_register_plugin(grpc_http_filters_init, - grpc_http_filters_shutdown); - grpc_register_plugin(grpc_chttp2_plugin_init, - grpc_chttp2_plugin_shutdown); + grpc_register_plugin(grpc_http_filters_init, grpc_http_filters_shutdown); + grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); grpc_register_plugin(grpc_deadline_filter_init, grpc_deadline_filter_shutdown); - grpc_register_plugin(grpc_client_channel_init, - grpc_client_channel_shutdown); + grpc_register_plugin(grpc_client_channel_init, grpc_client_channel_shutdown); } diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc index a5f6571c510..28e6c04869e 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -41,6 +41,7 @@ #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/transport_impl.h" + #include "third_party/objective_c/Cronet/bidirectional_stream_c.h" #define GRPC_HEADER_SIZE_IN_BYTES 5 diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc index 8cb9ac4a2fd..a7f67879287 100644 --- a/src/core/ext/transport/inproc/inproc_transport.cc +++ b/src/core/ext/transport/inproc/inproc_transport.cc @@ -1203,7 +1203,7 @@ void inproc_transports_create(grpc_transport** server_transport, */ void grpc_inproc_transport_init(void) { grpc_core::ExecCtx exec_ctx; - g_empty_slice = grpc_slice_from_static_buffer_internal(nullptr, 0); + g_empty_slice = grpc_core::ExternallyManagedSlice(); grpc_slice key_tmp = grpc_slice_from_static_string(":path"); g_fake_path_key = grpc_slice_intern(key_tmp); diff --git a/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c b/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c index e8a2fb32bab..844ad3d147f 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c @@ -124,20 +124,22 @@ const upb_msglayout envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValida UPB_SIZE(8, 16), 2, false, }; -static const upb_msglayout *const envoy_api_v2_auth_UpstreamTlsContext_submsgs[1] = { +static const upb_msglayout *const envoy_api_v2_auth_UpstreamTlsContext_submsgs[2] = { &envoy_api_v2_auth_CommonTlsContext_msginit, + &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_auth_UpstreamTlsContext__fields[3] = { +static const upb_msglayout_field envoy_api_v2_auth_UpstreamTlsContext__fields[4] = { {1, UPB_SIZE(12, 24), 0, 0, 11, 1}, {2, UPB_SIZE(4, 8), 0, 0, 9, 1}, {3, UPB_SIZE(0, 0), 0, 0, 8, 1}, + {4, UPB_SIZE(16, 32), 0, 1, 11, 1}, }; const upb_msglayout envoy_api_v2_auth_UpstreamTlsContext_msginit = { &envoy_api_v2_auth_UpstreamTlsContext_submsgs[0], &envoy_api_v2_auth_UpstreamTlsContext__fields[0], - UPB_SIZE(16, 32), 3, false, + UPB_SIZE(24, 48), 4, false, }; static const upb_msglayout *const envoy_api_v2_auth_DownstreamTlsContext_submsgs[5] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h b/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h index 22379341331..89aeaee2fd7 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_AUTH_CERT_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -53,11 +53,11 @@ extern const upb_msglayout envoy_api_v2_auth_Secret_msginit; struct envoy_api_v2_core_ConfigSource; struct envoy_api_v2_core_DataSource; struct google_protobuf_BoolValue; +struct google_protobuf_UInt32Value; extern const upb_msglayout envoy_api_v2_core_ConfigSource_msginit; extern const upb_msglayout envoy_api_v2_core_DataSource_msginit; extern const upb_msglayout google_protobuf_BoolValue_msginit; - -/* Enums */ +extern const upb_msglayout google_protobuf_UInt32Value_msginit; typedef enum { envoy_api_v2_auth_TlsParameters_TLS_AUTO = 0, @@ -73,9 +73,10 @@ typedef enum { UPB_INLINE envoy_api_v2_auth_TlsParameters *envoy_api_v2_auth_TlsParameters_new(upb_arena *arena) { return (envoy_api_v2_auth_TlsParameters *)upb_msg_new(&envoy_api_v2_auth_TlsParameters_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_TlsParameters *envoy_api_v2_auth_TlsParameters_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_TlsParameters *envoy_api_v2_auth_TlsParameters_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_TlsParameters *ret = envoy_api_v2_auth_TlsParameters_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_TlsParameters_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_TlsParameters_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_TlsParameters_serialize(const envoy_api_v2_auth_TlsParameters *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_TlsParameters_msginit, arena, len); @@ -113,15 +114,15 @@ UPB_INLINE bool envoy_api_v2_auth_TlsParameters_add_ecdh_curves(envoy_api_v2_aut msg, UPB_SIZE(20, 24), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } - /* envoy.api.v2.auth.TlsCertificate */ UPB_INLINE envoy_api_v2_auth_TlsCertificate *envoy_api_v2_auth_TlsCertificate_new(upb_arena *arena) { return (envoy_api_v2_auth_TlsCertificate *)upb_msg_new(&envoy_api_v2_auth_TlsCertificate_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_TlsCertificate *envoy_api_v2_auth_TlsCertificate_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_TlsCertificate *envoy_api_v2_auth_TlsCertificate_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_TlsCertificate *ret = envoy_api_v2_auth_TlsCertificate_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_TlsCertificate_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_TlsCertificate_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_TlsCertificate_serialize(const envoy_api_v2_auth_TlsCertificate *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_TlsCertificate_msginit, arena, len); @@ -195,15 +196,15 @@ UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsCertificate return sub; } - /* envoy.api.v2.auth.TlsSessionTicketKeys */ UPB_INLINE envoy_api_v2_auth_TlsSessionTicketKeys *envoy_api_v2_auth_TlsSessionTicketKeys_new(upb_arena *arena) { return (envoy_api_v2_auth_TlsSessionTicketKeys *)upb_msg_new(&envoy_api_v2_auth_TlsSessionTicketKeys_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_TlsSessionTicketKeys *envoy_api_v2_auth_TlsSessionTicketKeys_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_TlsSessionTicketKeys *envoy_api_v2_auth_TlsSessionTicketKeys_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_TlsSessionTicketKeys *ret = envoy_api_v2_auth_TlsSessionTicketKeys_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_TlsSessionTicketKeys_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_TlsSessionTicketKeys_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_TlsSessionTicketKeys_serialize(const envoy_api_v2_auth_TlsSessionTicketKeys *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_TlsSessionTicketKeys_msginit, arena, len); @@ -225,15 +226,15 @@ UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_auth_TlsSessionTick return sub; } - /* envoy.api.v2.auth.CertificateValidationContext */ UPB_INLINE envoy_api_v2_auth_CertificateValidationContext *envoy_api_v2_auth_CertificateValidationContext_new(upb_arena *arena) { return (envoy_api_v2_auth_CertificateValidationContext *)upb_msg_new(&envoy_api_v2_auth_CertificateValidationContext_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_CertificateValidationContext *envoy_api_v2_auth_CertificateValidationContext_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_CertificateValidationContext *envoy_api_v2_auth_CertificateValidationContext_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_CertificateValidationContext *ret = envoy_api_v2_auth_CertificateValidationContext_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_CertificateValidationContext_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_CertificateValidationContext_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_CertificateValidationContext_serialize(const envoy_api_v2_auth_CertificateValidationContext *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_CertificateValidationContext_msginit, arena, len); @@ -330,15 +331,15 @@ UPB_INLINE void envoy_api_v2_auth_CertificateValidationContext_set_allow_expired UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; } - /* envoy.api.v2.auth.CommonTlsContext */ UPB_INLINE envoy_api_v2_auth_CommonTlsContext *envoy_api_v2_auth_CommonTlsContext_new(upb_arena *arena) { return (envoy_api_v2_auth_CommonTlsContext *)upb_msg_new(&envoy_api_v2_auth_CommonTlsContext_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_CommonTlsContext *envoy_api_v2_auth_CommonTlsContext_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_CommonTlsContext *envoy_api_v2_auth_CommonTlsContext_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_CommonTlsContext *ret = envoy_api_v2_auth_CommonTlsContext_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_CommonTlsContext_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_CommonTlsContext_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_CommonTlsContext_serialize(const envoy_api_v2_auth_CommonTlsContext *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_CommonTlsContext_msginit, arena, len); @@ -348,9 +349,9 @@ typedef enum { envoy_api_v2_auth_CommonTlsContext_validation_context_type_validation_context = 3, envoy_api_v2_auth_CommonTlsContext_validation_context_type_validation_context_sds_secret_config = 7, envoy_api_v2_auth_CommonTlsContext_validation_context_type_combined_validation_context = 8, - envoy_api_v2_auth_CommonTlsContext_validation_context_type_NOT_SET = 0, + envoy_api_v2_auth_CommonTlsContext_validation_context_type_NOT_SET = 0 } envoy_api_v2_auth_CommonTlsContext_validation_context_type_oneofcases; -UPB_INLINE envoy_api_v2_auth_CommonTlsContext_validation_context_type_oneofcases envoy_api_v2_auth_CommonTlsContext_validation_context_type_case(const envoy_api_v2_auth_CommonTlsContext* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(20, 40)); } +UPB_INLINE envoy_api_v2_auth_CommonTlsContext_validation_context_type_oneofcases envoy_api_v2_auth_CommonTlsContext_validation_context_type_case(const envoy_api_v2_auth_CommonTlsContext* msg) { return (envoy_api_v2_auth_CommonTlsContext_validation_context_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(20, 40)); } UPB_INLINE const envoy_api_v2_auth_TlsParameters* envoy_api_v2_auth_CommonTlsContext_tls_params(const envoy_api_v2_auth_CommonTlsContext *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_auth_TlsParameters*, UPB_SIZE(0, 0)); } UPB_INLINE const envoy_api_v2_auth_TlsCertificate* const* envoy_api_v2_auth_CommonTlsContext_tls_certificates(const envoy_api_v2_auth_CommonTlsContext *msg, size_t *len) { return (const envoy_api_v2_auth_TlsCertificate* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } @@ -448,15 +449,15 @@ UPB_INLINE struct envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidati return sub; } - /* envoy.api.v2.auth.CommonTlsContext.CombinedCertificateValidationContext */ UPB_INLINE envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_new(upb_arena *arena) { return (envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *)upb_msg_new(&envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *ret = envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_serialize(const envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_CommonTlsContext_CombinedCertificateValidationContext_msginit, arena, len); @@ -490,15 +491,15 @@ UPB_INLINE struct envoy_api_v2_auth_SdsSecretConfig* envoy_api_v2_auth_CommonTls return sub; } - /* envoy.api.v2.auth.UpstreamTlsContext */ UPB_INLINE envoy_api_v2_auth_UpstreamTlsContext *envoy_api_v2_auth_UpstreamTlsContext_new(upb_arena *arena) { return (envoy_api_v2_auth_UpstreamTlsContext *)upb_msg_new(&envoy_api_v2_auth_UpstreamTlsContext_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_UpstreamTlsContext *envoy_api_v2_auth_UpstreamTlsContext_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_UpstreamTlsContext *envoy_api_v2_auth_UpstreamTlsContext_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_UpstreamTlsContext *ret = envoy_api_v2_auth_UpstreamTlsContext_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_UpstreamTlsContext_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_UpstreamTlsContext_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_UpstreamTlsContext_serialize(const envoy_api_v2_auth_UpstreamTlsContext *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_UpstreamTlsContext_msginit, arena, len); @@ -507,6 +508,7 @@ UPB_INLINE char *envoy_api_v2_auth_UpstreamTlsContext_serialize(const envoy_api_ UPB_INLINE const envoy_api_v2_auth_CommonTlsContext* envoy_api_v2_auth_UpstreamTlsContext_common_tls_context(const envoy_api_v2_auth_UpstreamTlsContext *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_auth_CommonTlsContext*, UPB_SIZE(12, 24)); } UPB_INLINE upb_strview envoy_api_v2_auth_UpstreamTlsContext_sni(const envoy_api_v2_auth_UpstreamTlsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } UPB_INLINE bool envoy_api_v2_auth_UpstreamTlsContext_allow_renegotiation(const envoy_api_v2_auth_UpstreamTlsContext *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_auth_UpstreamTlsContext_max_session_keys(const envoy_api_v2_auth_UpstreamTlsContext *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); } UPB_INLINE void envoy_api_v2_auth_UpstreamTlsContext_set_common_tls_context(envoy_api_v2_auth_UpstreamTlsContext *msg, envoy_api_v2_auth_CommonTlsContext* value) { UPB_FIELD_AT(msg, envoy_api_v2_auth_CommonTlsContext*, UPB_SIZE(12, 24)) = value; @@ -526,16 +528,28 @@ UPB_INLINE void envoy_api_v2_auth_UpstreamTlsContext_set_sni(envoy_api_v2_auth_U UPB_INLINE void envoy_api_v2_auth_UpstreamTlsContext_set_allow_renegotiation(envoy_api_v2_auth_UpstreamTlsContext *msg, bool value) { UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; } - +UPB_INLINE void envoy_api_v2_auth_UpstreamTlsContext_set_max_session_keys(envoy_api_v2_auth_UpstreamTlsContext *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_auth_UpstreamTlsContext_mutable_max_session_keys(envoy_api_v2_auth_UpstreamTlsContext *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_auth_UpstreamTlsContext_max_session_keys(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_auth_UpstreamTlsContext_set_max_session_keys(msg, sub); + } + return sub; +} /* envoy.api.v2.auth.DownstreamTlsContext */ UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext *envoy_api_v2_auth_DownstreamTlsContext_new(upb_arena *arena) { return (envoy_api_v2_auth_DownstreamTlsContext *)upb_msg_new(&envoy_api_v2_auth_DownstreamTlsContext_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext *envoy_api_v2_auth_DownstreamTlsContext_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext *envoy_api_v2_auth_DownstreamTlsContext_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_DownstreamTlsContext *ret = envoy_api_v2_auth_DownstreamTlsContext_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_DownstreamTlsContext_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_DownstreamTlsContext_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_DownstreamTlsContext_serialize(const envoy_api_v2_auth_DownstreamTlsContext *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_DownstreamTlsContext_msginit, arena, len); @@ -544,9 +558,9 @@ UPB_INLINE char *envoy_api_v2_auth_DownstreamTlsContext_serialize(const envoy_ap typedef enum { envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_session_ticket_keys = 4, envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_session_ticket_keys_sds_secret_config = 5, - envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_NOT_SET = 0, + envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_NOT_SET = 0 } envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_oneofcases; -UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_oneofcases envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_case(const envoy_api_v2_auth_DownstreamTlsContext* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(16, 32)); } +UPB_INLINE envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_oneofcases envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_case(const envoy_api_v2_auth_DownstreamTlsContext* msg) { return (envoy_api_v2_auth_DownstreamTlsContext_session_ticket_keys_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 32)); } UPB_INLINE const envoy_api_v2_auth_CommonTlsContext* envoy_api_v2_auth_DownstreamTlsContext_common_tls_context(const envoy_api_v2_auth_DownstreamTlsContext *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_auth_CommonTlsContext*, UPB_SIZE(0, 0)); } UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_auth_DownstreamTlsContext_require_client_certificate(const envoy_api_v2_auth_DownstreamTlsContext *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(4, 8)); } @@ -617,15 +631,15 @@ UPB_INLINE struct envoy_api_v2_auth_SdsSecretConfig* envoy_api_v2_auth_Downstrea return sub; } - /* envoy.api.v2.auth.SdsSecretConfig */ UPB_INLINE envoy_api_v2_auth_SdsSecretConfig *envoy_api_v2_auth_SdsSecretConfig_new(upb_arena *arena) { return (envoy_api_v2_auth_SdsSecretConfig *)upb_msg_new(&envoy_api_v2_auth_SdsSecretConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_SdsSecretConfig *envoy_api_v2_auth_SdsSecretConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_SdsSecretConfig *envoy_api_v2_auth_SdsSecretConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_SdsSecretConfig *ret = envoy_api_v2_auth_SdsSecretConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_SdsSecretConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_SdsSecretConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_SdsSecretConfig_serialize(const envoy_api_v2_auth_SdsSecretConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_SdsSecretConfig_msginit, arena, len); @@ -650,15 +664,15 @@ UPB_INLINE struct envoy_api_v2_core_ConfigSource* envoy_api_v2_auth_SdsSecretCon return sub; } - /* envoy.api.v2.auth.Secret */ UPB_INLINE envoy_api_v2_auth_Secret *envoy_api_v2_auth_Secret_new(upb_arena *arena) { return (envoy_api_v2_auth_Secret *)upb_msg_new(&envoy_api_v2_auth_Secret_msginit, arena); } -UPB_INLINE envoy_api_v2_auth_Secret *envoy_api_v2_auth_Secret_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_auth_Secret *envoy_api_v2_auth_Secret_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_auth_Secret *ret = envoy_api_v2_auth_Secret_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_auth_Secret_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_auth_Secret_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_auth_Secret_serialize(const envoy_api_v2_auth_Secret *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_auth_Secret_msginit, arena, len); @@ -668,9 +682,9 @@ typedef enum { envoy_api_v2_auth_Secret_type_tls_certificate = 2, envoy_api_v2_auth_Secret_type_session_ticket_keys = 3, envoy_api_v2_auth_Secret_type_validation_context = 4, - envoy_api_v2_auth_Secret_type_NOT_SET = 0, + envoy_api_v2_auth_Secret_type_NOT_SET = 0 } envoy_api_v2_auth_Secret_type_oneofcases; -UPB_INLINE envoy_api_v2_auth_Secret_type_oneofcases envoy_api_v2_auth_Secret_type_case(const envoy_api_v2_auth_Secret* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); } +UPB_INLINE envoy_api_v2_auth_Secret_type_oneofcases envoy_api_v2_auth_Secret_type_case(const envoy_api_v2_auth_Secret* msg) { return (envoy_api_v2_auth_Secret_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); } UPB_INLINE upb_strview envoy_api_v2_auth_Secret_name(const envoy_api_v2_auth_Secret *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } UPB_INLINE bool envoy_api_v2_auth_Secret_has_tls_certificate(const envoy_api_v2_auth_Secret *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); } @@ -720,7 +734,6 @@ UPB_INLINE struct envoy_api_v2_auth_CertificateValidationContext* envoy_api_v2_a return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c b/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c index 91a25cd220b..f5a7b9195e1 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c @@ -30,11 +30,13 @@ #include "upb/port_def.inc" -static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[26] = { +static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[28] = { &envoy_api_v2_Cluster_CommonLbConfig_msginit, + &envoy_api_v2_Cluster_CustomClusterType_msginit, &envoy_api_v2_Cluster_EdsClusterConfig_msginit, &envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, &envoy_api_v2_Cluster_LbSubsetConfig_msginit, + &envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, &envoy_api_v2_Cluster_OriginalDstLbConfig_msginit, &envoy_api_v2_Cluster_RingHashLbConfig_msginit, &envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, @@ -55,47 +57,64 @@ static const upb_msglayout *const envoy_api_v2_Cluster_submsgs[26] = { &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_Cluster__fields[34] = { - {1, UPB_SIZE(36, 40), 0, 0, 9, 1}, - {2, UPB_SIZE(0, 0), 0, 0, 14, 1}, - {3, UPB_SIZE(52, 72), 0, 1, 11, 1}, - {4, UPB_SIZE(56, 80), 0, 20, 11, 1}, - {5, UPB_SIZE(60, 88), 0, 21, 11, 1}, - {6, UPB_SIZE(8, 8), 0, 0, 14, 1}, - {7, UPB_SIZE(128, 224), 0, 12, 11, 3}, - {8, UPB_SIZE(132, 232), 0, 14, 11, 3}, - {9, UPB_SIZE(64, 96), 0, 21, 11, 1}, - {10, UPB_SIZE(68, 104), 0, 10, 11, 1}, - {11, UPB_SIZE(72, 112), 0, 9, 11, 1}, - {13, UPB_SIZE(76, 120), 0, 15, 11, 1}, - {14, UPB_SIZE(80, 128), 0, 16, 11, 1}, - {16, UPB_SIZE(84, 136), 0, 20, 11, 1}, - {17, UPB_SIZE(16, 16), 0, 0, 14, 1}, - {18, UPB_SIZE(136, 240), 0, 12, 11, 3}, - {19, UPB_SIZE(88, 144), 0, 11, 11, 1}, - {20, UPB_SIZE(92, 152), 0, 20, 11, 1}, - {21, UPB_SIZE(96, 160), 0, 13, 11, 1}, - {22, UPB_SIZE(100, 168), 0, 3, 11, 1}, - {23, UPB_SIZE(148, 264), UPB_SIZE(-153, -273), 5, 11, 1}, - {24, UPB_SIZE(104, 176), 0, 19, 11, 1}, - {25, UPB_SIZE(108, 184), 0, 18, 11, 1}, - {26, UPB_SIZE(24, 24), 0, 0, 14, 1}, - {27, UPB_SIZE(112, 192), 0, 0, 11, 1}, - {28, UPB_SIZE(44, 56), 0, 0, 9, 1}, - {29, UPB_SIZE(116, 200), 0, 17, 11, 1}, - {30, UPB_SIZE(120, 208), 0, 8, 11, 1}, - {31, UPB_SIZE(32, 32), 0, 0, 8, 1}, - {32, UPB_SIZE(33, 33), 0, 0, 8, 1}, - {33, UPB_SIZE(124, 216), 0, 7, 11, 1}, - {34, UPB_SIZE(148, 264), UPB_SIZE(-153, -273), 4, 11, 1}, - {35, UPB_SIZE(140, 248), 0, 2, 11, 3}, - {36, UPB_SIZE(144, 256), 0, 6, 11, 3}, +static const upb_msglayout_field envoy_api_v2_Cluster__fields[36] = { + {1, UPB_SIZE(28, 32), 0, 0, 9, 1}, + {2, UPB_SIZE(144, 256), UPB_SIZE(-153, -265), 0, 14, 1}, + {3, UPB_SIZE(44, 64), 0, 2, 11, 1}, + {4, UPB_SIZE(48, 72), 0, 22, 11, 1}, + {5, UPB_SIZE(52, 80), 0, 23, 11, 1}, + {6, UPB_SIZE(0, 0), 0, 0, 14, 1}, + {7, UPB_SIZE(120, 216), 0, 14, 11, 3}, + {8, UPB_SIZE(124, 224), 0, 16, 11, 3}, + {9, UPB_SIZE(56, 88), 0, 23, 11, 1}, + {10, UPB_SIZE(60, 96), 0, 12, 11, 1}, + {11, UPB_SIZE(64, 104), 0, 11, 11, 1}, + {13, UPB_SIZE(68, 112), 0, 17, 11, 1}, + {14, UPB_SIZE(72, 120), 0, 18, 11, 1}, + {16, UPB_SIZE(76, 128), 0, 22, 11, 1}, + {17, UPB_SIZE(8, 8), 0, 0, 14, 1}, + {18, UPB_SIZE(128, 232), 0, 14, 11, 3}, + {19, UPB_SIZE(80, 136), 0, 13, 11, 1}, + {20, UPB_SIZE(84, 144), 0, 22, 11, 1}, + {21, UPB_SIZE(88, 152), 0, 15, 11, 1}, + {22, UPB_SIZE(92, 160), 0, 4, 11, 1}, + {23, UPB_SIZE(156, 272), UPB_SIZE(-161, -281), 7, 11, 1}, + {24, UPB_SIZE(96, 168), 0, 21, 11, 1}, + {25, UPB_SIZE(100, 176), 0, 20, 11, 1}, + {26, UPB_SIZE(16, 16), 0, 0, 14, 1}, + {27, UPB_SIZE(104, 184), 0, 0, 11, 1}, + {28, UPB_SIZE(36, 48), 0, 0, 9, 1}, + {29, UPB_SIZE(108, 192), 0, 19, 11, 1}, + {30, UPB_SIZE(112, 200), 0, 10, 11, 1}, + {31, UPB_SIZE(24, 24), 0, 0, 8, 1}, + {32, UPB_SIZE(25, 25), 0, 0, 8, 1}, + {33, UPB_SIZE(116, 208), 0, 9, 11, 1}, + {34, UPB_SIZE(156, 272), UPB_SIZE(-161, -281), 6, 11, 1}, + {35, UPB_SIZE(132, 240), 0, 3, 11, 3}, + {36, UPB_SIZE(136, 248), 0, 8, 11, 3}, + {37, UPB_SIZE(156, 272), UPB_SIZE(-161, -281), 5, 11, 1}, + {38, UPB_SIZE(144, 256), UPB_SIZE(-153, -265), 1, 11, 1}, }; const upb_msglayout envoy_api_v2_Cluster_msginit = { &envoy_api_v2_Cluster_submsgs[0], &envoy_api_v2_Cluster__fields[0], - UPB_SIZE(160, 288), 34, false, + UPB_SIZE(168, 288), 36, false, +}; + +static const upb_msglayout *const envoy_api_v2_Cluster_CustomClusterType_submsgs[1] = { + &google_protobuf_Any_msginit, +}; + +static const upb_msglayout_field envoy_api_v2_Cluster_CustomClusterType__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 16), 0, 0, 11, 1}, +}; + +const upb_msglayout envoy_api_v2_Cluster_CustomClusterType_msginit = { + &envoy_api_v2_Cluster_CustomClusterType_submsgs[0], + &envoy_api_v2_Cluster_CustomClusterType__fields[0], + UPB_SIZE(16, 32), 2, false, }; static const upb_msglayout *const envoy_api_v2_Cluster_EdsClusterConfig_submsgs[1] = { @@ -148,17 +167,19 @@ static const upb_msglayout *const envoy_api_v2_Cluster_LbSubsetConfig_submsgs[2] &google_protobuf_Struct_msginit, }; -static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig__fields[4] = { +static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig__fields[6] = { {1, UPB_SIZE(0, 0), 0, 0, 14, 1}, {2, UPB_SIZE(12, 16), 0, 1, 11, 1}, {3, UPB_SIZE(16, 24), 0, 0, 11, 3}, {4, UPB_SIZE(8, 8), 0, 0, 8, 1}, + {5, UPB_SIZE(9, 9), 0, 0, 8, 1}, + {6, UPB_SIZE(10, 10), 0, 0, 8, 1}, }; const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_msginit = { &envoy_api_v2_Cluster_LbSubsetConfig_submsgs[0], &envoy_api_v2_Cluster_LbSubsetConfig__fields[0], - UPB_SIZE(24, 32), 4, false, + UPB_SIZE(24, 32), 6, false, }; static const upb_msglayout_field envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector__fields[1] = { @@ -171,34 +192,34 @@ const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit UPB_SIZE(4, 8), 1, false, }; -static const upb_msglayout *const envoy_api_v2_Cluster_RingHashLbConfig_submsgs[2] = { - &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit, - &google_protobuf_UInt64Value_msginit, +static const upb_msglayout *const envoy_api_v2_Cluster_LeastRequestLbConfig_submsgs[1] = { + &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_Cluster_RingHashLbConfig__fields[2] = { - {1, UPB_SIZE(0, 0), 0, 1, 11, 1}, - {2, UPB_SIZE(4, 8), 0, 0, 11, 1}, +static const upb_msglayout_field envoy_api_v2_Cluster_LeastRequestLbConfig__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 11, 1}, }; -const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_msginit = { - &envoy_api_v2_Cluster_RingHashLbConfig_submsgs[0], - &envoy_api_v2_Cluster_RingHashLbConfig__fields[0], - UPB_SIZE(8, 16), 2, false, +const upb_msglayout envoy_api_v2_Cluster_LeastRequestLbConfig_msginit = { + &envoy_api_v2_Cluster_LeastRequestLbConfig_submsgs[0], + &envoy_api_v2_Cluster_LeastRequestLbConfig__fields[0], + UPB_SIZE(4, 8), 1, false, }; -static const upb_msglayout *const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_submsgs[1] = { - &google_protobuf_BoolValue_msginit, +static const upb_msglayout *const envoy_api_v2_Cluster_RingHashLbConfig_submsgs[2] = { + &google_protobuf_UInt64Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1__fields[1] = { - {1, UPB_SIZE(0, 0), 0, 0, 11, 1}, +static const upb_msglayout_field envoy_api_v2_Cluster_RingHashLbConfig__fields[3] = { + {1, UPB_SIZE(8, 8), 0, 0, 11, 1}, + {3, UPB_SIZE(0, 0), 0, 0, 14, 1}, + {4, UPB_SIZE(12, 16), 0, 0, 11, 1}, }; -const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit = { - &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_submsgs[0], - &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1__fields[0], - UPB_SIZE(4, 8), 1, false, +const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_msginit = { + &envoy_api_v2_Cluster_RingHashLbConfig_submsgs[0], + &envoy_api_v2_Cluster_RingHashLbConfig__fields[0], + UPB_SIZE(16, 24), 3, false, }; static const upb_msglayout_field envoy_api_v2_Cluster_OriginalDstLbConfig__fields[1] = { @@ -218,17 +239,18 @@ static const upb_msglayout *const envoy_api_v2_Cluster_CommonLbConfig_submsgs[4] &google_protobuf_Duration_msginit, }; -static const upb_msglayout_field envoy_api_v2_Cluster_CommonLbConfig__fields[4] = { - {1, UPB_SIZE(0, 0), 0, 2, 11, 1}, - {2, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 1, 11, 1}, - {3, UPB_SIZE(8, 16), UPB_SIZE(-13, -25), 0, 11, 1}, - {4, UPB_SIZE(4, 8), 0, 3, 11, 1}, +static const upb_msglayout_field envoy_api_v2_Cluster_CommonLbConfig__fields[5] = { + {1, UPB_SIZE(4, 8), 0, 2, 11, 1}, + {2, UPB_SIZE(12, 24), UPB_SIZE(-17, -33), 1, 11, 1}, + {3, UPB_SIZE(12, 24), UPB_SIZE(-17, -33), 0, 11, 1}, + {4, UPB_SIZE(8, 16), 0, 3, 11, 1}, + {5, UPB_SIZE(0, 0), 0, 0, 8, 1}, }; const upb_msglayout envoy_api_v2_Cluster_CommonLbConfig_msginit = { &envoy_api_v2_Cluster_CommonLbConfig_submsgs[0], &envoy_api_v2_Cluster_CommonLbConfig__fields[0], - UPB_SIZE(16, 32), 4, false, + UPB_SIZE(20, 40), 5, false, }; static const upb_msglayout *const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_submsgs[2] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h b/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h index e960b82506e..2fecf727bcb 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h @@ -10,24 +10,25 @@ #define ENVOY_API_V2_CDS_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif struct envoy_api_v2_Cluster; +struct envoy_api_v2_Cluster_CustomClusterType; struct envoy_api_v2_Cluster_EdsClusterConfig; struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry; struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry; struct envoy_api_v2_Cluster_LbSubsetConfig; struct envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector; +struct envoy_api_v2_Cluster_LeastRequestLbConfig; struct envoy_api_v2_Cluster_RingHashLbConfig; -struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1; struct envoy_api_v2_Cluster_OriginalDstLbConfig; struct envoy_api_v2_Cluster_CommonLbConfig; struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig; @@ -35,13 +36,14 @@ struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig; struct envoy_api_v2_UpstreamBindConfig; struct envoy_api_v2_UpstreamConnectionOptions; typedef struct envoy_api_v2_Cluster envoy_api_v2_Cluster; +typedef struct envoy_api_v2_Cluster_CustomClusterType envoy_api_v2_Cluster_CustomClusterType; typedef struct envoy_api_v2_Cluster_EdsClusterConfig envoy_api_v2_Cluster_EdsClusterConfig; typedef struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry; typedef struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry; typedef struct envoy_api_v2_Cluster_LbSubsetConfig envoy_api_v2_Cluster_LbSubsetConfig; typedef struct envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector; +typedef struct envoy_api_v2_Cluster_LeastRequestLbConfig envoy_api_v2_Cluster_LeastRequestLbConfig; typedef struct envoy_api_v2_Cluster_RingHashLbConfig envoy_api_v2_Cluster_RingHashLbConfig; -typedef struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1; typedef struct envoy_api_v2_Cluster_OriginalDstLbConfig envoy_api_v2_Cluster_OriginalDstLbConfig; typedef struct envoy_api_v2_Cluster_CommonLbConfig envoy_api_v2_Cluster_CommonLbConfig; typedef struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig; @@ -49,13 +51,14 @@ typedef struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig envo typedef struct envoy_api_v2_UpstreamBindConfig envoy_api_v2_UpstreamBindConfig; typedef struct envoy_api_v2_UpstreamConnectionOptions envoy_api_v2_UpstreamConnectionOptions; extern const upb_msglayout envoy_api_v2_Cluster_msginit; +extern const upb_msglayout envoy_api_v2_Cluster_CustomClusterType_msginit; extern const upb_msglayout envoy_api_v2_Cluster_EdsClusterConfig_msginit; extern const upb_msglayout envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit; extern const upb_msglayout envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit; extern const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_msginit; extern const upb_msglayout envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit; +extern const upb_msglayout envoy_api_v2_Cluster_LeastRequestLbConfig_msginit; extern const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_msginit; -extern const upb_msglayout envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit; extern const upb_msglayout envoy_api_v2_Cluster_OriginalDstLbConfig_msginit; extern const upb_msglayout envoy_api_v2_Cluster_CommonLbConfig_msginit; extern const upb_msglayout envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit; @@ -78,7 +81,6 @@ struct envoy_api_v2_core_TcpKeepalive; struct envoy_api_v2_core_TransportSocket; struct envoy_type_Percent; struct google_protobuf_Any; -struct google_protobuf_BoolValue; struct google_protobuf_Duration; struct google_protobuf_Struct; struct google_protobuf_UInt32Value; @@ -99,14 +101,11 @@ extern const upb_msglayout envoy_api_v2_core_TcpKeepalive_msginit; extern const upb_msglayout envoy_api_v2_core_TransportSocket_msginit; extern const upb_msglayout envoy_type_Percent_msginit; extern const upb_msglayout google_protobuf_Any_msginit; -extern const upb_msglayout google_protobuf_BoolValue_msginit; extern const upb_msglayout google_protobuf_Duration_msginit; extern const upb_msglayout google_protobuf_Struct_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; extern const upb_msglayout google_protobuf_UInt64Value_msginit; -/* Enums */ - typedef enum { envoy_api_v2_Cluster_USE_CONFIGURED_PROTOCOL = 0, envoy_api_v2_Cluster_USE_DOWNSTREAM_PROTOCOL = 1 @@ -132,7 +131,8 @@ typedef enum { envoy_api_v2_Cluster_RING_HASH = 2, envoy_api_v2_Cluster_RANDOM = 3, envoy_api_v2_Cluster_ORIGINAL_DST_LB = 4, - envoy_api_v2_Cluster_MAGLEV = 5 + envoy_api_v2_Cluster_MAGLEV = 5, + envoy_api_v2_Cluster_CLUSTER_PROVIDED = 6 } envoy_api_v2_Cluster_LbPolicy; typedef enum { @@ -141,72 +141,91 @@ typedef enum { envoy_api_v2_Cluster_LbSubsetConfig_DEFAULT_SUBSET = 2 } envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetFallbackPolicy; +typedef enum { + envoy_api_v2_Cluster_RingHashLbConfig_XX_HASH = 0, + envoy_api_v2_Cluster_RingHashLbConfig_MURMUR_HASH_2 = 1 +} envoy_api_v2_Cluster_RingHashLbConfig_HashFunction; + /* envoy.api.v2.Cluster */ UPB_INLINE envoy_api_v2_Cluster *envoy_api_v2_Cluster_new(upb_arena *arena) { return (envoy_api_v2_Cluster *)upb_msg_new(&envoy_api_v2_Cluster_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster *envoy_api_v2_Cluster_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster *envoy_api_v2_Cluster_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster *ret = envoy_api_v2_Cluster_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_serialize(const envoy_api_v2_Cluster *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_msginit, arena, len); } +typedef enum { + envoy_api_v2_Cluster_cluster_discovery_type_type = 2, + envoy_api_v2_Cluster_cluster_discovery_type_cluster_type = 38, + envoy_api_v2_Cluster_cluster_discovery_type_NOT_SET = 0 +} envoy_api_v2_Cluster_cluster_discovery_type_oneofcases; +UPB_INLINE envoy_api_v2_Cluster_cluster_discovery_type_oneofcases envoy_api_v2_Cluster_cluster_discovery_type_case(const envoy_api_v2_Cluster* msg) { return (envoy_api_v2_Cluster_cluster_discovery_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(152, 264)); } + typedef enum { envoy_api_v2_Cluster_lb_config_ring_hash_lb_config = 23, envoy_api_v2_Cluster_lb_config_original_dst_lb_config = 34, - envoy_api_v2_Cluster_lb_config_NOT_SET = 0, + envoy_api_v2_Cluster_lb_config_least_request_lb_config = 37, + envoy_api_v2_Cluster_lb_config_NOT_SET = 0 } envoy_api_v2_Cluster_lb_config_oneofcases; -UPB_INLINE envoy_api_v2_Cluster_lb_config_oneofcases envoy_api_v2_Cluster_lb_config_case(const envoy_api_v2_Cluster* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(152, 272)); } - -UPB_INLINE upb_strview envoy_api_v2_Cluster_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 40)); } -UPB_INLINE int32_t envoy_api_v2_Cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } -UPB_INLINE const envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_eds_cluster_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(52, 72)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_connect_timeout(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(56, 80)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_per_connection_buffer_limit_bytes(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(60, 88)); } -UPB_INLINE int32_t envoy_api_v2_Cluster_lb_policy(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } -UPB_INLINE const struct envoy_api_v2_core_Address* const* envoy_api_v2_Cluster_hosts(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_Address* const*)_upb_array_accessor(msg, UPB_SIZE(128, 224), len); } -UPB_INLINE const struct envoy_api_v2_core_HealthCheck* const* envoy_api_v2_Cluster_health_checks(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_HealthCheck* const*)_upb_array_accessor(msg, UPB_SIZE(132, 232), len); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_max_requests_per_connection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(64, 96)); } -UPB_INLINE const struct envoy_api_v2_cluster_CircuitBreakers* envoy_api_v2_Cluster_circuit_breakers(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_cluster_CircuitBreakers*, UPB_SIZE(68, 104)); } -UPB_INLINE const struct envoy_api_v2_auth_UpstreamTlsContext* envoy_api_v2_Cluster_tls_context(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_auth_UpstreamTlsContext*, UPB_SIZE(72, 112)); } -UPB_INLINE const struct envoy_api_v2_core_Http1ProtocolOptions* envoy_api_v2_Cluster_http_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Http1ProtocolOptions*, UPB_SIZE(76, 120)); } -UPB_INLINE const struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_Cluster_http2_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Http2ProtocolOptions*, UPB_SIZE(80, 128)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_dns_refresh_rate(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(84, 136)); } -UPB_INLINE int32_t envoy_api_v2_Cluster_dns_lookup_family(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); } -UPB_INLINE const struct envoy_api_v2_core_Address* const* envoy_api_v2_Cluster_dns_resolvers(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_Address* const*)_upb_array_accessor(msg, UPB_SIZE(136, 240), len); } -UPB_INLINE const struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Cluster_outlier_detection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_cluster_OutlierDetection*, UPB_SIZE(88, 144)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_cleanup_interval(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(92, 152)); } -UPB_INLINE const struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_upstream_bind_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_BindConfig*, UPB_SIZE(96, 160)); } -UPB_INLINE const envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_lb_subset_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(100, 168)); } -UPB_INLINE bool envoy_api_v2_Cluster_has_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 272), 23); } -UPB_INLINE const envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(148, 264), UPB_SIZE(152, 272), 23, NULL); } -UPB_INLINE const struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_transport_socket(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(104, 176)); } -UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_metadata(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(108, 184)); } -UPB_INLINE int32_t envoy_api_v2_Cluster_protocol_selection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)); } -UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig* envoy_api_v2_Cluster_common_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_CommonLbConfig*, UPB_SIZE(112, 192)); } -UPB_INLINE upb_strview envoy_api_v2_Cluster_alt_stat_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 56)); } -UPB_INLINE const struct envoy_api_v2_core_HttpProtocolOptions* envoy_api_v2_Cluster_common_http_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_HttpProtocolOptions*, UPB_SIZE(116, 200)); } -UPB_INLINE const envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_upstream_connection_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_UpstreamConnectionOptions*, UPB_SIZE(120, 208)); } -UPB_INLINE bool envoy_api_v2_Cluster_close_connections_on_host_health_failure(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(32, 32)); } -UPB_INLINE bool envoy_api_v2_Cluster_drain_connections_on_host_removal(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(33, 33)); } -UPB_INLINE const struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_load_assignment(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(124, 216)); } -UPB_INLINE bool envoy_api_v2_Cluster_has_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 272), 34); } -UPB_INLINE const envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(148, 264), UPB_SIZE(152, 272), 34, NULL); } -UPB_INLINE const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(140, 248), len); } -UPB_INLINE const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_typed_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(144, 256), len); } +UPB_INLINE envoy_api_v2_Cluster_lb_config_oneofcases envoy_api_v2_Cluster_lb_config_case(const envoy_api_v2_Cluster* msg) { return (envoy_api_v2_Cluster_lb_config_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(160, 280)); } + +UPB_INLINE upb_strview envoy_api_v2_Cluster_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)); } +UPB_INLINE bool envoy_api_v2_Cluster_has_type(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 264), 2); } +UPB_INLINE int32_t envoy_api_v2_Cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, int32_t, UPB_SIZE(144, 256), UPB_SIZE(152, 264), 2, envoy_api_v2_Cluster_STATIC); } +UPB_INLINE const envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_eds_cluster_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(44, 64)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_connect_timeout(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(48, 72)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_per_connection_buffer_limit_bytes(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(52, 80)); } +UPB_INLINE int32_t envoy_api_v2_Cluster_lb_policy(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } +UPB_INLINE const struct envoy_api_v2_core_Address* const* envoy_api_v2_Cluster_hosts(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_Address* const*)_upb_array_accessor(msg, UPB_SIZE(120, 216), len); } +UPB_INLINE const struct envoy_api_v2_core_HealthCheck* const* envoy_api_v2_Cluster_health_checks(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_HealthCheck* const*)_upb_array_accessor(msg, UPB_SIZE(124, 224), len); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_max_requests_per_connection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(56, 88)); } +UPB_INLINE const struct envoy_api_v2_cluster_CircuitBreakers* envoy_api_v2_Cluster_circuit_breakers(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_cluster_CircuitBreakers*, UPB_SIZE(60, 96)); } +UPB_INLINE const struct envoy_api_v2_auth_UpstreamTlsContext* envoy_api_v2_Cluster_tls_context(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_auth_UpstreamTlsContext*, UPB_SIZE(64, 104)); } +UPB_INLINE const struct envoy_api_v2_core_Http1ProtocolOptions* envoy_api_v2_Cluster_http_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Http1ProtocolOptions*, UPB_SIZE(68, 112)); } +UPB_INLINE const struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_Cluster_http2_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Http2ProtocolOptions*, UPB_SIZE(72, 120)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_dns_refresh_rate(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(76, 128)); } +UPB_INLINE int32_t envoy_api_v2_Cluster_dns_lookup_family(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } +UPB_INLINE const struct envoy_api_v2_core_Address* const* envoy_api_v2_Cluster_dns_resolvers(const envoy_api_v2_Cluster *msg, size_t *len) { return (const struct envoy_api_v2_core_Address* const*)_upb_array_accessor(msg, UPB_SIZE(128, 232), len); } +UPB_INLINE const struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Cluster_outlier_detection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_cluster_OutlierDetection*, UPB_SIZE(80, 136)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_cleanup_interval(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(84, 144)); } +UPB_INLINE const struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_upstream_bind_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_BindConfig*, UPB_SIZE(88, 152)); } +UPB_INLINE const envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_lb_subset_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(92, 160)); } +UPB_INLINE bool envoy_api_v2_Cluster_has_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 280), 23); } +UPB_INLINE const envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_ring_hash_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(156, 272), UPB_SIZE(160, 280), 23, NULL); } +UPB_INLINE const struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_transport_socket(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(96, 168)); } +UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_metadata(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(100, 176)); } +UPB_INLINE int32_t envoy_api_v2_Cluster_protocol_selection(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)); } +UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig* envoy_api_v2_Cluster_common_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_CommonLbConfig*, UPB_SIZE(104, 184)); } +UPB_INLINE upb_strview envoy_api_v2_Cluster_alt_stat_name(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)); } +UPB_INLINE const struct envoy_api_v2_core_HttpProtocolOptions* envoy_api_v2_Cluster_common_http_protocol_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_HttpProtocolOptions*, UPB_SIZE(108, 192)); } +UPB_INLINE const envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_upstream_connection_options(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_UpstreamConnectionOptions*, UPB_SIZE(112, 200)); } +UPB_INLINE bool envoy_api_v2_Cluster_close_connections_on_host_health_failure(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)); } +UPB_INLINE bool envoy_api_v2_Cluster_drain_connections_on_host_removal(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)); } +UPB_INLINE const struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_load_assignment(const envoy_api_v2_Cluster *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(116, 208)); } +UPB_INLINE bool envoy_api_v2_Cluster_has_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 280), 34); } +UPB_INLINE const envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_original_dst_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(156, 272), UPB_SIZE(160, 280), 34, NULL); } +UPB_INLINE const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(132, 240), len); } +UPB_INLINE const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const* envoy_api_v2_Cluster_typed_extension_protocol_options(const envoy_api_v2_Cluster *msg, size_t *len) { return (const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(136, 248), len); } +UPB_INLINE bool envoy_api_v2_Cluster_has_least_request_lb_config(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(160, 280), 37); } +UPB_INLINE const envoy_api_v2_Cluster_LeastRequestLbConfig* envoy_api_v2_Cluster_least_request_lb_config(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_LeastRequestLbConfig*, UPB_SIZE(156, 272), UPB_SIZE(160, 280), 37, NULL); } +UPB_INLINE bool envoy_api_v2_Cluster_has_cluster_type(const envoy_api_v2_Cluster *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(152, 264), 38); } +UPB_INLINE const envoy_api_v2_Cluster_CustomClusterType* envoy_api_v2_Cluster_cluster_type(const envoy_api_v2_Cluster *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CustomClusterType*, UPB_SIZE(144, 256), UPB_SIZE(152, 264), 38, NULL); } UPB_INLINE void envoy_api_v2_Cluster_set_name(envoy_api_v2_Cluster *msg, upb_strview value) { - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 40)) = value; + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(28, 32)) = value; } UPB_INLINE void envoy_api_v2_Cluster_set_type(envoy_api_v2_Cluster *msg, int32_t value) { - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; + UPB_WRITE_ONEOF(msg, int32_t, UPB_SIZE(144, 256), value, UPB_SIZE(152, 264), 2); } UPB_INLINE void envoy_api_v2_Cluster_set_eds_cluster_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_EdsClusterConfig* value) { - UPB_FIELD_AT(msg, envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(52, 72)) = value; + UPB_FIELD_AT(msg, envoy_api_v2_Cluster_EdsClusterConfig*, UPB_SIZE(44, 64)) = value; } UPB_INLINE struct envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_mutable_eds_cluster_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_EdsClusterConfig* sub = (struct envoy_api_v2_Cluster_EdsClusterConfig*)envoy_api_v2_Cluster_eds_cluster_config(msg); @@ -218,7 +237,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_EdsClusterConfig* envoy_api_v2_Cluster_mu return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_connect_timeout(envoy_api_v2_Cluster *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(56, 80)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(48, 72)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_connect_timeout(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_Cluster_connect_timeout(msg); @@ -230,7 +249,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_connect return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_per_connection_buffer_limit_bytes(envoy_api_v2_Cluster *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(60, 88)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(52, 80)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_mutable_per_connection_buffer_limit_bytes(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_Cluster_per_connection_buffer_limit_bytes(msg); @@ -242,36 +261,36 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_mutable_per_ return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_lb_policy(envoy_api_v2_Cluster *msg, int32_t value) { - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; } UPB_INLINE struct envoy_api_v2_core_Address** envoy_api_v2_Cluster_mutable_hosts(envoy_api_v2_Cluster *msg, size_t *len) { - return (struct envoy_api_v2_core_Address**)_upb_array_mutable_accessor(msg, UPB_SIZE(128, 224), len); + return (struct envoy_api_v2_core_Address**)_upb_array_mutable_accessor(msg, UPB_SIZE(120, 216), len); } UPB_INLINE struct envoy_api_v2_core_Address** envoy_api_v2_Cluster_resize_hosts(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) { - return (struct envoy_api_v2_core_Address**)_upb_array_resize_accessor(msg, UPB_SIZE(128, 224), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (struct envoy_api_v2_core_Address**)_upb_array_resize_accessor(msg, UPB_SIZE(120, 216), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_core_Address* envoy_api_v2_Cluster_add_hosts(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_Address* sub = (struct envoy_api_v2_core_Address*)upb_msg_new(&envoy_api_v2_core_Address_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(128, 224), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(120, 216), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } UPB_INLINE struct envoy_api_v2_core_HealthCheck** envoy_api_v2_Cluster_mutable_health_checks(envoy_api_v2_Cluster *msg, size_t *len) { - return (struct envoy_api_v2_core_HealthCheck**)_upb_array_mutable_accessor(msg, UPB_SIZE(132, 232), len); + return (struct envoy_api_v2_core_HealthCheck**)_upb_array_mutable_accessor(msg, UPB_SIZE(124, 224), len); } UPB_INLINE struct envoy_api_v2_core_HealthCheck** envoy_api_v2_Cluster_resize_health_checks(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) { - return (struct envoy_api_v2_core_HealthCheck**)_upb_array_resize_accessor(msg, UPB_SIZE(132, 232), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (struct envoy_api_v2_core_HealthCheck**)_upb_array_resize_accessor(msg, UPB_SIZE(124, 224), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_core_HealthCheck* envoy_api_v2_Cluster_add_health_checks(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_HealthCheck* sub = (struct envoy_api_v2_core_HealthCheck*)upb_msg_new(&envoy_api_v2_core_HealthCheck_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(132, 232), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(124, 224), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_max_requests_per_connection(envoy_api_v2_Cluster *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(64, 96)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(56, 88)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_mutable_max_requests_per_connection(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_Cluster_max_requests_per_connection(msg); @@ -283,7 +302,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_mutable_max_ return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_circuit_breakers(envoy_api_v2_Cluster *msg, struct envoy_api_v2_cluster_CircuitBreakers* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_cluster_CircuitBreakers*, UPB_SIZE(68, 104)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_cluster_CircuitBreakers*, UPB_SIZE(60, 96)) = value; } UPB_INLINE struct envoy_api_v2_cluster_CircuitBreakers* envoy_api_v2_Cluster_mutable_circuit_breakers(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_cluster_CircuitBreakers* sub = (struct envoy_api_v2_cluster_CircuitBreakers*)envoy_api_v2_Cluster_circuit_breakers(msg); @@ -295,7 +314,7 @@ UPB_INLINE struct envoy_api_v2_cluster_CircuitBreakers* envoy_api_v2_Cluster_mut return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_tls_context(envoy_api_v2_Cluster *msg, struct envoy_api_v2_auth_UpstreamTlsContext* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_auth_UpstreamTlsContext*, UPB_SIZE(72, 112)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_auth_UpstreamTlsContext*, UPB_SIZE(64, 104)) = value; } UPB_INLINE struct envoy_api_v2_auth_UpstreamTlsContext* envoy_api_v2_Cluster_mutable_tls_context(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_auth_UpstreamTlsContext* sub = (struct envoy_api_v2_auth_UpstreamTlsContext*)envoy_api_v2_Cluster_tls_context(msg); @@ -307,7 +326,7 @@ UPB_INLINE struct envoy_api_v2_auth_UpstreamTlsContext* envoy_api_v2_Cluster_mut return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_http_protocol_options(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_Http1ProtocolOptions* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_Http1ProtocolOptions*, UPB_SIZE(76, 120)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_Http1ProtocolOptions*, UPB_SIZE(68, 112)) = value; } UPB_INLINE struct envoy_api_v2_core_Http1ProtocolOptions* envoy_api_v2_Cluster_mutable_http_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_Http1ProtocolOptions* sub = (struct envoy_api_v2_core_Http1ProtocolOptions*)envoy_api_v2_Cluster_http_protocol_options(msg); @@ -319,7 +338,7 @@ UPB_INLINE struct envoy_api_v2_core_Http1ProtocolOptions* envoy_api_v2_Cluster_m return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_http2_protocol_options(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_Http2ProtocolOptions* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_Http2ProtocolOptions*, UPB_SIZE(80, 128)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_Http2ProtocolOptions*, UPB_SIZE(72, 120)) = value; } UPB_INLINE struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_Cluster_mutable_http2_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_Http2ProtocolOptions* sub = (struct envoy_api_v2_core_Http2ProtocolOptions*)envoy_api_v2_Cluster_http2_protocol_options(msg); @@ -331,7 +350,7 @@ UPB_INLINE struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_Cluster_m return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_dns_refresh_rate(envoy_api_v2_Cluster *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(84, 136)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(76, 128)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_dns_refresh_rate(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_Cluster_dns_refresh_rate(msg); @@ -343,23 +362,23 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_dns_ref return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_dns_lookup_family(envoy_api_v2_Cluster *msg, int32_t value) { - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value; + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; } UPB_INLINE struct envoy_api_v2_core_Address** envoy_api_v2_Cluster_mutable_dns_resolvers(envoy_api_v2_Cluster *msg, size_t *len) { - return (struct envoy_api_v2_core_Address**)_upb_array_mutable_accessor(msg, UPB_SIZE(136, 240), len); + return (struct envoy_api_v2_core_Address**)_upb_array_mutable_accessor(msg, UPB_SIZE(128, 232), len); } UPB_INLINE struct envoy_api_v2_core_Address** envoy_api_v2_Cluster_resize_dns_resolvers(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) { - return (struct envoy_api_v2_core_Address**)_upb_array_resize_accessor(msg, UPB_SIZE(136, 240), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (struct envoy_api_v2_core_Address**)_upb_array_resize_accessor(msg, UPB_SIZE(128, 232), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_core_Address* envoy_api_v2_Cluster_add_dns_resolvers(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_Address* sub = (struct envoy_api_v2_core_Address*)upb_msg_new(&envoy_api_v2_core_Address_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(136, 240), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(128, 232), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_outlier_detection(envoy_api_v2_Cluster *msg, struct envoy_api_v2_cluster_OutlierDetection* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_cluster_OutlierDetection*, UPB_SIZE(88, 144)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_cluster_OutlierDetection*, UPB_SIZE(80, 136)) = value; } UPB_INLINE struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Cluster_mutable_outlier_detection(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_cluster_OutlierDetection* sub = (struct envoy_api_v2_cluster_OutlierDetection*)envoy_api_v2_Cluster_outlier_detection(msg); @@ -371,7 +390,7 @@ UPB_INLINE struct envoy_api_v2_cluster_OutlierDetection* envoy_api_v2_Cluster_mu return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_cleanup_interval(envoy_api_v2_Cluster *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(92, 152)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(84, 144)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_cleanup_interval(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_Cluster_cleanup_interval(msg); @@ -383,7 +402,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_mutable_cleanup return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_upstream_bind_config(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_BindConfig* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_BindConfig*, UPB_SIZE(96, 160)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_BindConfig*, UPB_SIZE(88, 152)) = value; } UPB_INLINE struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_mutable_upstream_bind_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_BindConfig* sub = (struct envoy_api_v2_core_BindConfig*)envoy_api_v2_Cluster_upstream_bind_config(msg); @@ -395,7 +414,7 @@ UPB_INLINE struct envoy_api_v2_core_BindConfig* envoy_api_v2_Cluster_mutable_ups return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_lb_subset_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_LbSubsetConfig* value) { - UPB_FIELD_AT(msg, envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(100, 168)) = value; + UPB_FIELD_AT(msg, envoy_api_v2_Cluster_LbSubsetConfig*, UPB_SIZE(92, 160)) = value; } UPB_INLINE struct envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_mutable_lb_subset_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_LbSubsetConfig* sub = (struct envoy_api_v2_Cluster_LbSubsetConfig*)envoy_api_v2_Cluster_lb_subset_config(msg); @@ -407,7 +426,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_LbSubsetConfig* envoy_api_v2_Cluster_muta return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_ring_hash_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_RingHashLbConfig* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(148, 264), value, UPB_SIZE(152, 272), 23); + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_RingHashLbConfig*, UPB_SIZE(156, 272), value, UPB_SIZE(160, 280), 23); } UPB_INLINE struct envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_mutable_ring_hash_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_RingHashLbConfig* sub = (struct envoy_api_v2_Cluster_RingHashLbConfig*)envoy_api_v2_Cluster_ring_hash_lb_config(msg); @@ -419,7 +438,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_RingHashLbConfig* envoy_api_v2_Cluster_mu return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_transport_socket(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_TransportSocket* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(104, 176)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_TransportSocket*, UPB_SIZE(96, 168)) = value; } UPB_INLINE struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_mutable_transport_socket(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_TransportSocket* sub = (struct envoy_api_v2_core_TransportSocket*)envoy_api_v2_Cluster_transport_socket(msg); @@ -431,7 +450,7 @@ UPB_INLINE struct envoy_api_v2_core_TransportSocket* envoy_api_v2_Cluster_mutabl return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_metadata(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_Metadata* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_Metadata*, UPB_SIZE(108, 184)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_Metadata*, UPB_SIZE(100, 176)) = value; } UPB_INLINE struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_mutable_metadata(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_Metadata* sub = (struct envoy_api_v2_core_Metadata*)envoy_api_v2_Cluster_metadata(msg); @@ -443,10 +462,10 @@ UPB_INLINE struct envoy_api_v2_core_Metadata* envoy_api_v2_Cluster_mutable_metad return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_protocol_selection(envoy_api_v2_Cluster *msg, int32_t value) { - UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 24)) = value; + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value; } UPB_INLINE void envoy_api_v2_Cluster_set_common_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_CommonLbConfig* value) { - UPB_FIELD_AT(msg, envoy_api_v2_Cluster_CommonLbConfig*, UPB_SIZE(112, 192)) = value; + UPB_FIELD_AT(msg, envoy_api_v2_Cluster_CommonLbConfig*, UPB_SIZE(104, 184)) = value; } UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig* envoy_api_v2_Cluster_mutable_common_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_CommonLbConfig* sub = (struct envoy_api_v2_Cluster_CommonLbConfig*)envoy_api_v2_Cluster_common_lb_config(msg); @@ -458,10 +477,10 @@ UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig* envoy_api_v2_Cluster_muta return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_alt_stat_name(envoy_api_v2_Cluster *msg, upb_strview value) { - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(44, 56)) = value; + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(36, 48)) = value; } UPB_INLINE void envoy_api_v2_Cluster_set_common_http_protocol_options(envoy_api_v2_Cluster *msg, struct envoy_api_v2_core_HttpProtocolOptions* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_HttpProtocolOptions*, UPB_SIZE(116, 200)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_HttpProtocolOptions*, UPB_SIZE(108, 192)) = value; } UPB_INLINE struct envoy_api_v2_core_HttpProtocolOptions* envoy_api_v2_Cluster_mutable_common_http_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_core_HttpProtocolOptions* sub = (struct envoy_api_v2_core_HttpProtocolOptions*)envoy_api_v2_Cluster_common_http_protocol_options(msg); @@ -473,7 +492,7 @@ UPB_INLINE struct envoy_api_v2_core_HttpProtocolOptions* envoy_api_v2_Cluster_mu return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_upstream_connection_options(envoy_api_v2_Cluster *msg, envoy_api_v2_UpstreamConnectionOptions* value) { - UPB_FIELD_AT(msg, envoy_api_v2_UpstreamConnectionOptions*, UPB_SIZE(120, 208)) = value; + UPB_FIELD_AT(msg, envoy_api_v2_UpstreamConnectionOptions*, UPB_SIZE(112, 200)) = value; } UPB_INLINE struct envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_mutable_upstream_connection_options(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_UpstreamConnectionOptions* sub = (struct envoy_api_v2_UpstreamConnectionOptions*)envoy_api_v2_Cluster_upstream_connection_options(msg); @@ -485,13 +504,13 @@ UPB_INLINE struct envoy_api_v2_UpstreamConnectionOptions* envoy_api_v2_Cluster_m return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_close_connections_on_host_health_failure(envoy_api_v2_Cluster *msg, bool value) { - UPB_FIELD_AT(msg, bool, UPB_SIZE(32, 32)) = value; + UPB_FIELD_AT(msg, bool, UPB_SIZE(24, 24)) = value; } UPB_INLINE void envoy_api_v2_Cluster_set_drain_connections_on_host_removal(envoy_api_v2_Cluster *msg, bool value) { - UPB_FIELD_AT(msg, bool, UPB_SIZE(33, 33)) = value; + UPB_FIELD_AT(msg, bool, UPB_SIZE(25, 25)) = value; } UPB_INLINE void envoy_api_v2_Cluster_set_load_assignment(envoy_api_v2_Cluster *msg, struct envoy_api_v2_ClusterLoadAssignment* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(124, 216)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_ClusterLoadAssignment*, UPB_SIZE(116, 208)) = value; } UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_mutable_load_assignment(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_ClusterLoadAssignment* sub = (struct envoy_api_v2_ClusterLoadAssignment*)envoy_api_v2_Cluster_load_assignment(msg); @@ -503,7 +522,7 @@ UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment* envoy_api_v2_Cluster_mutab return sub; } UPB_INLINE void envoy_api_v2_Cluster_set_original_dst_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_OriginalDstLbConfig* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(148, 264), value, UPB_SIZE(152, 272), 34); + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_OriginalDstLbConfig*, UPB_SIZE(156, 272), value, UPB_SIZE(160, 280), 34); } UPB_INLINE struct envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster_mutable_original_dst_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_OriginalDstLbConfig* sub = (struct envoy_api_v2_Cluster_OriginalDstLbConfig*)envoy_api_v2_Cluster_original_dst_lb_config(msg); @@ -515,41 +534,98 @@ UPB_INLINE struct envoy_api_v2_Cluster_OriginalDstLbConfig* envoy_api_v2_Cluster return sub; } UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry** envoy_api_v2_Cluster_mutable_extension_protocol_options(envoy_api_v2_Cluster *msg, size_t *len) { - return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(140, 248), len); + return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(132, 240), len); } UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry** envoy_api_v2_Cluster_resize_extension_protocol_options(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(140, 248), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(132, 240), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* envoy_api_v2_Cluster_add_extension_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry* sub = (struct envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry*)upb_msg_new(&envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(140, 248), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(132, 240), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry** envoy_api_v2_Cluster_mutable_typed_extension_protocol_options(envoy_api_v2_Cluster *msg, size_t *len) { - return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(144, 256), len); + return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(136, 248), len); } UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry** envoy_api_v2_Cluster_resize_typed_extension_protocol_options(envoy_api_v2_Cluster *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(144, 256), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(136, 248), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* envoy_api_v2_Cluster_add_typed_extension_protocol_options(envoy_api_v2_Cluster *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry* sub = (struct envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry*)upb_msg_new(&envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(144, 256), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(136, 248), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } +UPB_INLINE void envoy_api_v2_Cluster_set_least_request_lb_config(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_LeastRequestLbConfig* value) { + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_LeastRequestLbConfig*, UPB_SIZE(156, 272), value, UPB_SIZE(160, 280), 37); +} +UPB_INLINE struct envoy_api_v2_Cluster_LeastRequestLbConfig* envoy_api_v2_Cluster_mutable_least_request_lb_config(envoy_api_v2_Cluster *msg, upb_arena *arena) { + struct envoy_api_v2_Cluster_LeastRequestLbConfig* sub = (struct envoy_api_v2_Cluster_LeastRequestLbConfig*)envoy_api_v2_Cluster_least_request_lb_config(msg); + if (sub == NULL) { + sub = (struct envoy_api_v2_Cluster_LeastRequestLbConfig*)upb_msg_new(&envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_Cluster_set_least_request_lb_config(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_Cluster_set_cluster_type(envoy_api_v2_Cluster *msg, envoy_api_v2_Cluster_CustomClusterType* value) { + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CustomClusterType*, UPB_SIZE(144, 256), value, UPB_SIZE(152, 264), 38); +} +UPB_INLINE struct envoy_api_v2_Cluster_CustomClusterType* envoy_api_v2_Cluster_mutable_cluster_type(envoy_api_v2_Cluster *msg, upb_arena *arena) { + struct envoy_api_v2_Cluster_CustomClusterType* sub = (struct envoy_api_v2_Cluster_CustomClusterType*)envoy_api_v2_Cluster_cluster_type(msg); + if (sub == NULL) { + sub = (struct envoy_api_v2_Cluster_CustomClusterType*)upb_msg_new(&envoy_api_v2_Cluster_CustomClusterType_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_Cluster_set_cluster_type(msg, sub); + } + return sub; +} + +/* envoy.api.v2.Cluster.CustomClusterType */ + +UPB_INLINE envoy_api_v2_Cluster_CustomClusterType *envoy_api_v2_Cluster_CustomClusterType_new(upb_arena *arena) { + return (envoy_api_v2_Cluster_CustomClusterType *)upb_msg_new(&envoy_api_v2_Cluster_CustomClusterType_msginit, arena); +} +UPB_INLINE envoy_api_v2_Cluster_CustomClusterType *envoy_api_v2_Cluster_CustomClusterType_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_Cluster_CustomClusterType *ret = envoy_api_v2_Cluster_CustomClusterType_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_CustomClusterType_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_Cluster_CustomClusterType_serialize(const envoy_api_v2_Cluster_CustomClusterType *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_Cluster_CustomClusterType_msginit, arena, len); +} + +UPB_INLINE upb_strview envoy_api_v2_Cluster_CustomClusterType_name(const envoy_api_v2_Cluster_CustomClusterType *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_Cluster_CustomClusterType_typed_config(const envoy_api_v2_Cluster_CustomClusterType *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16)); } +UPB_INLINE void envoy_api_v2_Cluster_CustomClusterType_set_name(envoy_api_v2_Cluster_CustomClusterType *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void envoy_api_v2_Cluster_CustomClusterType_set_typed_config(envoy_api_v2_Cluster_CustomClusterType *msg, struct google_protobuf_Any* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16)) = value; +} +UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Cluster_CustomClusterType_mutable_typed_config(envoy_api_v2_Cluster_CustomClusterType *msg, upb_arena *arena) { + struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_Cluster_CustomClusterType_typed_config(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_Cluster_CustomClusterType_set_typed_config(msg, sub); + } + return sub; +} /* envoy.api.v2.Cluster.EdsClusterConfig */ UPB_INLINE envoy_api_v2_Cluster_EdsClusterConfig *envoy_api_v2_Cluster_EdsClusterConfig_new(upb_arena *arena) { return (envoy_api_v2_Cluster_EdsClusterConfig *)upb_msg_new(&envoy_api_v2_Cluster_EdsClusterConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_EdsClusterConfig *envoy_api_v2_Cluster_EdsClusterConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_EdsClusterConfig *envoy_api_v2_Cluster_EdsClusterConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_EdsClusterConfig *ret = envoy_api_v2_Cluster_EdsClusterConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_EdsClusterConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_EdsClusterConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_EdsClusterConfig_serialize(const envoy_api_v2_Cluster_EdsClusterConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_EdsClusterConfig_msginit, arena, len); @@ -574,15 +650,15 @@ UPB_INLINE void envoy_api_v2_Cluster_EdsClusterConfig_set_service_name(envoy_api UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } - /* envoy.api.v2.Cluster.ExtensionProtocolOptionsEntry */ UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_new(upb_arena *arena) { return (envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *)upb_msg_new(&envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *ret = envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_serialize(const envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_ExtensionProtocolOptionsEntry_msginit, arena, len); @@ -607,15 +683,15 @@ UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_Cluster_ExtensionProtocol return sub; } - /* envoy.api.v2.Cluster.TypedExtensionProtocolOptionsEntry */ UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_new(upb_arena *arena) { return (envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *)upb_msg_new(&envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *ret = envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_serialize(const envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_TypedExtensionProtocolOptionsEntry_msginit, arena, len); @@ -640,15 +716,15 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Cluster_TypedExtensionProtoc return sub; } - /* envoy.api.v2.Cluster.LbSubsetConfig */ UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig *envoy_api_v2_Cluster_LbSubsetConfig_new(upb_arena *arena) { return (envoy_api_v2_Cluster_LbSubsetConfig *)upb_msg_new(&envoy_api_v2_Cluster_LbSubsetConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig *envoy_api_v2_Cluster_LbSubsetConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig *envoy_api_v2_Cluster_LbSubsetConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_LbSubsetConfig *ret = envoy_api_v2_Cluster_LbSubsetConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_LbSubsetConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_LbSubsetConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_LbSubsetConfig_serialize(const envoy_api_v2_Cluster_LbSubsetConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_LbSubsetConfig_msginit, arena, len); @@ -658,6 +734,8 @@ UPB_INLINE int32_t envoy_api_v2_Cluster_LbSubsetConfig_fallback_policy(const env UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_Cluster_LbSubsetConfig_default_subset(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Struct*, UPB_SIZE(12, 16)); } UPB_INLINE const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector* const* envoy_api_v2_Cluster_LbSubsetConfig_subset_selectors(const envoy_api_v2_Cluster_LbSubsetConfig *msg, size_t *len) { return (const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector* const*)_upb_array_accessor(msg, UPB_SIZE(16, 24), len); } UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_locality_weight_aware(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)); } +UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_scale_locality_weight(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(9, 9)); } +UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_panic_mode_any(const envoy_api_v2_Cluster_LbSubsetConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(10, 10)); } UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_fallback_policy(envoy_api_v2_Cluster_LbSubsetConfig *msg, int32_t value) { UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; @@ -690,16 +768,22 @@ UPB_INLINE struct envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector* envoy_ap UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_locality_weight_aware(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) { UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value; } - +UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_scale_locality_weight(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(9, 9)) = value; +} +UPB_INLINE void envoy_api_v2_Cluster_LbSubsetConfig_set_panic_mode_any(envoy_api_v2_Cluster_LbSubsetConfig *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(10, 10)) = value; +} /* envoy.api.v2.Cluster.LbSubsetConfig.LbSubsetSelector */ UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_new(upb_arena *arena) { return (envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *)upb_msg_new(&envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *ret = envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_serialize(const envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_msginit, arena, len); @@ -718,25 +802,55 @@ UPB_INLINE bool envoy_api_v2_Cluster_LbSubsetConfig_LbSubsetSelector_add_keys(en msg, UPB_SIZE(0, 0), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } +/* envoy.api.v2.Cluster.LeastRequestLbConfig */ + +UPB_INLINE envoy_api_v2_Cluster_LeastRequestLbConfig *envoy_api_v2_Cluster_LeastRequestLbConfig_new(upb_arena *arena) { + return (envoy_api_v2_Cluster_LeastRequestLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, arena); +} +UPB_INLINE envoy_api_v2_Cluster_LeastRequestLbConfig *envoy_api_v2_Cluster_LeastRequestLbConfig_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_Cluster_LeastRequestLbConfig *ret = envoy_api_v2_Cluster_LeastRequestLbConfig_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_Cluster_LeastRequestLbConfig_serialize(const envoy_api_v2_Cluster_LeastRequestLbConfig *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_Cluster_LeastRequestLbConfig_msginit, arena, len); +} + +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_LeastRequestLbConfig_choice_count(const envoy_api_v2_Cluster_LeastRequestLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)); } + +UPB_INLINE void envoy_api_v2_Cluster_LeastRequestLbConfig_set_choice_count(envoy_api_v2_Cluster_LeastRequestLbConfig *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_Cluster_LeastRequestLbConfig_mutable_choice_count(envoy_api_v2_Cluster_LeastRequestLbConfig *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_Cluster_LeastRequestLbConfig_choice_count(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_Cluster_LeastRequestLbConfig_set_choice_count(msg, sub); + } + return sub; +} /* envoy.api.v2.Cluster.RingHashLbConfig */ UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig *envoy_api_v2_Cluster_RingHashLbConfig_new(upb_arena *arena) { return (envoy_api_v2_Cluster_RingHashLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_RingHashLbConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig *envoy_api_v2_Cluster_RingHashLbConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig *envoy_api_v2_Cluster_RingHashLbConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_RingHashLbConfig *ret = envoy_api_v2_Cluster_RingHashLbConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_RingHashLbConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_RingHashLbConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_RingHashLbConfig_serialize(const envoy_api_v2_Cluster_RingHashLbConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_RingHashLbConfig_msginit, arena, len); } -UPB_INLINE const struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_minimum_ring_size(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt64Value*, UPB_SIZE(0, 0)); } -UPB_INLINE const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1* envoy_api_v2_Cluster_RingHashLbConfig_deprecated_v1(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1*, UPB_SIZE(4, 8)); } +UPB_INLINE const struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_minimum_ring_size(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt64Value*, UPB_SIZE(8, 8)); } +UPB_INLINE int32_t envoy_api_v2_Cluster_RingHashLbConfig_hash_function(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } +UPB_INLINE const struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_maximum_ring_size(const envoy_api_v2_Cluster_RingHashLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt64Value*, UPB_SIZE(12, 16)); } UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_set_minimum_ring_size(envoy_api_v2_Cluster_RingHashLbConfig *msg, struct google_protobuf_UInt64Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt64Value*, UPB_SIZE(0, 0)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt64Value*, UPB_SIZE(8, 8)) = value; } UPB_INLINE struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_mutable_minimum_ring_size(envoy_api_v2_Cluster_RingHashLbConfig *msg, upb_arena *arena) { struct google_protobuf_UInt64Value* sub = (struct google_protobuf_UInt64Value*)envoy_api_v2_Cluster_RingHashLbConfig_minimum_ring_size(msg); @@ -747,57 +861,31 @@ UPB_INLINE struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbCo } return sub; } -UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_set_deprecated_v1(envoy_api_v2_Cluster_RingHashLbConfig *msg, envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1* value) { - UPB_FIELD_AT(msg, envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1*, UPB_SIZE(4, 8)) = value; -} -UPB_INLINE struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1* envoy_api_v2_Cluster_RingHashLbConfig_mutable_deprecated_v1(envoy_api_v2_Cluster_RingHashLbConfig *msg, upb_arena *arena) { - struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1* sub = (struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1*)envoy_api_v2_Cluster_RingHashLbConfig_deprecated_v1(msg); - if (sub == NULL) { - sub = (struct envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1*)upb_msg_new(&envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit, arena); - if (!sub) return NULL; - envoy_api_v2_Cluster_RingHashLbConfig_set_deprecated_v1(msg, sub); - } - return sub; -} - - -/* envoy.api.v2.Cluster.RingHashLbConfig.DeprecatedV1 */ - -UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_new(upb_arena *arena) { - return (envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *)upb_msg_new(&envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit, arena); -} -UPB_INLINE envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_parsenew(upb_strview buf, upb_arena *arena) { - envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *ret = envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit)) ? ret : NULL; +UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_set_hash_function(envoy_api_v2_Cluster_RingHashLbConfig *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; } -UPB_INLINE char *envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_serialize(const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_msginit, arena, len); +UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_set_maximum_ring_size(envoy_api_v2_Cluster_RingHashLbConfig *msg, struct google_protobuf_UInt64Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt64Value*, UPB_SIZE(12, 16)) = value; } - -UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_use_std_hash(const envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(0, 0)); } - -UPB_INLINE void envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_set_use_std_hash(envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *msg, struct google_protobuf_BoolValue* value) { - UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(0, 0)) = value; -} -UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_mutable_use_std_hash(envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1 *msg, upb_arena *arena) { - struct google_protobuf_BoolValue* sub = (struct google_protobuf_BoolValue*)envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_use_std_hash(msg); +UPB_INLINE struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_RingHashLbConfig_mutable_maximum_ring_size(envoy_api_v2_Cluster_RingHashLbConfig *msg, upb_arena *arena) { + struct google_protobuf_UInt64Value* sub = (struct google_protobuf_UInt64Value*)envoy_api_v2_Cluster_RingHashLbConfig_maximum_ring_size(msg); if (sub == NULL) { - sub = (struct google_protobuf_BoolValue*)upb_msg_new(&google_protobuf_BoolValue_msginit, arena); + sub = (struct google_protobuf_UInt64Value*)upb_msg_new(&google_protobuf_UInt64Value_msginit, arena); if (!sub) return NULL; - envoy_api_v2_Cluster_RingHashLbConfig_DeprecatedV1_set_use_std_hash(msg, sub); + envoy_api_v2_Cluster_RingHashLbConfig_set_maximum_ring_size(msg, sub); } return sub; } - /* envoy.api.v2.Cluster.OriginalDstLbConfig */ UPB_INLINE envoy_api_v2_Cluster_OriginalDstLbConfig *envoy_api_v2_Cluster_OriginalDstLbConfig_new(upb_arena *arena) { return (envoy_api_v2_Cluster_OriginalDstLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_OriginalDstLbConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_OriginalDstLbConfig *envoy_api_v2_Cluster_OriginalDstLbConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_OriginalDstLbConfig *envoy_api_v2_Cluster_OriginalDstLbConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_OriginalDstLbConfig *ret = envoy_api_v2_Cluster_OriginalDstLbConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_OriginalDstLbConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_OriginalDstLbConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_OriginalDstLbConfig_serialize(const envoy_api_v2_Cluster_OriginalDstLbConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_OriginalDstLbConfig_msginit, arena, len); @@ -809,15 +897,15 @@ UPB_INLINE void envoy_api_v2_Cluster_OriginalDstLbConfig_set_use_http_header(env UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; } - /* envoy.api.v2.Cluster.CommonLbConfig */ UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig *envoy_api_v2_Cluster_CommonLbConfig_new(upb_arena *arena) { return (envoy_api_v2_Cluster_CommonLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_CommonLbConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig *envoy_api_v2_Cluster_CommonLbConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig *envoy_api_v2_Cluster_CommonLbConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_CommonLbConfig *ret = envoy_api_v2_Cluster_CommonLbConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_CommonLbConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_CommonLbConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_serialize(const envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_CommonLbConfig_msginit, arena, len); @@ -826,19 +914,20 @@ UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_serialize(const envoy_api_v typedef enum { envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_zone_aware_lb_config = 2, envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_locality_weighted_lb_config = 3, - envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_NOT_SET = 0, + envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_NOT_SET = 0 } envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_oneofcases; -UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_oneofcases envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_case(const envoy_api_v2_Cluster_CommonLbConfig* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); } +UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_oneofcases envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_case(const envoy_api_v2_Cluster_CommonLbConfig* msg) { return (envoy_api_v2_Cluster_CommonLbConfig_locality_config_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 32)); } -UPB_INLINE const struct envoy_type_Percent* envoy_api_v2_Cluster_CommonLbConfig_healthy_panic_threshold(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct envoy_type_Percent*, UPB_SIZE(0, 0)); } -UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_zone_aware_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); } -UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* envoy_api_v2_Cluster_CommonLbConfig_zone_aware_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 2, NULL); } -UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 3); } -UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* envoy_api_v2_Cluster_CommonLbConfig_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 3, NULL); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_update_merge_window(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(4, 8)); } +UPB_INLINE const struct envoy_type_Percent* envoy_api_v2_Cluster_CommonLbConfig_healthy_panic_threshold(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct envoy_type_Percent*, UPB_SIZE(4, 8)); } +UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_zone_aware_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(16, 32), 2); } +UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* envoy_api_v2_Cluster_CommonLbConfig_zone_aware_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*, UPB_SIZE(12, 24), UPB_SIZE(16, 32), 2, NULL); } +UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_has_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(16, 32), 3); } +UPB_INLINE const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* envoy_api_v2_Cluster_CommonLbConfig_locality_weighted_lb_config(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(12, 24), UPB_SIZE(16, 32), 3, NULL); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_update_merge_window(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); } +UPB_INLINE bool envoy_api_v2_Cluster_CommonLbConfig_ignore_new_hosts_until_first_hc(const envoy_api_v2_Cluster_CommonLbConfig *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_healthy_panic_threshold(envoy_api_v2_Cluster_CommonLbConfig *msg, struct envoy_type_Percent* value) { - UPB_FIELD_AT(msg, struct envoy_type_Percent*, UPB_SIZE(0, 0)) = value; + UPB_FIELD_AT(msg, struct envoy_type_Percent*, UPB_SIZE(4, 8)) = value; } UPB_INLINE struct envoy_type_Percent* envoy_api_v2_Cluster_CommonLbConfig_mutable_healthy_panic_threshold(envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena) { struct envoy_type_Percent* sub = (struct envoy_type_Percent*)envoy_api_v2_Cluster_CommonLbConfig_healthy_panic_threshold(msg); @@ -850,7 +939,7 @@ UPB_INLINE struct envoy_type_Percent* envoy_api_v2_Cluster_CommonLbConfig_mutabl return sub; } UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_zone_aware_lb_config(envoy_api_v2_Cluster_CommonLbConfig *msg, envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 2); + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*, UPB_SIZE(12, 24), value, UPB_SIZE(16, 32), 2); } UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* envoy_api_v2_Cluster_CommonLbConfig_mutable_zone_aware_lb_config(envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* sub = (struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig*)envoy_api_v2_Cluster_CommonLbConfig_zone_aware_lb_config(msg); @@ -862,7 +951,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig* envoy_a return sub; } UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_locality_weighted_lb_config(envoy_api_v2_Cluster_CommonLbConfig *msg, envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(8, 16), value, UPB_SIZE(12, 24), 3); + UPB_WRITE_ONEOF(msg, envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*, UPB_SIZE(12, 24), value, UPB_SIZE(16, 32), 3); } UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* envoy_api_v2_Cluster_CommonLbConfig_mutable_locality_weighted_lb_config(envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena) { struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* sub = (struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig*)envoy_api_v2_Cluster_CommonLbConfig_locality_weighted_lb_config(msg); @@ -874,7 +963,7 @@ UPB_INLINE struct envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig* return sub; } UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_update_merge_window(envoy_api_v2_Cluster_CommonLbConfig *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(4, 8)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_mutable_update_merge_window(envoy_api_v2_Cluster_CommonLbConfig *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_Cluster_CommonLbConfig_update_merge_window(msg); @@ -885,16 +974,19 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_Cluster_CommonLbConfig_ } return sub; } - +UPB_INLINE void envoy_api_v2_Cluster_CommonLbConfig_set_ignore_new_hosts_until_first_hc(envoy_api_v2_Cluster_CommonLbConfig *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; +} /* envoy.api.v2.Cluster.CommonLbConfig.ZoneAwareLbConfig */ UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_new(upb_arena *arena) { return (envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *ret = envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_serialize(const envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_CommonLbConfig_ZoneAwareLbConfig_msginit, arena, len); @@ -928,15 +1020,15 @@ UPB_INLINE struct google_protobuf_UInt64Value* envoy_api_v2_Cluster_CommonLbConf return sub; } - /* envoy.api.v2.Cluster.CommonLbConfig.LocalityWeightedLbConfig */ UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_new(upb_arena *arena) { return (envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *)upb_msg_new(&envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *ret = envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_serialize(const envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_msginit, arena, len); @@ -944,15 +1036,15 @@ UPB_INLINE char *envoy_api_v2_Cluster_CommonLbConfig_LocalityWeightedLbConfig_se - /* envoy.api.v2.UpstreamBindConfig */ UPB_INLINE envoy_api_v2_UpstreamBindConfig *envoy_api_v2_UpstreamBindConfig_new(upb_arena *arena) { return (envoy_api_v2_UpstreamBindConfig *)upb_msg_new(&envoy_api_v2_UpstreamBindConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_UpstreamBindConfig *envoy_api_v2_UpstreamBindConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_UpstreamBindConfig *envoy_api_v2_UpstreamBindConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_UpstreamBindConfig *ret = envoy_api_v2_UpstreamBindConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_UpstreamBindConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_UpstreamBindConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_UpstreamBindConfig_serialize(const envoy_api_v2_UpstreamBindConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_UpstreamBindConfig_msginit, arena, len); @@ -973,15 +1065,15 @@ UPB_INLINE struct envoy_api_v2_core_Address* envoy_api_v2_UpstreamBindConfig_mut return sub; } - /* envoy.api.v2.UpstreamConnectionOptions */ UPB_INLINE envoy_api_v2_UpstreamConnectionOptions *envoy_api_v2_UpstreamConnectionOptions_new(upb_arena *arena) { return (envoy_api_v2_UpstreamConnectionOptions *)upb_msg_new(&envoy_api_v2_UpstreamConnectionOptions_msginit, arena); } -UPB_INLINE envoy_api_v2_UpstreamConnectionOptions *envoy_api_v2_UpstreamConnectionOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_UpstreamConnectionOptions *envoy_api_v2_UpstreamConnectionOptions_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_UpstreamConnectionOptions *ret = envoy_api_v2_UpstreamConnectionOptions_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_UpstreamConnectionOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_UpstreamConnectionOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_UpstreamConnectionOptions_serialize(const envoy_api_v2_UpstreamConnectionOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_UpstreamConnectionOptions_msginit, arena, len); @@ -1002,7 +1094,6 @@ UPB_INLINE struct envoy_api_v2_core_TcpKeepalive* envoy_api_v2_UpstreamConnectio return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c b/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c index d16f2ce2afb..12d8cf5ec3f 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c @@ -29,22 +29,24 @@ const upb_msglayout envoy_api_v2_cluster_CircuitBreakers_msginit = { UPB_SIZE(4, 8), 1, false, }; -static const upb_msglayout *const envoy_api_v2_cluster_CircuitBreakers_Thresholds_submsgs[4] = { +static const upb_msglayout *const envoy_api_v2_cluster_CircuitBreakers_Thresholds_submsgs[5] = { &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_cluster_CircuitBreakers_Thresholds__fields[5] = { +static const upb_msglayout_field envoy_api_v2_cluster_CircuitBreakers_Thresholds__fields[7] = { {1, UPB_SIZE(0, 0), 0, 0, 14, 1}, - {2, UPB_SIZE(8, 8), 0, 0, 11, 1}, - {3, UPB_SIZE(12, 16), 0, 0, 11, 1}, - {4, UPB_SIZE(16, 24), 0, 0, 11, 1}, - {5, UPB_SIZE(20, 32), 0, 0, 11, 1}, + {2, UPB_SIZE(12, 16), 0, 0, 11, 1}, + {3, UPB_SIZE(16, 24), 0, 0, 11, 1}, + {4, UPB_SIZE(20, 32), 0, 0, 11, 1}, + {5, UPB_SIZE(24, 40), 0, 0, 11, 1}, + {6, UPB_SIZE(8, 8), 0, 0, 8, 1}, + {7, UPB_SIZE(28, 48), 0, 0, 11, 1}, }; const upb_msglayout envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit = { &envoy_api_v2_cluster_CircuitBreakers_Thresholds_submsgs[0], &envoy_api_v2_cluster_CircuitBreakers_Thresholds__fields[0], - UPB_SIZE(24, 40), 5, false, + UPB_SIZE(32, 56), 7, false, }; #include "upb/port_undef.inc" diff --git a/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h b/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h index 45fd07230b0..9a1fa088f05 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_CLUSTER_CIRCUIT_BREAKER_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -29,17 +29,16 @@ extern const upb_msglayout envoy_api_v2_cluster_CircuitBreakers_Thresholds_msgin struct google_protobuf_UInt32Value; extern const upb_msglayout google_protobuf_UInt32Value_msginit; -/* Enums */ - /* envoy.api.v2.cluster.CircuitBreakers */ UPB_INLINE envoy_api_v2_cluster_CircuitBreakers *envoy_api_v2_cluster_CircuitBreakers_new(upb_arena *arena) { return (envoy_api_v2_cluster_CircuitBreakers *)upb_msg_new(&envoy_api_v2_cluster_CircuitBreakers_msginit, arena); } -UPB_INLINE envoy_api_v2_cluster_CircuitBreakers *envoy_api_v2_cluster_CircuitBreakers_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_cluster_CircuitBreakers *envoy_api_v2_cluster_CircuitBreakers_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_cluster_CircuitBreakers *ret = envoy_api_v2_cluster_CircuitBreakers_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_cluster_CircuitBreakers_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_cluster_CircuitBreakers_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_cluster_CircuitBreakers_serialize(const envoy_api_v2_cluster_CircuitBreakers *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_cluster_CircuitBreakers_msginit, arena, len); @@ -61,31 +60,33 @@ UPB_INLINE struct envoy_api_v2_cluster_CircuitBreakers_Thresholds* envoy_api_v2_ return sub; } - /* envoy.api.v2.cluster.CircuitBreakers.Thresholds */ UPB_INLINE envoy_api_v2_cluster_CircuitBreakers_Thresholds *envoy_api_v2_cluster_CircuitBreakers_Thresholds_new(upb_arena *arena) { return (envoy_api_v2_cluster_CircuitBreakers_Thresholds *)upb_msg_new(&envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit, arena); } -UPB_INLINE envoy_api_v2_cluster_CircuitBreakers_Thresholds *envoy_api_v2_cluster_CircuitBreakers_Thresholds_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_cluster_CircuitBreakers_Thresholds *envoy_api_v2_cluster_CircuitBreakers_Thresholds_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_cluster_CircuitBreakers_Thresholds *ret = envoy_api_v2_cluster_CircuitBreakers_Thresholds_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_cluster_CircuitBreakers_Thresholds_serialize(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_cluster_CircuitBreakers_Thresholds_msginit, arena, len); } UPB_INLINE int32_t envoy_api_v2_cluster_CircuitBreakers_Thresholds_priority(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connections(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(8, 8)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_pending_requests(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_requests(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_retries(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 32)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connections(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_pending_requests(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_requests(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(20, 32)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_retries(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 40)); } +UPB_INLINE bool envoy_api_v2_cluster_CircuitBreakers_Thresholds_track_remaining(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connection_pools(const envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 48)); } UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_priority(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, int32_t value) { UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; } UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_connections(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(8, 8)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_connections(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connections(msg); @@ -97,7 +98,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreak return sub; } UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_pending_requests(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_pending_requests(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_pending_requests(msg); @@ -109,7 +110,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreak return sub; } UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_requests(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 32)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_requests(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_requests(msg); @@ -121,7 +122,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreak return sub; } UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_retries(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(20, 32)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 40)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_retries(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_retries(msg); @@ -132,7 +133,21 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreak } return sub; } - +UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_track_remaining(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_connection_pools(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 48)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_CircuitBreakers_Thresholds_mutable_max_connection_pools(envoy_api_v2_cluster_CircuitBreakers_Thresholds *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_cluster_CircuitBreakers_Thresholds_max_connection_pools(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_cluster_CircuitBreakers_Thresholds_set_max_connection_pools(msg, sub); + } + return sub; +} #ifdef __cplusplus } /* extern "C" */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h b/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h index 06fa49f6fd7..cb290de1c0e 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_CLUSTER_OUTLIER_DETECTION_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -28,17 +28,16 @@ struct google_protobuf_UInt32Value; extern const upb_msglayout google_protobuf_Duration_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; -/* Enums */ - /* envoy.api.v2.cluster.OutlierDetection */ UPB_INLINE envoy_api_v2_cluster_OutlierDetection *envoy_api_v2_cluster_OutlierDetection_new(upb_arena *arena) { return (envoy_api_v2_cluster_OutlierDetection *)upb_msg_new(&envoy_api_v2_cluster_OutlierDetection_msginit, arena); } -UPB_INLINE envoy_api_v2_cluster_OutlierDetection *envoy_api_v2_cluster_OutlierDetection_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_cluster_OutlierDetection *envoy_api_v2_cluster_OutlierDetection_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_cluster_OutlierDetection *ret = envoy_api_v2_cluster_OutlierDetection_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_cluster_OutlierDetection_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_cluster_OutlierDetection_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_cluster_OutlierDetection_serialize(const envoy_api_v2_cluster_OutlierDetection *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_cluster_OutlierDetection_msginit, arena, len); @@ -189,7 +188,6 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_cluster_OutlierDetec return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h index 8e0f8a28656..ebf172a036a 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_CORE_ADDRESS_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -45,8 +45,6 @@ extern const upb_msglayout envoy_api_v2_core_SocketOption_msginit; extern const upb_msglayout google_protobuf_BoolValue_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; -/* Enums */ - typedef enum { envoy_api_v2_core_SocketAddress_TCP = 0, envoy_api_v2_core_SocketAddress_UDP = 1 @@ -58,9 +56,10 @@ typedef enum { UPB_INLINE envoy_api_v2_core_Pipe *envoy_api_v2_core_Pipe_new(upb_arena *arena) { return (envoy_api_v2_core_Pipe *)upb_msg_new(&envoy_api_v2_core_Pipe_msginit, arena); } -UPB_INLINE envoy_api_v2_core_Pipe *envoy_api_v2_core_Pipe_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_Pipe *envoy_api_v2_core_Pipe_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_Pipe *ret = envoy_api_v2_core_Pipe_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Pipe_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Pipe_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_Pipe_serialize(const envoy_api_v2_core_Pipe *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_Pipe_msginit, arena, len); @@ -72,15 +71,15 @@ UPB_INLINE void envoy_api_v2_core_Pipe_set_path(envoy_api_v2_core_Pipe *msg, upb UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } - /* envoy.api.v2.core.SocketAddress */ UPB_INLINE envoy_api_v2_core_SocketAddress *envoy_api_v2_core_SocketAddress_new(upb_arena *arena) { return (envoy_api_v2_core_SocketAddress *)upb_msg_new(&envoy_api_v2_core_SocketAddress_msginit, arena); } -UPB_INLINE envoy_api_v2_core_SocketAddress *envoy_api_v2_core_SocketAddress_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_SocketAddress *envoy_api_v2_core_SocketAddress_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_SocketAddress *ret = envoy_api_v2_core_SocketAddress_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_SocketAddress_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_SocketAddress_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_SocketAddress_serialize(const envoy_api_v2_core_SocketAddress *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_SocketAddress_msginit, arena, len); @@ -89,9 +88,9 @@ UPB_INLINE char *envoy_api_v2_core_SocketAddress_serialize(const envoy_api_v2_co typedef enum { envoy_api_v2_core_SocketAddress_port_specifier_port_value = 3, envoy_api_v2_core_SocketAddress_port_specifier_named_port = 4, - envoy_api_v2_core_SocketAddress_port_specifier_NOT_SET = 0, + envoy_api_v2_core_SocketAddress_port_specifier_NOT_SET = 0 } envoy_api_v2_core_SocketAddress_port_specifier_oneofcases; -UPB_INLINE envoy_api_v2_core_SocketAddress_port_specifier_oneofcases envoy_api_v2_core_SocketAddress_port_specifier_case(const envoy_api_v2_core_SocketAddress* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(36, 64)); } +UPB_INLINE envoy_api_v2_core_SocketAddress_port_specifier_oneofcases envoy_api_v2_core_SocketAddress_port_specifier_case(const envoy_api_v2_core_SocketAddress* msg) { return (envoy_api_v2_core_SocketAddress_port_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(36, 64)); } UPB_INLINE int32_t envoy_api_v2_core_SocketAddress_protocol(const envoy_api_v2_core_SocketAddress *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } UPB_INLINE upb_strview envoy_api_v2_core_SocketAddress_address(const envoy_api_v2_core_SocketAddress *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); } @@ -121,15 +120,15 @@ UPB_INLINE void envoy_api_v2_core_SocketAddress_set_ipv4_compat(envoy_api_v2_cor UPB_FIELD_AT(msg, bool, UPB_SIZE(8, 8)) = value; } - /* envoy.api.v2.core.TcpKeepalive */ UPB_INLINE envoy_api_v2_core_TcpKeepalive *envoy_api_v2_core_TcpKeepalive_new(upb_arena *arena) { return (envoy_api_v2_core_TcpKeepalive *)upb_msg_new(&envoy_api_v2_core_TcpKeepalive_msginit, arena); } -UPB_INLINE envoy_api_v2_core_TcpKeepalive *envoy_api_v2_core_TcpKeepalive_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_TcpKeepalive *envoy_api_v2_core_TcpKeepalive_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_TcpKeepalive *ret = envoy_api_v2_core_TcpKeepalive_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_TcpKeepalive_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_TcpKeepalive_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_TcpKeepalive_serialize(const envoy_api_v2_core_TcpKeepalive *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_TcpKeepalive_msginit, arena, len); @@ -176,15 +175,15 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_TcpKeepalive_mu return sub; } - /* envoy.api.v2.core.BindConfig */ UPB_INLINE envoy_api_v2_core_BindConfig *envoy_api_v2_core_BindConfig_new(upb_arena *arena) { return (envoy_api_v2_core_BindConfig *)upb_msg_new(&envoy_api_v2_core_BindConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_core_BindConfig *envoy_api_v2_core_BindConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_BindConfig *envoy_api_v2_core_BindConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_BindConfig *ret = envoy_api_v2_core_BindConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_BindConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_BindConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_BindConfig_serialize(const envoy_api_v2_core_BindConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_BindConfig_msginit, arena, len); @@ -232,15 +231,15 @@ UPB_INLINE struct envoy_api_v2_core_SocketOption* envoy_api_v2_core_BindConfig_a return sub; } - /* envoy.api.v2.core.Address */ UPB_INLINE envoy_api_v2_core_Address *envoy_api_v2_core_Address_new(upb_arena *arena) { return (envoy_api_v2_core_Address *)upb_msg_new(&envoy_api_v2_core_Address_msginit, arena); } -UPB_INLINE envoy_api_v2_core_Address *envoy_api_v2_core_Address_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_Address *envoy_api_v2_core_Address_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_Address *ret = envoy_api_v2_core_Address_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Address_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Address_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_Address_serialize(const envoy_api_v2_core_Address *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_Address_msginit, arena, len); @@ -249,9 +248,9 @@ UPB_INLINE char *envoy_api_v2_core_Address_serialize(const envoy_api_v2_core_Add typedef enum { envoy_api_v2_core_Address_address_socket_address = 1, envoy_api_v2_core_Address_address_pipe = 2, - envoy_api_v2_core_Address_address_NOT_SET = 0, + envoy_api_v2_core_Address_address_NOT_SET = 0 } envoy_api_v2_core_Address_address_oneofcases; -UPB_INLINE envoy_api_v2_core_Address_address_oneofcases envoy_api_v2_core_Address_address_case(const envoy_api_v2_core_Address* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(4, 8)); } +UPB_INLINE envoy_api_v2_core_Address_address_oneofcases envoy_api_v2_core_Address_address_case(const envoy_api_v2_core_Address* msg) { return (envoy_api_v2_core_Address_address_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); } UPB_INLINE bool envoy_api_v2_core_Address_has_socket_address(const envoy_api_v2_core_Address *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); } UPB_INLINE const envoy_api_v2_core_SocketAddress* envoy_api_v2_core_Address_socket_address(const envoy_api_v2_core_Address *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_SocketAddress*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); } @@ -283,15 +282,15 @@ UPB_INLINE struct envoy_api_v2_core_Pipe* envoy_api_v2_core_Address_mutable_pipe return sub; } - /* envoy.api.v2.core.CidrRange */ UPB_INLINE envoy_api_v2_core_CidrRange *envoy_api_v2_core_CidrRange_new(upb_arena *arena) { return (envoy_api_v2_core_CidrRange *)upb_msg_new(&envoy_api_v2_core_CidrRange_msginit, arena); } -UPB_INLINE envoy_api_v2_core_CidrRange *envoy_api_v2_core_CidrRange_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_CidrRange *envoy_api_v2_core_CidrRange_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_CidrRange *ret = envoy_api_v2_core_CidrRange_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_CidrRange_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_CidrRange_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_CidrRange_serialize(const envoy_api_v2_core_CidrRange *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_CidrRange_msginit, arena, len); @@ -316,7 +315,6 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_CidrRange_mutab return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c b/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c index 1e5c9190381..725b17d7e31 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c @@ -116,6 +116,20 @@ const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit = { UPB_SIZE(8, 16), 2, false, }; +static const upb_msglayout *const envoy_api_v2_core_HeaderMap_submsgs[1] = { + &envoy_api_v2_core_HeaderValue_msginit, +}; + +static const upb_msglayout_field envoy_api_v2_core_HeaderMap__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, +}; + +const upb_msglayout envoy_api_v2_core_HeaderMap_msginit = { + &envoy_api_v2_core_HeaderMap_submsgs[0], + &envoy_api_v2_core_HeaderMap__fields[0], + UPB_SIZE(4, 8), 1, false, +}; + static const upb_msglayout_field envoy_api_v2_core_DataSource__fields[3] = { {1, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 9, 1}, {2, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 12, 1}, @@ -175,5 +189,15 @@ const upb_msglayout envoy_api_v2_core_RuntimeFractionalPercent_msginit = { UPB_SIZE(16, 32), 2, false, }; +static const upb_msglayout_field envoy_api_v2_core_ControlPlane__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, +}; + +const upb_msglayout envoy_api_v2_core_ControlPlane_msginit = { + NULL, + &envoy_api_v2_core_ControlPlane__fields[0], + UPB_SIZE(8, 16), 1, false, +}; + #include "upb/port_undef.inc" diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h index 41d0dd096ac..58e6e5e3f7b 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_CORE_BASE_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -27,10 +27,12 @@ struct envoy_api_v2_core_Metadata_FilterMetadataEntry; struct envoy_api_v2_core_RuntimeUInt32; struct envoy_api_v2_core_HeaderValue; struct envoy_api_v2_core_HeaderValueOption; +struct envoy_api_v2_core_HeaderMap; struct envoy_api_v2_core_DataSource; struct envoy_api_v2_core_TransportSocket; struct envoy_api_v2_core_SocketOption; struct envoy_api_v2_core_RuntimeFractionalPercent; +struct envoy_api_v2_core_ControlPlane; typedef struct envoy_api_v2_core_Locality envoy_api_v2_core_Locality; typedef struct envoy_api_v2_core_Node envoy_api_v2_core_Node; typedef struct envoy_api_v2_core_Metadata envoy_api_v2_core_Metadata; @@ -38,10 +40,12 @@ typedef struct envoy_api_v2_core_Metadata_FilterMetadataEntry envoy_api_v2_core_ typedef struct envoy_api_v2_core_RuntimeUInt32 envoy_api_v2_core_RuntimeUInt32; typedef struct envoy_api_v2_core_HeaderValue envoy_api_v2_core_HeaderValue; typedef struct envoy_api_v2_core_HeaderValueOption envoy_api_v2_core_HeaderValueOption; +typedef struct envoy_api_v2_core_HeaderMap envoy_api_v2_core_HeaderMap; typedef struct envoy_api_v2_core_DataSource envoy_api_v2_core_DataSource; typedef struct envoy_api_v2_core_TransportSocket envoy_api_v2_core_TransportSocket; typedef struct envoy_api_v2_core_SocketOption envoy_api_v2_core_SocketOption; typedef struct envoy_api_v2_core_RuntimeFractionalPercent envoy_api_v2_core_RuntimeFractionalPercent; +typedef struct envoy_api_v2_core_ControlPlane envoy_api_v2_core_ControlPlane; extern const upb_msglayout envoy_api_v2_core_Locality_msginit; extern const upb_msglayout envoy_api_v2_core_Node_msginit; extern const upb_msglayout envoy_api_v2_core_Metadata_msginit; @@ -49,10 +53,12 @@ extern const upb_msglayout envoy_api_v2_core_Metadata_FilterMetadataEntry_msgini extern const upb_msglayout envoy_api_v2_core_RuntimeUInt32_msginit; extern const upb_msglayout envoy_api_v2_core_HeaderValue_msginit; extern const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit; +extern const upb_msglayout envoy_api_v2_core_HeaderMap_msginit; extern const upb_msglayout envoy_api_v2_core_DataSource_msginit; extern const upb_msglayout envoy_api_v2_core_TransportSocket_msginit; extern const upb_msglayout envoy_api_v2_core_SocketOption_msginit; extern const upb_msglayout envoy_api_v2_core_RuntimeFractionalPercent_msginit; +extern const upb_msglayout envoy_api_v2_core_ControlPlane_msginit; struct envoy_type_FractionalPercent; struct google_protobuf_Any; struct google_protobuf_BoolValue; @@ -62,8 +68,6 @@ extern const upb_msglayout google_protobuf_Any_msginit; extern const upb_msglayout google_protobuf_BoolValue_msginit; extern const upb_msglayout google_protobuf_Struct_msginit; -/* Enums */ - typedef enum { envoy_api_v2_core_METHOD_UNSPECIFIED = 0, envoy_api_v2_core_GET = 1, @@ -73,7 +77,8 @@ typedef enum { envoy_api_v2_core_DELETE = 5, envoy_api_v2_core_CONNECT = 6, envoy_api_v2_core_OPTIONS = 7, - envoy_api_v2_core_TRACE = 8 + envoy_api_v2_core_TRACE = 8, + envoy_api_v2_core_PATCH = 9 } envoy_api_v2_core_RequestMethod; typedef enum { @@ -93,9 +98,10 @@ typedef enum { UPB_INLINE envoy_api_v2_core_Locality *envoy_api_v2_core_Locality_new(upb_arena *arena) { return (envoy_api_v2_core_Locality *)upb_msg_new(&envoy_api_v2_core_Locality_msginit, arena); } -UPB_INLINE envoy_api_v2_core_Locality *envoy_api_v2_core_Locality_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_Locality *envoy_api_v2_core_Locality_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_Locality *ret = envoy_api_v2_core_Locality_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Locality_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Locality_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_Locality_serialize(const envoy_api_v2_core_Locality *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_Locality_msginit, arena, len); @@ -115,15 +121,15 @@ UPB_INLINE void envoy_api_v2_core_Locality_set_sub_zone(envoy_api_v2_core_Locali UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value; } - /* envoy.api.v2.core.Node */ UPB_INLINE envoy_api_v2_core_Node *envoy_api_v2_core_Node_new(upb_arena *arena) { return (envoy_api_v2_core_Node *)upb_msg_new(&envoy_api_v2_core_Node_msginit, arena); } -UPB_INLINE envoy_api_v2_core_Node *envoy_api_v2_core_Node_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_Node *envoy_api_v2_core_Node_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_Node *ret = envoy_api_v2_core_Node_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Node_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Node_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_Node_serialize(const envoy_api_v2_core_Node *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_Node_msginit, arena, len); @@ -169,15 +175,15 @@ UPB_INLINE void envoy_api_v2_core_Node_set_build_version(envoy_api_v2_core_Node UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value; } - /* envoy.api.v2.core.Metadata */ UPB_INLINE envoy_api_v2_core_Metadata *envoy_api_v2_core_Metadata_new(upb_arena *arena) { return (envoy_api_v2_core_Metadata *)upb_msg_new(&envoy_api_v2_core_Metadata_msginit, arena); } -UPB_INLINE envoy_api_v2_core_Metadata *envoy_api_v2_core_Metadata_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_Metadata *envoy_api_v2_core_Metadata_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_Metadata *ret = envoy_api_v2_core_Metadata_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Metadata_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Metadata_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_Metadata_serialize(const envoy_api_v2_core_Metadata *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_Metadata_msginit, arena, len); @@ -199,15 +205,15 @@ UPB_INLINE struct envoy_api_v2_core_Metadata_FilterMetadataEntry* envoy_api_v2_c return sub; } - /* envoy.api.v2.core.Metadata.FilterMetadataEntry */ UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry *envoy_api_v2_core_Metadata_FilterMetadataEntry_new(upb_arena *arena) { return (envoy_api_v2_core_Metadata_FilterMetadataEntry *)upb_msg_new(&envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena); } -UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry *envoy_api_v2_core_Metadata_FilterMetadataEntry_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_Metadata_FilterMetadataEntry *envoy_api_v2_core_Metadata_FilterMetadataEntry_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_Metadata_FilterMetadataEntry *ret = envoy_api_v2_core_Metadata_FilterMetadataEntry_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_Metadata_FilterMetadataEntry_serialize(const envoy_api_v2_core_Metadata_FilterMetadataEntry *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_Metadata_FilterMetadataEntry_msginit, arena, len); @@ -232,15 +238,15 @@ UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_core_Metadata_FilterMetad return sub; } - /* envoy.api.v2.core.RuntimeUInt32 */ UPB_INLINE envoy_api_v2_core_RuntimeUInt32 *envoy_api_v2_core_RuntimeUInt32_new(upb_arena *arena) { return (envoy_api_v2_core_RuntimeUInt32 *)upb_msg_new(&envoy_api_v2_core_RuntimeUInt32_msginit, arena); } -UPB_INLINE envoy_api_v2_core_RuntimeUInt32 *envoy_api_v2_core_RuntimeUInt32_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_RuntimeUInt32 *envoy_api_v2_core_RuntimeUInt32_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_RuntimeUInt32 *ret = envoy_api_v2_core_RuntimeUInt32_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_RuntimeUInt32_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_RuntimeUInt32_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_RuntimeUInt32_serialize(const envoy_api_v2_core_RuntimeUInt32 *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_RuntimeUInt32_msginit, arena, len); @@ -256,15 +262,15 @@ UPB_INLINE void envoy_api_v2_core_RuntimeUInt32_set_runtime_key(envoy_api_v2_cor UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; } - /* envoy.api.v2.core.HeaderValue */ UPB_INLINE envoy_api_v2_core_HeaderValue *envoy_api_v2_core_HeaderValue_new(upb_arena *arena) { return (envoy_api_v2_core_HeaderValue *)upb_msg_new(&envoy_api_v2_core_HeaderValue_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HeaderValue *envoy_api_v2_core_HeaderValue_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HeaderValue *envoy_api_v2_core_HeaderValue_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HeaderValue *ret = envoy_api_v2_core_HeaderValue_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HeaderValue_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HeaderValue_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HeaderValue_serialize(const envoy_api_v2_core_HeaderValue *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HeaderValue_msginit, arena, len); @@ -280,15 +286,15 @@ UPB_INLINE void envoy_api_v2_core_HeaderValue_set_value(envoy_api_v2_core_Header UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; } - /* envoy.api.v2.core.HeaderValueOption */ UPB_INLINE envoy_api_v2_core_HeaderValueOption *envoy_api_v2_core_HeaderValueOption_new(upb_arena *arena) { return (envoy_api_v2_core_HeaderValueOption *)upb_msg_new(&envoy_api_v2_core_HeaderValueOption_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HeaderValueOption *envoy_api_v2_core_HeaderValueOption_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HeaderValueOption *envoy_api_v2_core_HeaderValueOption_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HeaderValueOption *ret = envoy_api_v2_core_HeaderValueOption_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HeaderValueOption_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HeaderValueOption_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HeaderValueOption_serialize(const envoy_api_v2_core_HeaderValueOption *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HeaderValueOption_msginit, arena, len); @@ -322,15 +328,45 @@ UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_HeaderValueOption return sub; } +/* envoy.api.v2.core.HeaderMap */ + +UPB_INLINE envoy_api_v2_core_HeaderMap *envoy_api_v2_core_HeaderMap_new(upb_arena *arena) { + return (envoy_api_v2_core_HeaderMap *)upb_msg_new(&envoy_api_v2_core_HeaderMap_msginit, arena); +} +UPB_INLINE envoy_api_v2_core_HeaderMap *envoy_api_v2_core_HeaderMap_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_core_HeaderMap *ret = envoy_api_v2_core_HeaderMap_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HeaderMap_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_core_HeaderMap_serialize(const envoy_api_v2_core_HeaderMap *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_core_HeaderMap_msginit, arena, len); +} + +UPB_INLINE const envoy_api_v2_core_HeaderValue* const* envoy_api_v2_core_HeaderMap_headers(const envoy_api_v2_core_HeaderMap *msg, size_t *len) { return (const envoy_api_v2_core_HeaderValue* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } + +UPB_INLINE envoy_api_v2_core_HeaderValue** envoy_api_v2_core_HeaderMap_mutable_headers(envoy_api_v2_core_HeaderMap *msg, size_t *len) { + return (envoy_api_v2_core_HeaderValue**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE envoy_api_v2_core_HeaderValue** envoy_api_v2_core_HeaderMap_resize_headers(envoy_api_v2_core_HeaderMap *msg, size_t len, upb_arena *arena) { + return (envoy_api_v2_core_HeaderValue**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct envoy_api_v2_core_HeaderValue* envoy_api_v2_core_HeaderMap_add_headers(envoy_api_v2_core_HeaderMap *msg, upb_arena *arena) { + struct envoy_api_v2_core_HeaderValue* sub = (struct envoy_api_v2_core_HeaderValue*)upb_msg_new(&envoy_api_v2_core_HeaderValue_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} /* envoy.api.v2.core.DataSource */ UPB_INLINE envoy_api_v2_core_DataSource *envoy_api_v2_core_DataSource_new(upb_arena *arena) { return (envoy_api_v2_core_DataSource *)upb_msg_new(&envoy_api_v2_core_DataSource_msginit, arena); } -UPB_INLINE envoy_api_v2_core_DataSource *envoy_api_v2_core_DataSource_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_DataSource *envoy_api_v2_core_DataSource_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_DataSource *ret = envoy_api_v2_core_DataSource_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_DataSource_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_DataSource_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_DataSource_serialize(const envoy_api_v2_core_DataSource *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_DataSource_msginit, arena, len); @@ -340,9 +376,9 @@ typedef enum { envoy_api_v2_core_DataSource_specifier_filename = 1, envoy_api_v2_core_DataSource_specifier_inline_bytes = 2, envoy_api_v2_core_DataSource_specifier_inline_string = 3, - envoy_api_v2_core_DataSource_specifier_NOT_SET = 0, + envoy_api_v2_core_DataSource_specifier_NOT_SET = 0 } envoy_api_v2_core_DataSource_specifier_oneofcases; -UPB_INLINE envoy_api_v2_core_DataSource_specifier_oneofcases envoy_api_v2_core_DataSource_specifier_case(const envoy_api_v2_core_DataSource* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); } +UPB_INLINE envoy_api_v2_core_DataSource_specifier_oneofcases envoy_api_v2_core_DataSource_specifier_case(const envoy_api_v2_core_DataSource* msg) { return (envoy_api_v2_core_DataSource_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 16)); } UPB_INLINE bool envoy_api_v2_core_DataSource_has_filename(const envoy_api_v2_core_DataSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); } UPB_INLINE upb_strview envoy_api_v2_core_DataSource_filename(const envoy_api_v2_core_DataSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); } @@ -361,15 +397,15 @@ UPB_INLINE void envoy_api_v2_core_DataSource_set_inline_string(envoy_api_v2_core UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3); } - /* envoy.api.v2.core.TransportSocket */ UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_new(upb_arena *arena) { return (envoy_api_v2_core_TransportSocket *)upb_msg_new(&envoy_api_v2_core_TransportSocket_msginit, arena); } -UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_TransportSocket *envoy_api_v2_core_TransportSocket_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_TransportSocket *ret = envoy_api_v2_core_TransportSocket_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_TransportSocket_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_TransportSocket_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_TransportSocket_serialize(const envoy_api_v2_core_TransportSocket *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_TransportSocket_msginit, arena, len); @@ -378,9 +414,9 @@ UPB_INLINE char *envoy_api_v2_core_TransportSocket_serialize(const envoy_api_v2_ typedef enum { envoy_api_v2_core_TransportSocket_config_type_config = 2, envoy_api_v2_core_TransportSocket_config_type_typed_config = 3, - envoy_api_v2_core_TransportSocket_config_type_NOT_SET = 0, + envoy_api_v2_core_TransportSocket_config_type_NOT_SET = 0 } envoy_api_v2_core_TransportSocket_config_type_oneofcases; -UPB_INLINE envoy_api_v2_core_TransportSocket_config_type_oneofcases envoy_api_v2_core_TransportSocket_config_type_case(const envoy_api_v2_core_TransportSocket* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); } +UPB_INLINE envoy_api_v2_core_TransportSocket_config_type_oneofcases envoy_api_v2_core_TransportSocket_config_type_case(const envoy_api_v2_core_TransportSocket* msg) { return (envoy_api_v2_core_TransportSocket_config_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); } UPB_INLINE upb_strview envoy_api_v2_core_TransportSocket_name(const envoy_api_v2_core_TransportSocket *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } UPB_INLINE bool envoy_api_v2_core_TransportSocket_has_config(const envoy_api_v2_core_TransportSocket *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); } @@ -416,15 +452,15 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_core_TransportSocket_mutable return sub; } - /* envoy.api.v2.core.SocketOption */ UPB_INLINE envoy_api_v2_core_SocketOption *envoy_api_v2_core_SocketOption_new(upb_arena *arena) { return (envoy_api_v2_core_SocketOption *)upb_msg_new(&envoy_api_v2_core_SocketOption_msginit, arena); } -UPB_INLINE envoy_api_v2_core_SocketOption *envoy_api_v2_core_SocketOption_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_SocketOption *envoy_api_v2_core_SocketOption_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_SocketOption *ret = envoy_api_v2_core_SocketOption_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_SocketOption_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_SocketOption_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_SocketOption_serialize(const envoy_api_v2_core_SocketOption *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_SocketOption_msginit, arena, len); @@ -433,9 +469,9 @@ UPB_INLINE char *envoy_api_v2_core_SocketOption_serialize(const envoy_api_v2_cor typedef enum { envoy_api_v2_core_SocketOption_value_int_value = 4, envoy_api_v2_core_SocketOption_value_buf_value = 5, - envoy_api_v2_core_SocketOption_value_NOT_SET = 0, + envoy_api_v2_core_SocketOption_value_NOT_SET = 0 } envoy_api_v2_core_SocketOption_value_oneofcases; -UPB_INLINE envoy_api_v2_core_SocketOption_value_oneofcases envoy_api_v2_core_SocketOption_value_case(const envoy_api_v2_core_SocketOption* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(40, 56)); } +UPB_INLINE envoy_api_v2_core_SocketOption_value_oneofcases envoy_api_v2_core_SocketOption_value_case(const envoy_api_v2_core_SocketOption* msg) { return (envoy_api_v2_core_SocketOption_value_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(40, 56)); } UPB_INLINE upb_strview envoy_api_v2_core_SocketOption_description(const envoy_api_v2_core_SocketOption *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(24, 24)); } UPB_INLINE int64_t envoy_api_v2_core_SocketOption_level(const envoy_api_v2_core_SocketOption *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)); } @@ -465,15 +501,15 @@ UPB_INLINE void envoy_api_v2_core_SocketOption_set_state(envoy_api_v2_core_Socke UPB_FIELD_AT(msg, int32_t, UPB_SIZE(16, 16)) = value; } - /* envoy.api.v2.core.RuntimeFractionalPercent */ UPB_INLINE envoy_api_v2_core_RuntimeFractionalPercent *envoy_api_v2_core_RuntimeFractionalPercent_new(upb_arena *arena) { return (envoy_api_v2_core_RuntimeFractionalPercent *)upb_msg_new(&envoy_api_v2_core_RuntimeFractionalPercent_msginit, arena); } -UPB_INLINE envoy_api_v2_core_RuntimeFractionalPercent *envoy_api_v2_core_RuntimeFractionalPercent_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_RuntimeFractionalPercent *envoy_api_v2_core_RuntimeFractionalPercent_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_RuntimeFractionalPercent *ret = envoy_api_v2_core_RuntimeFractionalPercent_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_RuntimeFractionalPercent_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_RuntimeFractionalPercent_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_RuntimeFractionalPercent_serialize(const envoy_api_v2_core_RuntimeFractionalPercent *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_RuntimeFractionalPercent_msginit, arena, len); @@ -498,6 +534,25 @@ UPB_INLINE void envoy_api_v2_core_RuntimeFractionalPercent_set_runtime_key(envoy UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } +/* envoy.api.v2.core.ControlPlane */ + +UPB_INLINE envoy_api_v2_core_ControlPlane *envoy_api_v2_core_ControlPlane_new(upb_arena *arena) { + return (envoy_api_v2_core_ControlPlane *)upb_msg_new(&envoy_api_v2_core_ControlPlane_msginit, arena); +} +UPB_INLINE envoy_api_v2_core_ControlPlane *envoy_api_v2_core_ControlPlane_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_core_ControlPlane *ret = envoy_api_v2_core_ControlPlane_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_ControlPlane_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_core_ControlPlane_serialize(const envoy_api_v2_core_ControlPlane *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_core_ControlPlane_msginit, arena, len); +} + +UPB_INLINE upb_strview envoy_api_v2_core_ControlPlane_identifier(const envoy_api_v2_core_ControlPlane *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } + +UPB_INLINE void envoy_api_v2_core_ControlPlane_set_identifier(envoy_api_v2_core_ControlPlane *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} #ifdef __cplusplus } /* extern "C" */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c b/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c index b36d02aeb81..5fe2a189ce0 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c @@ -60,21 +60,23 @@ const upb_msglayout envoy_api_v2_core_RateLimitSettings_msginit = { UPB_SIZE(8, 16), 2, false, }; -static const upb_msglayout *const envoy_api_v2_core_ConfigSource_submsgs[2] = { +static const upb_msglayout *const envoy_api_v2_core_ConfigSource_submsgs[3] = { &envoy_api_v2_core_AggregatedConfigSource_msginit, &envoy_api_v2_core_ApiConfigSource_msginit, + &google_protobuf_Duration_msginit, }; -static const upb_msglayout_field envoy_api_v2_core_ConfigSource__fields[3] = { - {1, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 9, 1}, - {2, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 1, 11, 1}, - {3, UPB_SIZE(0, 0), UPB_SIZE(-9, -17), 0, 11, 1}, +static const upb_msglayout_field envoy_api_v2_core_ConfigSource__fields[4] = { + {1, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 0, 9, 1}, + {2, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 1, 11, 1}, + {3, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 0, 11, 1}, + {4, UPB_SIZE(0, 0), 0, 2, 11, 1}, }; const upb_msglayout envoy_api_v2_core_ConfigSource_msginit = { &envoy_api_v2_core_ConfigSource_submsgs[0], &envoy_api_v2_core_ConfigSource__fields[0], - UPB_SIZE(16, 32), 3, false, + UPB_SIZE(16, 32), 4, false, }; #include "upb/port_undef.inc" diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h index 2b03b134c8e..27f4779c17f 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_CORE_CONFIG_SOURCE_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -41,12 +41,11 @@ extern const upb_msglayout google_protobuf_DoubleValue_msginit; extern const upb_msglayout google_protobuf_Duration_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; -/* Enums */ - typedef enum { - envoy_api_v2_core_ApiConfigSource_REST_LEGACY = 0, + envoy_api_v2_core_ApiConfigSource_UNSUPPORTED_REST_LEGACY = 0, envoy_api_v2_core_ApiConfigSource_REST = 1, - envoy_api_v2_core_ApiConfigSource_GRPC = 2 + envoy_api_v2_core_ApiConfigSource_GRPC = 2, + envoy_api_v2_core_ApiConfigSource_DELTA_GRPC = 3 } envoy_api_v2_core_ApiConfigSource_ApiType; @@ -55,9 +54,10 @@ typedef enum { UPB_INLINE envoy_api_v2_core_ApiConfigSource *envoy_api_v2_core_ApiConfigSource_new(upb_arena *arena) { return (envoy_api_v2_core_ApiConfigSource *)upb_msg_new(&envoy_api_v2_core_ApiConfigSource_msginit, arena); } -UPB_INLINE envoy_api_v2_core_ApiConfigSource *envoy_api_v2_core_ApiConfigSource_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_ApiConfigSource *envoy_api_v2_core_ApiConfigSource_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_ApiConfigSource *ret = envoy_api_v2_core_ApiConfigSource_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_ApiConfigSource_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_ApiConfigSource_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_ApiConfigSource_serialize(const envoy_api_v2_core_ApiConfigSource *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_ApiConfigSource_msginit, arena, len); @@ -133,15 +133,15 @@ UPB_INLINE struct envoy_api_v2_core_RateLimitSettings* envoy_api_v2_core_ApiConf return sub; } - /* envoy.api.v2.core.AggregatedConfigSource */ UPB_INLINE envoy_api_v2_core_AggregatedConfigSource *envoy_api_v2_core_AggregatedConfigSource_new(upb_arena *arena) { return (envoy_api_v2_core_AggregatedConfigSource *)upb_msg_new(&envoy_api_v2_core_AggregatedConfigSource_msginit, arena); } -UPB_INLINE envoy_api_v2_core_AggregatedConfigSource *envoy_api_v2_core_AggregatedConfigSource_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_AggregatedConfigSource *envoy_api_v2_core_AggregatedConfigSource_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_AggregatedConfigSource *ret = envoy_api_v2_core_AggregatedConfigSource_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_AggregatedConfigSource_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_AggregatedConfigSource_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_AggregatedConfigSource_serialize(const envoy_api_v2_core_AggregatedConfigSource *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_AggregatedConfigSource_msginit, arena, len); @@ -149,15 +149,15 @@ UPB_INLINE char *envoy_api_v2_core_AggregatedConfigSource_serialize(const envoy_ - /* envoy.api.v2.core.RateLimitSettings */ UPB_INLINE envoy_api_v2_core_RateLimitSettings *envoy_api_v2_core_RateLimitSettings_new(upb_arena *arena) { return (envoy_api_v2_core_RateLimitSettings *)upb_msg_new(&envoy_api_v2_core_RateLimitSettings_msginit, arena); } -UPB_INLINE envoy_api_v2_core_RateLimitSettings *envoy_api_v2_core_RateLimitSettings_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_RateLimitSettings *envoy_api_v2_core_RateLimitSettings_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_RateLimitSettings *ret = envoy_api_v2_core_RateLimitSettings_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_RateLimitSettings_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_RateLimitSettings_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_RateLimitSettings_serialize(const envoy_api_v2_core_RateLimitSettings *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_RateLimitSettings_msginit, arena, len); @@ -191,15 +191,15 @@ UPB_INLINE struct google_protobuf_DoubleValue* envoy_api_v2_core_RateLimitSettin return sub; } - /* envoy.api.v2.core.ConfigSource */ UPB_INLINE envoy_api_v2_core_ConfigSource *envoy_api_v2_core_ConfigSource_new(upb_arena *arena) { return (envoy_api_v2_core_ConfigSource *)upb_msg_new(&envoy_api_v2_core_ConfigSource_msginit, arena); } -UPB_INLINE envoy_api_v2_core_ConfigSource *envoy_api_v2_core_ConfigSource_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_ConfigSource *envoy_api_v2_core_ConfigSource_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_ConfigSource *ret = envoy_api_v2_core_ConfigSource_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_ConfigSource_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_ConfigSource_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_ConfigSource_serialize(const envoy_api_v2_core_ConfigSource *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_ConfigSource_msginit, arena, len); @@ -209,22 +209,23 @@ typedef enum { envoy_api_v2_core_ConfigSource_config_source_specifier_path = 1, envoy_api_v2_core_ConfigSource_config_source_specifier_api_config_source = 2, envoy_api_v2_core_ConfigSource_config_source_specifier_ads = 3, - envoy_api_v2_core_ConfigSource_config_source_specifier_NOT_SET = 0, + envoy_api_v2_core_ConfigSource_config_source_specifier_NOT_SET = 0 } envoy_api_v2_core_ConfigSource_config_source_specifier_oneofcases; -UPB_INLINE envoy_api_v2_core_ConfigSource_config_source_specifier_oneofcases envoy_api_v2_core_ConfigSource_config_source_specifier_case(const envoy_api_v2_core_ConfigSource* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); } +UPB_INLINE envoy_api_v2_core_ConfigSource_config_source_specifier_oneofcases envoy_api_v2_core_ConfigSource_config_source_specifier_case(const envoy_api_v2_core_ConfigSource* msg) { return (envoy_api_v2_core_ConfigSource_config_source_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); } -UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_path(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); } -UPB_INLINE upb_strview envoy_api_v2_core_ConfigSource_path(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); } -UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_api_config_source(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 2); } -UPB_INLINE const envoy_api_v2_core_ApiConfigSource* envoy_api_v2_core_ConfigSource_api_config_source(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_ApiConfigSource*, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 2, NULL); } -UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_ads(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 3); } -UPB_INLINE const envoy_api_v2_core_AggregatedConfigSource* envoy_api_v2_core_ConfigSource_ads(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_AggregatedConfigSource*, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 3, NULL); } +UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_path(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 1); } +UPB_INLINE upb_strview envoy_api_v2_core_ConfigSource_path(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 1, upb_strview_make("", strlen(""))); } +UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_api_config_source(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); } +UPB_INLINE const envoy_api_v2_core_ApiConfigSource* envoy_api_v2_core_ConfigSource_api_config_source(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_ApiConfigSource*, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 2, NULL); } +UPB_INLINE bool envoy_api_v2_core_ConfigSource_has_ads(const envoy_api_v2_core_ConfigSource *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 3); } +UPB_INLINE const envoy_api_v2_core_AggregatedConfigSource* envoy_api_v2_core_ConfigSource_ads(const envoy_api_v2_core_ConfigSource *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_AggregatedConfigSource*, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 3, NULL); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_ConfigSource_initial_fetch_timeout(const envoy_api_v2_core_ConfigSource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(0, 0)); } UPB_INLINE void envoy_api_v2_core_ConfigSource_set_path(envoy_api_v2_core_ConfigSource *msg, upb_strview value) { - UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 1); + UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 1); } UPB_INLINE void envoy_api_v2_core_ConfigSource_set_api_config_source(envoy_api_v2_core_ConfigSource *msg, envoy_api_v2_core_ApiConfigSource* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_core_ApiConfigSource*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2); + UPB_WRITE_ONEOF(msg, envoy_api_v2_core_ApiConfigSource*, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 2); } UPB_INLINE struct envoy_api_v2_core_ApiConfigSource* envoy_api_v2_core_ConfigSource_mutable_api_config_source(envoy_api_v2_core_ConfigSource *msg, upb_arena *arena) { struct envoy_api_v2_core_ApiConfigSource* sub = (struct envoy_api_v2_core_ApiConfigSource*)envoy_api_v2_core_ConfigSource_api_config_source(msg); @@ -236,7 +237,7 @@ UPB_INLINE struct envoy_api_v2_core_ApiConfigSource* envoy_api_v2_core_ConfigSou return sub; } UPB_INLINE void envoy_api_v2_core_ConfigSource_set_ads(envoy_api_v2_core_ConfigSource *msg, envoy_api_v2_core_AggregatedConfigSource* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_core_AggregatedConfigSource*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 3); + UPB_WRITE_ONEOF(msg, envoy_api_v2_core_AggregatedConfigSource*, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 3); } UPB_INLINE struct envoy_api_v2_core_AggregatedConfigSource* envoy_api_v2_core_ConfigSource_mutable_ads(envoy_api_v2_core_ConfigSource *msg, upb_arena *arena) { struct envoy_api_v2_core_AggregatedConfigSource* sub = (struct envoy_api_v2_core_AggregatedConfigSource*)envoy_api_v2_core_ConfigSource_ads(msg); @@ -247,7 +248,18 @@ UPB_INLINE struct envoy_api_v2_core_AggregatedConfigSource* envoy_api_v2_core_Co } return sub; } - +UPB_INLINE void envoy_api_v2_core_ConfigSource_set_initial_fetch_timeout(envoy_api_v2_core_ConfigSource *msg, struct google_protobuf_Duration* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_ConfigSource_mutable_initial_fetch_timeout(envoy_api_v2_core_ConfigSource *msg, upb_arena *arena) { + struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_ConfigSource_initial_fetch_timeout(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_ConfigSource_set_initial_fetch_timeout(msg, sub); + } + return sub; +} #ifdef __cplusplus } /* extern "C" */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h index 8369c026dc7..bff3c3c0e81 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_CORE_GRPC_SERVICE_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -63,17 +63,16 @@ extern const upb_msglayout google_protobuf_Duration_msginit; extern const upb_msglayout google_protobuf_Empty_msginit; extern const upb_msglayout google_protobuf_Struct_msginit; -/* Enums */ - /* envoy.api.v2.core.GrpcService */ UPB_INLINE envoy_api_v2_core_GrpcService *envoy_api_v2_core_GrpcService_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService *)upb_msg_new(&envoy_api_v2_core_GrpcService_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService *envoy_api_v2_core_GrpcService_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService *envoy_api_v2_core_GrpcService_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService *ret = envoy_api_v2_core_GrpcService_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_serialize(const envoy_api_v2_core_GrpcService *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_msginit, arena, len); @@ -82,9 +81,9 @@ UPB_INLINE char *envoy_api_v2_core_GrpcService_serialize(const envoy_api_v2_core typedef enum { envoy_api_v2_core_GrpcService_target_specifier_envoy_grpc = 1, envoy_api_v2_core_GrpcService_target_specifier_google_grpc = 2, - envoy_api_v2_core_GrpcService_target_specifier_NOT_SET = 0, + envoy_api_v2_core_GrpcService_target_specifier_NOT_SET = 0 } envoy_api_v2_core_GrpcService_target_specifier_oneofcases; -UPB_INLINE envoy_api_v2_core_GrpcService_target_specifier_oneofcases envoy_api_v2_core_GrpcService_target_specifier_case(const envoy_api_v2_core_GrpcService* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); } +UPB_INLINE envoy_api_v2_core_GrpcService_target_specifier_oneofcases envoy_api_v2_core_GrpcService_target_specifier_case(const envoy_api_v2_core_GrpcService* msg) { return (envoy_api_v2_core_GrpcService_target_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); } UPB_INLINE bool envoy_api_v2_core_GrpcService_has_envoy_grpc(const envoy_api_v2_core_GrpcService *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 1); } UPB_INLINE const envoy_api_v2_core_GrpcService_EnvoyGrpc* envoy_api_v2_core_GrpcService_envoy_grpc(const envoy_api_v2_core_GrpcService *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_GrpcService_EnvoyGrpc*, UPB_SIZE(8, 16), UPB_SIZE(12, 24), 1, NULL); } @@ -143,15 +142,15 @@ UPB_INLINE struct envoy_api_v2_core_HeaderValue* envoy_api_v2_core_GrpcService_a return sub; } - /* envoy.api.v2.core.GrpcService.EnvoyGrpc */ UPB_INLINE envoy_api_v2_core_GrpcService_EnvoyGrpc *envoy_api_v2_core_GrpcService_EnvoyGrpc_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_EnvoyGrpc *)upb_msg_new(&envoy_api_v2_core_GrpcService_EnvoyGrpc_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_EnvoyGrpc *envoy_api_v2_core_GrpcService_EnvoyGrpc_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_EnvoyGrpc *envoy_api_v2_core_GrpcService_EnvoyGrpc_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_EnvoyGrpc *ret = envoy_api_v2_core_GrpcService_EnvoyGrpc_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_EnvoyGrpc_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_EnvoyGrpc_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_EnvoyGrpc_serialize(const envoy_api_v2_core_GrpcService_EnvoyGrpc *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_EnvoyGrpc_msginit, arena, len); @@ -163,15 +162,15 @@ UPB_INLINE void envoy_api_v2_core_GrpcService_EnvoyGrpc_set_cluster_name(envoy_a UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } - /* envoy.api.v2.core.GrpcService.GoogleGrpc */ UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc *envoy_api_v2_core_GrpcService_GoogleGrpc_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_GoogleGrpc *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc *envoy_api_v2_core_GrpcService_GoogleGrpc_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc *envoy_api_v2_core_GrpcService_GoogleGrpc_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_GoogleGrpc *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_msginit, arena, len); @@ -231,15 +230,15 @@ UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_core_GrpcService_GoogleGr return sub; } - /* envoy.api.v2.core.GrpcService.GoogleGrpc.SslCredentials */ UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials_msginit, arena, len); @@ -286,15 +285,15 @@ UPB_INLINE struct envoy_api_v2_core_DataSource* envoy_api_v2_core_GrpcService_Go return sub; } - /* envoy.api.v2.core.GrpcService.GoogleGrpc.GoogleLocalCredentials */ UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials_msginit, arena, len); @@ -302,15 +301,15 @@ UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredentials - /* envoy.api.v2.core.GrpcService.GoogleGrpc.ChannelCredentials */ UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_msginit, arena, len); @@ -320,9 +319,9 @@ typedef enum { envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_ssl_credentials = 1, envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_google_default = 2, envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_local_credentials = 3, - envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_NOT_SET = 0, + envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_NOT_SET = 0 } envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_oneofcases; -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(4, 8)); } +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials* msg) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_credential_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); } UPB_INLINE bool envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_has_ssl_credentials(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); } UPB_INLINE const envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials* envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials_ssl_credentials(const envoy_api_v2_core_GrpcService_GoogleGrpc_ChannelCredentials *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_GrpcService_GoogleGrpc_SslCredentials*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); } @@ -368,15 +367,15 @@ UPB_INLINE struct envoy_api_v2_core_GrpcService_GoogleGrpc_GoogleLocalCredential return sub; } - /* envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials */ UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_msginit, arena, len); @@ -389,9 +388,9 @@ typedef enum { envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_service_account_jwt_access = 4, envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_google_iam = 5, envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_from_plugin = 6, - envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_NOT_SET = 0, + envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_NOT_SET = 0 } envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_oneofcases; -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); } +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials* msg) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_credential_specifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 16)); } UPB_INLINE bool envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_has_access_token(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); } UPB_INLINE upb_strview envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_access_token(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); } @@ -461,15 +460,15 @@ UPB_INLINE struct envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_Metad return sub; } - /* envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.ServiceAccountJWTAccessCredentials */ UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_ServiceAccountJWTAccessCredentials_msginit, arena, len); @@ -485,15 +484,15 @@ UPB_INLINE void envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_Service UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)) = value; } - /* envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.GoogleIAMCredentials */ UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleIAMCredentials_msginit, arena, len); @@ -509,15 +508,15 @@ UPB_INLINE void envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_GoogleI UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; } - /* envoy.api.v2.core.GrpcService.GoogleGrpc.CallCredentials.MetadataCredentialsFromPlugin */ UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *)upb_msg_new(&envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *ret = envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_serialize(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_msginit, arena, len); @@ -526,9 +525,9 @@ UPB_INLINE char *envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_Metada typedef enum { envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_config = 2, envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_typed_config = 3, - envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_NOT_SET = 0, + envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_NOT_SET = 0 } envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_oneofcases; -UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); } +UPB_INLINE envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_oneofcases envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_case(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin* msg) { return (envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_config_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); } UPB_INLINE upb_strview envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_name(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } UPB_INLINE bool envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin_has_config(const envoy_api_v2_core_GrpcService_GoogleGrpc_CallCredentials_MetadataCredentialsFromPlugin *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); } @@ -564,7 +563,6 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_core_GrpcService_GoogleGrpc_ return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c b/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c index a6dcd52d45b..9b804abcadc 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c @@ -10,6 +10,7 @@ #include "upb/msg.h" #include "envoy/api/v2/core/health_check.upb.h" #include "envoy/api/v2/core/base.upb.h" +#include "envoy/type/range.upb.h" #include "google/protobuf/any.upb.h" #include "google/protobuf/duration.upb.h" #include "google/protobuf/struct.upb.h" @@ -19,7 +20,7 @@ #include "upb/port_def.inc" -static const upb_msglayout *const envoy_api_v2_core_HealthCheck_submsgs[15] = { +static const upb_msglayout *const envoy_api_v2_core_HealthCheck_submsgs[16] = { &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, @@ -29,30 +30,32 @@ static const upb_msglayout *const envoy_api_v2_core_HealthCheck_submsgs[15] = { &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_core_HealthCheck__fields[17] = { - {1, UPB_SIZE(12, 24), 0, 5, 11, 1}, - {2, UPB_SIZE(16, 32), 0, 5, 11, 1}, - {3, UPB_SIZE(20, 40), 0, 5, 11, 1}, - {4, UPB_SIZE(24, 48), 0, 6, 11, 1}, - {5, UPB_SIZE(28, 56), 0, 6, 11, 1}, - {6, UPB_SIZE(32, 64), 0, 6, 11, 1}, - {7, UPB_SIZE(36, 72), 0, 4, 11, 1}, - {8, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 2, 11, 1}, - {9, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 3, 11, 1}, - {11, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 1, 11, 1}, - {12, UPB_SIZE(40, 80), 0, 5, 11, 1}, - {13, UPB_SIZE(56, 112), UPB_SIZE(-61, -121), 0, 11, 1}, - {14, UPB_SIZE(44, 88), 0, 5, 11, 1}, - {15, UPB_SIZE(48, 96), 0, 5, 11, 1}, - {16, UPB_SIZE(52, 104), 0, 5, 11, 1}, - {17, UPB_SIZE(4, 8), 0, 0, 9, 1}, +static const upb_msglayout_field envoy_api_v2_core_HealthCheck__fields[19] = { + {1, UPB_SIZE(16, 24), 0, 5, 11, 1}, + {2, UPB_SIZE(20, 32), 0, 5, 11, 1}, + {3, UPB_SIZE(24, 40), 0, 5, 11, 1}, + {4, UPB_SIZE(28, 48), 0, 6, 11, 1}, + {5, UPB_SIZE(32, 56), 0, 6, 11, 1}, + {6, UPB_SIZE(36, 64), 0, 6, 11, 1}, + {7, UPB_SIZE(40, 72), 0, 4, 11, 1}, + {8, UPB_SIZE(64, 120), UPB_SIZE(-69, -129), 2, 11, 1}, + {9, UPB_SIZE(64, 120), UPB_SIZE(-69, -129), 3, 11, 1}, + {11, UPB_SIZE(64, 120), UPB_SIZE(-69, -129), 1, 11, 1}, + {12, UPB_SIZE(44, 80), 0, 5, 11, 1}, + {13, UPB_SIZE(64, 120), UPB_SIZE(-69, -129), 0, 11, 1}, + {14, UPB_SIZE(48, 88), 0, 5, 11, 1}, + {15, UPB_SIZE(52, 96), 0, 5, 11, 1}, + {16, UPB_SIZE(56, 104), 0, 5, 11, 1}, + {17, UPB_SIZE(8, 8), 0, 0, 9, 1}, {18, UPB_SIZE(0, 0), 0, 0, 13, 1}, + {19, UPB_SIZE(4, 4), 0, 0, 8, 1}, + {20, UPB_SIZE(60, 112), 0, 5, 11, 1}, }; const upb_msglayout envoy_api_v2_core_HealthCheck_msginit = { &envoy_api_v2_core_HealthCheck_submsgs[0], &envoy_api_v2_core_HealthCheck__fields[0], - UPB_SIZE(64, 128), 17, false, + UPB_SIZE(72, 144), 19, false, }; static const upb_msglayout_field envoy_api_v2_core_HealthCheck_Payload__fields[2] = { @@ -66,12 +69,13 @@ const upb_msglayout envoy_api_v2_core_HealthCheck_Payload_msginit = { UPB_SIZE(16, 32), 2, false, }; -static const upb_msglayout *const envoy_api_v2_core_HealthCheck_HttpHealthCheck_submsgs[3] = { +static const upb_msglayout *const envoy_api_v2_core_HealthCheck_HttpHealthCheck_submsgs[4] = { &envoy_api_v2_core_HeaderValueOption_msginit, &envoy_api_v2_core_HealthCheck_Payload_msginit, + &envoy_type_Int64Range_msginit, }; -static const upb_msglayout_field envoy_api_v2_core_HealthCheck_HttpHealthCheck__fields[8] = { +static const upb_msglayout_field envoy_api_v2_core_HealthCheck_HttpHealthCheck__fields[9] = { {1, UPB_SIZE(4, 8), 0, 0, 9, 1}, {2, UPB_SIZE(12, 24), 0, 0, 9, 1}, {3, UPB_SIZE(28, 56), 0, 1, 11, 1}, @@ -80,12 +84,13 @@ static const upb_msglayout_field envoy_api_v2_core_HealthCheck_HttpHealthCheck__ {6, UPB_SIZE(36, 72), 0, 0, 11, 3}, {7, UPB_SIZE(0, 0), 0, 0, 8, 1}, {8, UPB_SIZE(40, 80), 0, 0, 9, 3}, + {9, UPB_SIZE(44, 88), 0, 2, 11, 3}, }; const upb_msglayout envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit = { &envoy_api_v2_core_HealthCheck_HttpHealthCheck_submsgs[0], &envoy_api_v2_core_HealthCheck_HttpHealthCheck__fields[0], - UPB_SIZE(48, 96), 8, false, + UPB_SIZE(48, 96), 9, false, }; static const upb_msglayout *const envoy_api_v2_core_HealthCheck_TcpHealthCheck_submsgs[2] = { @@ -113,14 +118,15 @@ const upb_msglayout envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit = { UPB_SIZE(8, 16), 1, false, }; -static const upb_msglayout_field envoy_api_v2_core_HealthCheck_GrpcHealthCheck__fields[1] = { +static const upb_msglayout_field envoy_api_v2_core_HealthCheck_GrpcHealthCheck__fields[2] = { {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 16), 0, 0, 9, 1}, }; const upb_msglayout envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit = { NULL, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck__fields[0], - UPB_SIZE(8, 16), 1, false, + UPB_SIZE(16, 32), 2, false, }; static const upb_msglayout *const envoy_api_v2_core_HealthCheck_CustomHealthCheck_submsgs[2] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h index 7db04bf3e73..6e7b25866db 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_CORE_HEALTH_CHECK_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -42,26 +42,27 @@ extern const upb_msglayout envoy_api_v2_core_HealthCheck_RedisHealthCheck_msgini extern const upb_msglayout envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit; extern const upb_msglayout envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit; struct envoy_api_v2_core_HeaderValueOption; +struct envoy_type_Int64Range; struct google_protobuf_Any; struct google_protobuf_BoolValue; struct google_protobuf_Duration; struct google_protobuf_Struct; struct google_protobuf_UInt32Value; extern const upb_msglayout envoy_api_v2_core_HeaderValueOption_msginit; +extern const upb_msglayout envoy_type_Int64Range_msginit; extern const upb_msglayout google_protobuf_Any_msginit; extern const upb_msglayout google_protobuf_BoolValue_msginit; extern const upb_msglayout google_protobuf_Duration_msginit; extern const upb_msglayout google_protobuf_Struct_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; -/* Enums */ - typedef enum { envoy_api_v2_core_UNKNOWN = 0, envoy_api_v2_core_HEALTHY = 1, envoy_api_v2_core_UNHEALTHY = 2, envoy_api_v2_core_DRAINING = 3, - envoy_api_v2_core_TIMEOUT = 4 + envoy_api_v2_core_TIMEOUT = 4, + envoy_api_v2_core_DEGRADED = 5 } envoy_api_v2_core_HealthStatus; @@ -70,9 +71,10 @@ typedef enum { UPB_INLINE envoy_api_v2_core_HealthCheck *envoy_api_v2_core_HealthCheck_new(upb_arena *arena) { return (envoy_api_v2_core_HealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HealthCheck *envoy_api_v2_core_HealthCheck_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HealthCheck *envoy_api_v2_core_HealthCheck_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HealthCheck *ret = envoy_api_v2_core_HealthCheck_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HealthCheck_serialize(const envoy_api_v2_core_HealthCheck *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HealthCheck_msginit, arena, len); @@ -83,34 +85,36 @@ typedef enum { envoy_api_v2_core_HealthCheck_health_checker_tcp_health_check = 9, envoy_api_v2_core_HealthCheck_health_checker_grpc_health_check = 11, envoy_api_v2_core_HealthCheck_health_checker_custom_health_check = 13, - envoy_api_v2_core_HealthCheck_health_checker_NOT_SET = 0, + envoy_api_v2_core_HealthCheck_health_checker_NOT_SET = 0 } envoy_api_v2_core_HealthCheck_health_checker_oneofcases; -UPB_INLINE envoy_api_v2_core_HealthCheck_health_checker_oneofcases envoy_api_v2_core_HealthCheck_health_checker_case(const envoy_api_v2_core_HealthCheck* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(60, 120)); } - -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_timeout(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(12, 24)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 32)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval_jitter(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(20, 40)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_unhealthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_healthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_alt_port(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)); } -UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_reuse_connection(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(36, 72)); } -UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 8); } -UPB_INLINE const envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_core_HealthCheck_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 8, NULL); } -UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 9); } -UPB_INLINE const envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_core_HealthCheck_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 9, NULL); } -UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 11); } -UPB_INLINE const envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_core_HealthCheck_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 11, NULL); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_no_traffic_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(40, 80)); } -UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(60, 120), 13); } -UPB_INLINE const envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_core_HealthCheck_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(56, 112), UPB_SIZE(60, 120), 13, NULL); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(44, 88)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(48, 96)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_healthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(52, 104)); } -UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_event_log_path(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE envoy_api_v2_core_HealthCheck_health_checker_oneofcases envoy_api_v2_core_HealthCheck_health_checker_case(const envoy_api_v2_core_HealthCheck* msg) { return (envoy_api_v2_core_HealthCheck_health_checker_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(68, 128)); } + +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_timeout(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 24)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(20, 32)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_interval_jitter(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(24, 40)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_unhealthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(28, 48)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_healthy_threshold(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(32, 56)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_alt_port(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(36, 64)); } +UPB_INLINE const struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_reuse_connection(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_BoolValue*, UPB_SIZE(40, 72)); } +UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(68, 128), 8); } +UPB_INLINE const envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_core_HealthCheck_http_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(64, 120), UPB_SIZE(68, 128), 8, NULL); } +UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(68, 128), 9); } +UPB_INLINE const envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_core_HealthCheck_tcp_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(64, 120), UPB_SIZE(68, 128), 9, NULL); } +UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(68, 128), 11); } +UPB_INLINE const envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_core_HealthCheck_grpc_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(64, 120), UPB_SIZE(68, 128), 11, NULL); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_no_traffic_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(44, 80)); } +UPB_INLINE bool envoy_api_v2_core_HealthCheck_has_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(68, 128), 13); } +UPB_INLINE const envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_core_HealthCheck_custom_health_check(const envoy_api_v2_core_HealthCheck *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(64, 120), UPB_SIZE(68, 128), 13, NULL); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(48, 88)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_unhealthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(52, 96)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_healthy_edge_interval(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(56, 104)); } +UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_event_log_path(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } UPB_INLINE uint32_t envoy_api_v2_core_HealthCheck_interval_jitter_percent(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); } +UPB_INLINE bool envoy_api_v2_core_HealthCheck_always_log_health_check_failures(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_initial_jitter(const envoy_api_v2_core_HealthCheck *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(60, 112)); } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_timeout(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(12, 24)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 24)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_timeout(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_timeout(msg); @@ -122,7 +126,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 32)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(20, 32)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_interval(msg); @@ -134,7 +138,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval_jitter(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(20, 40)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(24, 40)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_interval_jitter(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_interval_jitter(msg); @@ -146,7 +150,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_threshold(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(24, 48)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 48)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_unhealthy_threshold(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_unhealthy_threshold(msg); @@ -158,7 +162,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mut return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_healthy_threshold(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(28, 56)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 56)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_healthy_threshold(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_healthy_threshold(msg); @@ -170,7 +174,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mut return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_alt_port(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(32, 64)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(36, 64)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mutable_alt_port(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_core_HealthCheck_alt_port(msg); @@ -182,7 +186,7 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_HealthCheck_mut return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_reuse_connection(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_BoolValue* value) { - UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(36, 72)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_BoolValue*, UPB_SIZE(40, 72)) = value; } UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_mutable_reuse_connection(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_BoolValue* sub = (struct google_protobuf_BoolValue*)envoy_api_v2_core_HealthCheck_reuse_connection(msg); @@ -194,7 +198,7 @@ UPB_INLINE struct google_protobuf_BoolValue* envoy_api_v2_core_HealthCheck_mutab return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_http_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_HttpHealthCheck* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 8); + UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_HttpHealthCheck*, UPB_SIZE(64, 120), value, UPB_SIZE(68, 128), 8); } UPB_INLINE struct envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_core_HealthCheck_mutable_http_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct envoy_api_v2_core_HealthCheck_HttpHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_HttpHealthCheck*)envoy_api_v2_core_HealthCheck_http_health_check(msg); @@ -206,7 +210,7 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_HttpHealthCheck* envoy_api_v2_co return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_tcp_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_TcpHealthCheck* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 9); + UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_TcpHealthCheck*, UPB_SIZE(64, 120), value, UPB_SIZE(68, 128), 9); } UPB_INLINE struct envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_core_HealthCheck_mutable_tcp_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct envoy_api_v2_core_HealthCheck_TcpHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_TcpHealthCheck*)envoy_api_v2_core_HealthCheck_tcp_health_check(msg); @@ -218,7 +222,7 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_TcpHealthCheck* envoy_api_v2_cor return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_grpc_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_GrpcHealthCheck* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 11); + UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_GrpcHealthCheck*, UPB_SIZE(64, 120), value, UPB_SIZE(68, 128), 11); } UPB_INLINE struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_core_HealthCheck_mutable_grpc_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck*)envoy_api_v2_core_HealthCheck_grpc_health_check(msg); @@ -230,7 +234,7 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_GrpcHealthCheck* envoy_api_v2_co return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_no_traffic_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(40, 80)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(44, 80)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_no_traffic_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_no_traffic_interval(msg); @@ -242,7 +246,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_custom_health_check(envoy_api_v2_core_HealthCheck *msg, envoy_api_v2_core_HealthCheck_CustomHealthCheck* value) { - UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(56, 112), value, UPB_SIZE(60, 120), 13); + UPB_WRITE_ONEOF(msg, envoy_api_v2_core_HealthCheck_CustomHealthCheck*, UPB_SIZE(64, 120), value, UPB_SIZE(68, 128), 13); } UPB_INLINE struct envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_core_HealthCheck_mutable_custom_health_check(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct envoy_api_v2_core_HealthCheck_CustomHealthCheck* sub = (struct envoy_api_v2_core_HealthCheck_CustomHealthCheck*)envoy_api_v2_core_HealthCheck_custom_health_check(msg); @@ -254,7 +258,7 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_CustomHealthCheck* envoy_api_v2_ return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(44, 88)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(48, 88)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_unhealthy_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_unhealthy_interval(msg); @@ -266,7 +270,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_unhealthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(48, 96)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(52, 96)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_unhealthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_unhealthy_edge_interval(msg); @@ -278,7 +282,7 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_healthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(52, 104)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(56, 104)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_healthy_edge_interval(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_healthy_edge_interval(msg); @@ -290,21 +294,36 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutabl return sub; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_event_log_path(envoy_api_v2_core_HealthCheck *msg, upb_strview value) { - UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; } UPB_INLINE void envoy_api_v2_core_HealthCheck_set_interval_jitter_percent(envoy_api_v2_core_HealthCheck *msg, uint32_t value) { UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value; } - +UPB_INLINE void envoy_api_v2_core_HealthCheck_set_always_log_health_check_failures(envoy_api_v2_core_HealthCheck *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)) = value; +} +UPB_INLINE void envoy_api_v2_core_HealthCheck_set_initial_jitter(envoy_api_v2_core_HealthCheck *msg, struct google_protobuf_Duration* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(60, 112)) = value; +} +UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HealthCheck_mutable_initial_jitter(envoy_api_v2_core_HealthCheck *msg, upb_arena *arena) { + struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_core_HealthCheck_initial_jitter(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_core_HealthCheck_set_initial_jitter(msg, sub); + } + return sub; +} /* envoy.api.v2.core.HealthCheck.Payload */ UPB_INLINE envoy_api_v2_core_HealthCheck_Payload *envoy_api_v2_core_HealthCheck_Payload_new(upb_arena *arena) { return (envoy_api_v2_core_HealthCheck_Payload *)upb_msg_new(&envoy_api_v2_core_HealthCheck_Payload_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HealthCheck_Payload *envoy_api_v2_core_HealthCheck_Payload_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HealthCheck_Payload *envoy_api_v2_core_HealthCheck_Payload_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HealthCheck_Payload *ret = envoy_api_v2_core_HealthCheck_Payload_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_Payload_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_Payload_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HealthCheck_Payload_serialize(const envoy_api_v2_core_HealthCheck_Payload *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HealthCheck_Payload_msginit, arena, len); @@ -313,9 +332,9 @@ UPB_INLINE char *envoy_api_v2_core_HealthCheck_Payload_serialize(const envoy_api typedef enum { envoy_api_v2_core_HealthCheck_Payload_payload_text = 1, envoy_api_v2_core_HealthCheck_Payload_payload_binary = 2, - envoy_api_v2_core_HealthCheck_Payload_payload_NOT_SET = 0, + envoy_api_v2_core_HealthCheck_Payload_payload_NOT_SET = 0 } envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases; -UPB_INLINE envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases envoy_api_v2_core_HealthCheck_Payload_payload_case(const envoy_api_v2_core_HealthCheck_Payload* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); } +UPB_INLINE envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases envoy_api_v2_core_HealthCheck_Payload_payload_case(const envoy_api_v2_core_HealthCheck_Payload* msg) { return (envoy_api_v2_core_HealthCheck_Payload_payload_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 16)); } UPB_INLINE bool envoy_api_v2_core_HealthCheck_Payload_has_text(const envoy_api_v2_core_HealthCheck_Payload *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); } UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_Payload_text(const envoy_api_v2_core_HealthCheck_Payload *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, upb_strview_make("", strlen(""))); } @@ -329,15 +348,15 @@ UPB_INLINE void envoy_api_v2_core_HealthCheck_Payload_set_binary(envoy_api_v2_co UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2); } - /* envoy.api.v2.core.HealthCheck.HttpHealthCheck */ UPB_INLINE envoy_api_v2_core_HealthCheck_HttpHealthCheck *envoy_api_v2_core_HealthCheck_HttpHealthCheck_new(upb_arena *arena) { return (envoy_api_v2_core_HealthCheck_HttpHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HealthCheck_HttpHealthCheck *envoy_api_v2_core_HealthCheck_HttpHealthCheck_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HealthCheck_HttpHealthCheck *envoy_api_v2_core_HealthCheck_HttpHealthCheck_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HealthCheck_HttpHealthCheck *ret = envoy_api_v2_core_HealthCheck_HttpHealthCheck_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HealthCheck_HttpHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HealthCheck_HttpHealthCheck_msginit, arena, len); @@ -351,6 +370,7 @@ UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_HttpHealthCheck_service_nam UPB_INLINE const struct envoy_api_v2_core_HeaderValueOption* const* envoy_api_v2_core_HealthCheck_HttpHealthCheck_request_headers_to_add(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { return (const struct envoy_api_v2_core_HeaderValueOption* const*)_upb_array_accessor(msg, UPB_SIZE(36, 72), len); } UPB_INLINE bool envoy_api_v2_core_HealthCheck_HttpHealthCheck_use_http2(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } UPB_INLINE upb_strview const* envoy_api_v2_core_HealthCheck_HttpHealthCheck_request_headers_to_remove(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(40, 80), len); } +UPB_INLINE const struct envoy_type_Int64Range* const* envoy_api_v2_core_HealthCheck_HttpHealthCheck_expected_statuses(const envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { return (const struct envoy_type_Int64Range* const*)_upb_array_accessor(msg, UPB_SIZE(44, 88), len); } UPB_INLINE void envoy_api_v2_core_HealthCheck_HttpHealthCheck_set_host(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; @@ -411,16 +431,29 @@ UPB_INLINE bool envoy_api_v2_core_HealthCheck_HttpHealthCheck_add_request_header return _upb_array_append_accessor( msg, UPB_SIZE(40, 80), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } - +UPB_INLINE struct envoy_type_Int64Range** envoy_api_v2_core_HealthCheck_HttpHealthCheck_mutable_expected_statuses(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t *len) { + return (struct envoy_type_Int64Range**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len); +} +UPB_INLINE struct envoy_type_Int64Range** envoy_api_v2_core_HealthCheck_HttpHealthCheck_resize_expected_statuses(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, size_t len, upb_arena *arena) { + return (struct envoy_type_Int64Range**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct envoy_type_Int64Range* envoy_api_v2_core_HealthCheck_HttpHealthCheck_add_expected_statuses(envoy_api_v2_core_HealthCheck_HttpHealthCheck *msg, upb_arena *arena) { + struct envoy_type_Int64Range* sub = (struct envoy_type_Int64Range*)upb_msg_new(&envoy_type_Int64Range_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(44, 88), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} /* envoy.api.v2.core.HealthCheck.TcpHealthCheck */ UPB_INLINE envoy_api_v2_core_HealthCheck_TcpHealthCheck *envoy_api_v2_core_HealthCheck_TcpHealthCheck_new(upb_arena *arena) { return (envoy_api_v2_core_HealthCheck_TcpHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HealthCheck_TcpHealthCheck *envoy_api_v2_core_HealthCheck_TcpHealthCheck_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HealthCheck_TcpHealthCheck *envoy_api_v2_core_HealthCheck_TcpHealthCheck_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HealthCheck_TcpHealthCheck *ret = envoy_api_v2_core_HealthCheck_TcpHealthCheck_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HealthCheck_TcpHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_TcpHealthCheck *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HealthCheck_TcpHealthCheck_msginit, arena, len); @@ -455,15 +488,15 @@ UPB_INLINE struct envoy_api_v2_core_HealthCheck_Payload* envoy_api_v2_core_Healt return sub; } - /* envoy.api.v2.core.HealthCheck.RedisHealthCheck */ UPB_INLINE envoy_api_v2_core_HealthCheck_RedisHealthCheck *envoy_api_v2_core_HealthCheck_RedisHealthCheck_new(upb_arena *arena) { return (envoy_api_v2_core_HealthCheck_RedisHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HealthCheck_RedisHealthCheck *envoy_api_v2_core_HealthCheck_RedisHealthCheck_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HealthCheck_RedisHealthCheck *envoy_api_v2_core_HealthCheck_RedisHealthCheck_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HealthCheck_RedisHealthCheck *ret = envoy_api_v2_core_HealthCheck_RedisHealthCheck_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HealthCheck_RedisHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_RedisHealthCheck *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HealthCheck_RedisHealthCheck_msginit, arena, len); @@ -475,35 +508,39 @@ UPB_INLINE void envoy_api_v2_core_HealthCheck_RedisHealthCheck_set_key(envoy_api UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } - /* envoy.api.v2.core.HealthCheck.GrpcHealthCheck */ UPB_INLINE envoy_api_v2_core_HealthCheck_GrpcHealthCheck *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_new(upb_arena *arena) { return (envoy_api_v2_core_HealthCheck_GrpcHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HealthCheck_GrpcHealthCheck *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HealthCheck_GrpcHealthCheck *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HealthCheck_GrpcHealthCheck *ret = envoy_api_v2_core_HealthCheck_GrpcHealthCheck_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HealthCheck_GrpcHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HealthCheck_GrpcHealthCheck_msginit, arena, len); } UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_GrpcHealthCheck_service_name(const envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_GrpcHealthCheck_authority(const envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } UPB_INLINE void envoy_api_v2_core_HealthCheck_GrpcHealthCheck_set_service_name(envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } - +UPB_INLINE void envoy_api_v2_core_HealthCheck_GrpcHealthCheck_set_authority(envoy_api_v2_core_HealthCheck_GrpcHealthCheck *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; +} /* envoy.api.v2.core.HealthCheck.CustomHealthCheck */ UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck *envoy_api_v2_core_HealthCheck_CustomHealthCheck_new(upb_arena *arena) { return (envoy_api_v2_core_HealthCheck_CustomHealthCheck *)upb_msg_new(&envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck *envoy_api_v2_core_HealthCheck_CustomHealthCheck_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck *envoy_api_v2_core_HealthCheck_CustomHealthCheck_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HealthCheck_CustomHealthCheck *ret = envoy_api_v2_core_HealthCheck_CustomHealthCheck_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HealthCheck_CustomHealthCheck_serialize(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HealthCheck_CustomHealthCheck_msginit, arena, len); @@ -512,9 +549,9 @@ UPB_INLINE char *envoy_api_v2_core_HealthCheck_CustomHealthCheck_serialize(const typedef enum { envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_config = 2, envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_typed_config = 3, - envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_NOT_SET = 0, + envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_NOT_SET = 0 } envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases; -UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_case(const envoy_api_v2_core_HealthCheck_CustomHealthCheck* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(12, 24)); } +UPB_INLINE envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_case(const envoy_api_v2_core_HealthCheck_CustomHealthCheck* msg) { return (envoy_api_v2_core_HealthCheck_CustomHealthCheck_config_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); } UPB_INLINE upb_strview envoy_api_v2_core_HealthCheck_CustomHealthCheck_name(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } UPB_INLINE bool envoy_api_v2_core_HealthCheck_CustomHealthCheck_has_config(const envoy_api_v2_core_HealthCheck_CustomHealthCheck *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); } @@ -550,7 +587,6 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_core_HealthCheck_CustomHealt return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c b/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c index fa8855d20b9..896cfe25638 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c @@ -56,18 +56,19 @@ static const upb_msglayout *const envoy_api_v2_core_Http2ProtocolOptions_submsgs &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_core_Http2ProtocolOptions__fields[5] = { +static const upb_msglayout_field envoy_api_v2_core_Http2ProtocolOptions__fields[6] = { {1, UPB_SIZE(4, 8), 0, 0, 11, 1}, {2, UPB_SIZE(8, 16), 0, 0, 11, 1}, {3, UPB_SIZE(12, 24), 0, 0, 11, 1}, {4, UPB_SIZE(16, 32), 0, 0, 11, 1}, {5, UPB_SIZE(0, 0), 0, 0, 8, 1}, + {6, UPB_SIZE(1, 1), 0, 0, 8, 1}, }; const upb_msglayout envoy_api_v2_core_Http2ProtocolOptions_msginit = { &envoy_api_v2_core_Http2ProtocolOptions_submsgs[0], &envoy_api_v2_core_Http2ProtocolOptions__fields[0], - UPB_SIZE(20, 40), 5, false, + UPB_SIZE(20, 40), 6, false, }; static const upb_msglayout *const envoy_api_v2_core_GrpcProtocolOptions_submsgs[1] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h b/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h index db352e43d87..039b221ef2a 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_CORE_PROTOCOL_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -42,17 +42,16 @@ extern const upb_msglayout google_protobuf_BoolValue_msginit; extern const upb_msglayout google_protobuf_Duration_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; -/* Enums */ - /* envoy.api.v2.core.TcpProtocolOptions */ UPB_INLINE envoy_api_v2_core_TcpProtocolOptions *envoy_api_v2_core_TcpProtocolOptions_new(upb_arena *arena) { return (envoy_api_v2_core_TcpProtocolOptions *)upb_msg_new(&envoy_api_v2_core_TcpProtocolOptions_msginit, arena); } -UPB_INLINE envoy_api_v2_core_TcpProtocolOptions *envoy_api_v2_core_TcpProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_TcpProtocolOptions *envoy_api_v2_core_TcpProtocolOptions_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_TcpProtocolOptions *ret = envoy_api_v2_core_TcpProtocolOptions_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_TcpProtocolOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_TcpProtocolOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_TcpProtocolOptions_serialize(const envoy_api_v2_core_TcpProtocolOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_TcpProtocolOptions_msginit, arena, len); @@ -60,15 +59,15 @@ UPB_INLINE char *envoy_api_v2_core_TcpProtocolOptions_serialize(const envoy_api_ - /* envoy.api.v2.core.HttpProtocolOptions */ UPB_INLINE envoy_api_v2_core_HttpProtocolOptions *envoy_api_v2_core_HttpProtocolOptions_new(upb_arena *arena) { return (envoy_api_v2_core_HttpProtocolOptions *)upb_msg_new(&envoy_api_v2_core_HttpProtocolOptions_msginit, arena); } -UPB_INLINE envoy_api_v2_core_HttpProtocolOptions *envoy_api_v2_core_HttpProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_HttpProtocolOptions *envoy_api_v2_core_HttpProtocolOptions_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_HttpProtocolOptions *ret = envoy_api_v2_core_HttpProtocolOptions_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_HttpProtocolOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_HttpProtocolOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_HttpProtocolOptions_serialize(const envoy_api_v2_core_HttpProtocolOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_HttpProtocolOptions_msginit, arena, len); @@ -89,15 +88,15 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_core_HttpProtocolOption return sub; } - /* envoy.api.v2.core.Http1ProtocolOptions */ UPB_INLINE envoy_api_v2_core_Http1ProtocolOptions *envoy_api_v2_core_Http1ProtocolOptions_new(upb_arena *arena) { return (envoy_api_v2_core_Http1ProtocolOptions *)upb_msg_new(&envoy_api_v2_core_Http1ProtocolOptions_msginit, arena); } -UPB_INLINE envoy_api_v2_core_Http1ProtocolOptions *envoy_api_v2_core_Http1ProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_Http1ProtocolOptions *envoy_api_v2_core_Http1ProtocolOptions_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_Http1ProtocolOptions *ret = envoy_api_v2_core_Http1ProtocolOptions_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Http1ProtocolOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Http1ProtocolOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_Http1ProtocolOptions_serialize(const envoy_api_v2_core_Http1ProtocolOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_Http1ProtocolOptions_msginit, arena, len); @@ -126,15 +125,15 @@ UPB_INLINE void envoy_api_v2_core_Http1ProtocolOptions_set_default_host_for_http UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; } - /* envoy.api.v2.core.Http2ProtocolOptions */ UPB_INLINE envoy_api_v2_core_Http2ProtocolOptions *envoy_api_v2_core_Http2ProtocolOptions_new(upb_arena *arena) { return (envoy_api_v2_core_Http2ProtocolOptions *)upb_msg_new(&envoy_api_v2_core_Http2ProtocolOptions_msginit, arena); } -UPB_INLINE envoy_api_v2_core_Http2ProtocolOptions *envoy_api_v2_core_Http2ProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_Http2ProtocolOptions *envoy_api_v2_core_Http2ProtocolOptions_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_Http2ProtocolOptions *ret = envoy_api_v2_core_Http2ProtocolOptions_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_Http2ProtocolOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_Http2ProtocolOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_Http2ProtocolOptions_serialize(const envoy_api_v2_core_Http2ProtocolOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_Http2ProtocolOptions_msginit, arena, len); @@ -145,6 +144,7 @@ UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2Prot UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_initial_stream_window_size(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)); } UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOptions_initial_connection_window_size(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 32)); } UPB_INLINE bool envoy_api_v2_core_Http2ProtocolOptions_allow_connect(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } +UPB_INLINE bool envoy_api_v2_core_Http2ProtocolOptions_allow_metadata(const envoy_api_v2_core_Http2ProtocolOptions *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)); } UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_hpack_table_size(envoy_api_v2_core_Http2ProtocolOptions *msg, struct google_protobuf_UInt32Value* value) { UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(4, 8)) = value; @@ -197,16 +197,19 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_core_Http2ProtocolOp UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_allow_connect(envoy_api_v2_core_Http2ProtocolOptions *msg, bool value) { UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; } - +UPB_INLINE void envoy_api_v2_core_Http2ProtocolOptions_set_allow_metadata(envoy_api_v2_core_Http2ProtocolOptions *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; +} /* envoy.api.v2.core.GrpcProtocolOptions */ UPB_INLINE envoy_api_v2_core_GrpcProtocolOptions *envoy_api_v2_core_GrpcProtocolOptions_new(upb_arena *arena) { return (envoy_api_v2_core_GrpcProtocolOptions *)upb_msg_new(&envoy_api_v2_core_GrpcProtocolOptions_msginit, arena); } -UPB_INLINE envoy_api_v2_core_GrpcProtocolOptions *envoy_api_v2_core_GrpcProtocolOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_core_GrpcProtocolOptions *envoy_api_v2_core_GrpcProtocolOptions_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_core_GrpcProtocolOptions *ret = envoy_api_v2_core_GrpcProtocolOptions_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_core_GrpcProtocolOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_core_GrpcProtocolOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_core_GrpcProtocolOptions_serialize(const envoy_api_v2_core_GrpcProtocolOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_core_GrpcProtocolOptions_msginit, arena, len); @@ -227,7 +230,6 @@ UPB_INLINE struct envoy_api_v2_core_Http2ProtocolOptions* envoy_api_v2_core_Grpc return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c b/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c index 2f67f55a8a3..c51a38e7c1c 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c @@ -36,31 +36,33 @@ const upb_msglayout envoy_api_v2_DiscoveryRequest_msginit = { UPB_SIZE(40, 80), 6, false, }; -static const upb_msglayout *const envoy_api_v2_DiscoveryResponse_submsgs[1] = { +static const upb_msglayout *const envoy_api_v2_DiscoveryResponse_submsgs[2] = { + &envoy_api_v2_core_ControlPlane_msginit, &google_protobuf_Any_msginit, }; -static const upb_msglayout_field envoy_api_v2_DiscoveryResponse__fields[5] = { +static const upb_msglayout_field envoy_api_v2_DiscoveryResponse__fields[6] = { {1, UPB_SIZE(4, 8), 0, 0, 9, 1}, - {2, UPB_SIZE(28, 56), 0, 0, 11, 3}, + {2, UPB_SIZE(32, 64), 0, 1, 11, 3}, {3, UPB_SIZE(0, 0), 0, 0, 8, 1}, {4, UPB_SIZE(12, 24), 0, 0, 9, 1}, {5, UPB_SIZE(20, 40), 0, 0, 9, 1}, + {6, UPB_SIZE(28, 56), 0, 0, 11, 1}, }; const upb_msglayout envoy_api_v2_DiscoveryResponse_msginit = { &envoy_api_v2_DiscoveryResponse_submsgs[0], &envoy_api_v2_DiscoveryResponse__fields[0], - UPB_SIZE(32, 64), 5, false, + UPB_SIZE(40, 80), 6, false, }; -static const upb_msglayout *const envoy_api_v2_IncrementalDiscoveryRequest_submsgs[3] = { - &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, +static const upb_msglayout *const envoy_api_v2_DeltaDiscoveryRequest_submsgs[3] = { + &envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, &envoy_api_v2_core_Node_msginit, &google_rpc_Status_msginit, }; -static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryRequest__fields[7] = { +static const upb_msglayout_field envoy_api_v2_DeltaDiscoveryRequest__fields[7] = { {1, UPB_SIZE(16, 32), 0, 1, 11, 1}, {2, UPB_SIZE(0, 0), 0, 0, 9, 1}, {3, UPB_SIZE(24, 48), 0, 0, 9, 3}, @@ -70,53 +72,56 @@ static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryRequest__field {7, UPB_SIZE(20, 40), 0, 2, 11, 1}, }; -const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_msginit = { - &envoy_api_v2_IncrementalDiscoveryRequest_submsgs[0], - &envoy_api_v2_IncrementalDiscoveryRequest__fields[0], +const upb_msglayout envoy_api_v2_DeltaDiscoveryRequest_msginit = { + &envoy_api_v2_DeltaDiscoveryRequest_submsgs[0], + &envoy_api_v2_DeltaDiscoveryRequest__fields[0], UPB_SIZE(40, 80), 7, false, }; -static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry__fields[2] = { +static const upb_msglayout_field envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry__fields[2] = { {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, {2, UPB_SIZE(8, 16), 0, 0, 9, 1}, }; -const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit = { +const upb_msglayout envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit = { NULL, - &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry__fields[0], + &envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry__fields[0], UPB_SIZE(16, 32), 2, false, }; -static const upb_msglayout *const envoy_api_v2_IncrementalDiscoveryResponse_submsgs[1] = { +static const upb_msglayout *const envoy_api_v2_DeltaDiscoveryResponse_submsgs[1] = { &envoy_api_v2_Resource_msginit, }; -static const upb_msglayout_field envoy_api_v2_IncrementalDiscoveryResponse__fields[4] = { +static const upb_msglayout_field envoy_api_v2_DeltaDiscoveryResponse__fields[5] = { {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, - {2, UPB_SIZE(16, 32), 0, 0, 11, 3}, - {5, UPB_SIZE(8, 16), 0, 0, 9, 1}, - {6, UPB_SIZE(20, 40), 0, 0, 9, 3}, + {2, UPB_SIZE(24, 48), 0, 0, 11, 3}, + {4, UPB_SIZE(8, 16), 0, 0, 9, 1}, + {5, UPB_SIZE(16, 32), 0, 0, 9, 1}, + {6, UPB_SIZE(28, 56), 0, 0, 9, 3}, }; -const upb_msglayout envoy_api_v2_IncrementalDiscoveryResponse_msginit = { - &envoy_api_v2_IncrementalDiscoveryResponse_submsgs[0], - &envoy_api_v2_IncrementalDiscoveryResponse__fields[0], - UPB_SIZE(24, 48), 4, false, +const upb_msglayout envoy_api_v2_DeltaDiscoveryResponse_msginit = { + &envoy_api_v2_DeltaDiscoveryResponse_submsgs[0], + &envoy_api_v2_DeltaDiscoveryResponse__fields[0], + UPB_SIZE(32, 64), 5, false, }; static const upb_msglayout *const envoy_api_v2_Resource_submsgs[1] = { &google_protobuf_Any_msginit, }; -static const upb_msglayout_field envoy_api_v2_Resource__fields[2] = { +static const upb_msglayout_field envoy_api_v2_Resource__fields[4] = { {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, - {2, UPB_SIZE(8, 16), 0, 0, 11, 1}, + {2, UPB_SIZE(16, 32), 0, 0, 11, 1}, + {3, UPB_SIZE(8, 16), 0, 0, 9, 1}, + {4, UPB_SIZE(20, 40), 0, 0, 9, 3}, }; const upb_msglayout envoy_api_v2_Resource_msginit = { &envoy_api_v2_Resource_submsgs[0], &envoy_api_v2_Resource__fields[0], - UPB_SIZE(16, 32), 2, false, + UPB_SIZE(24, 48), 4, false, }; #include "upb/port_undef.inc" diff --git a/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h b/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h index 7044ea956bf..b2475bee1b6 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h @@ -10,52 +10,53 @@ #define ENVOY_API_V2_DISCOVERY_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif struct envoy_api_v2_DiscoveryRequest; struct envoy_api_v2_DiscoveryResponse; -struct envoy_api_v2_IncrementalDiscoveryRequest; -struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry; -struct envoy_api_v2_IncrementalDiscoveryResponse; +struct envoy_api_v2_DeltaDiscoveryRequest; +struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry; +struct envoy_api_v2_DeltaDiscoveryResponse; struct envoy_api_v2_Resource; typedef struct envoy_api_v2_DiscoveryRequest envoy_api_v2_DiscoveryRequest; typedef struct envoy_api_v2_DiscoveryResponse envoy_api_v2_DiscoveryResponse; -typedef struct envoy_api_v2_IncrementalDiscoveryRequest envoy_api_v2_IncrementalDiscoveryRequest; -typedef struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry; -typedef struct envoy_api_v2_IncrementalDiscoveryResponse envoy_api_v2_IncrementalDiscoveryResponse; +typedef struct envoy_api_v2_DeltaDiscoveryRequest envoy_api_v2_DeltaDiscoveryRequest; +typedef struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry; +typedef struct envoy_api_v2_DeltaDiscoveryResponse envoy_api_v2_DeltaDiscoveryResponse; typedef struct envoy_api_v2_Resource envoy_api_v2_Resource; extern const upb_msglayout envoy_api_v2_DiscoveryRequest_msginit; extern const upb_msglayout envoy_api_v2_DiscoveryResponse_msginit; -extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_msginit; -extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit; -extern const upb_msglayout envoy_api_v2_IncrementalDiscoveryResponse_msginit; +extern const upb_msglayout envoy_api_v2_DeltaDiscoveryRequest_msginit; +extern const upb_msglayout envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit; +extern const upb_msglayout envoy_api_v2_DeltaDiscoveryResponse_msginit; extern const upb_msglayout envoy_api_v2_Resource_msginit; +struct envoy_api_v2_core_ControlPlane; struct envoy_api_v2_core_Node; struct google_protobuf_Any; struct google_rpc_Status; +extern const upb_msglayout envoy_api_v2_core_ControlPlane_msginit; extern const upb_msglayout envoy_api_v2_core_Node_msginit; extern const upb_msglayout google_protobuf_Any_msginit; extern const upb_msglayout google_rpc_Status_msginit; -/* Enums */ - /* envoy.api.v2.DiscoveryRequest */ UPB_INLINE envoy_api_v2_DiscoveryRequest *envoy_api_v2_DiscoveryRequest_new(upb_arena *arena) { return (envoy_api_v2_DiscoveryRequest *)upb_msg_new(&envoy_api_v2_DiscoveryRequest_msginit, arena); } -UPB_INLINE envoy_api_v2_DiscoveryRequest *envoy_api_v2_DiscoveryRequest_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_DiscoveryRequest *envoy_api_v2_DiscoveryRequest_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_DiscoveryRequest *ret = envoy_api_v2_DiscoveryRequest_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_DiscoveryRequest_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DiscoveryRequest_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_DiscoveryRequest_serialize(const envoy_api_v2_DiscoveryRequest *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_DiscoveryRequest_msginit, arena, len); @@ -112,39 +113,40 @@ UPB_INLINE struct google_rpc_Status* envoy_api_v2_DiscoveryRequest_mutable_error return sub; } - /* envoy.api.v2.DiscoveryResponse */ UPB_INLINE envoy_api_v2_DiscoveryResponse *envoy_api_v2_DiscoveryResponse_new(upb_arena *arena) { return (envoy_api_v2_DiscoveryResponse *)upb_msg_new(&envoy_api_v2_DiscoveryResponse_msginit, arena); } -UPB_INLINE envoy_api_v2_DiscoveryResponse *envoy_api_v2_DiscoveryResponse_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_DiscoveryResponse *envoy_api_v2_DiscoveryResponse_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_DiscoveryResponse *ret = envoy_api_v2_DiscoveryResponse_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_DiscoveryResponse_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DiscoveryResponse_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_DiscoveryResponse_serialize(const envoy_api_v2_DiscoveryResponse *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_DiscoveryResponse_msginit, arena, len); } UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_version_info(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } -UPB_INLINE const struct google_protobuf_Any* const* envoy_api_v2_DiscoveryResponse_resources(const envoy_api_v2_DiscoveryResponse *msg, size_t *len) { return (const struct google_protobuf_Any* const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); } +UPB_INLINE const struct google_protobuf_Any* const* envoy_api_v2_DiscoveryResponse_resources(const envoy_api_v2_DiscoveryResponse *msg, size_t *len) { return (const struct google_protobuf_Any* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); } UPB_INLINE bool envoy_api_v2_DiscoveryResponse_canary(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_type_url(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); } UPB_INLINE upb_strview envoy_api_v2_DiscoveryResponse_nonce(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); } +UPB_INLINE const struct envoy_api_v2_core_ControlPlane* envoy_api_v2_DiscoveryResponse_control_plane(const envoy_api_v2_DiscoveryResponse *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_ControlPlane*, UPB_SIZE(28, 56)); } UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_version_info(envoy_api_v2_DiscoveryResponse *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; } UPB_INLINE struct google_protobuf_Any** envoy_api_v2_DiscoveryResponse_mutable_resources(envoy_api_v2_DiscoveryResponse *msg, size_t *len) { - return (struct google_protobuf_Any**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); + return (struct google_protobuf_Any**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len); } UPB_INLINE struct google_protobuf_Any** envoy_api_v2_DiscoveryResponse_resize_resources(envoy_api_v2_DiscoveryResponse *msg, size_t len, upb_arena *arena) { - return (struct google_protobuf_Any**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (struct google_protobuf_Any**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct google_protobuf_Any* envoy_api_v2_DiscoveryResponse_add_resources(envoy_api_v2_DiscoveryResponse *msg, upb_arena *arena) { struct google_protobuf_Any* sub = (struct google_protobuf_Any*)upb_msg_new(&google_protobuf_Any_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } @@ -157,188 +159,206 @@ UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_type_url(envoy_api_v2_Discove UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_nonce(envoy_api_v2_DiscoveryResponse *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value; } +UPB_INLINE void envoy_api_v2_DiscoveryResponse_set_control_plane(envoy_api_v2_DiscoveryResponse *msg, struct envoy_api_v2_core_ControlPlane* value) { + UPB_FIELD_AT(msg, struct envoy_api_v2_core_ControlPlane*, UPB_SIZE(28, 56)) = value; +} +UPB_INLINE struct envoy_api_v2_core_ControlPlane* envoy_api_v2_DiscoveryResponse_mutable_control_plane(envoy_api_v2_DiscoveryResponse *msg, upb_arena *arena) { + struct envoy_api_v2_core_ControlPlane* sub = (struct envoy_api_v2_core_ControlPlane*)envoy_api_v2_DiscoveryResponse_control_plane(msg); + if (sub == NULL) { + sub = (struct envoy_api_v2_core_ControlPlane*)upb_msg_new(&envoy_api_v2_core_ControlPlane_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_DiscoveryResponse_set_control_plane(msg, sub); + } + return sub; +} +/* envoy.api.v2.DeltaDiscoveryRequest */ -/* envoy.api.v2.IncrementalDiscoveryRequest */ - -UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest *envoy_api_v2_IncrementalDiscoveryRequest_new(upb_arena *arena) { - return (envoy_api_v2_IncrementalDiscoveryRequest *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_msginit, arena); +UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest *envoy_api_v2_DeltaDiscoveryRequest_new(upb_arena *arena) { + return (envoy_api_v2_DeltaDiscoveryRequest *)upb_msg_new(&envoy_api_v2_DeltaDiscoveryRequest_msginit, arena); } -UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest *envoy_api_v2_IncrementalDiscoveryRequest_parsenew(upb_strview buf, upb_arena *arena) { - envoy_api_v2_IncrementalDiscoveryRequest *ret = envoy_api_v2_IncrementalDiscoveryRequest_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryRequest_msginit)) ? ret : NULL; +UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest *envoy_api_v2_DeltaDiscoveryRequest_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_DeltaDiscoveryRequest *ret = envoy_api_v2_DeltaDiscoveryRequest_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DeltaDiscoveryRequest_msginit, arena)) ? ret : NULL; } -UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryRequest_serialize(const envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryRequest_msginit, arena, len); +UPB_INLINE char *envoy_api_v2_DeltaDiscoveryRequest_serialize(const envoy_api_v2_DeltaDiscoveryRequest *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_DeltaDiscoveryRequest_msginit, arena, len); } -UPB_INLINE const struct envoy_api_v2_core_Node* envoy_api_v2_IncrementalDiscoveryRequest_node(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Node*, UPB_SIZE(16, 32)); } -UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_type_url(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } -UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryRequest_resource_names_subscribe(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } -UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryRequest_resource_names_unsubscribe(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); } -UPB_INLINE const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* const* envoy_api_v2_IncrementalDiscoveryRequest_initial_resource_versions(const envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { return (const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); } -UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_response_nonce(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } -UPB_INLINE const struct google_rpc_Status* envoy_api_v2_IncrementalDiscoveryRequest_error_detail(const envoy_api_v2_IncrementalDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct google_rpc_Status*, UPB_SIZE(20, 40)); } +UPB_INLINE const struct envoy_api_v2_core_Node* envoy_api_v2_DeltaDiscoveryRequest_node(const envoy_api_v2_DeltaDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Node*, UPB_SIZE(16, 32)); } +UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryRequest_type_url(const envoy_api_v2_DeltaDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview const* envoy_api_v2_DeltaDiscoveryRequest_resource_names_subscribe(const envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } +UPB_INLINE upb_strview const* envoy_api_v2_DeltaDiscoveryRequest_resource_names_unsubscribe(const envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); } +UPB_INLINE const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry* const* envoy_api_v2_DeltaDiscoveryRequest_initial_resource_versions(const envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { return (const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(32, 64), len); } +UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryRequest_response_nonce(const envoy_api_v2_DeltaDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } +UPB_INLINE const struct google_rpc_Status* envoy_api_v2_DeltaDiscoveryRequest_error_detail(const envoy_api_v2_DeltaDiscoveryRequest *msg) { return UPB_FIELD_AT(msg, const struct google_rpc_Status*, UPB_SIZE(20, 40)); } -UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_node(envoy_api_v2_IncrementalDiscoveryRequest *msg, struct envoy_api_v2_core_Node* value) { +UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_set_node(envoy_api_v2_DeltaDiscoveryRequest *msg, struct envoy_api_v2_core_Node* value) { UPB_FIELD_AT(msg, struct envoy_api_v2_core_Node*, UPB_SIZE(16, 32)) = value; } -UPB_INLINE struct envoy_api_v2_core_Node* envoy_api_v2_IncrementalDiscoveryRequest_mutable_node(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) { - struct envoy_api_v2_core_Node* sub = (struct envoy_api_v2_core_Node*)envoy_api_v2_IncrementalDiscoveryRequest_node(msg); +UPB_INLINE struct envoy_api_v2_core_Node* envoy_api_v2_DeltaDiscoveryRequest_mutable_node(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_arena *arena) { + struct envoy_api_v2_core_Node* sub = (struct envoy_api_v2_core_Node*)envoy_api_v2_DeltaDiscoveryRequest_node(msg); if (sub == NULL) { sub = (struct envoy_api_v2_core_Node*)upb_msg_new(&envoy_api_v2_core_Node_msginit, arena); if (!sub) return NULL; - envoy_api_v2_IncrementalDiscoveryRequest_set_node(msg, sub); + envoy_api_v2_DeltaDiscoveryRequest_set_node(msg, sub); } return sub; } -UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_type_url(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview value) { +UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_set_type_url(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } -UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_mutable_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { +UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryRequest_mutable_resource_names_subscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); } -UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_resize_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) { +UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryRequest_resize_resource_names_subscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t len, upb_arena *arena) { return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); } -UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryRequest_add_resource_names_subscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview val, upb_arena *arena) { +UPB_INLINE bool envoy_api_v2_DeltaDiscoveryRequest_add_resource_names_subscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_strview val, upb_arena *arena) { return _upb_array_append_accessor( msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } -UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_mutable_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { +UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryRequest_mutable_resource_names_unsubscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); } -UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryRequest_resize_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) { +UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryRequest_resize_resource_names_unsubscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t len, upb_arena *arena) { return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); } -UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryRequest_add_resource_names_unsubscribe(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview val, upb_arena *arena) { +UPB_INLINE bool envoy_api_v2_DeltaDiscoveryRequest_add_resource_names_unsubscribe(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_strview val, upb_arena *arena) { return _upb_array_append_accessor( msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } -UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_IncrementalDiscoveryRequest_mutable_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t *len) { - return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len); +UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_DeltaDiscoveryRequest_mutable_initial_resource_versions(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t *len) { + return (envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len); } -UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_IncrementalDiscoveryRequest_resize_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry** envoy_api_v2_DeltaDiscoveryRequest_resize_initial_resource_versions(envoy_api_v2_DeltaDiscoveryRequest *msg, size_t len, upb_arena *arena) { + return (envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } -UPB_INLINE struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* envoy_api_v2_IncrementalDiscoveryRequest_add_initial_resource_versions(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) { - struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry* sub = (struct envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry*)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena); +UPB_INLINE struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry* envoy_api_v2_DeltaDiscoveryRequest_add_initial_resource_versions(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_arena *arena) { + struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry* sub = (struct envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry*)upb_msg_new(&envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena); bool ok = _upb_array_append_accessor( msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } -UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_response_nonce(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_strview value) { +UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_set_response_nonce(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; } -UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_set_error_detail(envoy_api_v2_IncrementalDiscoveryRequest *msg, struct google_rpc_Status* value) { +UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_set_error_detail(envoy_api_v2_DeltaDiscoveryRequest *msg, struct google_rpc_Status* value) { UPB_FIELD_AT(msg, struct google_rpc_Status*, UPB_SIZE(20, 40)) = value; } -UPB_INLINE struct google_rpc_Status* envoy_api_v2_IncrementalDiscoveryRequest_mutable_error_detail(envoy_api_v2_IncrementalDiscoveryRequest *msg, upb_arena *arena) { - struct google_rpc_Status* sub = (struct google_rpc_Status*)envoy_api_v2_IncrementalDiscoveryRequest_error_detail(msg); +UPB_INLINE struct google_rpc_Status* envoy_api_v2_DeltaDiscoveryRequest_mutable_error_detail(envoy_api_v2_DeltaDiscoveryRequest *msg, upb_arena *arena) { + struct google_rpc_Status* sub = (struct google_rpc_Status*)envoy_api_v2_DeltaDiscoveryRequest_error_detail(msg); if (sub == NULL) { sub = (struct google_rpc_Status*)upb_msg_new(&google_rpc_Status_msginit, arena); if (!sub) return NULL; - envoy_api_v2_IncrementalDiscoveryRequest_set_error_detail(msg, sub); + envoy_api_v2_DeltaDiscoveryRequest_set_error_detail(msg, sub); } return sub; } +/* envoy.api.v2.DeltaDiscoveryRequest.InitialResourceVersionsEntry */ -/* envoy.api.v2.IncrementalDiscoveryRequest.InitialResourceVersionsEntry */ - -UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_new(upb_arena *arena) { - return (envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena); +UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_new(upb_arena *arena) { + return (envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *)upb_msg_new(&envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena); } -UPB_INLINE envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_parsenew(upb_strview buf, upb_arena *arena) { - envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *ret = envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit)) ? ret : NULL; +UPB_INLINE envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *ret = envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena)) ? ret : NULL; } -UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_serialize(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena, len); +UPB_INLINE char *envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_serialize(const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_msginit, arena, len); } -UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_key(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } -UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_value(const envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } +UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_key(const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_value(const envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } -UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_set_key(envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) { +UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_set_key(envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } -UPB_INLINE void envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry_set_value(envoy_api_v2_IncrementalDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) { +UPB_INLINE void envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry_set_value(envoy_api_v2_DeltaDiscoveryRequest_InitialResourceVersionsEntry *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; } +/* envoy.api.v2.DeltaDiscoveryResponse */ -/* envoy.api.v2.IncrementalDiscoveryResponse */ - -UPB_INLINE envoy_api_v2_IncrementalDiscoveryResponse *envoy_api_v2_IncrementalDiscoveryResponse_new(upb_arena *arena) { - return (envoy_api_v2_IncrementalDiscoveryResponse *)upb_msg_new(&envoy_api_v2_IncrementalDiscoveryResponse_msginit, arena); +UPB_INLINE envoy_api_v2_DeltaDiscoveryResponse *envoy_api_v2_DeltaDiscoveryResponse_new(upb_arena *arena) { + return (envoy_api_v2_DeltaDiscoveryResponse *)upb_msg_new(&envoy_api_v2_DeltaDiscoveryResponse_msginit, arena); } -UPB_INLINE envoy_api_v2_IncrementalDiscoveryResponse *envoy_api_v2_IncrementalDiscoveryResponse_parsenew(upb_strview buf, upb_arena *arena) { - envoy_api_v2_IncrementalDiscoveryResponse *ret = envoy_api_v2_IncrementalDiscoveryResponse_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_IncrementalDiscoveryResponse_msginit)) ? ret : NULL; +UPB_INLINE envoy_api_v2_DeltaDiscoveryResponse *envoy_api_v2_DeltaDiscoveryResponse_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_DeltaDiscoveryResponse *ret = envoy_api_v2_DeltaDiscoveryResponse_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_DeltaDiscoveryResponse_msginit, arena)) ? ret : NULL; } -UPB_INLINE char *envoy_api_v2_IncrementalDiscoveryResponse_serialize(const envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_arena *arena, size_t *len) { - return upb_encode(msg, &envoy_api_v2_IncrementalDiscoveryResponse_msginit, arena, len); +UPB_INLINE char *envoy_api_v2_DeltaDiscoveryResponse_serialize(const envoy_api_v2_DeltaDiscoveryResponse *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_DeltaDiscoveryResponse_msginit, arena, len); } -UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryResponse_system_version_info(const envoy_api_v2_IncrementalDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } -UPB_INLINE const envoy_api_v2_Resource* const* envoy_api_v2_IncrementalDiscoveryResponse_resources(const envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) { return (const envoy_api_v2_Resource* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } -UPB_INLINE upb_strview envoy_api_v2_IncrementalDiscoveryResponse_nonce(const envoy_api_v2_IncrementalDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } -UPB_INLINE upb_strview const* envoy_api_v2_IncrementalDiscoveryResponse_removed_resources(const envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } +UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryResponse_system_version_info(const envoy_api_v2_DeltaDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE const envoy_api_v2_Resource* const* envoy_api_v2_DeltaDiscoveryResponse_resources(const envoy_api_v2_DeltaDiscoveryResponse *msg, size_t *len) { return (const envoy_api_v2_Resource* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } +UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryResponse_type_url(const envoy_api_v2_DeltaDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } +UPB_INLINE upb_strview envoy_api_v2_DeltaDiscoveryResponse_nonce(const envoy_api_v2_DeltaDiscoveryResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)); } +UPB_INLINE upb_strview const* envoy_api_v2_DeltaDiscoveryResponse_removed_resources(const envoy_api_v2_DeltaDiscoveryResponse *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(28, 56), len); } -UPB_INLINE void envoy_api_v2_IncrementalDiscoveryResponse_set_system_version_info(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview value) { +UPB_INLINE void envoy_api_v2_DeltaDiscoveryResponse_set_system_version_info(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } -UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_IncrementalDiscoveryResponse_mutable_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) { - return (envoy_api_v2_Resource**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); +UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_DeltaDiscoveryResponse_mutable_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, size_t *len) { + return (envoy_api_v2_Resource**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); } -UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_IncrementalDiscoveryResponse_resize_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_Resource**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +UPB_INLINE envoy_api_v2_Resource** envoy_api_v2_DeltaDiscoveryResponse_resize_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, size_t len, upb_arena *arena) { + return (envoy_api_v2_Resource**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } -UPB_INLINE struct envoy_api_v2_Resource* envoy_api_v2_IncrementalDiscoveryResponse_add_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_arena *arena) { +UPB_INLINE struct envoy_api_v2_Resource* envoy_api_v2_DeltaDiscoveryResponse_add_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_arena *arena) { struct envoy_api_v2_Resource* sub = (struct envoy_api_v2_Resource*)upb_msg_new(&envoy_api_v2_Resource_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } -UPB_INLINE void envoy_api_v2_IncrementalDiscoveryResponse_set_nonce(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview value) { +UPB_INLINE void envoy_api_v2_DeltaDiscoveryResponse_set_type_url(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; } -UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryResponse_mutable_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t *len) { - return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); +UPB_INLINE void envoy_api_v2_DeltaDiscoveryResponse_set_nonce(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value; } -UPB_INLINE upb_strview* envoy_api_v2_IncrementalDiscoveryResponse_resize_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryResponse_mutable_removed_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); } -UPB_INLINE bool envoy_api_v2_IncrementalDiscoveryResponse_add_removed_resources(envoy_api_v2_IncrementalDiscoveryResponse *msg, upb_strview val, upb_arena *arena) { +UPB_INLINE upb_strview* envoy_api_v2_DeltaDiscoveryResponse_resize_removed_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool envoy_api_v2_DeltaDiscoveryResponse_add_removed_resources(envoy_api_v2_DeltaDiscoveryResponse *msg, upb_strview val, upb_arena *arena) { return _upb_array_append_accessor( - msg, UPB_SIZE(20, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); + msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } - /* envoy.api.v2.Resource */ UPB_INLINE envoy_api_v2_Resource *envoy_api_v2_Resource_new(upb_arena *arena) { return (envoy_api_v2_Resource *)upb_msg_new(&envoy_api_v2_Resource_msginit, arena); } -UPB_INLINE envoy_api_v2_Resource *envoy_api_v2_Resource_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_Resource *envoy_api_v2_Resource_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_Resource *ret = envoy_api_v2_Resource_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_Resource_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_Resource_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_Resource_serialize(const envoy_api_v2_Resource *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_Resource_msginit, arena, len); } UPB_INLINE upb_strview envoy_api_v2_Resource_version(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } -UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_Resource_resource(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(8, 16)); } +UPB_INLINE const struct google_protobuf_Any* envoy_api_v2_Resource_resource(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Any*, UPB_SIZE(16, 32)); } +UPB_INLINE upb_strview envoy_api_v2_Resource_name(const envoy_api_v2_Resource *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } +UPB_INLINE upb_strview const* envoy_api_v2_Resource_aliases(const envoy_api_v2_Resource *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } UPB_INLINE void envoy_api_v2_Resource_set_version(envoy_api_v2_Resource *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } UPB_INLINE void envoy_api_v2_Resource_set_resource(envoy_api_v2_Resource *msg, struct google_protobuf_Any* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(8, 16)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Any*, UPB_SIZE(16, 32)) = value; } UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Resource_mutable_resource(envoy_api_v2_Resource *msg, upb_arena *arena) { struct google_protobuf_Any* sub = (struct google_protobuf_Any*)envoy_api_v2_Resource_resource(msg); @@ -349,7 +369,19 @@ UPB_INLINE struct google_protobuf_Any* envoy_api_v2_Resource_mutable_resource(en } return sub; } - +UPB_INLINE void envoy_api_v2_Resource_set_name(envoy_api_v2_Resource *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; +} +UPB_INLINE upb_strview* envoy_api_v2_Resource_mutable_aliases(envoy_api_v2_Resource *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); +} +UPB_INLINE upb_strview* envoy_api_v2_Resource_resize_aliases(envoy_api_v2_Resource *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool envoy_api_v2_Resource_add_aliases(envoy_api_v2_Resource *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(20, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} #ifdef __cplusplus } /* extern "C" */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c b/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c index d6f074b0879..b8f5b57c140 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c @@ -16,40 +16,60 @@ #include "validate/validate.upb.h" #include "gogoproto/gogo.upb.h" #include "google/protobuf/wrappers.upb.h" +#include "google/protobuf/duration.upb.h" #include "upb/port_def.inc" -static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_submsgs[2] = { +static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_submsgs[3] = { + &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, &envoy_api_v2_ClusterLoadAssignment_Policy_msginit, &envoy_api_v2_endpoint_LocalityLbEndpoints_msginit, }; -static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment__fields[3] = { +static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment__fields[4] = { {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, - {2, UPB_SIZE(12, 24), 0, 1, 11, 3}, - {4, UPB_SIZE(8, 16), 0, 0, 11, 1}, + {2, UPB_SIZE(12, 24), 0, 2, 11, 3}, + {4, UPB_SIZE(8, 16), 0, 1, 11, 1}, + {5, UPB_SIZE(16, 32), 0, 0, 11, 3}, }; const upb_msglayout envoy_api_v2_ClusterLoadAssignment_msginit = { &envoy_api_v2_ClusterLoadAssignment_submsgs[0], &envoy_api_v2_ClusterLoadAssignment__fields[0], - UPB_SIZE(16, 32), 3, false, + UPB_SIZE(24, 48), 4, false, }; -static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_Policy_submsgs[2] = { +static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_submsgs[1] = { + &envoy_api_v2_endpoint_Endpoint_msginit, +}; + +static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 16), 0, 0, 11, 1}, +}; + +const upb_msglayout envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit = { + &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_submsgs[0], + &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_Policy_submsgs[3] = { &envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, + &google_protobuf_Duration_msginit, &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment_Policy__fields[2] = { - {2, UPB_SIZE(4, 8), 0, 0, 11, 3}, - {3, UPB_SIZE(0, 0), 0, 1, 11, 1}, +static const upb_msglayout_field envoy_api_v2_ClusterLoadAssignment_Policy__fields[3] = { + {2, UPB_SIZE(8, 16), 0, 0, 11, 3}, + {3, UPB_SIZE(0, 0), 0, 2, 11, 1}, + {4, UPB_SIZE(4, 8), 0, 1, 11, 1}, }; const upb_msglayout envoy_api_v2_ClusterLoadAssignment_Policy_msginit = { &envoy_api_v2_ClusterLoadAssignment_Policy_submsgs[0], &envoy_api_v2_ClusterLoadAssignment_Policy__fields[0], - UPB_SIZE(8, 16), 2, false, + UPB_SIZE(12, 24), 3, false, }; static const upb_msglayout *const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_submsgs[1] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h b/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h index a9b6f5f9c3d..334147090d4 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h @@ -10,43 +10,49 @@ #define ENVOY_API_V2_EDS_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif struct envoy_api_v2_ClusterLoadAssignment; +struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry; struct envoy_api_v2_ClusterLoadAssignment_Policy; struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload; typedef struct envoy_api_v2_ClusterLoadAssignment envoy_api_v2_ClusterLoadAssignment; +typedef struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry; typedef struct envoy_api_v2_ClusterLoadAssignment_Policy envoy_api_v2_ClusterLoadAssignment_Policy; typedef struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload; extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_msginit; +extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit; extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_Policy_msginit; extern const upb_msglayout envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit; +struct envoy_api_v2_endpoint_Endpoint; struct envoy_api_v2_endpoint_LocalityLbEndpoints; struct envoy_type_FractionalPercent; +struct google_protobuf_Duration; struct google_protobuf_UInt32Value; +extern const upb_msglayout envoy_api_v2_endpoint_Endpoint_msginit; extern const upb_msglayout envoy_api_v2_endpoint_LocalityLbEndpoints_msginit; extern const upb_msglayout envoy_type_FractionalPercent_msginit; +extern const upb_msglayout google_protobuf_Duration_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; -/* Enums */ - /* envoy.api.v2.ClusterLoadAssignment */ UPB_INLINE envoy_api_v2_ClusterLoadAssignment *envoy_api_v2_ClusterLoadAssignment_new(upb_arena *arena) { return (envoy_api_v2_ClusterLoadAssignment *)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_msginit, arena); } -UPB_INLINE envoy_api_v2_ClusterLoadAssignment *envoy_api_v2_ClusterLoadAssignment_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_ClusterLoadAssignment *envoy_api_v2_ClusterLoadAssignment_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_ClusterLoadAssignment *ret = envoy_api_v2_ClusterLoadAssignment_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_ClusterLoadAssignment_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_ClusterLoadAssignment_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_serialize(const envoy_api_v2_ClusterLoadAssignment *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_ClusterLoadAssignment_msginit, arena, len); @@ -55,6 +61,7 @@ UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_serialize(const envoy_api_v2 UPB_INLINE upb_strview envoy_api_v2_ClusterLoadAssignment_cluster_name(const envoy_api_v2_ClusterLoadAssignment *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } UPB_INLINE const struct envoy_api_v2_endpoint_LocalityLbEndpoints* const* envoy_api_v2_ClusterLoadAssignment_endpoints(const envoy_api_v2_ClusterLoadAssignment *msg, size_t *len) { return (const struct envoy_api_v2_endpoint_LocalityLbEndpoints* const*)_upb_array_accessor(msg, UPB_SIZE(12, 24), len); } UPB_INLINE const envoy_api_v2_ClusterLoadAssignment_Policy* envoy_api_v2_ClusterLoadAssignment_policy(const envoy_api_v2_ClusterLoadAssignment *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_ClusterLoadAssignment_Policy*, UPB_SIZE(8, 16)); } +UPB_INLINE const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry* const* envoy_api_v2_ClusterLoadAssignment_named_endpoints(const envoy_api_v2_ClusterLoadAssignment *msg, size_t *len) { return (const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } UPB_INLINE void envoy_api_v2_ClusterLoadAssignment_set_cluster_name(envoy_api_v2_ClusterLoadAssignment *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; @@ -84,34 +91,81 @@ UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment_Policy* envoy_api_v2_Cluste } return sub; } +UPB_INLINE envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry** envoy_api_v2_ClusterLoadAssignment_mutable_named_endpoints(envoy_api_v2_ClusterLoadAssignment *msg, size_t *len) { + return (envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); +} +UPB_INLINE envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry** envoy_api_v2_ClusterLoadAssignment_resize_named_endpoints(envoy_api_v2_ClusterLoadAssignment *msg, size_t len, upb_arena *arena) { + return (envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry* envoy_api_v2_ClusterLoadAssignment_add_named_endpoints(envoy_api_v2_ClusterLoadAssignment *msg, upb_arena *arena) { + struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry* sub = (struct envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry*)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* envoy.api.v2.ClusterLoadAssignment.NamedEndpointsEntry */ + +UPB_INLINE envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_new(upb_arena *arena) { + return (envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, arena); +} +UPB_INLINE envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_parse(const char *buf, size_t size, + upb_arena *arena) { + envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *ret = envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_new(arena); + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_serialize(const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_msginit, arena, len); +} +UPB_INLINE upb_strview envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_key(const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE const struct envoy_api_v2_endpoint_Endpoint* envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_value(const envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(8, 16)); } + +UPB_INLINE void envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_set_key(envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_set_value(envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg, struct envoy_api_v2_endpoint_Endpoint* value) { + UPB_FIELD_AT(msg, struct envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(8, 16)) = value; +} +UPB_INLINE struct envoy_api_v2_endpoint_Endpoint* envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_mutable_value(envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry *msg, upb_arena *arena) { + struct envoy_api_v2_endpoint_Endpoint* sub = (struct envoy_api_v2_endpoint_Endpoint*)envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_value(msg); + if (sub == NULL) { + sub = (struct envoy_api_v2_endpoint_Endpoint*)upb_msg_new(&envoy_api_v2_endpoint_Endpoint_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_ClusterLoadAssignment_NamedEndpointsEntry_set_value(msg, sub); + } + return sub; +} /* envoy.api.v2.ClusterLoadAssignment.Policy */ UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy *envoy_api_v2_ClusterLoadAssignment_Policy_new(upb_arena *arena) { return (envoy_api_v2_ClusterLoadAssignment_Policy *)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_Policy_msginit, arena); } -UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy *envoy_api_v2_ClusterLoadAssignment_Policy_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy *envoy_api_v2_ClusterLoadAssignment_Policy_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_ClusterLoadAssignment_Policy *ret = envoy_api_v2_ClusterLoadAssignment_Policy_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_ClusterLoadAssignment_Policy_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_ClusterLoadAssignment_Policy_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_Policy_serialize(const envoy_api_v2_ClusterLoadAssignment_Policy *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_ClusterLoadAssignment_Policy_msginit, arena, len); } -UPB_INLINE const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const* envoy_api_v2_ClusterLoadAssignment_Policy_drop_overloads(const envoy_api_v2_ClusterLoadAssignment_Policy *msg, size_t *len) { return (const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } +UPB_INLINE const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const* envoy_api_v2_ClusterLoadAssignment_Policy_drop_overloads(const envoy_api_v2_ClusterLoadAssignment_Policy *msg, size_t *len) { return (const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* const*)_upb_array_accessor(msg, UPB_SIZE(8, 16), len); } UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_ClusterLoadAssignment_Policy_overprovisioning_factor(const envoy_api_v2_ClusterLoadAssignment_Policy *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(0, 0)); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_ClusterLoadAssignment_Policy_endpoint_stale_after(const envoy_api_v2_ClusterLoadAssignment_Policy *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(4, 8)); } UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload** envoy_api_v2_ClusterLoadAssignment_Policy_mutable_drop_overloads(envoy_api_v2_ClusterLoadAssignment_Policy *msg, size_t *len) { - return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); + return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 16), len); } UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload** envoy_api_v2_ClusterLoadAssignment_Policy_resize_drop_overloads(envoy_api_v2_ClusterLoadAssignment_Policy *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 16), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* envoy_api_v2_ClusterLoadAssignment_Policy_add_drop_overloads(envoy_api_v2_ClusterLoadAssignment_Policy *msg, upb_arena *arena) { struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload* sub = (struct envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload*)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(8, 16), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } @@ -127,16 +181,28 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_ClusterLoadAssignmen } return sub; } - +UPB_INLINE void envoy_api_v2_ClusterLoadAssignment_Policy_set_endpoint_stale_after(envoy_api_v2_ClusterLoadAssignment_Policy *msg, struct google_protobuf_Duration* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_ClusterLoadAssignment_Policy_mutable_endpoint_stale_after(envoy_api_v2_ClusterLoadAssignment_Policy *msg, upb_arena *arena) { + struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_ClusterLoadAssignment_Policy_endpoint_stale_after(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_ClusterLoadAssignment_Policy_set_endpoint_stale_after(msg, sub); + } + return sub; +} /* envoy.api.v2.ClusterLoadAssignment.Policy.DropOverload */ UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_new(upb_arena *arena) { return (envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *)upb_msg_new(&envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, arena); } -UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *ret = envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_serialize(const envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_ClusterLoadAssignment_Policy_DropOverload_msginit, arena, len); @@ -161,7 +227,6 @@ UPB_INLINE struct envoy_type_FractionalPercent* envoy_api_v2_ClusterLoadAssignme return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c b/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c index 4cc9d7dd445..527096be8c9 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c @@ -50,36 +50,38 @@ static const upb_msglayout *const envoy_api_v2_endpoint_LbEndpoint_submsgs[3] = &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_endpoint_LbEndpoint__fields[4] = { - {1, UPB_SIZE(8, 8), 0, 1, 11, 1}, +static const upb_msglayout_field envoy_api_v2_endpoint_LbEndpoint__fields[5] = { + {1, UPB_SIZE(16, 24), UPB_SIZE(-25, -41), 1, 11, 1}, {2, UPB_SIZE(0, 0), 0, 0, 14, 1}, - {3, UPB_SIZE(12, 16), 0, 0, 11, 1}, - {4, UPB_SIZE(16, 24), 0, 2, 11, 1}, + {3, UPB_SIZE(8, 8), 0, 0, 11, 1}, + {4, UPB_SIZE(12, 16), 0, 2, 11, 1}, + {5, UPB_SIZE(16, 24), UPB_SIZE(-25, -41), 0, 9, 1}, }; const upb_msglayout envoy_api_v2_endpoint_LbEndpoint_msginit = { &envoy_api_v2_endpoint_LbEndpoint_submsgs[0], &envoy_api_v2_endpoint_LbEndpoint__fields[0], - UPB_SIZE(24, 32), 4, false, + UPB_SIZE(32, 48), 5, false, }; -static const upb_msglayout *const envoy_api_v2_endpoint_LocalityLbEndpoints_submsgs[3] = { +static const upb_msglayout *const envoy_api_v2_endpoint_LocalityLbEndpoints_submsgs[4] = { &envoy_api_v2_core_Locality_msginit, &envoy_api_v2_endpoint_LbEndpoint_msginit, &google_protobuf_UInt32Value_msginit, }; -static const upb_msglayout_field envoy_api_v2_endpoint_LocalityLbEndpoints__fields[4] = { +static const upb_msglayout_field envoy_api_v2_endpoint_LocalityLbEndpoints__fields[5] = { {1, UPB_SIZE(4, 8), 0, 0, 11, 1}, - {2, UPB_SIZE(12, 24), 0, 1, 11, 3}, + {2, UPB_SIZE(16, 32), 0, 1, 11, 3}, {3, UPB_SIZE(8, 16), 0, 2, 11, 1}, {5, UPB_SIZE(0, 0), 0, 0, 13, 1}, + {6, UPB_SIZE(12, 24), 0, 2, 11, 1}, }; const upb_msglayout envoy_api_v2_endpoint_LocalityLbEndpoints_msginit = { &envoy_api_v2_endpoint_LocalityLbEndpoints_submsgs[0], &envoy_api_v2_endpoint_LocalityLbEndpoints__fields[0], - UPB_SIZE(16, 32), 4, false, + UPB_SIZE(20, 40), 5, false, }; #include "upb/port_undef.inc" diff --git a/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h b/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h index 4fd6341d3c4..2b3a9166c55 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_ENDPOINT_ENDPOINT_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -41,17 +41,16 @@ extern const upb_msglayout envoy_api_v2_core_Locality_msginit; extern const upb_msglayout envoy_api_v2_core_Metadata_msginit; extern const upb_msglayout google_protobuf_UInt32Value_msginit; -/* Enums */ - /* envoy.api.v2.endpoint.Endpoint */ UPB_INLINE envoy_api_v2_endpoint_Endpoint *envoy_api_v2_endpoint_Endpoint_new(upb_arena *arena) { return (envoy_api_v2_endpoint_Endpoint *)upb_msg_new(&envoy_api_v2_endpoint_Endpoint_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_Endpoint *envoy_api_v2_endpoint_Endpoint_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_Endpoint *envoy_api_v2_endpoint_Endpoint_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_Endpoint *ret = envoy_api_v2_endpoint_Endpoint_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_Endpoint_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_Endpoint_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_Endpoint_serialize(const envoy_api_v2_endpoint_Endpoint *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_Endpoint_msginit, arena, len); @@ -85,15 +84,15 @@ UPB_INLINE struct envoy_api_v2_endpoint_Endpoint_HealthCheckConfig* envoy_api_v2 return sub; } - /* envoy.api.v2.endpoint.Endpoint.HealthCheckConfig */ UPB_INLINE envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_new(upb_arena *arena) { return (envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *)upb_msg_new(&envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *ret = envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_serialize(const envoy_api_v2_endpoint_Endpoint_HealthCheckConfig *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_msginit, arena, len); @@ -105,27 +104,37 @@ UPB_INLINE void envoy_api_v2_endpoint_Endpoint_HealthCheckConfig_set_port_value( UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value; } - /* envoy.api.v2.endpoint.LbEndpoint */ UPB_INLINE envoy_api_v2_endpoint_LbEndpoint *envoy_api_v2_endpoint_LbEndpoint_new(upb_arena *arena) { return (envoy_api_v2_endpoint_LbEndpoint *)upb_msg_new(&envoy_api_v2_endpoint_LbEndpoint_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_LbEndpoint *envoy_api_v2_endpoint_LbEndpoint_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_LbEndpoint *envoy_api_v2_endpoint_LbEndpoint_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_LbEndpoint *ret = envoy_api_v2_endpoint_LbEndpoint_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_LbEndpoint_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_LbEndpoint_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_LbEndpoint_serialize(const envoy_api_v2_endpoint_LbEndpoint *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_LbEndpoint_msginit, arena, len); } -UPB_INLINE const envoy_api_v2_endpoint_Endpoint* envoy_api_v2_endpoint_LbEndpoint_endpoint(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(8, 8)); } +typedef enum { + envoy_api_v2_endpoint_LbEndpoint_host_identifier_endpoint = 1, + envoy_api_v2_endpoint_LbEndpoint_host_identifier_endpoint_name = 5, + envoy_api_v2_endpoint_LbEndpoint_host_identifier_NOT_SET = 0 +} envoy_api_v2_endpoint_LbEndpoint_host_identifier_oneofcases; +UPB_INLINE envoy_api_v2_endpoint_LbEndpoint_host_identifier_oneofcases envoy_api_v2_endpoint_LbEndpoint_host_identifier_case(const envoy_api_v2_endpoint_LbEndpoint* msg) { return (envoy_api_v2_endpoint_LbEndpoint_host_identifier_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(24, 40)); } + +UPB_INLINE bool envoy_api_v2_endpoint_LbEndpoint_has_endpoint(const envoy_api_v2_endpoint_LbEndpoint *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(24, 40), 1); } +UPB_INLINE const envoy_api_v2_endpoint_Endpoint* envoy_api_v2_endpoint_LbEndpoint_endpoint(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_READ_ONEOF(msg, const envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(16, 24), UPB_SIZE(24, 40), 1, NULL); } UPB_INLINE int32_t envoy_api_v2_endpoint_LbEndpoint_health_status(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } -UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_endpoint_LbEndpoint_metadata(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(12, 16)); } -UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LbEndpoint_load_balancing_weight(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)); } +UPB_INLINE const struct envoy_api_v2_core_Metadata* envoy_api_v2_endpoint_LbEndpoint_metadata(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Metadata*, UPB_SIZE(8, 8)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LbEndpoint_load_balancing_weight(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)); } +UPB_INLINE bool envoy_api_v2_endpoint_LbEndpoint_has_endpoint_name(const envoy_api_v2_endpoint_LbEndpoint *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(24, 40), 5); } +UPB_INLINE upb_strview envoy_api_v2_endpoint_LbEndpoint_endpoint_name(const envoy_api_v2_endpoint_LbEndpoint *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(16, 24), UPB_SIZE(24, 40), 5, upb_strview_make("", strlen(""))); } UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_endpoint(envoy_api_v2_endpoint_LbEndpoint *msg, envoy_api_v2_endpoint_Endpoint* value) { - UPB_FIELD_AT(msg, envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(8, 8)) = value; + UPB_WRITE_ONEOF(msg, envoy_api_v2_endpoint_Endpoint*, UPB_SIZE(16, 24), value, UPB_SIZE(24, 40), 1); } UPB_INLINE struct envoy_api_v2_endpoint_Endpoint* envoy_api_v2_endpoint_LbEndpoint_mutable_endpoint(envoy_api_v2_endpoint_LbEndpoint *msg, upb_arena *arena) { struct envoy_api_v2_endpoint_Endpoint* sub = (struct envoy_api_v2_endpoint_Endpoint*)envoy_api_v2_endpoint_LbEndpoint_endpoint(msg); @@ -140,7 +149,7 @@ UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_health_status(envoy_api_v2_ UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; } UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_metadata(envoy_api_v2_endpoint_LbEndpoint *msg, struct envoy_api_v2_core_Metadata* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_Metadata*, UPB_SIZE(12, 16)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_Metadata*, UPB_SIZE(8, 8)) = value; } UPB_INLINE struct envoy_api_v2_core_Metadata* envoy_api_v2_endpoint_LbEndpoint_mutable_metadata(envoy_api_v2_endpoint_LbEndpoint *msg, upb_arena *arena) { struct envoy_api_v2_core_Metadata* sub = (struct envoy_api_v2_core_Metadata*)envoy_api_v2_endpoint_LbEndpoint_metadata(msg); @@ -152,7 +161,7 @@ UPB_INLINE struct envoy_api_v2_core_Metadata* envoy_api_v2_endpoint_LbEndpoint_m return sub; } UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_load_balancing_weight(envoy_api_v2_endpoint_LbEndpoint *msg, struct google_protobuf_UInt32Value* value) { - UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(16, 24)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 16)) = value; } UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LbEndpoint_mutable_load_balancing_weight(envoy_api_v2_endpoint_LbEndpoint *msg, upb_arena *arena) { struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_endpoint_LbEndpoint_load_balancing_weight(msg); @@ -163,25 +172,29 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LbEndpoint_ } return sub; } - +UPB_INLINE void envoy_api_v2_endpoint_LbEndpoint_set_endpoint_name(envoy_api_v2_endpoint_LbEndpoint *msg, upb_strview value) { + UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(16, 24), value, UPB_SIZE(24, 40), 5); +} /* envoy.api.v2.endpoint.LocalityLbEndpoints */ UPB_INLINE envoy_api_v2_endpoint_LocalityLbEndpoints *envoy_api_v2_endpoint_LocalityLbEndpoints_new(upb_arena *arena) { return (envoy_api_v2_endpoint_LocalityLbEndpoints *)upb_msg_new(&envoy_api_v2_endpoint_LocalityLbEndpoints_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_LocalityLbEndpoints *envoy_api_v2_endpoint_LocalityLbEndpoints_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_LocalityLbEndpoints *envoy_api_v2_endpoint_LocalityLbEndpoints_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_LocalityLbEndpoints *ret = envoy_api_v2_endpoint_LocalityLbEndpoints_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_LocalityLbEndpoints_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_LocalityLbEndpoints_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_LocalityLbEndpoints_serialize(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_LocalityLbEndpoints_msginit, arena, len); } UPB_INLINE const struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_LocalityLbEndpoints_locality(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Locality*, UPB_SIZE(4, 8)); } -UPB_INLINE const envoy_api_v2_endpoint_LbEndpoint* const* envoy_api_v2_endpoint_LocalityLbEndpoints_lb_endpoints(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg, size_t *len) { return (const envoy_api_v2_endpoint_LbEndpoint* const*)_upb_array_accessor(msg, UPB_SIZE(12, 24), len); } +UPB_INLINE const envoy_api_v2_endpoint_LbEndpoint* const* envoy_api_v2_endpoint_LocalityLbEndpoints_lb_endpoints(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg, size_t *len) { return (const envoy_api_v2_endpoint_LbEndpoint* const*)_upb_array_accessor(msg, UPB_SIZE(16, 32), len); } UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(8, 16)); } UPB_INLINE uint32_t envoy_api_v2_endpoint_LocalityLbEndpoints_priority(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); } +UPB_INLINE const struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LocalityLbEndpoints_proximity(const envoy_api_v2_endpoint_LocalityLbEndpoints *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)); } UPB_INLINE void envoy_api_v2_endpoint_LocalityLbEndpoints_set_locality(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, struct envoy_api_v2_core_Locality* value) { UPB_FIELD_AT(msg, struct envoy_api_v2_core_Locality*, UPB_SIZE(4, 8)) = value; @@ -196,15 +209,15 @@ UPB_INLINE struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_LocalityLbEn return sub; } UPB_INLINE envoy_api_v2_endpoint_LbEndpoint** envoy_api_v2_endpoint_LocalityLbEndpoints_mutable_lb_endpoints(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, size_t *len) { - return (envoy_api_v2_endpoint_LbEndpoint**)_upb_array_mutable_accessor(msg, UPB_SIZE(12, 24), len); + return (envoy_api_v2_endpoint_LbEndpoint**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); } UPB_INLINE envoy_api_v2_endpoint_LbEndpoint** envoy_api_v2_endpoint_LocalityLbEndpoints_resize_lb_endpoints(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_endpoint_LbEndpoint**)_upb_array_resize_accessor(msg, UPB_SIZE(12, 24), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_endpoint_LbEndpoint**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_endpoint_LbEndpoint* envoy_api_v2_endpoint_LocalityLbEndpoints_add_lb_endpoints(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, upb_arena *arena) { struct envoy_api_v2_endpoint_LbEndpoint* sub = (struct envoy_api_v2_endpoint_LbEndpoint*)upb_msg_new(&envoy_api_v2_endpoint_LbEndpoint_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(12, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } @@ -223,7 +236,18 @@ UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LocalityLbE UPB_INLINE void envoy_api_v2_endpoint_LocalityLbEndpoints_set_priority(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, uint32_t value) { UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value; } - +UPB_INLINE void envoy_api_v2_endpoint_LocalityLbEndpoints_set_proximity(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, struct google_protobuf_UInt32Value* value) { + UPB_FIELD_AT(msg, struct google_protobuf_UInt32Value*, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE struct google_protobuf_UInt32Value* envoy_api_v2_endpoint_LocalityLbEndpoints_mutable_proximity(envoy_api_v2_endpoint_LocalityLbEndpoints *msg, upb_arena *arena) { + struct google_protobuf_UInt32Value* sub = (struct google_protobuf_UInt32Value*)envoy_api_v2_endpoint_LocalityLbEndpoints_proximity(msg); + if (sub == NULL) { + sub = (struct google_protobuf_UInt32Value*)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_endpoint_LocalityLbEndpoints_set_proximity(msg, sub); + } + return sub; +} #ifdef __cplusplus } /* extern "C" */ diff --git a/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c b/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c index 2af77c59efb..ad7c93f24ae 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +++ b/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c @@ -12,6 +12,7 @@ #include "envoy/api/v2/core/address.upb.h" #include "envoy/api/v2/core/base.upb.h" #include "google/protobuf/duration.upb.h" +#include "google/protobuf/struct.upb.h" #include "validate/validate.upb.h" #include "gogoproto/gogo.upb.h" @@ -23,39 +24,43 @@ static const upb_msglayout *const envoy_api_v2_endpoint_UpstreamLocalityStats_su &envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, }; -static const upb_msglayout_field envoy_api_v2_endpoint_UpstreamLocalityStats__fields[7] = { - {1, UPB_SIZE(28, 32), 0, 0, 11, 1}, +static const upb_msglayout_field envoy_api_v2_endpoint_UpstreamLocalityStats__fields[8] = { + {1, UPB_SIZE(36, 40), 0, 0, 11, 1}, {2, UPB_SIZE(0, 0), 0, 0, 4, 1}, {3, UPB_SIZE(8, 8), 0, 0, 4, 1}, {4, UPB_SIZE(16, 16), 0, 0, 4, 1}, - {5, UPB_SIZE(32, 40), 0, 1, 11, 3}, - {6, UPB_SIZE(24, 24), 0, 0, 13, 1}, - {7, UPB_SIZE(36, 48), 0, 2, 11, 3}, + {5, UPB_SIZE(40, 48), 0, 1, 11, 3}, + {6, UPB_SIZE(32, 32), 0, 0, 13, 1}, + {7, UPB_SIZE(44, 56), 0, 2, 11, 3}, + {8, UPB_SIZE(24, 24), 0, 0, 4, 1}, }; const upb_msglayout envoy_api_v2_endpoint_UpstreamLocalityStats_msginit = { &envoy_api_v2_endpoint_UpstreamLocalityStats_submsgs[0], &envoy_api_v2_endpoint_UpstreamLocalityStats__fields[0], - UPB_SIZE(40, 56), 7, false, + UPB_SIZE(48, 64), 8, false, }; -static const upb_msglayout *const envoy_api_v2_endpoint_UpstreamEndpointStats_submsgs[2] = { +static const upb_msglayout *const envoy_api_v2_endpoint_UpstreamEndpointStats_submsgs[3] = { &envoy_api_v2_core_Address_msginit, &envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, + &google_protobuf_Struct_msginit, }; -static const upb_msglayout_field envoy_api_v2_endpoint_UpstreamEndpointStats__fields[5] = { - {1, UPB_SIZE(24, 24), 0, 0, 11, 1}, +static const upb_msglayout_field envoy_api_v2_endpoint_UpstreamEndpointStats__fields[7] = { + {1, UPB_SIZE(32, 32), 0, 0, 11, 1}, {2, UPB_SIZE(0, 0), 0, 0, 4, 1}, {3, UPB_SIZE(8, 8), 0, 0, 4, 1}, {4, UPB_SIZE(16, 16), 0, 0, 4, 1}, - {5, UPB_SIZE(28, 32), 0, 1, 11, 3}, + {5, UPB_SIZE(40, 48), 0, 1, 11, 3}, + {6, UPB_SIZE(36, 40), 0, 2, 11, 1}, + {7, UPB_SIZE(24, 24), 0, 0, 4, 1}, }; const upb_msglayout envoy_api_v2_endpoint_UpstreamEndpointStats_msginit = { &envoy_api_v2_endpoint_UpstreamEndpointStats_submsgs[0], &envoy_api_v2_endpoint_UpstreamEndpointStats__fields[0], - UPB_SIZE(32, 40), 5, false, + UPB_SIZE(48, 56), 7, false, }; static const upb_msglayout_field envoy_api_v2_endpoint_EndpointLoadMetricStats__fields[3] = { @@ -76,18 +81,19 @@ static const upb_msglayout *const envoy_api_v2_endpoint_ClusterStats_submsgs[3] &google_protobuf_Duration_msginit, }; -static const upb_msglayout_field envoy_api_v2_endpoint_ClusterStats__fields[5] = { +static const upb_msglayout_field envoy_api_v2_endpoint_ClusterStats__fields[6] = { {1, UPB_SIZE(8, 8), 0, 0, 9, 1}, - {2, UPB_SIZE(20, 32), 0, 1, 11, 3}, + {2, UPB_SIZE(28, 48), 0, 1, 11, 3}, {3, UPB_SIZE(0, 0), 0, 0, 4, 1}, - {4, UPB_SIZE(16, 24), 0, 2, 11, 1}, - {5, UPB_SIZE(24, 40), 0, 0, 11, 3}, + {4, UPB_SIZE(24, 40), 0, 2, 11, 1}, + {5, UPB_SIZE(32, 56), 0, 0, 11, 3}, + {6, UPB_SIZE(16, 24), 0, 0, 9, 1}, }; const upb_msglayout envoy_api_v2_endpoint_ClusterStats_msginit = { &envoy_api_v2_endpoint_ClusterStats_submsgs[0], &envoy_api_v2_endpoint_ClusterStats__fields[0], - UPB_SIZE(32, 48), 5, false, + UPB_SIZE(40, 64), 6, false, }; static const upb_msglayout_field envoy_api_v2_endpoint_ClusterStats_DroppedRequests__fields[2] = { diff --git a/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h b/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h index 7ee2129f436..d37045d874e 100644 --- a/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +++ b/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h @@ -10,12 +10,12 @@ #define ENVOY_API_V2_ENDPOINT_LOAD_REPORT_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -38,11 +38,11 @@ extern const upb_msglayout envoy_api_v2_endpoint_ClusterStats_DroppedRequests_ms struct envoy_api_v2_core_Address; struct envoy_api_v2_core_Locality; struct google_protobuf_Duration; +struct google_protobuf_Struct; extern const upb_msglayout envoy_api_v2_core_Address_msginit; extern const upb_msglayout envoy_api_v2_core_Locality_msginit; extern const upb_msglayout google_protobuf_Duration_msginit; - -/* Enums */ +extern const upb_msglayout google_protobuf_Struct_msginit; /* envoy.api.v2.endpoint.UpstreamLocalityStats */ @@ -50,24 +50,26 @@ extern const upb_msglayout google_protobuf_Duration_msginit; UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats *envoy_api_v2_endpoint_UpstreamLocalityStats_new(upb_arena *arena) { return (envoy_api_v2_endpoint_UpstreamLocalityStats *)upb_msg_new(&envoy_api_v2_endpoint_UpstreamLocalityStats_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats *envoy_api_v2_endpoint_UpstreamLocalityStats_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats *envoy_api_v2_endpoint_UpstreamLocalityStats_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_UpstreamLocalityStats *ret = envoy_api_v2_endpoint_UpstreamLocalityStats_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_UpstreamLocalityStats_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_UpstreamLocalityStats_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_UpstreamLocalityStats_serialize(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_UpstreamLocalityStats_msginit, arena, len); } -UPB_INLINE const struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_UpstreamLocalityStats_locality(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Locality*, UPB_SIZE(28, 32)); } +UPB_INLINE const struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_UpstreamLocalityStats_locality(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Locality*, UPB_SIZE(36, 40)); } UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamLocalityStats_total_successful_requests(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)); } UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamLocalityStats_total_requests_in_progress(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)); } UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamLocalityStats_total_error_requests(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)); } -UPB_INLINE const envoy_api_v2_endpoint_EndpointLoadMetricStats* const* envoy_api_v2_endpoint_UpstreamLocalityStats_load_metric_stats(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_EndpointLoadMetricStats* const*)_upb_array_accessor(msg, UPB_SIZE(32, 40), len); } -UPB_INLINE uint32_t envoy_api_v2_endpoint_UpstreamLocalityStats_priority(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(24, 24)); } -UPB_INLINE const envoy_api_v2_endpoint_UpstreamEndpointStats* const* envoy_api_v2_endpoint_UpstreamLocalityStats_upstream_endpoint_stats(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_UpstreamEndpointStats* const*)_upb_array_accessor(msg, UPB_SIZE(36, 48), len); } +UPB_INLINE const envoy_api_v2_endpoint_EndpointLoadMetricStats* const* envoy_api_v2_endpoint_UpstreamLocalityStats_load_metric_stats(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_EndpointLoadMetricStats* const*)_upb_array_accessor(msg, UPB_SIZE(40, 48), len); } +UPB_INLINE uint32_t envoy_api_v2_endpoint_UpstreamLocalityStats_priority(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(32, 32)); } +UPB_INLINE const envoy_api_v2_endpoint_UpstreamEndpointStats* const* envoy_api_v2_endpoint_UpstreamLocalityStats_upstream_endpoint_stats(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_UpstreamEndpointStats* const*)_upb_array_accessor(msg, UPB_SIZE(44, 56), len); } +UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamLocalityStats_total_issued_requests(const envoy_api_v2_endpoint_UpstreamLocalityStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)); } UPB_INLINE void envoy_api_v2_endpoint_UpstreamLocalityStats_set_locality(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, struct envoy_api_v2_core_Locality* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_Locality*, UPB_SIZE(28, 32)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_Locality*, UPB_SIZE(36, 40)) = value; } UPB_INLINE struct envoy_api_v2_core_Locality* envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_locality(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, upb_arena *arena) { struct envoy_api_v2_core_Locality* sub = (struct envoy_api_v2_core_Locality*)envoy_api_v2_endpoint_UpstreamLocalityStats_locality(msg); @@ -88,57 +90,62 @@ UPB_INLINE void envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_error_requ UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)) = value; } UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats** envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_load_metric_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { - return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 40), len); + return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 48), len); } UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats** envoy_api_v2_endpoint_UpstreamLocalityStats_resize_load_metric_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_endpoint_EndpointLoadMetricStats* envoy_api_v2_endpoint_UpstreamLocalityStats_add_load_metric_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, upb_arena *arena) { struct envoy_api_v2_endpoint_EndpointLoadMetricStats* sub = (struct envoy_api_v2_endpoint_EndpointLoadMetricStats*)upb_msg_new(&envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(32, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(40, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } UPB_INLINE void envoy_api_v2_endpoint_UpstreamLocalityStats_set_priority(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, uint32_t value) { - UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(24, 24)) = value; + UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(32, 32)) = value; } UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats** envoy_api_v2_endpoint_UpstreamLocalityStats_mutable_upstream_endpoint_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t *len) { - return (envoy_api_v2_endpoint_UpstreamEndpointStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 48), len); + return (envoy_api_v2_endpoint_UpstreamEndpointStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 56), len); } UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats** envoy_api_v2_endpoint_UpstreamLocalityStats_resize_upstream_endpoint_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_endpoint_UpstreamEndpointStats**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_endpoint_UpstreamEndpointStats**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_endpoint_UpstreamEndpointStats* envoy_api_v2_endpoint_UpstreamLocalityStats_add_upstream_endpoint_stats(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, upb_arena *arena) { struct envoy_api_v2_endpoint_UpstreamEndpointStats* sub = (struct envoy_api_v2_endpoint_UpstreamEndpointStats*)upb_msg_new(&envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(36, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(44, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } - +UPB_INLINE void envoy_api_v2_endpoint_UpstreamLocalityStats_set_total_issued_requests(envoy_api_v2_endpoint_UpstreamLocalityStats *msg, uint64_t value) { + UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)) = value; +} /* envoy.api.v2.endpoint.UpstreamEndpointStats */ UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats *envoy_api_v2_endpoint_UpstreamEndpointStats_new(upb_arena *arena) { return (envoy_api_v2_endpoint_UpstreamEndpointStats *)upb_msg_new(&envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats *envoy_api_v2_endpoint_UpstreamEndpointStats_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_UpstreamEndpointStats *envoy_api_v2_endpoint_UpstreamEndpointStats_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_UpstreamEndpointStats *ret = envoy_api_v2_endpoint_UpstreamEndpointStats_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_UpstreamEndpointStats_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_UpstreamEndpointStats_serialize(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_UpstreamEndpointStats_msginit, arena, len); } -UPB_INLINE const struct envoy_api_v2_core_Address* envoy_api_v2_endpoint_UpstreamEndpointStats_address(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Address*, UPB_SIZE(24, 24)); } +UPB_INLINE const struct envoy_api_v2_core_Address* envoy_api_v2_endpoint_UpstreamEndpointStats_address(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, const struct envoy_api_v2_core_Address*, UPB_SIZE(32, 32)); } UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamEndpointStats_total_successful_requests(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)); } UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamEndpointStats_total_requests_in_progress(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(8, 8)); } UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamEndpointStats_total_error_requests(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)); } -UPB_INLINE const envoy_api_v2_endpoint_EndpointLoadMetricStats* const* envoy_api_v2_endpoint_UpstreamEndpointStats_load_metric_stats(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_EndpointLoadMetricStats* const*)_upb_array_accessor(msg, UPB_SIZE(28, 32), len); } +UPB_INLINE const envoy_api_v2_endpoint_EndpointLoadMetricStats* const* envoy_api_v2_endpoint_UpstreamEndpointStats_load_metric_stats(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_EndpointLoadMetricStats* const*)_upb_array_accessor(msg, UPB_SIZE(40, 48), len); } +UPB_INLINE const struct google_protobuf_Struct* envoy_api_v2_endpoint_UpstreamEndpointStats_metadata(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Struct*, UPB_SIZE(36, 40)); } +UPB_INLINE uint64_t envoy_api_v2_endpoint_UpstreamEndpointStats_total_issued_requests(const envoy_api_v2_endpoint_UpstreamEndpointStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)); } UPB_INLINE void envoy_api_v2_endpoint_UpstreamEndpointStats_set_address(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, struct envoy_api_v2_core_Address* value) { - UPB_FIELD_AT(msg, struct envoy_api_v2_core_Address*, UPB_SIZE(24, 24)) = value; + UPB_FIELD_AT(msg, struct envoy_api_v2_core_Address*, UPB_SIZE(32, 32)) = value; } UPB_INLINE struct envoy_api_v2_core_Address* envoy_api_v2_endpoint_UpstreamEndpointStats_mutable_address(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, upb_arena *arena) { struct envoy_api_v2_core_Address* sub = (struct envoy_api_v2_core_Address*)envoy_api_v2_endpoint_UpstreamEndpointStats_address(msg); @@ -159,28 +166,43 @@ UPB_INLINE void envoy_api_v2_endpoint_UpstreamEndpointStats_set_total_error_requ UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(16, 16)) = value; } UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats** envoy_api_v2_endpoint_UpstreamEndpointStats_mutable_load_metric_stats(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, size_t *len) { - return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len); + return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 48), len); } UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats** envoy_api_v2_endpoint_UpstreamEndpointStats_resize_load_metric_stats(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_endpoint_EndpointLoadMetricStats**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_endpoint_EndpointLoadMetricStats* envoy_api_v2_endpoint_UpstreamEndpointStats_add_load_metric_stats(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, upb_arena *arena) { struct envoy_api_v2_endpoint_EndpointLoadMetricStats* sub = (struct envoy_api_v2_endpoint_EndpointLoadMetricStats*)upb_msg_new(&envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(40, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } - +UPB_INLINE void envoy_api_v2_endpoint_UpstreamEndpointStats_set_metadata(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, struct google_protobuf_Struct* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Struct*, UPB_SIZE(36, 40)) = value; +} +UPB_INLINE struct google_protobuf_Struct* envoy_api_v2_endpoint_UpstreamEndpointStats_mutable_metadata(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, upb_arena *arena) { + struct google_protobuf_Struct* sub = (struct google_protobuf_Struct*)envoy_api_v2_endpoint_UpstreamEndpointStats_metadata(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Struct*)upb_msg_new(&google_protobuf_Struct_msginit, arena); + if (!sub) return NULL; + envoy_api_v2_endpoint_UpstreamEndpointStats_set_metadata(msg, sub); + } + return sub; +} +UPB_INLINE void envoy_api_v2_endpoint_UpstreamEndpointStats_set_total_issued_requests(envoy_api_v2_endpoint_UpstreamEndpointStats *msg, uint64_t value) { + UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)) = value; +} /* envoy.api.v2.endpoint.EndpointLoadMetricStats */ UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats *envoy_api_v2_endpoint_EndpointLoadMetricStats_new(upb_arena *arena) { return (envoy_api_v2_endpoint_EndpointLoadMetricStats *)upb_msg_new(&envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats *envoy_api_v2_endpoint_EndpointLoadMetricStats_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_EndpointLoadMetricStats *envoy_api_v2_endpoint_EndpointLoadMetricStats_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_EndpointLoadMetricStats *ret = envoy_api_v2_endpoint_EndpointLoadMetricStats_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_EndpointLoadMetricStats_serialize(const envoy_api_v2_endpoint_EndpointLoadMetricStats *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_EndpointLoadMetricStats_msginit, arena, len); @@ -200,39 +222,40 @@ UPB_INLINE void envoy_api_v2_endpoint_EndpointLoadMetricStats_set_total_metric_v UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)) = value; } - /* envoy.api.v2.endpoint.ClusterStats */ UPB_INLINE envoy_api_v2_endpoint_ClusterStats *envoy_api_v2_endpoint_ClusterStats_new(upb_arena *arena) { return (envoy_api_v2_endpoint_ClusterStats *)upb_msg_new(&envoy_api_v2_endpoint_ClusterStats_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_ClusterStats *envoy_api_v2_endpoint_ClusterStats_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_ClusterStats *envoy_api_v2_endpoint_ClusterStats_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_ClusterStats *ret = envoy_api_v2_endpoint_ClusterStats_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_ClusterStats_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_ClusterStats_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_ClusterStats_serialize(const envoy_api_v2_endpoint_ClusterStats *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_ClusterStats_msginit, arena, len); } UPB_INLINE upb_strview envoy_api_v2_endpoint_ClusterStats_cluster_name(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } -UPB_INLINE const envoy_api_v2_endpoint_UpstreamLocalityStats* const* envoy_api_v2_endpoint_ClusterStats_upstream_locality_stats(const envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_UpstreamLocalityStats* const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); } +UPB_INLINE const envoy_api_v2_endpoint_UpstreamLocalityStats* const* envoy_api_v2_endpoint_ClusterStats_upstream_locality_stats(const envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_UpstreamLocalityStats* const*)_upb_array_accessor(msg, UPB_SIZE(28, 48), len); } UPB_INLINE uint64_t envoy_api_v2_endpoint_ClusterStats_total_dropped_requests(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)); } -UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_endpoint_ClusterStats_load_report_interval(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(16, 24)); } -UPB_INLINE const envoy_api_v2_endpoint_ClusterStats_DroppedRequests* const* envoy_api_v2_endpoint_ClusterStats_dropped_requests(const envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_ClusterStats_DroppedRequests* const*)_upb_array_accessor(msg, UPB_SIZE(24, 40), len); } +UPB_INLINE const struct google_protobuf_Duration* envoy_api_v2_endpoint_ClusterStats_load_report_interval(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(24, 40)); } +UPB_INLINE const envoy_api_v2_endpoint_ClusterStats_DroppedRequests* const* envoy_api_v2_endpoint_ClusterStats_dropped_requests(const envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { return (const envoy_api_v2_endpoint_ClusterStats_DroppedRequests* const*)_upb_array_accessor(msg, UPB_SIZE(32, 56), len); } +UPB_INLINE upb_strview envoy_api_v2_endpoint_ClusterStats_cluster_service_name(const envoy_api_v2_endpoint_ClusterStats *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)); } UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_set_cluster_name(envoy_api_v2_endpoint_ClusterStats *msg, upb_strview value) { UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; } UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats** envoy_api_v2_endpoint_ClusterStats_mutable_upstream_locality_stats(envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { - return (envoy_api_v2_endpoint_UpstreamLocalityStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len); + return (envoy_api_v2_endpoint_UpstreamLocalityStats**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 48), len); } UPB_INLINE envoy_api_v2_endpoint_UpstreamLocalityStats** envoy_api_v2_endpoint_ClusterStats_resize_upstream_locality_stats(envoy_api_v2_endpoint_ClusterStats *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_endpoint_UpstreamLocalityStats**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_endpoint_UpstreamLocalityStats**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_endpoint_UpstreamLocalityStats* envoy_api_v2_endpoint_ClusterStats_add_upstream_locality_stats(envoy_api_v2_endpoint_ClusterStats *msg, upb_arena *arena) { struct envoy_api_v2_endpoint_UpstreamLocalityStats* sub = (struct envoy_api_v2_endpoint_UpstreamLocalityStats*)upb_msg_new(&envoy_api_v2_endpoint_UpstreamLocalityStats_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(20, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(28, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } @@ -240,7 +263,7 @@ UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_set_total_dropped_requests(en UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)) = value; } UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_set_load_report_interval(envoy_api_v2_endpoint_ClusterStats *msg, struct google_protobuf_Duration* value) { - UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(16, 24)) = value; + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(24, 40)) = value; } UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_endpoint_ClusterStats_mutable_load_report_interval(envoy_api_v2_endpoint_ClusterStats *msg, upb_arena *arena) { struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_api_v2_endpoint_ClusterStats_load_report_interval(msg); @@ -252,28 +275,31 @@ UPB_INLINE struct google_protobuf_Duration* envoy_api_v2_endpoint_ClusterStats_m return sub; } UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests** envoy_api_v2_endpoint_ClusterStats_mutable_dropped_requests(envoy_api_v2_endpoint_ClusterStats *msg, size_t *len) { - return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 40), len); + return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 56), len); } UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests** envoy_api_v2_endpoint_ClusterStats_resize_dropped_requests(envoy_api_v2_endpoint_ClusterStats *msg, size_t len, upb_arena *arena) { - return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); + return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 56), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); } UPB_INLINE struct envoy_api_v2_endpoint_ClusterStats_DroppedRequests* envoy_api_v2_endpoint_ClusterStats_add_dropped_requests(envoy_api_v2_endpoint_ClusterStats *msg, upb_arena *arena) { struct envoy_api_v2_endpoint_ClusterStats_DroppedRequests* sub = (struct envoy_api_v2_endpoint_ClusterStats_DroppedRequests*)upb_msg_new(&envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(24, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(32, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); if (!ok) return NULL; return sub; } - +UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_set_cluster_service_name(envoy_api_v2_endpoint_ClusterStats *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)) = value; +} /* envoy.api.v2.endpoint.ClusterStats.DroppedRequests */ UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests *envoy_api_v2_endpoint_ClusterStats_DroppedRequests_new(upb_arena *arena) { return (envoy_api_v2_endpoint_ClusterStats_DroppedRequests *)upb_msg_new(&envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit, arena); } -UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests *envoy_api_v2_endpoint_ClusterStats_DroppedRequests_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_api_v2_endpoint_ClusterStats_DroppedRequests *envoy_api_v2_endpoint_ClusterStats_DroppedRequests_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_api_v2_endpoint_ClusterStats_DroppedRequests *ret = envoy_api_v2_endpoint_ClusterStats_DroppedRequests_new(arena); - return (ret && upb_decode(buf, ret, &envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_api_v2_endpoint_ClusterStats_DroppedRequests_serialize(const envoy_api_v2_endpoint_ClusterStats_DroppedRequests *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_api_v2_endpoint_ClusterStats_DroppedRequests_msginit, arena, len); @@ -289,7 +315,6 @@ UPB_INLINE void envoy_api_v2_endpoint_ClusterStats_DroppedRequests_set_dropped_c UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h b/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h index d5f1b90a032..05fc7302e73 100644 --- a/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +++ b/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h @@ -10,12 +10,12 @@ #define ENVOY_SERVICE_DISCOVERY_V2_ADS_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -24,17 +24,16 @@ struct envoy_service_discovery_v2_AdsDummy; typedef struct envoy_service_discovery_v2_AdsDummy envoy_service_discovery_v2_AdsDummy; extern const upb_msglayout envoy_service_discovery_v2_AdsDummy_msginit; -/* Enums */ - /* envoy.service.discovery.v2.AdsDummy */ UPB_INLINE envoy_service_discovery_v2_AdsDummy *envoy_service_discovery_v2_AdsDummy_new(upb_arena *arena) { return (envoy_service_discovery_v2_AdsDummy *)upb_msg_new(&envoy_service_discovery_v2_AdsDummy_msginit, arena); } -UPB_INLINE envoy_service_discovery_v2_AdsDummy *envoy_service_discovery_v2_AdsDummy_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_service_discovery_v2_AdsDummy *envoy_service_discovery_v2_AdsDummy_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_service_discovery_v2_AdsDummy *ret = envoy_service_discovery_v2_AdsDummy_new(arena); - return (ret && upb_decode(buf, ret, &envoy_service_discovery_v2_AdsDummy_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_service_discovery_v2_AdsDummy_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_service_discovery_v2_AdsDummy_serialize(const envoy_service_discovery_v2_AdsDummy *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_service_discovery_v2_AdsDummy_msginit, arena, len); @@ -42,7 +41,6 @@ UPB_INLINE char *envoy_service_discovery_v2_AdsDummy_serialize(const envoy_servi - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h b/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h index 99db767a8a1..457deafdd9d 100644 --- a/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +++ b/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h @@ -10,12 +10,12 @@ #define ENVOY_SERVICE_LOAD_STATS_V2_LRS_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -33,17 +33,16 @@ extern const upb_msglayout envoy_api_v2_core_Node_msginit; extern const upb_msglayout envoy_api_v2_endpoint_ClusterStats_msginit; extern const upb_msglayout google_protobuf_Duration_msginit; -/* Enums */ - /* envoy.service.load_stats.v2.LoadStatsRequest */ UPB_INLINE envoy_service_load_stats_v2_LoadStatsRequest *envoy_service_load_stats_v2_LoadStatsRequest_new(upb_arena *arena) { return (envoy_service_load_stats_v2_LoadStatsRequest *)upb_msg_new(&envoy_service_load_stats_v2_LoadStatsRequest_msginit, arena); } -UPB_INLINE envoy_service_load_stats_v2_LoadStatsRequest *envoy_service_load_stats_v2_LoadStatsRequest_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_service_load_stats_v2_LoadStatsRequest *envoy_service_load_stats_v2_LoadStatsRequest_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_service_load_stats_v2_LoadStatsRequest *ret = envoy_service_load_stats_v2_LoadStatsRequest_new(arena); - return (ret && upb_decode(buf, ret, &envoy_service_load_stats_v2_LoadStatsRequest_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_service_load_stats_v2_LoadStatsRequest_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_service_load_stats_v2_LoadStatsRequest_serialize(const envoy_service_load_stats_v2_LoadStatsRequest *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_service_load_stats_v2_LoadStatsRequest_msginit, arena, len); @@ -78,15 +77,15 @@ UPB_INLINE struct envoy_api_v2_endpoint_ClusterStats* envoy_service_load_stats_v return sub; } - /* envoy.service.load_stats.v2.LoadStatsResponse */ UPB_INLINE envoy_service_load_stats_v2_LoadStatsResponse *envoy_service_load_stats_v2_LoadStatsResponse_new(upb_arena *arena) { return (envoy_service_load_stats_v2_LoadStatsResponse *)upb_msg_new(&envoy_service_load_stats_v2_LoadStatsResponse_msginit, arena); } -UPB_INLINE envoy_service_load_stats_v2_LoadStatsResponse *envoy_service_load_stats_v2_LoadStatsResponse_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_service_load_stats_v2_LoadStatsResponse *envoy_service_load_stats_v2_LoadStatsResponse_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_service_load_stats_v2_LoadStatsResponse *ret = envoy_service_load_stats_v2_LoadStatsResponse_new(arena); - return (ret && upb_decode(buf, ret, &envoy_service_load_stats_v2_LoadStatsResponse_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_service_load_stats_v2_LoadStatsResponse_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_service_load_stats_v2_LoadStatsResponse_serialize(const envoy_service_load_stats_v2_LoadStatsResponse *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_service_load_stats_v2_LoadStatsResponse_msginit, arena, len); @@ -122,7 +121,6 @@ UPB_INLINE void envoy_service_load_stats_v2_LoadStatsResponse_set_report_endpoin UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/type/percent.upb.h b/src/core/ext/upb-generated/envoy/type/percent.upb.h index 13df96a610c..e9aa889957a 100644 --- a/src/core/ext/upb-generated/envoy/type/percent.upb.h +++ b/src/core/ext/upb-generated/envoy/type/percent.upb.h @@ -10,12 +10,12 @@ #define ENVOY_TYPE_PERCENT_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -27,8 +27,6 @@ typedef struct envoy_type_FractionalPercent envoy_type_FractionalPercent; extern const upb_msglayout envoy_type_Percent_msginit; extern const upb_msglayout envoy_type_FractionalPercent_msginit; -/* Enums */ - typedef enum { envoy_type_FractionalPercent_HUNDRED = 0, envoy_type_FractionalPercent_TEN_THOUSAND = 1, @@ -41,9 +39,10 @@ typedef enum { UPB_INLINE envoy_type_Percent *envoy_type_Percent_new(upb_arena *arena) { return (envoy_type_Percent *)upb_msg_new(&envoy_type_Percent_msginit, arena); } -UPB_INLINE envoy_type_Percent *envoy_type_Percent_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_type_Percent *envoy_type_Percent_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_type_Percent *ret = envoy_type_Percent_new(arena); - return (ret && upb_decode(buf, ret, &envoy_type_Percent_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_type_Percent_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_type_Percent_serialize(const envoy_type_Percent *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_type_Percent_msginit, arena, len); @@ -55,15 +54,15 @@ UPB_INLINE void envoy_type_Percent_set_value(envoy_type_Percent *msg, double val UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value; } - /* envoy.type.FractionalPercent */ UPB_INLINE envoy_type_FractionalPercent *envoy_type_FractionalPercent_new(upb_arena *arena) { return (envoy_type_FractionalPercent *)upb_msg_new(&envoy_type_FractionalPercent_msginit, arena); } -UPB_INLINE envoy_type_FractionalPercent *envoy_type_FractionalPercent_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_type_FractionalPercent *envoy_type_FractionalPercent_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_type_FractionalPercent *ret = envoy_type_FractionalPercent_new(arena); - return (ret && upb_decode(buf, ret, &envoy_type_FractionalPercent_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_type_FractionalPercent_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_type_FractionalPercent_serialize(const envoy_type_FractionalPercent *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_type_FractionalPercent_msginit, arena, len); @@ -79,7 +78,6 @@ UPB_INLINE void envoy_type_FractionalPercent_set_denominator(envoy_type_Fraction UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/envoy/type/range.upb.h b/src/core/ext/upb-generated/envoy/type/range.upb.h index de1846a1300..3e607745151 100644 --- a/src/core/ext/upb-generated/envoy/type/range.upb.h +++ b/src/core/ext/upb-generated/envoy/type/range.upb.h @@ -10,12 +10,12 @@ #define ENVOY_TYPE_RANGE_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -27,17 +27,16 @@ typedef struct envoy_type_DoubleRange envoy_type_DoubleRange; extern const upb_msglayout envoy_type_Int64Range_msginit; extern const upb_msglayout envoy_type_DoubleRange_msginit; -/* Enums */ - /* envoy.type.Int64Range */ UPB_INLINE envoy_type_Int64Range *envoy_type_Int64Range_new(upb_arena *arena) { return (envoy_type_Int64Range *)upb_msg_new(&envoy_type_Int64Range_msginit, arena); } -UPB_INLINE envoy_type_Int64Range *envoy_type_Int64Range_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_type_Int64Range *envoy_type_Int64Range_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_type_Int64Range *ret = envoy_type_Int64Range_new(arena); - return (ret && upb_decode(buf, ret, &envoy_type_Int64Range_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_type_Int64Range_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_type_Int64Range_serialize(const envoy_type_Int64Range *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_type_Int64Range_msginit, arena, len); @@ -53,15 +52,15 @@ UPB_INLINE void envoy_type_Int64Range_set_end(envoy_type_Int64Range *msg, int64_ UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)) = value; } - /* envoy.type.DoubleRange */ UPB_INLINE envoy_type_DoubleRange *envoy_type_DoubleRange_new(upb_arena *arena) { return (envoy_type_DoubleRange *)upb_msg_new(&envoy_type_DoubleRange_msginit, arena); } -UPB_INLINE envoy_type_DoubleRange *envoy_type_DoubleRange_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE envoy_type_DoubleRange *envoy_type_DoubleRange_parse(const char *buf, size_t size, + upb_arena *arena) { envoy_type_DoubleRange *ret = envoy_type_DoubleRange_new(arena); - return (ret && upb_decode(buf, ret, &envoy_type_DoubleRange_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &envoy_type_DoubleRange_msginit, arena)) ? ret : NULL; } UPB_INLINE char *envoy_type_DoubleRange_serialize(const envoy_type_DoubleRange *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &envoy_type_DoubleRange_msginit, arena, len); @@ -77,7 +76,6 @@ UPB_INLINE void envoy_type_DoubleRange_set_end(envoy_type_DoubleRange *msg, doub UPB_FIELD_AT(msg, double, UPB_SIZE(8, 8)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/gogoproto/gogo.upb.h b/src/core/ext/upb-generated/gogoproto/gogo.upb.h index 6b3dda647ee..530adbf32db 100644 --- a/src/core/ext/upb-generated/gogoproto/gogo.upb.h +++ b/src/core/ext/upb-generated/gogoproto/gogo.upb.h @@ -10,20 +10,17 @@ #define GOGOPROTO_GOGO_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif -/* Enums */ - - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/api/annotations.upb.h b/src/core/ext/upb-generated/google/api/annotations.upb.h index 5a49fffdd22..d81cd3d4446 100644 --- a/src/core/ext/upb-generated/google/api/annotations.upb.h +++ b/src/core/ext/upb-generated/google/api/annotations.upb.h @@ -10,20 +10,17 @@ #define GOOGLE_API_ANNOTATIONS_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif -/* Enums */ - - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/api/http.upb.h b/src/core/ext/upb-generated/google/api/http.upb.h index d8bda895b86..5e8bffea178 100644 --- a/src/core/ext/upb-generated/google/api/http.upb.h +++ b/src/core/ext/upb-generated/google/api/http.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_API_HTTP_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -30,17 +30,16 @@ extern const upb_msglayout google_api_Http_msginit; extern const upb_msglayout google_api_HttpRule_msginit; extern const upb_msglayout google_api_CustomHttpPattern_msginit; -/* Enums */ - /* google.api.Http */ UPB_INLINE google_api_Http *google_api_Http_new(upb_arena *arena) { return (google_api_Http *)upb_msg_new(&google_api_Http_msginit, arena); } -UPB_INLINE google_api_Http *google_api_Http_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_api_Http *google_api_Http_parse(const char *buf, size_t size, + upb_arena *arena) { google_api_Http *ret = google_api_Http_new(arena); - return (ret && upb_decode(buf, ret, &google_api_Http_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_api_Http_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_api_Http_serialize(const google_api_Http *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_api_Http_msginit, arena, len); @@ -66,15 +65,15 @@ UPB_INLINE void google_api_Http_set_fully_decode_reserved_expansion(google_api_H UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; } - /* google.api.HttpRule */ UPB_INLINE google_api_HttpRule *google_api_HttpRule_new(upb_arena *arena) { return (google_api_HttpRule *)upb_msg_new(&google_api_HttpRule_msginit, arena); } -UPB_INLINE google_api_HttpRule *google_api_HttpRule_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_api_HttpRule *google_api_HttpRule_parse(const char *buf, size_t size, + upb_arena *arena) { google_api_HttpRule *ret = google_api_HttpRule_new(arena); - return (ret && upb_decode(buf, ret, &google_api_HttpRule_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_api_HttpRule_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_api_HttpRule_serialize(const google_api_HttpRule *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_api_HttpRule_msginit, arena, len); @@ -87,9 +86,9 @@ typedef enum { google_api_HttpRule_pattern_delete = 5, google_api_HttpRule_pattern_patch = 6, google_api_HttpRule_pattern_custom = 8, - google_api_HttpRule_pattern_NOT_SET = 0, + google_api_HttpRule_pattern_NOT_SET = 0 } google_api_HttpRule_pattern_oneofcases; -UPB_INLINE google_api_HttpRule_pattern_oneofcases google_api_HttpRule_pattern_case(const google_api_HttpRule* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(36, 72)); } +UPB_INLINE google_api_HttpRule_pattern_oneofcases google_api_HttpRule_pattern_case(const google_api_HttpRule* msg) { return (google_api_HttpRule_pattern_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(36, 72)); } UPB_INLINE upb_strview google_api_HttpRule_selector(const google_api_HttpRule *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } UPB_INLINE bool google_api_HttpRule_has_get(const google_api_HttpRule *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(36, 72), 2); } @@ -158,15 +157,15 @@ UPB_INLINE void google_api_HttpRule_set_response_body(google_api_HttpRule *msg, UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 32)) = value; } - /* google.api.CustomHttpPattern */ UPB_INLINE google_api_CustomHttpPattern *google_api_CustomHttpPattern_new(upb_arena *arena) { return (google_api_CustomHttpPattern *)upb_msg_new(&google_api_CustomHttpPattern_msginit, arena); } -UPB_INLINE google_api_CustomHttpPattern *google_api_CustomHttpPattern_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_api_CustomHttpPattern *google_api_CustomHttpPattern_parse(const char *buf, size_t size, + upb_arena *arena) { google_api_CustomHttpPattern *ret = google_api_CustomHttpPattern_new(arena); - return (ret && upb_decode(buf, ret, &google_api_CustomHttpPattern_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_api_CustomHttpPattern_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_api_CustomHttpPattern_serialize(const google_api_CustomHttpPattern *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_api_CustomHttpPattern_msginit, arena, len); @@ -182,7 +181,6 @@ UPB_INLINE void google_api_CustomHttpPattern_set_path(google_api_CustomHttpPatte UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/protobuf/any.upb.h b/src/core/ext/upb-generated/google/protobuf/any.upb.h index 877e5bd606d..a591ba85d44 100644 --- a/src/core/ext/upb-generated/google/protobuf/any.upb.h +++ b/src/core/ext/upb-generated/google/protobuf/any.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_PROTOBUF_ANY_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -24,17 +24,16 @@ struct google_protobuf_Any; typedef struct google_protobuf_Any google_protobuf_Any; extern const upb_msglayout google_protobuf_Any_msginit; -/* Enums */ - /* google.protobuf.Any */ UPB_INLINE google_protobuf_Any *google_protobuf_Any_new(upb_arena *arena) { return (google_protobuf_Any *)upb_msg_new(&google_protobuf_Any_msginit, arena); } -UPB_INLINE google_protobuf_Any *google_protobuf_Any_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Any *google_protobuf_Any_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Any *ret = google_protobuf_Any_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Any_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Any_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Any_serialize(const google_protobuf_Any *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Any_msginit, arena, len); @@ -50,7 +49,6 @@ UPB_INLINE void google_protobuf_Any_set_value(google_protobuf_Any *msg, upb_strv UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h b/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h index 11868b28f1f..681614910e0 100644 --- a/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +++ b/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_PROTOBUF_DESCRIPTOR_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -102,8 +102,6 @@ extern const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit; extern const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit; extern const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit; -/* Enums */ - typedef enum { google_protobuf_FieldDescriptorProto_LABEL_OPTIONAL = 1, google_protobuf_FieldDescriptorProto_LABEL_REQUIRED = 2, @@ -161,9 +159,10 @@ typedef enum { UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_new(upb_arena *arena) { return (google_protobuf_FileDescriptorSet *)upb_msg_new(&google_protobuf_FileDescriptorSet_msginit, arena); } -UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_FileDescriptorSet *google_protobuf_FileDescriptorSet_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_FileDescriptorSet *ret = google_protobuf_FileDescriptorSet_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_FileDescriptorSet_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorSet_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_FileDescriptorSet_serialize(const google_protobuf_FileDescriptorSet *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_FileDescriptorSet_msginit, arena, len); @@ -185,15 +184,15 @@ UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescr return sub; } - /* google.protobuf.FileDescriptorProto */ UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_new(upb_arena *arena) { return (google_protobuf_FileDescriptorProto *)upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena); } -UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_FileDescriptorProto *google_protobuf_FileDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_FileDescriptorProto *ret = google_protobuf_FileDescriptorProto_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_FileDescriptorProto_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_FileDescriptorProto_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_FileDescriptorProto_serialize(const google_protobuf_FileDescriptorProto *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_FileDescriptorProto_msginit, arena, len); @@ -338,15 +337,15 @@ UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_F UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value; } - /* google.protobuf.DescriptorProto */ UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_new(upb_arena *arena) { return (google_protobuf_DescriptorProto *)upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); } -UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_DescriptorProto *google_protobuf_DescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_DescriptorProto *ret = google_protobuf_DescriptorProto_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_DescriptorProto_serialize(const google_protobuf_DescriptorProto *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_DescriptorProto_msginit, arena, len); @@ -484,15 +483,15 @@ UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobu msg, UPB_SIZE(44, 88), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } - /* google.protobuf.DescriptorProto.ExtensionRange */ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_new(upb_arena *arena) { return (google_protobuf_DescriptorProto_ExtensionRange *)upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena); } -UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange *google_protobuf_DescriptorProto_ExtensionRange_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_DescriptorProto_ExtensionRange *ret = google_protobuf_DescriptorProto_ExtensionRange_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_DescriptorProto_ExtensionRange_serialize(const google_protobuf_DescriptorProto_ExtensionRange *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_DescriptorProto_ExtensionRange_msginit, arena, len); @@ -527,15 +526,15 @@ UPB_INLINE struct google_protobuf_ExtensionRangeOptions* google_protobuf_Descrip return sub; } - /* google.protobuf.DescriptorProto.ReservedRange */ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_new(upb_arena *arena) { return (google_protobuf_DescriptorProto_ReservedRange *)upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena); } -UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_DescriptorProto_ReservedRange *google_protobuf_DescriptorProto_ReservedRange_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_DescriptorProto_ReservedRange *ret = google_protobuf_DescriptorProto_ReservedRange_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_DescriptorProto_ReservedRange_serialize(const google_protobuf_DescriptorProto_ReservedRange *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_DescriptorProto_ReservedRange_msginit, arena, len); @@ -555,15 +554,15 @@ UPB_INLINE void google_protobuf_DescriptorProto_ReservedRange_set_end(google_pro UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; } - /* google.protobuf.ExtensionRangeOptions */ UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_new(upb_arena *arena) { return (google_protobuf_ExtensionRangeOptions *)upb_msg_new(&google_protobuf_ExtensionRangeOptions_msginit, arena); } -UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_ExtensionRangeOptions *google_protobuf_ExtensionRangeOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_ExtensionRangeOptions *ret = google_protobuf_ExtensionRangeOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_ExtensionRangeOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_ExtensionRangeOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_ExtensionRangeOptions_serialize(const google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_ExtensionRangeOptions_msginit, arena, len); @@ -585,15 +584,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_Extension return sub; } - /* google.protobuf.FieldDescriptorProto */ UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_new(upb_arena *arena) { return (google_protobuf_FieldDescriptorProto *)upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); } -UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_FieldDescriptorProto *google_protobuf_FieldDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_FieldDescriptorProto *ret = google_protobuf_FieldDescriptorProto_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_FieldDescriptorProto_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldDescriptorProto_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_protobuf_FieldDescriptorProto *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len); @@ -670,15 +669,15 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protob UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(64, 96)) = value; } - /* google.protobuf.OneofDescriptorProto */ UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_new(upb_arena *arena) { return (google_protobuf_OneofDescriptorProto *)upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena); } -UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_OneofDescriptorProto *google_protobuf_OneofDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_OneofDescriptorProto *ret = google_protobuf_OneofDescriptorProto_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_OneofDescriptorProto_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofDescriptorProto_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_OneofDescriptorProto_serialize(const google_protobuf_OneofDescriptorProto *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_OneofDescriptorProto_msginit, arena, len); @@ -707,15 +706,15 @@ UPB_INLINE struct google_protobuf_OneofOptions* google_protobuf_OneofDescriptorP return sub; } - /* google.protobuf.EnumDescriptorProto */ UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_new(upb_arena *arena) { return (google_protobuf_EnumDescriptorProto *)upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); } -UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_EnumDescriptorProto *google_protobuf_EnumDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_EnumDescriptorProto *ret = google_protobuf_EnumDescriptorProto_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_EnumDescriptorProto_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_EnumDescriptorProto_serialize(const google_protobuf_EnumDescriptorProto *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_EnumDescriptorProto_msginit, arena, len); @@ -783,15 +782,15 @@ UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_pro msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } - /* google.protobuf.EnumDescriptorProto.EnumReservedRange */ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_new(upb_arena *arena) { return (google_protobuf_EnumDescriptorProto_EnumReservedRange *)upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena); } -UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange *google_protobuf_EnumDescriptorProto_EnumReservedRange_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_EnumDescriptorProto_EnumReservedRange *ret = google_protobuf_EnumDescriptorProto_EnumReservedRange_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_EnumDescriptorProto_EnumReservedRange_serialize(const google_protobuf_EnumDescriptorProto_EnumReservedRange *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena, len); @@ -811,15 +810,15 @@ UPB_INLINE void google_protobuf_EnumDescriptorProto_EnumReservedRange_set_end(go UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; } - /* google.protobuf.EnumValueDescriptorProto */ UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_new(upb_arena *arena) { return (google_protobuf_EnumValueDescriptorProto *)upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena); } -UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_EnumValueDescriptorProto *google_protobuf_EnumValueDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_EnumValueDescriptorProto *ret = google_protobuf_EnumValueDescriptorProto_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_EnumValueDescriptorProto_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueDescriptorProto_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google_protobuf_EnumValueDescriptorProto *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len); @@ -854,15 +853,15 @@ UPB_INLINE struct google_protobuf_EnumValueOptions* google_protobuf_EnumValueDes return sub; } - /* google.protobuf.ServiceDescriptorProto */ UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_new(upb_arena *arena) { return (google_protobuf_ServiceDescriptorProto *)upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena); } -UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_ServiceDescriptorProto *google_protobuf_ServiceDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_ServiceDescriptorProto *ret = google_protobuf_ServiceDescriptorProto_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_ServiceDescriptorProto_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceDescriptorProto_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_ServiceDescriptorProto_serialize(const google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_ServiceDescriptorProto_msginit, arena, len); @@ -905,15 +904,15 @@ UPB_INLINE struct google_protobuf_ServiceOptions* google_protobuf_ServiceDescrip return sub; } - /* google.protobuf.MethodDescriptorProto */ UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_new(upb_arena *arena) { return (google_protobuf_MethodDescriptorProto *)upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena); } -UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_MethodDescriptorProto *google_protobuf_MethodDescriptorProto_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_MethodDescriptorProto *ret = google_protobuf_MethodDescriptorProto_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_MethodDescriptorProto_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodDescriptorProto_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_protobuf_MethodDescriptorProto *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len); @@ -966,15 +965,15 @@ UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(googl UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; } - /* google.protobuf.FileOptions */ UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_new(upb_arena *arena) { return (google_protobuf_FileOptions *)upb_msg_new(&google_protobuf_FileOptions_msginit, arena); } -UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_FileOptions *google_protobuf_FileOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_FileOptions *ret = google_protobuf_FileOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_FileOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_FileOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_FileOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len); @@ -1116,15 +1115,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptio return sub; } - /* google.protobuf.MessageOptions */ UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_new(upb_arena *arena) { return (google_protobuf_MessageOptions *)upb_msg_new(&google_protobuf_MessageOptions_msginit, arena); } -UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_MessageOptions *google_protobuf_MessageOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_MessageOptions *ret = google_protobuf_MessageOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_MessageOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_MessageOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_MessageOptions_serialize(const google_protobuf_MessageOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_MessageOptions_msginit, arena, len); @@ -1170,15 +1169,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOp return sub; } - /* google.protobuf.FieldOptions */ UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_new(upb_arena *arena) { return (google_protobuf_FieldOptions *)upb_msg_new(&google_protobuf_FieldOptions_msginit, arena); } -UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_FieldOptions *google_protobuf_FieldOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_FieldOptions *ret = google_protobuf_FieldOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_FieldOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_FieldOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_FieldOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_FieldOptions_msginit, arena, len); @@ -1236,15 +1235,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOpti return sub; } - /* google.protobuf.OneofOptions */ UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_new(upb_arena *arena) { return (google_protobuf_OneofOptions *)upb_msg_new(&google_protobuf_OneofOptions_msginit, arena); } -UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_OneofOptions *google_protobuf_OneofOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_OneofOptions *ret = google_protobuf_OneofOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_OneofOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_OneofOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_OneofOptions_serialize(const google_protobuf_OneofOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_OneofOptions_msginit, arena, len); @@ -1266,15 +1265,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOpti return sub; } - /* google.protobuf.EnumOptions */ UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_new(upb_arena *arena) { return (google_protobuf_EnumOptions *)upb_msg_new(&google_protobuf_EnumOptions_msginit, arena); } -UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_EnumOptions *google_protobuf_EnumOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_EnumOptions *ret = google_protobuf_EnumOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_EnumOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_EnumOptions_serialize(const google_protobuf_EnumOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_EnumOptions_msginit, arena, len); @@ -1308,15 +1307,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptio return sub; } - /* google.protobuf.EnumValueOptions */ UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_new(upb_arena *arena) { return (google_protobuf_EnumValueOptions *)upb_msg_new(&google_protobuf_EnumValueOptions_msginit, arena); } -UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_EnumValueOptions *google_protobuf_EnumValueOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_EnumValueOptions *ret = google_protobuf_EnumValueOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_EnumValueOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_EnumValueOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_EnumValueOptions_serialize(const google_protobuf_EnumValueOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_EnumValueOptions_msginit, arena, len); @@ -1344,15 +1343,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValue return sub; } - /* google.protobuf.ServiceOptions */ UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_new(upb_arena *arena) { return (google_protobuf_ServiceOptions *)upb_msg_new(&google_protobuf_ServiceOptions_msginit, arena); } -UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_ServiceOptions *google_protobuf_ServiceOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_ServiceOptions *ret = google_protobuf_ServiceOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_ServiceOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_ServiceOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_ServiceOptions_serialize(const google_protobuf_ServiceOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_ServiceOptions_msginit, arena, len); @@ -1380,15 +1379,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOp return sub; } - /* google.protobuf.MethodOptions */ UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_new(upb_arena *arena) { return (google_protobuf_MethodOptions *)upb_msg_new(&google_protobuf_MethodOptions_msginit, arena); } -UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_MethodOptions *google_protobuf_MethodOptions_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_MethodOptions *ret = google_protobuf_MethodOptions_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_MethodOptions_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_MethodOptions_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_MethodOptions *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len); @@ -1422,15 +1421,15 @@ UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOpt return sub; } - /* google.protobuf.UninterpretedOption */ UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_new(upb_arena *arena) { return (google_protobuf_UninterpretedOption *)upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); } -UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_UninterpretedOption *google_protobuf_UninterpretedOption_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_UninterpretedOption *ret = google_protobuf_UninterpretedOption_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_UninterpretedOption_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_protobuf_UninterpretedOption *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_UninterpretedOption_msginit, arena, len); @@ -1488,15 +1487,15 @@ UPB_INLINE void google_protobuf_UninterpretedOption_set_aggregate_value(google_p UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(48, 64)) = value; } - /* google.protobuf.UninterpretedOption.NamePart */ UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_new(upb_arena *arena) { return (google_protobuf_UninterpretedOption_NamePart *)upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena); } -UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_UninterpretedOption_NamePart *google_protobuf_UninterpretedOption_NamePart_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_UninterpretedOption_NamePart *ret = google_protobuf_UninterpretedOption_NamePart_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_UninterpretedOption_NamePart_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_UninterpretedOption_NamePart_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const google_protobuf_UninterpretedOption_NamePart *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len); @@ -1516,15 +1515,15 @@ UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(go UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; } - /* google.protobuf.SourceCodeInfo */ UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_new(upb_arena *arena) { return (google_protobuf_SourceCodeInfo *)upb_msg_new(&google_protobuf_SourceCodeInfo_msginit, arena); } -UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_SourceCodeInfo *google_protobuf_SourceCodeInfo_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_SourceCodeInfo *ret = google_protobuf_SourceCodeInfo_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_SourceCodeInfo_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_SourceCodeInfo_serialize(const google_protobuf_SourceCodeInfo *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_SourceCodeInfo_msginit, arena, len); @@ -1546,15 +1545,15 @@ UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_Sourc return sub; } - /* google.protobuf.SourceCodeInfo.Location */ UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_new(upb_arena *arena) { return (google_protobuf_SourceCodeInfo_Location *)upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena); } -UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_SourceCodeInfo_Location *google_protobuf_SourceCodeInfo_Location_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_SourceCodeInfo_Location *ret = google_protobuf_SourceCodeInfo_Location_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_SourceCodeInfo_Location_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_SourceCodeInfo_Location_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_SourceCodeInfo_Location_serialize(const google_protobuf_SourceCodeInfo_Location *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_SourceCodeInfo_Location_msginit, arena, len); @@ -1607,15 +1606,15 @@ UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_com msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } - /* google.protobuf.GeneratedCodeInfo */ UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_new(upb_arena *arena) { return (google_protobuf_GeneratedCodeInfo *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_msginit, arena); } -UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_GeneratedCodeInfo *google_protobuf_GeneratedCodeInfo_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_GeneratedCodeInfo *ret = google_protobuf_GeneratedCodeInfo_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_GeneratedCodeInfo_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_GeneratedCodeInfo_serialize(const google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_msginit, arena, len); @@ -1637,15 +1636,15 @@ UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_ return sub; } - /* google.protobuf.GeneratedCodeInfo.Annotation */ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_new(upb_arena *arena) { return (google_protobuf_GeneratedCodeInfo_Annotation *)upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena); } -UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation *google_protobuf_GeneratedCodeInfo_Annotation_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_GeneratedCodeInfo_Annotation *ret = google_protobuf_GeneratedCodeInfo_Annotation_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena, len); @@ -1682,7 +1681,6 @@ UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_prot UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/protobuf/duration.upb.h b/src/core/ext/upb-generated/google/protobuf/duration.upb.h index bb116dcc89a..f4b35811daf 100644 --- a/src/core/ext/upb-generated/google/protobuf/duration.upb.h +++ b/src/core/ext/upb-generated/google/protobuf/duration.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_PROTOBUF_DURATION_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -24,17 +24,16 @@ struct google_protobuf_Duration; typedef struct google_protobuf_Duration google_protobuf_Duration; extern const upb_msglayout google_protobuf_Duration_msginit; -/* Enums */ - /* google.protobuf.Duration */ UPB_INLINE google_protobuf_Duration *google_protobuf_Duration_new(upb_arena *arena) { return (google_protobuf_Duration *)upb_msg_new(&google_protobuf_Duration_msginit, arena); } -UPB_INLINE google_protobuf_Duration *google_protobuf_Duration_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Duration *google_protobuf_Duration_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Duration *ret = google_protobuf_Duration_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Duration_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Duration_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Duration_serialize(const google_protobuf_Duration *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Duration_msginit, arena, len); @@ -50,7 +49,6 @@ UPB_INLINE void google_protobuf_Duration_set_nanos(google_protobuf_Duration *msg UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/protobuf/empty.upb.h b/src/core/ext/upb-generated/google/protobuf/empty.upb.h index 43b2edd8cc0..6232ecf6374 100644 --- a/src/core/ext/upb-generated/google/protobuf/empty.upb.h +++ b/src/core/ext/upb-generated/google/protobuf/empty.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_PROTOBUF_EMPTY_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -24,17 +24,16 @@ struct google_protobuf_Empty; typedef struct google_protobuf_Empty google_protobuf_Empty; extern const upb_msglayout google_protobuf_Empty_msginit; -/* Enums */ - /* google.protobuf.Empty */ UPB_INLINE google_protobuf_Empty *google_protobuf_Empty_new(upb_arena *arena) { return (google_protobuf_Empty *)upb_msg_new(&google_protobuf_Empty_msginit, arena); } -UPB_INLINE google_protobuf_Empty *google_protobuf_Empty_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Empty *google_protobuf_Empty_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Empty *ret = google_protobuf_Empty_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Empty_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Empty_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Empty_serialize(const google_protobuf_Empty *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Empty_msginit, arena, len); @@ -42,7 +41,6 @@ UPB_INLINE char *google_protobuf_Empty_serialize(const google_protobuf_Empty *ms - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/protobuf/struct.upb.h b/src/core/ext/upb-generated/google/protobuf/struct.upb.h index da5da203457..8d036b57663 100644 --- a/src/core/ext/upb-generated/google/protobuf/struct.upb.h +++ b/src/core/ext/upb-generated/google/protobuf/struct.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_PROTOBUF_STRUCT_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -33,8 +33,6 @@ extern const upb_msglayout google_protobuf_Struct_FieldsEntry_msginit; extern const upb_msglayout google_protobuf_Value_msginit; extern const upb_msglayout google_protobuf_ListValue_msginit; -/* Enums */ - typedef enum { google_protobuf_NULL_VALUE = 0 } google_protobuf_NullValue; @@ -45,9 +43,10 @@ typedef enum { UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_new(upb_arena *arena) { return (google_protobuf_Struct *)upb_msg_new(&google_protobuf_Struct_msginit, arena); } -UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Struct *google_protobuf_Struct_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Struct *ret = google_protobuf_Struct_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Struct_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Struct_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Struct_serialize(const google_protobuf_Struct *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Struct_msginit, arena, len); @@ -69,15 +68,15 @@ UPB_INLINE struct google_protobuf_Struct_FieldsEntry* google_protobuf_Struct_add return sub; } - /* google.protobuf.Struct.FieldsEntry */ UPB_INLINE google_protobuf_Struct_FieldsEntry *google_protobuf_Struct_FieldsEntry_new(upb_arena *arena) { return (google_protobuf_Struct_FieldsEntry *)upb_msg_new(&google_protobuf_Struct_FieldsEntry_msginit, arena); } -UPB_INLINE google_protobuf_Struct_FieldsEntry *google_protobuf_Struct_FieldsEntry_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Struct_FieldsEntry *google_protobuf_Struct_FieldsEntry_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Struct_FieldsEntry *ret = google_protobuf_Struct_FieldsEntry_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Struct_FieldsEntry_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Struct_FieldsEntry_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Struct_FieldsEntry_serialize(const google_protobuf_Struct_FieldsEntry *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Struct_FieldsEntry_msginit, arena, len); @@ -102,15 +101,15 @@ UPB_INLINE struct google_protobuf_Value* google_protobuf_Struct_FieldsEntry_muta return sub; } - /* google.protobuf.Value */ UPB_INLINE google_protobuf_Value *google_protobuf_Value_new(upb_arena *arena) { return (google_protobuf_Value *)upb_msg_new(&google_protobuf_Value_msginit, arena); } -UPB_INLINE google_protobuf_Value *google_protobuf_Value_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Value *google_protobuf_Value_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Value *ret = google_protobuf_Value_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Value_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Value_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Value_serialize(const google_protobuf_Value *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Value_msginit, arena, len); @@ -123,9 +122,9 @@ typedef enum { google_protobuf_Value_kind_bool_value = 4, google_protobuf_Value_kind_struct_value = 5, google_protobuf_Value_kind_list_value = 6, - google_protobuf_Value_kind_NOT_SET = 0, + google_protobuf_Value_kind_NOT_SET = 0 } google_protobuf_Value_kind_oneofcases; -UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(8, 16)); } +UPB_INLINE google_protobuf_Value_kind_oneofcases google_protobuf_Value_kind_case(const google_protobuf_Value* msg) { return (google_protobuf_Value_kind_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 16)); } UPB_INLINE bool google_protobuf_Value_has_null_value(const google_protobuf_Value *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(8, 16), 1); } UPB_INLINE int32_t google_protobuf_Value_null_value(const google_protobuf_Value *msg) { return UPB_READ_ONEOF(msg, int32_t, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, google_protobuf_NULL_VALUE); } @@ -177,15 +176,15 @@ UPB_INLINE struct google_protobuf_ListValue* google_protobuf_Value_mutable_list_ return sub; } - /* google.protobuf.ListValue */ UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_new(upb_arena *arena) { return (google_protobuf_ListValue *)upb_msg_new(&google_protobuf_ListValue_msginit, arena); } -UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_ListValue *google_protobuf_ListValue_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_ListValue *ret = google_protobuf_ListValue_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_ListValue_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_ListValue_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_ListValue_serialize(const google_protobuf_ListValue *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_ListValue_msginit, arena, len); @@ -207,7 +206,6 @@ UPB_INLINE struct google_protobuf_Value* google_protobuf_ListValue_add_values(go return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h b/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h index 23d39e55f9d..ec4dfe9444a 100644 --- a/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +++ b/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_PROTOBUF_TIMESTAMP_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -24,17 +24,16 @@ struct google_protobuf_Timestamp; typedef struct google_protobuf_Timestamp google_protobuf_Timestamp; extern const upb_msglayout google_protobuf_Timestamp_msginit; -/* Enums */ - /* google.protobuf.Timestamp */ UPB_INLINE google_protobuf_Timestamp *google_protobuf_Timestamp_new(upb_arena *arena) { return (google_protobuf_Timestamp *)upb_msg_new(&google_protobuf_Timestamp_msginit, arena); } -UPB_INLINE google_protobuf_Timestamp *google_protobuf_Timestamp_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Timestamp *google_protobuf_Timestamp_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Timestamp *ret = google_protobuf_Timestamp_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Timestamp_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Timestamp_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Timestamp_serialize(const google_protobuf_Timestamp *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Timestamp_msginit, arena, len); @@ -50,7 +49,6 @@ UPB_INLINE void google_protobuf_Timestamp_set_nanos(google_protobuf_Timestamp *m UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h b/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h index b9897ecceb2..589c21355bf 100644 --- a/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +++ b/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_PROTOBUF_WRAPPERS_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -48,17 +48,16 @@ extern const upb_msglayout google_protobuf_BoolValue_msginit; extern const upb_msglayout google_protobuf_StringValue_msginit; extern const upb_msglayout google_protobuf_BytesValue_msginit; -/* Enums */ - /* google.protobuf.DoubleValue */ UPB_INLINE google_protobuf_DoubleValue *google_protobuf_DoubleValue_new(upb_arena *arena) { return (google_protobuf_DoubleValue *)upb_msg_new(&google_protobuf_DoubleValue_msginit, arena); } -UPB_INLINE google_protobuf_DoubleValue *google_protobuf_DoubleValue_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_DoubleValue *google_protobuf_DoubleValue_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_DoubleValue *ret = google_protobuf_DoubleValue_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_DoubleValue_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_DoubleValue_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_DoubleValue_serialize(const google_protobuf_DoubleValue *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_DoubleValue_msginit, arena, len); @@ -70,15 +69,15 @@ UPB_INLINE void google_protobuf_DoubleValue_set_value(google_protobuf_DoubleValu UPB_FIELD_AT(msg, double, UPB_SIZE(0, 0)) = value; } - /* google.protobuf.FloatValue */ UPB_INLINE google_protobuf_FloatValue *google_protobuf_FloatValue_new(upb_arena *arena) { return (google_protobuf_FloatValue *)upb_msg_new(&google_protobuf_FloatValue_msginit, arena); } -UPB_INLINE google_protobuf_FloatValue *google_protobuf_FloatValue_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_FloatValue *google_protobuf_FloatValue_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_FloatValue *ret = google_protobuf_FloatValue_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_FloatValue_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_FloatValue_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_FloatValue_serialize(const google_protobuf_FloatValue *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_FloatValue_msginit, arena, len); @@ -90,15 +89,15 @@ UPB_INLINE void google_protobuf_FloatValue_set_value(google_protobuf_FloatValue UPB_FIELD_AT(msg, float, UPB_SIZE(0, 0)) = value; } - /* google.protobuf.Int64Value */ UPB_INLINE google_protobuf_Int64Value *google_protobuf_Int64Value_new(upb_arena *arena) { return (google_protobuf_Int64Value *)upb_msg_new(&google_protobuf_Int64Value_msginit, arena); } -UPB_INLINE google_protobuf_Int64Value *google_protobuf_Int64Value_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Int64Value *google_protobuf_Int64Value_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Int64Value *ret = google_protobuf_Int64Value_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Int64Value_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Int64Value_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Int64Value_serialize(const google_protobuf_Int64Value *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Int64Value_msginit, arena, len); @@ -110,15 +109,15 @@ UPB_INLINE void google_protobuf_Int64Value_set_value(google_protobuf_Int64Value UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)) = value; } - /* google.protobuf.UInt64Value */ UPB_INLINE google_protobuf_UInt64Value *google_protobuf_UInt64Value_new(upb_arena *arena) { return (google_protobuf_UInt64Value *)upb_msg_new(&google_protobuf_UInt64Value_msginit, arena); } -UPB_INLINE google_protobuf_UInt64Value *google_protobuf_UInt64Value_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_UInt64Value *google_protobuf_UInt64Value_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_UInt64Value *ret = google_protobuf_UInt64Value_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_UInt64Value_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_UInt64Value_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_UInt64Value_serialize(const google_protobuf_UInt64Value *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_UInt64Value_msginit, arena, len); @@ -130,15 +129,15 @@ UPB_INLINE void google_protobuf_UInt64Value_set_value(google_protobuf_UInt64Valu UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(0, 0)) = value; } - /* google.protobuf.Int32Value */ UPB_INLINE google_protobuf_Int32Value *google_protobuf_Int32Value_new(upb_arena *arena) { return (google_protobuf_Int32Value *)upb_msg_new(&google_protobuf_Int32Value_msginit, arena); } -UPB_INLINE google_protobuf_Int32Value *google_protobuf_Int32Value_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_Int32Value *google_protobuf_Int32Value_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_Int32Value *ret = google_protobuf_Int32Value_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_Int32Value_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_Int32Value_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_Int32Value_serialize(const google_protobuf_Int32Value *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_Int32Value_msginit, arena, len); @@ -150,15 +149,15 @@ UPB_INLINE void google_protobuf_Int32Value_set_value(google_protobuf_Int32Value UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; } - /* google.protobuf.UInt32Value */ UPB_INLINE google_protobuf_UInt32Value *google_protobuf_UInt32Value_new(upb_arena *arena) { return (google_protobuf_UInt32Value *)upb_msg_new(&google_protobuf_UInt32Value_msginit, arena); } -UPB_INLINE google_protobuf_UInt32Value *google_protobuf_UInt32Value_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_UInt32Value *google_protobuf_UInt32Value_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_UInt32Value *ret = google_protobuf_UInt32Value_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_UInt32Value_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_UInt32Value_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_UInt32Value_serialize(const google_protobuf_UInt32Value *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_UInt32Value_msginit, arena, len); @@ -170,15 +169,15 @@ UPB_INLINE void google_protobuf_UInt32Value_set_value(google_protobuf_UInt32Valu UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value; } - /* google.protobuf.BoolValue */ UPB_INLINE google_protobuf_BoolValue *google_protobuf_BoolValue_new(upb_arena *arena) { return (google_protobuf_BoolValue *)upb_msg_new(&google_protobuf_BoolValue_msginit, arena); } -UPB_INLINE google_protobuf_BoolValue *google_protobuf_BoolValue_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_BoolValue *google_protobuf_BoolValue_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_BoolValue *ret = google_protobuf_BoolValue_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_BoolValue_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_BoolValue_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_BoolValue_serialize(const google_protobuf_BoolValue *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_BoolValue_msginit, arena, len); @@ -190,15 +189,15 @@ UPB_INLINE void google_protobuf_BoolValue_set_value(google_protobuf_BoolValue *m UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; } - /* google.protobuf.StringValue */ UPB_INLINE google_protobuf_StringValue *google_protobuf_StringValue_new(upb_arena *arena) { return (google_protobuf_StringValue *)upb_msg_new(&google_protobuf_StringValue_msginit, arena); } -UPB_INLINE google_protobuf_StringValue *google_protobuf_StringValue_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_StringValue *google_protobuf_StringValue_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_StringValue *ret = google_protobuf_StringValue_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_StringValue_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_StringValue_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_StringValue_serialize(const google_protobuf_StringValue *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_StringValue_msginit, arena, len); @@ -210,15 +209,15 @@ UPB_INLINE void google_protobuf_StringValue_set_value(google_protobuf_StringValu UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } - /* google.protobuf.BytesValue */ UPB_INLINE google_protobuf_BytesValue *google_protobuf_BytesValue_new(upb_arena *arena) { return (google_protobuf_BytesValue *)upb_msg_new(&google_protobuf_BytesValue_msginit, arena); } -UPB_INLINE google_protobuf_BytesValue *google_protobuf_BytesValue_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_protobuf_BytesValue *google_protobuf_BytesValue_parse(const char *buf, size_t size, + upb_arena *arena) { google_protobuf_BytesValue *ret = google_protobuf_BytesValue_new(arena); - return (ret && upb_decode(buf, ret, &google_protobuf_BytesValue_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_protobuf_BytesValue_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_protobuf_BytesValue_serialize(const google_protobuf_BytesValue *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_protobuf_BytesValue_msginit, arena, len); @@ -230,7 +229,6 @@ UPB_INLINE void google_protobuf_BytesValue_set_value(google_protobuf_BytesValue UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/google/rpc/status.upb.h b/src/core/ext/upb-generated/google/rpc/status.upb.h index ccdac652130..6c35d83dc1d 100644 --- a/src/core/ext/upb-generated/google/rpc/status.upb.h +++ b/src/core/ext/upb-generated/google/rpc/status.upb.h @@ -10,12 +10,12 @@ #define GOOGLE_RPC_STATUS_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -26,17 +26,16 @@ extern const upb_msglayout google_rpc_Status_msginit; struct google_protobuf_Any; extern const upb_msglayout google_protobuf_Any_msginit; -/* Enums */ - /* google.rpc.Status */ UPB_INLINE google_rpc_Status *google_rpc_Status_new(upb_arena *arena) { return (google_rpc_Status *)upb_msg_new(&google_rpc_Status_msginit, arena); } -UPB_INLINE google_rpc_Status *google_rpc_Status_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE google_rpc_Status *google_rpc_Status_parse(const char *buf, size_t size, + upb_arena *arena) { google_rpc_Status *ret = google_rpc_Status_new(arena); - return (ret && upb_decode(buf, ret, &google_rpc_Status_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &google_rpc_Status_msginit, arena)) ? ret : NULL; } UPB_INLINE char *google_rpc_Status_serialize(const google_rpc_Status *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &google_rpc_Status_msginit, arena, len); @@ -66,7 +65,6 @@ UPB_INLINE struct google_protobuf_Any* google_rpc_Status_add_details(google_rpc_ return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.c b/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.c new file mode 100644 index 00000000000..52477e183dc --- /dev/null +++ b/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.c @@ -0,0 +1,49 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/gcp/altscontext.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "grpc/gcp/altscontext.upb.h" +#include "src/proto/grpc/gcp/transport_security_common.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout *const grpc_gcp_AltsContext_submsgs[2] = { + &grpc_gcp_AltsContext_PeerAttributesEntry_msginit, + &grpc_gcp_RpcProtocolVersions_msginit, +}; + +static const upb_msglayout_field grpc_gcp_AltsContext__fields[7] = { + {1, UPB_SIZE(8, 8), 0, 0, 9, 1}, + {2, UPB_SIZE(16, 24), 0, 0, 9, 1}, + {3, UPB_SIZE(0, 0), 0, 0, 14, 1}, + {4, UPB_SIZE(24, 40), 0, 0, 9, 1}, + {5, UPB_SIZE(32, 56), 0, 0, 9, 1}, + {6, UPB_SIZE(40, 72), 0, 1, 11, 1}, + {7, UPB_SIZE(44, 80), 0, 0, 11, 3}, +}; + +const upb_msglayout grpc_gcp_AltsContext_msginit = { + &grpc_gcp_AltsContext_submsgs[0], + &grpc_gcp_AltsContext__fields[0], + UPB_SIZE(48, 96), 7, false, +}; + +static const upb_msglayout_field grpc_gcp_AltsContext_PeerAttributesEntry__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 16), 0, 0, 9, 1}, +}; + +const upb_msglayout grpc_gcp_AltsContext_PeerAttributesEntry_msginit = { + NULL, + &grpc_gcp_AltsContext_PeerAttributesEntry__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.h b/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.h new file mode 100644 index 00000000000..d9a4d58854d --- /dev/null +++ b/src/core/ext/upb-generated/grpc/gcp/altscontext.upb.h @@ -0,0 +1,126 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/gcp/altscontext.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ +#define GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct grpc_gcp_AltsContext; +struct grpc_gcp_AltsContext_PeerAttributesEntry; +typedef struct grpc_gcp_AltsContext grpc_gcp_AltsContext; +typedef struct grpc_gcp_AltsContext_PeerAttributesEntry grpc_gcp_AltsContext_PeerAttributesEntry; +extern const upb_msglayout grpc_gcp_AltsContext_msginit; +extern const upb_msglayout grpc_gcp_AltsContext_PeerAttributesEntry_msginit; +struct grpc_gcp_RpcProtocolVersions; +extern const upb_msglayout grpc_gcp_RpcProtocolVersions_msginit; + + +/* grpc.gcp.AltsContext */ + +UPB_INLINE grpc_gcp_AltsContext *grpc_gcp_AltsContext_new(upb_arena *arena) { + return (grpc_gcp_AltsContext *)upb_msg_new(&grpc_gcp_AltsContext_msginit, arena); +} +UPB_INLINE grpc_gcp_AltsContext *grpc_gcp_AltsContext_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_AltsContext *ret = grpc_gcp_AltsContext_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_AltsContext_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_AltsContext_serialize(const grpc_gcp_AltsContext *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_AltsContext_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_gcp_AltsContext_application_protocol(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } +UPB_INLINE upb_strview grpc_gcp_AltsContext_record_protocol(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)); } +UPB_INLINE int32_t grpc_gcp_AltsContext_security_level(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview grpc_gcp_AltsContext_peer_service_account(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(24, 40)); } +UPB_INLINE upb_strview grpc_gcp_AltsContext_local_service_account(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 56)); } +UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_AltsContext_peer_rpc_versions(const grpc_gcp_AltsContext *msg) { return UPB_FIELD_AT(msg, const struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(40, 72)); } +UPB_INLINE const grpc_gcp_AltsContext_PeerAttributesEntry* const* grpc_gcp_AltsContext_peer_attributes(const grpc_gcp_AltsContext *msg, size_t *len) { return (const grpc_gcp_AltsContext_PeerAttributesEntry* const*)_upb_array_accessor(msg, UPB_SIZE(44, 80), len); } + +UPB_INLINE void grpc_gcp_AltsContext_set_application_protocol(grpc_gcp_AltsContext *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void grpc_gcp_AltsContext_set_record_protocol(grpc_gcp_AltsContext *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)) = value; +} +UPB_INLINE void grpc_gcp_AltsContext_set_security_level(grpc_gcp_AltsContext *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_AltsContext_set_peer_service_account(grpc_gcp_AltsContext *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(24, 40)) = value; +} +UPB_INLINE void grpc_gcp_AltsContext_set_local_service_account(grpc_gcp_AltsContext *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 56)) = value; +} +UPB_INLINE void grpc_gcp_AltsContext_set_peer_rpc_versions(grpc_gcp_AltsContext *msg, struct grpc_gcp_RpcProtocolVersions* value) { + UPB_FIELD_AT(msg, struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(40, 72)) = value; +} +UPB_INLINE struct grpc_gcp_RpcProtocolVersions* grpc_gcp_AltsContext_mutable_peer_rpc_versions(grpc_gcp_AltsContext *msg, upb_arena *arena) { + struct grpc_gcp_RpcProtocolVersions* sub = (struct grpc_gcp_RpcProtocolVersions*)grpc_gcp_AltsContext_peer_rpc_versions(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_RpcProtocolVersions*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena); + if (!sub) return NULL; + grpc_gcp_AltsContext_set_peer_rpc_versions(msg, sub); + } + return sub; +} +UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry** grpc_gcp_AltsContext_mutable_peer_attributes(grpc_gcp_AltsContext *msg, size_t *len) { + return (grpc_gcp_AltsContext_PeerAttributesEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 80), len); +} +UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry** grpc_gcp_AltsContext_resize_peer_attributes(grpc_gcp_AltsContext *msg, size_t len, upb_arena *arena) { + return (grpc_gcp_AltsContext_PeerAttributesEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 80), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct grpc_gcp_AltsContext_PeerAttributesEntry* grpc_gcp_AltsContext_add_peer_attributes(grpc_gcp_AltsContext *msg, upb_arena *arena) { + struct grpc_gcp_AltsContext_PeerAttributesEntry* sub = (struct grpc_gcp_AltsContext_PeerAttributesEntry*)upb_msg_new(&grpc_gcp_AltsContext_PeerAttributesEntry_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(44, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* grpc.gcp.AltsContext.PeerAttributesEntry */ + +UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry *grpc_gcp_AltsContext_PeerAttributesEntry_new(upb_arena *arena) { + return (grpc_gcp_AltsContext_PeerAttributesEntry *)upb_msg_new(&grpc_gcp_AltsContext_PeerAttributesEntry_msginit, arena); +} +UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry *grpc_gcp_AltsContext_PeerAttributesEntry_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_AltsContext_PeerAttributesEntry *ret = grpc_gcp_AltsContext_PeerAttributesEntry_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_AltsContext_PeerAttributesEntry_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_AltsContext_PeerAttributesEntry_serialize(const grpc_gcp_AltsContext_PeerAttributesEntry *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_AltsContext_PeerAttributesEntry_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_gcp_AltsContext_PeerAttributesEntry_key(const grpc_gcp_AltsContext_PeerAttributesEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview grpc_gcp_AltsContext_PeerAttributesEntry_value(const grpc_gcp_AltsContext_PeerAttributesEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } + +UPB_INLINE void grpc_gcp_AltsContext_PeerAttributesEntry_set_key(grpc_gcp_AltsContext_PeerAttributesEntry *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_AltsContext_PeerAttributesEntry_set_value(grpc_gcp_AltsContext_PeerAttributesEntry *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* GRPC_GCP_ALTSCONTEXT_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.c b/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.c new file mode 100644 index 00000000000..9e957538323 --- /dev/null +++ b/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.c @@ -0,0 +1,209 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/gcp/handshaker.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "grpc/gcp/handshaker.upb.h" +#include "src/proto/grpc/gcp/transport_security_common.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout_field grpc_gcp_Endpoint__fields[3] = { + {1, UPB_SIZE(12, 16), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 8), 0, 0, 5, 1}, + {3, UPB_SIZE(0, 0), 0, 0, 14, 1}, +}; + +const upb_msglayout grpc_gcp_Endpoint_msginit = { + NULL, + &grpc_gcp_Endpoint__fields[0], + UPB_SIZE(24, 32), 3, false, +}; + +static const upb_msglayout *const grpc_gcp_Identity_submsgs[1] = { + &grpc_gcp_Identity_AttributesEntry_msginit, +}; + +static const upb_msglayout_field grpc_gcp_Identity__fields[3] = { + {1, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 0, 9, 1}, + {2, UPB_SIZE(4, 8), UPB_SIZE(-13, -25), 0, 9, 1}, + {3, UPB_SIZE(0, 0), 0, 0, 11, 3}, +}; + +const upb_msglayout grpc_gcp_Identity_msginit = { + &grpc_gcp_Identity_submsgs[0], + &grpc_gcp_Identity__fields[0], + UPB_SIZE(16, 32), 3, false, +}; + +static const upb_msglayout_field grpc_gcp_Identity_AttributesEntry__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 16), 0, 0, 9, 1}, +}; + +const upb_msglayout grpc_gcp_Identity_AttributesEntry_msginit = { + NULL, + &grpc_gcp_Identity_AttributesEntry__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout *const grpc_gcp_StartClientHandshakeReq_submsgs[5] = { + &grpc_gcp_Endpoint_msginit, + &grpc_gcp_Identity_msginit, + &grpc_gcp_RpcProtocolVersions_msginit, +}; + +static const upb_msglayout_field grpc_gcp_StartClientHandshakeReq__fields[9] = { + {1, UPB_SIZE(0, 0), 0, 0, 14, 1}, + {2, UPB_SIZE(32, 56), 0, 0, 9, 3}, + {3, UPB_SIZE(36, 64), 0, 0, 9, 3}, + {4, UPB_SIZE(40, 72), 0, 1, 11, 3}, + {5, UPB_SIZE(16, 24), 0, 1, 11, 1}, + {6, UPB_SIZE(20, 32), 0, 0, 11, 1}, + {7, UPB_SIZE(24, 40), 0, 0, 11, 1}, + {8, UPB_SIZE(8, 8), 0, 0, 9, 1}, + {9, UPB_SIZE(28, 48), 0, 2, 11, 1}, +}; + +const upb_msglayout grpc_gcp_StartClientHandshakeReq_msginit = { + &grpc_gcp_StartClientHandshakeReq_submsgs[0], + &grpc_gcp_StartClientHandshakeReq__fields[0], + UPB_SIZE(48, 80), 9, false, +}; + +static const upb_msglayout *const grpc_gcp_ServerHandshakeParameters_submsgs[1] = { + &grpc_gcp_Identity_msginit, +}; + +static const upb_msglayout_field grpc_gcp_ServerHandshakeParameters__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 3}, + {2, UPB_SIZE(4, 8), 0, 0, 11, 3}, +}; + +const upb_msglayout grpc_gcp_ServerHandshakeParameters_msginit = { + &grpc_gcp_ServerHandshakeParameters_submsgs[0], + &grpc_gcp_ServerHandshakeParameters__fields[0], + UPB_SIZE(8, 16), 2, false, +}; + +static const upb_msglayout *const grpc_gcp_StartServerHandshakeReq_submsgs[4] = { + &grpc_gcp_Endpoint_msginit, + &grpc_gcp_RpcProtocolVersions_msginit, + &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, +}; + +static const upb_msglayout_field grpc_gcp_StartServerHandshakeReq__fields[6] = { + {1, UPB_SIZE(20, 40), 0, 0, 9, 3}, + {2, UPB_SIZE(24, 48), 0, 2, 11, 3}, + {3, UPB_SIZE(0, 0), 0, 0, 12, 1}, + {4, UPB_SIZE(8, 16), 0, 0, 11, 1}, + {5, UPB_SIZE(12, 24), 0, 0, 11, 1}, + {6, UPB_SIZE(16, 32), 0, 1, 11, 1}, +}; + +const upb_msglayout grpc_gcp_StartServerHandshakeReq_msginit = { + &grpc_gcp_StartServerHandshakeReq_submsgs[0], + &grpc_gcp_StartServerHandshakeReq__fields[0], + UPB_SIZE(32, 64), 6, false, +}; + +static const upb_msglayout *const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_submsgs[1] = { + &grpc_gcp_ServerHandshakeParameters_msginit, +}; + +static const upb_msglayout_field grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 5, 1}, + {2, UPB_SIZE(4, 8), 0, 0, 11, 1}, +}; + +const upb_msglayout grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit = { + &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_submsgs[0], + &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry__fields[0], + UPB_SIZE(8, 16), 2, false, +}; + +static const upb_msglayout_field grpc_gcp_NextHandshakeMessageReq__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 12, 1}, +}; + +const upb_msglayout grpc_gcp_NextHandshakeMessageReq_msginit = { + NULL, + &grpc_gcp_NextHandshakeMessageReq__fields[0], + UPB_SIZE(8, 16), 1, false, +}; + +static const upb_msglayout *const grpc_gcp_HandshakerReq_submsgs[3] = { + &grpc_gcp_NextHandshakeMessageReq_msginit, + &grpc_gcp_StartClientHandshakeReq_msginit, + &grpc_gcp_StartServerHandshakeReq_msginit, +}; + +static const upb_msglayout_field grpc_gcp_HandshakerReq__fields[3] = { + {1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1}, + {2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 2, 11, 1}, + {3, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1}, +}; + +const upb_msglayout grpc_gcp_HandshakerReq_msginit = { + &grpc_gcp_HandshakerReq_submsgs[0], + &grpc_gcp_HandshakerReq__fields[0], + UPB_SIZE(8, 16), 3, false, +}; + +static const upb_msglayout *const grpc_gcp_HandshakerResult_submsgs[3] = { + &grpc_gcp_Identity_msginit, + &grpc_gcp_RpcProtocolVersions_msginit, +}; + +static const upb_msglayout_field grpc_gcp_HandshakerResult__fields[7] = { + {1, UPB_SIZE(4, 8), 0, 0, 9, 1}, + {2, UPB_SIZE(12, 24), 0, 0, 9, 1}, + {3, UPB_SIZE(20, 40), 0, 0, 12, 1}, + {4, UPB_SIZE(28, 56), 0, 0, 11, 1}, + {5, UPB_SIZE(32, 64), 0, 0, 11, 1}, + {6, UPB_SIZE(0, 0), 0, 0, 8, 1}, + {7, UPB_SIZE(36, 72), 0, 1, 11, 1}, +}; + +const upb_msglayout grpc_gcp_HandshakerResult_msginit = { + &grpc_gcp_HandshakerResult_submsgs[0], + &grpc_gcp_HandshakerResult__fields[0], + UPB_SIZE(40, 80), 7, false, +}; + +static const upb_msglayout_field grpc_gcp_HandshakerStatus__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 13, 1}, + {2, UPB_SIZE(4, 8), 0, 0, 9, 1}, +}; + +const upb_msglayout grpc_gcp_HandshakerStatus_msginit = { + NULL, + &grpc_gcp_HandshakerStatus__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout *const grpc_gcp_HandshakerResp_submsgs[2] = { + &grpc_gcp_HandshakerResult_msginit, + &grpc_gcp_HandshakerStatus_msginit, +}; + +static const upb_msglayout_field grpc_gcp_HandshakerResp__fields[4] = { + {1, UPB_SIZE(4, 8), 0, 0, 12, 1}, + {2, UPB_SIZE(0, 0), 0, 0, 13, 1}, + {3, UPB_SIZE(12, 24), 0, 0, 11, 1}, + {4, UPB_SIZE(16, 32), 0, 1, 11, 1}, +}; + +const upb_msglayout grpc_gcp_HandshakerResp_msginit = { + &grpc_gcp_HandshakerResp_submsgs[0], + &grpc_gcp_HandshakerResp__fields[0], + UPB_SIZE(24, 48), 4, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.h b/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.h new file mode 100644 index 00000000000..97c8d44f45e --- /dev/null +++ b/src/core/ext/upb-generated/grpc/gcp/handshaker.upb.h @@ -0,0 +1,681 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/gcp/handshaker.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ +#define GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct grpc_gcp_Endpoint; +struct grpc_gcp_Identity; +struct grpc_gcp_Identity_AttributesEntry; +struct grpc_gcp_StartClientHandshakeReq; +struct grpc_gcp_ServerHandshakeParameters; +struct grpc_gcp_StartServerHandshakeReq; +struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry; +struct grpc_gcp_NextHandshakeMessageReq; +struct grpc_gcp_HandshakerReq; +struct grpc_gcp_HandshakerResult; +struct grpc_gcp_HandshakerStatus; +struct grpc_gcp_HandshakerResp; +typedef struct grpc_gcp_Endpoint grpc_gcp_Endpoint; +typedef struct grpc_gcp_Identity grpc_gcp_Identity; +typedef struct grpc_gcp_Identity_AttributesEntry grpc_gcp_Identity_AttributesEntry; +typedef struct grpc_gcp_StartClientHandshakeReq grpc_gcp_StartClientHandshakeReq; +typedef struct grpc_gcp_ServerHandshakeParameters grpc_gcp_ServerHandshakeParameters; +typedef struct grpc_gcp_StartServerHandshakeReq grpc_gcp_StartServerHandshakeReq; +typedef struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry; +typedef struct grpc_gcp_NextHandshakeMessageReq grpc_gcp_NextHandshakeMessageReq; +typedef struct grpc_gcp_HandshakerReq grpc_gcp_HandshakerReq; +typedef struct grpc_gcp_HandshakerResult grpc_gcp_HandshakerResult; +typedef struct grpc_gcp_HandshakerStatus grpc_gcp_HandshakerStatus; +typedef struct grpc_gcp_HandshakerResp grpc_gcp_HandshakerResp; +extern const upb_msglayout grpc_gcp_Endpoint_msginit; +extern const upb_msglayout grpc_gcp_Identity_msginit; +extern const upb_msglayout grpc_gcp_Identity_AttributesEntry_msginit; +extern const upb_msglayout grpc_gcp_StartClientHandshakeReq_msginit; +extern const upb_msglayout grpc_gcp_ServerHandshakeParameters_msginit; +extern const upb_msglayout grpc_gcp_StartServerHandshakeReq_msginit; +extern const upb_msglayout grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit; +extern const upb_msglayout grpc_gcp_NextHandshakeMessageReq_msginit; +extern const upb_msglayout grpc_gcp_HandshakerReq_msginit; +extern const upb_msglayout grpc_gcp_HandshakerResult_msginit; +extern const upb_msglayout grpc_gcp_HandshakerStatus_msginit; +extern const upb_msglayout grpc_gcp_HandshakerResp_msginit; +struct grpc_gcp_RpcProtocolVersions; +extern const upb_msglayout grpc_gcp_RpcProtocolVersions_msginit; + +typedef enum { + grpc_gcp_HANDSHAKE_PROTOCOL_UNSPECIFIED = 0, + grpc_gcp_TLS = 1, + grpc_gcp_ALTS = 2 +} grpc_gcp_HandshakeProtocol; + +typedef enum { + grpc_gcp_NETWORK_PROTOCOL_UNSPECIFIED = 0, + grpc_gcp_TCP = 1, + grpc_gcp_UDP = 2 +} grpc_gcp_NetworkProtocol; + + +/* grpc.gcp.Endpoint */ + +UPB_INLINE grpc_gcp_Endpoint *grpc_gcp_Endpoint_new(upb_arena *arena) { + return (grpc_gcp_Endpoint *)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena); +} +UPB_INLINE grpc_gcp_Endpoint *grpc_gcp_Endpoint_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_Endpoint *ret = grpc_gcp_Endpoint_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_Endpoint_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_Endpoint_serialize(const grpc_gcp_Endpoint *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_Endpoint_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_gcp_Endpoint_ip_address(const grpc_gcp_Endpoint *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)); } +UPB_INLINE int32_t grpc_gcp_Endpoint_port(const grpc_gcp_Endpoint *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)); } +UPB_INLINE int32_t grpc_gcp_Endpoint_protocol(const grpc_gcp_Endpoint *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } + +UPB_INLINE void grpc_gcp_Endpoint_set_ip_address(grpc_gcp_Endpoint *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 16)) = value; +} +UPB_INLINE void grpc_gcp_Endpoint_set_port(grpc_gcp_Endpoint *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void grpc_gcp_Endpoint_set_protocol(grpc_gcp_Endpoint *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; +} + +/* grpc.gcp.Identity */ + +UPB_INLINE grpc_gcp_Identity *grpc_gcp_Identity_new(upb_arena *arena) { + return (grpc_gcp_Identity *)upb_msg_new(&grpc_gcp_Identity_msginit, arena); +} +UPB_INLINE grpc_gcp_Identity *grpc_gcp_Identity_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_Identity *ret = grpc_gcp_Identity_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_Identity_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_Identity_serialize(const grpc_gcp_Identity *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_Identity_msginit, arena, len); +} + +typedef enum { + grpc_gcp_Identity_identity_oneof_service_account = 1, + grpc_gcp_Identity_identity_oneof_hostname = 2, + grpc_gcp_Identity_identity_oneof_NOT_SET = 0 +} grpc_gcp_Identity_identity_oneof_oneofcases; +UPB_INLINE grpc_gcp_Identity_identity_oneof_oneofcases grpc_gcp_Identity_identity_oneof_case(const grpc_gcp_Identity* msg) { return (grpc_gcp_Identity_identity_oneof_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(12, 24)); } + +UPB_INLINE bool grpc_gcp_Identity_has_service_account(const grpc_gcp_Identity *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 1); } +UPB_INLINE upb_strview grpc_gcp_Identity_service_account(const grpc_gcp_Identity *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 1, upb_strview_make("", strlen(""))); } +UPB_INLINE bool grpc_gcp_Identity_has_hostname(const grpc_gcp_Identity *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(12, 24), 2); } +UPB_INLINE upb_strview grpc_gcp_Identity_hostname(const grpc_gcp_Identity *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), UPB_SIZE(12, 24), 2, upb_strview_make("", strlen(""))); } +UPB_INLINE const grpc_gcp_Identity_AttributesEntry* const* grpc_gcp_Identity_attributes(const grpc_gcp_Identity *msg, size_t *len) { return (const grpc_gcp_Identity_AttributesEntry* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } + +UPB_INLINE void grpc_gcp_Identity_set_service_account(grpc_gcp_Identity *msg, upb_strview value) { + UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 1); +} +UPB_INLINE void grpc_gcp_Identity_set_hostname(grpc_gcp_Identity *msg, upb_strview value) { + UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(4, 8), value, UPB_SIZE(12, 24), 2); +} +UPB_INLINE grpc_gcp_Identity_AttributesEntry** grpc_gcp_Identity_mutable_attributes(grpc_gcp_Identity *msg, size_t *len) { + return (grpc_gcp_Identity_AttributesEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE grpc_gcp_Identity_AttributesEntry** grpc_gcp_Identity_resize_attributes(grpc_gcp_Identity *msg, size_t len, upb_arena *arena) { + return (grpc_gcp_Identity_AttributesEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct grpc_gcp_Identity_AttributesEntry* grpc_gcp_Identity_add_attributes(grpc_gcp_Identity *msg, upb_arena *arena) { + struct grpc_gcp_Identity_AttributesEntry* sub = (struct grpc_gcp_Identity_AttributesEntry*)upb_msg_new(&grpc_gcp_Identity_AttributesEntry_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* grpc.gcp.Identity.AttributesEntry */ + +UPB_INLINE grpc_gcp_Identity_AttributesEntry *grpc_gcp_Identity_AttributesEntry_new(upb_arena *arena) { + return (grpc_gcp_Identity_AttributesEntry *)upb_msg_new(&grpc_gcp_Identity_AttributesEntry_msginit, arena); +} +UPB_INLINE grpc_gcp_Identity_AttributesEntry *grpc_gcp_Identity_AttributesEntry_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_Identity_AttributesEntry *ret = grpc_gcp_Identity_AttributesEntry_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_Identity_AttributesEntry_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_Identity_AttributesEntry_serialize(const grpc_gcp_Identity_AttributesEntry *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_Identity_AttributesEntry_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_gcp_Identity_AttributesEntry_key(const grpc_gcp_Identity_AttributesEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview grpc_gcp_Identity_AttributesEntry_value(const grpc_gcp_Identity_AttributesEntry *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)); } + +UPB_INLINE void grpc_gcp_Identity_AttributesEntry_set_key(grpc_gcp_Identity_AttributesEntry *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_Identity_AttributesEntry_set_value(grpc_gcp_Identity_AttributesEntry *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 16)) = value; +} + +/* grpc.gcp.StartClientHandshakeReq */ + +UPB_INLINE grpc_gcp_StartClientHandshakeReq *grpc_gcp_StartClientHandshakeReq_new(upb_arena *arena) { + return (grpc_gcp_StartClientHandshakeReq *)upb_msg_new(&grpc_gcp_StartClientHandshakeReq_msginit, arena); +} +UPB_INLINE grpc_gcp_StartClientHandshakeReq *grpc_gcp_StartClientHandshakeReq_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_StartClientHandshakeReq *ret = grpc_gcp_StartClientHandshakeReq_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_StartClientHandshakeReq_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_StartClientHandshakeReq_serialize(const grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_StartClientHandshakeReq_msginit, arena, len); +} + +UPB_INLINE int32_t grpc_gcp_StartClientHandshakeReq_handshake_security_protocol(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview const* grpc_gcp_StartClientHandshakeReq_application_protocols(const grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(32, 56), len); } +UPB_INLINE upb_strview const* grpc_gcp_StartClientHandshakeReq_record_protocols(const grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(36, 64), len); } +UPB_INLINE const grpc_gcp_Identity* const* grpc_gcp_StartClientHandshakeReq_target_identities(const grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { return (const grpc_gcp_Identity* const*)_upb_array_accessor(msg, UPB_SIZE(40, 72), len); } +UPB_INLINE const grpc_gcp_Identity* grpc_gcp_StartClientHandshakeReq_local_identity(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Identity*, UPB_SIZE(16, 24)); } +UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_local_endpoint(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Endpoint*, UPB_SIZE(20, 32)); } +UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_remote_endpoint(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Endpoint*, UPB_SIZE(24, 40)); } +UPB_INLINE upb_strview grpc_gcp_StartClientHandshakeReq_target_name(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } +UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartClientHandshakeReq_rpc_versions(const grpc_gcp_StartClientHandshakeReq *msg) { return UPB_FIELD_AT(msg, const struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(28, 48)); } + +UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_handshake_security_protocol(grpc_gcp_StartClientHandshakeReq *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE upb_strview* grpc_gcp_StartClientHandshakeReq_mutable_application_protocols(grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 56), len); +} +UPB_INLINE upb_strview* grpc_gcp_StartClientHandshakeReq_resize_application_protocols(grpc_gcp_StartClientHandshakeReq *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(32, 56), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_add_application_protocols(grpc_gcp_StartClientHandshakeReq *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(32, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} +UPB_INLINE upb_strview* grpc_gcp_StartClientHandshakeReq_mutable_record_protocols(grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 64), len); +} +UPB_INLINE upb_strview* grpc_gcp_StartClientHandshakeReq_resize_record_protocols(grpc_gcp_StartClientHandshakeReq *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(36, 64), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_add_record_protocols(grpc_gcp_StartClientHandshakeReq *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(36, 64), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} +UPB_INLINE grpc_gcp_Identity** grpc_gcp_StartClientHandshakeReq_mutable_target_identities(grpc_gcp_StartClientHandshakeReq *msg, size_t *len) { + return (grpc_gcp_Identity**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 72), len); +} +UPB_INLINE grpc_gcp_Identity** grpc_gcp_StartClientHandshakeReq_resize_target_identities(grpc_gcp_StartClientHandshakeReq *msg, size_t len, upb_arena *arena) { + return (grpc_gcp_Identity**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 72), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_StartClientHandshakeReq_add_target_identities(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(40, 72), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_local_identity(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Identity* value) { + UPB_FIELD_AT(msg, grpc_gcp_Identity*, UPB_SIZE(16, 24)) = value; +} +UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_StartClientHandshakeReq_mutable_local_identity(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)grpc_gcp_StartClientHandshakeReq_local_identity(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena); + if (!sub) return NULL; + grpc_gcp_StartClientHandshakeReq_set_local_identity(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_local_endpoint(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Endpoint* value) { + UPB_FIELD_AT(msg, grpc_gcp_Endpoint*, UPB_SIZE(20, 32)) = value; +} +UPB_INLINE struct grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_mutable_local_endpoint(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_Endpoint* sub = (struct grpc_gcp_Endpoint*)grpc_gcp_StartClientHandshakeReq_local_endpoint(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_Endpoint*)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena); + if (!sub) return NULL; + grpc_gcp_StartClientHandshakeReq_set_local_endpoint(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_remote_endpoint(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Endpoint* value) { + UPB_FIELD_AT(msg, grpc_gcp_Endpoint*, UPB_SIZE(24, 40)) = value; +} +UPB_INLINE struct grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_mutable_remote_endpoint(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_Endpoint* sub = (struct grpc_gcp_Endpoint*)grpc_gcp_StartClientHandshakeReq_remote_endpoint(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_Endpoint*)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena); + if (!sub) return NULL; + grpc_gcp_StartClientHandshakeReq_set_remote_endpoint(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_target_name(grpc_gcp_StartClientHandshakeReq *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_rpc_versions(grpc_gcp_StartClientHandshakeReq *msg, struct grpc_gcp_RpcProtocolVersions* value) { + UPB_FIELD_AT(msg, struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(28, 48)) = value; +} +UPB_INLINE struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartClientHandshakeReq_mutable_rpc_versions(grpc_gcp_StartClientHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_RpcProtocolVersions* sub = (struct grpc_gcp_RpcProtocolVersions*)grpc_gcp_StartClientHandshakeReq_rpc_versions(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_RpcProtocolVersions*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena); + if (!sub) return NULL; + grpc_gcp_StartClientHandshakeReq_set_rpc_versions(msg, sub); + } + return sub; +} + +/* grpc.gcp.ServerHandshakeParameters */ + +UPB_INLINE grpc_gcp_ServerHandshakeParameters *grpc_gcp_ServerHandshakeParameters_new(upb_arena *arena) { + return (grpc_gcp_ServerHandshakeParameters *)upb_msg_new(&grpc_gcp_ServerHandshakeParameters_msginit, arena); +} +UPB_INLINE grpc_gcp_ServerHandshakeParameters *grpc_gcp_ServerHandshakeParameters_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_ServerHandshakeParameters *ret = grpc_gcp_ServerHandshakeParameters_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_ServerHandshakeParameters_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_ServerHandshakeParameters_serialize(const grpc_gcp_ServerHandshakeParameters *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_ServerHandshakeParameters_msginit, arena, len); +} + +UPB_INLINE upb_strview const* grpc_gcp_ServerHandshakeParameters_record_protocols(const grpc_gcp_ServerHandshakeParameters *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } +UPB_INLINE const grpc_gcp_Identity* const* grpc_gcp_ServerHandshakeParameters_local_identities(const grpc_gcp_ServerHandshakeParameters *msg, size_t *len) { return (const grpc_gcp_Identity* const*)_upb_array_accessor(msg, UPB_SIZE(4, 8), len); } + +UPB_INLINE upb_strview* grpc_gcp_ServerHandshakeParameters_mutable_record_protocols(grpc_gcp_ServerHandshakeParameters *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE upb_strview* grpc_gcp_ServerHandshakeParameters_resize_record_protocols(grpc_gcp_ServerHandshakeParameters *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool grpc_gcp_ServerHandshakeParameters_add_record_protocols(grpc_gcp_ServerHandshakeParameters *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} +UPB_INLINE grpc_gcp_Identity** grpc_gcp_ServerHandshakeParameters_mutable_local_identities(grpc_gcp_ServerHandshakeParameters *msg, size_t *len) { + return (grpc_gcp_Identity**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); +} +UPB_INLINE grpc_gcp_Identity** grpc_gcp_ServerHandshakeParameters_resize_local_identities(grpc_gcp_ServerHandshakeParameters *msg, size_t len, upb_arena *arena) { + return (grpc_gcp_Identity**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_ServerHandshakeParameters_add_local_identities(grpc_gcp_ServerHandshakeParameters *msg, upb_arena *arena) { + struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* grpc.gcp.StartServerHandshakeReq */ + +UPB_INLINE grpc_gcp_StartServerHandshakeReq *grpc_gcp_StartServerHandshakeReq_new(upb_arena *arena) { + return (grpc_gcp_StartServerHandshakeReq *)upb_msg_new(&grpc_gcp_StartServerHandshakeReq_msginit, arena); +} +UPB_INLINE grpc_gcp_StartServerHandshakeReq *grpc_gcp_StartServerHandshakeReq_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_StartServerHandshakeReq *ret = grpc_gcp_StartServerHandshakeReq_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_StartServerHandshakeReq_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_StartServerHandshakeReq_serialize(const grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_StartServerHandshakeReq_msginit, arena, len); +} + +UPB_INLINE upb_strview const* grpc_gcp_StartServerHandshakeReq_application_protocols(const grpc_gcp_StartServerHandshakeReq *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); } +UPB_INLINE const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* const* grpc_gcp_StartServerHandshakeReq_handshake_parameters(const grpc_gcp_StartServerHandshakeReq *msg, size_t *len) { return (const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); } +UPB_INLINE upb_strview grpc_gcp_StartServerHandshakeReq_in_bytes(const grpc_gcp_StartServerHandshakeReq *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartServerHandshakeReq_local_endpoint(const grpc_gcp_StartServerHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Endpoint*, UPB_SIZE(8, 16)); } +UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartServerHandshakeReq_remote_endpoint(const grpc_gcp_StartServerHandshakeReq *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Endpoint*, UPB_SIZE(12, 24)); } +UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartServerHandshakeReq_rpc_versions(const grpc_gcp_StartServerHandshakeReq *msg) { return UPB_FIELD_AT(msg, const struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(16, 32)); } + +UPB_INLINE upb_strview* grpc_gcp_StartServerHandshakeReq_mutable_application_protocols(grpc_gcp_StartServerHandshakeReq *msg, size_t *len) { + return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); +} +UPB_INLINE upb_strview* grpc_gcp_StartServerHandshakeReq_resize_application_protocols(grpc_gcp_StartServerHandshakeReq *msg, size_t len, upb_arena *arena) { + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(8, 16), UPB_TYPE_STRING, arena); +} +UPB_INLINE bool grpc_gcp_StartServerHandshakeReq_add_application_protocols(grpc_gcp_StartServerHandshakeReq *msg, upb_strview val, upb_arena *arena) { + return _upb_array_append_accessor( + msg, UPB_SIZE(20, 40), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); +} +UPB_INLINE grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry** grpc_gcp_StartServerHandshakeReq_mutable_handshake_parameters(grpc_gcp_StartServerHandshakeReq *msg, size_t *len) { + return (grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); +} +UPB_INLINE grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry** grpc_gcp_StartServerHandshakeReq_resize_handshake_parameters(grpc_gcp_StartServerHandshakeReq *msg, size_t len, upb_arena *arena) { + return (grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* grpc_gcp_StartServerHandshakeReq_add_handshake_parameters(grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry* sub = (struct grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry*)upb_msg_new(&grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} +UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_in_bytes(grpc_gcp_StartServerHandshakeReq *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_local_endpoint(grpc_gcp_StartServerHandshakeReq *msg, grpc_gcp_Endpoint* value) { + UPB_FIELD_AT(msg, grpc_gcp_Endpoint*, UPB_SIZE(8, 16)) = value; +} +UPB_INLINE struct grpc_gcp_Endpoint* grpc_gcp_StartServerHandshakeReq_mutable_local_endpoint(grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_Endpoint* sub = (struct grpc_gcp_Endpoint*)grpc_gcp_StartServerHandshakeReq_local_endpoint(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_Endpoint*)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena); + if (!sub) return NULL; + grpc_gcp_StartServerHandshakeReq_set_local_endpoint(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_remote_endpoint(grpc_gcp_StartServerHandshakeReq *msg, grpc_gcp_Endpoint* value) { + UPB_FIELD_AT(msg, grpc_gcp_Endpoint*, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE struct grpc_gcp_Endpoint* grpc_gcp_StartServerHandshakeReq_mutable_remote_endpoint(grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_Endpoint* sub = (struct grpc_gcp_Endpoint*)grpc_gcp_StartServerHandshakeReq_remote_endpoint(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_Endpoint*)upb_msg_new(&grpc_gcp_Endpoint_msginit, arena); + if (!sub) return NULL; + grpc_gcp_StartServerHandshakeReq_set_remote_endpoint(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_rpc_versions(grpc_gcp_StartServerHandshakeReq *msg, struct grpc_gcp_RpcProtocolVersions* value) { + UPB_FIELD_AT(msg, struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(16, 32)) = value; +} +UPB_INLINE struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartServerHandshakeReq_mutable_rpc_versions(grpc_gcp_StartServerHandshakeReq *msg, upb_arena *arena) { + struct grpc_gcp_RpcProtocolVersions* sub = (struct grpc_gcp_RpcProtocolVersions*)grpc_gcp_StartServerHandshakeReq_rpc_versions(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_RpcProtocolVersions*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena); + if (!sub) return NULL; + grpc_gcp_StartServerHandshakeReq_set_rpc_versions(msg, sub); + } + return sub; +} + +/* grpc.gcp.StartServerHandshakeReq.HandshakeParametersEntry */ + +UPB_INLINE grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_new(upb_arena *arena) { + return (grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *)upb_msg_new(&grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, arena); +} +UPB_INLINE grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *ret = grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_serialize(const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_msginit, arena, len); +} + +UPB_INLINE int32_t grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_key(const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } +UPB_INLINE const grpc_gcp_ServerHandshakeParameters* grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_value(const grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_ServerHandshakeParameters*, UPB_SIZE(4, 8)); } + +UPB_INLINE void grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_key(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_value(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg, grpc_gcp_ServerHandshakeParameters* value) { + UPB_FIELD_AT(msg, grpc_gcp_ServerHandshakeParameters*, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE struct grpc_gcp_ServerHandshakeParameters* grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_mutable_value(grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry *msg, upb_arena *arena) { + struct grpc_gcp_ServerHandshakeParameters* sub = (struct grpc_gcp_ServerHandshakeParameters*)grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_value(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_ServerHandshakeParameters*)upb_msg_new(&grpc_gcp_ServerHandshakeParameters_msginit, arena); + if (!sub) return NULL; + grpc_gcp_StartServerHandshakeReq_HandshakeParametersEntry_set_value(msg, sub); + } + return sub; +} + +/* grpc.gcp.NextHandshakeMessageReq */ + +UPB_INLINE grpc_gcp_NextHandshakeMessageReq *grpc_gcp_NextHandshakeMessageReq_new(upb_arena *arena) { + return (grpc_gcp_NextHandshakeMessageReq *)upb_msg_new(&grpc_gcp_NextHandshakeMessageReq_msginit, arena); +} +UPB_INLINE grpc_gcp_NextHandshakeMessageReq *grpc_gcp_NextHandshakeMessageReq_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_NextHandshakeMessageReq *ret = grpc_gcp_NextHandshakeMessageReq_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_NextHandshakeMessageReq_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_NextHandshakeMessageReq_serialize(const grpc_gcp_NextHandshakeMessageReq *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_NextHandshakeMessageReq_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_gcp_NextHandshakeMessageReq_in_bytes(const grpc_gcp_NextHandshakeMessageReq *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } + +UPB_INLINE void grpc_gcp_NextHandshakeMessageReq_set_in_bytes(grpc_gcp_NextHandshakeMessageReq *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} + +/* grpc.gcp.HandshakerReq */ + +UPB_INLINE grpc_gcp_HandshakerReq *grpc_gcp_HandshakerReq_new(upb_arena *arena) { + return (grpc_gcp_HandshakerReq *)upb_msg_new(&grpc_gcp_HandshakerReq_msginit, arena); +} +UPB_INLINE grpc_gcp_HandshakerReq *grpc_gcp_HandshakerReq_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_HandshakerReq *ret = grpc_gcp_HandshakerReq_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_HandshakerReq_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_HandshakerReq_serialize(const grpc_gcp_HandshakerReq *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_HandshakerReq_msginit, arena, len); +} + +typedef enum { + grpc_gcp_HandshakerReq_req_oneof_client_start = 1, + grpc_gcp_HandshakerReq_req_oneof_server_start = 2, + grpc_gcp_HandshakerReq_req_oneof_next = 3, + grpc_gcp_HandshakerReq_req_oneof_NOT_SET = 0 +} grpc_gcp_HandshakerReq_req_oneof_oneofcases; +UPB_INLINE grpc_gcp_HandshakerReq_req_oneof_oneofcases grpc_gcp_HandshakerReq_req_oneof_case(const grpc_gcp_HandshakerReq* msg) { return (grpc_gcp_HandshakerReq_req_oneof_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); } + +UPB_INLINE bool grpc_gcp_HandshakerReq_has_client_start(const grpc_gcp_HandshakerReq *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); } +UPB_INLINE const grpc_gcp_StartClientHandshakeReq* grpc_gcp_HandshakerReq_client_start(const grpc_gcp_HandshakerReq *msg) { return UPB_READ_ONEOF(msg, const grpc_gcp_StartClientHandshakeReq*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); } +UPB_INLINE bool grpc_gcp_HandshakerReq_has_server_start(const grpc_gcp_HandshakerReq *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); } +UPB_INLINE const grpc_gcp_StartServerHandshakeReq* grpc_gcp_HandshakerReq_server_start(const grpc_gcp_HandshakerReq *msg) { return UPB_READ_ONEOF(msg, const grpc_gcp_StartServerHandshakeReq*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); } +UPB_INLINE bool grpc_gcp_HandshakerReq_has_next(const grpc_gcp_HandshakerReq *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 3); } +UPB_INLINE const grpc_gcp_NextHandshakeMessageReq* grpc_gcp_HandshakerReq_next(const grpc_gcp_HandshakerReq *msg) { return UPB_READ_ONEOF(msg, const grpc_gcp_NextHandshakeMessageReq*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 3, NULL); } + +UPB_INLINE void grpc_gcp_HandshakerReq_set_client_start(grpc_gcp_HandshakerReq *msg, grpc_gcp_StartClientHandshakeReq* value) { + UPB_WRITE_ONEOF(msg, grpc_gcp_StartClientHandshakeReq*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1); +} +UPB_INLINE struct grpc_gcp_StartClientHandshakeReq* grpc_gcp_HandshakerReq_mutable_client_start(grpc_gcp_HandshakerReq *msg, upb_arena *arena) { + struct grpc_gcp_StartClientHandshakeReq* sub = (struct grpc_gcp_StartClientHandshakeReq*)grpc_gcp_HandshakerReq_client_start(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_StartClientHandshakeReq*)upb_msg_new(&grpc_gcp_StartClientHandshakeReq_msginit, arena); + if (!sub) return NULL; + grpc_gcp_HandshakerReq_set_client_start(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_HandshakerReq_set_server_start(grpc_gcp_HandshakerReq *msg, grpc_gcp_StartServerHandshakeReq* value) { + UPB_WRITE_ONEOF(msg, grpc_gcp_StartServerHandshakeReq*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2); +} +UPB_INLINE struct grpc_gcp_StartServerHandshakeReq* grpc_gcp_HandshakerReq_mutable_server_start(grpc_gcp_HandshakerReq *msg, upb_arena *arena) { + struct grpc_gcp_StartServerHandshakeReq* sub = (struct grpc_gcp_StartServerHandshakeReq*)grpc_gcp_HandshakerReq_server_start(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_StartServerHandshakeReq*)upb_msg_new(&grpc_gcp_StartServerHandshakeReq_msginit, arena); + if (!sub) return NULL; + grpc_gcp_HandshakerReq_set_server_start(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_HandshakerReq_set_next(grpc_gcp_HandshakerReq *msg, grpc_gcp_NextHandshakeMessageReq* value) { + UPB_WRITE_ONEOF(msg, grpc_gcp_NextHandshakeMessageReq*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 3); +} +UPB_INLINE struct grpc_gcp_NextHandshakeMessageReq* grpc_gcp_HandshakerReq_mutable_next(grpc_gcp_HandshakerReq *msg, upb_arena *arena) { + struct grpc_gcp_NextHandshakeMessageReq* sub = (struct grpc_gcp_NextHandshakeMessageReq*)grpc_gcp_HandshakerReq_next(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_NextHandshakeMessageReq*)upb_msg_new(&grpc_gcp_NextHandshakeMessageReq_msginit, arena); + if (!sub) return NULL; + grpc_gcp_HandshakerReq_set_next(msg, sub); + } + return sub; +} + +/* grpc.gcp.HandshakerResult */ + +UPB_INLINE grpc_gcp_HandshakerResult *grpc_gcp_HandshakerResult_new(upb_arena *arena) { + return (grpc_gcp_HandshakerResult *)upb_msg_new(&grpc_gcp_HandshakerResult_msginit, arena); +} +UPB_INLINE grpc_gcp_HandshakerResult *grpc_gcp_HandshakerResult_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_HandshakerResult *ret = grpc_gcp_HandshakerResult_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_HandshakerResult_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_HandshakerResult_serialize(const grpc_gcp_HandshakerResult *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_HandshakerResult_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_gcp_HandshakerResult_application_protocol(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE upb_strview grpc_gcp_HandshakerResult_record_protocol(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)); } +UPB_INLINE upb_strview grpc_gcp_HandshakerResult_key_data(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)); } +UPB_INLINE const grpc_gcp_Identity* grpc_gcp_HandshakerResult_peer_identity(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Identity*, UPB_SIZE(28, 56)); } +UPB_INLINE const grpc_gcp_Identity* grpc_gcp_HandshakerResult_local_identity(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_Identity*, UPB_SIZE(32, 64)); } +UPB_INLINE bool grpc_gcp_HandshakerResult_keep_channel_open(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)); } +UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_HandshakerResult_peer_rpc_versions(const grpc_gcp_HandshakerResult *msg) { return UPB_FIELD_AT(msg, const struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(36, 72)); } + +UPB_INLINE void grpc_gcp_HandshakerResult_set_application_protocol(grpc_gcp_HandshakerResult *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE void grpc_gcp_HandshakerResult_set_record_protocol(grpc_gcp_HandshakerResult *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE void grpc_gcp_HandshakerResult_set_key_data(grpc_gcp_HandshakerResult *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(20, 40)) = value; +} +UPB_INLINE void grpc_gcp_HandshakerResult_set_peer_identity(grpc_gcp_HandshakerResult *msg, grpc_gcp_Identity* value) { + UPB_FIELD_AT(msg, grpc_gcp_Identity*, UPB_SIZE(28, 56)) = value; +} +UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_HandshakerResult_mutable_peer_identity(grpc_gcp_HandshakerResult *msg, upb_arena *arena) { + struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)grpc_gcp_HandshakerResult_peer_identity(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena); + if (!sub) return NULL; + grpc_gcp_HandshakerResult_set_peer_identity(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_HandshakerResult_set_local_identity(grpc_gcp_HandshakerResult *msg, grpc_gcp_Identity* value) { + UPB_FIELD_AT(msg, grpc_gcp_Identity*, UPB_SIZE(32, 64)) = value; +} +UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_HandshakerResult_mutable_local_identity(grpc_gcp_HandshakerResult *msg, upb_arena *arena) { + struct grpc_gcp_Identity* sub = (struct grpc_gcp_Identity*)grpc_gcp_HandshakerResult_local_identity(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_Identity*)upb_msg_new(&grpc_gcp_Identity_msginit, arena); + if (!sub) return NULL; + grpc_gcp_HandshakerResult_set_local_identity(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_HandshakerResult_set_keep_channel_open(grpc_gcp_HandshakerResult *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_HandshakerResult_set_peer_rpc_versions(grpc_gcp_HandshakerResult *msg, struct grpc_gcp_RpcProtocolVersions* value) { + UPB_FIELD_AT(msg, struct grpc_gcp_RpcProtocolVersions*, UPB_SIZE(36, 72)) = value; +} +UPB_INLINE struct grpc_gcp_RpcProtocolVersions* grpc_gcp_HandshakerResult_mutable_peer_rpc_versions(grpc_gcp_HandshakerResult *msg, upb_arena *arena) { + struct grpc_gcp_RpcProtocolVersions* sub = (struct grpc_gcp_RpcProtocolVersions*)grpc_gcp_HandshakerResult_peer_rpc_versions(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_RpcProtocolVersions*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena); + if (!sub) return NULL; + grpc_gcp_HandshakerResult_set_peer_rpc_versions(msg, sub); + } + return sub; +} + +/* grpc.gcp.HandshakerStatus */ + +UPB_INLINE grpc_gcp_HandshakerStatus *grpc_gcp_HandshakerStatus_new(upb_arena *arena) { + return (grpc_gcp_HandshakerStatus *)upb_msg_new(&grpc_gcp_HandshakerStatus_msginit, arena); +} +UPB_INLINE grpc_gcp_HandshakerStatus *grpc_gcp_HandshakerStatus_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_HandshakerStatus *ret = grpc_gcp_HandshakerStatus_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_HandshakerStatus_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_HandshakerStatus_serialize(const grpc_gcp_HandshakerStatus *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_HandshakerStatus_msginit, arena, len); +} + +UPB_INLINE uint32_t grpc_gcp_HandshakerStatus_code(const grpc_gcp_HandshakerStatus *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview grpc_gcp_HandshakerStatus_details(const grpc_gcp_HandshakerStatus *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } + +UPB_INLINE void grpc_gcp_HandshakerStatus_set_code(grpc_gcp_HandshakerStatus *msg, uint32_t value) { + UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_HandshakerStatus_set_details(grpc_gcp_HandshakerStatus *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} + +/* grpc.gcp.HandshakerResp */ + +UPB_INLINE grpc_gcp_HandshakerResp *grpc_gcp_HandshakerResp_new(upb_arena *arena) { + return (grpc_gcp_HandshakerResp *)upb_msg_new(&grpc_gcp_HandshakerResp_msginit, arena); +} +UPB_INLINE grpc_gcp_HandshakerResp *grpc_gcp_HandshakerResp_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_HandshakerResp *ret = grpc_gcp_HandshakerResp_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_HandshakerResp_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_HandshakerResp_serialize(const grpc_gcp_HandshakerResp *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_HandshakerResp_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_gcp_HandshakerResp_out_frames(const grpc_gcp_HandshakerResp *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)); } +UPB_INLINE uint32_t grpc_gcp_HandshakerResp_bytes_consumed(const grpc_gcp_HandshakerResp *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); } +UPB_INLINE const grpc_gcp_HandshakerResult* grpc_gcp_HandshakerResp_result(const grpc_gcp_HandshakerResp *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_HandshakerResult*, UPB_SIZE(12, 24)); } +UPB_INLINE const grpc_gcp_HandshakerStatus* grpc_gcp_HandshakerResp_status(const grpc_gcp_HandshakerResp *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_HandshakerStatus*, UPB_SIZE(16, 32)); } + +UPB_INLINE void grpc_gcp_HandshakerResp_set_out_frames(grpc_gcp_HandshakerResp *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE void grpc_gcp_HandshakerResp_set_bytes_consumed(grpc_gcp_HandshakerResp *msg, uint32_t value) { + UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_HandshakerResp_set_result(grpc_gcp_HandshakerResp *msg, grpc_gcp_HandshakerResult* value) { + UPB_FIELD_AT(msg, grpc_gcp_HandshakerResult*, UPB_SIZE(12, 24)) = value; +} +UPB_INLINE struct grpc_gcp_HandshakerResult* grpc_gcp_HandshakerResp_mutable_result(grpc_gcp_HandshakerResp *msg, upb_arena *arena) { + struct grpc_gcp_HandshakerResult* sub = (struct grpc_gcp_HandshakerResult*)grpc_gcp_HandshakerResp_result(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_HandshakerResult*)upb_msg_new(&grpc_gcp_HandshakerResult_msginit, arena); + if (!sub) return NULL; + grpc_gcp_HandshakerResp_set_result(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_HandshakerResp_set_status(grpc_gcp_HandshakerResp *msg, grpc_gcp_HandshakerStatus* value) { + UPB_FIELD_AT(msg, grpc_gcp_HandshakerStatus*, UPB_SIZE(16, 32)) = value; +} +UPB_INLINE struct grpc_gcp_HandshakerStatus* grpc_gcp_HandshakerResp_mutable_status(grpc_gcp_HandshakerResp *msg, upb_arena *arena) { + struct grpc_gcp_HandshakerStatus* sub = (struct grpc_gcp_HandshakerStatus*)grpc_gcp_HandshakerResp_status(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_HandshakerStatus*)upb_msg_new(&grpc_gcp_HandshakerStatus_msginit, arena); + if (!sub) return NULL; + grpc_gcp_HandshakerResp_set_status(msg, sub); + } + return sub; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* GRPC_GCP_HANDSHAKER_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.c b/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.c new file mode 100644 index 00000000000..19859504b87 --- /dev/null +++ b/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.c @@ -0,0 +1,42 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/gcp/transport_security_common.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "grpc/gcp/transport_security_common.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout *const grpc_gcp_RpcProtocolVersions_submsgs[2] = { + &grpc_gcp_RpcProtocolVersions_Version_msginit, +}; + +static const upb_msglayout_field grpc_gcp_RpcProtocolVersions__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 11, 1}, + {2, UPB_SIZE(4, 8), 0, 0, 11, 1}, +}; + +const upb_msglayout grpc_gcp_RpcProtocolVersions_msginit = { + &grpc_gcp_RpcProtocolVersions_submsgs[0], + &grpc_gcp_RpcProtocolVersions__fields[0], + UPB_SIZE(8, 16), 2, false, +}; + +static const upb_msglayout_field grpc_gcp_RpcProtocolVersions_Version__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 13, 1}, + {2, UPB_SIZE(4, 4), 0, 0, 13, 1}, +}; + +const upb_msglayout grpc_gcp_RpcProtocolVersions_Version_msginit = { + NULL, + &grpc_gcp_RpcProtocolVersions_Version__fields[0], + UPB_SIZE(8, 8), 2, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.h b/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.h new file mode 100644 index 00000000000..14d4898b2ab --- /dev/null +++ b/src/core/ext/upb-generated/grpc/gcp/transport_security_common.upb.h @@ -0,0 +1,109 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/gcp/transport_security_common.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ +#define GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct grpc_gcp_RpcProtocolVersions; +struct grpc_gcp_RpcProtocolVersions_Version; +typedef struct grpc_gcp_RpcProtocolVersions grpc_gcp_RpcProtocolVersions; +typedef struct grpc_gcp_RpcProtocolVersions_Version grpc_gcp_RpcProtocolVersions_Version; +extern const upb_msglayout grpc_gcp_RpcProtocolVersions_msginit; +extern const upb_msglayout grpc_gcp_RpcProtocolVersions_Version_msginit; + +typedef enum { + grpc_gcp_SECURITY_NONE = 0, + grpc_gcp_INTEGRITY_ONLY = 1, + grpc_gcp_INTEGRITY_AND_PRIVACY = 2 +} grpc_gcp_SecurityLevel; + + +/* grpc.gcp.RpcProtocolVersions */ + +UPB_INLINE grpc_gcp_RpcProtocolVersions *grpc_gcp_RpcProtocolVersions_new(upb_arena *arena) { + return (grpc_gcp_RpcProtocolVersions *)upb_msg_new(&grpc_gcp_RpcProtocolVersions_msginit, arena); +} +UPB_INLINE grpc_gcp_RpcProtocolVersions *grpc_gcp_RpcProtocolVersions_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_RpcProtocolVersions *ret = grpc_gcp_RpcProtocolVersions_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_RpcProtocolVersions_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_RpcProtocolVersions_serialize(const grpc_gcp_RpcProtocolVersions *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_RpcProtocolVersions_msginit, arena, len); +} + +UPB_INLINE const grpc_gcp_RpcProtocolVersions_Version* grpc_gcp_RpcProtocolVersions_max_rpc_version(const grpc_gcp_RpcProtocolVersions *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_RpcProtocolVersions_Version*, UPB_SIZE(0, 0)); } +UPB_INLINE const grpc_gcp_RpcProtocolVersions_Version* grpc_gcp_RpcProtocolVersions_min_rpc_version(const grpc_gcp_RpcProtocolVersions *msg) { return UPB_FIELD_AT(msg, const grpc_gcp_RpcProtocolVersions_Version*, UPB_SIZE(4, 8)); } + +UPB_INLINE void grpc_gcp_RpcProtocolVersions_set_max_rpc_version(grpc_gcp_RpcProtocolVersions *msg, grpc_gcp_RpcProtocolVersions_Version* value) { + UPB_FIELD_AT(msg, grpc_gcp_RpcProtocolVersions_Version*, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE struct grpc_gcp_RpcProtocolVersions_Version* grpc_gcp_RpcProtocolVersions_mutable_max_rpc_version(grpc_gcp_RpcProtocolVersions *msg, upb_arena *arena) { + struct grpc_gcp_RpcProtocolVersions_Version* sub = (struct grpc_gcp_RpcProtocolVersions_Version*)grpc_gcp_RpcProtocolVersions_max_rpc_version(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_RpcProtocolVersions_Version*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_Version_msginit, arena); + if (!sub) return NULL; + grpc_gcp_RpcProtocolVersions_set_max_rpc_version(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_gcp_RpcProtocolVersions_set_min_rpc_version(grpc_gcp_RpcProtocolVersions *msg, grpc_gcp_RpcProtocolVersions_Version* value) { + UPB_FIELD_AT(msg, grpc_gcp_RpcProtocolVersions_Version*, UPB_SIZE(4, 8)) = value; +} +UPB_INLINE struct grpc_gcp_RpcProtocolVersions_Version* grpc_gcp_RpcProtocolVersions_mutable_min_rpc_version(grpc_gcp_RpcProtocolVersions *msg, upb_arena *arena) { + struct grpc_gcp_RpcProtocolVersions_Version* sub = (struct grpc_gcp_RpcProtocolVersions_Version*)grpc_gcp_RpcProtocolVersions_min_rpc_version(msg); + if (sub == NULL) { + sub = (struct grpc_gcp_RpcProtocolVersions_Version*)upb_msg_new(&grpc_gcp_RpcProtocolVersions_Version_msginit, arena); + if (!sub) return NULL; + grpc_gcp_RpcProtocolVersions_set_min_rpc_version(msg, sub); + } + return sub; +} + +/* grpc.gcp.RpcProtocolVersions.Version */ + +UPB_INLINE grpc_gcp_RpcProtocolVersions_Version *grpc_gcp_RpcProtocolVersions_Version_new(upb_arena *arena) { + return (grpc_gcp_RpcProtocolVersions_Version *)upb_msg_new(&grpc_gcp_RpcProtocolVersions_Version_msginit, arena); +} +UPB_INLINE grpc_gcp_RpcProtocolVersions_Version *grpc_gcp_RpcProtocolVersions_Version_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_gcp_RpcProtocolVersions_Version *ret = grpc_gcp_RpcProtocolVersions_Version_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_gcp_RpcProtocolVersions_Version_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_gcp_RpcProtocolVersions_Version_serialize(const grpc_gcp_RpcProtocolVersions_Version *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_gcp_RpcProtocolVersions_Version_msginit, arena, len); +} + +UPB_INLINE uint32_t grpc_gcp_RpcProtocolVersions_Version_major(const grpc_gcp_RpcProtocolVersions_Version *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)); } +UPB_INLINE uint32_t grpc_gcp_RpcProtocolVersions_Version_minor(const grpc_gcp_RpcProtocolVersions_Version *msg) { return UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(4, 4)); } + +UPB_INLINE void grpc_gcp_RpcProtocolVersions_Version_set_major(grpc_gcp_RpcProtocolVersions_Version *msg, uint32_t value) { + UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_gcp_RpcProtocolVersions_Version_set_minor(grpc_gcp_RpcProtocolVersions_Version *msg, uint32_t value) { + UPB_FIELD_AT(msg, uint32_t, UPB_SIZE(4, 4)) = value; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* GRPC_GCP_TRANSPORT_SECURITY_COMMON_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/health/v1/health.upb.c b/src/core/ext/upb-generated/grpc/health/v1/health.upb.c new file mode 100644 index 00000000000..e672d431005 --- /dev/null +++ b/src/core/ext/upb-generated/grpc/health/v1/health.upb.c @@ -0,0 +1,36 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/health/v1/health.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "grpc/health/v1/health.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout_field grpc_health_v1_HealthCheckRequest__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, +}; + +const upb_msglayout grpc_health_v1_HealthCheckRequest_msginit = { + NULL, + &grpc_health_v1_HealthCheckRequest__fields[0], + UPB_SIZE(8, 16), 1, false, +}; + +static const upb_msglayout_field grpc_health_v1_HealthCheckResponse__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 14, 1}, +}; + +const upb_msglayout grpc_health_v1_HealthCheckResponse_msginit = { + NULL, + &grpc_health_v1_HealthCheckResponse__fields[0], + UPB_SIZE(8, 8), 1, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/grpc/health/v1/health.upb.h b/src/core/ext/upb-generated/grpc/health/v1/health.upb.h new file mode 100644 index 00000000000..536e7d8131b --- /dev/null +++ b/src/core/ext/upb-generated/grpc/health/v1/health.upb.h @@ -0,0 +1,84 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/health/v1/health.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ +#define GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct grpc_health_v1_HealthCheckRequest; +struct grpc_health_v1_HealthCheckResponse; +typedef struct grpc_health_v1_HealthCheckRequest grpc_health_v1_HealthCheckRequest; +typedef struct grpc_health_v1_HealthCheckResponse grpc_health_v1_HealthCheckResponse; +extern const upb_msglayout grpc_health_v1_HealthCheckRequest_msginit; +extern const upb_msglayout grpc_health_v1_HealthCheckResponse_msginit; + +typedef enum { + grpc_health_v1_HealthCheckResponse_UNKNOWN = 0, + grpc_health_v1_HealthCheckResponse_SERVING = 1, + grpc_health_v1_HealthCheckResponse_NOT_SERVING = 2, + grpc_health_v1_HealthCheckResponse_SERVICE_UNKNOWN = 3 +} grpc_health_v1_HealthCheckResponse_ServingStatus; + + +/* grpc.health.v1.HealthCheckRequest */ + +UPB_INLINE grpc_health_v1_HealthCheckRequest *grpc_health_v1_HealthCheckRequest_new(upb_arena *arena) { + return (grpc_health_v1_HealthCheckRequest *)upb_msg_new(&grpc_health_v1_HealthCheckRequest_msginit, arena); +} +UPB_INLINE grpc_health_v1_HealthCheckRequest *grpc_health_v1_HealthCheckRequest_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_health_v1_HealthCheckRequest *ret = grpc_health_v1_HealthCheckRequest_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_health_v1_HealthCheckRequest_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_health_v1_HealthCheckRequest_serialize(const grpc_health_v1_HealthCheckRequest *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_health_v1_HealthCheckRequest_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_health_v1_HealthCheckRequest_service(const grpc_health_v1_HealthCheckRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } + +UPB_INLINE void grpc_health_v1_HealthCheckRequest_set_service(grpc_health_v1_HealthCheckRequest *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} + +/* grpc.health.v1.HealthCheckResponse */ + +UPB_INLINE grpc_health_v1_HealthCheckResponse *grpc_health_v1_HealthCheckResponse_new(upb_arena *arena) { + return (grpc_health_v1_HealthCheckResponse *)upb_msg_new(&grpc_health_v1_HealthCheckResponse_msginit, arena); +} +UPB_INLINE grpc_health_v1_HealthCheckResponse *grpc_health_v1_HealthCheckResponse_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_health_v1_HealthCheckResponse *ret = grpc_health_v1_HealthCheckResponse_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_health_v1_HealthCheckResponse_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_health_v1_HealthCheckResponse_serialize(const grpc_health_v1_HealthCheckResponse *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_health_v1_HealthCheckResponse_msginit, arena, len); +} + +UPB_INLINE int32_t grpc_health_v1_HealthCheckResponse_status(const grpc_health_v1_HealthCheckResponse *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } + +UPB_INLINE void grpc_health_v1_HealthCheckResponse_set_status(grpc_health_v1_HealthCheckResponse *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* GRPC_HEALTH_V1_HEALTH_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c b/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c new file mode 100644 index 00000000000..74a01dc8d98 --- /dev/null +++ b/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c @@ -0,0 +1,133 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/lb/v1/load_balancer.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#include +#include "upb/msg.h" +#include "grpc/lb/v1/load_balancer.upb.h" +#include "google/protobuf/duration.upb.h" +#include "google/protobuf/timestamp.upb.h" + +#include "upb/port_def.inc" + +static const upb_msglayout *const grpc_lb_v1_LoadBalanceRequest_submsgs[2] = { + &grpc_lb_v1_ClientStats_msginit, + &grpc_lb_v1_InitialLoadBalanceRequest_msginit, +}; + +static const upb_msglayout_field grpc_lb_v1_LoadBalanceRequest__fields[2] = { + {1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1}, + {2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1}, +}; + +const upb_msglayout grpc_lb_v1_LoadBalanceRequest_msginit = { + &grpc_lb_v1_LoadBalanceRequest_submsgs[0], + &grpc_lb_v1_LoadBalanceRequest__fields[0], + UPB_SIZE(8, 16), 2, false, +}; + +static const upb_msglayout_field grpc_lb_v1_InitialLoadBalanceRequest__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, +}; + +const upb_msglayout grpc_lb_v1_InitialLoadBalanceRequest_msginit = { + NULL, + &grpc_lb_v1_InitialLoadBalanceRequest__fields[0], + UPB_SIZE(8, 16), 1, false, +}; + +static const upb_msglayout_field grpc_lb_v1_ClientStatsPerToken__fields[2] = { + {1, UPB_SIZE(8, 8), 0, 0, 9, 1}, + {2, UPB_SIZE(0, 0), 0, 0, 3, 1}, +}; + +const upb_msglayout grpc_lb_v1_ClientStatsPerToken_msginit = { + NULL, + &grpc_lb_v1_ClientStatsPerToken__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout *const grpc_lb_v1_ClientStats_submsgs[2] = { + &google_protobuf_Timestamp_msginit, + &grpc_lb_v1_ClientStatsPerToken_msginit, +}; + +static const upb_msglayout_field grpc_lb_v1_ClientStats__fields[6] = { + {1, UPB_SIZE(32, 32), 0, 0, 11, 1}, + {2, UPB_SIZE(0, 0), 0, 0, 3, 1}, + {3, UPB_SIZE(8, 8), 0, 0, 3, 1}, + {6, UPB_SIZE(16, 16), 0, 0, 3, 1}, + {7, UPB_SIZE(24, 24), 0, 0, 3, 1}, + {8, UPB_SIZE(36, 40), 0, 1, 11, 3}, +}; + +const upb_msglayout grpc_lb_v1_ClientStats_msginit = { + &grpc_lb_v1_ClientStats_submsgs[0], + &grpc_lb_v1_ClientStats__fields[0], + UPB_SIZE(40, 48), 6, false, +}; + +static const upb_msglayout *const grpc_lb_v1_LoadBalanceResponse_submsgs[2] = { + &grpc_lb_v1_InitialLoadBalanceResponse_msginit, + &grpc_lb_v1_ServerList_msginit, +}; + +static const upb_msglayout_field grpc_lb_v1_LoadBalanceResponse__fields[2] = { + {1, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 0, 11, 1}, + {2, UPB_SIZE(0, 0), UPB_SIZE(-5, -9), 1, 11, 1}, +}; + +const upb_msglayout grpc_lb_v1_LoadBalanceResponse_msginit = { + &grpc_lb_v1_LoadBalanceResponse_submsgs[0], + &grpc_lb_v1_LoadBalanceResponse__fields[0], + UPB_SIZE(8, 16), 2, false, +}; + +static const upb_msglayout *const grpc_lb_v1_InitialLoadBalanceResponse_submsgs[1] = { + &google_protobuf_Duration_msginit, +}; + +static const upb_msglayout_field grpc_lb_v1_InitialLoadBalanceResponse__fields[2] = { + {1, UPB_SIZE(0, 0), 0, 0, 9, 1}, + {2, UPB_SIZE(8, 16), 0, 0, 11, 1}, +}; + +const upb_msglayout grpc_lb_v1_InitialLoadBalanceResponse_msginit = { + &grpc_lb_v1_InitialLoadBalanceResponse_submsgs[0], + &grpc_lb_v1_InitialLoadBalanceResponse__fields[0], + UPB_SIZE(16, 32), 2, false, +}; + +static const upb_msglayout *const grpc_lb_v1_ServerList_submsgs[1] = { + &grpc_lb_v1_Server_msginit, +}; + +static const upb_msglayout_field grpc_lb_v1_ServerList__fields[1] = { + {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, +}; + +const upb_msglayout grpc_lb_v1_ServerList_msginit = { + &grpc_lb_v1_ServerList_submsgs[0], + &grpc_lb_v1_ServerList__fields[0], + UPB_SIZE(4, 8), 1, false, +}; + +static const upb_msglayout_field grpc_lb_v1_Server__fields[4] = { + {1, UPB_SIZE(8, 8), 0, 0, 12, 1}, + {2, UPB_SIZE(0, 0), 0, 0, 5, 1}, + {3, UPB_SIZE(16, 24), 0, 0, 9, 1}, + {4, UPB_SIZE(4, 4), 0, 0, 8, 1}, +}; + +const upb_msglayout grpc_lb_v1_Server_msginit = { + NULL, + &grpc_lb_v1_Server__fields[0], + UPB_SIZE(24, 48), 4, false, +}; + +#include "upb/port_undef.inc" + diff --git a/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h b/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h new file mode 100644 index 00000000000..398da3b71fe --- /dev/null +++ b/src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h @@ -0,0 +1,359 @@ +/* This file was generated by upbc (the upb compiler) from the input + * file: + * + * grpc/lb/v1/load_balancer.proto + * + * Do not edit -- your changes will be discarded when the file is + * regenerated. */ + +#ifndef GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ +#define GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ + +#include "upb/generated_util.h" +#include "upb/msg.h" +#include "upb/decode.h" +#include "upb/encode.h" + +#include "upb/port_def.inc" + +#ifdef __cplusplus +extern "C" { +#endif + +struct grpc_lb_v1_LoadBalanceRequest; +struct grpc_lb_v1_InitialLoadBalanceRequest; +struct grpc_lb_v1_ClientStatsPerToken; +struct grpc_lb_v1_ClientStats; +struct grpc_lb_v1_LoadBalanceResponse; +struct grpc_lb_v1_InitialLoadBalanceResponse; +struct grpc_lb_v1_ServerList; +struct grpc_lb_v1_Server; +typedef struct grpc_lb_v1_LoadBalanceRequest grpc_lb_v1_LoadBalanceRequest; +typedef struct grpc_lb_v1_InitialLoadBalanceRequest grpc_lb_v1_InitialLoadBalanceRequest; +typedef struct grpc_lb_v1_ClientStatsPerToken grpc_lb_v1_ClientStatsPerToken; +typedef struct grpc_lb_v1_ClientStats grpc_lb_v1_ClientStats; +typedef struct grpc_lb_v1_LoadBalanceResponse grpc_lb_v1_LoadBalanceResponse; +typedef struct grpc_lb_v1_InitialLoadBalanceResponse grpc_lb_v1_InitialLoadBalanceResponse; +typedef struct grpc_lb_v1_ServerList grpc_lb_v1_ServerList; +typedef struct grpc_lb_v1_Server grpc_lb_v1_Server; +extern const upb_msglayout grpc_lb_v1_LoadBalanceRequest_msginit; +extern const upb_msglayout grpc_lb_v1_InitialLoadBalanceRequest_msginit; +extern const upb_msglayout grpc_lb_v1_ClientStatsPerToken_msginit; +extern const upb_msglayout grpc_lb_v1_ClientStats_msginit; +extern const upb_msglayout grpc_lb_v1_LoadBalanceResponse_msginit; +extern const upb_msglayout grpc_lb_v1_InitialLoadBalanceResponse_msginit; +extern const upb_msglayout grpc_lb_v1_ServerList_msginit; +extern const upb_msglayout grpc_lb_v1_Server_msginit; +struct google_protobuf_Duration; +struct google_protobuf_Timestamp; +extern const upb_msglayout google_protobuf_Duration_msginit; +extern const upb_msglayout google_protobuf_Timestamp_msginit; + + +/* grpc.lb.v1.LoadBalanceRequest */ + +UPB_INLINE grpc_lb_v1_LoadBalanceRequest *grpc_lb_v1_LoadBalanceRequest_new(upb_arena *arena) { + return (grpc_lb_v1_LoadBalanceRequest *)upb_msg_new(&grpc_lb_v1_LoadBalanceRequest_msginit, arena); +} +UPB_INLINE grpc_lb_v1_LoadBalanceRequest *grpc_lb_v1_LoadBalanceRequest_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_lb_v1_LoadBalanceRequest *ret = grpc_lb_v1_LoadBalanceRequest_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_LoadBalanceRequest_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_lb_v1_LoadBalanceRequest_serialize(const grpc_lb_v1_LoadBalanceRequest *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_lb_v1_LoadBalanceRequest_msginit, arena, len); +} + +typedef enum { + grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_initial_request = 1, + grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_client_stats = 2, + grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_NOT_SET = 0 +} grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_oneofcases; +UPB_INLINE grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_oneofcases grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_case(const grpc_lb_v1_LoadBalanceRequest* msg) { return (grpc_lb_v1_LoadBalanceRequest_load_balance_request_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); } + +UPB_INLINE bool grpc_lb_v1_LoadBalanceRequest_has_initial_request(const grpc_lb_v1_LoadBalanceRequest *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); } +UPB_INLINE const grpc_lb_v1_InitialLoadBalanceRequest* grpc_lb_v1_LoadBalanceRequest_initial_request(const grpc_lb_v1_LoadBalanceRequest *msg) { return UPB_READ_ONEOF(msg, const grpc_lb_v1_InitialLoadBalanceRequest*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); } +UPB_INLINE bool grpc_lb_v1_LoadBalanceRequest_has_client_stats(const grpc_lb_v1_LoadBalanceRequest *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); } +UPB_INLINE const grpc_lb_v1_ClientStats* grpc_lb_v1_LoadBalanceRequest_client_stats(const grpc_lb_v1_LoadBalanceRequest *msg) { return UPB_READ_ONEOF(msg, const grpc_lb_v1_ClientStats*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); } + +UPB_INLINE void grpc_lb_v1_LoadBalanceRequest_set_initial_request(grpc_lb_v1_LoadBalanceRequest *msg, grpc_lb_v1_InitialLoadBalanceRequest* value) { + UPB_WRITE_ONEOF(msg, grpc_lb_v1_InitialLoadBalanceRequest*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1); +} +UPB_INLINE struct grpc_lb_v1_InitialLoadBalanceRequest* grpc_lb_v1_LoadBalanceRequest_mutable_initial_request(grpc_lb_v1_LoadBalanceRequest *msg, upb_arena *arena) { + struct grpc_lb_v1_InitialLoadBalanceRequest* sub = (struct grpc_lb_v1_InitialLoadBalanceRequest*)grpc_lb_v1_LoadBalanceRequest_initial_request(msg); + if (sub == NULL) { + sub = (struct grpc_lb_v1_InitialLoadBalanceRequest*)upb_msg_new(&grpc_lb_v1_InitialLoadBalanceRequest_msginit, arena); + if (!sub) return NULL; + grpc_lb_v1_LoadBalanceRequest_set_initial_request(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_lb_v1_LoadBalanceRequest_set_client_stats(grpc_lb_v1_LoadBalanceRequest *msg, grpc_lb_v1_ClientStats* value) { + UPB_WRITE_ONEOF(msg, grpc_lb_v1_ClientStats*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2); +} +UPB_INLINE struct grpc_lb_v1_ClientStats* grpc_lb_v1_LoadBalanceRequest_mutable_client_stats(grpc_lb_v1_LoadBalanceRequest *msg, upb_arena *arena) { + struct grpc_lb_v1_ClientStats* sub = (struct grpc_lb_v1_ClientStats*)grpc_lb_v1_LoadBalanceRequest_client_stats(msg); + if (sub == NULL) { + sub = (struct grpc_lb_v1_ClientStats*)upb_msg_new(&grpc_lb_v1_ClientStats_msginit, arena); + if (!sub) return NULL; + grpc_lb_v1_LoadBalanceRequest_set_client_stats(msg, sub); + } + return sub; +} + +/* grpc.lb.v1.InitialLoadBalanceRequest */ + +UPB_INLINE grpc_lb_v1_InitialLoadBalanceRequest *grpc_lb_v1_InitialLoadBalanceRequest_new(upb_arena *arena) { + return (grpc_lb_v1_InitialLoadBalanceRequest *)upb_msg_new(&grpc_lb_v1_InitialLoadBalanceRequest_msginit, arena); +} +UPB_INLINE grpc_lb_v1_InitialLoadBalanceRequest *grpc_lb_v1_InitialLoadBalanceRequest_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_lb_v1_InitialLoadBalanceRequest *ret = grpc_lb_v1_InitialLoadBalanceRequest_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_InitialLoadBalanceRequest_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_lb_v1_InitialLoadBalanceRequest_serialize(const grpc_lb_v1_InitialLoadBalanceRequest *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_lb_v1_InitialLoadBalanceRequest_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_lb_v1_InitialLoadBalanceRequest_name(const grpc_lb_v1_InitialLoadBalanceRequest *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } + +UPB_INLINE void grpc_lb_v1_InitialLoadBalanceRequest_set_name(grpc_lb_v1_InitialLoadBalanceRequest *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} + +/* grpc.lb.v1.ClientStatsPerToken */ + +UPB_INLINE grpc_lb_v1_ClientStatsPerToken *grpc_lb_v1_ClientStatsPerToken_new(upb_arena *arena) { + return (grpc_lb_v1_ClientStatsPerToken *)upb_msg_new(&grpc_lb_v1_ClientStatsPerToken_msginit, arena); +} +UPB_INLINE grpc_lb_v1_ClientStatsPerToken *grpc_lb_v1_ClientStatsPerToken_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_lb_v1_ClientStatsPerToken *ret = grpc_lb_v1_ClientStatsPerToken_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_ClientStatsPerToken_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_lb_v1_ClientStatsPerToken_serialize(const grpc_lb_v1_ClientStatsPerToken *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_lb_v1_ClientStatsPerToken_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_lb_v1_ClientStatsPerToken_load_balance_token(const grpc_lb_v1_ClientStatsPerToken *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } +UPB_INLINE int64_t grpc_lb_v1_ClientStatsPerToken_num_calls(const grpc_lb_v1_ClientStatsPerToken *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)); } + +UPB_INLINE void grpc_lb_v1_ClientStatsPerToken_set_load_balance_token(grpc_lb_v1_ClientStatsPerToken *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void grpc_lb_v1_ClientStatsPerToken_set_num_calls(grpc_lb_v1_ClientStatsPerToken *msg, int64_t value) { + UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)) = value; +} + +/* grpc.lb.v1.ClientStats */ + +UPB_INLINE grpc_lb_v1_ClientStats *grpc_lb_v1_ClientStats_new(upb_arena *arena) { + return (grpc_lb_v1_ClientStats *)upb_msg_new(&grpc_lb_v1_ClientStats_msginit, arena); +} +UPB_INLINE grpc_lb_v1_ClientStats *grpc_lb_v1_ClientStats_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_lb_v1_ClientStats *ret = grpc_lb_v1_ClientStats_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_ClientStats_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_lb_v1_ClientStats_serialize(const grpc_lb_v1_ClientStats *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_lb_v1_ClientStats_msginit, arena, len); +} + +UPB_INLINE const struct google_protobuf_Timestamp* grpc_lb_v1_ClientStats_timestamp(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Timestamp*, UPB_SIZE(32, 32)); } +UPB_INLINE int64_t grpc_lb_v1_ClientStats_num_calls_started(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)); } +UPB_INLINE int64_t grpc_lb_v1_ClientStats_num_calls_finished(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)); } +UPB_INLINE int64_t grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)); } +UPB_INLINE int64_t grpc_lb_v1_ClientStats_num_calls_finished_known_received(const grpc_lb_v1_ClientStats *msg) { return UPB_FIELD_AT(msg, int64_t, UPB_SIZE(24, 24)); } +UPB_INLINE const grpc_lb_v1_ClientStatsPerToken* const* grpc_lb_v1_ClientStats_calls_finished_with_drop(const grpc_lb_v1_ClientStats *msg, size_t *len) { return (const grpc_lb_v1_ClientStatsPerToken* const*)_upb_array_accessor(msg, UPB_SIZE(36, 40), len); } + +UPB_INLINE void grpc_lb_v1_ClientStats_set_timestamp(grpc_lb_v1_ClientStats *msg, struct google_protobuf_Timestamp* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Timestamp*, UPB_SIZE(32, 32)) = value; +} +UPB_INLINE struct google_protobuf_Timestamp* grpc_lb_v1_ClientStats_mutable_timestamp(grpc_lb_v1_ClientStats *msg, upb_arena *arena) { + struct google_protobuf_Timestamp* sub = (struct google_protobuf_Timestamp*)grpc_lb_v1_ClientStats_timestamp(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Timestamp*)upb_msg_new(&google_protobuf_Timestamp_msginit, arena); + if (!sub) return NULL; + grpc_lb_v1_ClientStats_set_timestamp(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_lb_v1_ClientStats_set_num_calls_started(grpc_lb_v1_ClientStats *msg, int64_t value) { + UPB_FIELD_AT(msg, int64_t, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_lb_v1_ClientStats_set_num_calls_finished(grpc_lb_v1_ClientStats *msg, int64_t value) { + UPB_FIELD_AT(msg, int64_t, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void grpc_lb_v1_ClientStats_set_num_calls_finished_with_client_failed_to_send(grpc_lb_v1_ClientStats *msg, int64_t value) { + UPB_FIELD_AT(msg, int64_t, UPB_SIZE(16, 16)) = value; +} +UPB_INLINE void grpc_lb_v1_ClientStats_set_num_calls_finished_known_received(grpc_lb_v1_ClientStats *msg, int64_t value) { + UPB_FIELD_AT(msg, int64_t, UPB_SIZE(24, 24)) = value; +} +UPB_INLINE grpc_lb_v1_ClientStatsPerToken** grpc_lb_v1_ClientStats_mutable_calls_finished_with_drop(grpc_lb_v1_ClientStats *msg, size_t *len) { + return (grpc_lb_v1_ClientStatsPerToken**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 40), len); +} +UPB_INLINE grpc_lb_v1_ClientStatsPerToken** grpc_lb_v1_ClientStats_resize_calls_finished_with_drop(grpc_lb_v1_ClientStats *msg, size_t len, upb_arena *arena) { + return (grpc_lb_v1_ClientStatsPerToken**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 40), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct grpc_lb_v1_ClientStatsPerToken* grpc_lb_v1_ClientStats_add_calls_finished_with_drop(grpc_lb_v1_ClientStats *msg, upb_arena *arena) { + struct grpc_lb_v1_ClientStatsPerToken* sub = (struct grpc_lb_v1_ClientStatsPerToken*)upb_msg_new(&grpc_lb_v1_ClientStatsPerToken_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(36, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* grpc.lb.v1.LoadBalanceResponse */ + +UPB_INLINE grpc_lb_v1_LoadBalanceResponse *grpc_lb_v1_LoadBalanceResponse_new(upb_arena *arena) { + return (grpc_lb_v1_LoadBalanceResponse *)upb_msg_new(&grpc_lb_v1_LoadBalanceResponse_msginit, arena); +} +UPB_INLINE grpc_lb_v1_LoadBalanceResponse *grpc_lb_v1_LoadBalanceResponse_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_lb_v1_LoadBalanceResponse *ret = grpc_lb_v1_LoadBalanceResponse_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_LoadBalanceResponse_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_lb_v1_LoadBalanceResponse_serialize(const grpc_lb_v1_LoadBalanceResponse *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_lb_v1_LoadBalanceResponse_msginit, arena, len); +} + +typedef enum { + grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_initial_response = 1, + grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_server_list = 2, + grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_NOT_SET = 0 +} grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_oneofcases; +UPB_INLINE grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_oneofcases grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_case(const grpc_lb_v1_LoadBalanceResponse* msg) { return (grpc_lb_v1_LoadBalanceResponse_load_balance_response_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); } + +UPB_INLINE bool grpc_lb_v1_LoadBalanceResponse_has_initial_response(const grpc_lb_v1_LoadBalanceResponse *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); } +UPB_INLINE const grpc_lb_v1_InitialLoadBalanceResponse* grpc_lb_v1_LoadBalanceResponse_initial_response(const grpc_lb_v1_LoadBalanceResponse *msg) { return UPB_READ_ONEOF(msg, const grpc_lb_v1_InitialLoadBalanceResponse*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); } +UPB_INLINE bool grpc_lb_v1_LoadBalanceResponse_has_server_list(const grpc_lb_v1_LoadBalanceResponse *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 2); } +UPB_INLINE const grpc_lb_v1_ServerList* grpc_lb_v1_LoadBalanceResponse_server_list(const grpc_lb_v1_LoadBalanceResponse *msg) { return UPB_READ_ONEOF(msg, const grpc_lb_v1_ServerList*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 2, NULL); } + +UPB_INLINE void grpc_lb_v1_LoadBalanceResponse_set_initial_response(grpc_lb_v1_LoadBalanceResponse *msg, grpc_lb_v1_InitialLoadBalanceResponse* value) { + UPB_WRITE_ONEOF(msg, grpc_lb_v1_InitialLoadBalanceResponse*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 1); +} +UPB_INLINE struct grpc_lb_v1_InitialLoadBalanceResponse* grpc_lb_v1_LoadBalanceResponse_mutable_initial_response(grpc_lb_v1_LoadBalanceResponse *msg, upb_arena *arena) { + struct grpc_lb_v1_InitialLoadBalanceResponse* sub = (struct grpc_lb_v1_InitialLoadBalanceResponse*)grpc_lb_v1_LoadBalanceResponse_initial_response(msg); + if (sub == NULL) { + sub = (struct grpc_lb_v1_InitialLoadBalanceResponse*)upb_msg_new(&grpc_lb_v1_InitialLoadBalanceResponse_msginit, arena); + if (!sub) return NULL; + grpc_lb_v1_LoadBalanceResponse_set_initial_response(msg, sub); + } + return sub; +} +UPB_INLINE void grpc_lb_v1_LoadBalanceResponse_set_server_list(grpc_lb_v1_LoadBalanceResponse *msg, grpc_lb_v1_ServerList* value) { + UPB_WRITE_ONEOF(msg, grpc_lb_v1_ServerList*, UPB_SIZE(0, 0), value, UPB_SIZE(4, 8), 2); +} +UPB_INLINE struct grpc_lb_v1_ServerList* grpc_lb_v1_LoadBalanceResponse_mutable_server_list(grpc_lb_v1_LoadBalanceResponse *msg, upb_arena *arena) { + struct grpc_lb_v1_ServerList* sub = (struct grpc_lb_v1_ServerList*)grpc_lb_v1_LoadBalanceResponse_server_list(msg); + if (sub == NULL) { + sub = (struct grpc_lb_v1_ServerList*)upb_msg_new(&grpc_lb_v1_ServerList_msginit, arena); + if (!sub) return NULL; + grpc_lb_v1_LoadBalanceResponse_set_server_list(msg, sub); + } + return sub; +} + +/* grpc.lb.v1.InitialLoadBalanceResponse */ + +UPB_INLINE grpc_lb_v1_InitialLoadBalanceResponse *grpc_lb_v1_InitialLoadBalanceResponse_new(upb_arena *arena) { + return (grpc_lb_v1_InitialLoadBalanceResponse *)upb_msg_new(&grpc_lb_v1_InitialLoadBalanceResponse_msginit, arena); +} +UPB_INLINE grpc_lb_v1_InitialLoadBalanceResponse *grpc_lb_v1_InitialLoadBalanceResponse_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_lb_v1_InitialLoadBalanceResponse *ret = grpc_lb_v1_InitialLoadBalanceResponse_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_InitialLoadBalanceResponse_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_lb_v1_InitialLoadBalanceResponse_serialize(const grpc_lb_v1_InitialLoadBalanceResponse *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_lb_v1_InitialLoadBalanceResponse_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate(const grpc_lb_v1_InitialLoadBalanceResponse *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)); } +UPB_INLINE const struct google_protobuf_Duration* grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval(const grpc_lb_v1_InitialLoadBalanceResponse *msg) { return UPB_FIELD_AT(msg, const struct google_protobuf_Duration*, UPB_SIZE(8, 16)); } + +UPB_INLINE void grpc_lb_v1_InitialLoadBalanceResponse_set_load_balancer_delegate(grpc_lb_v1_InitialLoadBalanceResponse *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_lb_v1_InitialLoadBalanceResponse_set_client_stats_report_interval(grpc_lb_v1_InitialLoadBalanceResponse *msg, struct google_protobuf_Duration* value) { + UPB_FIELD_AT(msg, struct google_protobuf_Duration*, UPB_SIZE(8, 16)) = value; +} +UPB_INLINE struct google_protobuf_Duration* grpc_lb_v1_InitialLoadBalanceResponse_mutable_client_stats_report_interval(grpc_lb_v1_InitialLoadBalanceResponse *msg, upb_arena *arena) { + struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval(msg); + if (sub == NULL) { + sub = (struct google_protobuf_Duration*)upb_msg_new(&google_protobuf_Duration_msginit, arena); + if (!sub) return NULL; + grpc_lb_v1_InitialLoadBalanceResponse_set_client_stats_report_interval(msg, sub); + } + return sub; +} + +/* grpc.lb.v1.ServerList */ + +UPB_INLINE grpc_lb_v1_ServerList *grpc_lb_v1_ServerList_new(upb_arena *arena) { + return (grpc_lb_v1_ServerList *)upb_msg_new(&grpc_lb_v1_ServerList_msginit, arena); +} +UPB_INLINE grpc_lb_v1_ServerList *grpc_lb_v1_ServerList_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_lb_v1_ServerList *ret = grpc_lb_v1_ServerList_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_ServerList_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_lb_v1_ServerList_serialize(const grpc_lb_v1_ServerList *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_lb_v1_ServerList_msginit, arena, len); +} + +UPB_INLINE const grpc_lb_v1_Server* const* grpc_lb_v1_ServerList_servers(const grpc_lb_v1_ServerList *msg, size_t *len) { return (const grpc_lb_v1_Server* const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); } + +UPB_INLINE grpc_lb_v1_Server** grpc_lb_v1_ServerList_mutable_servers(grpc_lb_v1_ServerList *msg, size_t *len) { + return (grpc_lb_v1_Server**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); +} +UPB_INLINE grpc_lb_v1_Server** grpc_lb_v1_ServerList_resize_servers(grpc_lb_v1_ServerList *msg, size_t len, upb_arena *arena) { + return (grpc_lb_v1_Server**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, arena); +} +UPB_INLINE struct grpc_lb_v1_Server* grpc_lb_v1_ServerList_add_servers(grpc_lb_v1_ServerList *msg, upb_arena *arena) { + struct grpc_lb_v1_Server* sub = (struct grpc_lb_v1_Server*)upb_msg_new(&grpc_lb_v1_Server_msginit, arena); + bool ok = _upb_array_append_accessor( + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + if (!ok) return NULL; + return sub; +} + +/* grpc.lb.v1.Server */ + +UPB_INLINE grpc_lb_v1_Server *grpc_lb_v1_Server_new(upb_arena *arena) { + return (grpc_lb_v1_Server *)upb_msg_new(&grpc_lb_v1_Server_msginit, arena); +} +UPB_INLINE grpc_lb_v1_Server *grpc_lb_v1_Server_parse(const char *buf, size_t size, + upb_arena *arena) { + grpc_lb_v1_Server *ret = grpc_lb_v1_Server_new(arena); + return (ret && upb_decode(buf, size, ret, &grpc_lb_v1_Server_msginit, arena)) ? ret : NULL; +} +UPB_INLINE char *grpc_lb_v1_Server_serialize(const grpc_lb_v1_Server *msg, upb_arena *arena, size_t *len) { + return upb_encode(msg, &grpc_lb_v1_Server_msginit, arena, len); +} + +UPB_INLINE upb_strview grpc_lb_v1_Server_ip_address(const grpc_lb_v1_Server *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)); } +UPB_INLINE int32_t grpc_lb_v1_Server_port(const grpc_lb_v1_Server *msg) { return UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)); } +UPB_INLINE upb_strview grpc_lb_v1_Server_load_balance_token(const grpc_lb_v1_Server *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)); } +UPB_INLINE bool grpc_lb_v1_Server_drop(const grpc_lb_v1_Server *msg) { return UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)); } + +UPB_INLINE void grpc_lb_v1_Server_set_ip_address(grpc_lb_v1_Server *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(8, 8)) = value; +} +UPB_INLINE void grpc_lb_v1_Server_set_port(grpc_lb_v1_Server *msg, int32_t value) { + UPB_FIELD_AT(msg, int32_t, UPB_SIZE(0, 0)) = value; +} +UPB_INLINE void grpc_lb_v1_Server_set_load_balance_token(grpc_lb_v1_Server *msg, upb_strview value) { + UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(16, 24)) = value; +} +UPB_INLINE void grpc_lb_v1_Server_set_drop(grpc_lb_v1_Server *msg, bool value) { + UPB_FIELD_AT(msg, bool, UPB_SIZE(4, 4)) = value; +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#include "upb/port_undef.inc" + +#endif /* GRPC_LB_V1_LOAD_BALANCER_PROTO_UPB_H_ */ diff --git a/src/core/ext/upb-generated/validate/validate.upb.h b/src/core/ext/upb-generated/validate/validate.upb.h index c28ac41881d..cac68a3441f 100644 --- a/src/core/ext/upb-generated/validate/validate.upb.h +++ b/src/core/ext/upb-generated/validate/validate.upb.h @@ -10,12 +10,12 @@ #define VALIDATE_VALIDATE_PROTO_UPB_H_ #include "upb/generated_util.h" - #include "upb/msg.h" - #include "upb/decode.h" #include "upb/encode.h" + #include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -94,17 +94,16 @@ struct google_protobuf_Timestamp; extern const upb_msglayout google_protobuf_Duration_msginit; extern const upb_msglayout google_protobuf_Timestamp_msginit; -/* Enums */ - /* validate.FieldRules */ UPB_INLINE validate_FieldRules *validate_FieldRules_new(upb_arena *arena) { return (validate_FieldRules *)upb_msg_new(&validate_FieldRules_msginit, arena); } -UPB_INLINE validate_FieldRules *validate_FieldRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_FieldRules *validate_FieldRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_FieldRules *ret = validate_FieldRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_FieldRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_FieldRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_FieldRules_serialize(const validate_FieldRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_FieldRules_msginit, arena, len); @@ -133,9 +132,9 @@ typedef enum { validate_FieldRules_type_any = 20, validate_FieldRules_type_duration = 21, validate_FieldRules_type_timestamp = 22, - validate_FieldRules_type_NOT_SET = 0, + validate_FieldRules_type_NOT_SET = 0 } validate_FieldRules_type_oneofcases; -UPB_INLINE validate_FieldRules_type_oneofcases validate_FieldRules_type_case(const validate_FieldRules* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(4, 8)); } +UPB_INLINE validate_FieldRules_type_oneofcases validate_FieldRules_type_case(const validate_FieldRules* msg) { return (validate_FieldRules_type_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(4, 8)); } UPB_INLINE bool validate_FieldRules_has_float(const validate_FieldRules *msg) { return _upb_has_oneof_field(msg, UPB_SIZE(4, 8), 1); } UPB_INLINE const validate_FloatRules* validate_FieldRules_float(const validate_FieldRules *msg) { return UPB_READ_ONEOF(msg, const validate_FloatRules*, UPB_SIZE(0, 0), UPB_SIZE(4, 8), 1, NULL); } @@ -447,15 +446,15 @@ UPB_INLINE struct validate_TimestampRules* validate_FieldRules_mutable_timestamp return sub; } - /* validate.FloatRules */ UPB_INLINE validate_FloatRules *validate_FloatRules_new(upb_arena *arena) { return (validate_FloatRules *)upb_msg_new(&validate_FloatRules_msginit, arena); } -UPB_INLINE validate_FloatRules *validate_FloatRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_FloatRules *validate_FloatRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_FloatRules *ret = validate_FloatRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_FloatRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_FloatRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_FloatRules_serialize(const validate_FloatRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_FloatRules_msginit, arena, len); @@ -515,15 +514,15 @@ UPB_INLINE bool validate_FloatRules_add_not_in(validate_FloatRules *msg, float v msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_FLOAT, &val, arena); } - /* validate.DoubleRules */ UPB_INLINE validate_DoubleRules *validate_DoubleRules_new(upb_arena *arena) { return (validate_DoubleRules *)upb_msg_new(&validate_DoubleRules_msginit, arena); } -UPB_INLINE validate_DoubleRules *validate_DoubleRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_DoubleRules *validate_DoubleRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_DoubleRules *ret = validate_DoubleRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_DoubleRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_DoubleRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_DoubleRules_serialize(const validate_DoubleRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_DoubleRules_msginit, arena, len); @@ -583,15 +582,15 @@ UPB_INLINE bool validate_DoubleRules_add_not_in(validate_DoubleRules *msg, doubl msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_DOUBLE, &val, arena); } - /* validate.Int32Rules */ UPB_INLINE validate_Int32Rules *validate_Int32Rules_new(upb_arena *arena) { return (validate_Int32Rules *)upb_msg_new(&validate_Int32Rules_msginit, arena); } -UPB_INLINE validate_Int32Rules *validate_Int32Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_Int32Rules *validate_Int32Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_Int32Rules *ret = validate_Int32Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_Int32Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_Int32Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_Int32Rules_serialize(const validate_Int32Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_Int32Rules_msginit, arena, len); @@ -651,15 +650,15 @@ UPB_INLINE bool validate_Int32Rules_add_not_in(validate_Int32Rules *msg, int32_t msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); } - /* validate.Int64Rules */ UPB_INLINE validate_Int64Rules *validate_Int64Rules_new(upb_arena *arena) { return (validate_Int64Rules *)upb_msg_new(&validate_Int64Rules_msginit, arena); } -UPB_INLINE validate_Int64Rules *validate_Int64Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_Int64Rules *validate_Int64Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_Int64Rules *ret = validate_Int64Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_Int64Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_Int64Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_Int64Rules_serialize(const validate_Int64Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_Int64Rules_msginit, arena, len); @@ -719,15 +718,15 @@ UPB_INLINE bool validate_Int64Rules_add_not_in(validate_Int64Rules *msg, int64_t msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_INT64, &val, arena); } - /* validate.UInt32Rules */ UPB_INLINE validate_UInt32Rules *validate_UInt32Rules_new(upb_arena *arena) { return (validate_UInt32Rules *)upb_msg_new(&validate_UInt32Rules_msginit, arena); } -UPB_INLINE validate_UInt32Rules *validate_UInt32Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_UInt32Rules *validate_UInt32Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_UInt32Rules *ret = validate_UInt32Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_UInt32Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_UInt32Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_UInt32Rules_serialize(const validate_UInt32Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_UInt32Rules_msginit, arena, len); @@ -787,15 +786,15 @@ UPB_INLINE bool validate_UInt32Rules_add_not_in(validate_UInt32Rules *msg, uint3 msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_UINT32, &val, arena); } - /* validate.UInt64Rules */ UPB_INLINE validate_UInt64Rules *validate_UInt64Rules_new(upb_arena *arena) { return (validate_UInt64Rules *)upb_msg_new(&validate_UInt64Rules_msginit, arena); } -UPB_INLINE validate_UInt64Rules *validate_UInt64Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_UInt64Rules *validate_UInt64Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_UInt64Rules *ret = validate_UInt64Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_UInt64Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_UInt64Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_UInt64Rules_serialize(const validate_UInt64Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_UInt64Rules_msginit, arena, len); @@ -855,15 +854,15 @@ UPB_INLINE bool validate_UInt64Rules_add_not_in(validate_UInt64Rules *msg, uint6 msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_UINT64, &val, arena); } - /* validate.SInt32Rules */ UPB_INLINE validate_SInt32Rules *validate_SInt32Rules_new(upb_arena *arena) { return (validate_SInt32Rules *)upb_msg_new(&validate_SInt32Rules_msginit, arena); } -UPB_INLINE validate_SInt32Rules *validate_SInt32Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_SInt32Rules *validate_SInt32Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_SInt32Rules *ret = validate_SInt32Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_SInt32Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_SInt32Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_SInt32Rules_serialize(const validate_SInt32Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_SInt32Rules_msginit, arena, len); @@ -923,15 +922,15 @@ UPB_INLINE bool validate_SInt32Rules_add_not_in(validate_SInt32Rules *msg, int32 msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); } - /* validate.SInt64Rules */ UPB_INLINE validate_SInt64Rules *validate_SInt64Rules_new(upb_arena *arena) { return (validate_SInt64Rules *)upb_msg_new(&validate_SInt64Rules_msginit, arena); } -UPB_INLINE validate_SInt64Rules *validate_SInt64Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_SInt64Rules *validate_SInt64Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_SInt64Rules *ret = validate_SInt64Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_SInt64Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_SInt64Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_SInt64Rules_serialize(const validate_SInt64Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_SInt64Rules_msginit, arena, len); @@ -991,15 +990,15 @@ UPB_INLINE bool validate_SInt64Rules_add_not_in(validate_SInt64Rules *msg, int64 msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_INT64, &val, arena); } - /* validate.Fixed32Rules */ UPB_INLINE validate_Fixed32Rules *validate_Fixed32Rules_new(upb_arena *arena) { return (validate_Fixed32Rules *)upb_msg_new(&validate_Fixed32Rules_msginit, arena); } -UPB_INLINE validate_Fixed32Rules *validate_Fixed32Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_Fixed32Rules *validate_Fixed32Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_Fixed32Rules *ret = validate_Fixed32Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_Fixed32Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_Fixed32Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_Fixed32Rules_serialize(const validate_Fixed32Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_Fixed32Rules_msginit, arena, len); @@ -1059,15 +1058,15 @@ UPB_INLINE bool validate_Fixed32Rules_add_not_in(validate_Fixed32Rules *msg, uin msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_UINT32, &val, arena); } - /* validate.Fixed64Rules */ UPB_INLINE validate_Fixed64Rules *validate_Fixed64Rules_new(upb_arena *arena) { return (validate_Fixed64Rules *)upb_msg_new(&validate_Fixed64Rules_msginit, arena); } -UPB_INLINE validate_Fixed64Rules *validate_Fixed64Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_Fixed64Rules *validate_Fixed64Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_Fixed64Rules *ret = validate_Fixed64Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_Fixed64Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_Fixed64Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_Fixed64Rules_serialize(const validate_Fixed64Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_Fixed64Rules_msginit, arena, len); @@ -1127,15 +1126,15 @@ UPB_INLINE bool validate_Fixed64Rules_add_not_in(validate_Fixed64Rules *msg, uin msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_UINT64, &val, arena); } - /* validate.SFixed32Rules */ UPB_INLINE validate_SFixed32Rules *validate_SFixed32Rules_new(upb_arena *arena) { return (validate_SFixed32Rules *)upb_msg_new(&validate_SFixed32Rules_msginit, arena); } -UPB_INLINE validate_SFixed32Rules *validate_SFixed32Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_SFixed32Rules *validate_SFixed32Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_SFixed32Rules *ret = validate_SFixed32Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_SFixed32Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_SFixed32Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_SFixed32Rules_serialize(const validate_SFixed32Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_SFixed32Rules_msginit, arena, len); @@ -1195,15 +1194,15 @@ UPB_INLINE bool validate_SFixed32Rules_add_not_in(validate_SFixed32Rules *msg, i msg, UPB_SIZE(28, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); } - /* validate.SFixed64Rules */ UPB_INLINE validate_SFixed64Rules *validate_SFixed64Rules_new(upb_arena *arena) { return (validate_SFixed64Rules *)upb_msg_new(&validate_SFixed64Rules_msginit, arena); } -UPB_INLINE validate_SFixed64Rules *validate_SFixed64Rules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_SFixed64Rules *validate_SFixed64Rules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_SFixed64Rules *ret = validate_SFixed64Rules_new(arena); - return (ret && upb_decode(buf, ret, &validate_SFixed64Rules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_SFixed64Rules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_SFixed64Rules_serialize(const validate_SFixed64Rules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_SFixed64Rules_msginit, arena, len); @@ -1263,15 +1262,15 @@ UPB_INLINE bool validate_SFixed64Rules_add_not_in(validate_SFixed64Rules *msg, i msg, UPB_SIZE(52, 56), UPB_SIZE(8, 8), UPB_TYPE_INT64, &val, arena); } - /* validate.BoolRules */ UPB_INLINE validate_BoolRules *validate_BoolRules_new(upb_arena *arena) { return (validate_BoolRules *)upb_msg_new(&validate_BoolRules_msginit, arena); } -UPB_INLINE validate_BoolRules *validate_BoolRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_BoolRules *validate_BoolRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_BoolRules *ret = validate_BoolRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_BoolRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_BoolRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_BoolRules_serialize(const validate_BoolRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_BoolRules_msginit, arena, len); @@ -1285,15 +1284,15 @@ UPB_INLINE void validate_BoolRules_set_const(validate_BoolRules *msg, bool value UPB_FIELD_AT(msg, bool, UPB_SIZE(1, 1)) = value; } - /* validate.StringRules */ UPB_INLINE validate_StringRules *validate_StringRules_new(upb_arena *arena) { return (validate_StringRules *)upb_msg_new(&validate_StringRules_msginit, arena); } -UPB_INLINE validate_StringRules *validate_StringRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_StringRules *validate_StringRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_StringRules *ret = validate_StringRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_StringRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_StringRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_StringRules_serialize(const validate_StringRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_StringRules_msginit, arena, len); @@ -1307,9 +1306,9 @@ typedef enum { validate_StringRules_well_known_ipv6 = 16, validate_StringRules_well_known_uri = 17, validate_StringRules_well_known_uri_ref = 18, - validate_StringRules_well_known_NOT_SET = 0, + validate_StringRules_well_known_NOT_SET = 0 } validate_StringRules_well_known_oneofcases; -UPB_INLINE validate_StringRules_well_known_oneofcases validate_StringRules_well_known_case(const validate_StringRules* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(108, 156)); } +UPB_INLINE validate_StringRules_well_known_oneofcases validate_StringRules_well_known_case(const validate_StringRules* msg) { return (validate_StringRules_well_known_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(108, 156)); } UPB_INLINE bool validate_StringRules_has_const(const validate_StringRules *msg) { return _upb_has_field(msg, 7); } UPB_INLINE upb_strview validate_StringRules_const(const validate_StringRules *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(56, 56)); } @@ -1436,15 +1435,15 @@ UPB_INLINE void validate_StringRules_set_len_bytes(validate_StringRules *msg, ui UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(48, 48)) = value; } - /* validate.BytesRules */ UPB_INLINE validate_BytesRules *validate_BytesRules_new(upb_arena *arena) { return (validate_BytesRules *)upb_msg_new(&validate_BytesRules_msginit, arena); } -UPB_INLINE validate_BytesRules *validate_BytesRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_BytesRules *validate_BytesRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_BytesRules *ret = validate_BytesRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_BytesRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_BytesRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_BytesRules_serialize(const validate_BytesRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_BytesRules_msginit, arena, len); @@ -1454,9 +1453,9 @@ typedef enum { validate_BytesRules_well_known_ip = 10, validate_BytesRules_well_known_ipv4 = 11, validate_BytesRules_well_known_ipv6 = 12, - validate_BytesRules_well_known_NOT_SET = 0, + validate_BytesRules_well_known_NOT_SET = 0 } validate_BytesRules_well_known_oneofcases; -UPB_INLINE validate_BytesRules_well_known_oneofcases validate_BytesRules_well_known_case(const validate_BytesRules* msg) { return UPB_FIELD_AT(msg, int, UPB_SIZE(84, 132)); } +UPB_INLINE validate_BytesRules_well_known_oneofcases validate_BytesRules_well_known_case(const validate_BytesRules* msg) { return (validate_BytesRules_well_known_oneofcases)UPB_FIELD_AT(msg, int32_t, UPB_SIZE(84, 132)); } UPB_INLINE bool validate_BytesRules_has_const(const validate_BytesRules *msg) { return _upb_has_field(msg, 4); } UPB_INLINE upb_strview validate_BytesRules_const(const validate_BytesRules *msg) { return UPB_FIELD_AT(msg, upb_strview, UPB_SIZE(32, 32)); } @@ -1545,15 +1544,15 @@ UPB_INLINE void validate_BytesRules_set_len(validate_BytesRules *msg, uint64_t v UPB_FIELD_AT(msg, uint64_t, UPB_SIZE(24, 24)) = value; } - /* validate.EnumRules */ UPB_INLINE validate_EnumRules *validate_EnumRules_new(upb_arena *arena) { return (validate_EnumRules *)upb_msg_new(&validate_EnumRules_msginit, arena); } -UPB_INLINE validate_EnumRules *validate_EnumRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_EnumRules *validate_EnumRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_EnumRules *ret = validate_EnumRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_EnumRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_EnumRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_EnumRules_serialize(const validate_EnumRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_EnumRules_msginit, arena, len); @@ -1595,15 +1594,15 @@ UPB_INLINE bool validate_EnumRules_add_not_in(validate_EnumRules *msg, int32_t v msg, UPB_SIZE(16, 24), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, arena); } - /* validate.MessageRules */ UPB_INLINE validate_MessageRules *validate_MessageRules_new(upb_arena *arena) { return (validate_MessageRules *)upb_msg_new(&validate_MessageRules_msginit, arena); } -UPB_INLINE validate_MessageRules *validate_MessageRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_MessageRules *validate_MessageRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_MessageRules *ret = validate_MessageRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_MessageRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_MessageRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_MessageRules_serialize(const validate_MessageRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_MessageRules_msginit, arena, len); @@ -1623,15 +1622,15 @@ UPB_INLINE void validate_MessageRules_set_required(validate_MessageRules *msg, b UPB_FIELD_AT(msg, bool, UPB_SIZE(2, 2)) = value; } - /* validate.RepeatedRules */ UPB_INLINE validate_RepeatedRules *validate_RepeatedRules_new(upb_arena *arena) { return (validate_RepeatedRules *)upb_msg_new(&validate_RepeatedRules_msginit, arena); } -UPB_INLINE validate_RepeatedRules *validate_RepeatedRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_RepeatedRules *validate_RepeatedRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_RepeatedRules *ret = validate_RepeatedRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_RepeatedRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_RepeatedRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_RepeatedRules_serialize(const validate_RepeatedRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_RepeatedRules_msginit, arena, len); @@ -1672,15 +1671,15 @@ UPB_INLINE struct validate_FieldRules* validate_RepeatedRules_mutable_items(vali return sub; } - /* validate.MapRules */ UPB_INLINE validate_MapRules *validate_MapRules_new(upb_arena *arena) { return (validate_MapRules *)upb_msg_new(&validate_MapRules_msginit, arena); } -UPB_INLINE validate_MapRules *validate_MapRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_MapRules *validate_MapRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_MapRules *ret = validate_MapRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_MapRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_MapRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_MapRules_serialize(const validate_MapRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_MapRules_msginit, arena, len); @@ -1736,15 +1735,15 @@ UPB_INLINE struct validate_FieldRules* validate_MapRules_mutable_values(validate return sub; } - /* validate.AnyRules */ UPB_INLINE validate_AnyRules *validate_AnyRules_new(upb_arena *arena) { return (validate_AnyRules *)upb_msg_new(&validate_AnyRules_msginit, arena); } -UPB_INLINE validate_AnyRules *validate_AnyRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_AnyRules *validate_AnyRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_AnyRules *ret = validate_AnyRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_AnyRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_AnyRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_AnyRules_serialize(const validate_AnyRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_AnyRules_msginit, arena, len); @@ -1780,15 +1779,15 @@ UPB_INLINE bool validate_AnyRules_add_not_in(validate_AnyRules *msg, upb_strview msg, UPB_SIZE(8, 16), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, arena); } - /* validate.DurationRules */ UPB_INLINE validate_DurationRules *validate_DurationRules_new(upb_arena *arena) { return (validate_DurationRules *)upb_msg_new(&validate_DurationRules_msginit, arena); } -UPB_INLINE validate_DurationRules *validate_DurationRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_DurationRules *validate_DurationRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_DurationRules *ret = validate_DurationRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_DurationRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_DurationRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_DurationRules_serialize(const validate_DurationRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_DurationRules_msginit, arena, len); @@ -1905,15 +1904,15 @@ UPB_INLINE struct google_protobuf_Duration* validate_DurationRules_add_not_in(va return sub; } - /* validate.TimestampRules */ UPB_INLINE validate_TimestampRules *validate_TimestampRules_new(upb_arena *arena) { return (validate_TimestampRules *)upb_msg_new(&validate_TimestampRules_msginit, arena); } -UPB_INLINE validate_TimestampRules *validate_TimestampRules_parsenew(upb_strview buf, upb_arena *arena) { +UPB_INLINE validate_TimestampRules *validate_TimestampRules_parse(const char *buf, size_t size, + upb_arena *arena) { validate_TimestampRules *ret = validate_TimestampRules_new(arena); - return (ret && upb_decode(buf, ret, &validate_TimestampRules_msginit)) ? ret : NULL; + return (ret && upb_decode(buf, size, ret, &validate_TimestampRules_msginit, arena)) ? ret : NULL; } UPB_INLINE char *validate_TimestampRules_serialize(const validate_TimestampRules *msg, upb_arena *arena, size_t *len) { return upb_encode(msg, &validate_TimestampRules_msginit, arena, len); @@ -2029,7 +2028,6 @@ UPB_INLINE struct google_protobuf_Duration* validate_TimestampRules_mutable_with return sub; } - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/core/lib/channel/channelz.cc b/src/core/lib/channel/channelz.cc index ab1e93a1bc7..325131b8439 100644 --- a/src/core/lib/channel/channelz.cc +++ b/src/core/lib/channel/channelz.cc @@ -85,7 +85,8 @@ intptr_t GetParentUuidFromArgs(const grpc_channel_args& args) { // BaseNode // -BaseNode::BaseNode(EntityType type) : type_(type), uuid_(-1) { +BaseNode::BaseNode(EntityType type, UniquePtr name) + : type_(type), uuid_(-1), name_(std::move(name)) { // The registry will set uuid_ under its lock. ChannelzRegistry::Register(this); } @@ -187,7 +188,8 @@ void CallCountingHelper::PopulateCallCounts(grpc_json* json) { ChannelNode::ChannelNode(UniquePtr target, size_t channel_tracer_max_nodes, intptr_t parent_uuid) : BaseNode(parent_uuid == 0 ? EntityType::kTopLevelChannel - : EntityType::kInternalChannel), + : EntityType::kInternalChannel, + UniquePtr(gpr_strdup(target.get()))), target_(std::move(target)), trace_(channel_tracer_max_nodes), parent_uuid_(parent_uuid) {} @@ -320,8 +322,7 @@ void ChannelNode::RemoveChildSubchannel(intptr_t child_uuid) { // ServerNode::ServerNode(grpc_server* server, size_t channel_tracer_max_nodes) - : BaseNode(EntityType::kServer), - server_(server), + : BaseNode(EntityType::kServer, /* name */ nullptr), trace_(channel_tracer_max_nodes) {} ServerNode::~ServerNode() {} @@ -336,6 +337,16 @@ void ServerNode::RemoveChildSocket(intptr_t child_uuid) { child_sockets_.erase(child_uuid); } +void ServerNode::AddChildListenSocket(RefCountedPtr node) { + MutexLock lock(&child_mu_); + child_listen_sockets_.insert(MakePair(node->uuid(), std::move(node))); +} + +void ServerNode::RemoveChildListenSocket(intptr_t child_uuid) { + MutexLock lock(&child_mu_); + child_listen_sockets_.erase(child_uuid); +} + char* ServerNode::RenderServerSockets(intptr_t start_socket_id, intptr_t max_results) { // If user does not set max_results, we choose 500. @@ -358,7 +369,7 @@ char* ServerNode::RenderServerSockets(intptr_t start_socket_id, json_iterator = grpc_json_add_number_string_child( socket_ref_json, nullptr, "socketId", it->first); grpc_json_create_child(json_iterator, socket_ref_json, "name", - it->second->remote(), GRPC_JSON_STRING, false); + it->second->name(), GRPC_JSON_STRING, false); } } if (sockets_rendered == child_sockets_.size()) { @@ -399,17 +410,19 @@ grpc_json* ServerNode::RenderJson() { // ask CallCountingHelper to populate trace and call count data. call_counter_.PopulateCallCounts(json); json = top_level_json; - ChildRefsList listen_sockets; - grpc_server_populate_listen_sockets(server_, &listen_sockets); - if (!listen_sockets.empty()) { + // Render listen sockets + MutexLock lock(&child_mu_); + if (!child_listen_sockets_.empty()) { grpc_json* array_parent = grpc_json_create_child( nullptr, json, "listenSocket", nullptr, GRPC_JSON_ARRAY, false); - for (size_t i = 0; i < listen_sockets.size(); ++i) { + for (const auto& it : child_listen_sockets_) { json_iterator = grpc_json_create_child(json_iterator, array_parent, nullptr, nullptr, GRPC_JSON_OBJECT, false); - grpc_json_add_number_string_child(json_iterator, nullptr, "socketId", - listen_sockets[i]); + grpc_json* sibling_iterator = grpc_json_add_number_string_child( + json_iterator, nullptr, "socketId", it.first); + grpc_json_create_child(sibling_iterator, json_iterator, "name", + it.second->name(), GRPC_JSON_STRING, false); } } return top_level_json; @@ -472,8 +485,9 @@ void PopulateSocketAddressJson(grpc_json* json, const char* name, } // namespace -SocketNode::SocketNode(UniquePtr local, UniquePtr remote) - : BaseNode(EntityType::kSocket), +SocketNode::SocketNode(UniquePtr local, UniquePtr remote, + UniquePtr name) + : BaseNode(EntityType::kSocket, std::move(name)), local_(std::move(local)), remote_(std::move(remote)) {} @@ -513,6 +527,8 @@ grpc_json* SocketNode::RenderJson() { json_iterator = nullptr; json_iterator = grpc_json_add_number_string_child(json, json_iterator, "socketId", uuid()); + json_iterator = grpc_json_create_child(json_iterator, json, "name", name(), + GRPC_JSON_STRING, false); json = top_level_json; PopulateSocketAddressJson(json, "remote", remote_.get()); PopulateSocketAddressJson(json, "local", local_.get()); @@ -592,8 +608,10 @@ grpc_json* SocketNode::RenderJson() { // ListenSocketNode // -ListenSocketNode::ListenSocketNode(UniquePtr local_addr) - : BaseNode(EntityType::kSocket), local_addr_(std::move(local_addr)) {} +ListenSocketNode::ListenSocketNode(UniquePtr local_addr, + UniquePtr name) + : BaseNode(EntityType::kSocket, std::move(name)), + local_addr_(std::move(local_addr)) {} grpc_json* ListenSocketNode::RenderJson() { // We need to track these three json objects to build our object @@ -607,6 +625,8 @@ grpc_json* ListenSocketNode::RenderJson() { json_iterator = nullptr; json_iterator = grpc_json_add_number_string_child(json, json_iterator, "socketId", uuid()); + json_iterator = grpc_json_create_child(json_iterator, json, "name", name(), + GRPC_JSON_STRING, false); json = top_level_json; PopulateSocketAddressJson(json, "local", local_addr_.get()); diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h index 1dc1f0a3cbb..e1af701834d 100644 --- a/src/core/lib/channel/channelz.h +++ b/src/core/lib/channel/channelz.h @@ -58,12 +58,8 @@ namespace channelz { grpc_arg MakeParentUuidArg(intptr_t parent_uuid); intptr_t GetParentUuidFromArgs(const grpc_channel_args& args); -// TODO(ncteisen), this only contains the uuids of the children for now, -// since that is all that is strictly needed. In a future enhancement we will -// add human readable names as in the channelz.proto -typedef InlinedVector ChildRefsList; - class SocketNode; +class ListenSocketNode; namespace testing { class CallCountingHelperPeer; @@ -84,7 +80,7 @@ class BaseNode : public RefCounted { kSocket, }; - explicit BaseNode(EntityType type); + BaseNode(EntityType type, UniquePtr name); virtual ~BaseNode(); // All children must implement this function. @@ -96,12 +92,14 @@ class BaseNode : public RefCounted { EntityType type() const { return type_; } intptr_t uuid() const { return uuid_; } + const char* name() const { return name_.get(); } private: // to allow the ChannelzRegistry to set uuid_ under its lock. friend class ChannelzRegistry; const EntityType type_; intptr_t uuid_; + UniquePtr name_; }; // This class is a helper class for channelz entities that deal with Channels, @@ -177,9 +175,13 @@ class ChannelNode : public BaseNode { void SetConnectivityState(grpc_connectivity_state state); + // TODO(roth): take in a RefCountedPtr to the child channel so we can retrieve + // the human-readable name. void AddChildChannel(intptr_t child_uuid); void RemoveChildChannel(intptr_t child_uuid); + // TODO(roth): take in a RefCountedPtr to the child subchannel so we can + // retrieve the human-readable name. void AddChildSubchannel(intptr_t child_uuid); void RemoveChildSubchannel(intptr_t child_uuid); @@ -217,10 +219,14 @@ class ServerNode : public BaseNode { char* RenderServerSockets(intptr_t start_socket_id, intptr_t max_results); - void AddChildSocket(RefCountedPtr); + void AddChildSocket(RefCountedPtr node); void RemoveChildSocket(intptr_t child_uuid); + void AddChildListenSocket(RefCountedPtr node); + + void RemoveChildListenSocket(intptr_t child_uuid); + // proxy methods to composed classes. void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice& data) { trace_.AddTraceEvent(severity, data); @@ -236,17 +242,18 @@ class ServerNode : public BaseNode { void RecordCallSucceeded() { call_counter_.RecordCallSucceeded(); } private: - grpc_server* server_; CallCountingHelper call_counter_; ChannelTrace trace_; - Mutex child_mu_; // Guards child map below. + Mutex child_mu_; // Guards child maps below. Map> child_sockets_; + Map> child_listen_sockets_; }; // Handles channelz bookkeeping for sockets class SocketNode : public BaseNode { public: - SocketNode(UniquePtr local, UniquePtr remote); + SocketNode(UniquePtr local, UniquePtr remote, + UniquePtr name); ~SocketNode() override {} grpc_json* RenderJson() override; @@ -285,8 +292,7 @@ class SocketNode : public BaseNode { // Handles channelz bookkeeping for listen sockets class ListenSocketNode : public BaseNode { public: - // ListenSocketNode takes ownership of host. - explicit ListenSocketNode(UniquePtr local_addr); + ListenSocketNode(UniquePtr local_addr, UniquePtr name); ~ListenSocketNode() override {} grpc_json* RenderJson() override; diff --git a/src/core/lib/gprpp/map.h b/src/core/lib/gprpp/map.h index 36e32d60c07..5238f43469f 100644 --- a/src/core/lib/gprpp/map.h +++ b/src/core/lib/gprpp/map.h @@ -30,6 +30,7 @@ #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/pair.h" +#include "src/core/lib/gprpp/ref_counted_ptr.h" namespace grpc_core { struct StringLess { @@ -41,6 +42,13 @@ struct StringLess { } }; +template +struct RefCountedPtrLess { + bool operator()(const RefCountedPtr& p1, const RefCountedPtr& p2) { + return p1.get() < p2.get(); + } +}; + namespace testing { class MapTest; } @@ -55,8 +63,25 @@ class Map { typedef Compare key_compare; class iterator; + Map() = default; ~Map() { clear(); } + // Movable. + Map(Map&& other) : root_(other.root_), size_(other.size_) { + other.root_ = nullptr; + other.size_ = 0; + } + Map& operator=(Map&& other) { + if (this != &other) { + clear(); + root_ = other.root_; + size_ = other.size_; + other.root_ = nullptr; + other.size_ = 0; + } + return *this; + } + T& operator[](key_type&& key); T& operator[](const key_type& key); iterator find(const key_type& k); diff --git a/src/core/lib/iomgr/cfstream_handle.cc b/src/core/lib/iomgr/cfstream_handle.cc index ea28e620695..c1e7d67e568 100644 --- a/src/core/lib/iomgr/cfstream_handle.cc +++ b/src/core/lib/iomgr/cfstream_handle.cc @@ -25,6 +25,7 @@ #import #import "src/core/lib/iomgr/cfstream_handle.h" +#include #include #include @@ -35,6 +36,10 @@ extern grpc_core::TraceFlag grpc_tcp_trace; +GrpcLibraryInitHolder::GrpcLibraryInitHolder() { grpc_init(); } + +GrpcLibraryInitHolder::~GrpcLibraryInitHolder() { grpc_shutdown(); } + void* CFStreamHandle::Retain(void* info) { CFStreamHandle* handle = static_cast(info); CFSTREAM_HANDLE_REF(handle, "retain"); diff --git a/src/core/lib/iomgr/cfstream_handle.h b/src/core/lib/iomgr/cfstream_handle.h index 05f45ed6251..5f3a525930c 100644 --- a/src/core/lib/iomgr/cfstream_handle.h +++ b/src/core/lib/iomgr/cfstream_handle.h @@ -33,11 +33,17 @@ #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/lockfree_event.h" -class CFStreamHandle final { +class GrpcLibraryInitHolder { + public: + GrpcLibraryInitHolder(); + virtual ~GrpcLibraryInitHolder(); +}; + +class CFStreamHandle : public GrpcLibraryInitHolder { public: static CFStreamHandle* CreateStreamHandle(CFReadStreamRef read_stream, CFWriteStreamRef write_stream); - ~CFStreamHandle(); + ~CFStreamHandle() override; CFStreamHandle(const CFStreamHandle& ref) = delete; CFStreamHandle(CFStreamHandle&& ref) = delete; CFStreamHandle& operator=(const CFStreamHandle& rhs) = delete; diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index eb44c9a2c90..dedc8376578 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -73,6 +73,8 @@ static const char* error_int_name(grpc_error_ints key) { return "limit"; case GRPC_ERROR_INT_OCCURRED_DURING_WRITE: return "occurred_during_write"; + case GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE: + return "channel_connectivity_state"; case GRPC_ERROR_INT_MAX: GPR_UNREACHABLE_CODE(return "unknown"); } diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 0a72e5ca101..8c22357b951 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -73,6 +73,8 @@ typedef enum { GRPC_ERROR_INT_LIMIT, /// chttp2: did the error occur while a write was in progress GRPC_ERROR_INT_OCCURRED_DURING_WRITE, + /// channel connectivity state associated with the error + GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, /// Must always be last GRPC_ERROR_INT_MAX, diff --git a/src/core/lib/iomgr/executor/mpmcqueue.cc b/src/core/lib/iomgr/executor/mpmcqueue.cc index 72c318e2bb1..74096a4c5b0 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.cc +++ b/src/core/lib/iomgr/executor/mpmcqueue.cc @@ -26,18 +26,15 @@ DebugOnlyTraceFlag grpc_thread_pool_trace(false, "thread_pool"); inline void* InfLenFIFOQueue::PopFront() { // Caller should already check queue is not empty and has already held the - // mutex. This function will only do the job of removal. + // mutex. This function will assume that there is at least one element in the + // queue (i.e. queue_head_->content is valid). void* result = queue_head_->content; - Node* head_to_remove = queue_head_; - queue_head_ = queue_head_->next; - count_.Store(count_.Load(MemoryOrder::RELAXED) - 1, MemoryOrder::RELAXED); + // Updates Stats when trace flag turned on. if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) { gpr_timespec wait_time = - gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), head_to_remove->insert_time); - - // Updates Stats info + gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), queue_head_->insert_time); stats_.num_completed++; stats_.total_queue_time = gpr_time_add(stats_.total_queue_time, wait_time); stats_.max_queue_time = gpr_time_max( @@ -58,44 +55,89 @@ inline void* InfLenFIFOQueue::PopFront() { gpr_timespec_to_micros(stats_.busy_queue_time)); } - Delete(head_to_remove); + queue_head_ = queue_head_->next; // Signal waiting thread - if (count_.Load(MemoryOrder::RELAXED) > 0 && num_waiters_ > 0) { - wait_nonempty_.Signal(); + if (count_.Load(MemoryOrder::RELAXED) > 0) { + TopWaiter()->cv.Signal(); } return result; } +InfLenFIFOQueue::Node* InfLenFIFOQueue::AllocateNodes(int num) { + num_nodes_ = num_nodes_ + num; + Node* new_chunk = static_cast(gpr_zalloc(sizeof(Node) * num)); + new_chunk[0].next = &new_chunk[1]; + new_chunk[num - 1].prev = &new_chunk[num - 2]; + for (int i = 1; i < num - 1; ++i) { + new_chunk[i].prev = &new_chunk[i - 1]; + new_chunk[i].next = &new_chunk[i + 1]; + } + return new_chunk; +} + +InfLenFIFOQueue::InfLenFIFOQueue() { + delete_list_size_ = kDeleteListInitSize; + delete_list_ = + static_cast(gpr_zalloc(sizeof(Node*) * delete_list_size_)); + + Node* new_chunk = AllocateNodes(kQueueInitNumNodes); + delete_list_[delete_list_count_++] = new_chunk; + queue_head_ = queue_tail_ = new_chunk; + new_chunk[0].prev = &new_chunk[kQueueInitNumNodes - 1]; + new_chunk[kQueueInitNumNodes - 1].next = &new_chunk[0]; + + waiters_.next = &waiters_; + waiters_.prev = &waiters_; +} + InfLenFIFOQueue::~InfLenFIFOQueue() { GPR_ASSERT(count_.Load(MemoryOrder::RELAXED) == 0); - GPR_ASSERT(num_waiters_ == 0); + for (size_t i = 0; i < delete_list_count_; ++i) { + gpr_free(delete_list_[i]); + } + gpr_free(delete_list_); } void InfLenFIFOQueue::Put(void* elem) { MutexLock l(&mu_); - Node* new_node = New(elem); - if (count_.Load(MemoryOrder::RELAXED) == 0) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) { - busy_time = gpr_now(GPR_CLOCK_MONOTONIC); + int curr_count = count_.Load(MemoryOrder::RELAXED); + + if (queue_tail_ == queue_head_ && curr_count != 0) { + // List is full. Expands list to double size by inserting new chunk of nodes + Node* new_chunk = AllocateNodes(curr_count); + delete_list_[delete_list_count_++] = new_chunk; + // Expands delete list on full. + if (delete_list_count_ == delete_list_size_) { + delete_list_size_ = delete_list_size_ * 2; + delete_list_ = static_cast( + gpr_realloc(delete_list_, sizeof(Node*) * delete_list_size_)); } - queue_head_ = queue_tail_ = new_node; - } else { - queue_tail_->next = new_node; - queue_tail_ = queue_tail_->next; + new_chunk[0].prev = queue_tail_->prev; + new_chunk[curr_count - 1].next = queue_head_; + queue_tail_->prev->next = new_chunk; + queue_head_->prev = &new_chunk[curr_count - 1]; + queue_tail_ = new_chunk; } - count_.Store(count_.Load(MemoryOrder::RELAXED) + 1, MemoryOrder::RELAXED); + queue_tail_->content = static_cast(elem); + // Updates Stats info if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace)) { stats_.num_started++; gpr_log(GPR_INFO, "[InfLenFIFOQueue Put] num_started: %" PRIu64, stats_.num_started); + auto current_time = gpr_now(GPR_CLOCK_MONOTONIC); + if (curr_count == 0) { + busy_time = current_time; + } + queue_tail_->insert_time = current_time; } - if (num_waiters_ > 0) { - wait_nonempty_.Signal(); - } + count_.Store(curr_count + 1, MemoryOrder::RELAXED); + queue_tail_ = queue_tail_->next; + + TopWaiter()->cv.Signal(); } void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { @@ -108,11 +150,12 @@ void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { start_time = gpr_now(GPR_CLOCK_MONOTONIC); } - num_waiters_++; + Waiter self; + PushWaiter(&self); do { - wait_nonempty_.Wait(&mu_); + self.cv.Wait(&mu_); } while (count_.Load(MemoryOrder::RELAXED) == 0); - num_waiters_--; + RemoveWaiter(&self); if (GRPC_TRACE_FLAG_ENABLED(grpc_thread_pool_trace) && wait_time != nullptr) { *wait_time = gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), start_time); @@ -122,4 +165,19 @@ void* InfLenFIFOQueue::Get(gpr_timespec* wait_time) { return PopFront(); } +void InfLenFIFOQueue::PushWaiter(Waiter* waiter) { + waiter->next = waiters_.next; + waiter->prev = &waiters_; + waiter->next->prev = waiter; + waiter->prev->next = waiter; +} + +void InfLenFIFOQueue::RemoveWaiter(Waiter* waiter) { + GPR_DEBUG_ASSERT(waiter != &waiters_); + waiter->next->prev = waiter->prev; + waiter->prev->next = waiter->next; +} + +InfLenFIFOQueue::Waiter* InfLenFIFOQueue::TopWaiter() { return waiters_.next; } + } // namespace grpc_core diff --git a/src/core/lib/iomgr/executor/mpmcqueue.h b/src/core/lib/iomgr/executor/mpmcqueue.h index c6102b3add0..ab5c484e094 100644 --- a/src/core/lib/iomgr/executor/mpmcqueue.h +++ b/src/core/lib/iomgr/executor/mpmcqueue.h @@ -54,7 +54,7 @@ class MPMCQueueInterface { class InfLenFIFOQueue : public MPMCQueueInterface { public: // Creates a new MPMC Queue. The queue created will have infinite length. - InfLenFIFOQueue() {} + InfLenFIFOQueue(); // Releases all resources held by the queue. The queue must be empty, and no // one waits on conditional variables. @@ -66,8 +66,8 @@ class InfLenFIFOQueue : public MPMCQueueInterface { // Removes the oldest element from the queue and returns it. // This routine will cause the thread to block if queue is currently empty. - // Argument wait_time should be passed in when turning on the trace flag - // grpc_thread_pool_trace (for collecting stats info purpose.) + // Argument wait_time should be passed in when trace flag turning on (for + // collecting stats info purpose.) void* Get(gpr_timespec* wait_time = nullptr); // Returns number of elements in queue currently. @@ -75,24 +75,33 @@ class InfLenFIFOQueue : public MPMCQueueInterface { // quickly. int count() const { return count_.Load(MemoryOrder::RELAXED); } - private: - // For Internal Use Only. - // Removes the oldest element from the queue and returns it. This routine - // will NOT check whether queue is empty, and it will NOT acquire mutex. - // Caller should do the check and acquire mutex before callling. - void* PopFront(); - struct Node { - Node* next; // Linking + Node* next; // Linking + Node* prev; void* content; // Points to actual element gpr_timespec insert_time; // Time for stats - Node(void* c) : content(c) { - next = nullptr; - insert_time = gpr_now(GPR_CLOCK_MONOTONIC); + Node() { + next = prev = nullptr; + content = nullptr; } }; + // For test purpose only. Returns number of nodes allocated in queue. + // Any allocated node will be alive until the destruction of the queue. + int num_nodes() const { return num_nodes_; } + + // For test purpose only. Returns the initial number of nodes in queue. + int init_num_nodes() const { return kQueueInitNumNodes; } + + private: + // For Internal Use Only. + // Removes the oldest element from the queue and returns it. This routine + // will NOT check whether queue is empty, and it will NOT acquire mutex. + // Caller MUST check that queue is not empty and must acquire mutex before + // callling. + void* PopFront(); + // Stats of queue. This will only be collect when debug trace mode is on. // All printed stats info will have time measurement in microsecond. struct Stats { @@ -115,15 +124,53 @@ class InfLenFIFOQueue : public MPMCQueueInterface { } }; - Mutex mu_; // Protecting lock - CondVar wait_nonempty_; // Wait on empty queue on get - int num_waiters_ = 0; // Number of waiters + // Node for waiting thread queue. Stands for one waiting thread, should have + // exact one thread waiting on its CondVar. + // Using a doubly linked list for waiting thread queue to wake up waiting + // threads in LIFO order to reduce cache misses. + struct Waiter { + CondVar cv; + Waiter* next; + Waiter* prev; + }; + + // Pushs waiter to the front of queue, require caller held mutex + void PushWaiter(Waiter* waiter); + + // Removes waiter from queue, require caller held mutex + void RemoveWaiter(Waiter* waiter); + + // Returns pointer to the waiter that should be waken up next, should be the + // last added waiter. + Waiter* TopWaiter(); + + Mutex mu_; // Protecting lock + Waiter waiters_; // Head of waiting thread queue + + // Initial size for delete list + static const int kDeleteListInitSize = 1024; + // Initial number of nodes allocated + static const int kQueueInitNumNodes = 1024; + + Node** delete_list_ = nullptr; // Keeps track of all allocated array entries + // for deleting on destruction + size_t delete_list_count_ = 0; // Number of entries in list + size_t delete_list_size_ = 0; // Size of the list. List will be expanded to + // double size on full Node* queue_head_ = nullptr; // Head of the queue, remove position Node* queue_tail_ = nullptr; // End of queue, insert position Atomic count_{0}; // Number of elements in queue - Stats stats_; // Stats info - gpr_timespec busy_time; // Start time of busy queue + int num_nodes_ = 0; // Number of nodes allocated + + Stats stats_; // Stats info + gpr_timespec busy_time; // Start time of busy queue + + // Internal Helper. + // Allocates an array of nodes of size "num", links all nodes together except + // the first node's prev and last node's next. They should be set by caller + // manually afterward. + Node* AllocateNodes(int num); }; } // namespace grpc_core diff --git a/src/core/lib/iomgr/resolve_address_custom.cc b/src/core/lib/iomgr/resolve_address_custom.cc index 64c33cdc0d4..b5c922b3ee5 100644 --- a/src/core/lib/iomgr/resolve_address_custom.cc +++ b/src/core/lib/iomgr/resolve_address_custom.cc @@ -71,6 +71,7 @@ void grpc_custom_resolve_callback(grpc_custom_resolver* r, grpc_resolved_addresses* result, grpc_error* error) { GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD(); + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; if (error == GRPC_ERROR_NONE) { *r->addresses = result; diff --git a/src/core/lib/iomgr/tcp_client_custom.cc b/src/core/lib/iomgr/tcp_client_custom.cc index 14a8b78dc68..6f236ae4d4e 100644 --- a/src/core/lib/iomgr/tcp_client_custom.cc +++ b/src/core/lib/iomgr/tcp_client_custom.cc @@ -101,6 +101,7 @@ static void custom_connect_callback_internal(grpc_custom_socket* socket, static void custom_connect_callback(grpc_custom_socket* socket, grpc_error* error) { + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; if (grpc_core::ExecCtx::Get() == nullptr) { /* If we are being run on a thread which does not have an exec_ctx created * yet, we should create one. */ diff --git a/src/core/lib/iomgr/tcp_custom.cc b/src/core/lib/iomgr/tcp_custom.cc index 66df5082e98..05cdd1ed358 100644 --- a/src/core/lib/iomgr/tcp_custom.cc +++ b/src/core/lib/iomgr/tcp_custom.cc @@ -145,6 +145,7 @@ static void call_read_cb(custom_tcp_endpoint* tcp, grpc_error* error) { static void custom_read_callback(grpc_custom_socket* socket, size_t nread, grpc_error* error) { + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; grpc_slice_buffer garbage; custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)socket->endpoint; @@ -207,6 +208,7 @@ static void endpoint_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices, static void custom_write_callback(grpc_custom_socket* socket, grpc_error* error) { + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)socket->endpoint; grpc_closure* cb = tcp->write_cb; @@ -301,6 +303,7 @@ static void custom_close_callback(grpc_custom_socket* socket) { grpc_custom_socket_vtable->destroy(socket); gpr_free(socket); } else if (socket->endpoint) { + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)socket->endpoint; TCP_UNREF(tcp, "destroy"); @@ -343,6 +346,7 @@ grpc_endpoint* custom_tcp_endpoint_create(grpc_custom_socket* socket, char* peer_string) { custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)gpr_malloc(sizeof(custom_tcp_endpoint)); + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; if (GRPC_TRACE_FLAG_ENABLED(grpc_tcp_trace)) { diff --git a/src/core/lib/iomgr/tcp_server_custom.cc b/src/core/lib/iomgr/tcp_server_custom.cc index 767404be21d..c4fe5afb65b 100644 --- a/src/core/lib/iomgr/tcp_server_custom.cc +++ b/src/core/lib/iomgr/tcp_server_custom.cc @@ -245,6 +245,7 @@ static void custom_accept_callback(grpc_custom_socket* socket, static void custom_accept_callback(grpc_custom_socket* socket, grpc_custom_socket* client, grpc_error* error) { + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; grpc_tcp_listener* sp = socket->listener; if (error != GRPC_ERROR_NONE) { diff --git a/src/core/lib/iomgr/timer_custom.cc b/src/core/lib/iomgr/timer_custom.cc index 71d825ff9f5..57675c27a8f 100644 --- a/src/core/lib/iomgr/timer_custom.cc +++ b/src/core/lib/iomgr/timer_custom.cc @@ -32,6 +32,7 @@ static grpc_custom_timer_vtable* custom_timer_impl; void grpc_custom_timer_callback(grpc_custom_timer* t, grpc_error* error) { GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD(); + grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; grpc_timer* timer = t->original; GPR_ASSERT(timer->pending); diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index 7a584835b96..87aa0357be7 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -199,8 +199,8 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( *token_lifetime = strtol(expires_in->value, nullptr, 10) * GPR_MS_PER_SEC; if (!GRPC_MDISNULL(*token_md)) GRPC_MDELEM_UNREF(*token_md); *token_md = grpc_mdelem_from_slices( - grpc_slice_from_static_string(GRPC_AUTHORIZATION_METADATA_KEY), - grpc_slice_from_copied_string(new_access_token)); + grpc_core::ExternallyManagedSlice(GRPC_AUTHORIZATION_METADATA_KEY), + grpc_core::UnmanagedMemorySlice(new_access_token)); status = GRPC_CREDENTIALS_OK; } @@ -721,8 +721,8 @@ grpc_access_token_credentials::grpc_access_token_credentials( gpr_asprintf(&token_md_value, "Bearer %s", access_token); grpc_core::ExecCtx exec_ctx; access_token_md_ = grpc_mdelem_from_slices( - grpc_slice_from_static_string(GRPC_AUTHORIZATION_METADATA_KEY), - grpc_slice_from_copied_string(token_md_value)); + grpc_core::ExternallyManagedSlice(GRPC_AUTHORIZATION_METADATA_KEY), + grpc_core::UnmanagedMemorySlice(token_md_value)); gpr_free(token_md_value); } diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc index 57862518feb..d3480abaa87 100644 --- a/src/core/lib/slice/slice.cc +++ b/src/core/lib/slice/slice.cc @@ -37,12 +37,7 @@ char* grpc_slice_to_c_string(grpc_slice slice) { return out; } -grpc_slice grpc_empty_slice(void) { - grpc_slice out; - out.refcount = nullptr; - out.data.inlined.length = 0; - return out; -} +grpc_slice grpc_empty_slice(void) { return grpc_core::UnmanagedMemorySlice(); } grpc_slice grpc_slice_copy(grpc_slice s) { grpc_slice out = GRPC_SLICE_MALLOC(GRPC_SLICE_LENGTH(s)); @@ -112,11 +107,11 @@ size_t grpc_slice_memory_usage(grpc_slice s) { } grpc_slice grpc_slice_from_static_buffer(const void* s, size_t len) { - return grpc_slice_from_static_buffer_internal(s, len); + return grpc_core::ExternallyManagedSlice(s, len); } grpc_slice grpc_slice_from_static_string(const char* s) { - return grpc_slice_from_static_buffer_internal(s, strlen(s)); + return grpc_core::ExternallyManagedSlice(s, strlen(s)); } grpc_slice grpc_slice_new_with_user_data(void* p, size_t len, @@ -202,15 +197,29 @@ grpc_slice grpc_slice_new_with_len(void* p, size_t len, return slice; } +grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(const char* source, + size_t length) { + if (length <= sizeof(data.inlined.bytes)) { + refcount = nullptr; + data.inlined.length = static_cast(length); + } else { + HeapInit(length); + } + if (length > 0) { + memcpy(GRPC_SLICE_START_PTR(*this), source, length); + } +} + +grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(const char* source) + : grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(source, + strlen(source)) {} + grpc_slice grpc_slice_from_copied_buffer(const char* source, size_t length) { - if (length == 0) return grpc_empty_slice(); - grpc_slice slice = GRPC_SLICE_MALLOC(length); - memcpy(GRPC_SLICE_START_PTR(slice), source, length); - return slice; + return grpc_core::UnmanagedMemorySlice(source, length); } grpc_slice grpc_slice_from_copied_string(const char* source) { - return grpc_slice_from_copied_buffer(source, strlen(source)); + return grpc_core::UnmanagedMemorySlice(source, strlen(source)); } grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr p, @@ -261,8 +270,11 @@ class MallocRefCount { } // namespace grpc_slice grpc_slice_malloc_large(size_t length) { - grpc_slice slice; + return grpc_core::UnmanagedMemorySlice( + length, grpc_core::UnmanagedMemorySlice::ForceHeapAllocation()); +} +void grpc_core::UnmanagedMemorySlice::HeapInit(size_t length) { /* Memory layout used by the slice created here: +-----------+----------------------------------------------------------+ @@ -281,29 +293,30 @@ grpc_slice grpc_slice_malloc_large(size_t length) { /* Build up the slice to be returned. */ /* The slices refcount points back to the allocated block. */ - slice.refcount = rc->base_refcount(); + refcount = rc->base_refcount(); /* The data bytes are placed immediately after the refcount struct */ - slice.data.refcounted.bytes = reinterpret_cast(rc + 1); + data.refcounted.bytes = reinterpret_cast(rc + 1); /* And the length of the block is set to the requested length */ - slice.data.refcounted.length = length; - return slice; + data.refcounted.length = length; } grpc_slice grpc_slice_malloc(size_t length) { - grpc_slice slice; + return grpc_core::UnmanagedMemorySlice(length); +} - if (length > sizeof(slice.data.inlined.bytes)) { - return grpc_slice_malloc_large(length); +grpc_core::UnmanagedMemorySlice::UnmanagedMemorySlice(size_t length) { + if (length > sizeof(data.inlined.bytes)) { + HeapInit(length); } else { /* small slice: just inline the data */ - slice.refcount = nullptr; - slice.data.inlined.length = static_cast(length); + refcount = nullptr; + data.inlined.length = static_cast(length); } - return slice; } -grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) { - grpc_slice subset; +template +static Slice sub_no_ref(const Slice& source, size_t begin, size_t end) { + Slice subset; GPR_ASSERT(end >= begin); @@ -327,6 +340,15 @@ grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) { return subset; } +grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) { + return sub_no_ref(source, begin, end); +} + +grpc_core::UnmanagedMemorySlice grpc_slice_sub_no_ref( + const grpc_core::UnmanagedMemorySlice& source, size_t begin, size_t end) { + return sub_no_ref(source, begin, end); +} + grpc_slice grpc_slice_sub(grpc_slice source, size_t begin, size_t end) { grpc_slice subset; diff --git a/src/core/lib/slice/slice_intern.cc b/src/core/lib/slice/slice_intern.cc index 81d34ddce25..13fe1ab40e9 100644 --- a/src/core/lib/slice/slice_intern.cc +++ b/src/core/lib/slice/slice_intern.cc @@ -107,12 +107,10 @@ static void grow_shard(slice_shard* shard) { shard->capacity = capacity; } -static grpc_slice materialize(InternedSliceRefcount* s) { - grpc_slice slice; - slice.refcount = &s->base; - slice.data.refcounted.bytes = reinterpret_cast(s + 1); - slice.data.refcounted.length = s->length; - return slice; +grpc_core::InternedSlice::InternedSlice(InternedSliceRefcount* s) { + refcount = &s->base; + data.refcounted.bytes = reinterpret_cast(s + 1); + data.refcounted.length = s->length; } uint32_t grpc_slice_default_hash_impl(grpc_slice s) { @@ -152,57 +150,150 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, } grpc_slice grpc_slice_intern(grpc_slice slice) { - GPR_TIMER_SCOPE("grpc_slice_intern", 0); - if (GRPC_IS_STATIC_METADATA_STRING(slice)) { - return slice; - } - - uint32_t hash = grpc_slice_hash_internal(slice); + /* TODO(arjunroy): At present, this is capable of returning either a static or + an interned slice. This yields weirdness like the constructor for + ManagedMemorySlice instantiating itself as an instance of a derived type + (StaticMetadataSlice or InternedSlice). Should reexamine. */ + return grpc_core::ManagedMemorySlice(&slice); +} +// Attempt to see if the provided slice or string matches a static slice. +// SliceArgs... is either a const grpc_slice& or a string and length. In either +// case, hash is the pre-computed hash value. +// +// Returns: a matching static slice, or null. +template +static const grpc_core::StaticMetadataSlice* MatchStaticSlice( + uint32_t hash, SliceArgs&&... args) { for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) { static_metadata_hash_ent ent = static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)]; if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT && - grpc_slice_eq_static_interned(slice, - grpc_static_slice_table[ent.idx])) { - return grpc_static_slice_table[ent.idx]; + grpc_static_slice_table[ent.idx].Equals( + std::forward(args)...)) { + return &grpc_static_slice_table[ent.idx]; } } + return nullptr; +} - InternedSliceRefcount* s; - slice_shard* shard = &g_shards[SHARD_IDX(hash)]; +// Helper methods to enable us to select appropriately overloaded slice methods +// whether we're dealing with a slice, or a buffer with length, when interning +// strings. Helpers for FindOrCreateInternedSlice(). +static const void* GetBuffer(const void* buf, size_t len) { return buf; } +static size_t GetLength(const void* buf, size_t len) { return len; } +static const void* GetBuffer(const grpc_slice& slice) { + return GRPC_SLICE_START_PTR(slice); +} +static size_t GetLength(const grpc_slice& slice) { + return GRPC_SLICE_LENGTH(slice); +} - gpr_mu_lock(&shard->mu); +// Creates an interned slice for a string that does not currently exist in the +// intern table. SliceArgs... is either a const grpc_slice& or a string and +// length. In either case, hash is the pre-computed hash value. We must already +// hold the shard lock. Helper for FindOrCreateInternedSlice(). +// +// Returns: a newly interned slice. +template +static InternedSliceRefcount* InternNewStringLocked(slice_shard* shard, + size_t shard_idx, + uint32_t hash, + SliceArgs&&... args) { + /* string data goes after the internal_string header */ + size_t len = GetLength(std::forward(args)...); + const void* buffer = GetBuffer(std::forward(args)...); + InternedSliceRefcount* s = + static_cast(gpr_malloc(sizeof(*s) + len)); + new (s) grpc_core::InternedSliceRefcount(len, hash, shard->strs[shard_idx]); + memcpy(reinterpret_cast(s + 1), buffer, len); + shard->strs[shard_idx] = s; + shard->count++; + if (shard->count > shard->capacity * 2) { + grow_shard(shard); + } + return s; +} +// Attempt to see if the provided slice or string matches an existing interned +// slice. SliceArgs... is either a const grpc_slice& or a string and length. In +// either case, hash is the pre-computed hash value. We must already hold the +// shard lock. Helper for FindOrCreateInternedSlice(). +// +// Returns: a pre-existing matching static slice, or null. +template +static InternedSliceRefcount* MatchInternedSliceLocked(uint32_t hash, + size_t idx, + SliceArgs&&... args) { + InternedSliceRefcount* s; + slice_shard* shard = &g_shards[SHARD_IDX(hash)]; /* search for an existing string */ - size_t idx = TABLE_IDX(hash, shard->capacity); for (s = shard->strs[idx]; s; s = s->bucket_next) { if (s->hash == hash && - grpc_slice_eq_static_interned(slice, materialize(s))) { + grpc_core::InternedSlice(s).Equals(std::forward(args)...)) { if (s->refcnt.RefIfNonZero()) { - gpr_mu_unlock(&shard->mu); - return materialize(s); + return s; } } } + return nullptr; +} - /* not found: create a new string */ - /* string data goes after the internal_string header */ - s = static_cast( - gpr_malloc(sizeof(*s) + GRPC_SLICE_LENGTH(slice))); - - new (s) grpc_core::InternedSliceRefcount(GRPC_SLICE_LENGTH(slice), hash, - shard->strs[idx]); - memcpy(reinterpret_cast(s + 1), GRPC_SLICE_START_PTR(slice), - GRPC_SLICE_LENGTH(slice)); - shard->strs[idx] = s; - shard->count++; - if (shard->count > shard->capacity * 2) { - grow_shard(shard); +// Attempt to see if the provided slice or string matches an existing interned +// slice, and failing that, create an interned slice with its contents. Returns +// either the existing matching interned slice or the newly created one. +// SliceArgs... is either a const grpc_slice& or a string and length. In either +// case, hash is the pre-computed hash value. We do not hold the shard lock +// here, but do take it. +// +// Returns: an interned slice, either pre-existing/matched or newly created. +template +static InternedSliceRefcount* FindOrCreateInternedSlice(uint32_t hash, + SliceArgs&&... args) { + slice_shard* shard = &g_shards[SHARD_IDX(hash)]; + gpr_mu_lock(&shard->mu); + const size_t idx = TABLE_IDX(hash, shard->capacity); + InternedSliceRefcount* s = + MatchInternedSliceLocked(hash, idx, std::forward(args)...); + if (s == nullptr) { + s = InternNewStringLocked(shard, idx, hash, + std::forward(args)...); } - gpr_mu_unlock(&shard->mu); - return materialize(s); + return s; +} + +grpc_core::ManagedMemorySlice::ManagedMemorySlice(const char* string) + : grpc_core::ManagedMemorySlice::ManagedMemorySlice(string, + strlen(string)) {} + +grpc_core::ManagedMemorySlice::ManagedMemorySlice(const char* string, + size_t len) { + GPR_TIMER_SCOPE("grpc_slice_intern", 0); + const uint32_t hash = gpr_murmur_hash3(string, len, g_hash_seed); + const StaticMetadataSlice* static_slice = MatchStaticSlice(hash, string, len); + if (static_slice) { + *this = *static_slice; + } else { + *this = + grpc_core::InternedSlice(FindOrCreateInternedSlice(hash, string, len)); + } +} + +grpc_core::ManagedMemorySlice::ManagedMemorySlice(const grpc_slice* slice_ptr) { + GPR_TIMER_SCOPE("grpc_slice_intern", 0); + const grpc_slice& slice = *slice_ptr; + if (GRPC_IS_STATIC_METADATA_STRING(slice)) { + *this = static_cast(slice); + return; + } + const uint32_t hash = grpc_slice_hash_internal(slice); + const StaticMetadataSlice* static_slice = MatchStaticSlice(hash, slice); + if (static_slice) { + *this = *static_slice; + } else { + *this = grpc_core::InternedSlice(FindOrCreateInternedSlice(hash, slice)); + } } void grpc_test_only_set_slice_hash_seed(uint32_t seed) { @@ -259,8 +350,8 @@ void grpc_slice_intern_shutdown(void) { shard->count); for (size_t j = 0; j < shard->capacity; j++) { for (InternedSliceRefcount* s = shard->strs[j]; s; s = s->bucket_next) { - char* text = - grpc_dump_slice(materialize(s), GPR_DUMP_HEX | GPR_DUMP_ASCII); + char* text = grpc_dump_slice(grpc_core::InternedSlice(s), + GPR_DUMP_HEX | GPR_DUMP_ASCII); gpr_log(GPR_DEBUG, "LEAKED: %s", text); gpr_free(text); } diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index 54badeb9ab9..219266c3941 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -30,6 +30,7 @@ #include "src/core/lib/gpr/murmur_hash.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/slice/slice_utils.h" #include "src/core/lib/transport/static_metadata.h" // Interned slices have specific fast-path operations for hashing. To inline @@ -95,6 +96,8 @@ extern uint32_t g_hash_seed; // In total, this saves us roughly 1-2% latency for unary calls, with smaller // calls benefitting. The effect is present, but not as useful, for larger calls // where the cost of sending the data dominates. +// TODO(arjunroy): Investigate if this can be removed with strongly typed +// grpc_slices. struct grpc_slice_refcount { public: enum class Type { @@ -314,17 +317,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr p); // 0. All other slices will return the size of the allocated chars. size_t grpc_slice_memory_usage(grpc_slice s); -inline grpc_slice grpc_slice_from_static_buffer_internal(const void* s, - size_t len) { - grpc_slice slice; - slice.refcount = &grpc_core::kNoopRefcount; - slice.data.refcounted.bytes = (uint8_t*)s; - slice.data.refcounted.length = len; - return slice; -} - -inline grpc_slice grpc_slice_from_static_string_internal(const char* s) { - return grpc_slice_from_static_buffer_internal(s, strlen(s)); -} +grpc_core::UnmanagedMemorySlice grpc_slice_sub_no_ref( + const grpc_core::UnmanagedMemorySlice& source, size_t begin, size_t end); #endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */ diff --git a/src/core/lib/slice/slice_utils.h b/src/core/lib/slice/slice_utils.h index 7589bf8f0f7..161300abe1e 100644 --- a/src/core/lib/slice/slice_utils.h +++ b/src/core/lib/slice/slice_utils.h @@ -21,6 +21,8 @@ #include +#include + #include // When we compare two slices, and we know the latter is not inlined, we can @@ -36,6 +38,7 @@ // x86-64/clang with differs(). int grpc_slice_differs_refcounted(const grpc_slice& a, const grpc_slice& b_not_inline); + // When we compare two slices, and we *know* that one of them is static or // interned, we can short circuit our slice equality function. The second slice // here must be static or interned; slice a can be any slice, inlined or not. @@ -47,4 +50,121 @@ inline bool grpc_slice_eq_static_interned(const grpc_slice& a, return !grpc_slice_differs_refcounted(a, b_static_interned); } +// TODO(arjunroy): These type declarations ought to be in +// src/core/lib/slice/slice_internal.h instead; they are here due to a circular +// header depedency between slice_internal.h and +// src/core/lib/transport/metadata.h. We need to fix this circular reference and +// when we do, move these type declarations. +// +// Internal slice type declarations. +// Externally, a grpc_slice is a grpc_slice is a grpc_slice. +// Internally, we may have heap allocated slices, static slices, interned +// slices, and inlined slices. If we know the specific type of slice +// we're dealing with, we can save cycles (e.g. fast-paths when we know we don't +// need to take a reference on a slice). Rather than introducing new methods +// ad-hoc in these cases, we rely on type-system backed overloads to keep +// internal APIs clean. +// +// For each overload, the definition and layout of the underlying slice does not +// change; this is purely type-system information. +namespace grpc_core { + +// There are two main types of slices: those that have their memory +// managed by the slice library and those that do not. +// +// The following types of slices are not managed: +// - inlined slices (i.e., refcount is null) +// - slices that have a custom refcount type (i.e., not STATIC or INTERNED) +// - slices where the memory is managed by some external agent. The slice is not +// ref-counted by grpc, and the programmer is responsible for ensuring the +// data is valid for the duration of the period that grpc may access it. +// +// The following types of slices are managed: +// - static metadata slices (i.e., refcount type is STATIC) +// - interned slices (i.e., refcount type is INTERNED) +// +// This categorization is reflected in the following hierarchy: +// +// - grpc_slice +// > - UnmanagedMemorySlice +// > - ExternallyManagedSlice +// - ManagedMemorySlice +// > - InternedSlice +// - StaticMetadataSlice +// +struct ManagedMemorySlice : public grpc_slice { + ManagedMemorySlice() { + refcount = nullptr; + data.refcounted.bytes = nullptr; + data.refcounted.length = 0; + } + explicit ManagedMemorySlice(const char* string); + ManagedMemorySlice(const char* buf, size_t len); + explicit ManagedMemorySlice(const grpc_slice* slice); + bool Equals(const grpc_slice& other) const { + if (refcount == other.refcount) { + return true; + } + return !grpc_slice_differs_refcounted(other, *this); + } + bool Equals(const char* buf, const size_t len) const { + return data.refcounted.length == len && + memcmp(buf, data.refcounted.bytes, len) == 0; + } +}; +struct UnmanagedMemorySlice : public grpc_slice { + // TODO(arjunroy): Can we use a default=false param instead of this enum? + enum class ForceHeapAllocation {}; + UnmanagedMemorySlice() { + refcount = nullptr; + data.inlined.length = 0; + } + explicit UnmanagedMemorySlice(const char* source); + UnmanagedMemorySlice(const char* source, size_t length); + // The first constructor creates a slice that may be heap allocated, or + // inlined in the slice structure if length is small enough + // (< GRPC_SLICE_INLINED_SIZE). The second constructor forces heap alloc. + explicit UnmanagedMemorySlice(size_t length); + explicit UnmanagedMemorySlice(size_t length, const ForceHeapAllocation&) { + HeapInit(length); + } + + private: + void HeapInit(size_t length); +}; + +extern grpc_slice_refcount kNoopRefcount; + +struct ExternallyManagedSlice : public UnmanagedMemorySlice { + ExternallyManagedSlice() + : ExternallyManagedSlice(&kNoopRefcount, 0, nullptr) {} + explicit ExternallyManagedSlice(const char* s) + : ExternallyManagedSlice(s, strlen(s)) {} + ExternallyManagedSlice(const void* s, size_t len) + : ExternallyManagedSlice( + &kNoopRefcount, len, + reinterpret_cast(const_cast(s))) {} + ExternallyManagedSlice(grpc_slice_refcount* ref, size_t length, + uint8_t* bytes) { + refcount = ref; + data.refcounted.length = length; + data.refcounted.bytes = bytes; + } +}; + +struct StaticMetadataSlice : public ManagedMemorySlice { + StaticMetadataSlice(grpc_slice_refcount* ref, size_t length, uint8_t* bytes) { + refcount = ref; + data.refcounted.length = length; + data.refcounted.bytes = bytes; + } +}; + +struct InternedSliceRefcount; +struct InternedSlice : public ManagedMemorySlice { + explicit InternedSlice(InternedSliceRefcount* s); +}; + +} // namespace grpc_core + #endif /* GRPC_CORE_LIB_SLICE_SLICE_UTILS_H */ diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index e61550743b7..942af37a830 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -235,6 +235,23 @@ grpc_channel* grpc_channel_create(const char* target, grpc_channel_stack_type channel_stack_type, grpc_transport* optional_transport, grpc_resource_user* resource_user) { + // We need to make sure that grpc_shutdown() does not shut things down + // until after the channel is destroyed. However, the channel may not + // actually be destroyed by the time grpc_channel_destroy() returns, + // since there may be other existing refs to the channel. If those + // refs are held by things that are visible to the wrapped language + // (such as outstanding calls on the channel), then the wrapped + // language can be responsible for making sure that grpc_shutdown() + // does not run until after those refs are released. However, the + // channel may also have refs to itself held internally for various + // things that need to be cleaned up at channel destruction (e.g., + // LB policies, subchannels, etc), and because these refs are not + // visible to the wrapped language, it cannot be responsible for + // deferring grpc_shutdown() until after they are released. To + // accommodate that, we call grpc_init() here and then call + // grpc_shutdown() when the channel is actually destroyed, thus + // ensuring that shutdown is deferred until that point. + grpc_init(); grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create(); const grpc_core::UniquePtr default_authority = get_default_authority(input_args); @@ -250,6 +267,7 @@ grpc_channel* grpc_channel_create(const char* target, if (resource_user != nullptr) { grpc_resource_user_free(resource_user, GRPC_RESOURCE_QUOTA_CHANNEL_SIZE); } + grpc_shutdown(); // Since we won't call destroy_channel(). return nullptr; } // We only need to do this for clients here. For servers, this will be @@ -257,7 +275,12 @@ grpc_channel* grpc_channel_create(const char* target, if (grpc_channel_stack_type_is_client(channel_stack_type)) { CreateChannelzNode(builder); } - return grpc_channel_create_with_builder(builder, channel_stack_type); + grpc_channel* channel = + grpc_channel_create_with_builder(builder, channel_stack_type); + if (channel == nullptr) { + grpc_shutdown(); // Since we won't call destroy_channel(). + } + return channel; } size_t grpc_channel_get_call_size_estimate(grpc_channel* channel) { @@ -393,13 +416,11 @@ void* grpc_channel_register_call(grpc_channel* channel, const char* method, GPR_ASSERT(!reserved); grpc_core::ExecCtx exec_ctx; - rc->path = grpc_mdelem_from_slices( - GRPC_MDSTR_PATH, - grpc_slice_intern(grpc_slice_from_static_string(method))); + rc->path = grpc_mdelem_from_slices(GRPC_MDSTR_PATH, + grpc_core::ManagedMemorySlice(method)); rc->authority = - host ? grpc_mdelem_from_slices( - GRPC_MDSTR_AUTHORITY, - grpc_slice_intern(grpc_slice_from_static_string(host))) + host ? grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY, + grpc_core::ManagedMemorySlice(host)) : GRPC_MDNULL; gpr_mu_lock(&channel->registered_call_mu); rc->next = channel->registered_calls; @@ -468,6 +489,8 @@ static void destroy_channel(void* arg, grpc_error* error) { gpr_mu_destroy(&channel->registered_call_mu); gpr_free(channel->target); gpr_free(channel); + // See comment in grpc_channel_create() for why we do this. + grpc_shutdown(); } void grpc_channel_destroy(grpc_channel* channel) { @@ -488,5 +511,5 @@ grpc_mdelem grpc_channel_get_reffed_status_elem_slowpath(grpc_channel* channel, char tmp[GPR_LTOA_MIN_BUFSIZE]; gpr_ltoa(i, tmp); return grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_STATUS, - grpc_slice_from_copied_string(tmp)); + grpc_core::UnmanagedMemorySlice(tmp)); } diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index dde39b8c681..10a27924073 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -61,10 +61,10 @@ static void fill_metadata(grpc_call_element* elem, grpc_metadata_batch* mdb) { char tmp[GPR_LTOA_MIN_BUFSIZE]; gpr_ltoa(chand->error_code, tmp); calld->status.md = grpc_mdelem_from_slices( - GRPC_MDSTR_GRPC_STATUS, grpc_slice_from_copied_string(tmp)); + GRPC_MDSTR_GRPC_STATUS, grpc_core::UnmanagedMemorySlice(tmp)); calld->details.md = grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_MESSAGE, - grpc_slice_from_copied_string(chand->error_message)); + grpc_core::UnmanagedMemorySlice(chand->error_message)); calld->status.prev = calld->details.next = nullptr; calld->status.next = &calld->details; calld->details.prev = &calld->status; diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 7fe05c10a54..db2d291bc59 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -1254,15 +1254,6 @@ void grpc_server_setup_transport( grpc_transport_perform_op(transport, op); } -void grpc_server_populate_listen_sockets( - grpc_server* server, grpc_core::channelz::ChildRefsList* listen_sockets) { - gpr_mu_lock(&server->mu_global); - for (listener* l = server->listeners; l != nullptr; l = l->next) { - listen_sockets->push_back(l->socket_uuid); - } - gpr_mu_unlock(&server->mu_global); -} - void done_published_shutdown(void* done_arg, grpc_cq_completion* storage) { (void)done_arg; gpr_free(storage); @@ -1350,6 +1341,9 @@ void grpc_server_shutdown_and_notify(grpc_server* server, GRPC_CLOSURE_INIT(&l->destroy_done, listener_destroy_done, server, grpc_schedule_on_exec_ctx); l->destroy(server, l->arg, &l->destroy_done); + if (server->channelz_server != nullptr && l->socket_uuid != 0) { + server->channelz_server->RemoveChildListenSocket(l->socket_uuid); + } } channel_broadcaster_shutdown(&broadcaster, true /* send_goaway */, @@ -1401,18 +1395,23 @@ void grpc_server_destroy(grpc_server* server) { server_unref(server); } -void grpc_server_add_listener(grpc_server* server, void* arg, - void (*start)(grpc_server* server, void* arg, - grpc_pollset** pollsets, - size_t pollset_count), - void (*destroy)(grpc_server* server, void* arg, - grpc_closure* on_done), - intptr_t socket_uuid) { +void grpc_server_add_listener( + grpc_server* server, void* listener_arg, + void (*start)(grpc_server* server, void* arg, grpc_pollset** pollsets, + size_t pollset_count), + void (*destroy)(grpc_server* server, void* arg, grpc_closure* on_done), + grpc_core::RefCountedPtr node) { listener* l = static_cast(gpr_malloc(sizeof(listener))); - l->arg = arg; + l->arg = listener_arg; l->start = start; l->destroy = destroy; - l->socket_uuid = socket_uuid; + l->socket_uuid = 0; + if (node != nullptr) { + l->socket_uuid = node->uuid(); + if (server->channelz_server != nullptr) { + server->channelz_server->AddChildListenSocket(std::move(node)); + } + } l->next = server->listeners; server->listeners = l; } diff --git a/src/core/lib/surface/server.h b/src/core/lib/surface/server.h index 926a5825006..2285821e11b 100644 --- a/src/core/lib/surface/server.h +++ b/src/core/lib/surface/server.h @@ -34,13 +34,12 @@ extern grpc_core::TraceFlag grpc_server_channel_trace; /* Add a listener to the server: when the server starts, it will call start, and when it shuts down, it will call destroy */ -void grpc_server_add_listener(grpc_server* server, void* listener, - void (*start)(grpc_server* server, void* arg, - grpc_pollset** pollsets, - size_t npollsets), - void (*destroy)(grpc_server* server, void* arg, - grpc_closure* on_done), - intptr_t socket_uuid); +void grpc_server_add_listener( + grpc_server* server, void* listener_arg, + void (*start)(grpc_server* server, void* arg, grpc_pollset** pollsets, + size_t npollsets), + void (*destroy)(grpc_server* server, void* arg, grpc_closure* on_done), + grpc_core::RefCountedPtr node); /* Setup a transport - creates a channel stack, binds the transport to the server */ @@ -51,10 +50,6 @@ void grpc_server_setup_transport( socket_node, grpc_resource_user* resource_user = nullptr); -/* fills in the uuids of all listen sockets on this server */ -void grpc_server_populate_listen_sockets( - grpc_server* server, grpc_core::channelz::ChildRefsList* listen_sockets); - grpc_core::channelz::ServerNode* grpc_server_get_channelz_node( grpc_server* server); diff --git a/src/core/lib/transport/error_utils.cc b/src/core/lib/transport/error_utils.cc index 5be98c9f04f..78a324b2d7f 100644 --- a/src/core/lib/transport/error_utils.cc +++ b/src/core/lib/transport/error_utils.cc @@ -61,7 +61,7 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline, // 3) The resulting slice is statically known. // 4) Said resulting slice is of length 0 (""). // This means 3 movs, instead of 10s of instructions and a strlen. - *slice = grpc_slice_from_static_string_internal(""); + *slice = grpc_core::ExternallyManagedSlice(""); } if (http_error != nullptr) { *http_error = GRPC_HTTP2_NO_ERROR; diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc index 1523ced16d8..4242923283e 100644 --- a/src/core/lib/transport/metadata.cc +++ b/src/core/lib/transport/metadata.cc @@ -68,8 +68,8 @@ void grpc_mdelem_trace_ref(void* md, const grpc_slice& key, char* key_str = grpc_slice_to_c_string(key); char* value_str = grpc_slice_to_c_string(value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, refcnt, - refcnt + 1, key_str, value_str); + "mdelem REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, + refcnt, refcnt + 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); } @@ -82,7 +82,7 @@ void grpc_mdelem_trace_unref(void* md, const grpc_slice& key, char* key_str = grpc_slice_to_c_string(key); char* value_str = grpc_slice_to_c_string(value); gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, - "ELM UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, + "mdelem UNREF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", md, refcnt, refcnt - 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); @@ -112,14 +112,33 @@ AllocatedMetadata::AllocatedMetadata(const grpc_slice& key, : RefcountedMdBase(grpc_slice_ref_internal(key), grpc_slice_ref_internal(value)) { #ifndef NDEBUG - if (grpc_trace_metadata.enabled()) { - char* key_str = grpc_slice_to_c_string(key); - char* value_str = grpc_slice_to_c_string(value); - gpr_log(GPR_DEBUG, "ELM ALLOC:%p:%" PRIdPTR ": '%s' = '%s'", this, - RefValue(), key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); - } + TraceAtStart("ALLOC_MD"); +#endif +} + +AllocatedMetadata::AllocatedMetadata(const grpc_slice& key, + const grpc_slice& value, const NoRefKey*) + : RefcountedMdBase(key, grpc_slice_ref_internal(value)) { +#ifndef NDEBUG + TraceAtStart("ALLOC_MD_NOREF_KEY"); +#endif +} + +AllocatedMetadata::AllocatedMetadata( + const grpc_core::ManagedMemorySlice& key, + const grpc_core::UnmanagedMemorySlice& value) + : RefcountedMdBase(key, value) { +#ifndef NDEBUG + TraceAtStart("ALLOC_MD_NOREF_KEY_VAL"); +#endif +} + +AllocatedMetadata::AllocatedMetadata( + const grpc_core::ExternallyManagedSlice& key, + const grpc_core::UnmanagedMemorySlice& value) + : RefcountedMdBase(key, value) { +#ifndef NDEBUG + TraceAtStart("ALLOC_MD_NOREF_KEY_VAL"); #endif } @@ -134,6 +153,19 @@ AllocatedMetadata::~AllocatedMetadata() { } } +#ifndef NDEBUG +void grpc_core::RefcountedMdBase::TraceAtStart(const char* tag) { + if (grpc_trace_metadata.enabled()) { + char* key_str = grpc_slice_to_c_string(key()); + char* value_str = grpc_slice_to_c_string(value()); + gpr_log(GPR_DEBUG, "mdelem %s:%p:%" PRIdPTR ": '%s' = '%s'", tag, this, + RefValue(), key_str, value_str); + gpr_free(key_str); + gpr_free(value_str); + } +} +#endif + InternedMetadata::InternedMetadata(const grpc_slice& key, const grpc_slice& value, uint32_t hash, InternedMetadata* next) @@ -141,14 +173,16 @@ InternedMetadata::InternedMetadata(const grpc_slice& key, grpc_slice_ref_internal(value), hash), link_(next) { #ifndef NDEBUG - if (grpc_trace_metadata.enabled()) { - char* key_str = grpc_slice_to_c_string(key); - char* value_str = grpc_slice_to_c_string(value); - gpr_log(GPR_DEBUG, "ELM NEW:%p:%" PRIdPTR ": '%s' = '%s'", this, - RefValue(), key_str, value_str); - gpr_free(key_str); - gpr_free(value_str); - } + TraceAtStart("INTERNED_MD"); +#endif +} + +InternedMetadata::InternedMetadata(const grpc_slice& key, + const grpc_slice& value, uint32_t hash, + InternedMetadata* next, const NoRefKey*) + : RefcountedMdBase(key, grpc_slice_ref_internal(value), hash), link_(next) { +#ifndef NDEBUG + TraceAtStart("INTERNED_MD_NOREF_KEY"); #endif } @@ -222,7 +256,12 @@ void grpc_mdctx_global_shutdown() { abort(); } } + // For ASAN builds, we don't want to crash here, because that will + // prevent ASAN from providing leak detection information, which is + // far more useful than this simple assertion. +#ifndef GRPC_ASAN_ENABLED GPR_DEBUG_ASSERT(shard->count == 0); +#endif gpr_free(shard->elems); } } @@ -243,8 +282,8 @@ void InternedMetadata::RefWithShardLocked(mdtab_shard* shard) { char* value_str = grpc_slice_to_c_string(value()); intptr_t value = RefValue(); gpr_log(__FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG, - "ELM REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", this, value, - value + 1, key_str, value_str); + "mdelem REF:%p:%" PRIdPTR "->%" PRIdPTR ": '%s' = '%s'", this, + value, value + 1, key_str, value_str); gpr_free(key_str); gpr_free(value_str); } @@ -302,36 +341,100 @@ static void rehash_mdtab(mdtab_shard* shard) { } } -grpc_mdelem grpc_mdelem_create( +template +static grpc_mdelem md_create_maybe_static(const grpc_slice& key, + const grpc_slice& value); +template +static grpc_mdelem md_create_must_intern(const grpc_slice& key, + const grpc_slice& value, + uint32_t hash); + +template +static grpc_mdelem md_create( const grpc_slice& key, const grpc_slice& value, grpc_mdelem_data* compatible_external_backing_store) { + // Ensure slices are, in fact, static if we claimed they were. + GPR_DEBUG_ASSERT(!key_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(key)); + GPR_DEBUG_ASSERT(!value_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(value)); + const bool key_is_interned = + key_definitely_static || grpc_slice_is_interned(key); + const bool value_is_interned = + value_definitely_static || grpc_slice_is_interned(value); // External storage if either slice is not interned and the caller already // created a backing store. If no backing store, we allocate one. - if (!grpc_slice_is_interned(key) || !grpc_slice_is_interned(value)) { + if (!key_is_interned || !value_is_interned) { if (compatible_external_backing_store != nullptr) { // Caller provided backing store. return GRPC_MAKE_MDELEM(compatible_external_backing_store, GRPC_MDELEM_STORAGE_EXTERNAL); } else { // We allocate backing store. - return GRPC_MAKE_MDELEM(grpc_core::New(key, value), - GRPC_MDELEM_STORAGE_ALLOCATED); + return key_definitely_static + ? GRPC_MAKE_MDELEM( + grpc_core::New( + key, value, + static_cast( + nullptr)), + GRPC_MDELEM_STORAGE_ALLOCATED) + : GRPC_MAKE_MDELEM( + grpc_core::New(key, value), + GRPC_MDELEM_STORAGE_ALLOCATED); } } + return md_create_maybe_static( + key, value); +} + +template +static grpc_mdelem md_create_maybe_static(const grpc_slice& key, + const grpc_slice& value) { + // Ensure slices are, in fact, static if we claimed they were. + GPR_DEBUG_ASSERT(!key_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(key)); + GPR_DEBUG_ASSERT(!value_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(value)); + GPR_DEBUG_ASSERT(key.refcount != nullptr); + GPR_DEBUG_ASSERT(value.refcount != nullptr); + + const bool key_is_static_mdstr = + key_definitely_static || + key.refcount->GetType() == grpc_slice_refcount::Type::STATIC; + const bool value_is_static_mdstr = + value_definitely_static || + value.refcount->GetType() == grpc_slice_refcount::Type::STATIC; + + const intptr_t kidx = GRPC_STATIC_METADATA_INDEX(key); // Not all static slice input yields a statically stored metadata element. - // It may be worth documenting why. - if (GRPC_IS_STATIC_METADATA_STRING(key) && - GRPC_IS_STATIC_METADATA_STRING(value)) { + if (key_is_static_mdstr && value_is_static_mdstr) { grpc_mdelem static_elem = grpc_static_mdelem_for_static_strings( - GRPC_STATIC_METADATA_INDEX(key), GRPC_STATIC_METADATA_INDEX(value)); + kidx, GRPC_STATIC_METADATA_INDEX(value)); if (!GRPC_MDISNULL(static_elem)) { return static_elem; } } - uint32_t hash = GRPC_MDSTR_KV_HASH(grpc_slice_hash_refcounted(key), - grpc_slice_hash_refcounted(value)); + uint32_t khash = key_definitely_static + ? grpc_static_metadata_hash_values[kidx] + : grpc_slice_hash_refcounted(key); + + uint32_t hash = GRPC_MDSTR_KV_HASH(khash, grpc_slice_hash_refcounted(value)); + return md_create_must_intern(key, value, hash); +} + +template +static grpc_mdelem md_create_must_intern(const grpc_slice& key, + const grpc_slice& value, + uint32_t hash) { + // Here, we know both key and value are both at least interned, and both + // possibly static. We know that anything inside the shared interned table is + // also at least interned (and maybe static). Note that equality for a static + // and interned slice implies that they are both the same exact slice. + // The same applies to a pair of interned slices, or a pair of static slices. + // Rather than run the full equality check, we can therefore just do a pointer + // comparison of the refcounts. InternedMetadata* md; mdtab_shard* shard = &g_shards[SHARD_IDX(hash)]; size_t idx; @@ -343,7 +446,8 @@ grpc_mdelem grpc_mdelem_create( idx = TABLE_IDX(hash, shard->capacity); /* search for an existing pair */ for (md = shard->elems[idx].next; md; md = md->bucket_next()) { - if (grpc_slice_eq(key, md->key()) && grpc_slice_eq(value, md->value())) { + if (grpc_slice_static_interned_equal(key, md->key()) && + grpc_slice_static_interned_equal(value, md->value())) { md->RefWithShardLocked(shard); gpr_mu_unlock(&shard->mu); return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED); @@ -351,8 +455,12 @@ grpc_mdelem grpc_mdelem_create( } /* not found: create a new pair */ - md = grpc_core::New(key, value, hash, - shard->elems[idx].next); + md = key_definitely_static + ? grpc_core::New( + key, value, hash, shard->elems[idx].next, + static_cast(nullptr)) + : grpc_core::New(key, value, hash, + shard->elems[idx].next); shard->elems[idx].next = md; shard->count++; @@ -365,9 +473,68 @@ grpc_mdelem grpc_mdelem_create( return GRPC_MAKE_MDELEM(md, GRPC_MDELEM_STORAGE_INTERNED); } +grpc_mdelem grpc_mdelem_create( + const grpc_slice& key, const grpc_slice& value, + grpc_mdelem_data* compatible_external_backing_store) { + return md_create(key, value, compatible_external_backing_store); +} + +grpc_mdelem grpc_mdelem_create( + const grpc_core::StaticMetadataSlice& key, const grpc_slice& value, + grpc_mdelem_data* compatible_external_backing_store) { + return md_create(key, value, compatible_external_backing_store); +} + +/* Create grpc_mdelem from provided slices. We specify via template parameter + whether we know that the input key is static or not. If it is, we short + circuit various comparisons and a no-op unref. */ +template +static grpc_mdelem md_from_slices(const grpc_slice& key, + const grpc_slice& value) { + // Ensure key is, in fact, static if we claimed it was. + GPR_DEBUG_ASSERT(!key_definitely_static || + GRPC_IS_STATIC_METADATA_STRING(key)); + grpc_mdelem out = md_create(key, value, nullptr); + if (!key_definitely_static) { + grpc_slice_unref_internal(key); + } + grpc_slice_unref_internal(value); + return out; +} + grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key, const grpc_slice& value) { - grpc_mdelem out = grpc_mdelem_create(key, value, nullptr); + return md_from_slices(key, value); +} + +grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key, + const grpc_slice& value) { + return md_from_slices(key, value); +} + +grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::StaticMetadataSlice& key, + const grpc_core::StaticMetadataSlice& value) { + grpc_mdelem out = md_create_maybe_static(key, value); + return out; +} + +grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::StaticMetadataSlice& key, + const grpc_core::ManagedMemorySlice& value) { + // TODO(arjunroy): We can save the unref if md_create_maybe_static ended up + // creating a new interned metadata. But otherwise - we need this here. + grpc_mdelem out = md_create_maybe_static(key, value); + grpc_slice_unref_internal(value); + return out; +} + +grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::ManagedMemorySlice& key, + const grpc_core::ManagedMemorySlice& value) { + grpc_mdelem out = md_create_maybe_static(key, value); + // TODO(arjunroy): We can save the unref if md_create_maybe_static ended up + // creating a new interned metadata. But otherwise - we need this here. grpc_slice_unref_internal(key); grpc_slice_unref_internal(value); return out; diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 4621433bf01..3d3a68119f2 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -118,10 +118,31 @@ struct grpc_mdelem { ((grpc_mdelem_data_storage)((md).payload & \ (uintptr_t)GRPC_MDELEM_STORAGE_INTERNED_BIT)) -/* Unrefs the slices. */ +/* Given arbitrary input slices, create a grpc_mdelem object. The caller refs + * the input slices; we unref them. This method is always safe to call; however, + * if we know data about the slices in question (e.g. if we knew our key was + * static) we can call specializations that save on cycle count. */ grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key, const grpc_slice& value); +/* Like grpc_mdelem_from_slices, but we know that key is a static slice. This + saves us a few branches and a no-op call to md_unref() for the key. */ +grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key, + const grpc_slice& value); + +/* Like grpc_mdelem_from_slices, but key is static and val is static. */ +grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::StaticMetadataSlice& key, + const grpc_core::StaticMetadataSlice& value); + +/* Like grpc_mdelem_from_slices, but key is static and val is interned. */ +grpc_mdelem grpc_mdelem_from_slices(const grpc_core::StaticMetadataSlice& key, + const grpc_core::ManagedMemorySlice& value); + +/* Like grpc_mdelem_from_slices, but key and val are interned. */ +grpc_mdelem grpc_mdelem_from_slices(const grpc_core::ManagedMemorySlice& key, + const grpc_core::ManagedMemorySlice& value); + /* Cheaply convert a grpc_metadata to a grpc_mdelem; may use the grpc_metadata object as backing storage (so lifetimes should align) */ grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata); @@ -134,6 +155,11 @@ grpc_mdelem grpc_mdelem_create( const grpc_slice& key, const grpc_slice& value, grpc_mdelem_data* compatible_external_backing_store); +/* Like grpc_mdelem_create, but we know that key is static. */ +grpc_mdelem grpc_mdelem_create( + const grpc_core::StaticMetadataSlice& key, const grpc_slice& value, + grpc_mdelem_data* compatible_external_backing_store); + #define GRPC_MDKEY(md) (GRPC_MDELEM_DATA(md)->key) #define GRPC_MDVALUE(md) (GRPC_MDELEM_DATA(md)->value) @@ -239,6 +265,10 @@ class RefcountedMdBase { } protected: +#ifndef NDEBUG + void TraceAtStart(const char* tag); +#endif + intptr_t RefValue() { return refcnt_.Load(MemoryOrder::RELAXED); } bool AllRefsDropped() { return refcnt_.Load(MemoryOrder::ACQUIRE) == 0; } bool FirstRef() { return refcnt_.FetchAdd(1, MemoryOrder::RELAXED) == 0; } @@ -253,16 +283,19 @@ class RefcountedMdBase { class InternedMetadata : public RefcountedMdBase { public: + // TODO(arjunroy): Change to use strongly typed slices instead. + struct NoRefKey {}; struct BucketLink { explicit BucketLink(InternedMetadata* md) : next(md) {} InternedMetadata* next = nullptr; }; - InternedMetadata(const grpc_slice& key, const grpc_slice& value, uint32_t hash, InternedMetadata* next); - ~InternedMetadata(); + InternedMetadata(const grpc_slice& key, const grpc_slice& value, + uint32_t hash, InternedMetadata* next, const NoRefKey*); + ~InternedMetadata(); void RefWithShardLocked(mdtab_shard* shard); UserData* user_data() { return &user_data_; } InternedMetadata* bucket_next() { return link_.next; } @@ -278,7 +311,15 @@ class InternedMetadata : public RefcountedMdBase { /* Shadow structure for grpc_mdelem_data for allocated elements */ class AllocatedMetadata : public RefcountedMdBase { public: + // TODO(arjunroy): Change to use strongly typed slices instead. + struct NoRefKey {}; AllocatedMetadata(const grpc_slice& key, const grpc_slice& value); + AllocatedMetadata(const grpc_core::ManagedMemorySlice& key, + const grpc_core::UnmanagedMemorySlice& value); + AllocatedMetadata(const grpc_core::ExternallyManagedSlice& key, + const grpc_core::UnmanagedMemorySlice& value); + AllocatedMetadata(const grpc_slice& key, const grpc_slice& value, + const NoRefKey*); ~AllocatedMetadata(); UserData* user_data() { return &user_data_; } @@ -374,4 +415,35 @@ inline void grpc_mdelem_unref(grpc_mdelem gmd) { void grpc_mdctx_global_init(void); void grpc_mdctx_global_shutdown(); +/* Like grpc_mdelem_from_slices, but we know that key is a static or interned + slice and value is not static or interned. This gives us an inlinable + fastpath - we know we must allocate metadata now, and that we do not need to + unref the value (rather, we just transfer the ref). We can avoid a ref since: + 1) the key slice is passed in already ref'd + 2) We're guaranteed to create a new Allocated slice, thus meaning the + ref can be considered 'transferred'.*/ +inline grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::ManagedMemorySlice& key, + const grpc_core::UnmanagedMemorySlice& value) { + using grpc_core::AllocatedMetadata; + return GRPC_MAKE_MDELEM(grpc_core::New(key, value), + GRPC_MDELEM_STORAGE_ALLOCATED); +} + +inline grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::ExternallyManagedSlice& key, + const grpc_core::UnmanagedMemorySlice& value) { + using grpc_core::AllocatedMetadata; + return GRPC_MAKE_MDELEM(grpc_core::New(key, value), + GRPC_MDELEM_STORAGE_ALLOCATED); +} + +inline grpc_mdelem grpc_mdelem_from_slices( + const grpc_core::StaticMetadataSlice& key, + const grpc_core::UnmanagedMemorySlice& value) { + using grpc_core::AllocatedMetadata; + return GRPC_MAKE_MDELEM(grpc_core::New(key, value), + GRPC_MDELEM_STORAGE_ALLOCATED); +} + #endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */ diff --git a/src/core/lib/transport/static_metadata.cc b/src/core/lib/transport/static_metadata.cc index 8b0a6f482d7..ec5db5515a7 100644 --- a/src/core/lib/transport/static_metadata.cc +++ b/src/core/lib/transport/static_metadata.cc @@ -49,72 +49,72 @@ static uint8_t g_bytes[] = { 101, 113, 117, 101, 115, 116, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, 110, 97, 108, 45, 115, 116, 114, 101, 97, 109, 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114, 101, 113, 117, 101, 115, 116, 117, 115, - 101, 114, 45, 97, 103, 101, 110, 116, 104, 111, 115, 116, 108, 98, 45, - 116, 111, 107, 101, 110, 103, 114, 112, 99, 45, 112, 114, 101, 118, 105, - 111, 117, 115, 45, 114, 112, 99, 45, 97, 116, 116, 101, 109, 112, 116, - 115, 103, 114, 112, 99, 45, 114, 101, 116, 114, 121, 45, 112, 117, 115, - 104, 98, 97, 99, 107, 45, 109, 115, 103, 114, 112, 99, 45, 116, 105, - 109, 101, 111, 117, 116, 49, 50, 51, 52, 103, 114, 112, 99, 46, 119, - 97, 105, 116, 95, 102, 111, 114, 95, 114, 101, 97, 100, 121, 103, 114, - 112, 99, 46, 116, 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 46, - 109, 97, 120, 95, 114, 101, 113, 117, 101, 115, 116, 95, 109, 101, 115, - 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 103, 114, 112, 99, 46, - 109, 97, 120, 95, 114, 101, 115, 112, 111, 110, 115, 101, 95, 109, 101, - 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 47, 103, 114, 112, - 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, - 97, 110, 99, 101, 114, 47, 66, 97, 108, 97, 110, 99, 101, 76, 111, - 97, 100, 47, 103, 114, 112, 99, 46, 104, 101, 97, 108, 116, 104, 46, - 118, 49, 46, 72, 101, 97, 108, 116, 104, 47, 87, 97, 116, 99, 104, - 47, 101, 110, 118, 111, 121, 46, 115, 101, 114, 118, 105, 99, 101, 46, - 100, 105, 115, 99, 111, 118, 101, 114, 121, 46, 118, 50, 46, 65, 103, - 103, 114, 101, 103, 97, 116, 101, 100, 68, 105, 115, 99, 111, 118, 101, - 114, 121, 83, 101, 114, 118, 105, 99, 101, 47, 83, 116, 114, 101, 97, - 109, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, 82, 101, 115, 111, - 117, 114, 99, 101, 115, 100, 101, 102, 108, 97, 116, 101, 103, 122, 105, - 112, 115, 116, 114, 101, 97, 109, 47, 103, 122, 105, 112, 71, 69, 84, - 80, 79, 83, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104, 116, 109, - 108, 104, 116, 116, 112, 104, 116, 116, 112, 115, 50, 48, 48, 50, 48, - 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 52, 48, 52, 53, 48, - 48, 97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, - 103, 122, 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 97, 99, - 99, 101, 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97, 99, - 99, 101, 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99, 101, - 112, 116, 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, - 108, 45, 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, - 103, 101, 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114, 105, 122, - 97, 116, 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111, 110, 116, - 114, 111, 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105, 115, 112, - 111, 115, 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, - 108, 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, 116, - 45, 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, 45, - 108, 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, - 45, 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, 116, - 101, 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, 105, - 114, 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, 104, - 105, 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, - 99, 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, - 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, - 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, - 116, 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108, - 111, 99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, - 97, 114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, - 110, 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, - 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, - 101, 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, - 114, 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, - 101, 114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, - 105, 99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, - 101, 99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, - 45, 101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, - 97, 119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, - 116, 101, 48, 105, 100, 101, 110, 116, 105, 116, 121, 116, 114, 97, 105, - 108, 101, 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, - 47, 103, 114, 112, 99, 103, 114, 112, 99, 80, 85, 84, 108, 98, 45, - 99, 111, 115, 116, 45, 98, 105, 110, 105, 100, 101, 110, 116, 105, 116, - 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, 101, 110, 116, 105, - 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108, 97, 116, 101, 44, - 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, - 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; + 101, 114, 45, 97, 103, 101, 110, 116, 104, 111, 115, 116, 103, 114, 112, + 99, 45, 112, 114, 101, 118, 105, 111, 117, 115, 45, 114, 112, 99, 45, + 97, 116, 116, 101, 109, 112, 116, 115, 103, 114, 112, 99, 45, 114, 101, + 116, 114, 121, 45, 112, 117, 115, 104, 98, 97, 99, 107, 45, 109, 115, + 103, 114, 112, 99, 45, 116, 105, 109, 101, 111, 117, 116, 49, 50, 51, + 52, 103, 114, 112, 99, 46, 119, 97, 105, 116, 95, 102, 111, 114, 95, + 114, 101, 97, 100, 121, 103, 114, 112, 99, 46, 116, 105, 109, 101, 111, + 117, 116, 103, 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 113, 117, + 101, 115, 116, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, 116, + 101, 115, 103, 114, 112, 99, 46, 109, 97, 120, 95, 114, 101, 115, 112, + 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, 103, 101, 95, 98, 121, + 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, 98, 46, 118, 49, 46, + 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, 101, 114, 47, 66, 97, + 108, 97, 110, 99, 101, 76, 111, 97, 100, 47, 103, 114, 112, 99, 46, + 104, 101, 97, 108, 116, 104, 46, 118, 49, 46, 72, 101, 97, 108, 116, + 104, 47, 87, 97, 116, 99, 104, 47, 101, 110, 118, 111, 121, 46, 115, + 101, 114, 118, 105, 99, 101, 46, 100, 105, 115, 99, 111, 118, 101, 114, + 121, 46, 118, 50, 46, 65, 103, 103, 114, 101, 103, 97, 116, 101, 100, + 68, 105, 115, 99, 111, 118, 101, 114, 121, 83, 101, 114, 118, 105, 99, + 101, 47, 83, 116, 114, 101, 97, 109, 65, 103, 103, 114, 101, 103, 97, + 116, 101, 100, 82, 101, 115, 111, 117, 114, 99, 101, 115, 100, 101, 102, + 108, 97, 116, 101, 103, 122, 105, 112, 115, 116, 114, 101, 97, 109, 47, + 103, 122, 105, 112, 71, 69, 84, 80, 79, 83, 84, 47, 47, 105, 110, + 100, 101, 120, 46, 104, 116, 109, 108, 104, 116, 116, 112, 104, 116, 116, + 112, 115, 50, 48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52, 52, + 48, 48, 52, 48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116, 45, + 99, 104, 97, 114, 115, 101, 116, 103, 122, 105, 112, 44, 32, 100, 101, + 102, 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, 108, 97, 110, + 103, 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, 114, 97, 110, + 103, 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, 101, 115, 115, + 45, 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, 111, 119, 45, + 111, 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, 111, 119, 97, + 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 99, 97, 99, + 104, 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, 110, 116, 101, + 110, 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 99, + 111, 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, + 99, 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, 103, 116, 104, 99, + 111, 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, 116, 105, 111, 110, + 99, 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, 103, 101, 99, 111, + 111, 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, 103, 101, 120, 112, + 101, 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, 114, 111, 109, 105, + 102, 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, 111, 100, 105, 102, + 105, 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, 45, 110, 111, 110, + 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, + 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, + 105, 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, 100, 105, 102, 105, + 101, 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105, 111, 110, 109, + 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112, 114, 111, 120, + 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 112, + 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, + 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101, 114, 101, 114, + 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121, 45, 97, 102, + 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116, 45, 99, 111, + 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116, 114, 97, 110, + 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105, 116, 121, 116, + 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111, 100, 105, 110, + 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, 97, 117, 116, + 104, 101, 110, 116, 105, 99, 97, 116, 101, 48, 105, 100, 101, 110, 116, + 105, 116, 121, 116, 114, 97, 105, 108, 101, 114, 115, 97, 112, 112, 108, + 105, 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, 103, 114, 112, + 99, 80, 85, 84, 108, 98, 45, 99, 111, 115, 116, 45, 98, 105, 110, + 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, + 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, + 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, + 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, + 105, 112}; static grpc_slice_refcount static_sub_refcnt; grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { @@ -224,117 +224,222 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), - grpc_slice_refcount(&static_sub_refcnt, grpc_slice_refcount::Type::STATIC), }; -const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { - {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}}, - {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[3], {{10, g_bytes + 19}}}, - {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[5], {{2, g_bytes + 36}}}, - {&grpc_static_metadata_refcounts[6], {{12, g_bytes + 38}}}, - {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[8], {{16, g_bytes + 61}}}, - {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[11], {{21, g_bytes + 110}}}, - {&grpc_static_metadata_refcounts[12], {{13, g_bytes + 131}}}, - {&grpc_static_metadata_refcounts[13], {{14, g_bytes + 144}}}, - {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}}, - {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[17], {{30, g_bytes + 201}}}, - {&grpc_static_metadata_refcounts[18], {{37, g_bytes + 231}}}, - {&grpc_static_metadata_refcounts[19], {{10, g_bytes + 268}}}, - {&grpc_static_metadata_refcounts[20], {{4, g_bytes + 278}}}, - {&grpc_static_metadata_refcounts[21], {{8, g_bytes + 282}}}, - {&grpc_static_metadata_refcounts[22], {{26, g_bytes + 290}}}, - {&grpc_static_metadata_refcounts[23], {{22, g_bytes + 316}}}, - {&grpc_static_metadata_refcounts[24], {{12, g_bytes + 338}}}, - {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 350}}}, - {&grpc_static_metadata_refcounts[26], {{1, g_bytes + 351}}}, - {&grpc_static_metadata_refcounts[27], {{1, g_bytes + 352}}}, - {&grpc_static_metadata_refcounts[28], {{1, g_bytes + 353}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, - {&grpc_static_metadata_refcounts[30], {{19, g_bytes + 354}}}, - {&grpc_static_metadata_refcounts[31], {{12, g_bytes + 373}}}, - {&grpc_static_metadata_refcounts[32], {{30, g_bytes + 385}}}, - {&grpc_static_metadata_refcounts[33], {{31, g_bytes + 415}}}, - {&grpc_static_metadata_refcounts[34], {{36, g_bytes + 446}}}, - {&grpc_static_metadata_refcounts[35], {{28, g_bytes + 482}}}, - {&grpc_static_metadata_refcounts[36], {{80, g_bytes + 510}}}, - {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, - {&grpc_static_metadata_refcounts[39], {{11, g_bytes + 601}}}, - {&grpc_static_metadata_refcounts[40], {{3, g_bytes + 612}}}, - {&grpc_static_metadata_refcounts[41], {{4, g_bytes + 615}}}, - {&grpc_static_metadata_refcounts[42], {{1, g_bytes + 619}}}, - {&grpc_static_metadata_refcounts[43], {{11, g_bytes + 620}}}, - {&grpc_static_metadata_refcounts[44], {{4, g_bytes + 631}}}, - {&grpc_static_metadata_refcounts[45], {{5, g_bytes + 635}}}, - {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 640}}}, - {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 643}}}, - {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 646}}}, - {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 649}}}, - {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 652}}}, - {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 655}}}, - {&grpc_static_metadata_refcounts[52], {{3, g_bytes + 658}}}, - {&grpc_static_metadata_refcounts[53], {{14, g_bytes + 661}}}, - {&grpc_static_metadata_refcounts[54], {{13, g_bytes + 675}}}, - {&grpc_static_metadata_refcounts[55], {{15, g_bytes + 688}}}, - {&grpc_static_metadata_refcounts[56], {{13, g_bytes + 703}}}, - {&grpc_static_metadata_refcounts[57], {{6, g_bytes + 716}}}, - {&grpc_static_metadata_refcounts[58], {{27, g_bytes + 722}}}, - {&grpc_static_metadata_refcounts[59], {{3, g_bytes + 749}}}, - {&grpc_static_metadata_refcounts[60], {{5, g_bytes + 752}}}, - {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 757}}}, - {&grpc_static_metadata_refcounts[62], {{13, g_bytes + 770}}}, - {&grpc_static_metadata_refcounts[63], {{19, g_bytes + 783}}}, - {&grpc_static_metadata_refcounts[64], {{16, g_bytes + 802}}}, - {&grpc_static_metadata_refcounts[65], {{14, g_bytes + 818}}}, - {&grpc_static_metadata_refcounts[66], {{16, g_bytes + 832}}}, - {&grpc_static_metadata_refcounts[67], {{13, g_bytes + 848}}}, - {&grpc_static_metadata_refcounts[68], {{6, g_bytes + 861}}}, - {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 867}}}, - {&grpc_static_metadata_refcounts[70], {{4, g_bytes + 871}}}, - {&grpc_static_metadata_refcounts[71], {{6, g_bytes + 875}}}, - {&grpc_static_metadata_refcounts[72], {{7, g_bytes + 881}}}, - {&grpc_static_metadata_refcounts[73], {{4, g_bytes + 888}}}, - {&grpc_static_metadata_refcounts[74], {{8, g_bytes + 892}}}, - {&grpc_static_metadata_refcounts[75], {{17, g_bytes + 900}}}, - {&grpc_static_metadata_refcounts[76], {{13, g_bytes + 917}}}, - {&grpc_static_metadata_refcounts[77], {{8, g_bytes + 930}}}, - {&grpc_static_metadata_refcounts[78], {{19, g_bytes + 938}}}, - {&grpc_static_metadata_refcounts[79], {{13, g_bytes + 957}}}, - {&grpc_static_metadata_refcounts[80], {{4, g_bytes + 970}}}, - {&grpc_static_metadata_refcounts[81], {{8, g_bytes + 974}}}, - {&grpc_static_metadata_refcounts[82], {{12, g_bytes + 982}}}, - {&grpc_static_metadata_refcounts[83], {{18, g_bytes + 994}}}, - {&grpc_static_metadata_refcounts[84], {{19, g_bytes + 1012}}}, - {&grpc_static_metadata_refcounts[85], {{5, g_bytes + 1031}}}, - {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1036}}}, - {&grpc_static_metadata_refcounts[87], {{7, g_bytes + 1043}}}, - {&grpc_static_metadata_refcounts[88], {{11, g_bytes + 1050}}}, - {&grpc_static_metadata_refcounts[89], {{6, g_bytes + 1061}}}, - {&grpc_static_metadata_refcounts[90], {{10, g_bytes + 1067}}}, - {&grpc_static_metadata_refcounts[91], {{25, g_bytes + 1077}}}, - {&grpc_static_metadata_refcounts[92], {{17, g_bytes + 1102}}}, - {&grpc_static_metadata_refcounts[93], {{4, g_bytes + 1119}}}, - {&grpc_static_metadata_refcounts[94], {{3, g_bytes + 1123}}}, - {&grpc_static_metadata_refcounts[95], {{16, g_bytes + 1126}}}, - {&grpc_static_metadata_refcounts[96], {{1, g_bytes + 1142}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, - {&grpc_static_metadata_refcounts[98], {{8, g_bytes + 1151}}}, - {&grpc_static_metadata_refcounts[99], {{16, g_bytes + 1159}}}, - {&grpc_static_metadata_refcounts[100], {{4, g_bytes + 1175}}}, - {&grpc_static_metadata_refcounts[101], {{3, g_bytes + 1179}}}, - {&grpc_static_metadata_refcounts[102], {{11, g_bytes + 1182}}}, - {&grpc_static_metadata_refcounts[103], {{16, g_bytes + 1193}}}, - {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}}, - {&grpc_static_metadata_refcounts[105], {{12, g_bytes + 1222}}}, - {&grpc_static_metadata_refcounts[106], {{21, g_bytes + 1234}}}, +const grpc_core::StaticMetadataSlice + grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, + g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, + g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3], 10, + g_bytes + 19), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, + g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5], 2, + g_bytes + 36), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[6], 12, + g_bytes + 38), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, + g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[8], 16, + g_bytes + 61), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, + g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[11], 21, + g_bytes + 110), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[12], 13, + g_bytes + 131), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[13], 14, + g_bytes + 144), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, + g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[17], 30, + g_bytes + 201), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[18], 37, + g_bytes + 231), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19], 10, + g_bytes + 268), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20], 4, + g_bytes + 278), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[21], 26, + g_bytes + 282), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[22], 22, + g_bytes + 308), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[23], 12, + g_bytes + 330), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24], 1, + g_bytes + 342), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25], 1, + g_bytes + 343), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[26], 1, + g_bytes + 344), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[27], 1, + g_bytes + 345), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[29], 19, + g_bytes + 346), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[30], 12, + g_bytes + 365), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[31], 30, + g_bytes + 377), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[32], 31, + g_bytes + 407), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[33], 36, + g_bytes + 438), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[34], 28, + g_bytes + 474), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[35], 80, + g_bytes + 502), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, + g_bytes + 582), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[38], 11, + g_bytes + 593), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39], 3, + g_bytes + 604), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40], 4, + g_bytes + 607), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41], 1, + g_bytes + 611), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42], 11, + g_bytes + 612), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43], 4, + g_bytes + 623), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44], 5, + g_bytes + 627), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45], 3, + g_bytes + 632), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46], 3, + g_bytes + 635), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47], 3, + g_bytes + 638), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48], 3, + g_bytes + 641), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49], 3, + g_bytes + 644), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50], 3, + g_bytes + 647), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51], 3, + g_bytes + 650), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52], 14, + g_bytes + 653), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53], 13, + g_bytes + 667), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54], 15, + g_bytes + 680), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55], 13, + g_bytes + 695), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56], 6, + g_bytes + 708), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57], 27, + g_bytes + 714), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58], 3, + g_bytes + 741), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59], 5, + g_bytes + 744), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60], 13, + g_bytes + 749), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61], 13, + g_bytes + 762), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62], 19, + g_bytes + 775), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63], 16, + g_bytes + 794), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64], 14, + g_bytes + 810), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65], 16, + g_bytes + 824), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66], 13, + g_bytes + 840), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67], 6, + g_bytes + 853), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68], 4, + g_bytes + 859), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69], 4, + g_bytes + 863), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70], 6, + g_bytes + 867), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71], 7, + g_bytes + 873), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72], 4, + g_bytes + 880), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73], 8, + g_bytes + 884), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74], 17, + g_bytes + 892), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75], 13, + g_bytes + 909), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76], 8, + g_bytes + 922), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77], 19, + g_bytes + 930), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78], 13, + g_bytes + 949), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79], 4, + g_bytes + 962), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80], 8, + g_bytes + 966), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81], 12, + g_bytes + 974), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82], 18, + g_bytes + 986), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83], 19, + g_bytes + 1004), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84], 5, + g_bytes + 1023), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85], 7, + g_bytes + 1028), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86], 7, + g_bytes + 1035), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87], 11, + g_bytes + 1042), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88], 6, + g_bytes + 1053), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89], 10, + g_bytes + 1059), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90], 25, + g_bytes + 1069), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91], 17, + g_bytes + 1094), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92], 4, + g_bytes + 1111), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93], 3, + g_bytes + 1115), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94], 16, + g_bytes + 1118), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95], 1, + g_bytes + 1134), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97], 8, + g_bytes + 1143), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98], 16, + g_bytes + 1151), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99], 4, + g_bytes + 1167), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[100], 3, + g_bytes + 1171), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[101], 11, + g_bytes + 1174), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[102], 16, + g_bytes + 1185), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, + g_bytes + 1201), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[104], 12, + g_bytes + 1214), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[105], 21, + g_bytes + 1226), }; /* Warning: the core static metadata currently operates under the soft @@ -716,65 +821,60 @@ grpc_mdelem grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = { GRPC_MAKE_MDELEM( &grpc_static_mdelem_table[73].data(), GRPC_MDELEM_STORAGE_STATIC), - /* GRPC_MDELEM_LB_TOKEN_EMPTY: - "lb-token": "" */ - GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[74].data(), - GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_LB_COST_BIN_EMPTY: "lb-cost-bin": "" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[75].data(), + &grpc_static_mdelem_table[74].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY: "grpc-accept-encoding": "identity" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[76].data(), + &grpc_static_mdelem_table[75].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE: "grpc-accept-encoding": "deflate" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[77].data(), + &grpc_static_mdelem_table[76].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE: "grpc-accept-encoding": "identity,deflate" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[78].data(), + &grpc_static_mdelem_table[77].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP: "grpc-accept-encoding": "gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[79].data(), + &grpc_static_mdelem_table[78].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP: "grpc-accept-encoding": "identity,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[80].data(), + &grpc_static_mdelem_table[79].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP: "grpc-accept-encoding": "deflate,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[81].data(), + &grpc_static_mdelem_table[80].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP: "grpc-accept-encoding": "identity,deflate,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[82].data(), + &grpc_static_mdelem_table[81].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY: "accept-encoding": "identity" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[83].data(), + &grpc_static_mdelem_table[82].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_GZIP: "accept-encoding": "gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[84].data(), + &grpc_static_mdelem_table[83].data(), GRPC_MDELEM_STORAGE_STATIC), /* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP: "accept-encoding": "identity,gzip" */ GRPC_MAKE_MDELEM( - &grpc_static_mdelem_table[85].data(), + &grpc_static_mdelem_table[84].data(), GRPC_MDELEM_STORAGE_STATIC) // clang-format on }; @@ -782,20 +882,20 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8, 2, 4, 4}; static const int8_t elems_r[] = { - 15, 10, -8, 0, 2, -42, -81, -43, 0, 6, -8, 0, 0, 0, 2, - -3, -10, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -64, 0, -67, -68, -69, -70, 0, - 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, - 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 5, 4, 4, 8, 8, 0, 0, 0, 0, 0, 0, -5, 0}; + 15, 10, -8, 0, 2, -42, -80, -43, 0, 6, -8, 0, 0, 0, 2, + -3, -10, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -63, 0, -47, -68, -69, -70, -52, 0, + 31, 30, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, + 18, 17, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, + 4, 3, 4, 3, 3, 7, 0, 0, 0, 0, 0, 0, -5, 0}; static uint32_t elems_phash(uint32_t i) { - i -= 42; - uint32_t x = i % 105; - uint32_t y = i / 105; + i -= 41; + uint32_t x = i % 104; + uint32_t y = i / 104; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -805,29 +905,28 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 260, 261, 262, 263, 264, 265, 266, 1107, 1108, 1741, 147, 148, - 472, 473, 1634, 42, 43, 1527, 1750, 1000, 1001, 774, 775, 1643, - 633, 845, 2062, 2169, 2276, 5700, 5914, 6021, 6128, 6235, 1766, 6342, - 6449, 6556, 6663, 6770, 6877, 6984, 7091, 7198, 7305, 7412, 7519, 7626, - 7733, 7840, 7947, 8054, 8161, 8268, 8375, 8482, 8589, 8696, 8803, 8910, - 9017, 9124, 9231, 9338, 9445, 9552, 9659, 1167, 528, 9766, 9873, 208, - 9980, 1173, 1174, 1175, 1176, 1809, 10087, 1060, 10194, 10943, 1702, 0, - 1816, 0, 0, 1597, 0, 0, 350, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0}; + 257, 258, 259, 260, 261, 262, 263, 1096, 1097, 1724, 145, 146, + 467, 468, 1618, 41, 42, 1512, 1733, 990, 991, 766, 767, 1627, + 627, 837, 2042, 2148, 5540, 5858, 5964, 6070, 6282, 6388, 1749, 6494, + 6600, 6706, 6812, 6918, 7024, 7130, 7236, 7342, 7448, 7554, 7660, 7766, + 5752, 7872, 7978, 6176, 8084, 8190, 8296, 8402, 8508, 8614, 8720, 8826, + 8932, 9038, 9144, 9250, 9356, 9462, 9568, 1156, 523, 9674, 9780, 206, + 9886, 1162, 1163, 1164, 1165, 1792, 9992, 1050, 10734, 0, 1686, 0, + 1799, 0, 0, 1582, 0, 346, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0}; static const uint8_t elem_idxs[] = { - 7, 8, 9, 10, 11, 12, 13, 77, 79, 71, 1, 2, 5, 6, 25, 3, - 4, 30, 84, 66, 65, 62, 63, 73, 67, 61, 57, 37, 74, 14, 16, 17, - 18, 19, 15, 20, 21, 22, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34, - 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 76, 69, 55, 56, 70, 58, 78, 80, 81, 82, 83, 59, 64, - 60, 75, 72, 255, 85, 255, 255, 68, 255, 255, 0}; + 7, 8, 9, 10, 11, 12, 13, 76, 78, 71, 1, 2, 5, 6, 25, 3, 4, 30, + 83, 66, 65, 62, 63, 73, 67, 61, 57, 37, 14, 17, 18, 19, 21, 22, 15, 23, + 24, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 38, 16, 39, 40, 20, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 75, 69, 56, 58, 70, + 59, 77, 79, 80, 81, 82, 60, 64, 74, 255, 72, 255, 84, 255, 255, 68, 255, 0}; grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = static_cast(a * 107 + b); + uint32_t k = static_cast(a * 106 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k && elem_idxs[h] != 255 @@ -838,265 +937,517 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b) { grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[3], {{10, g_bytes + 19}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 0), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[40], {{3, g_bytes + 612}}}, 1), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[41], {{4, g_bytes + 615}}}, 2), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}}, - {&grpc_static_metadata_refcounts[42], {{1, g_bytes + 619}}}, 3), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[0], {{5, g_bytes + 0}}}, - {&grpc_static_metadata_refcounts[43], {{11, g_bytes + 620}}}, 4), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[44], {{4, g_bytes + 631}}}, 5), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[45], {{5, g_bytes + 635}}}, 6), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[46], {{3, g_bytes + 640}}}, 7), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[47], {{3, g_bytes + 643}}}, 8), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[48], {{3, g_bytes + 646}}}, 9), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[49], {{3, g_bytes + 649}}}, 10), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[50], {{3, g_bytes + 652}}}, 11), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[51], {{3, g_bytes + 655}}}, 12), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[2], {{7, g_bytes + 12}}}, - {&grpc_static_metadata_refcounts[52], {{3, g_bytes + 658}}}, 13), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[53], {{14, g_bytes + 661}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 14), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[54], {{13, g_bytes + 675}}}, 15), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[55], {{15, g_bytes + 688}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 16), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[56], {{13, g_bytes + 703}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 17), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[57], {{6, g_bytes + 716}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 18), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[58], {{27, g_bytes + 722}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 19), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[59], {{3, g_bytes + 749}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 20), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[60], {{5, g_bytes + 752}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 21), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[61], {{13, g_bytes + 757}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 22), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[62], {{13, g_bytes + 770}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 23), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[63], {{19, g_bytes + 783}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 24), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 25), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[64], {{16, g_bytes + 802}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 26), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[65], {{14, g_bytes + 818}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 27), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[66], {{16, g_bytes + 832}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 28), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[67], {{13, g_bytes + 848}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 29), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 30), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[68], {{6, g_bytes + 861}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 31), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[69], {{4, g_bytes + 867}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 32), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[70], {{4, g_bytes + 871}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 33), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[71], {{6, g_bytes + 875}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 34), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[72], {{7, g_bytes + 881}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 35), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[73], {{4, g_bytes + 888}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 36), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[20], {{4, g_bytes + 278}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 37), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[74], {{8, g_bytes + 892}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 38), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[75], {{17, g_bytes + 900}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 39), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[76], {{13, g_bytes + 917}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 40), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[77], {{8, g_bytes + 930}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 41), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[78], {{19, g_bytes + 938}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 42), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[79], {{13, g_bytes + 957}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 43), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[80], {{4, g_bytes + 970}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 44), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[81], {{8, g_bytes + 974}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 45), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[82], {{12, g_bytes + 982}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 46), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[83], {{18, g_bytes + 994}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 47), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[84], {{19, g_bytes + 1012}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 48), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[85], {{5, g_bytes + 1031}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 49), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[86], {{7, g_bytes + 1036}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 50), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[87], {{7, g_bytes + 1043}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 51), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[88], {{11, g_bytes + 1050}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 52), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[89], {{6, g_bytes + 1061}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 53), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[90], {{10, g_bytes + 1067}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 54), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[91], {{25, g_bytes + 1077}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 55), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[92], {{17, g_bytes + 1102}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 56), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[19], {{10, g_bytes + 268}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 57), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[93], {{4, g_bytes + 1119}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 58), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[94], {{3, g_bytes + 1123}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 59), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[95], {{16, g_bytes + 1126}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 60), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[96], {{1, g_bytes + 1142}}}, 61), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[25], {{1, g_bytes + 350}}}, 62), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[7], {{11, g_bytes + 50}}}, - {&grpc_static_metadata_refcounts[26], {{1, g_bytes + 351}}}, 63), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 64), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, 65), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[9], {{13, g_bytes + 77}}}, - {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}}, 66), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[5], {{2, g_bytes + 36}}}, - {&grpc_static_metadata_refcounts[98], {{8, g_bytes + 1151}}}, 67), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[14], {{12, g_bytes + 158}}}, - {&grpc_static_metadata_refcounts[99], {{16, g_bytes + 1159}}}, 68), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[4], {{7, g_bytes + 29}}}, - {&grpc_static_metadata_refcounts[100], {{4, g_bytes + 1175}}}, 69), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[1], {{7, g_bytes + 5}}}, - {&grpc_static_metadata_refcounts[101], {{3, g_bytes + 1179}}}, 70), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 71), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 72), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[15], {{16, g_bytes + 170}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, 73), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[21], {{8, g_bytes + 282}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 74), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[102], {{11, g_bytes + 1182}}}, - {&grpc_static_metadata_refcounts[29], {{0, g_bytes + 354}}}, 75), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 76), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[37], {{7, g_bytes + 590}}}, 77), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[103], {{16, g_bytes + 1193}}}, 78), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, 79), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}}, 80), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[105], {{12, g_bytes + 1222}}}, 81), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[10], {{20, g_bytes + 90}}}, - {&grpc_static_metadata_refcounts[106], {{21, g_bytes + 1234}}}, 82), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[97], {{8, g_bytes + 1143}}}, 83), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[38], {{4, g_bytes + 597}}}, 84), - grpc_core::StaticMetadata( - {&grpc_static_metadata_refcounts[16], {{15, g_bytes + 186}}}, - {&grpc_static_metadata_refcounts[104], {{13, g_bytes + 1209}}}, 85), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[3], 10, + g_bytes + 19), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 0), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, + g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[39], 3, + g_bytes + 604), + 1), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, + g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[40], 4, + g_bytes + 607), + 2), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, + g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[41], 1, + g_bytes + 611), + 3), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[0], 5, + g_bytes + 0), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[42], 11, + g_bytes + 612), + 4), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, + g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[43], 4, + g_bytes + 623), + 5), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, + g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[44], 5, + g_bytes + 627), + 6), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[45], 3, + g_bytes + 632), + 7), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[46], 3, + g_bytes + 635), + 8), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[47], 3, + g_bytes + 638), + 9), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[48], 3, + g_bytes + 641), + 10), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[49], 3, + g_bytes + 644), + 11), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[50], 3, + g_bytes + 647), + 12), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[2], 7, + g_bytes + 12), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[51], 3, + g_bytes + 650), + 13), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[52], 14, + g_bytes + 653), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 14), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[53], 13, + g_bytes + 667), + 15), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[54], 15, + g_bytes + 680), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 16), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[55], 13, + g_bytes + 695), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 17), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[56], 6, + g_bytes + 708), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 18), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[57], 27, + g_bytes + 714), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 19), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[58], 3, + g_bytes + 741), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 20), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[59], 5, + g_bytes + 744), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 21), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[60], 13, + g_bytes + 749), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 22), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[61], 13, + g_bytes + 762), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 23), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[62], 19, + g_bytes + 775), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 24), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 25), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[63], 16, + g_bytes + 794), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 26), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[64], 14, + g_bytes + 810), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 27), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[65], 16, + g_bytes + 824), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 28), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[66], 13, + g_bytes + 840), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 29), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, + g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 30), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[67], 6, + g_bytes + 853), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 31), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[68], 4, + g_bytes + 859), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 32), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[69], 4, + g_bytes + 863), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 33), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[70], 6, + g_bytes + 867), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 34), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[71], 7, + g_bytes + 873), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 35), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[72], 4, + g_bytes + 880), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 36), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[20], 4, + g_bytes + 278), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 37), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[73], 8, + g_bytes + 884), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 38), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[74], 17, + g_bytes + 892), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 39), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[75], 13, + g_bytes + 909), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 40), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[76], 8, + g_bytes + 922), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 41), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[77], 19, + g_bytes + 930), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 42), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[78], 13, + g_bytes + 949), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 43), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[79], 4, + g_bytes + 962), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 44), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[80], 8, + g_bytes + 966), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 45), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[81], 12, + g_bytes + 974), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 46), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[82], 18, + g_bytes + 986), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 47), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[83], 19, + g_bytes + 1004), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 48), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[84], 5, + g_bytes + 1023), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 49), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[85], 7, + g_bytes + 1028), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 50), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[86], 7, + g_bytes + 1035), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 51), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[87], 11, + g_bytes + 1042), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 52), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[88], 6, + g_bytes + 1053), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 53), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[89], 10, + g_bytes + 1059), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 54), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[90], 25, + g_bytes + 1069), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 55), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[91], 17, + g_bytes + 1094), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 56), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[19], 10, + g_bytes + 268), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 57), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[92], 4, + g_bytes + 1111), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 58), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[93], 3, + g_bytes + 1115), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 59), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[94], 16, + g_bytes + 1118), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 60), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, + g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[95], 1, + g_bytes + 1134), + 61), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, + g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[24], 1, + g_bytes + 342), + 62), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[7], 11, + g_bytes + 50), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[25], 1, + g_bytes + 343), + 63), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, + g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + 64), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, + g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + 65), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[9], 13, + g_bytes + 77), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, + g_bytes + 582), + 66), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[5], 2, + g_bytes + 36), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[97], 8, + g_bytes + 1143), + 67), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[14], 12, + g_bytes + 158), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[98], 16, + g_bytes + 1151), + 68), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[4], 7, + g_bytes + 29), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[99], 4, + g_bytes + 1167), + 69), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[1], 7, + g_bytes + 5), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[100], 3, + g_bytes + 1171), + 70), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 71), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + 72), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[15], 16, + g_bytes + 170), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + 73), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[101], 11, + g_bytes + 1174), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[28], 0, + g_bytes + 346), + 74), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + 75), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[36], 7, + g_bytes + 582), + 76), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[102], 16, + g_bytes + 1185), + 77), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + 78), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, + g_bytes + 1201), + 79), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[104], 12, + g_bytes + 1214), + 80), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[10], 20, + g_bytes + 90), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[105], 21, + g_bytes + 1226), + 81), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[96], 8, + g_bytes + 1135), + 82), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[37], 4, + g_bytes + 589), + 83), + grpc_core::StaticMetadata( + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[16], 15, + g_bytes + 186), + grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[103], 13, + g_bytes + 1201), + 84), }; -const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 76, 77, 78, - 79, 80, 81, 82}; +const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 75, 76, 77, + 78, 79, 80, 81}; -const uint8_t grpc_static_accept_stream_encoding_metadata[4] = {0, 83, 84, 85}; +const uint8_t grpc_static_accept_stream_encoding_metadata[4] = {0, 82, 83, 84}; diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 458e87d30a7..7c05b27cc07 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -33,8 +33,12 @@ #include "src/core/lib/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 107 -extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; +static_assert( + std::is_trivially_destructible::value, + "grpc_core::StaticMetadataSlice must be trivially destructible."); +#define GRPC_STATIC_MDSTR_COUNT 106 +extern const grpc_core::StaticMetadataSlice + grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ #define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) /* ":method" */ @@ -78,185 +82,183 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[19]) /* "host" */ #define GRPC_MDSTR_HOST (grpc_static_slice_table[20]) -/* "lb-token" */ -#define GRPC_MDSTR_LB_TOKEN (grpc_static_slice_table[21]) /* "grpc-previous-rpc-attempts" */ -#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table[22]) +#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table[21]) /* "grpc-retry-pushback-ms" */ -#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table[23]) +#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table[22]) /* "grpc-timeout" */ -#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[24]) +#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[23]) /* "1" */ -#define GRPC_MDSTR_1 (grpc_static_slice_table[25]) +#define GRPC_MDSTR_1 (grpc_static_slice_table[24]) /* "2" */ -#define GRPC_MDSTR_2 (grpc_static_slice_table[26]) +#define GRPC_MDSTR_2 (grpc_static_slice_table[25]) /* "3" */ -#define GRPC_MDSTR_3 (grpc_static_slice_table[27]) +#define GRPC_MDSTR_3 (grpc_static_slice_table[26]) /* "4" */ -#define GRPC_MDSTR_4 (grpc_static_slice_table[28]) +#define GRPC_MDSTR_4 (grpc_static_slice_table[27]) /* "" */ -#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[29]) +#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[28]) /* "grpc.wait_for_ready" */ -#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[30]) +#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[29]) /* "grpc.timeout" */ -#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[31]) +#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[30]) /* "grpc.max_request_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \ - (grpc_static_slice_table[32]) + (grpc_static_slice_table[31]) /* "grpc.max_response_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \ - (grpc_static_slice_table[33]) + (grpc_static_slice_table[32]) /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ - (grpc_static_slice_table[34]) + (grpc_static_slice_table[33]) /* "/grpc.health.v1.Health/Watch" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \ - (grpc_static_slice_table[35]) + (grpc_static_slice_table[34]) /* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources" */ #define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \ - (grpc_static_slice_table[36]) + (grpc_static_slice_table[35]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[37]) +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[36]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table[38]) +#define GRPC_MDSTR_GZIP (grpc_static_slice_table[37]) /* "stream/gzip" */ -#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[39]) +#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[38]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table[40]) +#define GRPC_MDSTR_GET (grpc_static_slice_table[39]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table[41]) +#define GRPC_MDSTR_POST (grpc_static_slice_table[40]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table[42]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table[41]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[43]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[42]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table[44]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table[43]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[45]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[44]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table[46]) +#define GRPC_MDSTR_200 (grpc_static_slice_table[45]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table[47]) +#define GRPC_MDSTR_204 (grpc_static_slice_table[46]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table[48]) +#define GRPC_MDSTR_206 (grpc_static_slice_table[47]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table[49]) +#define GRPC_MDSTR_304 (grpc_static_slice_table[48]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table[50]) +#define GRPC_MDSTR_400 (grpc_static_slice_table[49]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table[51]) +#define GRPC_MDSTR_404 (grpc_static_slice_table[50]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table[52]) +#define GRPC_MDSTR_500 (grpc_static_slice_table[51]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[53]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[52]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[54]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[53]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[55]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[54]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[56]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[55]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[57]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[56]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[58]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[57]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table[59]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table[58]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[60]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[59]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[61]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[60]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[62]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[61]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[63]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[62]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[64]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[63]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[65]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[64]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[66]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[65]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[67]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[66]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[68]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[67]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table[69]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table[68]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table[70]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table[69]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[71]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[70]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[72]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[71]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table[73]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table[72]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[74]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[73]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[75]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[74]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[76]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[75]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[77]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[76]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[78]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[77]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[79]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[78]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[80]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table[79]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[81]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[80]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[82]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[81]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[83]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[82]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[84]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[83]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[85]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table[84]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[86]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table[85]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[87]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[86]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[88]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[87]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[89]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table[88]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[90]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[89]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[91]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[90]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[92]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[91]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[93]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table[92]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[94]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table[93]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[95]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[94]) /* "0" */ -#define GRPC_MDSTR_0 (grpc_static_slice_table[96]) +#define GRPC_MDSTR_0 (grpc_static_slice_table[95]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[97]) +#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[96]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[98]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[97]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[99]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[98]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table[100]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table[99]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table[101]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table[100]) /* "lb-cost-bin" */ -#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[102]) +#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[101]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[103]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[102]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[104]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[103]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[105]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[104]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[106]) + (grpc_static_slice_table[105]) extern grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT]; @@ -268,7 +270,7 @@ extern grpc_slice_refcount (static_cast( \ ((static_slice).refcount - grpc_static_metadata_refcounts))) -#define GRPC_STATIC_MDELEM_COUNT 86 +#define GRPC_STATIC_MDELEM_COUNT 85 extern grpc_core::StaticMetadata grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; @@ -429,38 +431,36 @@ extern grpc_mdelem grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT]; (grpc_static_mdelem_manifested[72]) /* "content-encoding": "gzip" */ #define GRPC_MDELEM_CONTENT_ENCODING_GZIP (grpc_static_mdelem_manifested[73]) -/* "lb-token": "" */ -#define GRPC_MDELEM_LB_TOKEN_EMPTY (grpc_static_mdelem_manifested[74]) /* "lb-cost-bin": "" */ -#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested[75]) +#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested[74]) /* "grpc-accept-encoding": "identity" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \ - (grpc_static_mdelem_manifested[76]) + (grpc_static_mdelem_manifested[75]) /* "grpc-accept-encoding": "deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \ - (grpc_static_mdelem_manifested[77]) + (grpc_static_mdelem_manifested[76]) /* "grpc-accept-encoding": "identity,deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \ - (grpc_static_mdelem_manifested[78]) + (grpc_static_mdelem_manifested[77]) /* "grpc-accept-encoding": "gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \ - (grpc_static_mdelem_manifested[79]) + (grpc_static_mdelem_manifested[78]) /* "grpc-accept-encoding": "identity,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ - (grpc_static_mdelem_manifested[80]) + (grpc_static_mdelem_manifested[79]) /* "grpc-accept-encoding": "deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \ - (grpc_static_mdelem_manifested[81]) + (grpc_static_mdelem_manifested[80]) /* "grpc-accept-encoding": "identity,deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_mdelem_manifested[82]) + (grpc_static_mdelem_manifested[81]) /* "accept-encoding": "identity" */ -#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY (grpc_static_mdelem_manifested[83]) +#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY (grpc_static_mdelem_manifested[82]) /* "accept-encoding": "gzip" */ -#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested[84]) +#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested[83]) /* "accept-encoding": "identity,gzip" */ #define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ - (grpc_static_mdelem_manifested[85]) + (grpc_static_mdelem_manifested[84]) grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b); typedef enum { @@ -485,7 +485,6 @@ typedef enum { GRPC_BATCH_GRPC_INTERNAL_STREAM_ENCODING_REQUEST, GRPC_BATCH_USER_AGENT, GRPC_BATCH_HOST, - GRPC_BATCH_LB_TOKEN, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS, GRPC_BATCH_GRPC_RETRY_PUSHBACK_MS, GRPC_BATCH_CALLOUTS_COUNT @@ -515,7 +514,6 @@ typedef union { struct grpc_linked_mdelem* grpc_internal_stream_encoding_request; struct grpc_linked_mdelem* user_agent; struct grpc_linked_mdelem* host; - struct grpc_linked_mdelem* lb_token; struct grpc_linked_mdelem* grpc_previous_rpc_attempts; struct grpc_linked_mdelem* grpc_retry_pushback_ms; } named; diff --git a/src/core/plugin_registry/grpc_plugin_registry.cc b/src/core/plugin_registry/grpc_plugin_registry.cc index cde40ef65cf..9b011d8df0f 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_plugin_registry.cc @@ -46,6 +46,8 @@ void grpc_resolver_dns_native_init(void); void grpc_resolver_dns_native_shutdown(void); void grpc_resolver_sockaddr_init(void); void grpc_resolver_sockaddr_shutdown(void); +void grpc_client_idle_filter_init(void); +void grpc_client_idle_filter_shutdown(void); void grpc_max_age_filter_init(void); void grpc_max_age_filter_shutdown(void); void grpc_message_size_filter_init(void); @@ -82,6 +84,8 @@ void grpc_register_built_in_plugins(void) { grpc_resolver_dns_native_shutdown); grpc_register_plugin(grpc_resolver_sockaddr_init, grpc_resolver_sockaddr_shutdown); + grpc_register_plugin(grpc_client_idle_filter_init, + grpc_client_idle_filter_shutdown); grpc_register_plugin(grpc_max_age_filter_init, grpc_max_age_filter_shutdown); grpc_register_plugin(grpc_message_size_filter_init, diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc index 5749ab6b954..055c3ccc134 100644 --- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.cc @@ -46,6 +46,8 @@ void grpc_lb_policy_pick_first_init(void); void grpc_lb_policy_pick_first_shutdown(void); void grpc_lb_policy_round_robin_init(void); void grpc_lb_policy_round_robin_shutdown(void); +void grpc_client_idle_filter_init(void); +void grpc_client_idle_filter_shutdown(void); void grpc_max_age_filter_init(void); void grpc_max_age_filter_shutdown(void); void grpc_message_size_filter_init(void); @@ -82,6 +84,8 @@ void grpc_register_built_in_plugins(void) { grpc_lb_policy_pick_first_shutdown); grpc_register_plugin(grpc_lb_policy_round_robin_init, grpc_lb_policy_round_robin_shutdown); + grpc_register_plugin(grpc_client_idle_filter_init, + grpc_client_idle_filter_shutdown); grpc_register_plugin(grpc_max_age_filter_init, grpc_max_age_filter_shutdown); grpc_register_plugin(grpc_message_size_filter_init, diff --git a/src/cpp/Protobuf-C++.podspec b/src/cpp/Protobuf-C++.podspec new file mode 100644 index 00000000000..f6a488dc350 --- /dev/null +++ b/src/cpp/Protobuf-C++.podspec @@ -0,0 +1,42 @@ +Pod::Spec.new do |s| + s.name = 'Protobuf-C++' + s.version = '3.8.0' + s.summary = 'Protocol Buffers v3 runtime library for C++.' + s.homepage = 'https://github.com/google/protobuf' + s.license = '3-Clause BSD License' + s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' } + s.cocoapods_version = '>= 1.0' + + s.source = { :git => 'https://github.com/google/protobuf.git', + :tag => "v#{s.version}" } + + s.source_files = 'src/google/protobuf/*.{h,cc,inc}', + 'src/google/protobuf/stubs/*.{h,cc}', + 'src/google/protobuf/io/*.{h,cc}', + 'src/google/protobuf/util/*.{h,cc}', + 'src/google/protobuf/util/internal/*.{h,cc}' + + # Excluding all the tests in the directories above + s.exclude_files = 'src/google/**/*_test.{h,cc,inc}', + 'src/google/**/*_unittest.{h,cc}', + 'src/google/protobuf/test_util*.{h,cc}', + 'src/google/protobuf/map_lite_test_util.{h,cc}', + 'src/google/protobuf/map_test_util*.{h,cc,inc}' + + s.header_mappings_dir = 'src' + + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '2.0' + + s.pod_target_xcconfig = { + # Do not let src/google/protobuf/stubs/time.h override system API + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + + # Configure tool is not being used for Xcode. When building, assume pthread is supported. + 'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "HAVE_PTHREAD=1"', + } + +end diff --git a/src/cpp/ext/filters/census/client_filter.cc b/src/cpp/ext/filters/census/client_filter.cc index 940d42d1000..0f69e793551 100644 --- a/src/cpp/ext/filters/census/client_filter.cc +++ b/src/cpp/ext/filters/census/client_filter.cc @@ -94,7 +94,7 @@ void CensusClientCallData::StartTransportStreamOpBatch( op->send_initial_metadata()->batch(), &tracing_bin_, grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_TRACE_BIN, - grpc_slice_from_copied_buffer(tracing_buf_, tracing_len)))); + grpc_core::UnmanagedMemorySlice(tracing_buf_, tracing_len)))); } grpc_slice tags = grpc_empty_slice(); // TODO: Add in tagging serialization. diff --git a/src/cpp/ext/filters/census/server_filter.cc b/src/cpp/ext/filters/census/server_filter.cc index b5f3d5a13a7..603d1f90bbb 100644 --- a/src/cpp/ext/filters/census/server_filter.cc +++ b/src/cpp/ext/filters/census/server_filter.cc @@ -155,7 +155,7 @@ void CensusServerCallData::StartTransportStreamOpBatch( op->send_trailing_metadata()->batch(), &census_bin_, grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_SERVER_STATS_BIN, - grpc_slice_from_copied_buffer(stats_buf_, len)))); + grpc_core::UnmanagedMemorySlice(stats_buf_, len)))); } } // Call next op. diff --git a/src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs b/src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs index d859075c3bd..e6c973431d7 100644 --- a/src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs +++ b/src/csharp/Grpc.Auth/GoogleAuthInterceptors.cs @@ -61,7 +61,7 @@ namespace Grpc.Auth return new AsyncAuthInterceptor((context, metadata) => { metadata.Add(CreateBearerTokenHeader(accessToken)); - return TaskUtils.CompletedTask; + return GetCompletedTask(); }); } @@ -69,5 +69,17 @@ namespace Grpc.Auth { return new Metadata.Entry(AuthorizationHeader, Schema + " " + accessToken); } + + /// + /// Framework independent equivalent of Task.CompletedTask. + /// + private static Task GetCompletedTask() + { +#if NETSTANDARD1_5 || NETSTANDARD2_0 + return Task.CompletedTask; +#else + return Task.FromResult(null); // for .NET45, emulate the functionality +#endif + } } } diff --git a/src/csharp/Grpc.Auth/Grpc.Auth.csproj b/src/csharp/Grpc.Auth/Grpc.Auth.csproj index 298b721409e..1e559c19872 100755 --- a/src/csharp/Grpc.Auth/Grpc.Auth.csproj +++ b/src/csharp/Grpc.Auth/Grpc.Auth.csproj @@ -27,7 +27,7 @@ - + None diff --git a/src/csharp/Grpc.Core.Api/AsyncStreamReaderExtensions.cs b/src/csharp/Grpc.Core.Api/AsyncStreamReaderExtensions.cs new file mode 100644 index 00000000000..a1f895723ed --- /dev/null +++ b/src/csharp/Grpc.Core.Api/AsyncStreamReaderExtensions.cs @@ -0,0 +1,50 @@ +#region Copyright notice and license + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// Extension methods for . + /// + public static class AsyncStreamReaderExtensions + { + /// + /// Advances the stream reader to the next element in the sequence, returning the result asynchronously. + /// + /// The message type. + /// The stream reader. + /// + /// Task containing the result of the operation: true if the reader was successfully advanced + /// to the next element; false if the reader has passed the end of the sequence. + /// + public static Task MoveNext(this IAsyncStreamReader streamReader) + where T : class + { + if (streamReader == null) + { + throw new ArgumentNullException(nameof(streamReader)); + } + + return streamReader.MoveNext(CancellationToken.None); + } + } +} diff --git a/src/csharp/Grpc.Core.Api/CallCredentials.cs b/src/csharp/Grpc.Core.Api/CallCredentials.cs index 6344a881070..3b150a211c2 100644 --- a/src/csharp/Grpc.Core.Api/CallCredentials.cs +++ b/src/csharp/Grpc.Core.Api/CallCredentials.cs @@ -51,8 +51,8 @@ namespace Grpc.Core } /// - /// Populates this call credential instances. - /// You never need to invoke this, part of internal implementation. + /// Populates call credentials configurator with this instance's configuration. + /// End users never need to invoke this method as it is part of internal implementation. /// public abstract void InternalPopulateConfiguration(CallCredentialsConfiguratorBase configurator, object state); diff --git a/src/csharp/Grpc.Core.Api/ChannelBase.cs b/src/csharp/Grpc.Core.Api/ChannelBase.cs new file mode 100644 index 00000000000..54546300e81 --- /dev/null +++ b/src/csharp/Grpc.Core.Api/ChannelBase.cs @@ -0,0 +1,52 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using Grpc.Core.Utils; + +namespace Grpc.Core +{ + /// + /// Base class for gRPC channel. Channels are an abstraction of long-lived connections to remote servers. + /// + public abstract class ChannelBase + { + private readonly string target; + + /// + /// Initializes a new instance of class that connects to a specific host. + /// + /// Target of the channel. + protected ChannelBase(string target) + { + this.target = GrpcPreconditions.CheckNotNull(target, nameof(target)); + } + + /// The original target used to create the channel. + public string Target + { + get { return this.target; } + } + + /// + /// Create a new for the channel. + /// + /// A new . + public abstract CallInvoker CreateCallInvoker(); + } +} diff --git a/src/csharp/Grpc.Core.Api/ChannelCredentials.cs b/src/csharp/Grpc.Core.Api/ChannelCredentials.cs new file mode 100644 index 00000000000..23ede0a512e --- /dev/null +++ b/src/csharp/Grpc.Core.Api/ChannelCredentials.cs @@ -0,0 +1,113 @@ +#region Copyright notice and license + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +using Grpc.Core.Internal; +using Grpc.Core.Utils; + +namespace Grpc.Core +{ + /// + /// Client-side channel credentials. Used for creation of a secure channel. + /// + public abstract class ChannelCredentials + { + static readonly ChannelCredentials InsecureInstance = new InsecureCredentialsImpl(); + + /// + /// Creates a new instance of channel credentials + /// + public ChannelCredentials() + { + } + + /// + /// Returns instance of credentials that provides no security and + /// will result in creating an unsecure channel with no encryption whatsoever. + /// + public static ChannelCredentials Insecure + { + get + { + return InsecureInstance; + } + } + + /// + /// Creates a new instance of ChannelCredentials class by composing + /// given channel credentials with call credentials. + /// + /// Channel credentials. + /// Call credentials. + /// The new composite ChannelCredentials + public static ChannelCredentials Create(ChannelCredentials channelCredentials, CallCredentials callCredentials) + { + return new CompositeChannelCredentials(channelCredentials, callCredentials); + } + + /// + /// Populates channel credentials configurator with this instance's configuration. + /// End users never need to invoke this method as it is part of internal implementation. + /// + public abstract void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state); + + /// + /// Returns true if this credential type allows being composed by CompositeCredentials. + /// + internal virtual bool IsComposable => false; + + private sealed class InsecureCredentialsImpl : ChannelCredentials + { + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) + { + configurator.SetInsecureCredentials(state); + } + } + + /// + /// Credentials that allow composing one object and + /// one or more objects into a single . + /// + private sealed class CompositeChannelCredentials : ChannelCredentials + { + readonly ChannelCredentials channelCredentials; + readonly CallCredentials callCredentials; + + /// + /// Initializes a new instance of CompositeChannelCredentials class. + /// The resulting credentials object will be composite of all the credentials specified as parameters. + /// + /// channelCredentials to compose + /// channelCredentials to compose + public CompositeChannelCredentials(ChannelCredentials channelCredentials, CallCredentials callCredentials) + { + this.channelCredentials = GrpcPreconditions.CheckNotNull(channelCredentials); + this.callCredentials = GrpcPreconditions.CheckNotNull(callCredentials); + GrpcPreconditions.CheckArgument(channelCredentials.IsComposable, "Supplied channel credentials do not allow composition."); + } + + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) + { + configurator.SetCompositeCredentials(state, channelCredentials, callCredentials); + } + } + } +} diff --git a/src/csharp/Grpc.Core.Api/ChannelCredentialsConfiguratorBase.cs b/src/csharp/Grpc.Core.Api/ChannelCredentialsConfiguratorBase.cs new file mode 100644 index 00000000000..5c779bc66b4 --- /dev/null +++ b/src/csharp/Grpc.Core.Api/ChannelCredentialsConfiguratorBase.cs @@ -0,0 +1,44 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System.Collections.Generic; + +namespace Grpc.Core +{ + /// + /// Base class for objects that can consume configuration from CallCredentials objects. + /// Note: experimental API that can change or be removed without any prior notice. + /// + public abstract class ChannelCredentialsConfiguratorBase + { + /// + /// Configures the credentials to use insecure credentials. + /// + public abstract void SetInsecureCredentials(object state); + + /// + /// Configures the credentials to use SslCredentials. + /// + public abstract void SetSslCredentials(object state, string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback); + + /// + /// Configures the credentials to use composite channel credentials (a composite of channel credentials and call credentials). + /// + public abstract void SetCompositeCredentials(object state, ChannelCredentials channelCredentials, CallCredentials callCredentials); + } +} diff --git a/src/csharp/Grpc.Core/ClientBase.cs b/src/csharp/Grpc.Core.Api/ClientBase.cs similarity index 98% rename from src/csharp/Grpc.Core/ClientBase.cs rename to src/csharp/Grpc.Core.Api/ClientBase.cs index 05edce7467d..243c35e20c1 100644 --- a/src/csharp/Grpc.Core/ClientBase.cs +++ b/src/csharp/Grpc.Core.Api/ClientBase.cs @@ -51,7 +51,7 @@ namespace Grpc.Core /// Initializes a new instance of ClientBase class. /// /// The channel to use for remote call invocation. - public ClientBase(Channel channel) : base(channel) + public ClientBase(ChannelBase channel) : base(channel) { } @@ -113,7 +113,7 @@ namespace Grpc.Core /// Initializes a new instance of ClientBase class. /// /// The channel to use for remote call invocation. - public ClientBase(Channel channel) : this(new DefaultCallInvoker(channel)) + public ClientBase(ChannelBase channel) : this(channel.CreateCallInvoker()) { } diff --git a/src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj b/src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj index a0d41a260da..ae6bea8bd16 100755 --- a/src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj +++ b/src/csharp/Grpc.Core.Api/Grpc.Core.Api.csproj @@ -23,7 +23,6 @@ - diff --git a/src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs b/src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs index 3751d549e39..7ad4f2687b8 100644 --- a/src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs +++ b/src/csharp/Grpc.Core.Api/IAsyncStreamReader.cs @@ -1,4 +1,4 @@ -#region Copyright notice and license +#region Copyright notice and license // Copyright 2015 gRPC authors. // @@ -16,10 +16,7 @@ #endregion -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Threading; using System.Threading.Tasks; namespace Grpc.Core @@ -50,7 +47,20 @@ namespace Grpc.Core /// /// /// The message type. - public interface IAsyncStreamReader : IAsyncEnumerator + public interface IAsyncStreamReader { + /// + /// Gets the current element in the iteration. + /// + T Current { get; } + + /// + /// Advances the reader to the next element in the sequence, returning the result asynchronously. + /// + /// Cancellation token that can be used to cancel the operation. + /// + /// Task containing the result of the operation: true if the reader was successfully advanced + /// to the next element; false if the reader has passed the end of the sequence. + Task MoveNext(CancellationToken cancellationToken); } } diff --git a/src/csharp/Grpc.Core.Api/Internal/UnimplementedCallInvoker.cs b/src/csharp/Grpc.Core.Api/Internal/UnimplementedCallInvoker.cs new file mode 100644 index 00000000000..c7be74ecf30 --- /dev/null +++ b/src/csharp/Grpc.Core.Api/Internal/UnimplementedCallInvoker.cs @@ -0,0 +1,60 @@ +#region Copyright notice and license + +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Threading.Tasks; +using Grpc.Core; +using Grpc.Core.Utils; + +namespace Grpc.Core.Internal +{ + /// + /// Call invoker that throws NotImplementedException for all requests. + /// + internal class UnimplementedCallInvoker : CallInvoker + { + public UnimplementedCallInvoker() + { + } + + public override TResponse BlockingUnaryCall(Method method, string host, CallOptions options, TRequest request) + { + throw new NotImplementedException(); + } + + public override AsyncUnaryCall AsyncUnaryCall(Method method, string host, CallOptions options, TRequest request) + { + throw new NotImplementedException(); + } + + public override AsyncServerStreamingCall AsyncServerStreamingCall(Method method, string host, CallOptions options, TRequest request) + { + throw new NotImplementedException(); + } + + public override AsyncClientStreamingCall AsyncClientStreamingCall(Method method, string host, CallOptions options) + { + throw new NotImplementedException(); + } + + public override AsyncDuplexStreamingCall AsyncDuplexStreamingCall(Method method, string host, CallOptions options) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/csharp/Grpc.Core/KeyCertificatePair.cs b/src/csharp/Grpc.Core.Api/KeyCertificatePair.cs similarity index 100% rename from src/csharp/Grpc.Core/KeyCertificatePair.cs rename to src/csharp/Grpc.Core.Api/KeyCertificatePair.cs diff --git a/src/csharp/Grpc.Core.Api/LiteClientBase.cs b/src/csharp/Grpc.Core.Api/LiteClientBase.cs index c3215f016a0..132f10a912f 100644 --- a/src/csharp/Grpc.Core.Api/LiteClientBase.cs +++ b/src/csharp/Grpc.Core.Api/LiteClientBase.cs @@ -17,6 +17,7 @@ #endregion using System; +using Grpc.Core.Internal; using Grpc.Core.Utils; namespace Grpc.Core @@ -58,40 +59,5 @@ namespace Grpc.Core { get { return this.callInvoker; } } - - /// - /// Call invoker that throws NotImplementedException for all requests. - /// - private class UnimplementedCallInvoker : CallInvoker - { - public UnimplementedCallInvoker() - { - } - - public override TResponse BlockingUnaryCall(Method method, string host, CallOptions options, TRequest request) - { - throw new NotImplementedException(); - } - - public override AsyncUnaryCall AsyncUnaryCall(Method method, string host, CallOptions options, TRequest request) - { - throw new NotImplementedException(); - } - - public override AsyncServerStreamingCall AsyncServerStreamingCall(Method method, string host, CallOptions options, TRequest request) - { - throw new NotImplementedException(); - } - - public override AsyncClientStreamingCall AsyncClientStreamingCall(Method method, string host, CallOptions options) - { - throw new NotImplementedException(); - } - - public override AsyncDuplexStreamingCall AsyncDuplexStreamingCall(Method method, string host, CallOptions options) - { - throw new NotImplementedException(); - } - } } } diff --git a/src/csharp/Grpc.Core.Api/SslCredentials.cs b/src/csharp/Grpc.Core.Api/SslCredentials.cs new file mode 100644 index 00000000000..21db7cdfb66 --- /dev/null +++ b/src/csharp/Grpc.Core.Api/SslCredentials.cs @@ -0,0 +1,122 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +namespace Grpc.Core +{ + /// + /// Callback invoked with the expected targetHost and the peer's certificate. + /// If false is returned by this callback then it is treated as a + /// verification failure and the attempted connection will fail. + /// Invocation of the callback is blocking, so any + /// implementation should be light-weight. + /// Note that the callback can potentially be invoked multiple times, + /// concurrently from different threads (e.g. when multiple connections + /// are being created for the same credentials). + /// + /// The associated with the callback + /// true if verification succeeded, false otherwise. + /// Note: experimental API that can change or be removed without any prior notice. + public delegate bool VerifyPeerCallback(VerifyPeerContext context); + + /// + /// Client-side SSL credentials. + /// + public sealed class SslCredentials : ChannelCredentials + { + readonly string rootCertificates; + readonly KeyCertificatePair keyCertificatePair; + readonly VerifyPeerCallback verifyPeerCallback; + + /// + /// Creates client-side SSL credentials loaded from + /// disk file pointed to by the GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable. + /// If that fails, gets the roots certificates from a well known place on disk. + /// + public SslCredentials() : this(null, null, null) + { + } + + /// + /// Creates client-side SSL credentials from + /// a string containing PEM encoded root certificates. + /// + public SslCredentials(string rootCertificates) : this(rootCertificates, null, null) + { + } + + /// + /// Creates client-side SSL credentials. + /// + /// string containing PEM encoded server root certificates. + /// a key certificate pair. + public SslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair) : + this(rootCertificates, keyCertificatePair, null) + { + } + + /// + /// Creates client-side SSL credentials. + /// + /// string containing PEM encoded server root certificates. + /// a key certificate pair. + /// a callback to verify peer's target name and certificate. + /// Note: experimental API that can change or be removed without any prior notice. + public SslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback) + { + this.rootCertificates = rootCertificates; + this.keyCertificatePair = keyCertificatePair; + this.verifyPeerCallback = verifyPeerCallback; + } + + /// + /// PEM encoding of the server root certificates. + /// + public string RootCertificates + { + get + { + return this.rootCertificates; + } + } + + /// + /// Client side key and certificate pair. + /// If null, client will not use key and certificate pair. + /// + public KeyCertificatePair KeyCertificatePair + { + get + { + return this.keyCertificatePair; + } + } + + /// + /// Populates channel credentials configurator with this instance's configuration. + /// End users never need to invoke this method as it is part of internal implementation. + /// + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) + { + configurator.SetSslCredentials(state, rootCertificates, keyCertificatePair, verifyPeerCallback); + } + + internal override bool IsComposable => true; + } + + +} diff --git a/src/csharp/Grpc.Core/VerifyPeerContext.cs b/src/csharp/Grpc.Core.Api/VerifyPeerContext.cs similarity index 100% rename from src/csharp/Grpc.Core/VerifyPeerContext.cs rename to src/csharp/Grpc.Core.Api/VerifyPeerContext.cs diff --git a/src/csharp/Grpc.Core.Api/VersionInfo.cs b/src/csharp/Grpc.Core.Api/VersionInfo.cs index 6469aeb3f4b..d84da7c9e2f 100644 --- a/src/csharp/Grpc.Core.Api/VersionInfo.cs +++ b/src/csharp/Grpc.Core.Api/VersionInfo.cs @@ -28,16 +28,16 @@ namespace Grpc.Core /// /// Current AssemblyVersion attribute of gRPC C# assemblies /// - public const string CurrentAssemblyVersion = "1.0.0.0"; + public const string CurrentAssemblyVersion = "2.0.0.0"; /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.23.0.0"; + public const string CurrentAssemblyFileVersion = "2.23.0.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.23.0-dev"; + public const string CurrentVersion = "2.23.0-dev"; } } diff --git a/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs b/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs index 843d88bfb6a..57acfc0bab5 100644 --- a/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs +++ b/src/csharp/Grpc.Core.Tests/ChannelCredentialsTest.cs @@ -48,28 +48,9 @@ namespace Grpc.Core.Tests { // always returning the same native object is critical for subchannel sharing to work with secure channels var creds = new SslCredentials(); - var nativeCreds1 = creds.GetNativeCredentials(); - var nativeCreds2 = creds.GetNativeCredentials(); + var nativeCreds1 = creds.ToNativeCredentials(); + var nativeCreds2 = creds.ToNativeCredentials(); Assert.AreSame(nativeCreds1, nativeCreds2); } - - [Test] - public void ChannelCredentials_CreateExceptionIsCached() - { - var creds = new ChannelCredentialsWithCreateNativeThrows(); - var ex1 = Assert.Throws(typeof(Exception), () => creds.GetNativeCredentials()); - var ex2 = Assert.Throws(typeof(Exception), () => creds.GetNativeCredentials()); - Assert.AreSame(ex1, ex2); - } - - internal class ChannelCredentialsWithCreateNativeThrows : ChannelCredentials - { - internal override bool IsComposable => false; - - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() - { - throw new Exception("Creation of native credentials has failed on purpose."); - } - } } } diff --git a/src/csharp/Grpc.Core.Tests/FakeCredentials.cs b/src/csharp/Grpc.Core.Tests/FakeCredentials.cs index 59587b9a510..e38e0e136cc 100644 --- a/src/csharp/Grpc.Core.Tests/FakeCredentials.cs +++ b/src/csharp/Grpc.Core.Tests/FakeCredentials.cs @@ -34,9 +34,9 @@ namespace Grpc.Core.Tests get { return composable; } } - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() + public override void InternalPopulateConfiguration(ChannelCredentialsConfiguratorBase configurator, object state) { - return null; + // not invoking configuration on purpose } } diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs index 97f79b0fb4f..8d1fb921ff4 100644 --- a/src/csharp/Grpc.Core/Channel.cs +++ b/src/csharp/Grpc.Core/Channel.cs @@ -30,7 +30,7 @@ namespace Grpc.Core /// More client objects can reuse the same channel. Creating a channel is an expensive operation compared to invoking /// a remote call so in general you should reuse a single channel for as many calls as possible. /// - public class Channel + public class Channel : ChannelBase { static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); @@ -38,7 +38,6 @@ namespace Grpc.Core readonly AtomicCounter activeCallCounter = new AtomicCounter(); readonly CancellationTokenSource shutdownTokenSource = new CancellationTokenSource(); - readonly string target; readonly GrpcEnvironment environment; readonly CompletionQueueSafeHandle completionQueue; readonly ChannelSafeHandle handle; @@ -64,9 +63,8 @@ namespace Grpc.Core /// Target of the channel. /// Credentials to secure the channel. /// Channel options. - public Channel(string target, ChannelCredentials credentials, IEnumerable options) + public Channel(string target, ChannelCredentials credentials, IEnumerable options) : base(target) { - this.target = GrpcPreconditions.CheckNotNull(target, "target"); this.options = CreateOptionsDictionary(options); EnsureUserAgentChannelOption(this.options); this.environment = GrpcEnvironment.AddRef(); @@ -74,7 +72,7 @@ namespace Grpc.Core this.completionQueue = this.environment.PickCompletionQueue(); using (var nativeChannelArgs = ChannelOptions.CreateChannelArgs(this.options.Values)) { - var nativeCredentials = credentials.GetNativeCredentials(); + var nativeCredentials = credentials.ToNativeCredentials(); if (nativeCredentials != null) { this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, target, nativeChannelArgs); @@ -179,15 +177,6 @@ namespace Grpc.Core } } - /// The original target used to create the channel. - public string Target - { - get - { - return this.target; - } - } - /// /// Returns a token that gets cancelled once ShutdownAsync is invoked. /// @@ -257,6 +246,15 @@ namespace Grpc.Core await GrpcEnvironment.ReleaseAsync().ConfigureAwait(false); } + /// + /// Create a new for the channel. + /// + /// A new . + public override CallInvoker CreateCallInvoker() + { + return new DefaultCallInvoker(this); + } + internal ChannelSafeHandle Handle { get diff --git a/src/csharp/Grpc.Core/ChannelCredentials.cs b/src/csharp/Grpc.Core/ChannelCredentials.cs deleted file mode 100644 index dcbe9f3599b..00000000000 --- a/src/csharp/Grpc.Core/ChannelCredentials.cs +++ /dev/null @@ -1,293 +0,0 @@ -#region Copyright notice and license - -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#endregion - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Threading.Tasks; - -using Grpc.Core.Internal; -using Grpc.Core.Logging; -using Grpc.Core.Utils; - -namespace Grpc.Core -{ - /// - /// Client-side channel credentials. Used for creation of a secure channel. - /// - public abstract class ChannelCredentials - { - static readonly ChannelCredentials InsecureInstance = new InsecureCredentialsImpl(); - readonly Lazy cachedNativeCredentials; - - /// - /// Creates a new instance of channel credentials - /// - public ChannelCredentials() - { - // Native credentials object need to be kept alive once initialized for subchannel sharing to work correctly - // with secure connections. See https://github.com/grpc/grpc/issues/15207. - // We rely on finalizer to clean up the native portion of ChannelCredentialsSafeHandle after the ChannelCredentials - // instance becomes unused. - this.cachedNativeCredentials = new Lazy(() => CreateNativeCredentials()); - } - - /// - /// Returns instance of credentials that provides no security and - /// will result in creating an unsecure channel with no encryption whatsoever. - /// - public static ChannelCredentials Insecure - { - get - { - return InsecureInstance; - } - } - - /// - /// Creates a new instance of ChannelCredentials class by composing - /// given channel credentials with call credentials. - /// - /// Channel credentials. - /// Call credentials. - /// The new composite ChannelCredentials - public static ChannelCredentials Create(ChannelCredentials channelCredentials, CallCredentials callCredentials) - { - return new CompositeChannelCredentials(channelCredentials, callCredentials); - } - - /// - /// Gets native object for the credentials, creating one if it already doesn't exist. May return null if insecure channel - /// should be created. Caller must not call Dispose() on the returned native credentials as their lifetime - /// is managed by this class (and instances of native credentials are cached). - /// - /// The native credentials. - internal ChannelCredentialsSafeHandle GetNativeCredentials() - { - return cachedNativeCredentials.Value; - } - - /// - /// Creates a new native object for the credentials. May return null if insecure channel - /// should be created. For internal use only, use instead. - /// - /// The native credentials. - internal abstract ChannelCredentialsSafeHandle CreateNativeCredentials(); - - /// - /// Returns true if this credential type allows being composed by CompositeCredentials. - /// - internal virtual bool IsComposable - { - get { return false; } - } - - private sealed class InsecureCredentialsImpl : ChannelCredentials - { - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() - { - return null; - } - } - } - - /// - /// Callback invoked with the expected targetHost and the peer's certificate. - /// If false is returned by this callback then it is treated as a - /// verification failure and the attempted connection will fail. - /// Invocation of the callback is blocking, so any - /// implementation should be light-weight. - /// Note that the callback can potentially be invoked multiple times, - /// concurrently from different threads (e.g. when multiple connections - /// are being created for the same credentials). - /// - /// The associated with the callback - /// true if verification succeeded, false otherwise. - /// Note: experimental API that can change or be removed without any prior notice. - public delegate bool VerifyPeerCallback(VerifyPeerContext context); - - /// - /// Client-side SSL credentials. - /// - public sealed class SslCredentials : ChannelCredentials - { - static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); - - readonly string rootCertificates; - readonly KeyCertificatePair keyCertificatePair; - readonly VerifyPeerCallback verifyPeerCallback; - - /// - /// Creates client-side SSL credentials loaded from - /// disk file pointed to by the GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable. - /// If that fails, gets the roots certificates from a well known place on disk. - /// - public SslCredentials() : this(null, null, null) - { - } - - /// - /// Creates client-side SSL credentials from - /// a string containing PEM encoded root certificates. - /// - public SslCredentials(string rootCertificates) : this(rootCertificates, null, null) - { - } - - /// - /// Creates client-side SSL credentials. - /// - /// string containing PEM encoded server root certificates. - /// a key certificate pair. - public SslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair) : - this(rootCertificates, keyCertificatePair, null) - { - } - - /// - /// Creates client-side SSL credentials. - /// - /// string containing PEM encoded server root certificates. - /// a key certificate pair. - /// a callback to verify peer's target name and certificate. - /// Note: experimental API that can change or be removed without any prior notice. - public SslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback) - { - this.rootCertificates = rootCertificates; - this.keyCertificatePair = keyCertificatePair; - this.verifyPeerCallback = verifyPeerCallback; - } - - /// - /// PEM encoding of the server root certificates. - /// - public string RootCertificates - { - get - { - return this.rootCertificates; - } - } - - /// - /// Client side key and certificate pair. - /// If null, client will not use key and certificate pair. - /// - public KeyCertificatePair KeyCertificatePair - { - get - { - return this.keyCertificatePair; - } - } - - // Composing composite makes no sense. - internal override bool IsComposable - { - get { return true; } - } - - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() - { - IntPtr verifyPeerCallbackTag = IntPtr.Zero; - if (verifyPeerCallback != null) - { - verifyPeerCallbackTag = new VerifyPeerCallbackRegistration(verifyPeerCallback).CallbackRegistration.Tag; - } - return ChannelCredentialsSafeHandle.CreateSslCredentials(rootCertificates, keyCertificatePair, verifyPeerCallbackTag); - } - - private class VerifyPeerCallbackRegistration - { - readonly VerifyPeerCallback verifyPeerCallback; - readonly NativeCallbackRegistration callbackRegistration; - - public VerifyPeerCallbackRegistration(VerifyPeerCallback verifyPeerCallback) - { - this.verifyPeerCallback = verifyPeerCallback; - this.callbackRegistration = NativeCallbackDispatcher.RegisterCallback(HandleUniversalCallback); - } - - public NativeCallbackRegistration CallbackRegistration => callbackRegistration; - - private int HandleUniversalCallback(IntPtr arg0, IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5) - { - return VerifyPeerCallbackHandler(arg0, arg1, arg2 != IntPtr.Zero); - } - - private int VerifyPeerCallbackHandler(IntPtr targetName, IntPtr peerPem, bool isDestroy) - { - if (isDestroy) - { - this.callbackRegistration.Dispose(); - return 0; - } - - try - { - var context = new VerifyPeerContext(Marshal.PtrToStringAnsi(targetName), Marshal.PtrToStringAnsi(peerPem)); - - return this.verifyPeerCallback(context) ? 0 : 1; - } - catch (Exception e) - { - // eat the exception, we must not throw when inside callback from native code. - Logger.Error(e, "Exception occurred while invoking verify peer callback handler."); - // Return validation failure in case of exception. - return 1; - } - } - } - } - - /// - /// Credentials that allow composing one object and - /// one or more objects into a single . - /// - internal sealed class CompositeChannelCredentials : ChannelCredentials - { - readonly ChannelCredentials channelCredentials; - readonly CallCredentials callCredentials; - - /// - /// Initializes a new instance of CompositeChannelCredentials class. - /// The resulting credentials object will be composite of all the credentials specified as parameters. - /// - /// channelCredentials to compose - /// channelCredentials to compose - public CompositeChannelCredentials(ChannelCredentials channelCredentials, CallCredentials callCredentials) - { - this.channelCredentials = GrpcPreconditions.CheckNotNull(channelCredentials); - this.callCredentials = GrpcPreconditions.CheckNotNull(callCredentials); - GrpcPreconditions.CheckArgument(channelCredentials.IsComposable, "Supplied channel credentials do not allow composition."); - } - - internal override ChannelCredentialsSafeHandle CreateNativeCredentials() - { - using (var callCreds = callCredentials.ToNativeCredentials()) - { - var nativeComposite = ChannelCredentialsSafeHandle.CreateComposite(channelCredentials.GetNativeCredentials(), callCreds); - if (nativeComposite.IsInvalid) - { - throw new ArgumentException("Error creating native composite credentials. Likely, this is because you are trying to compose incompatible credentials."); - } - return nativeComposite; - } - } - } -} diff --git a/src/csharp/Grpc.Core/ForwardedTypes.cs b/src/csharp/Grpc.Core/ForwardedTypes.cs index fb99cfc018d..4394a7c907c 100644 --- a/src/csharp/Grpc.Core/ForwardedTypes.cs +++ b/src/csharp/Grpc.Core/ForwardedTypes.cs @@ -38,6 +38,9 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(CallInvoker))] [assembly:TypeForwardedToAttribute(typeof(CallInvokerExtensions))] [assembly:TypeForwardedToAttribute(typeof(CallOptions))] +[assembly:TypeForwardedToAttribute(typeof(ClientBase))] +[assembly:TypeForwardedToAttribute(typeof(ClientBase<>))] +[assembly:TypeForwardedToAttribute(typeof(ChannelCredentials))] [assembly:TypeForwardedToAttribute(typeof(ClientInterceptorContext<,>))] [assembly:TypeForwardedToAttribute(typeof(ContextPropagationOptions))] [assembly:TypeForwardedToAttribute(typeof(ContextPropagationToken))] @@ -48,6 +51,7 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(Interceptor))] [assembly:TypeForwardedToAttribute(typeof(InterceptingCallInvoker))] [assembly:TypeForwardedToAttribute(typeof(IServerStreamWriter<>))] +[assembly:TypeForwardedToAttribute(typeof(KeyCertificatePair))] [assembly:TypeForwardedToAttribute(typeof(Marshaller<>))] [assembly:TypeForwardedToAttribute(typeof(Marshallers))] [assembly:TypeForwardedToAttribute(typeof(Metadata))] @@ -63,8 +67,11 @@ using Grpc.Core.Utils; [assembly:TypeForwardedToAttribute(typeof(DuplexStreamingServerMethod<,>))] [assembly:TypeForwardedToAttribute(typeof(ServerServiceDefinition))] [assembly:TypeForwardedToAttribute(typeof(ServiceBinderBase))] +[assembly:TypeForwardedToAttribute(typeof(SslCredentials))] [assembly:TypeForwardedToAttribute(typeof(Status))] [assembly:TypeForwardedToAttribute(typeof(StatusCode))] +[assembly:TypeForwardedToAttribute(typeof(VerifyPeerCallback))] +[assembly:TypeForwardedToAttribute(typeof(VerifyPeerContext))] [assembly:TypeForwardedToAttribute(typeof(VersionInfo))] [assembly:TypeForwardedToAttribute(typeof(WriteOptions))] [assembly:TypeForwardedToAttribute(typeof(WriteFlags))] diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index b7c7851a34b..561c3edc9cc 100755 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -1,4 +1,4 @@ - + @@ -98,7 +98,6 @@ - diff --git a/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs index 28135d7b0d5..6103ba99aab 100644 --- a/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs @@ -29,7 +29,7 @@ namespace Grpc.Core.Internal { static readonly NativeMethods Native = NativeMethods.Get(); - AtomicCounter shutdownRefcount = new AtomicCounter(1); + AtomicCounter shutdownRefcount; CompletionRegistry completionRegistry; private CompletionQueueSafeHandle() @@ -51,6 +51,7 @@ namespace Grpc.Core.Internal { var cq = Native.grpcsharp_completion_queue_create_async(); cq.completionRegistry = completionRegistry; + cq.shutdownRefcount = new AtomicCounter(1); return cq; } @@ -95,7 +96,7 @@ namespace Grpc.Core.Internal private void DecrementShutdownRefcount() { - if (shutdownRefcount.Decrement() == 0) + if (shutdownRefcount == null || shutdownRefcount.Decrement() == 0) { Native.grpcsharp_completion_queue_shutdown(this); } @@ -103,6 +104,7 @@ namespace Grpc.Core.Internal private void BeginOp() { + GrpcPreconditions.CheckNotNull(shutdownRefcount, nameof(shutdownRefcount)); bool success = false; shutdownRefcount.IncrementIfNonzero(ref success); GrpcPreconditions.CheckState(success, "Shutdown has already been called"); @@ -110,6 +112,7 @@ namespace Grpc.Core.Internal private void EndOp() { + GrpcPreconditions.CheckNotNull(shutdownRefcount, nameof(shutdownRefcount)); DecrementShutdownRefcount(); } diff --git a/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs b/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs new file mode 100644 index 00000000000..c4c044cd577 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/DefaultChannelCredentialsConfigurator.cs @@ -0,0 +1,163 @@ +#region Copyright notice and license + +// Copyright 2019 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; +using Grpc.Core.Utils; +using Grpc.Core.Logging; + +namespace Grpc.Core.Internal +{ + /// + /// Creates native call credential objects from instances of ChannelCredentials. + /// + internal class DefaultChannelCredentialsConfigurator : ChannelCredentialsConfiguratorBase + { + static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); + + // Native credentials object need to be kept alive once initialized for subchannel sharing to work correctly + // with secure connections. See https://github.com/grpc/grpc/issues/15207. + // We rely on finalizer to clean up the native portion of ChannelCredentialsSafeHandle after the ChannelCredentials + // instance becomes unused. + static readonly ConditionalWeakTable> CachedNativeCredentials = new ConditionalWeakTable>(); + static readonly object StaticLock = new object(); + + bool configured; + ChannelCredentialsSafeHandle nativeCredentials; + + public ChannelCredentialsSafeHandle NativeCredentials => nativeCredentials; + + public override void SetInsecureCredentials(object state) + { + GrpcPreconditions.CheckState(!configured); + // null corresponds to insecure credentials. + configured = true; + nativeCredentials = null; + } + + public override void SetSslCredentials(object state, string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback) + { + GrpcPreconditions.CheckState(!configured); + configured = true; + nativeCredentials = GetOrCreateNativeCredentials((ChannelCredentials) state, + () => CreateNativeSslCredentials(rootCertificates, keyCertificatePair, verifyPeerCallback)); + } + + public override void SetCompositeCredentials(object state, ChannelCredentials channelCredentials, CallCredentials callCredentials) + { + GrpcPreconditions.CheckState(!configured); + configured = true; + nativeCredentials = GetOrCreateNativeCredentials((ChannelCredentials) state, + () => CreateNativeCompositeCredentials(channelCredentials, callCredentials)); + } + + private ChannelCredentialsSafeHandle CreateNativeSslCredentials(string rootCertificates, KeyCertificatePair keyCertificatePair, VerifyPeerCallback verifyPeerCallback) + { + IntPtr verifyPeerCallbackTag = IntPtr.Zero; + if (verifyPeerCallback != null) + { + verifyPeerCallbackTag = new VerifyPeerCallbackRegistration(verifyPeerCallback).CallbackRegistration.Tag; + } + return ChannelCredentialsSafeHandle.CreateSslCredentials(rootCertificates, keyCertificatePair, verifyPeerCallbackTag); + } + + private ChannelCredentialsSafeHandle CreateNativeCompositeCredentials(ChannelCredentials channelCredentials, CallCredentials callCredentials) + { + using (var callCreds = callCredentials.ToNativeCredentials()) + { + var nativeComposite = ChannelCredentialsSafeHandle.CreateComposite(channelCredentials.ToNativeCredentials(), callCreds); + if (nativeComposite.IsInvalid) + { + throw new ArgumentException("Error creating native composite credentials. Likely, this is because you are trying to compose incompatible credentials."); + } + return nativeComposite; + } + } + + private ChannelCredentialsSafeHandle GetOrCreateNativeCredentials(ChannelCredentials key, Func nativeCredentialsFactory) + { + Lazy lazyValue; + lock (StaticLock) { + if (!CachedNativeCredentials.TryGetValue(key, out lazyValue)) + { + lazyValue = new Lazy(nativeCredentialsFactory); + CachedNativeCredentials.Add(key, lazyValue); + } + } + return lazyValue.Value; + } + + private class VerifyPeerCallbackRegistration + { + readonly VerifyPeerCallback verifyPeerCallback; + readonly NativeCallbackRegistration callbackRegistration; + + public VerifyPeerCallbackRegistration(VerifyPeerCallback verifyPeerCallback) + { + this.verifyPeerCallback = verifyPeerCallback; + this.callbackRegistration = NativeCallbackDispatcher.RegisterCallback(HandleUniversalCallback); + } + + public NativeCallbackRegistration CallbackRegistration => callbackRegistration; + + private int HandleUniversalCallback(IntPtr arg0, IntPtr arg1, IntPtr arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5) + { + return VerifyPeerCallbackHandler(arg0, arg1, arg2 != IntPtr.Zero); + } + + private int VerifyPeerCallbackHandler(IntPtr targetName, IntPtr peerPem, bool isDestroy) + { + if (isDestroy) + { + this.callbackRegistration.Dispose(); + return 0; + } + + try + { + var context = new VerifyPeerContext(Marshal.PtrToStringAnsi(targetName), Marshal.PtrToStringAnsi(peerPem)); + + return this.verifyPeerCallback(context) ? 0 : 1; + } + catch (Exception e) + { + // eat the exception, we must not throw when inside callback from native code. + Logger.Error(e, "Exception occurred while invoking verify peer callback handler."); + // Return validation failure in case of exception. + return 1; + } + } + } + } + + internal static class ChannelCredentialsExtensions + { + /// + /// Creates native object for the credentials. + /// + /// The native credentials. + public static ChannelCredentialsSafeHandle ToNativeCredentials(this ChannelCredentials credentials) + { + var configurator = new DefaultChannelCredentialsConfigurator(); + credentials.InternalPopulateConfiguration(configurator, credentials); + return configurator.NativeCredentials; + } + } +} diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index fab64354411..5186d2f6dae 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -130,7 +130,7 @@ namespace Math { { /// Creates a new client for Math /// The channel to use to make remote calls. - public MathClient(grpc::Channel channel) : base(channel) + public MathClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for Math that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj index 223c9985ecd..05f7320ad57 100755 --- a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj +++ b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -10,6 +10,7 @@ + diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj index 7e8a8a7de87..391aee81cbc 100755 --- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj +++ b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj @@ -1,4 +1,4 @@ - + @@ -26,7 +26,7 @@ - + None diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 7137b907274..d5051f3b05a 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -102,7 +102,7 @@ namespace Grpc.Health.V1 { { /// Creates a new client for Health /// The channel to use to make remote calls. - public HealthClient(grpc::Channel channel) : base(channel) + public HealthClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for Health that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs index 5b37b144f2a..4a608be318c 100644 --- a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs @@ -148,7 +148,7 @@ namespace Grpc.Testing { { /// Creates a new client for BenchmarkService /// The channel to use to make remote calls. - public BenchmarkServiceClient(grpc::Channel channel) : base(channel) + public BenchmarkServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for BenchmarkService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs index 50c6e159206..30fd6dec542 100644 --- a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs @@ -49,7 +49,7 @@ namespace Grpc.Testing { { /// Creates a new client for EmptyService /// The channel to use to make remote calls. - public EmptyServiceClient(grpc::Channel channel) : base(channel) + public EmptyServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for EmptyService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/Messages.cs b/src/csharp/Grpc.IntegrationTesting/Messages.cs index 3b6c0010222..5c5042b75b6 100644 --- a/src/csharp/Grpc.IntegrationTesting/Messages.cs +++ b/src/csharp/Grpc.IntegrationTesting/Messages.cs @@ -28,41 +28,42 @@ namespace Grpc.Testing { "LnRlc3RpbmciGgoJQm9vbFZhbHVlEg0KBXZhbHVlGAEgASgIIkAKB1BheWxv", "YWQSJwoEdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlwZRIM", "CgRib2R5GAIgASgMIisKCkVjaG9TdGF0dXMSDAoEY29kZRgBIAEoBRIPCgdt", - "ZXNzYWdlGAIgASgJIs4CCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5", + "ZXNzYWdlGAIgASgJIuYCCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5", "cGUYASABKA4yGS5ncnBjLnRlc3RpbmcuUGF5bG9hZFR5cGUSFQoNcmVzcG9u", "c2Vfc2l6ZRgCIAEoBRImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50ZXN0aW5n", "LlBheWxvYWQSFQoNZmlsbF91c2VybmFtZRgEIAEoCBIYChBmaWxsX29hdXRo", "X3Njb3BlGAUgASgIEjQKE3Jlc3BvbnNlX2NvbXByZXNzZWQYBiABKAsyFy5n", "cnBjLnRlc3RpbmcuQm9vbFZhbHVlEjEKD3Jlc3BvbnNlX3N0YXR1cxgHIAEo", "CzIYLmdycGMudGVzdGluZy5FY2hvU3RhdHVzEjIKEWV4cGVjdF9jb21wcmVz", - "c2VkGAggASgLMhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZSJfCg5TaW1wbGVS", - "ZXNwb25zZRImCgdwYXlsb2FkGAEgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxv", - "YWQSEAoIdXNlcm5hbWUYAiABKAkSEwoLb2F1dGhfc2NvcGUYAyABKAkidwoZ", - "U3RyZWFtaW5nSW5wdXRDYWxsUmVxdWVzdBImCgdwYXlsb2FkGAEgASgLMhUu", - "Z3JwYy50ZXN0aW5nLlBheWxvYWQSMgoRZXhwZWN0X2NvbXByZXNzZWQYAiAB", - "KAsyFy5ncnBjLnRlc3RpbmcuQm9vbFZhbHVlIj0KGlN0cmVhbWluZ0lucHV0", - "Q2FsbFJlc3BvbnNlEh8KF2FnZ3JlZ2F0ZWRfcGF5bG9hZF9zaXplGAEgASgF", - "ImQKElJlc3BvbnNlUGFyYW1ldGVycxIMCgRzaXplGAEgASgFEhMKC2ludGVy", - "dmFsX3VzGAIgASgFEisKCmNvbXByZXNzZWQYAyABKAsyFy5ncnBjLnRlc3Rp", - "bmcuQm9vbFZhbHVlIugBChpTdHJlYW1pbmdPdXRwdXRDYWxsUmVxdWVzdBIw", - "Cg1yZXNwb25zZV90eXBlGAEgASgOMhkuZ3JwYy50ZXN0aW5nLlBheWxvYWRU", - "eXBlEj0KE3Jlc3BvbnNlX3BhcmFtZXRlcnMYAiADKAsyIC5ncnBjLnRlc3Rp", - "bmcuUmVzcG9uc2VQYXJhbWV0ZXJzEiYKB3BheWxvYWQYAyABKAsyFS5ncnBj", - "LnRlc3RpbmcuUGF5bG9hZBIxCg9yZXNwb25zZV9zdGF0dXMYByABKAsyGC5n", - "cnBjLnRlc3RpbmcuRWNob1N0YXR1cyJFChtTdHJlYW1pbmdPdXRwdXRDYWxs", - "UmVzcG9uc2USJgoHcGF5bG9hZBgBIAEoCzIVLmdycGMudGVzdGluZy5QYXls", - "b2FkIjMKD1JlY29ubmVjdFBhcmFtcxIgChhtYXhfcmVjb25uZWN0X2JhY2tv", - "ZmZfbXMYASABKAUiMwoNUmVjb25uZWN0SW5mbxIOCgZwYXNzZWQYASABKAgS", - "EgoKYmFja29mZl9tcxgCIAMoBSofCgtQYXlsb2FkVHlwZRIQCgxDT01QUkVT", - "U0FCTEUQAGIGcHJvdG8z")); + "c2VkGAggASgLMhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZRIWCg5maWxsX3Nl", + "cnZlcl9pZBgJIAEoCCJyCg5TaW1wbGVSZXNwb25zZRImCgdwYXlsb2FkGAEg", + "ASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQSEAoIdXNlcm5hbWUYAiABKAkS", + "EwoLb2F1dGhfc2NvcGUYAyABKAkSEQoJc2VydmVyX2lkGAQgASgJIncKGVN0", + "cmVhbWluZ0lucHV0Q2FsbFJlcXVlc3QSJgoHcGF5bG9hZBgBIAEoCzIVLmdy", + "cGMudGVzdGluZy5QYXlsb2FkEjIKEWV4cGVjdF9jb21wcmVzc2VkGAIgASgL", + "MhcuZ3JwYy50ZXN0aW5nLkJvb2xWYWx1ZSI9ChpTdHJlYW1pbmdJbnB1dENh", + "bGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRfc2l6ZRgBIAEoBSJk", + "ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEoBRITCgtpbnRlcnZh", + "bF91cxgCIAEoBRIrCgpjb21wcmVzc2VkGAMgASgLMhcuZ3JwYy50ZXN0aW5n", + "LkJvb2xWYWx1ZSLoAQoaU3RyZWFtaW5nT3V0cHV0Q2FsbFJlcXVlc3QSMAoN", + "cmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlw", + "ZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAuZ3JwYy50ZXN0aW5n", + "LlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50", + "ZXN0aW5nLlBheWxvYWQSMQoPcmVzcG9uc2Vfc3RhdHVzGAcgASgLMhguZ3Jw", + "Yy50ZXN0aW5nLkVjaG9TdGF0dXMiRQobU3RyZWFtaW5nT3V0cHV0Q2FsbFJl", + "c3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9h", + "ZCIzCg9SZWNvbm5lY3RQYXJhbXMSIAoYbWF4X3JlY29ubmVjdF9iYWNrb2Zm", + "X21zGAEgASgFIjMKDVJlY29ubmVjdEluZm8SDgoGcGFzc2VkGAEgASgIEhIK", + "CmJhY2tvZmZfbXMYAiADKAUqHwoLUGF5bG9hZFR5cGUSEAoMQ09NUFJFU1NB", + "QkxFEABiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.PayloadType), }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.BoolValue), global::Grpc.Testing.BoolValue.Parser, new[]{ "Value" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Payload), global::Grpc.Testing.Payload.Parser, new[]{ "Type", "Body" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.EchoStatus), global::Grpc.Testing.EchoStatus.Parser, new[]{ "Code", "Message" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompressed", "ResponseStatus", "ExpectCompressed" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompressed", "ResponseStatus", "ExpectCompressed", "FillServerId" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope", "ServerId" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallRequest), global::Grpc.Testing.StreamingInputCallRequest.Parser, new[]{ "Payload", "ExpectCompressed" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.StreamingInputCallResponse), global::Grpc.Testing.StreamingInputCallResponse.Parser, new[]{ "AggregatedPayloadSize" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ResponseParameters), global::Grpc.Testing.ResponseParameters.Parser, new[]{ "Size", "IntervalUs", "Compressed" }, null, null, null), @@ -589,6 +590,7 @@ namespace Grpc.Testing { responseCompressed_ = other.responseCompressed_ != null ? other.responseCompressed_.Clone() : null; responseStatus_ = other.responseStatus_ != null ? other.responseStatus_.Clone() : null; expectCompressed_ = other.expectCompressed_ != null ? other.expectCompressed_.Clone() : null; + fillServerId_ = other.fillServerId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -713,6 +715,20 @@ namespace Grpc.Testing { } } + /// Field number for the "fill_server_id" field. + public const int FillServerIdFieldNumber = 9; + private bool fillServerId_; + /// + /// Whether SimpleResponse should include server_id. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool FillServerId { + get { return fillServerId_; } + set { + fillServerId_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SimpleRequest); @@ -734,6 +750,7 @@ namespace Grpc.Testing { if (!object.Equals(ResponseCompressed, other.ResponseCompressed)) return false; if (!object.Equals(ResponseStatus, other.ResponseStatus)) return false; if (!object.Equals(ExpectCompressed, other.ExpectCompressed)) return false; + if (FillServerId != other.FillServerId) return false; return Equals(_unknownFields, other._unknownFields); } @@ -748,6 +765,7 @@ namespace Grpc.Testing { if (responseCompressed_ != null) hash ^= ResponseCompressed.GetHashCode(); if (responseStatus_ != null) hash ^= ResponseStatus.GetHashCode(); if (expectCompressed_ != null) hash ^= ExpectCompressed.GetHashCode(); + if (FillServerId != false) hash ^= FillServerId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -793,6 +811,10 @@ namespace Grpc.Testing { output.WriteRawTag(66); output.WriteMessage(ExpectCompressed); } + if (FillServerId != false) { + output.WriteRawTag(72); + output.WriteBool(FillServerId); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -825,6 +847,9 @@ namespace Grpc.Testing { if (expectCompressed_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpectCompressed); } + if (FillServerId != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -872,6 +897,9 @@ namespace Grpc.Testing { } ExpectCompressed.MergeFrom(other.ExpectCompressed); } + if (other.FillServerId != false) { + FillServerId = other.FillServerId; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -927,6 +955,10 @@ namespace Grpc.Testing { input.ReadMessage(ExpectCompressed); break; } + case 72: { + FillServerId = input.ReadBool(); + break; + } } } } @@ -964,6 +996,7 @@ namespace Grpc.Testing { payload_ = other.payload_ != null ? other.payload_.Clone() : null; username_ = other.username_; oauthScope_ = other.oauthScope_; + serverId_ = other.serverId_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1015,6 +1048,21 @@ namespace Grpc.Testing { } } + /// Field number for the "server_id" field. + public const int ServerIdFieldNumber = 4; + private string serverId_ = ""; + /// + /// Server ID. This must be unique among different server instances, + /// but the same across all RPC's made to a particular server instance. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ServerId { + get { return serverId_; } + set { + serverId_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SimpleResponse); @@ -1031,6 +1079,7 @@ namespace Grpc.Testing { if (!object.Equals(Payload, other.Payload)) return false; if (Username != other.Username) return false; if (OauthScope != other.OauthScope) return false; + if (ServerId != other.ServerId) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1040,6 +1089,7 @@ namespace Grpc.Testing { if (payload_ != null) hash ^= Payload.GetHashCode(); if (Username.Length != 0) hash ^= Username.GetHashCode(); if (OauthScope.Length != 0) hash ^= OauthScope.GetHashCode(); + if (ServerId.Length != 0) hash ^= ServerId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1065,6 +1115,10 @@ namespace Grpc.Testing { output.WriteRawTag(26); output.WriteString(OauthScope); } + if (ServerId.Length != 0) { + output.WriteRawTag(34); + output.WriteString(ServerId); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1082,6 +1136,9 @@ namespace Grpc.Testing { if (OauthScope.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(OauthScope); } + if (ServerId.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ServerId); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1105,6 +1162,9 @@ namespace Grpc.Testing { if (other.OauthScope.Length != 0) { OauthScope = other.OauthScope; } + if (other.ServerId.Length != 0) { + ServerId = other.ServerId; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1131,6 +1191,10 @@ namespace Grpc.Testing { OauthScope = input.ReadString(); break; } + case 34: { + ServerId = input.ReadString(); + break; + } } } } diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 9b11e990d2d..fbc3690d2ac 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -92,7 +92,7 @@ namespace Grpc.Testing { { /// Creates a new client for MetricsService /// The channel to use to make remote calls. - public MetricsServiceClient(grpc::Channel channel) : base(channel) + public MetricsServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for MetricsService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs index 1a505ebc764..e35c7c39fd5 100644 --- a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs @@ -67,7 +67,7 @@ namespace Grpc.Testing { { /// Creates a new client for ReportQpsScenarioService /// The channel to use to make remote calls. - public ReportQpsScenarioServiceClient(grpc::Channel channel) : base(channel) + public ReportQpsScenarioServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for ReportQpsScenarioService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index e7b93094c65..f358a6d175c 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -216,7 +216,7 @@ namespace Grpc.Testing { { /// Creates a new client for TestService /// The channel to use to make remote calls. - public TestServiceClient(grpc::Channel channel) : base(channel) + public TestServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for TestService that uses a custom CallInvoker. @@ -602,7 +602,7 @@ namespace Grpc.Testing { { /// Creates a new client for UnimplementedService /// The channel to use to make remote calls. - public UnimplementedServiceClient(grpc::Channel channel) : base(channel) + public UnimplementedServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for UnimplementedService that uses a custom CallInvoker. @@ -741,7 +741,7 @@ namespace Grpc.Testing { { /// Creates a new client for ReconnectService /// The channel to use to make remote calls. - public ReconnectServiceClient(grpc::Channel channel) : base(channel) + public ReconnectServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for ReconnectService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs index 14c26f99a6b..66378081626 100644 --- a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs @@ -138,7 +138,7 @@ namespace Grpc.Testing { { /// Creates a new client for WorkerService /// The channel to use to make remote calls. - public WorkerServiceClient(grpc::Channel channel) : base(channel) + public WorkerServiceClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for WorkerService that uses a custom CallInvoker. diff --git a/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs b/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs index 4953806f6f4..8448f03dd62 100644 --- a/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs +++ b/src/csharp/Grpc.Microbenchmarks/UnaryCallOverheadBenchmark.cs @@ -33,14 +33,28 @@ namespace Grpc.Microbenchmarks public class UnaryCallOverheadBenchmark { private static readonly Task CompletedString = Task.FromResult(""); - private static readonly byte[] EmptyBlob = new byte[0]; - private static readonly Marshaller EmptyMarshaller = new Marshaller(_ => EmptyBlob, _ => ""); - private static readonly Method PingMethod = new Method(MethodType.Unary, nameof(PingBenchmark), "Ping", EmptyMarshaller, EmptyMarshaller); + private static readonly Marshaller IdentityMarshaller = new Marshaller(msg => msg, payload => payload); + private static readonly Method PingMethod = new Method(MethodType.Unary, nameof(PingBenchmark), "Ping", IdentityMarshaller, IdentityMarshaller); + + private int payloadSize; + private byte[] payload; + + // size of payload that is sent as request and received as response. + [Params(0, 1, 10, 100, 1000)] + public int PayloadSize + { + get { return payloadSize; } + set + { + payloadSize = value; + payload = new byte[value]; + } + } [Benchmark] - public string SyncUnaryCallOverhead() + public byte[] SyncUnaryCallOverhead() { - return client.Ping("", new CallOptions()); + return client.Ping(payload, new CallOptions()); } Channel channel; @@ -81,7 +95,7 @@ namespace Grpc.Microbenchmarks { public PingClient(CallInvoker callInvoker) : base(callInvoker) { } - public string Ping(string request, CallOptions options) + public byte[] Ping(byte[] request, CallOptions options) { return CallInvoker.BlockingUnaryCall(PingMethod, null, options, request); } diff --git a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj index ef9d2a1c570..e19020808f7 100755 --- a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj +++ b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -10,6 +10,7 @@ + diff --git a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs index 76f8cfadcfd..b77f245667c 100644 --- a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs +++ b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs @@ -1,4 +1,4 @@ -#region Copyright notice and license +#region Copyright notice and license // Copyright 2015 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj index cf08e58ed65..4dbc8d69390 100755 --- a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj +++ b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj @@ -26,7 +26,7 @@ - + None diff --git a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs index f97b3143a69..fa482eba494 100644 --- a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs +++ b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs @@ -69,7 +69,7 @@ namespace Grpc.Reflection.V1Alpha { { /// Creates a new client for ServerReflection /// The channel to use to make remote calls. - public ServerReflectionClient(grpc::Channel channel) : base(channel) + public ServerReflectionClient(grpc::ChannelBase channel) : base(channel) { } /// Creates a new client for ServerReflection that uses a custom CallInvoker. diff --git a/src/csharp/build/dependencies.props b/src/csharp/build/dependencies.props index a91b5e19414..4f100873bc7 100644 --- a/src/csharp/build/dependencies.props +++ b/src/csharp/build/dependencies.props @@ -1,7 +1,7 @@ - 1.23.0-dev + 2.23.0-dev 3.8.0 diff --git a/src/csharp/build_unitypackage.bat b/src/csharp/build_unitypackage.bat index 06552e8464b..f29bd98b5a2 100644 --- a/src/csharp/build_unitypackage.bat +++ b/src/csharp/build_unitypackage.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.23.0-dev +set VERSION=2.23.0-dev @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe @@ -64,7 +64,6 @@ copy /Y nativelibs\csharp_ext_macos_ios\libgrpc.a unitypackage\unitypackage_skel @rem add gRPC dependencies @rem TODO(jtattermusch): also include XMLdoc -copy /Y Grpc.Core\bin\Release\net45\System.Interactive.Async.dll unitypackage\unitypackage_skeleton\Plugins\System.Interactive.Async\lib\net45\System.Interactive.Async.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Runtime.CompilerServices.Unsafe.dll unitypackage\unitypackage_skeleton\Plugins\System.Runtime.CompilerServices.Unsafe\lib\net45\System.Runtime.CompilerServices.Unsafe.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Buffers.dll unitypackage\unitypackage_skeleton\Plugins\System.Buffers\lib\net45\System.Buffers.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Memory.dll unitypackage\unitypackage_skeleton\Plugins\System.Memory\lib\net45\System.Memory.dll || goto :error diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async.meta deleted file mode 100644 index 6f1b910534d..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: b2ba2199282e9c641bc2e611f1e776a0 -folderAsset: yes -timeCreated: 1531219385 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib.meta deleted file mode 100644 index d7ae012a397..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: bd5ddd2522dc301488ffe002106fe0ab -folderAsset: yes -timeCreated: 1531219385 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45.meta deleted file mode 100644 index 9b1748d3e76..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45.meta +++ /dev/null @@ -1,10 +0,0 @@ -fileFormatVersion: 2 -guid: a68443518bcd1d44ba88a871dcab0c83 -folderAsset: yes -timeCreated: 1531219385 -licenseType: Free -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.dll.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.dll.meta deleted file mode 100644 index bb910fe9229..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.dll.meta +++ /dev/null @@ -1,32 +0,0 @@ -fileFormatVersion: 2 -guid: 4c05e46cbf00c68408f5ddc1eef9ae3b -timeCreated: 1531219386 -licenseType: Free -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.xml.meta b/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.xml.meta deleted file mode 100644 index 53f91502bd6..00000000000 --- a/src/csharp/unitypackage/unitypackage_skeleton/Plugins/System.Interactive.Async/lib/net45/System.Interactive.Async.xml.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6fc38864f2d3dde46b3833c62c91a008 -timeCreated: 1531219386 -licenseType: Free -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec new file mode 100644 index 00000000000..dc1f8b2c090 --- /dev/null +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -0,0 +1,125 @@ +# This file has been automatically generated from a template file. +# Please make modifications to +# `templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template` +# instead. This file can be regenerated from the template by running +# `tools/buildgen/generate_projects.sh`. + +# CocoaPods podspec for the gRPC Proto Compiler Plugin +# +# Copyright 2019, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Pod::Spec.new do |s| + # This pod is only a utility that will be used by other pods _at install time_ (not at compile + # time). Other pods can access it in their `prepare_command` script, under /. + # Because CocoaPods installs pods in alphabetical order, beginning this pod's name with an + # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed + # before them. + s.name = '!ProtoCompiler-gRPCCppPlugin' + v = '1.23.0-dev' + s.version = v + s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' + s.description = <<-DESC + This podspec only downloads the gRPC protoc plugin so that local pods generating protos can use + it in their invocation of protoc, as part of their prepare_command. + DESC + s.homepage = 'https://grpc.io' + s.license = { + :type => 'Apache License, Version 2.0', + :text => <<-LICENSE + Copyright 2019, Google Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + LICENSE + } + s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } + + repo = 'grpc/grpc' + file = "grpc_cpp_plugin-#{v}-macos-x86_64.zip" + s.source = { + :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}", + # TODO(jcanizales): Add sha1 or sha256 + # :sha1 => '??', + } + + repo_root = '../..' + plugin = 'grpc_cpp_plugin' + + s.preserve_paths = plugin + + # Restrict the protoc version to the one supported by this plugin. + s.dependency '!ProtoCompiler', '3.8.0' + # For the Protobuf dependency not to complain: + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '2.0' + + # This is only for local development of the plugin: If the Podfile brings this pod from a local + # directory using `:path`, CocoaPods won't download the zip file and so the plugin won't be + # present in this pod's directory. We use that knowledge to check for the existence of the file + # and, if absent, compile the plugin from the local sources. + s.prepare_command = <<-CMD + if [ ! -f #{plugin} ]; then + cd #{repo_root} + # This will build the plugin and put it in #{repo_root}/bins/opt. + # + # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and + # library binary) if found, which _we do not want_. Find a way for this to always use the + # sources in the repo. + make #{plugin} + cd - + fi + CMD +end diff --git a/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m b/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m index 9da6dedbf9e..ac6ce6752d9 100644 --- a/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m +++ b/src/objective-c/examples/InterceptorSample/InterceptorSample/ViewController.m @@ -19,8 +19,13 @@ #import "ViewController.h" #import +#if USE_FRAMEWORKS #import #import +#else +#import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" +#endif #import "CacheInterceptor.h" diff --git a/src/objective-c/examples/InterceptorSample/Podfile b/src/objective-c/examples/InterceptorSample/Podfile index b20813d32aa..0252451eff9 100644 --- a/src/objective-c/examples/InterceptorSample/Podfile +++ b/src/objective-c/examples/InterceptorSample/Podfile @@ -2,6 +2,11 @@ platform :ios, '8.0' install! 'cocoapods', :deterministic_uuids => false +# Default to use framework, so that providing no 'FRAMEWORK' env parameter works consistently +# for all Samples, specifically because Swift only supports framework. +# Only effective for examples/ +use_frameworks! if ENV['FRAMEWORKS'] != 'NO' + ROOT_DIR = '../../../..' target 'InterceptorSample' do diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec index 63c6ba4ad5c..e3dbf4fe7ef 100644 --- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec @@ -22,25 +22,42 @@ Pod::Spec.new do |s| well_known_types_dir = "#{repo_root}/third_party/protobuf/src" plugin = "#{bin_dir}/grpc_objective_c_plugin" - s.prepare_command = <<-CMD - #{protoc} \ - --plugin=protoc-gen-grpc=#{plugin} \ - --objc_out=. \ - --grpc_out=. \ - -I . \ - -I #{well_known_types_dir} \ - *.proto - CMD + # Since we switched to importing full path, -I needs to be set to the directory + # from which the imported file can be found, which is the grpc's root here + if ENV['FRAMEWORKS'] != 'NO' then + s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' } + s.prepare_command = <<-CMD + # Cannot find file if using *.proto. Maybe files' paths must match the -I flags + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --objc_out=. \ + --grpc_out=generate_for_named_framework=#{s.name}:. \ + --objc_opt=generate_for_named_framework=#{s.name} \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto + CMD + else + s.prepare_command = <<-CMD + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --objc_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{well_known_types_dir} \ + #{repo_root}/src/objective-c/examples/RemoteTestClient/*.proto + CMD + end s.subspec 'Messages' do |ms| - ms.source_files = '*.pbobjc.{h,m}' + ms.source_files = 'src/objective-c/examples/RemoteTestClient/*.pbobjc.{h,m}' ms.header_mappings_dir = '.' ms.requires_arc = false ms.dependency 'Protobuf' end s.subspec 'Services' do |ss| - ss.source_files = '*.pbrpc.{h,m}' + ss.source_files = 'src/objective-c/examples/RemoteTestClient/*.pbrpc.{h,m}' ss.header_mappings_dir = '.' ss.requires_arc = true ss.dependency 'gRPC-ProtoRPC' @@ -53,4 +70,5 @@ Pod::Spec.new do |s| # This is needed by all pods that depend on gRPC-RxLibrary: 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', } + end diff --git a/src/objective-c/examples/RemoteTestClient/test.proto b/src/objective-c/examples/RemoteTestClient/test.proto index c5696043630..8c91f7d9f2e 100644 --- a/src/objective-c/examples/RemoteTestClient/test.proto +++ b/src/objective-c/examples/RemoteTestClient/test.proto @@ -17,7 +17,7 @@ syntax = "proto3"; import "google/protobuf/empty.proto"; -import "messages.proto"; +import "src/objective-c/examples/RemoteTestClient/messages.proto"; package grpc.testing; diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index bebd55bd628..e7ee700cb17 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -3,7 +3,10 @@ platform :ios, '8.0' install! 'cocoapods', :deterministic_uuids => false -use_frameworks! if ENV['FRAMEWORKS'] == 'YES' +# Default to use framework, so that providing no 'FRAMEWORK' env parameter works consistently +# for all Samples, specifically because Swift only supports framework. +# Only effective for examples/ +use_frameworks! if ENV['FRAMEWORKS'] != 'NO' # Location of gRPC's repo root relative to this file. GRPC_LOCAL_SRC = '../../../..' diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 9bcb002027b..e4f3712d72d 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -20,8 +20,13 @@ #import #import +#if USE_FRAMEWORKS #import #import +#else +#import "src/objective-c/examples/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/examples/RemoteTestClient/Test.pbrpc.h" +#endif #import #import diff --git a/src/objective-c/tests/InteropTests/InteropTests.m b/src/objective-c/tests/InteropTests/InteropTests.m index 3260e918f2f..c13dd1e2b35 100644 --- a/src/objective-c/tests/InteropTests/InteropTests.m +++ b/src/objective-c/tests/InteropTests/InteropTests.m @@ -30,13 +30,13 @@ #import #import #import -#import -#import -#import #import #import #import #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" diff --git a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m index 14ba2871aa2..a2a3e64b1b1 100644 --- a/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m +++ b/src/objective-c/tests/InteropTests/InteropTestsMultipleChannels.m @@ -21,10 +21,10 @@ #ifdef GRPC_COMPILE_WITH_CRONET #import #endif -#import -#import -#import #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #import "../ConfigureCronet.h" #import "InteropTestsBlockCallbacks.h" diff --git a/src/objective-c/tests/MacTests/StressTests.m b/src/objective-c/tests/MacTests/StressTests.m index 3c6ecd52610..c7020740eac 100644 --- a/src/objective-c/tests/MacTests/StressTests.m +++ b/src/objective-c/tests/MacTests/StressTests.m @@ -21,13 +21,13 @@ #import #import #import -#import -#import -#import #import #import #import #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbobjc.h" +#import "src/objective-c/tests/RemoteTestClient/Test.pbrpc.h" #define TEST_TIMEOUT 32 diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec index be8fce9993b..d772163e117 100644 --- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec @@ -29,9 +29,9 @@ Pod::Spec.new do |s| --plugin=protoc-gen-grpc=#{plugin} \ --objc_out=. \ --grpc_out=. \ - -I . \ + -I #{repo_root} \ -I #{well_known_types_dir} \ - *.proto + #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto else # protoc was not found bin_dir, use installed version instead (>&2 echo "\nWARNING: Using installed version of protoc. It might be incompatible with gRPC") @@ -40,21 +40,21 @@ Pod::Spec.new do |s| --plugin=protoc-gen-grpc=#{plugin} \ --objc_out=. \ --grpc_out=. \ - -I . \ + -I #{repo_root} \ -I #{well_known_types_dir} \ - *.proto + #{repo_root}/src/objective-c/tests/RemoteTestClient/*.proto fi CMD s.subspec "Messages" do |ms| - ms.source_files = "*.pbobjc.{h,m}" + ms.source_files = "src/objective-c/tests/RemoteTestClient/*.pbobjc.{h,m}" ms.header_mappings_dir = "." ms.requires_arc = false ms.dependency "Protobuf" end s.subspec "Services" do |ss| - ss.source_files = "*.pbrpc.{h,m}" + ss.source_files = "src/objective-c/tests/RemoteTestClient/*.pbrpc.{h,m}" ss.header_mappings_dir = "." ss.requires_arc = true ss.dependency "gRPC-ProtoRPC" diff --git a/src/objective-c/tests/RemoteTestClient/test.proto b/src/objective-c/tests/RemoteTestClient/test.proto index c5696043630..6931600edc0 100644 --- a/src/objective-c/tests/RemoteTestClient/test.proto +++ b/src/objective-c/tests/RemoteTestClient/test.proto @@ -17,7 +17,7 @@ syntax = "proto3"; import "google/protobuf/empty.proto"; -import "messages.proto"; +import "src/objective-c/tests/RemoteTestClient/messages.proto"; package grpc.testing; diff --git a/src/objective-c/tests/UnitTests/APIv2Tests.m b/src/objective-c/tests/UnitTests/APIv2Tests.m index db293750ca3..86d4e8b3619 100644 --- a/src/objective-c/tests/UnitTests/APIv2Tests.m +++ b/src/objective-c/tests/UnitTests/APIv2Tests.m @@ -18,8 +18,8 @@ #import #import -#import #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #include #include diff --git a/src/objective-c/tests/UnitTests/GRPCClientTests.m b/src/objective-c/tests/UnitTests/GRPCClientTests.m index bcd87c17b78..3d144c33b06 100644 --- a/src/objective-c/tests/UnitTests/GRPCClientTests.m +++ b/src/objective-c/tests/UnitTests/GRPCClientTests.m @@ -26,10 +26,10 @@ #import #import #import -#import #import #import #import +#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h" #include diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh index a78dd259e2f..31506c58936 100755 --- a/src/php/bin/run_tests.sh +++ b/src/php/bin/run_tests.sh @@ -25,8 +25,18 @@ export DYLD_LIBRARY_PATH=$root/libs/$CONFIG $(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ --exclude-group persistent_list_bound_tests ../tests/unit_tests -$(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ - ../tests/unit_tests/PersistentChannelTests +for arg in "$@" +do + if [[ "$arg" == "--skip-persistent-channel-tests" ]]; then + SKIP_PERSISTENT_CHANNEL_TESTS=true + break + fi +done + +if [[ "$SKIP_PERSISTENT_CHANNEL_TESTS" != "true" ]]; then + $(which php) $extension_dir -d max_execution_time=300 $(which phpunit) -v --debug \ + ../tests/unit_tests/PersistentChannelTests +fi export ZEND_DONT_UNLOAD_MODULES=1 export USE_ZEND_ALLOC=0 diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index 860d38be34a..8551ba2c196 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -330,6 +330,7 @@ PHP_METHOD(Channel, __construct) { 1 TSRMLS_CC); return; } else { + Z_ADDREF(*creds_obj); creds = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_channel_credentials, creds_obj); php_grpc_zend_hash_del(array_hash, "credentials", sizeof("credentials")); diff --git a/src/php/tests/unit_tests/ChannelTest.php b/src/php/tests/unit_tests/ChannelTest.php index 583c618d32a..58f96a740b6 100644 --- a/src/php/tests/unit_tests/ChannelTest.php +++ b/src/php/tests/unit_tests/ChannelTest.php @@ -37,6 +37,12 @@ class ChannelTest extends PHPUnit_Framework_TestCase $this->assertSame('Grpc\Channel', get_class($this->channel)); } + public function testConstructorCreateSsl() + { + new Grpc\Channel('localhost:50033', + ['credentials' => \Grpc\ChannelCredentials::createSsl()]); + } + public function testGetConnectivityState() { $this->channel = new Grpc\Channel('localhost:50001', diff --git a/src/proto/gen_build_yaml.py b/src/proto/gen_build_yaml.py index 1a935b56d89..fc1b5f7986e 100755 --- a/src/proto/gen_build_yaml.py +++ b/src/proto/gen_build_yaml.py @@ -15,6 +15,7 @@ """Generates the appropriate build.json data for all the proto files.""" +from __future__ import print_function import yaml import collections import os @@ -36,6 +37,10 @@ def update_deps(key, proto_filename, deps, deps_external, is_trans, visited): deps_external[key] = [] deps_external[key].append(imp_proto[:-6]) continue + # In case that the path is changed by copybara, + # revert the change to avoid file error. + if imp_proto.startswith('third_party/grpc'): + imp_proto = imp_proto[17:] if key not in deps: deps[key] = [] deps[key].append(imp_proto[:-6]) if is_trans: @@ -66,7 +71,7 @@ def main(): 'proto_transitive_external_deps': deps_external_trans } - print yaml.dump(json) + print(yaml.dump(json)) if __name__ == '__main__': main() diff --git a/src/proto/grpc/channelz/BUILD b/src/proto/grpc/channelz/BUILD index 1d80ec23af1..cfc8531de1b 100644 --- a/src/proto/grpc/channelz/BUILD +++ b/src/proto/grpc/channelz/BUILD @@ -28,6 +28,12 @@ grpc_proto_library( proto_library( name = "channelz_proto_descriptors", srcs = ["channelz.proto"], + deps = [ + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:wrappers_proto", + ], ) filegroup( diff --git a/src/proto/grpc/channelz/channelz.proto b/src/proto/grpc/channelz/channelz.proto index 20de23f7fa3..f0b3b10837e 100644 --- a/src/proto/grpc/channelz/channelz.proto +++ b/src/proto/grpc/channelz/channelz.proto @@ -165,7 +165,7 @@ message ChannelRef { reserved 3, 4, 5, 6, 7, 8; } -// ChannelRef is a reference to a Subchannel. +// SubchannelRef is a reference to a Subchannel. message SubchannelRef { // The globally unique id for this subchannel. Must be a positive number. int64 subchannel_id = 7; diff --git a/src/proto/grpc/gcp/BUILD b/src/proto/grpc/gcp/BUILD new file mode 100644 index 00000000000..1c22d89e464 --- /dev/null +++ b/src/proto/grpc/gcp/BUILD @@ -0,0 +1,25 @@ +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) # Apache v2 + +proto_library( + name = "alts_handshaker_proto", + srcs = [ + "altscontext.proto", + "handshaker.proto", + "transport_security_common.proto", + ], + visibility = ["//visibility:public"], +) diff --git a/src/proto/grpc/gcp/altscontext.proto b/src/proto/grpc/gcp/altscontext.proto new file mode 100644 index 00000000000..cce6dd2afc5 --- /dev/null +++ b/src/proto/grpc/gcp/altscontext.proto @@ -0,0 +1,50 @@ +// Copyright 2018 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/gcp/altscontext.proto + +syntax = "proto3"; + +package grpc.gcp; + +import "src/proto/grpc/gcp/transport_security_common.proto"; + +option go_package = "google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp"; +option java_multiple_files = true; +option java_outer_classname = "AltsContextProto"; +option java_package = "io.grpc.alts.internal"; + +message AltsContext { + // The application protocol negotiated for this connection. + string application_protocol = 1; + + // The record protocol negotiated for this connection. + string record_protocol = 2; + + // The security level of the created secure channel. + SecurityLevel security_level = 3; + + // The peer service account. + string peer_service_account = 4; + + // The local service account. + string local_service_account = 5; + + // The RPC protocol versions supported by the peer. + RpcProtocolVersions peer_rpc_versions = 6; + + // Additional attributes of the peer. + map peer_attributes = 7; +} diff --git a/src/proto/grpc/gcp/handshaker.proto b/src/proto/grpc/gcp/handshaker.proto new file mode 100644 index 00000000000..702945f5795 --- /dev/null +++ b/src/proto/grpc/gcp/handshaker.proto @@ -0,0 +1,234 @@ +// Copyright 2018 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/gcp/handshaker.proto + +syntax = "proto3"; + +package grpc.gcp; + +import "src/proto/grpc/gcp/transport_security_common.proto"; + +option go_package = "google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp"; +option java_multiple_files = true; +option java_outer_classname = "HandshakerProto"; +option java_package = "io.grpc.alts.internal"; + + +enum HandshakeProtocol { + // Default value. + HANDSHAKE_PROTOCOL_UNSPECIFIED = 0; + + // TLS handshake protocol. + TLS = 1; + + // Application Layer Transport Security handshake protocol. + ALTS = 2; +} + +enum NetworkProtocol { + NETWORK_PROTOCOL_UNSPECIFIED = 0; + TCP = 1; + UDP = 2; +} + +message Endpoint { + // IP address. It should contain an IPv4 or IPv6 string literal, e.g. + // "192.168.0.1" or "2001:db8::1". + string ip_address = 1; + + // Port number. + int32 port = 2; + + // Network protocol (e.g., TCP, UDP) associated with this endpoint. + NetworkProtocol protocol = 3; +} + +message Identity { + oneof identity_oneof { + // Service account of a connection endpoint. + string service_account = 1; + + // Hostname of a connection endpoint. + string hostname = 2; + } + + // Additional attributes of the identity. + map attributes = 3; +} + +message StartClientHandshakeReq { + // Handshake security protocol requested by the client. + HandshakeProtocol handshake_security_protocol = 1; + + // The application protocols supported by the client, e.g., "h2" (for http2), + // "grpc". + repeated string application_protocols = 2; + + // The record protocols supported by the client, e.g., + // "ALTSRP_GCM_AES128". + repeated string record_protocols = 3; + + // (Optional) Describes which server identities are acceptable by the client. + // If target identities are provided and none of them matches the peer + // identity of the server, handshake will fail. + repeated Identity target_identities = 4; + + // (Optional) Application may specify a local identity. Otherwise, the + // handshaker chooses a default local identity. + Identity local_identity = 5; + + // (Optional) Local endpoint information of the connection to the server, + // such as local IP address, port number, and network protocol. + Endpoint local_endpoint = 6; + + // (Optional) Endpoint information of the remote server, such as IP address, + // port number, and network protocol. + Endpoint remote_endpoint = 7; + + // (Optional) If target name is provided, a secure naming check is performed + // to verify that the peer authenticated identity is indeed authorized to run + // the target name. + string target_name = 8; + + // (Optional) RPC protocol versions supported by the client. + RpcProtocolVersions rpc_versions = 9; +} + +message ServerHandshakeParameters { + // The record protocols supported by the server, e.g., + // "ALTSRP_GCM_AES128". + repeated string record_protocols = 1; + + // (Optional) A list of local identities supported by the server, if + // specified. Otherwise, the handshaker chooses a default local identity. + repeated Identity local_identities = 2; +} + +message StartServerHandshakeReq { + // The application protocols supported by the server, e.g., "h2" (for http2), + // "grpc". + repeated string application_protocols = 1; + + // Handshake parameters (record protocols and local identities supported by + // the server) mapped by the handshake protocol. Each handshake security + // protocol (e.g., TLS or ALTS) has its own set of record protocols and local + // identities. Since protobuf does not support enum as key to the map, the key + // to handshake_parameters is the integer value of HandshakeProtocol enum. + map handshake_parameters = 2; + + // Bytes in out_frames returned from the peer's HandshakerResp. It is possible + // that the peer's out_frames are split into multiple HandshakReq messages. + bytes in_bytes = 3; + + // (Optional) Local endpoint information of the connection to the client, + // such as local IP address, port number, and network protocol. + Endpoint local_endpoint = 4; + + // (Optional) Endpoint information of the remote client, such as IP address, + // port number, and network protocol. + Endpoint remote_endpoint = 5; + + // (Optional) RPC protocol versions supported by the server. + RpcProtocolVersions rpc_versions = 6; +} + +message NextHandshakeMessageReq { + // Bytes in out_frames returned from the peer's HandshakerResp. It is possible + // that the peer's out_frames are split into multiple NextHandshakerMessageReq + // messages. + bytes in_bytes = 1; +} + +message HandshakerReq { + oneof req_oneof { + // The start client handshake request message. + StartClientHandshakeReq client_start = 1; + + // The start server handshake request message. + StartServerHandshakeReq server_start = 2; + + // The next handshake request message. + NextHandshakeMessageReq next = 3; + } +} + +message HandshakerResult { + // The application protocol negotiated for this connection. + string application_protocol = 1; + + // The record protocol negotiated for this connection. + string record_protocol = 2; + + // Cryptographic key data. The key data may be more than the key length + // required for the record protocol, thus the client of the handshaker + // service needs to truncate the key data into the right key length. + bytes key_data = 3; + + // The authenticated identity of the peer. + Identity peer_identity = 4; + + // The local identity used in the handshake. + Identity local_identity = 5; + + // Indicate whether the handshaker service client should keep the channel + // between the handshaker service open, e.g., in order to handle + // post-handshake messages in the future. + bool keep_channel_open = 6; + + // The RPC protocol versions supported by the peer. + RpcProtocolVersions peer_rpc_versions = 7; +} + +message HandshakerStatus { + // The status code. This could be the gRPC status code. + uint32 code = 1; + + // The status details. + string details = 2; +} + +message HandshakerResp { + // Frames to be given to the peer for the NextHandshakeMessageReq. May be + // empty if no out_frames have to be sent to the peer or if in_bytes in the + // HandshakerReq are incomplete. All the non-empty out frames must be sent to + // the peer even if the handshaker status is not OK as these frames may + // contain the alert frames. + bytes out_frames = 1; + + // Number of bytes in the in_bytes consumed by the handshaker. It is possible + // that part of in_bytes in HandshakerReq was unrelated to the handshake + // process. + uint32 bytes_consumed = 2; + + // This is set iff the handshake was successful. out_frames may still be set + // to frames that needs to be forwarded to the peer. + HandshakerResult result = 3; + + // Status of the handshaker. + HandshakerStatus status = 4; +} + +service HandshakerService { + // Handshaker service accepts a stream of handshaker request, returning a + // stream of handshaker response. Client is expected to send exactly one + // message with either client_start or server_start followed by one or more + // messages with next. Each time client sends a request, the handshaker + // service expects to respond. Client does not have to wait for service's + // response before sending next request. + rpc DoHandshake(stream HandshakerReq) + returns (stream HandshakerResp) { + } +} diff --git a/src/proto/grpc/gcp/transport_security_common.proto b/src/proto/grpc/gcp/transport_security_common.proto new file mode 100644 index 00000000000..8f01be79e36 --- /dev/null +++ b/src/proto/grpc/gcp/transport_security_common.proto @@ -0,0 +1,46 @@ +// Copyright 2018 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/gcp/transport_security_common.proto + +syntax = "proto3"; + +package grpc.gcp; + +option go_package = "google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp"; +option java_multiple_files = true; +option java_outer_classname = "TransportSecurityCommonProto"; +option java_package = "io.grpc.alts.internal"; + +// The security level of the created channel. The list is sorted in increasing +// level of security. This order must always be maintained. +enum SecurityLevel { + SECURITY_NONE = 0; + INTEGRITY_ONLY = 1; + INTEGRITY_AND_PRIVACY = 2; +} + +// Max and min supported RPC protocol versions. +message RpcProtocolVersions { + // RPC version contains a major version and a minor version. + message Version { + uint32 major = 1; + uint32 minor = 2; + } + // Maximum supported RPC version. + Version max_rpc_version = 1; + // Minimum supported RPC version. + Version min_rpc_version = 2; +} diff --git a/src/proto/grpc/lb/v1/BUILD b/src/proto/grpc/lb/v1/BUILD index fd01f847fd5..2a6e82a57e7 100644 --- a/src/proto/grpc/lb/v1/BUILD +++ b/src/proto/grpc/lb/v1/BUILD @@ -29,6 +29,15 @@ grpc_proto_library( well_known_protos = True, ) +proto_library( + name = "load_balancer_proto_descriptor", + srcs = ["load_balancer.proto"], + deps = [ + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + grpc_proto_library( name = "load_reporter_proto", srcs = ["load_reporter.proto"], diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 6a8b208b914..aab3768b02e 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -391,6 +391,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc', 'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc', 'src/core/ext/filters/census/grpc_context.cc', + 'src/core/ext/filters/client_idle/client_idle_filter.cc', 'src/core/ext/filters/max_age/max_age_filter.cc', 'src/core/ext/filters/message_size/message_size_filter.cc', 'src/core/ext/filters/http/client_authority_filter.cc', diff --git a/src/python/grpcio_status/grpc_status/rpc_status.py b/src/python/grpcio_status/grpc_status/rpc_status.py index 76891e2422e..4e424e1394b 100644 --- a/src/python/grpcio_status/grpc_status/rpc_status.py +++ b/src/python/grpcio_status/grpc_status/rpc_status.py @@ -52,6 +52,8 @@ def from_call(call): ValueError: If the gRPC call's code or details are inconsistent with the status code and message inside of the google.rpc.status.Status. """ + if call.trailing_metadata() is None: + return None for key, value in call.trailing_metadata(): if key == _GRPC_DETAILS_METADATA_KEY: rich_status = status_pb2.Status.FromString(value) diff --git a/src/upb/gen_build_yaml.py b/src/upb/gen_build_yaml.py index 8b726d374a3..181d026fbd2 100755 --- a/src/upb/gen_build_yaml.py +++ b/src/upb/gen_build_yaml.py @@ -22,7 +22,7 @@ import sys import yaml srcs = [ - "third_party/upb/google/protobuf/descriptor.upb.c", + "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.c", "third_party/upb/upb/decode.c", "third_party/upb/upb/def.c", "third_party/upb/upb/encode.c", @@ -35,7 +35,7 @@ srcs = [ ] hdrs = [ - "third_party/upb/google/protobuf/descriptor.upb.h", + "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.h", "third_party/upb/upb/decode.h", "third_party/upb/upb/def.h", "third_party/upb/upb/encode.h", diff --git a/templates/Makefile.template b/templates/Makefile.template index 18132b0db13..a46a27061ab 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -240,7 +240,7 @@ LDFLAGS += -fPIC endif - INCLUDES = . include $(GENDIR) + INCLUDES = . include $(GENDIR) third_party/upb third_party/upb/generated_for_cmake LDFLAGS += -Llibs/$(CONFIG) ifeq ($(SYSTEM),Darwin) diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index 40368e422d9..9ecdf80143e 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -28,6 +28,13 @@ if lib.name in expect_libs: for group in groups: out += lib.get(group, []) + # Add cronet-related files manually since they're not in BUILD.yaml. + if "grpc++" in expect_libs: + if "public_headers" in groups: + out += ["include/grpcpp/security/cronet_credentials.h", + "include/grpcpp/security/cronet_credentials_impl.h"] + if "src" in groups: + out += ["src/cpp/client/cronet_credentials.cc"] return out def filter_grpcpp(files): @@ -65,7 +72,6 @@ out += [file for file in grpc_private_headers(libs) if not file.startswith("third_party/nanopb/")] out = filter_grpcpp(out) - return out def grpcpp_private_headers(libs, filegroups): diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index b838e86413a..968e0273adf 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -47,7 +47,7 @@ excl = grpc_private_files(libs) excl += [ # We do not need cronet dedicated plugin registry - "src/core/plugin_registry/grpc_cronet_plugin_registry.cc", + "src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc", # We do not need dummy cronet API for ObjC "src/core/ext/transport/cronet/transport/cronet_api_dummy.cc", ] diff --git a/templates/src/csharp/Grpc.Core.Api/VersionInfo.cs.template b/templates/src/csharp/Grpc.Core.Api/VersionInfo.cs.template index e94f8c296b6..a9b59a227fe 100644 --- a/templates/src/csharp/Grpc.Core.Api/VersionInfo.cs.template +++ b/templates/src/csharp/Grpc.Core.Api/VersionInfo.cs.template @@ -30,12 +30,12 @@ /// /// Current AssemblyVersion attribute of gRPC C# assemblies /// - public const string CurrentAssemblyVersion = "1.0.0.0"; + public const string CurrentAssemblyVersion = "${settings.csharp_version.major}.0.0.0"; /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "${settings.version.major}.${settings.version.minor}.${settings.version.patch}.0"; + public const string CurrentAssemblyFileVersion = "${settings.csharp_version.major}.${settings.csharp_version.minor}.${settings.csharp_version.patch}.0"; /// /// Current version of gRPC C# diff --git a/templates/src/csharp/build_unitypackage.bat.template b/templates/src/csharp/build_unitypackage.bat.template index 07f19c2af3e..2dbb22a0d17 100755 --- a/templates/src/csharp/build_unitypackage.bat.template +++ b/templates/src/csharp/build_unitypackage.bat.template @@ -66,7 +66,6 @@ @rem add gRPC dependencies @rem TODO(jtattermusch): also include XMLdoc - copy /Y Grpc.Core\bin\Release\net45\System.Interactive.Async.dll unitypackage\unitypackage_skeleton\Plugins\System.Interactive.Async\lib\net45\System.Interactive.Async.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Runtime.CompilerServices.Unsafe.dll unitypackage\unitypackage_skeleton\Plugins\System.Runtime.CompilerServices.Unsafe\lib\net45\System.Runtime.CompilerServices.Unsafe.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Buffers.dll unitypackage\unitypackage_skeleton\Plugins\System.Buffers\lib\net45\System.Buffers.dll || goto :error copy /Y Grpc.Core\bin\Release\net45\System.Memory.dll unitypackage\unitypackage_skeleton\Plugins\System.Memory\lib\net45\System.Memory.dll || goto :error diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template new file mode 100644 index 00000000000..259a5c54f24 --- /dev/null +++ b/templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template @@ -0,0 +1,127 @@ +%YAML 1.2 +--- | + # This file has been automatically generated from a template file. + # Please make modifications to + # `templates/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec.template` + # instead. This file can be regenerated from the template by running + # `tools/buildgen/generate_projects.sh`. + + # CocoaPods podspec for the gRPC Proto Compiler Plugin + # + # Copyright 2019, Google Inc. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # * Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following disclaimer + # in the documentation and/or other materials provided with the + # distribution. + # * Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Pod::Spec.new do |s| + # This pod is only a utility that will be used by other pods _at install time_ (not at compile + # time). Other pods can access it in their `prepare_command` script, under /. + # Because CocoaPods installs pods in alphabetical order, beginning this pod's name with an + # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed + # before them. + s.name = '!ProtoCompiler-gRPCCppPlugin' + v = '${settings.version}' + s.version = v + s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' + s.description = <<-DESC + This podspec only downloads the gRPC protoc plugin so that local pods generating protos can use + it in their invocation of protoc, as part of their prepare_command. + DESC + s.homepage = 'https://grpc.io' + s.license = { + :type => 'Apache License, Version 2.0', + :text => <<-LICENSE + Copyright 2019, Google Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + LICENSE + } + s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } + + repo = 'grpc/grpc' + file = "grpc_cpp_plugin-#{v}-macos-x86_64.zip" + s.source = { + :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}", + # TODO(jcanizales): Add sha1 or sha256 + # :sha1 => '??', + } + + repo_root = '../..' + plugin = 'grpc_cpp_plugin' + + s.preserve_paths = plugin + + # Restrict the protoc version to the one supported by this plugin. + s.dependency '!ProtoCompiler', '3.8.0' + # For the Protobuf dependency not to complain: + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '10.0' + s.watchos.deployment_target = '2.0' + + # This is only for local development of the plugin: If the Podfile brings this pod from a local + # directory using `:path`, CocoaPods won't download the zip file and so the plugin won't be + # present in this pod's directory. We use that knowledge to check for the existence of the file + # and, if absent, compile the plugin from the local sources. + s.prepare_command = <<-CMD + if [ ! -f #{plugin} ]; then + cd #{repo_root} + # This will build the plugin and put it in #{repo_root}/bins/opt. + # + # TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and + # library binary) if found, which _we do not want_. Find a way for this to always use the + # sources in the repo. + make #{plugin} + cd - + fi + CMD + end diff --git a/templates/test/core/surface/public_headers_must_be_c89.c.template b/templates/test/core/surface/public_headers_must_be_c89.c.template index 6e4a83666e6..dde5c81e1ce 100644 --- a/templates/test/core/surface/public_headers_must_be_c89.c.template +++ b/templates/test/core/surface/public_headers_must_be_c89.c.template @@ -25,13 +25,15 @@ if platform_identifier in hdr: return True return False + def is_cronet_header(hdr): + return "cronet" in hdr hdrs = set() pfx = 'include/' for lib in libs: if lib.language != 'c': continue for hdr in lib.get('public_headers', []): if is_platform_header(hdr): continue - if 'grpc_cronet.h' in hdr: continue + if is_cronet_header(hdr): continue assert(hdr[0:len(pfx)] == pfx) hdrs.add(hdr[len(pfx):]) hdrs = sorted(list(hdrs)) diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channel/channelz_registry_test.cc index deb85d85624..995182da249 100644 --- a/test/core/channel/channelz_registry_test.cc +++ b/test/core/channel/channelz_registry_test.cc @@ -53,7 +53,7 @@ class ChannelzRegistryTest : public ::testing::Test { TEST_F(ChannelzRegistryTest, UuidStartsAboveZeroTest) { RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel); + MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); intptr_t uuid = channelz_channel->uuid(); EXPECT_GT(uuid, 0) << "First uuid chose must be greater than zero. Zero if " "reserved according to " @@ -65,8 +65,8 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { std::vector> channelz_channels; channelz_channels.reserve(10); for (int i = 0; i < 10; ++i) { - channelz_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); + channelz_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); } for (size_t i = 1; i < channelz_channels.size(); ++i) { EXPECT_LT(channelz_channels[i - 1]->uuid(), channelz_channels[i]->uuid()) @@ -76,7 +76,7 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { TEST_F(ChannelzRegistryTest, RegisterGetTest) { RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel); + MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); RefCountedPtr retrieved = ChannelzRegistry::Get(channelz_channel->uuid()); EXPECT_EQ(channelz_channel, retrieved); @@ -85,8 +85,8 @@ TEST_F(ChannelzRegistryTest, RegisterGetTest) { TEST_F(ChannelzRegistryTest, RegisterManyItems) { std::vector> channelz_channels; for (int i = 0; i < 100; i++) { - channelz_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); + channelz_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); RefCountedPtr retrieved = ChannelzRegistry::Get(channelz_channels[i]->uuid()); EXPECT_EQ(channelz_channels[i], retrieved); @@ -95,7 +95,7 @@ TEST_F(ChannelzRegistryTest, RegisterManyItems) { TEST_F(ChannelzRegistryTest, NullIfNotPresentTest) { RefCountedPtr channelz_channel = - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel); + MakeRefCounted(BaseNode::EntityType::kTopLevelChannel, nullptr); // try to pull out a uuid that does not exist. RefCountedPtr nonexistant = ChannelzRegistry::Get(channelz_channel->uuid() + 1); @@ -117,10 +117,10 @@ TEST_F(ChannelzRegistryTest, TestUnregistration) { std::vector> odd_channels; odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - even_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); - odd_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); + even_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); + odd_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); odd_uuids.push_back(odd_channels[i]->uuid()); } } @@ -137,8 +137,8 @@ TEST_F(ChannelzRegistryTest, TestUnregistration) { std::vector> more_channels; more_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - more_channels.push_back( - MakeRefCounted(BaseNode::EntityType::kTopLevelChannel)); + more_channels.push_back(MakeRefCounted( + BaseNode::EntityType::kTopLevelChannel, nullptr)); RefCountedPtr retrieved = ChannelzRegistry::Get(more_channels[i]->uuid()); EXPECT_EQ(more_channels[i], retrieved); diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index 0469421c975..abad1720ee8 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -20,7 +20,6 @@ "%grpc-internal-stream-encoding-request" "\x0Auser-agent" "\x04host" -"\x08lb-token" "\x1Agrpc-previous-rpc-attempts" "\x16grpc-retry-pushback-ms" "\x0Cgrpc-timeout" @@ -180,7 +179,6 @@ "\x00\x0Faccept-encoding\x00" "\x00\x10content-encoding\x08identity" "\x00\x10content-encoding\x04gzip" -"\x00\x08lb-token\x00" "\x00\x0Blb-cost-bin\x00" "\x00\x14grpc-accept-encoding\x08identity" "\x00\x14grpc-accept-encoding\x07deflate" diff --git a/test/core/gprpp/map_test.cc b/test/core/gprpp/map_test.cc index 30d9eb0b207..21aeee82486 100644 --- a/test/core/gprpp/map_test.cc +++ b/test/core/gprpp/map_test.cc @@ -437,6 +437,35 @@ TEST_F(MapTest, LowerBound) { EXPECT_EQ(it, test_map.end()); } +// Test move ctor +TEST_F(MapTest, MoveCtor) { + Map test_map; + for (int i = 0; i < 5; i++) { + test_map.emplace(kKeys[i], Payload(i)); + } + Map test_map2 = std::move(test_map); + for (int i = 0; i < 5; i++) { + EXPECT_EQ(test_map.end(), test_map.find(kKeys[i])); + EXPECT_EQ(i, test_map2.find(kKeys[i])->second.data()); + } +} + +// Test move assignment +TEST_F(MapTest, MoveAssignment) { + Map test_map; + for (int i = 0; i < 5; i++) { + test_map.emplace(kKeys[i], Payload(i)); + } + Map test_map2; + test_map2.emplace("xxx", Payload(123)); + test_map2 = std::move(test_map); + for (int i = 0; i < 5; i++) { + EXPECT_EQ(test_map.end(), test_map.find(kKeys[i])); + EXPECT_EQ(i, test_map2.find(kKeys[i])->second.data()); + } + EXPECT_EQ(test_map2.end(), test_map2.find("xxx")); +} + } // namespace testing } // namespace grpc_core diff --git a/test/core/iomgr/buffer_list_test.cc b/test/core/iomgr/buffer_list_test.cc index 70e36940425..d71bb9ace2b 100644 --- a/test/core/iomgr/buffer_list_test.cc +++ b/test/core/iomgr/buffer_list_test.cc @@ -92,9 +92,33 @@ static void TestVerifierCalledOnAck() { grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); } +/** Tests that shutdown can be called repeatedly. + */ +static void TestRepeatedShutdown() { + struct sock_extended_err serr; + serr.ee_data = 213; + serr.ee_info = grpc_core::SCM_TSTAMP_ACK; + struct grpc_core::scm_timestamping tss; + tss.ts[0].tv_sec = 123; + tss.ts[0].tv_nsec = 456; + grpc_core::grpc_tcp_set_write_timestamps_callback( + TestVerifierCalledOnAckVerifier); + grpc_core::TracedBuffer* list = nullptr; + gpr_atm verifier_called; + gpr_atm_rel_store(&verifier_called, static_cast(0)); + grpc_core::TracedBuffer::AddNewEntry(&list, 213, 0, &verifier_called); + grpc_core::TracedBuffer::ProcessTimestamp(&list, &serr, nullptr, &tss); + GPR_ASSERT(gpr_atm_acq_load(&verifier_called) == static_cast(1)); + GPR_ASSERT(list == nullptr); + grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); + grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); + grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); +} + static void TestTcpBufferList() { TestVerifierCalledOnAck(); TestShutdownFlushesList(); + TestRepeatedShutdown(); } int main(int argc, char** argv) { diff --git a/test/core/iomgr/mpmcqueue_test.cc b/test/core/iomgr/mpmcqueue_test.cc index a301832f608..9ebc1cc7363 100644 --- a/test/core/iomgr/mpmcqueue_test.cc +++ b/test/core/iomgr/mpmcqueue_test.cc @@ -119,6 +119,57 @@ static void test_FIFO(void) { } } +// Test if queue's behavior of expanding is correct. (Only does expansion when +// it gets full, and each time expands to doubled size). +static void test_space_efficiency(void) { + gpr_log(GPR_INFO, "test_space_efficiency"); + grpc_core::InfLenFIFOQueue queue; + for (int i = 0; i < queue.init_num_nodes(); ++i) { + queue.Put(static_cast(grpc_core::New(i))); + } + // Queue should not have been expanded at this time. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes()); + for (int i = 0; i < queue.init_num_nodes(); ++i) { + WorkItem* item = static_cast(queue.Get()); + queue.Put(item); + } + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes()); + for (int i = 0; i < queue.init_num_nodes(); ++i) { + WorkItem* item = static_cast(queue.Get()); + grpc_core::Delete(item); + } + // Queue never shrinks even it is empty. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes()); + GPR_ASSERT(queue.count() == 0); + // queue empty now + for (int i = 0; i < queue.init_num_nodes() * 2; ++i) { + queue.Put(static_cast(grpc_core::New(i))); + } + GPR_ASSERT(queue.count() == queue.init_num_nodes() * 2); + // Queue should have been expanded once. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 2); + for (int i = 0; i < queue.init_num_nodes(); ++i) { + WorkItem* item = static_cast(queue.Get()); + grpc_core::Delete(item); + } + GPR_ASSERT(queue.count() == queue.init_num_nodes()); + // Queue will never shrink, should keep same number of node as before. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 2); + for (int i = 0; i < queue.init_num_nodes() + 1; ++i) { + queue.Put(static_cast(grpc_core::New(i))); + } + GPR_ASSERT(queue.count() == queue.init_num_nodes() * 2 + 1); + // Queue should have been expanded twice. + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 4); + for (int i = 0; i < queue.init_num_nodes() * 2 + 1; ++i) { + WorkItem* item = static_cast(queue.Get()); + grpc_core::Delete(item); + } + GPR_ASSERT(queue.count() == 0); + GPR_ASSERT(queue.num_nodes() == queue.init_num_nodes() * 4); + gpr_log(GPR_DEBUG, "Done."); +} + static void test_many_thread(void) { gpr_log(GPR_INFO, "test_many_thread"); const int num_producer_threads = 10; @@ -172,6 +223,7 @@ int main(int argc, char** argv) { grpc::testing::TestEnvironment env(argc, argv); grpc_init(); test_FIFO(); + test_space_efficiency(); test_many_thread(); grpc_shutdown(); return 0; diff --git a/test/core/transport/chttp2/context_list_test.cc b/test/core/transport/chttp2/context_list_test.cc index 0379eaaee4c..f8c0bee0afb 100644 --- a/test/core/transport/chttp2/context_list_test.cc +++ b/test/core/transport/chttp2/context_list_test.cc @@ -42,21 +42,29 @@ void TestExecuteFlushesListVerifier(void* arg, grpc_core::Timestamps* ts, grpc_error* error) { ASSERT_NE(arg, nullptr); EXPECT_EQ(error, GRPC_ERROR_NONE); - EXPECT_EQ(ts->byte_offset, kByteOffset); + if (ts) { + EXPECT_EQ(ts->byte_offset, kByteOffset); + } gpr_atm* done = reinterpret_cast(arg); gpr_atm_rel_store(done, static_cast(1)); } void discard_write(grpc_slice slice) {} +class ContextListTest : public ::testing::Test { + protected: + void SetUp() override { + grpc_http2_set_write_timestamps_callback(TestExecuteFlushesListVerifier); + grpc_http2_set_fn_get_copied_context(DummyArgsCopier); + } +}; + /** Tests that all ContextList elements in the list are flushed out on * execute. * Also tests that arg and byte_counter are passed correctly. */ -TEST(ContextList, ExecuteFlushesList) { +TEST_F(ContextListTest, ExecuteFlushesList) { grpc_core::ContextList* list = nullptr; - grpc_http2_set_write_timestamps_callback(TestExecuteFlushesListVerifier); - grpc_http2_set_fn_get_copied_context(DummyArgsCopier); const int kNumElems = 5; grpc_core::ExecCtx exec_ctx; grpc_stream_refcount ref; @@ -95,6 +103,62 @@ TEST(ContextList, ExecuteFlushesList) { grpc_resource_quota_unref(resource_quota); exec_ctx.Flush(); } + +TEST_F(ContextListTest, EmptyList) { + grpc_core::ContextList* list = nullptr; + grpc_core::ExecCtx exec_ctx; + grpc_core::Timestamps ts; + grpc_core::ContextList::Execute(list, &ts, GRPC_ERROR_NONE); + exec_ctx.Flush(); +} + +TEST_F(ContextListTest, EmptyListEmptyTimestamp) { + grpc_core::ContextList* list = nullptr; + grpc_core::ExecCtx exec_ctx; + grpc_core::ContextList::Execute(list, nullptr, GRPC_ERROR_NONE); + exec_ctx.Flush(); +} + +TEST_F(ContextListTest, NonEmptyListEmptyTimestamp) { + grpc_core::ContextList* list = nullptr; + const int kNumElems = 5; + grpc_core::ExecCtx exec_ctx; + grpc_stream_refcount ref; + GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "dummy ref"); + grpc_resource_quota* resource_quota = + grpc_resource_quota_create("context_list_test"); + grpc_endpoint* mock_endpoint = + grpc_mock_endpoint_create(discard_write, resource_quota); + grpc_transport* t = + grpc_create_chttp2_transport(nullptr, mock_endpoint, true); + std::vector s; + s.reserve(kNumElems); + gpr_atm verifier_called[kNumElems]; + for (auto i = 0; i < kNumElems; i++) { + s.push_back(static_cast( + gpr_malloc(grpc_transport_stream_size(t)))); + grpc_transport_init_stream(reinterpret_cast(t), + reinterpret_cast(s[i]), &ref, + nullptr, nullptr); + s[i]->context = &verifier_called[i]; + s[i]->byte_counter = kByteOffset; + gpr_atm_rel_store(&verifier_called[i], static_cast(0)); + grpc_core::ContextList::Append(&list, s[i]); + } + grpc_core::ContextList::Execute(list, nullptr, GRPC_ERROR_NONE); + for (auto i = 0; i < kNumElems; i++) { + EXPECT_EQ(gpr_atm_acq_load(&verifier_called[i]), static_cast(1)); + grpc_transport_destroy_stream(reinterpret_cast(t), + reinterpret_cast(s[i]), + nullptr); + exec_ctx.Flush(); + gpr_free(s[i]); + } + grpc_transport_destroy(t); + grpc_resource_quota_unref(resource_quota); + exec_ctx.Flush(); +} + } // namespace } // namespace testing } // namespace grpc_core diff --git a/test/core/transport/chttp2/stream_map_test.cc b/test/core/transport/chttp2/stream_map_test.cc index a36c496eb1e..3452c86cdc9 100644 --- a/test/core/transport/chttp2/stream_map_test.cc +++ b/test/core/transport/chttp2/stream_map_test.cc @@ -43,29 +43,6 @@ static void test_empty_find(void) { grpc_chttp2_stream_map_destroy(&map); } -/* test it's safe to delete twice */ -static void test_double_deletion(void) { - grpc_chttp2_stream_map map; - - LOG_TEST("test_double_deletion"); - - grpc_chttp2_stream_map_init(&map, 8); - GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); - grpc_chttp2_stream_map_add(&map, 1, (void*)1); - GPR_ASSERT((void*)1 == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(1 == grpc_chttp2_stream_map_size(&map)); - GPR_ASSERT((void*)1 == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); - grpc_chttp2_stream_map_destroy(&map); -} - /* test add & lookup */ static void test_basic_add_find(uint32_t n) { grpc_chttp2_stream_map map; @@ -197,7 +174,6 @@ int main(int argc, char** argv) { test_no_op(); test_empty_find(); - test_double_deletion(); while (n < 100000) { test_basic_add_find(n); diff --git a/test/core/util/test_lb_policies.cc b/test/core/util/test_lb_policies.cc index 2c1f988d173..12a042ab827 100644 --- a/test/core/util/test_lb_policies.cc +++ b/test/core/util/test_lb_policies.cc @@ -20,6 +20,8 @@ #include +#include + #include "src/core/ext/filters/client_channel/lb_policy.h" #include "src/core/ext/filters/client_channel/lb_policy_registry.h" #include "src/core/lib/channel/channel_args.h" @@ -115,9 +117,15 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy user_data_(user_data) {} PickResult Pick(PickArgs args) override { + // Check that we can read initial metadata. + gpr_log(GPR_INFO, "initial metadata:"); + InterceptRecvTrailingMetadataLoadBalancingPolicy::LogMetadata( + args.initial_metadata); + // Do pick. PickResult result = delegate_picker_->Pick(args); + // Intercept trailing metadata. if (result.type == PickResult::PICK_COMPLETE && - result.connected_subchannel != nullptr) { + result.subchannel != nullptr) { new (args.call_state->Alloc(sizeof(TrailingMetadataHandler))) TrailingMetadataHandler(&result, cb_, user_data_); } @@ -180,11 +188,14 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy private: static void RecordRecvTrailingMetadata( - void* arg, grpc_metadata_batch* recv_trailing_metadata, + void* arg, MetadataInterface* recv_trailing_metadata, CallState* call_state) { TrailingMetadataHandler* self = static_cast(arg); GPR_ASSERT(recv_trailing_metadata != nullptr); + gpr_log(GPR_INFO, "trailing metadata:"); + InterceptRecvTrailingMetadataLoadBalancingPolicy::LogMetadata( + recv_trailing_metadata); self->cb_(self->user_data_); self->~TrailingMetadataHandler(); } @@ -192,6 +203,17 @@ class InterceptRecvTrailingMetadataLoadBalancingPolicy InterceptRecvTrailingMetadataCallback cb_; void* user_data_; }; + + static void LogMetadata(MetadataInterface* metadata) { + for (MetadataInterface::Iterator it = metadata->Begin(); + !metadata->IsEnd(it); metadata->Next(&it)) { + gpr_log(GPR_INFO, " \"%.*s\"=>\"%.*s\"", + static_cast(metadata->Key(it).size()), + metadata->Key(it).data(), + static_cast(metadata->Value(it).size()), + metadata->Value(it).data()); + } + } }; class InterceptTrailingFactory : public LoadBalancingPolicyFactory { diff --git a/test/cpp/end2end/channelz_service_test.cc b/test/cpp/end2end/channelz_service_test.cc index 69c56c574f9..1ed2d8c65f2 100644 --- a/test/cpp/end2end/channelz_service_test.cc +++ b/test/cpp/end2end/channelz_service_test.cc @@ -571,6 +571,8 @@ TEST_F(ChannelzServerTest, ManySubchannelsAndSockets) { get_subchannel_resp.subchannel().socket_ref(0).socket_id()); s = channelz_stub_->GetSocket(&get_socket_ctx, get_socket_req, &get_socket_resp); + EXPECT_TRUE( + get_subchannel_resp.subchannel().socket_ref(0).name().find("http")); EXPECT_TRUE(s.ok()) << s.error_message(); // calls started == streams started AND stream succeeded. Since none of // these RPCs were canceled, all of the streams will succeeded even though @@ -626,6 +628,8 @@ TEST_F(ChannelzServerTest, StreamingRPC) { ClientContext get_socket_context; get_socket_request.set_socket_id( get_subchannel_response.subchannel().socket_ref(0).socket_id()); + EXPECT_TRUE( + get_subchannel_response.subchannel().socket_ref(0).name().find("http")); s = channelz_stub_->GetSocket(&get_socket_context, get_socket_request, &get_socket_response); EXPECT_TRUE(s.ok()) << "s.error_message() = " << s.error_message(); @@ -659,6 +663,7 @@ TEST_F(ChannelzServerTest, GetServerSocketsTest) { &get_server_sockets_response); EXPECT_TRUE(s.ok()) << "s.error_message() = " << s.error_message(); EXPECT_EQ(get_server_sockets_response.socket_ref_size(), 1); + EXPECT_TRUE(get_server_sockets_response.socket_ref(0).name().find("http")); } TEST_F(ChannelzServerTest, GetServerSocketsPaginationTest) { @@ -738,6 +743,8 @@ TEST_F(ChannelzServerTest, GetServerListenSocketsTest) { GetSocketResponse get_socket_response; get_socket_request.set_socket_id( get_server_response.server(0).listen_socket(0).socket_id()); + EXPECT_TRUE( + get_server_response.server(0).listen_socket(0).name().find("http")); ClientContext get_socket_context; s = channelz_stub_->GetSocket(&get_socket_context, get_socket_request, &get_socket_response); diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 8fc0eacc2fc..dac7860141c 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -209,7 +209,6 @@ class ClientLbEnd2endTest : public ::testing::Test { // Explicitly destroy all the members so that we can make sure grpc_shutdown // has finished by the end of this function, and thus all the registered // LB policy factories are removed. - stub_.reset(); servers_.clear(); creds_.reset(); grpc_shutdown_blocking(); @@ -421,7 +420,6 @@ class ClientLbEnd2endTest : public ::testing::Test { } const grpc::string server_host_; - std::unique_ptr stub_; std::vector> servers_; const grpc::string kRequestMessage_; std::shared_ptr creds_; @@ -1467,6 +1465,32 @@ TEST_F(ClientLbEnd2endTest, RoundRobinWithHealthCheckingServiceNamePerChannel) { EnableDefaultHealthCheckService(false); } +TEST_F(ClientLbEnd2endTest, ChannelIdleness) { + // Start server. + const int kNumServers = 1; + StartServers(kNumServers); + // Set max idle time and build the channel. + ChannelArguments args; + args.SetInt(GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS, 100); + auto response_generator = BuildResolverResponseGenerator(); + auto channel = BuildChannel("", response_generator, args); + auto stub = BuildStub(channel); + // The initial channel state should be IDLE. + EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_IDLE); + // After sending RPC, channel state should be READY. + response_generator.SetNextResolution(GetServersPorts()); + CheckRpcSendOk(stub, DEBUG_LOCATION); + EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_READY); + // After a period time not using the channel, the channel state should switch + // to IDLE. + gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(120)); + EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_IDLE); + // Sending a new RPC should awake the IDLE channel. + response_generator.SetNextResolution(GetServersPorts()); + CheckRpcSendOk(stub, DEBUG_LOCATION); + EXPECT_EQ(channel->GetState(false), GRPC_CHANNEL_READY); +} + class ClientLbInterceptTrailingMetadataTest : public ClientLbEnd2endTest { protected: void SetUp() override { diff --git a/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm b/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm new file mode 100644 index 00000000000..07b514f6c65 --- /dev/null +++ b/test/cpp/ios/CronetTests/CppCronetEnd2EndTests.mm @@ -0,0 +1,569 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#import "TestHelper.h" +#import "test/core/end2end/data/ssl_test_data.h" + +#import +#import +#import +#import + +using namespace grpc::testing; +using std::chrono::system_clock; +using grpc::Status; +using grpc::ServerContext; +using grpc::ClientContext; + +@interface CppCronetEnd2EndTests : XCTestCase + +@end + +@implementation CppCronetEnd2EndTests { + std::unique_ptr _server; + TestServiceImpl _service; + TestServiceImpl _foo_service; +} + +// The setUp() function is run before the test cases run and only run once ++ (void)setUp { + [super setUp]; + configureCronet(); +} + +- (void)startServer { + if (_server) { + // server is already running + return; + } + + grpc::ServerBuilder builder; + grpc::SslServerCredentialsOptions ssl_opts; + + ssl_opts.pem_root_certs = ""; + grpc::SslServerCredentialsOptions::PemKeyCertPair pkcp = {test_server1_key, test_server1_cert}; + ssl_opts.pem_key_cert_pairs.push_back(pkcp); + auto server_creds = SslServerCredentials(ssl_opts); + builder.AddListeningPort("localhost:5000", server_creds); + builder.RegisterService(&_service); + builder.RegisterService("foo.test.youtube.com", &_foo_service); + _server = builder.BuildAndStart(); +} + +- (void)stopServer { + _server.reset(); +} + +- (void)restartServer { + [self stopServer]; + [self startServer]; +} + +- (void)setUp { + [self startServer]; +} + +- (void)sendRPCWithStub:(EchoTestService::Stub*)stub + numRPCs:(int)num_rpcs + withBinaryMetadata:(BOOL)with_binary_metadata { + EchoRequest request; + EchoResponse response; + request.set_message("Hello hello hello hello"); + + for (int i = 0; i < num_rpcs; ++i) { + ClientContext context; + if (with_binary_metadata) { + char bytes[8] = {'\0', '\1', '\2', '\3', '\4', '\5', '\6', static_cast(i)}; + context.AddMetadata("custom-bin", grpc::string(bytes, 8)); + } + context.set_compression_algorithm(GRPC_COMPRESS_GZIP); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); + } +} + +- (std::shared_ptr<::grpc::Channel>)getChannel { + stream_engine* cronetEngine = [Cronet getGlobalEngine]; + auto cronetChannelCredentials = grpc::CronetChannelCredentials(cronetEngine); + grpc::ChannelArguments args; + args.SetSslTargetNameOverride("foo.test.google.fr"); + args.SetUserAgentPrefix("custom_prefix"); + args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test"); + auto channel = grpc::CreateCustomChannel("127.0.0.1:5000", cronetChannelCredentials, args); + return channel; +} + +- (std::shared_ptr<::grpc::Channel>)getChannelWithInterceptors: + (std::vector>)creators { + stream_engine* cronetEngine = [Cronet getGlobalEngine]; + auto cronetChannelCredentials = grpc::CronetChannelCredentials(cronetEngine); + grpc::ChannelArguments args; + args.SetSslTargetNameOverride("foo.test.google.fr"); + args.SetUserAgentPrefix("custom_prefix"); + args.SetString(GRPC_ARG_SECONDARY_USER_AGENT_STRING, "end2end_test"); + auto channel = grpc::experimental::CreateCustomChannelWithInterceptors( + "127.0.01:5000", cronetChannelCredentials, args, std::move(creators)); + return channel; +} + +- (std::unique_ptr)getStub { + auto channel = [self getChannel]; + auto stub = EchoTestService::NewStub(channel); + return stub; +} + +- (void)testUserAgent { + ClientContext context; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + request.mutable_param()->set_echo_metadata(true); + auto stub = [self getStub]; + Status s = stub->Echo(&context, request, &response); + XCTAssertTrue(s.ok()); + const auto& trailing_metadata = context.GetServerTrailingMetadata(); + auto iter = trailing_metadata.find("user-agent"); + XCTAssert(iter->second.starts_with("custom_prefix grpc-c++")); +} + +- (void)testMultipleRPCs { + auto stub = [self getStub]; + std::vector threads; + threads.reserve(10); + for (int i = 0; i < 10; ++i) { + threads.emplace_back( + [self, &stub]() { [self sendRPCWithStub:stub.get() numRPCs:10 withBinaryMetadata:NO]; }); + } + for (int i = 0; i < 10; ++i) { + threads[i].join(); + } +} + +- (void)testMultipleRPCsWithBinaryMetadata { + auto stub = [self getStub]; + std::vector threads; + threads.reserve(10); + for (int i = 0; i < 10; ++i) { + threads.emplace_back( + [self, &stub]() { [self sendRPCWithStub:stub.get() numRPCs:10 withBinaryMetadata:YES]; }); + } + for (int i = 0; i < 10; ++i) { + threads[i].join(); + } +} + +- (void)testEmptyBinaryMetadata { + EchoRequest request; + EchoResponse response; + request.set_message("Hello hello hello hello"); + ClientContext context; + context.AddMetadata("custom-bin", ""); + auto stub = [self getStub]; + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); +} + +- (void)testReconnectChannel { + auto stub = [self getStub]; + [self sendRPCWithStub:stub.get() numRPCs:1 withBinaryMetadata:NO]; + + [self restartServer]; + [self sendRPCWithStub:stub.get() numRPCs:1 withBinaryMetadata:NO]; +} + +- (void)testRequestStreamOneRequest { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + auto stream = stub->RequestStream(&context, &response); + request.set_message("hello"); + XCTAssertTrue(stream->Write(request)); + stream->WritesDone(); + Status s = stream->Finish(); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); + XCTAssertTrue(context.debug_error_string().empty()); +} + +- (void)testRequestStreamOneRequestWithCoalescingApi { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + context.set_initial_metadata_corked(true); + auto stream = stub->RequestStream(&context, &response); + request.set_message("hello"); + XCTAssertTrue(stream->Write(request)); + stream->WritesDone(); + Status s = stream->Finish(); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); +} + +- (void)testRequestStreamTwoRequests { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + auto stream = stub->RequestStream(&context, &response); + request.set_message("hello"); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Write(request)); + stream->WritesDone(); + Status s = stream->Finish(); + XCTAssertEqual(response.message(), "hellohello"); + XCTAssertTrue(s.ok()); +} + +- (void)testResponseStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("hello"); + + auto stream = stub->ResponseStream(&context, request); + for (int i = 0; i < kServerDefaultResponseStreamsToSend; ++i) { + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message() + grpc::to_string(i)); + } + XCTAssertFalse(stream->Read(&response)); + + Status s = stream->Finish(); + XCTAssertTrue(s.ok()); +} + +- (void)testBidiStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + grpc::string msg("hello"); + + auto stream = stub->BidiStream(&context); + + for (int i = 0; i < kServerDefaultResponseStreamsToSend; ++i) { + request.set_message(msg + grpc::to_string(i)); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + } + + stream->WritesDone(); + XCTAssertFalse(stream->Read(&response)); + XCTAssertFalse(stream->Read(&response)); + + Status s = stream->Finish(); + XCTAssertTrue(s.ok()); +} + +- (void)testBidiStreamWithCoalescingApi { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + context.AddMetadata(kServerFinishAfterNReads, "3"); + context.set_initial_metadata_corked(true); + grpc::string msg("hello"); + + auto stream = stub->BidiStream(&context); + + request.set_message(msg + "0"); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + + request.set_message(msg + "1"); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + + request.set_message(msg + "2"); + stream->WriteLast(request, grpc::WriteOptions()); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + + XCTAssertFalse(stream->Read(&response)); + XCTAssertFalse(stream->Read(&response)); + + Status s = stream->Finish(); + XCTAssertTrue(s.ok()); +} + +- (void)testCancelBeforeStart { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("hello"); + context.TryCancel(); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual("", response.message()); + XCTAssertEqual(grpc::StatusCode::CANCELLED, s.error_code()); +} + +- (void)testClientCancelsRequestStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("hello"); + + auto stream = stub->RequestStream(&context, &response); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Write(request)); + + context.TryCancel(); + + Status s = stream->Finish(); + XCTAssertEqual(grpc::StatusCode::CANCELLED, s.error_code()); + XCTAssertEqual(response.message(), ""); +} + +- (void)testClientCancelsResponseStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("hello"); + + auto stream = stub->ResponseStream(&context, request); + + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message() + "0"); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message() + "1"); + + context.TryCancel(); + + // The cancellation races with responses, so there might be zero or + // one responses pending, read till failure + + if (stream->Read(&response)) { + XCTAssertEqual(response.message(), request.message() + "2"); + // Since we have cancelled, we expect the next attempt to read to fail + XCTAssertFalse(stream->Read(&response)); + } +} + +- (void)testlClientCancelsBidiStream { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + grpc::string msg("hello"); + + auto stream = stub->BidiStream(&context); + + request.set_message(msg + "0"); + XCTAssertTrue(stream->Write(request)); + XCTAssertTrue(stream->Read(&response)); + XCTAssertEqual(response.message(), request.message()); + + request.set_message(msg + "1"); + XCTAssertTrue(stream->Write(request)); + + context.TryCancel(); + + // The cancellation races with responses, so there might be zero or + // one responses pending, read till failure + + if (stream->Read(&response)) { + XCTAssertEqual(response.message(), request.message()); + // Since we have cancelled, we expect the next attempt to read to fail + XCTAssertFalse(stream->Read(&response)); + } + + Status s = stream->Finish(); + XCTAssertEqual(grpc::StatusCode::CANCELLED, s.error_code()); +} + +- (void)testNonExistingService { + auto channel = [self getChannel]; + auto stub = grpc::testing::UnimplementedEchoService::NewStub(channel); + + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + + ClientContext context; + Status s = stub->Unimplemented(&context, request, &response); + XCTAssertEqual(grpc::StatusCode::UNIMPLEMENTED, s.error_code()); + XCTAssertEqual("", s.error_message()); +} + +- (void)testBinaryTrailer { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + ClientContext context; + + request.mutable_param()->set_echo_metadata(true); + DebugInfo* info = request.mutable_param()->mutable_debug_info(); + info->add_stack_entries("stack_entry_1"); + info->add_stack_entries("stack_entry_2"); + info->add_stack_entries("stack_entry_3"); + info->set_detail("detailed debug info"); + grpc::string expected_string = info->SerializeAsString(); + request.set_message("Hello"); + + Status s = stub->Echo(&context, request, &response); + XCTAssertFalse(s.ok()); + auto trailers = context.GetServerTrailingMetadata(); + XCTAssertEqual(1u, trailers.count(kDebugInfoTrailerKey)); + auto iter = trailers.find(kDebugInfoTrailerKey); + XCTAssertEqual(expected_string, iter->second); + // Parse the returned trailer into a DebugInfo proto. + DebugInfo returned_info; + XCTAssertTrue(returned_info.ParseFromString(ToString(iter->second))); +} + +- (void)testExpectError { + auto stub = [self getStub]; + std::vector expected_status; + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL + // No Error message or details + + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL + expected_status.back().set_error_message("text error message"); + expected_status.back().set_binary_error_details("text error details"); + + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL + expected_status.back().set_error_message("text error message"); + expected_status.back().set_binary_error_details("\x0\x1\x2\x3\x4\x5\x6\x8\x9\xA\xB"); + + for (auto iter = expected_status.begin(); iter != expected_status.end(); ++iter) { + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("Hello"); + auto* error = request.mutable_param()->mutable_expected_error(); + error->set_code(iter->code()); + error->set_error_message(iter->error_message()); + error->set_binary_error_details(iter->binary_error_details()); + + Status s = stub->Echo(&context, request, &response); + XCTAssertFalse(s.ok()); + XCTAssertEqual(iter->code(), s.error_code()); + XCTAssertEqual(iter->error_message(), s.error_message()); + XCTAssertEqual(iter->binary_error_details(), s.error_details()); + XCTAssertTrue(context.debug_error_string().find("created") != std::string::npos); + XCTAssertTrue(context.debug_error_string().find("file") != std::string::npos); + XCTAssertTrue(context.debug_error_string().find("line") != std::string::npos); + XCTAssertTrue(context.debug_error_string().find("status") != std::string::npos); + XCTAssertTrue(context.debug_error_string().find("13") != std::string::npos); + } +} + +- (void)testRpcDeadlineExpires { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + request.mutable_param()->set_skip_cancelled_check(true); + // Let server sleep for 40 ms first to guarantee expiry. + request.mutable_param()->set_server_sleep_us(40 * 1000); + + ClientContext context; + std::chrono::system_clock::time_point deadline = + std::chrono::system_clock::now() + std::chrono::milliseconds(1); + context.set_deadline(deadline); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(grpc::StatusCode::DEADLINE_EXCEEDED, s.error_code()); +} + +- (void)testRpcLongDeadline { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + + ClientContext context; + std::chrono::system_clock::time_point deadline = + std::chrono::system_clock::now() + std::chrono::hours(1); + context.set_deadline(deadline); + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); +} + +- (void)testEchoDeadlineForNoDeadlineRpc { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + request.mutable_param()->set_echo_deadline(true); + + ClientContext context; + Status s = stub->Echo(&context, request, &response); + XCTAssertEqual(response.message(), request.message()); + XCTAssertTrue(s.ok()); + XCTAssertEqual(response.param().request_deadline(), gpr_inf_future(GPR_CLOCK_REALTIME).tv_sec); +} + +- (void)testPeer { + auto stub = [self getStub]; + EchoRequest request; + EchoResponse response; + request.set_message("Hello"); + ClientContext context; + Status s = stub->Echo(&context, request, &response); + XCTAssertTrue(s.ok()); + XCTAssertTrue(CheckIsLocalhost(context.peer())); +} + +- (void)testClientInterceptor { + DummyInterceptor::Reset(); + std::vector> creators; + // Add 20 dummy interceptors + for (auto i = 0; i < 20; i++) { + creators.push_back(std::unique_ptr(new DummyInterceptorFactory())); + } + auto channel = [self getChannelWithInterceptors:std::move(creators)]; + auto stub = EchoTestService::NewStub(channel); + + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("Hello"); + Status s = stub->Echo(&context, request, &response); + XCTAssertTrue(s.ok()); + XCTAssertEqual(DummyInterceptor::GetNumTimesRun(), 20); +} + +@end diff --git a/test/cpp/ios/CronetTests/TestHelper.h b/test/cpp/ios/CronetTests/TestHelper.h new file mode 100644 index 00000000000..fb8a42d459a --- /dev/null +++ b/test/cpp/ios/CronetTests/TestHelper.h @@ -0,0 +1,81 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef TESTHELPER_H +#define TESTHELPER_H + +#import +#import +#import + +#import +#import +#import +#import +#import + +const char* const kServerFinishAfterNReads = "server_finish_after_n_reads"; +const char* const kServerResponseStreamsToSend = "server_responses_to_send"; +const int kServerDefaultResponseStreamsToSend = 3; +const char* const kDebugInfoTrailerKey = "debug-info-bin"; + +grpc::string ToString(const grpc::string_ref& r); +void configureCronet(void); +bool CheckIsLocalhost(const grpc::string& addr); + +class DummyInterceptor : public grpc::experimental::Interceptor { + public: + DummyInterceptor() {} + virtual void Intercept(grpc::experimental::InterceptorBatchMethods* methods); + static void Reset(); + static int GetNumTimesRun(); + + private: + static std::atomic num_times_run_; + static std::atomic num_times_run_reverse_; +}; + +class DummyInterceptorFactory + : public grpc::experimental::ClientInterceptorFactoryInterface { + public: + virtual grpc::experimental::Interceptor* CreateClientInterceptor( + grpc::experimental::ClientRpcInfo* info) override { + return new DummyInterceptor(); + } +}; + +class TestServiceImpl : public grpc::testing::EchoTestService::Service { + public: + grpc::Status Echo(grpc::ServerContext* context, + const grpc::testing::EchoRequest* request, + grpc::testing::EchoResponse* response); + grpc::Status RequestStream( + grpc::ServerContext* context, + grpc::ServerReader* reader, + grpc::testing::EchoResponse* response); + grpc::Status ResponseStream( + grpc::ServerContext* context, const grpc::testing::EchoRequest* request, + grpc::ServerWriter* writer); + + grpc::Status BidiStream( + grpc::ServerContext* context, + grpc::ServerReaderWriter* stream); +}; + +#endif /* TESTHELPER_H */ diff --git a/test/cpp/ios/CronetTests/TestHelper.mm b/test/cpp/ios/CronetTests/TestHelper.mm new file mode 100644 index 00000000000..3b2d1803960 --- /dev/null +++ b/test/cpp/ios/CronetTests/TestHelper.mm @@ -0,0 +1,198 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "TestHelper.h" +#import +#import +#import + +using std::chrono::system_clock; +using grpc::testing::EchoRequest; +using grpc::testing::EchoResponse; +using grpc::testing::EchoTestService; +using grpc::ServerContext; +using grpc::Status; + +std::atomic DummyInterceptor::num_times_run_; +std::atomic DummyInterceptor::num_times_run_reverse_; + +grpc::string ToString(const grpc::string_ref& r) { return grpc::string(r.data(), r.size()); } + +void configureCronet(void) { + static dispatch_once_t configureCronet; + dispatch_once(&configureCronet, ^{ + [Cronet setHttp2Enabled:YES]; + [Cronet setSslKeyLogFileName:@"Documents/key"]; + [Cronet enableTestCertVerifierForTesting]; + NSURL* url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory + inDomains:NSUserDomainMask] lastObject]; + [Cronet start]; + [Cronet startNetLogToFile:@"cronet_netlog.json" logBytes:YES]; + }); +} + +bool CheckIsLocalhost(const grpc::string& addr) { + const grpc::string kIpv6("[::1]:"); + const grpc::string kIpv4MappedIpv6("[::ffff:127.0.0.1]:"); + const grpc::string kIpv4("127.0.0.1:"); + return addr.substr(0, kIpv4.size()) == kIpv4 || + addr.substr(0, kIpv4MappedIpv6.size()) == kIpv4MappedIpv6 || + addr.substr(0, kIpv6.size()) == kIpv6; +} + +int GetIntValueFromMetadataHelper(const char* key, + const std::multimap& metadata, + int default_value) { + if (metadata.find(key) != metadata.end()) { + std::istringstream iss(ToString(metadata.find(key)->second)); + iss >> default_value; + } + + return default_value; +} + +int GetIntValueFromMetadata(const char* key, + const std::multimap& metadata, + int default_value) { + return GetIntValueFromMetadataHelper(key, metadata, default_value); +} + +// When echo_deadline is requested, deadline seen in the ServerContext is set in +// the response in seconds. +void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request, EchoResponse* response) { + if (request->has_param() && request->param().echo_deadline()) { + gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_REALTIME); + if (context->deadline() != system_clock::time_point::max()) { + grpc::Timepoint2Timespec(context->deadline(), &deadline); + } + response->mutable_param()->set_request_deadline(deadline.tv_sec); + } +} + +Status TestServiceImpl::Echo(ServerContext* context, const EchoRequest* request, + EchoResponse* response) { + // A bit of sleep to make sure that short deadline tests fail + if (request->has_param() && request->param().server_sleep_us() > 0) { + gpr_sleep_until( + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_micros(request->param().server_sleep_us(), GPR_TIMESPAN))); + } + + if (request->has_param() && request->param().has_expected_error()) { + const auto& error = request->param().expected_error(); + return Status(static_cast(error.code()), error.error_message(), + error.binary_error_details()); + } + + if (request->has_param() && request->param().echo_metadata()) { + const std::multimap& client_metadata = + context->client_metadata(); + for (std::multimap::const_iterator iter = + client_metadata.begin(); + iter != client_metadata.end(); ++iter) { + context->AddTrailingMetadata(ToString(iter->first), ToString(iter->second)); + } + // Terminate rpc with error and debug info in trailer. + if (request->param().debug_info().stack_entries_size() || + !request->param().debug_info().detail().empty()) { + grpc::string serialized_debug_info = request->param().debug_info().SerializeAsString(); + context->AddTrailingMetadata(kDebugInfoTrailerKey, serialized_debug_info); + return Status::CANCELLED; + } + } + + response->set_message(request->message()); + MaybeEchoDeadline(context, request, response); + return Status::OK; +} + +Status TestServiceImpl::RequestStream(ServerContext* context, + grpc::ServerReader* reader, + EchoResponse* response) { + EchoRequest request; + response->set_message(""); + int num_msgs_read = 0; + while (reader->Read(&request)) { + response->mutable_message()->append(request.message()); + ++num_msgs_read; + } + return Status::OK; +} + +Status TestServiceImpl::ResponseStream(ServerContext* context, const EchoRequest* request, + grpc::ServerWriter* writer) { + EchoResponse response; + int server_responses_to_send = + GetIntValueFromMetadata(kServerResponseStreamsToSend, context->client_metadata(), + kServerDefaultResponseStreamsToSend); + for (int i = 0; i < server_responses_to_send; i++) { + response.set_message(request->message() + grpc::to_string(i)); + if (i == server_responses_to_send - 1) { + writer->WriteLast(response, grpc::WriteOptions()); + } else { + writer->Write(response); + } + } + return Status::OK; +} + +Status TestServiceImpl::BidiStream(ServerContext* context, + grpc::ServerReaderWriter* stream) { + EchoRequest request; + EchoResponse response; + + // kServerFinishAfterNReads suggests after how many reads, the server should + // write the last message and send status (coalesced using WriteLast) + int server_write_last = + GetIntValueFromMetadata(kServerFinishAfterNReads, context->client_metadata(), 0); + + int read_counts = 0; + while (stream->Read(&request)) { + read_counts++; + response.set_message(request.message()); + if (read_counts == server_write_last) { + stream->WriteLast(response, grpc::WriteOptions()); + } else { + stream->Write(response); + } + } + + return Status::OK; +} + +void DummyInterceptor::Intercept(grpc::experimental::InterceptorBatchMethods* methods) { + if (methods->QueryInterceptionHookPoint( + grpc::experimental::InterceptionHookPoints::PRE_SEND_INITIAL_METADATA)) { + num_times_run_++; + } else if (methods->QueryInterceptionHookPoint( + grpc::experimental::InterceptionHookPoints::POST_RECV_INITIAL_METADATA)) { + num_times_run_reverse_++; + } + methods->Proceed(); +} + +void DummyInterceptor::Reset() { + num_times_run_.store(0); + num_times_run_reverse_.store(0); +} + +int DummyInterceptor::GetNumTimesRun() { + NSCAssert(num_times_run_.load() == num_times_run_reverse_.load(), + @"Interceptor must run same number of times in both directions"); + return num_times_run_.load(); +} diff --git a/test/cpp/ios/Info.plist b/test/cpp/ios/Info.plist new file mode 100644 index 00000000000..fbeeb96ba6c --- /dev/null +++ b/test/cpp/ios/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + gRPC.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/test/cpp/ios/Podfile b/test/cpp/ios/Podfile new file mode 100644 index 00000000000..49044d2a050 --- /dev/null +++ b/test/cpp/ios/Podfile @@ -0,0 +1,102 @@ +source 'https://github.com/CocoaPods/Specs.git' + +install! 'cocoapods', :deterministic_uuids => false + +# Location of gRPC's repo root relative to this file. +GRPC_LOCAL_SRC = '../../..' + + +target 'CronetTests' do + platform :ios, '8.0' + pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true + + pod '!ProtoCompiler', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod '!ProtoCompiler-gRPCCppPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod 'Protobuf-C++', :podspec => "#{GRPC_LOCAL_SRC}/src/cpp", :inhibit_warnings => true + + pod 'BoringSSL-GRPC', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true + + pod 'gRPC-Core', :path => GRPC_LOCAL_SRC + pod 'gRPC-C++', :path => GRPC_LOCAL_SRC + pod 'gRPC-C++/Protobuf', :path => GRPC_LOCAL_SRC + pod 'RemoteTestCpp', :path => "RemoteTestClientCpp", :inhibit_warnings => true + + pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC + pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c" + pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true +end + +# gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's +# pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded +# and before they are installed in the user project. +# +# This podspec searches for the gRPC core library headers under "$(PODS_ROOT)/gRPC-Core", where +# Cocoapods normally places the downloaded sources. When doing local development of the libraries, +# though, Cocoapods just takes the sources from whatever directory was specified using `:path`, and +# doesn't copy them under $(PODS_ROOT). When using static libraries, one can sometimes rely on the +# symbolic links to the pods headers that Cocoapods creates under "$(PODS_ROOT)/Headers". But those +# aren't created when using dynamic frameworks. So our solution is to modify the podspec on the fly +# to point at the local directory where the sources are. +# +# TODO(jcanizales): Send a PR to Cocoapods to get rid of this need. +pre_install do |installer| + # This is the gRPC-Core podspec object, as initialized by its podspec file. + grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec + + # Copied from gRPC-Core.podspec, except for the adjusted src_root: + src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}" + grpc_core_spec.pod_target_xcconfig = { + 'GRPC_SRC_ROOT' => src_root, + 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', + 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"', + # If we don't set these two settings, `include/grpc/support/time.h` and + # `src/core/lib/gpr/string.h` shadow the system `` and ``, breaking the + # build. + 'USE_HEADERMAP' => 'NO', + 'ALWAYS_SEARCH_USER_PATHS' => 'NO', + } +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES' + end + + # CocoaPods creates duplicated library targets of gRPC-Core when the test targets include + # non-default subspecs of gRPC-Core. All of these library targets start with prefix 'gRPC-Core' + # and require the same error suppresion. + if target.name.start_with?('gRPC-Core') + target.build_configurations.each do |config| + # TODO(zyc): Remove this setting after the issue is resolved + # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void + # function" warning + config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1 GRPC_CFSTREAM=1' + end + end + + # Activate Cronet for the dedicated build configuration 'Cronet', which will be used solely by + # the test target 'InteropTestsRemoteWithCronet' + # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will + # be used by all test targets using it. + if /gRPC-(mac|i)OS/.match(target.name) + target.build_configurations.each do |config| + if config.name == 'Cronet' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1' + elsif config.name == 'Test' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_TEST_OBJC=1' + end + end + end + + # Enable NSAssert on gRPC + if /(gRPC|ProtoRPC|RxLibrary)-(mac|i)OS/.match(target.name) + target.build_configurations.each do |config| + if config.name != 'Release' + config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES' + end + end + end + end +end diff --git a/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec new file mode 100644 index 00000000000..0d51fdab31e --- /dev/null +++ b/test/cpp/ios/RemoteTestClientCpp/RemoteTestCpp.podspec @@ -0,0 +1,98 @@ +Pod::Spec.new do |s| + s.name = "RemoteTestCpp" + s.version = "0.0.1" + s.license = "Apache License, Version 2.0" + s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' } + s.homepage = "https://grpc.io/" + s.summary = "RemoteTest example" + s.source = { :git => 'https://github.com/grpc/grpc.git' } + + s.ios.deployment_target = '7.1' + s.osx.deployment_target = '10.9' + + # Run protoc with the C++ and gRPC plugins to generate protocol messages and gRPC clients. + s.dependency "!ProtoCompiler-gRPCCppPlugin" + s.dependency "Protobuf-C++" + s.dependency "gRPC-C++" + s.source_files = "src/proto/grpc/testing/*.pb.{h,cc}" + s.header_mappings_dir = "RemoteTestCpp" + s.requires_arc = false + + repo_root = '../../../..' + config = ENV['CONFIG'] || 'opt' + bin_dir = "#{repo_root}/bins/#{config}" + + protoc = "#{bin_dir}/protobuf/protoc" + well_known_types_dir = "#{repo_root}/third_party/protobuf/src" + plugin = "#{bin_dir}/grpc_cpp_plugin" + proto_dir = "#{repo_root}/src/proto/grpc/testing" + + s.prepare_command = <<-CMD + if [ -f #{protoc} ]; then + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo.proto + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo_messages.proto + #{protoc} \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/simple_messages.proto + else + # protoc was not found bin_dir, use installed version instead + + if ! [ -x "$(command -v protoc)" ]; then + (>&2 echo "\nERROR: protoc not found") + exit 1 + fi + (>&2 echo "\nWARNING: Using installed version of protoc. It might be incompatible with gRPC") + + protoc \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo.proto + protoc \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/echo_messages.proto + protoc \ + --plugin=protoc-gen-grpc=#{plugin} \ + --cpp_out=. \ + --grpc_out=. \ + -I #{repo_root} \ + -I #{proto_dir} \ + -I #{well_known_types_dir} \ + #{proto_dir}/simple_messages.proto + fi + CMD + + s.pod_target_xcconfig = { + # This is needed by all pods that depend on Protobuf: + 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 GPB_GRPC_FORWARD_DECLARE_MESSAGE_PROTO=1', + # This is needed by all pods that depend on gRPC-RxLibrary: + 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', + } +end diff --git a/test/cpp/ios/Tests.xcodeproj/project.pbxproj b/test/cpp/ios/Tests.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..865fc6636ff --- /dev/null +++ b/test/cpp/ios/Tests.xcodeproj/project.pbxproj @@ -0,0 +1,594 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + B02C351522E8E5FE00708B55 /* TestHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = B02C351322E8E5FE00708B55 /* TestHelper.mm */; }; + B0B151E622D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = B0B151E522D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 00DA7762CD572056A66501B3 /* Pods-CronetTests.cronet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.cronet.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.cronet.xcconfig"; sourceTree = ""; }; + 5E7F485922775B15006656AD /* CronetTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CronetTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 5E7F486622776AD8006656AD /* Cronet.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cronet.framework; path = Pods/CronetFramework/Cronet.framework; sourceTree = ""; }; + 635697D81B14FC11007A7283 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7B0DE0EC5EB517A302CD4698 /* Pods-CronetTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.release.xcconfig"; sourceTree = ""; }; + B02C351322E8E5FE00708B55 /* TestHelper.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TestHelper.mm; sourceTree = ""; }; + B02C351422E8E5FE00708B55 /* TestHelper.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = TestHelper.h; sourceTree = ""; }; + B0B151E522D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = CppCronetEnd2EndTests.mm; sourceTree = ""; }; + CDB4E9D8890B97B6FAF35A4F /* Pods-CronetTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.debug.xcconfig"; sourceTree = ""; }; + ED8BB10304E81C38CAE911C2 /* Pods-CronetTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CronetTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests.test.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5E7F485622775B15006656AD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 136D535E19727099B941D7B1 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5E7F486622776AD8006656AD /* Cronet.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 51E4650F34F854F41FF053B3 /* Pods */ = { + isa = PBXGroup; + children = ( + CDB4E9D8890B97B6FAF35A4F /* Pods-CronetTests.debug.xcconfig */, + ED8BB10304E81C38CAE911C2 /* Pods-CronetTests.test.xcconfig */, + 00DA7762CD572056A66501B3 /* Pods-CronetTests.cronet.xcconfig */, + 7B0DE0EC5EB517A302CD4698 /* Pods-CronetTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 5E7F485A22775B15006656AD /* CronetTests */ = { + isa = PBXGroup; + children = ( + B0B151E522D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm */, + B02C351322E8E5FE00708B55 /* TestHelper.mm */, + B02C351422E8E5FE00708B55 /* TestHelper.h */, + ); + path = CronetTests; + sourceTree = ""; + }; + 635697BE1B14FC11007A7283 = { + isa = PBXGroup; + children = ( + 635697C91B14FC11007A7283 /* Tests */, + 5E7F485A22775B15006656AD /* CronetTests */, + 635697C81B14FC11007A7283 /* Products */, + 51E4650F34F854F41FF053B3 /* Pods */, + 136D535E19727099B941D7B1 /* Frameworks */, + ); + sourceTree = ""; + }; + 635697C81B14FC11007A7283 /* Products */ = { + isa = PBXGroup; + children = ( + 5E7F485922775B15006656AD /* CronetTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 635697C91B14FC11007A7283 /* Tests */ = { + isa = PBXGroup; + children = ( + 635697D71B14FC11007A7283 /* Supporting Files */, + ); + name = Tests; + sourceTree = SOURCE_ROOT; + }; + 635697D71B14FC11007A7283 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 635697D81B14FC11007A7283 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 5E7F485822775B15006656AD /* CronetTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5E7F485E22775B15006656AD /* Build configuration list for PBXNativeTarget "CronetTests" */; + buildPhases = ( + CCAEC0F23E05489651A07D53 /* [CP] Check Pods Manifest.lock */, + 5E7F485522775B15006656AD /* Sources */, + 5E7F485622775B15006656AD /* Frameworks */, + 5E7F485722775B15006656AD /* Resources */, + 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */, + 30AFD6F6FC40B9923632A866 /* [CP] Copy Pods Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CronetTests; + productName = CronetTests; + productReference = 5E7F485922775B15006656AD /* CronetTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 635697BF1B14FC11007A7283 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = gRPC; + TargetAttributes = { + 5E7F485822775B15006656AD = { + CreatedOnToolsVersion = 10.1; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 635697C21B14FC11007A7283 /* Build configuration list for PBXProject "Tests" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + English, + en, + ); + mainGroup = 635697BE1B14FC11007A7283; + productRefGroup = 635697C81B14FC11007A7283 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 5E7F485822775B15006656AD /* CronetTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 5E7F485722775B15006656AD /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 292EA42A76AC7933A37235FD /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh", + "${PODS_ROOT}/CronetFramework/Cronet.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cronet.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 30AFD6F6FC40B9923632A866 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC-C++/gRPCCertificates-Cpp.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates-Cpp.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CronetTests/Pods-CronetTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + CCAEC0F23E05489651A07D53 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-CronetTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 5E7F485522775B15006656AD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B0B151E622D7DFCA00C4BFE0 /* CppCronetEnd2EndTests.mm in Sources */, + B02C351522E8E5FE00708B55 /* TestHelper.mm in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 5E1228981E4D400F00E8504F /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + "GRPC_TEST_OBJC=1", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Test; + }; + 5E7F485F22775B15006656AD /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CDB4E9D8890B97B6FAF35A4F /* Pods-CronetTests.debug.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_TESTABILITY = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/CronetFramework", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CronetTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../..; + }; + name = Debug; + }; + 5E7F486022775B15006656AD /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = ED8BB10304E81C38CAE911C2 /* Pods-CronetTests.test.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/CronetFramework", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CronetTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../..; + }; + name = Test; + }; + 5E7F486122775B15006656AD /* Cronet */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 00DA7762CD572056A66501B3 /* Pods-CronetTests.cronet.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/CronetFramework", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CronetTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../..; + }; + name = Cronet; + }; + 5E7F486222775B15006656AD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7B0DE0EC5EB517A302CD4698 /* Pods-CronetTests.release.xcconfig */; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Pods/CronetFramework", + ); + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_WARN_INHIBIT_ALL_WARNINGS = YES; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = io.grpc.CronetTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../..; + }; + name = Release; + }; + 5EC3C7A01D4FC18C000330E2 /* Cronet */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + "GRPC_TEST_OBJC=1", + "GRPC_COMPILE_WITH_CRONET=1", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Cronet; + }; + 635697D91B14FC11007A7283 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 635697DA1B14FC11007A7283 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 5E7F485E22775B15006656AD /* Build configuration list for PBXNativeTarget "CronetTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5E7F485F22775B15006656AD /* Debug */, + 5E7F486022775B15006656AD /* Test */, + 5E7F486122775B15006656AD /* Cronet */, + 5E7F486222775B15006656AD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 635697C21B14FC11007A7283 /* Build configuration list for PBXProject "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 635697D91B14FC11007A7283 /* Debug */, + 5E1228981E4D400F00E8504F /* Test */, + 5EC3C7A01D4FC18C000330E2 /* Cronet */, + 635697DA1B14FC11007A7283 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 635697BF1B14FC11007A7283 /* Project object */; +} diff --git a/test/cpp/ios/Tests.xcodeproj/xcshareddata/xcschemes/CronetTests.xcscheme b/test/cpp/ios/Tests.xcodeproj/xcshareddata/xcschemes/CronetTests.xcscheme new file mode 100644 index 00000000000..0156c906971 --- /dev/null +++ b/test/cpp/ios/Tests.xcodeproj/xcshareddata/xcschemes/CronetTests.xcscheme @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/cpp/ios/build_tests.sh b/test/cpp/ios/build_tests.sh new file mode 100755 index 00000000000..ead0159dcc9 --- /dev/null +++ b/test/cpp/ios/build_tests.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l objc + +set -e + +# CocoaPods requires the terminal to be using UTF-8 encoding. +export LANG=en_US.UTF-8 + +cd "$(dirname "$0")" + +hash pod 2>/dev/null || { echo >&2 "Cocoapods needs to be installed."; exit 1; } +hash xcodebuild 2>/dev/null || { + echo >&2 "XCode command-line tools need to be installed." + exit 1 +} + +# clean the directory +rm -rf Pods +rm -rf Tests.xcworkspace +rm -f Podfile.lock +rm -rf RemoteTestClientCpp/src + +echo "TIME: $(date)" +pod install + diff --git a/test/cpp/ios/run_tests.sh b/test/cpp/ios/run_tests.sh new file mode 100755 index 00000000000..9eee0cd28ca --- /dev/null +++ b/test/cpp/ios/run_tests.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't run this script standalone. Instead, run from the repository root: +# ./tools/run_tests/run_tests.py -l c++ + +set -ev + +cd "$(dirname "$0")" + + +set -o pipefail + +XCODEBUILD_FILTER='(^CompileC |^Ld |^ *[^ ]*clang |^ *cd |^ *export |^Libtool |^ *[^ ]*libtool |^CpHeader |^ *builtin-copy )' + +xcodebuild \ + -workspace Tests.xcworkspace \ + -scheme CronetTests \ + -destination name="iPhone 8" \ + test \ + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' - diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index d9424f24f16..b8e9b14d4b4 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -222,6 +222,14 @@ grpc_cc_binary( deps = [":helpers"], ) +grpc_cc_binary( + name = "bm_threadpool", + testonly = 1, + srcs = ["bm_threadpool.cc"], + tags = ["no_windows"], + deps = [":helpers"], +) + grpc_cc_library( name = "bm_callback_test_service_impl", testonly = 1, diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 3bd1464b2aa..aad94afca5b 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -686,6 +686,12 @@ static const grpc_channel_filter isolated_call_filter = { class IsolatedCallFixture : public TrackCounters { public: IsolatedCallFixture() { + // We are calling grpc_channel_stack_builder_create() instead of + // grpc_channel_create() here, which means we're not getting the + // grpc_init() called by grpc_channel_create(), but we are getting + // the grpc_shutdown() run by grpc_channel_destroy(). So we need to + // call grpc_init() manually here to balance things out. + grpc_init(); grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create(); grpc_channel_stack_builder_set_name(builder, "dummy"); grpc_channel_stack_builder_set_target(builder, "dummy_target"); diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc index ff8fe541dfc..d472363eb87 100644 --- a/test/cpp/microbenchmarks/bm_metadata.cc +++ b/test/cpp/microbenchmarks/bm_metadata.cc @@ -21,6 +21,7 @@ #include #include +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/static_metadata.h" @@ -30,7 +31,7 @@ static void BM_SliceFromStatic(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { - benchmark::DoNotOptimize(grpc_slice_from_static_string("abc")); + benchmark::DoNotOptimize(grpc_core::ExternallyManagedSlice("abc")); } track_counters.Finish(state); } @@ -39,7 +40,7 @@ BENCHMARK(BM_SliceFromStatic); static void BM_SliceFromCopied(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { - grpc_slice_unref(grpc_slice_from_copied_string("abc")); + grpc_slice_unref(grpc_core::UnmanagedMemorySlice("abc")); } track_counters.Finish(state); } @@ -47,9 +48,9 @@ BENCHMARK(BM_SliceFromCopied); static void BM_SliceIntern(benchmark::State& state) { TrackCounters track_counters; - gpr_slice slice = grpc_slice_from_static_string("abc"); + grpc_core::ExternallyManagedSlice slice("abc"); while (state.KeepRunning()) { - grpc_slice_unref(grpc_slice_intern(slice)); + grpc_slice_unref(grpc_core::ManagedMemorySlice(&slice)); } track_counters.Finish(state); } @@ -57,11 +58,11 @@ BENCHMARK(BM_SliceIntern); static void BM_SliceReIntern(benchmark::State& state) { TrackCounters track_counters; - gpr_slice slice = grpc_slice_intern(grpc_slice_from_static_string("abc")); + grpc_core::ExternallyManagedSlice static_slice("abc"); + grpc_core::ManagedMemorySlice slice(&static_slice); while (state.KeepRunning()) { - grpc_slice_unref(grpc_slice_intern(slice)); + grpc_slice_unref(grpc_core::ManagedMemorySlice(&slice)); } - grpc_slice_unref(slice); track_counters.Finish(state); } BENCHMARK(BM_SliceReIntern); @@ -69,7 +70,7 @@ BENCHMARK(BM_SliceReIntern); static void BM_SliceInternStaticMetadata(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { - grpc_slice_intern(GRPC_MDSTR_GZIP); + benchmark::DoNotOptimize(grpc_core::ManagedMemorySlice(&GRPC_MDSTR_GZIP)); } track_counters.Finish(state); } @@ -77,9 +78,9 @@ BENCHMARK(BM_SliceInternStaticMetadata); static void BM_SliceInternEqualToStaticMetadata(benchmark::State& state) { TrackCounters track_counters; - gpr_slice slice = grpc_slice_from_static_string("gzip"); + grpc_core::ExternallyManagedSlice slice("gzip"); while (state.KeepRunning()) { - grpc_slice_intern(slice); + benchmark::DoNotOptimize(grpc_core::ManagedMemorySlice(&slice)); } track_counters.Finish(state); } @@ -87,8 +88,8 @@ BENCHMARK(BM_SliceInternEqualToStaticMetadata); static void BM_MetadataFromNonInternedSlices(benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_from_static_string("key"); - gpr_slice v = grpc_slice_from_static_string("value"); + grpc_core::ExternallyManagedSlice k("key"); + grpc_core::ExternallyManagedSlice v("value"); grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); @@ -100,8 +101,8 @@ BENCHMARK(BM_MetadataFromNonInternedSlices); static void BM_MetadataFromInternedSlices(benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ManagedMemorySlice v("value"); grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); @@ -116,8 +117,8 @@ BENCHMARK(BM_MetadataFromInternedSlices); static void BM_MetadataFromInternedSlicesAlreadyInIndex( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ManagedMemorySlice v("value"); grpc_core::ExecCtx exec_ctx; grpc_mdelem seed = grpc_mdelem_create(k, v, nullptr); while (state.KeepRunning()) { @@ -133,8 +134,8 @@ BENCHMARK(BM_MetadataFromInternedSlicesAlreadyInIndex); static void BM_MetadataFromInternedKey(benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_from_static_string("value"); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ExternallyManagedSlice v("value"); grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); @@ -148,8 +149,8 @@ BENCHMARK(BM_MetadataFromInternedKey); static void BM_MetadataFromNonInternedSlicesWithBackingStore( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_from_static_string("key"); - gpr_slice v = grpc_slice_from_static_string("value"); + grpc_core::ExternallyManagedSlice k("key"); + grpc_core::ExternallyManagedSlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { @@ -164,8 +165,8 @@ BENCHMARK(BM_MetadataFromNonInternedSlicesWithBackingStore); static void BM_MetadataFromInternedSlicesWithBackingStore( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ManagedMemorySlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { @@ -182,8 +183,8 @@ BENCHMARK(BM_MetadataFromInternedSlicesWithBackingStore); static void BM_MetadataFromInternedKeyWithBackingStore( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_from_static_string("value"); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ExternallyManagedSlice v("value"); char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { @@ -198,14 +199,12 @@ BENCHMARK(BM_MetadataFromInternedKeyWithBackingStore); static void BM_MetadataFromStaticMetadataStrings(benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = GRPC_MDSTR_STATUS; - gpr_slice v = GRPC_MDSTR_200; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); + GRPC_MDELEM_UNREF( + grpc_mdelem_create(GRPC_MDSTR_STATUS, GRPC_MDSTR_200, nullptr)); } - grpc_slice_unref(k); track_counters.Finish(state); } BENCHMARK(BM_MetadataFromStaticMetadataStrings); @@ -213,14 +212,12 @@ BENCHMARK(BM_MetadataFromStaticMetadataStrings); static void BM_MetadataFromStaticMetadataStringsNotIndexed( benchmark::State& state) { TrackCounters track_counters; - gpr_slice k = GRPC_MDSTR_STATUS; - gpr_slice v = GRPC_MDSTR_GZIP; grpc_core::ExecCtx exec_ctx; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, nullptr)); + GRPC_MDELEM_UNREF( + grpc_mdelem_create(GRPC_MDSTR_STATUS, GRPC_MDSTR_GZIP, nullptr)); } - grpc_slice_unref(k); track_counters.Finish(state); } BENCHMARK(BM_MetadataFromStaticMetadataStringsNotIndexed); @@ -229,9 +226,10 @@ static void BM_MetadataRefUnrefExternal(benchmark::State& state) { TrackCounters track_counters; char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; - grpc_mdelem el = grpc_mdelem_create( - grpc_slice_from_static_string("a"), grpc_slice_from_static_string("b"), - reinterpret_cast(backing_store)); + grpc_mdelem el = + grpc_mdelem_create(grpc_core::ExternallyManagedSlice("a"), + grpc_core::ExternallyManagedSlice("b"), + reinterpret_cast(backing_store)); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); } @@ -245,8 +243,8 @@ static void BM_MetadataRefUnrefInterned(benchmark::State& state) { TrackCounters track_counters; char backing_store[sizeof(grpc_mdelem_data)]; grpc_core::ExecCtx exec_ctx; - gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); - gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); + grpc_core::ManagedMemorySlice k("key"); + grpc_core::ManagedMemorySlice v("value"); grpc_mdelem el = grpc_mdelem_create( k, v, reinterpret_cast(backing_store)); grpc_slice_unref(k); @@ -264,8 +262,8 @@ static void BM_MetadataRefUnrefAllocated(benchmark::State& state) { TrackCounters track_counters; grpc_core::ExecCtx exec_ctx; grpc_mdelem el = - grpc_mdelem_create(grpc_slice_from_static_string("a"), - grpc_slice_from_static_string("b"), nullptr); + grpc_mdelem_create(grpc_core::ExternallyManagedSlice("a"), + grpc_core::ExternallyManagedSlice("b"), nullptr); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); } diff --git a/test/cpp/microbenchmarks/bm_threadpool.cc b/test/cpp/microbenchmarks/bm_threadpool.cc new file mode 100644 index 00000000000..55c8772e5b5 --- /dev/null +++ b/test/cpp/microbenchmarks/bm_threadpool.cc @@ -0,0 +1,324 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include +#include + +#include +#include + +#include "src/core/lib/iomgr/executor/threadpool.h" +#include "test/cpp/microbenchmarks/helpers.h" +#include "test/cpp/util/test_config.h" + +namespace grpc { +namespace testing { + +// This helper class allows a thread to block for a pre-specified number of +// actions. BlockingCounter has an initial non-negative count on initialization. +// Each call to DecrementCount will decrease the count by 1. When making a call +// to Wait, if the count is greater than 0, the thread will be blocked, until +// the count reaches 0. +class BlockingCounter { + public: + BlockingCounter(int count) : count_(count) {} + void DecrementCount() { + std::lock_guard l(mu_); + count_--; + if (count_ == 0) cv_.notify_all(); + } + + void Wait() { + std::unique_lock l(mu_); + while (count_ > 0) { + cv_.wait(l); + } + } + + private: + int count_; + std::mutex mu_; + std::condition_variable cv_; +}; + +// This is a functor/closure class for threadpool microbenchmark. +// This functor (closure) class will add another functor into pool if the +// number passed in (num_add) is greater than 0. Otherwise, it will decrement +// the counter to indicate that task is finished. This functor will suicide at +// the end, therefore, no need for caller to do clean-ups. +class AddAnotherFunctor : public grpc_experimental_completion_queue_functor { + public: + AddAnotherFunctor(grpc_core::ThreadPool* pool, BlockingCounter* counter, + int num_add) + : pool_(pool), counter_(counter), num_add_(num_add) { + functor_run = &AddAnotherFunctor::Run; + internal_next = this; + internal_success = 0; + } + // When the functor gets to run in thread pool, it will take itself as first + // argument and internal_success as second one. + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { + auto* callback = static_cast(cb); + if (--callback->num_add_ > 0) { + callback->pool_->Add(new AddAnotherFunctor( + callback->pool_, callback->counter_, callback->num_add_)); + } else { + callback->counter_->DecrementCount(); + } + // Suicides. + delete callback; + } + + private: + grpc_core::ThreadPool* pool_; + BlockingCounter* counter_; + int num_add_; +}; + +template +static void ThreadPoolAddAnother(benchmark::State& state) { + const int num_iterations = state.range(0); + const int num_threads = state.range(1); + // Number of adds done by each closure. + const int num_add = num_iterations / kConcurrentFunctor; + grpc_core::ThreadPool pool(num_threads); + while (state.KeepRunningBatch(num_iterations)) { + BlockingCounter counter(kConcurrentFunctor); + for (int i = 0; i < kConcurrentFunctor; ++i) { + pool.Add(new AddAnotherFunctor(&pool, &counter, num_add)); + } + counter.Wait(); + } + state.SetItemsProcessed(state.iterations()); +} + +// First pair of arguments is range for number of iterations (num_iterations). +// Second pair of arguments is range for thread pool size (num_threads). +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 1)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 4)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 8)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 16) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 32) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 64) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 128) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 512) + ->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddAnother, 2048) + ->RangePair(524288, 524288, 1, 1024); + +// A functor class that will delete self on end of running. +class SuicideFunctorForAdd : public grpc_experimental_completion_queue_functor { + public: + SuicideFunctorForAdd(BlockingCounter* counter) : counter_(counter) { + functor_run = &SuicideFunctorForAdd::Run; + internal_next = this; + internal_success = 0; + } + + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { + // On running, the first argument would be itself. + auto* callback = static_cast(cb); + callback->counter_->DecrementCount(); + delete callback; + } + + private: + BlockingCounter* counter_; +}; + +// Performs the scenario of external thread(s) adding closures into pool. +static void BM_ThreadPoolExternalAdd(benchmark::State& state) { + static grpc_core::ThreadPool* external_add_pool = nullptr; + // Setup for each run of test. + if (state.thread_index == 0) { + const int num_threads = state.range(1); + external_add_pool = grpc_core::New(num_threads); + } + const int num_iterations = state.range(0) / state.threads; + while (state.KeepRunningBatch(num_iterations)) { + BlockingCounter counter(num_iterations); + for (int i = 0; i < num_iterations; ++i) { + external_add_pool->Add(new SuicideFunctorForAdd(&counter)); + } + counter.Wait(); + } + + // Teardown at the end of each test run. + if (state.thread_index == 0) { + state.SetItemsProcessed(state.range(0)); + grpc_core::Delete(external_add_pool); + } +} +BENCHMARK(BM_ThreadPoolExternalAdd) + // First pair is range for number of iterations (num_iterations). + // Second pair is range for thread pool size (num_threads). + ->RangePair(524288, 524288, 1, 1024) + ->ThreadRange(1, 256); // Concurrent external thread(s) up to 256 + +// Functor (closure) that adds itself into pool repeatedly. By adding self, the +// overhead would be low and can measure the time of add more accurately. +class AddSelfFunctor : public grpc_experimental_completion_queue_functor { + public: + AddSelfFunctor(grpc_core::ThreadPool* pool, BlockingCounter* counter, + int num_add) + : pool_(pool), counter_(counter), num_add_(num_add) { + functor_run = &AddSelfFunctor::Run; + internal_next = this; + internal_success = 0; + } + // When the functor gets to run in thread pool, it will take itself as first + // argument and internal_success as second one. + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { + auto* callback = static_cast(cb); + if (--callback->num_add_ > 0) { + callback->pool_->Add(cb); + } else { + callback->counter_->DecrementCount(); + // Suicides. + delete callback; + } + } + + private: + grpc_core::ThreadPool* pool_; + BlockingCounter* counter_; + int num_add_; +}; + +template +static void ThreadPoolAddSelf(benchmark::State& state) { + const int num_iterations = state.range(0); + const int num_threads = state.range(1); + // Number of adds done by each closure. + const int num_add = num_iterations / kConcurrentFunctor; + grpc_core::ThreadPool pool(num_threads); + while (state.KeepRunningBatch(num_iterations)) { + BlockingCounter counter(kConcurrentFunctor); + for (int i = 0; i < kConcurrentFunctor; ++i) { + pool.Add(new AddSelfFunctor(&pool, &counter, num_add)); + } + counter.Wait(); + } + state.SetItemsProcessed(state.iterations()); +} + +// First pair of arguments is range for number of iterations (num_iterations). +// Second pair of arguments is range for thread pool size (num_threads). +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 1)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 4)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 8)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 16)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 32)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 64)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 128)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 512)->RangePair(524288, 524288, 1, 1024); +BENCHMARK_TEMPLATE(ThreadPoolAddSelf, 2048)->RangePair(524288, 524288, 1, 1024); + +#if defined(__GNUC__) && !defined(SWIG) +#if defined(__i386__) || defined(__x86_64__) +#define CACHELINE_SIZE 64 +#elif defined(__powerpc64__) +#define CACHELINE_SIZE 128 +#elif defined(__aarch64__) +#define CACHELINE_SIZE 64 +#elif defined(__arm__) +#if defined(__ARM_ARCH_5T__) +#define CACHELINE_SIZE 32 +#elif defined(__ARM_ARCH_7A__) +#define CACHELINE_SIZE 64 +#endif +#endif +#ifndef CACHELINE_SIZE +#define CACHELINE_SIZE 64 +#endif +#endif + +// A functor (closure) that simulates closures with small but non-trivial amount +// of work. +class ShortWorkFunctorForAdd + : public grpc_experimental_completion_queue_functor { + public: + BlockingCounter* counter_; + + ShortWorkFunctorForAdd() { + functor_run = &ShortWorkFunctorForAdd::Run; + internal_next = this; + internal_success = 0; + val_ = 0; + } + static void Run(grpc_experimental_completion_queue_functor* cb, int ok) { + auto* callback = static_cast(cb); + // Uses pad to avoid compiler complaining unused variable error. + callback->pad[0] = 0; + for (int i = 0; i < 1000; ++i) { + callback->val_++; + } + callback->counter_->DecrementCount(); + } + + private: + char pad[CACHELINE_SIZE]; + volatile int val_; +}; + +// Simulates workloads where many short running callbacks are added to the +// threadpool. The callbacks are not enough to keep all the workers busy +// continuously so the number of workers running changes overtime. +// +// In effect this tests how well the threadpool avoids spurious wakeups. +static void BM_SpikyLoad(benchmark::State& state) { + const int num_threads = state.range(0); + + const int kNumSpikes = 1000; + const int batch_size = 3 * num_threads; + std::vector work_vector(batch_size); + grpc_core::ThreadPool pool(num_threads); + while (state.KeepRunningBatch(kNumSpikes * batch_size)) { + for (int i = 0; i != kNumSpikes; ++i) { + BlockingCounter counter(batch_size); + for (auto& w : work_vector) { + w.counter_ = &counter; + pool.Add(&w); + } + counter.Wait(); + } + } + state.SetItemsProcessed(state.iterations() * batch_size); +} +BENCHMARK(BM_SpikyLoad)->Arg(1)->Arg(2)->Arg(4)->Arg(8)->Arg(16); + +} // namespace testing +} // namespace grpc + +// Some distros have RunSpecifiedBenchmarks under the benchmark namespace, +// and others do not. This allows us to support both modes. +namespace benchmark { +void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); } +} // namespace benchmark + +int main(int argc, char* argv[]) { + LibraryInitializer libInit; + ::benchmark::Initialize(&argc, argv); + ::grpc::testing::InitTest(&argc, &argv, false); + benchmark::RunTheBenchmarksNamespaced(); + return 0; +} diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc index dbac31170f0..a425c2f4c04 100644 --- a/test/cpp/util/grpc_tool.cc +++ b/test/cpp/util/grpc_tool.cc @@ -469,6 +469,8 @@ bool GrpcTool::CallMethod(int argc, const char** argv, " fallback when parsing request/response\n" " --proto_path ; The search path of proto files, valid" " only when --protofiles is given\n" + " --noremotedb ; Don't attempt to use reflection service" + " at all\n" " --metadata ; The metadata to be sent to the server\n" " --infile ; Input filename (defaults to stdin)\n" " --outfile ; Output filename (defaults to stdout)\n" @@ -810,6 +812,8 @@ bool GrpcTool::ParseMessage(int argc, const char** argv, " fallback when parsing request/response\n" " --proto_path ; The search path of proto files, valid" " only when --protofiles is given\n" + " --noremotedb ; Don't attempt to use reflection service" + " at all\n" " --infile ; Input filename (defaults to stdin)\n" " --outfile ; Output filename (defaults to stdout)\n" " --binary_input ; Input in binary format\n" diff --git a/third_party/BUILD b/third_party/BUILD index 8b43d6b8300..91d73b2c688 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -1,6 +1,5 @@ exports_files([ "gtest.BUILD", - "objective_c/Cronet/bidirectional_stream_c.h", "zlib.BUILD", "twisted.BUILD", "yaml.BUILD", diff --git a/third_party/abseil-cpp b/third_party/abseil-cpp index cc4bed2d74f..74d91756c11 160000 --- a/third_party/abseil-cpp +++ b/third_party/abseil-cpp @@ -1 +1 @@ -Subproject commit cc4bed2d74f7c8717e31f9579214ab52a9c9c610 +Subproject commit 74d91756c11bc22f9b0108b94da9326f7f9e376f diff --git a/third_party/data-plane-api b/third_party/data-plane-api deleted file mode 160000 index 911001cdca0..00000000000 --- a/third_party/data-plane-api +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 911001cdca003337bdb93fab32740cde61bafee3 diff --git a/third_party/envoy-api b/third_party/envoy-api new file mode 160000 index 00000000000..a83394157ad --- /dev/null +++ b/third_party/envoy-api @@ -0,0 +1 @@ +Subproject commit a83394157ad97f4dadbc8ed81f56ad5b3a72e542 diff --git a/third_party/objective_c/Cronet/BUILD b/third_party/objective_c/Cronet/BUILD new file mode 100644 index 00000000000..8d8a1d55d48 --- /dev/null +++ b/third_party/objective_c/Cronet/BUILD @@ -0,0 +1,27 @@ +# gRPC Bazel BUILD file. +# +# Copyright 2019 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) # Apache v2 + +package(default_visibility = ["//:__subpackages__"]) + +# C Header files used by GRPC C Transport. +cc_library( + name = "cronet_c_for_grpc", + hdrs = [ + "bidirectional_stream_c.h", + ] +) diff --git a/third_party/toolchains/BUILD b/third_party/toolchains/BUILD index 0ff68f9c3bb..ab2282d005d 100644 --- a/third_party/toolchains/BUILD +++ b/third_party/toolchains/BUILD @@ -32,7 +32,7 @@ platform( remote_execution_properties = """ properties: { name: "container-image" - value:"docker://gcr.io/grpc-testing/rbe_windows_toolchain@sha256:689b177e4a157c431c7077d19d043de27922c37de835031f29c9093b8d5c6370" + value:"docker://gcr.io/grpc-testing/rbe_windows_toolchain@sha256:75728e7d6d804090f71095e5fec627b18cfa1f47adc52096c209f2a687e06b2e" } properties: { name: "gceMachineType" # Small machines for majority of tests. diff --git a/third_party/toolchains/bazel_0.26.0_rbe_windows/BUILD b/third_party/toolchains/bazel_0.26.0_rbe_windows/BUILD new file mode 100644 index 00000000000..5a74a06ddbd --- /dev/null +++ b/third_party/toolchains/bazel_0.26.0_rbe_windows/BUILD @@ -0,0 +1,188 @@ +# Copyright 2018 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This becomes the BUILD file for @local_config_cc// under Windows. + +package(default_visibility = ["//visibility:public"]) + +load(":cc_toolchain_config.bzl", "cc_toolchain_config") + +cc_library( + name = "malloc", +) + +filegroup( + name = "empty", + srcs = [], +) + +# Hardcoded toolchain, legacy behaviour. +cc_toolchain_suite( + name = "toolchain", + toolchains = { + "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a", + "x64_windows|msvc-cl": ":cc-compiler-x64_windows", + "x64_windows|msys-gcc": ":cc-compiler-x64_windows_msys", + "x64_windows|mingw-gcc": ":cc-compiler-x64_windows_mingw", + "x64_windows_msys": ":cc-compiler-x64_windows_msys", + "x64_windows": ":cc-compiler-x64_windows", + "armeabi-v7a": ":cc-compiler-armeabi-v7a", + }, +) + +cc_toolchain( + name = "cc-compiler-x64_windows_msys", + toolchain_identifier = "msys_x64", + toolchain_config = ":msys_x64", + all_files = ":empty", + ar_files = ":empty", + as_files = ":empty", + compiler_files = ":empty", + dwp_files = ":empty", + linker_files = ":empty", + objcopy_files = ":empty", + strip_files = ":empty", + supports_param_files = 1, +) + +cc_toolchain_config( + name = "msys_x64", + cpu = "x64_windows", + compiler = "msys-gcc", +) + +toolchain( + name = "cc-toolchain-x64_windows_msys", + exec_compatible_with = [ + "@bazel_tools//platforms:x86_64", + "@bazel_tools//platforms:windows", + "@bazel_tools//tools/cpp:msys", + ], + target_compatible_with = [ + "@bazel_tools//platforms:x86_64", + "@bazel_tools//platforms:windows", + ], + toolchain = ":cc-compiler-x64_windows_msys", + toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", +) + +cc_toolchain( + name = "cc-compiler-x64_windows_mingw", + toolchain_identifier = "msys_x64_mingw", + toolchain_config = ":msys_x64_mingw", + all_files = ":empty", + ar_files = ":empty", + as_files = ":empty", + compiler_files = ":empty", + dwp_files = ":empty", + linker_files = ":empty", + objcopy_files = ":empty", + strip_files = ":empty", + supports_param_files = 0, +) + +cc_toolchain_config( + name = "msys_x64_mingw", + cpu = "x64_windows", + compiler = "mingw-gcc", +) + +toolchain( + name = "cc-toolchain-x64_windows_mingw", + exec_compatible_with = [ + "@bazel_tools//platforms:x86_64", + "@bazel_tools//platforms:windows", + "@bazel_tools//tools/cpp:mingw", + ], + target_compatible_with = [ + "@bazel_tools//platforms:x86_64", + "@bazel_tools//platforms:windows", + ], + toolchain = ":cc-compiler-x64_windows_mingw", + toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", +) + +cc_toolchain( + name = "cc-compiler-x64_windows", + toolchain_identifier = "msvc_x64", + toolchain_config = ":msvc_x64", + all_files = ":empty", + ar_files = ":empty", + as_files = ":empty", + compiler_files = ":empty", + dwp_files = ":empty", + linker_files = ":empty", + objcopy_files = ":empty", + strip_files = ":empty", + supports_param_files = 1, +) + +cc_toolchain_config( + name = "msvc_x64", + cpu = "x64_windows", + compiler = "msvc-cl", +) + +toolchain( + name = "cc-toolchain-x64_windows", + exec_compatible_with = [ + "@bazel_tools//platforms:x86_64", + "@bazel_tools//platforms:windows", + ], + target_compatible_with = [ + "@bazel_tools//platforms:x86_64", + "@bazel_tools//platforms:windows", + ], + toolchain = ":cc-compiler-x64_windows", + toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", +) + +cc_toolchain( + name = "cc-compiler-armeabi-v7a", + toolchain_identifier = "stub_armeabi-v7a", + toolchain_config = ":stub_armeabi-v7a", + all_files = ":empty", + ar_files = ":empty", + as_files = ":empty", + compiler_files = ":empty", + dwp_files = ":empty", + linker_files = ":empty", + objcopy_files = ":empty", + strip_files = ":empty", + supports_param_files = 1, +) + +cc_toolchain_config( + name = "stub_armeabi-v7a", + cpu = "armeabi-v7a", + compiler = "compiler", +) + +toolchain( + name = "cc-toolchain-armeabi-v7a", + exec_compatible_with = [ + ], + target_compatible_with = [ + "@bazel_tools//platforms:arm", + "@bazel_tools//platforms:android", + ], + toolchain = ":cc-compiler-armeabi-v7a", + toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", +) + +filegroup( + name = "link_dynamic_library", + srcs = ["link_dynamic_library.sh"], +) + diff --git a/third_party/toolchains/bazel_0.26.0_rbe_windows/Dockerfile b/third_party/toolchains/bazel_0.26.0_rbe_windows/Dockerfile new file mode 100644 index 00000000000..bbfce76436d --- /dev/null +++ b/third_party/toolchains/bazel_0.26.0_rbe_windows/Dockerfile @@ -0,0 +1,96 @@ +# This Dockerfile creates an image that: +# - Has the correct MTU setting for networking from inside the container to work. +# - Has Visual Studio 2015 Build Tools installed. +# - Has msys2 + git, curl, zip, unzip installed. +# - Has Python 2.7 installed. +# - Has Bazel installed. + +# TODO(jsharpe): Consider replacing "ADD $URI $DEST" with "Invoke-WebRequest -Method Get -Uri $URI -OutFile $DEST" + +# Use the latest Windows Server Core image. +# +# WARNING: What's the `:1803` about? There are two versions of Windows Server +# 2016: a "regular" one (corresponding to `microsoft/windowsservercore`) is on +# a slow release cadence, and a fast release cadence one (corresponding to +# `microsoft/windowsservercore:1803`). If you chose a different image than +# described above, probably omit the `:1803` or change it to a different +# number. +FROM microsoft/windowsservercore:1803 + +SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command", "$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue'; $VerbosePreference = 'Continue';"] + +# TODO(b/112379377): Workaround until bug is fixed. +RUN netsh interface ipv4 set subinterface \"vEthernet (Ethernet)\" mtu=1460 store=persistent + +# Install Visual Studio 2015 Build Tools. +RUN Invoke-WebRequest "https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe" \ + -OutFile visualcppbuildtools_full.exe -UseBasicParsing ; \ + Start-Process -FilePath 'visualcppbuildtools_full.exe' -ArgumentList '/quiet', '/NoRestart' -Wait ; \ + Remove-Item .\visualcppbuildtools_full.exe; + +# TODO(jsharpe): Alternate install for msys2: https://github.com/StefanScherer/dockerfiles-windows/issues/30 + +# Install 7-Zip and add it to the path. +ADD https://www.7-zip.org/a/7z1801-x64.msi C:\\TEMP\\7z.msi +RUN Start-Process msiexec.exe -ArgumentList \"/i C:\\TEMP\\7z.msi /qn /norestart /log C:\\TEMP\\7z_install_log.txt\" -wait +RUN $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path; \ + $newpath = \"$oldpath;C:\Program Files\7-Zip\"; \ + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath + +# Install msys2, and add some extra tools. +ADD http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20161025.tar.xz C:\\TEMP\\msys2.tar.xz +RUN 7z x C:\TEMP\msys2.tar.xz -oC:\TEMP\msys2.tar +RUN 7z x C:\TEMP\msys2.tar -oC:\tools +RUN $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path; \ + $newpath = \"$oldpath;C:\tools\msys64;C:\tools\msys64\usr\bin\"; \ + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath +RUN Start-Process msys2 -ArgumentList 'pacman -noconfirm -Syuu git curl zip unzip' -Wait + +# Install Visual C++ Redistributable for Visual Studio 2015: +ADD https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe C:\\TEMP\\vc_redist.x64.exe +RUN C:\TEMP\vc_redist.x64.exe /quiet /install + +# Install Python 2.7. +ADD https://www.python.org/ftp/python/2.7.14/python-2.7.14.amd64.msi C:\\TEMP\\python.msi +RUN Start-Process msiexec.exe -ArgumentList \"/i C:\\TEMP\\python.msi /qn /norestart /log C:\\TEMP\\python_install_log.txt\" -wait +RUN $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path; \ + $newpath = \"$oldpath;C:\Python27\"; \ + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath + +# Install Bazel. +RUN Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name BAZEL_SH -Value \"C:\tools\msys64\usr\bin\bash.exe\" +RUN Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name BAZEL_VC -Value \"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\" +RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; +ADD https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel-0.26.0-windows-x86_64.exe C:\\bin\\bazel.exe +RUN $oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path; \ + $newpath = \"$oldpath;C:\bin\"; \ + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath + +# TODO(jsharpe): This requires entropy so may be problematic on a headless machine: https://wiki.archlinux.org/index.php/Pacman/Package_signing#Initializing_the_keyring +RUN Start-Process msys2 -ArgumentList 'pacman-key --init' -Wait +# TODO(jsharpe): If you don't run this then the next command can't succeed since it needs to prompt to remove catgets. +RUN pacman --noconfirm -R libcatgets catgets +# Bazel documentation says to use -Syuu but this doesn't work in Docker. See +# http://g/foundry-windows/PDMVXbGew7Y +RUN pacman --noconfirm -Syy git curl zip unzip + +RUN \ + Add-Type -AssemblyName \"System.IO.Compression.FileSystem\"; \ + $zulu_url = \"https://cdn.azul.com/zulu/bin/zulu8.28.0.1-jdk8.0.163-win_x64.zip\"; \ + $zulu_zip = \"c:\\temp\\zulu8.28.0.1-jdk8.0.163-win_x64.zip\"; \ + $zulu_extracted_path = \"c:\\temp\\\" + [IO.Path]::GetFileNameWithoutExtension($zulu_zip); \ + $zulu_root = \"c:\\openjdk\"; \ + (New-Object Net.WebClient).DownloadFile($zulu_url, $zulu_zip); \ + [System.IO.Compression.ZipFile]::ExtractToDirectory($zulu_zip, \"c:\\temp\"); \ + Move-Item $zulu_extracted_path -Destination $zulu_root; \ + Remove-Item $zulu_zip; \ + $env:PATH = [Environment]::GetEnvironmentVariable(\"PATH\", \"Machine\") + \";${zulu_root}\\bin\"; \ + [Environment]::SetEnvironmentVariable(\"PATH\", $env:PATH, \"Machine\"); \ + $env:JAVA_HOME = $zulu_root; \ + [Environment]::SetEnvironmentVariable(\"JAVA_HOME\", $env:JAVA_HOME, \"Machine\") + +# Restore default shell for Windows containers. +SHELL ["cmd.exe", "/s", "/c"] + +# Default to PowerShell if no other command specified. +CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"] diff --git a/third_party/toolchains/bazel_0.26.0_rbe_windows/cc_toolchain_config.bzl b/third_party/toolchains/bazel_0.26.0_rbe_windows/cc_toolchain_config.bzl new file mode 100644 index 00000000000..20b4316c591 --- /dev/null +++ b/third_party/toolchains/bazel_0.26.0_rbe_windows/cc_toolchain_config.bzl @@ -0,0 +1,1728 @@ +# Copyright 2019 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""A Starlark cc_toolchain configuration rule""" +load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", + "action_config", + "artifact_name_pattern", + "env_entry", + "env_set", + "feature", + "feature_set", + "flag_group", + "flag_set", + "make_variable", + "tool", + "tool_path", + "variable_with_value", + "with_feature_set", + ) +load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") + + +all_compile_actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.clif_match, + ACTION_NAMES.lto_backend, +] + +all_cpp_compile_actions = [ + ACTION_NAMES.cpp_compile, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.clif_match, +] + +preprocessor_compile_actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.clif_match, +] + +codegen_compile_actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, +] + +all_link_actions = [ + ACTION_NAMES.cpp_link_executable, + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, +] + +def _windows_msvc_impl(ctx): + toolchain_identifier = "msvc_x64" + host_system_name = "local" + target_system_name = "local" + target_cpu = "x64_windows" + target_libc = "msvcrt" + compiler = "msvc-cl" + abi_version = "local" + abi_libc_version = "local" + cc_target_os = None + builtin_sysroot = None + + cxx_builtin_include_directories = [ + # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087. + "C:\\botcode\\w", + "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE", + "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt" + ] + + cpp_link_nodeps_dynamic_library_action = action_config( + action_name = ACTION_NAMES.cpp_link_nodeps_dynamic_library, + implies = [ + "nologo", + "shared_flag", + "linkstamps", + "output_execpath_flags", + "input_param_flags", + "user_link_flags", + "default_link_flags", + "linker_subsystem_flag", + "linker_param_file", + "msvc_env", + "no_stripping", + "has_configured_linker_path", + "def_file", + ], + tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/link.exe")], + ) + + cpp_link_static_library_action = action_config( + action_name = ACTION_NAMES.cpp_link_static_library, + implies = [ + "nologo", + "archiver_flags", + "input_param_flags", + "linker_param_file", + "msvc_env", + ], + tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/lib.exe")], + ) + + assemble_action = action_config( + action_name = ACTION_NAMES.assemble, + implies = [ + "compiler_input_flags", + "compiler_output_flags", + "nologo", + "msvc_env", + "sysroot", + ], + tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/ml64.exe")], + ) + + preprocess_assemble_action = action_config( + action_name = ACTION_NAMES.preprocess_assemble, + implies = [ + "compiler_input_flags", + "compiler_output_flags", + "nologo", + "msvc_env", + "sysroot", + ], + tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/ml64.exe")], + ) + + c_compile_action = action_config( + action_name = ACTION_NAMES.c_compile, + implies = [ + "compiler_input_flags", + "compiler_output_flags", + "default_compile_flags", + "nologo", + "msvc_env", + "parse_showincludes", + "user_compile_flags", + "sysroot", + "unfiltered_compile_flags", + ], + tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe")], + ) + + cpp_compile_action = action_config( + action_name = ACTION_NAMES.cpp_compile, + implies = [ + "compiler_input_flags", + "compiler_output_flags", + "default_compile_flags", + "nologo", + "msvc_env", + "parse_showincludes", + "user_compile_flags", + "sysroot", + "unfiltered_compile_flags", + ], + tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe")], + ) + + cpp_link_executable_action = action_config( + action_name = ACTION_NAMES.cpp_link_executable, + implies = [ + "nologo", + "linkstamps", + "output_execpath_flags", + "input_param_flags", + "user_link_flags", + "default_link_flags", + "linker_subsystem_flag", + "linker_param_file", + "msvc_env", + "no_stripping", + ], + tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/link.exe")], + ) + + cpp_link_dynamic_library_action = action_config( + action_name = ACTION_NAMES.cpp_link_dynamic_library, + implies = [ + "nologo", + "shared_flag", + "linkstamps", + "output_execpath_flags", + "input_param_flags", + "user_link_flags", + "default_link_flags", + "linker_subsystem_flag", + "linker_param_file", + "msvc_env", + "no_stripping", + "has_configured_linker_path", + "def_file", + ], + tools = [tool(path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/link.exe")], + ) + + action_configs = [ + assemble_action, + preprocess_assemble_action, + c_compile_action, + cpp_compile_action, + cpp_link_executable_action, + cpp_link_dynamic_library_action, + cpp_link_nodeps_dynamic_library_action, + cpp_link_static_library_action, + ] + + msvc_link_env_feature = feature( + name = "msvc_link_env", + env_sets = [ + env_set( + actions = all_link_actions + + [ACTION_NAMES.cpp_link_static_library], + env_entries = [env_entry(key = "LIB", value = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\LIB\\amd64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x64;C:\\Program Files (x86)\\Windows Kits\\8.1\\lib\\winv6.3\\um\\x64;")], + ), + ], + ) + + shared_flag_feature = feature( + name = "shared_flag", + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, + ], + flag_groups = [flag_group(flags = ["/DLL"])], + ), + ], + ) + + determinism_feature = feature( + name = "determinism", + enabled = True, + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [ + flag_group( + flags = [ + "/wd4117", + "-D__DATE__=\"redacted\"", + "-D__TIMESTAMP__=\"redacted\"", + "-D__TIME__=\"redacted\"", + ], + ), + ], + ), + ], + ) + + sysroot_feature = feature( + name = "sysroot", + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.cpp_link_executable, + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, + ], + flag_groups = [ + flag_group( + flags = ["--sysroot=%{sysroot}"], + iterate_over = "sysroot", + expand_if_available = "sysroot", + ), + ], + ), + ], + ) + + unfiltered_compile_flags_feature = feature( + name = "unfiltered_compile_flags", + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ], + flag_groups = [ + flag_group( + flags = ["%{unfiltered_compile_flags}"], + iterate_over = "unfiltered_compile_flags", + expand_if_available = "unfiltered_compile_flags", + ), + ], + ), + ], + ) + + compiler_param_file_feature = feature( + name = "compiler_param_file", + ) + + copy_dynamic_libraries_to_binary_feature = feature(name = "copy_dynamic_libraries_to_binary") + + input_param_flags_feature = feature( + name = "input_param_flags", + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, + ], + flag_groups = [ + flag_group( + flags = ["/IMPLIB:%{interface_library_output_path}"], + expand_if_available = "interface_library_output_path", + ), + ], + ), + flag_set( + actions = all_link_actions, + flag_groups = [ + flag_group( + flags = ["%{libopts}"], + iterate_over = "libopts", + expand_if_available = "libopts", + ), + ], + ), + flag_set( + actions = all_link_actions + + [ACTION_NAMES.cpp_link_static_library], + flag_groups = [ + flag_group( + iterate_over = "libraries_to_link", + flag_groups = [ + flag_group( + iterate_over = "libraries_to_link.object_files", + flag_groups = [flag_group(flags = ["%{libraries_to_link.object_files}"])], + expand_if_equal = variable_with_value( + name = "libraries_to_link.type", + value = "object_file_group", + ), + ), + flag_group( + flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])], + expand_if_equal = variable_with_value( + name = "libraries_to_link.type", + value = "object_file", + ), + ), + flag_group( + flag_groups = [flag_group(flags = ["%{libraries_to_link.name}"])], + expand_if_equal = variable_with_value( + name = "libraries_to_link.type", + value = "interface_library", + ), + ), + flag_group( + flag_groups = [ + flag_group( + flags = ["%{libraries_to_link.name}"], + expand_if_false = "libraries_to_link.is_whole_archive", + ), + flag_group( + flags = ["/WHOLEARCHIVE:%{libraries_to_link.name}"], + expand_if_true = "libraries_to_link.is_whole_archive", + ), + ], + expand_if_equal = variable_with_value( + name = "libraries_to_link.type", + value = "static_library", + ), + ), + ], + expand_if_available = "libraries_to_link", + ), + ], + ), + ], + ) + + fastbuild_feature = feature( + name = "fastbuild", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/Od", "/Z7"])], + ), + flag_set( + actions = all_link_actions, + flag_groups = [ + flag_group( + flags = ["/DEBUG:FASTLINK", "/INCREMENTAL:NO"], + ), + ], + ), + ], + implies = ["generate_pdb_file"], + ) + + user_compile_flags_feature = feature( + name = "user_compile_flags", + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ], + flag_groups = [ + flag_group( + flags = ["%{user_compile_flags}"], + iterate_over = "user_compile_flags", + expand_if_available = "user_compile_flags", + ), + ], + ), + ], + ) + + archiver_flags_feature = feature( + name = "archiver_flags", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.cpp_link_static_library], + flag_groups = [ + flag_group( + flags = ["/OUT:%{output_execpath}"], + expand_if_available = "output_execpath", + ), + flag_group( + flags = ["/MACHINE:X64"] + ), + ], + ), + ], + ) + + default_link_flags_feature = feature( + name = "default_link_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = [flag_group(flags = ["/MACHINE:X64"])], + ), + ], + ) + + static_link_msvcrt_feature = feature(name = "static_link_msvcrt") + + dynamic_link_msvcrt_debug_feature = feature( + name = "dynamic_link_msvcrt_debug", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/MDd"])], + ), + flag_set( + actions = all_link_actions, + flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrtd.lib"])], + ), + ], + requires = [feature_set(features = ["dbg"])], + ) + + dbg_feature = feature( + name = "dbg", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/Od", "/Z7"])], + ), + flag_set( + actions = all_link_actions, + flag_groups = [ + flag_group( + flags = ["/DEBUG:FULL", "/INCREMENTAL:NO"], + ), + ], + ), + ], + implies = ["generate_pdb_file"], + ) + + opt_feature = feature( + name = "opt", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/O2"])], + ), + ], + implies = ["frame_pointer"], + ) + + supports_interface_shared_libraries_feature = feature( + name = "supports_interface_shared_libraries", + enabled = True, + ) + + user_link_flags_feature = feature( + name = "user_link_flags", + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = [ + flag_group( + flags = ["%{user_link_flags}"], + iterate_over = "user_link_flags", + expand_if_available = "user_link_flags", + ), + ], + ), + ], + ) + + default_compile_flags_feature = feature( + name = "default_compile_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = [ + flag_group( + flags = [ + "/DCOMPILER_MSVC", + "/DNOMINMAX", + "/D_WIN32_WINNT=0x0601", + "/D_CRT_SECURE_NO_DEPRECATE", + "/D_CRT_SECURE_NO_WARNINGS", + "/bigobj", + "/Zm500", + "/EHsc", + "/wd4351", + "/wd4291", + "/wd4250", + "/wd4996", + ], + ), + ], + ), + ], + ) + + msvc_compile_env_feature = feature( + name = "msvc_compile_env", + env_sets = [ + env_set( + actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ], + env_entries = [env_entry(key = "INCLUDE", value = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um;C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt;")], + ), + ], + ) + + preprocessor_defines_feature = feature( + name = "preprocessor_defines", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ], + flag_groups = [ + flag_group( + flags = ["/D%{preprocessor_defines}"], + iterate_over = "preprocessor_defines", + ), + ], + ), + ], + ) + + generate_pdb_file_feature = feature( + name = "generate_pdb_file", + requires = [ + feature_set(features = ["dbg"]), + feature_set(features = ["fastbuild"]), + ], + ) + + output_execpath_flags_feature = feature( + name = "output_execpath_flags", + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = [ + flag_group( + flags = ["/OUT:%{output_execpath}"], + expand_if_available = "output_execpath", + ), + ], + ), + ], + ) + + dynamic_link_msvcrt_no_debug_feature = feature( + name = "dynamic_link_msvcrt_no_debug", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/MD"])], + ), + flag_set( + actions = all_link_actions, + flag_groups = [flag_group(flags = ["/DEFAULTLIB:msvcrt.lib"])], + ), + ], + requires = [ + feature_set(features = ["fastbuild"]), + feature_set(features = ["opt"]), + ], + ) + + disable_assertions_feature = feature( + name = "disable_assertions", + enabled = True, + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/DNDEBUG"])], + with_features = [with_feature_set(features = ["opt"])], + ), + ], + ) + + has_configured_linker_path_feature = feature(name = "has_configured_linker_path") + + supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) + + no_stripping_feature = feature(name = "no_stripping") + + linker_param_file_feature = feature( + name = "linker_param_file", + flag_sets = [ + flag_set( + actions = all_link_actions + + [ACTION_NAMES.cpp_link_static_library], + flag_groups = [ + flag_group( + flags = ["@%{linker_param_file}"], + expand_if_available = "linker_param_file", + ), + ], + ), + ], + ) + + ignore_noisy_warnings_feature = feature( + name = "ignore_noisy_warnings", + enabled = True, + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.cpp_link_static_library], + flag_groups = [flag_group(flags = ["/ignore:4221"])], + ), + ], + ) + + no_legacy_features_feature = feature(name = "no_legacy_features") + + parse_showincludes_feature = feature( + name = "parse_showincludes", + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_header_parsing, + ], + flag_groups = [flag_group(flags = ["/showIncludes"])], + ), + ], + ) + + static_link_msvcrt_no_debug_feature = feature( + name = "static_link_msvcrt_no_debug", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/MT"])], + ), + flag_set( + actions = all_link_actions, + flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmt.lib"])], + ), + ], + requires = [ + feature_set(features = ["fastbuild"]), + feature_set(features = ["opt"]), + ], + ) + + treat_warnings_as_errors_feature = feature( + name = "treat_warnings_as_errors", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/WX"])], + ), + ], + ) + + windows_export_all_symbols_feature = feature(name = "windows_export_all_symbols") + + no_windows_export_all_symbols_feature = feature(name = "no_windows_export_all_symbols") + + include_paths_feature = feature( + name = "include_paths", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ], + flag_groups = [ + flag_group( + flags = ["/I%{quote_include_paths}"], + iterate_over = "quote_include_paths", + ), + flag_group( + flags = ["/I%{include_paths}"], + iterate_over = "include_paths", + ), + flag_group( + flags = ["/I%{system_include_paths}"], + iterate_over = "system_include_paths", + ), + ], + ), + ], + ) + + linkstamps_feature = feature( + name = "linkstamps", + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = [ + flag_group( + flags = ["%{linkstamp_paths}"], + iterate_over = "linkstamp_paths", + expand_if_available = "linkstamp_paths", + ), + ], + ), + ], + ) + + targets_windows_feature = feature( + name = "targets_windows", + enabled = True, + implies = ["copy_dynamic_libraries_to_binary"], + ) + + linker_subsystem_flag_feature = feature( + name = "linker_subsystem_flag", + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = [flag_group(flags = ["/SUBSYSTEM:CONSOLE"])], + ), + ], + ) + + static_link_msvcrt_debug_feature = feature( + name = "static_link_msvcrt_debug", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/MTd"])], + ), + flag_set( + actions = all_link_actions, + flag_groups = [flag_group(flags = ["/DEFAULTLIB:libcmtd.lib"])], + ), + ], + requires = [feature_set(features = ["dbg"])], + ) + + frame_pointer_feature = feature( + name = "frame_pointer", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/Oy-"])], + ), + ], + ) + + compiler_output_flags_feature = feature( + name = "compiler_output_flags", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.assemble], + flag_groups = [ + flag_group( + flag_groups = [ + flag_group( + flags = ["/Fo%{output_file}", "/Zi"], + expand_if_available = "output_file", + expand_if_not_available = "output_assembly_file", + ), + ], + expand_if_not_available = "output_preprocess_file", + ), + ], + ), + flag_set( + actions = [ + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ], + flag_groups = [ + flag_group( + flag_groups = [ + flag_group( + flags = ["/Fo%{output_file}"], + expand_if_not_available = "output_preprocess_file", + ), + ], + expand_if_available = "output_file", + expand_if_not_available = "output_assembly_file", + ), + flag_group( + flag_groups = [ + flag_group( + flags = ["/Fa%{output_file}"], + expand_if_available = "output_assembly_file", + ), + ], + expand_if_available = "output_file", + ), + flag_group( + flag_groups = [ + flag_group( + flags = ["/P", "/Fi%{output_file}"], + expand_if_available = "output_preprocess_file", + ), + ], + expand_if_available = "output_file", + ), + ], + ), + ], + ) + + nologo_feature = feature( + name = "nologo", + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.cpp_link_executable, + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, + ACTION_NAMES.cpp_link_static_library, + ], + flag_groups = [flag_group(flags = ["/nologo"])], + ), + ], + ) + + smaller_binary_feature = feature( + name = "smaller_binary", + enabled = True, + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [flag_group(flags = ["/Gy", "/Gw"])], + with_features = [with_feature_set(features = ["opt"])], + ), + flag_set( + actions = all_link_actions, + flag_groups = [flag_group(flags = ["/OPT:ICF", "/OPT:REF"])], + with_features = [with_feature_set(features = ["opt"])], + ), + ], + ) + + compiler_input_flags_feature = feature( + name = "compiler_input_flags", + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ], + flag_groups = [ + flag_group( + flags = ["/c", "%{source_file}"], + expand_if_available = "source_file", + ), + ], + ), + ], + ) + + def_file_feature = feature( + name = "def_file", + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = [ + flag_group( + flags = ["/DEF:%{def_file_path}", "/ignore:4070"], + expand_if_available = "def_file_path", + ), + ], + ), + ], + ) + + msvc_env_feature = feature( + name = "msvc_env", + env_sets = [ + env_set( + actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.cpp_link_executable, + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, + ACTION_NAMES.cpp_link_static_library, + ], + env_entries = [ + env_entry(key = "PATH", value = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\amd64;C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Windows\\Microsoft.NET\\Framework64\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x64;C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x86;;C:\\Windows\\system32"), + env_entry(key = "TMP", value = "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp"), + env_entry(key = "TEMP", value = "C:\\Users\\ContainerAdministrator\\AppData\\Local\\Temp"), + ], + ), + ], + implies = ["msvc_compile_env", "msvc_link_env"], + ) + + features = [ + no_legacy_features_feature, + nologo_feature, + has_configured_linker_path_feature, + no_stripping_feature, + targets_windows_feature, + copy_dynamic_libraries_to_binary_feature, + default_compile_flags_feature, + msvc_env_feature, + msvc_compile_env_feature, + msvc_link_env_feature, + include_paths_feature, + preprocessor_defines_feature, + parse_showincludes_feature, + generate_pdb_file_feature, + shared_flag_feature, + linkstamps_feature, + output_execpath_flags_feature, + archiver_flags_feature, + input_param_flags_feature, + linker_subsystem_flag_feature, + user_link_flags_feature, + default_link_flags_feature, + linker_param_file_feature, + static_link_msvcrt_feature, + static_link_msvcrt_no_debug_feature, + dynamic_link_msvcrt_no_debug_feature, + static_link_msvcrt_debug_feature, + dynamic_link_msvcrt_debug_feature, + dbg_feature, + fastbuild_feature, + opt_feature, + frame_pointer_feature, + disable_assertions_feature, + determinism_feature, + treat_warnings_as_errors_feature, + smaller_binary_feature, + ignore_noisy_warnings_feature, + user_compile_flags_feature, + sysroot_feature, + unfiltered_compile_flags_feature, + compiler_param_file_feature, + compiler_output_flags_feature, + compiler_input_flags_feature, + def_file_feature, + windows_export_all_symbols_feature, + no_windows_export_all_symbols_feature, + supports_dynamic_linker_feature, + supports_interface_shared_libraries_feature, + ] + + artifact_name_patterns = [ + artifact_name_pattern( + category_name = "object_file", + prefix = "", + extension = ".obj", + ), + artifact_name_pattern( + category_name = "static_library", + prefix = "", + extension = ".lib", + ), + artifact_name_pattern( + category_name = "alwayslink_static_library", + prefix = "", + extension = ".lo.lib", + ), + artifact_name_pattern( + category_name = "executable", + prefix = "", + extension = ".exe", + ), + artifact_name_pattern( + category_name = "dynamic_library", + prefix = "", + extension = ".dll", + ), + artifact_name_pattern( + category_name = "interface_library", + prefix = "", + extension = ".if.lib", + ), + ] + + make_variables = [] + + tool_paths = [ + tool_path(name = "ar", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/lib.exe"), + tool_path(name = "ml", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/ml64.exe"), + tool_path(name = "cpp", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe"), + tool_path(name = "gcc", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe"), + tool_path(name = "gcov", path = "wrapper/bin/msvc_nop.bat"), + tool_path(name = "ld", path = "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/link.exe"), + tool_path(name = "nm", path = "wrapper/bin/msvc_nop.bat"), + tool_path( + name = "objcopy", + path = "wrapper/bin/msvc_nop.bat", + ), + tool_path( + name = "objdump", + path = "wrapper/bin/msvc_nop.bat", + ), + tool_path( + name = "strip", + path = "wrapper/bin/msvc_nop.bat", + ), + ] + + return cc_common.create_cc_toolchain_config_info( + ctx = ctx, + features = features, + action_configs = action_configs, + artifact_name_patterns = artifact_name_patterns, + cxx_builtin_include_directories = cxx_builtin_include_directories, + toolchain_identifier = toolchain_identifier, + host_system_name = host_system_name, + target_system_name = target_system_name, + target_cpu = target_cpu, + target_libc = target_libc, + compiler = compiler, + abi_version = abi_version, + abi_libc_version = abi_libc_version, + tool_paths = tool_paths, + make_variables = make_variables, + builtin_sysroot = builtin_sysroot, + cc_target_os = None, + ) + +def _windows_msys_mingw_impl(ctx): + toolchain_identifier = "msys_x64_mingw" + host_system_name = "local" + target_system_name = "local" + target_cpu = "x64_windows" + target_libc = "mingw" + compiler = "mingw-gcc" + abi_version = "local" + abi_libc_version = "local" + cc_target_os = None + builtin_sysroot = None + action_configs = [] + + targets_windows_feature = feature( + name = "targets_windows", + implies = ["copy_dynamic_libraries_to_binary"], + enabled = True, + ) + + copy_dynamic_libraries_to_binary_feature = feature(name= "copy_dynamic_libraries_to_binary") + + gcc_env_feature = feature( + name = "gcc_env", + enabled = True, + env_sets = [ + env_set ( + actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.cpp_link_executable, + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, + ACTION_NAMES.cpp_link_static_library, + ], + env_entries = [ + env_entry(key = "PATH", value = "c:/tools/msys64/mingw64/bin") + ], + ), + ], + ) + + msys_mingw_flags = [ + "-std=gnu++0x" + ] + msys_mingw_link_flags = [ + "-lstdc++" + ] + + default_compile_flags_feature = feature( + name = "default_compile_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + ), + flag_set( + actions = [ + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = ([flag_group(flags = msys_mingw_flags)] if msys_mingw_flags else []), + ), + ], + ) + + compiler_param_file_feature = feature( + name = "compiler_param_file", + ) + + default_link_flags_feature = feature( + name = "default_link_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = ([flag_group(flags = msys_mingw_link_flags)] if msys_mingw_link_flags else []), + ), + ], + ) + + supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) + + features = [ + targets_windows_feature, + copy_dynamic_libraries_to_binary_feature, + gcc_env_feature, + default_compile_flags_feature, + compiler_param_file_feature, + default_link_flags_feature, + supports_dynamic_linker_feature, + ] + + cxx_builtin_include_directories = [ + # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087. + "C:\\botcode\\w", + "c:/tools/msys64/mingw64/", + "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE", + "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt" + ] + + artifact_name_patterns = [ + artifact_name_pattern( + category_name = "executable", + prefix = "", + extension = ".exe", + ), + ] + + make_variables = [] + tool_paths = [ + tool_path (name= "ar", path= "c:/tools/msys64/mingw64/bin/ar"), + tool_path (name= "compat-ld", path= "c:/tools/msys64/mingw64/bin/ld"), + tool_path (name= "cpp", path= "c:/tools/msys64/mingw64/bin/cpp"), + tool_path (name= "dwp", path= "c:/tools/msys64/mingw64/bin/dwp"), + tool_path (name= "gcc", path= "c:/tools/msys64/mingw64/bin/gcc"), + tool_path (name= "gcov", path= "c:/tools/msys64/mingw64/bin/gcov"), + tool_path (name= "ld", path= "c:/tools/msys64/mingw64/bin/ld"), + tool_path (name= "nm", path= "c:/tools/msys64/mingw64/bin/nm"), + tool_path (name= "objcopy", path= "c:/tools/msys64/mingw64/bin/objcopy"), + tool_path (name= "objdump", path= "c:/tools/msys64/mingw64/bin/objdump"), + tool_path (name= "strip", path= "c:/tools/msys64/mingw64/bin/strip"), + + ] + + return cc_common.create_cc_toolchain_config_info( + ctx = ctx, + features = features, + action_configs = action_configs, + artifact_name_patterns = artifact_name_patterns, + cxx_builtin_include_directories = cxx_builtin_include_directories, + toolchain_identifier = toolchain_identifier, + host_system_name = host_system_name, + target_system_name = target_system_name, + target_cpu = target_cpu, + target_libc = target_libc, + compiler = compiler, + abi_version = abi_version, + abi_libc_version = abi_libc_version, + tool_paths = tool_paths, + make_variables = make_variables, + builtin_sysroot = builtin_sysroot, + cc_target_os = cc_target_os) + + +def _armeabi_impl(ctx): + toolchain_identifier = "stub_armeabi-v7a" + host_system_name = "armeabi-v7a" + target_system_name = "armeabi-v7a" + target_cpu = "armeabi-v7a" + target_libc = "armeabi-v7a" + compiler = "compiler" + abi_version = "armeabi-v7a" + abi_libc_version = "armeabi-v7a" + cc_target_os = None + builtin_sysroot = None + action_configs = [] + + supports_pic_feature = feature(name = "supports_pic", enabled = True) + supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) + features = [supports_dynamic_linker_feature, supports_pic_feature] + + cxx_builtin_include_directories = [ + # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087. + "C:\\botcode\\w",] + artifact_name_patterns = [] + make_variables = [] + + tool_paths = [ + tool_path(name = "ar", path = "/bin/false"), + tool_path(name = "compat-ld", path = "/bin/false"), + tool_path(name = "cpp", path = "/bin/false"), + tool_path(name = "dwp", path = "/bin/false"), + tool_path(name = "gcc", path = "/bin/false"), + tool_path(name = "gcov", path = "/bin/false"), + tool_path(name = "ld", path = "/bin/false"), + tool_path(name = "nm", path = "/bin/false"), + tool_path(name = "objcopy", path = "/bin/false"), + tool_path(name = "objdump", path = "/bin/false"), + tool_path(name = "strip", path = "/bin/false"), + ] + + return cc_common.create_cc_toolchain_config_info( + ctx = ctx, + features = features, + action_configs = action_configs, + artifact_name_patterns = artifact_name_patterns, + cxx_builtin_include_directories = cxx_builtin_include_directories, + toolchain_identifier = toolchain_identifier, + host_system_name = host_system_name, + target_system_name = target_system_name, + target_cpu = target_cpu, + target_libc = target_libc, + compiler = compiler, + abi_version = abi_version, + abi_libc_version = abi_libc_version, + tool_paths = tool_paths, + make_variables = make_variables, + builtin_sysroot = builtin_sysroot, + cc_target_os = cc_target_os + ) + +def _impl(ctx): + if ctx.attr.cpu == "armeabi-v7a": + return _armeabi_impl(ctx) + elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "msvc-cl": + return _windows_msvc_impl(ctx) + elif ctx.attr.cpu == "x64_windows" and ctx.attr.compiler == "mingw-gcc": + return _windows_msys_mingw_impl(ctx) + + tool_paths = [ + tool_path (name= "ar", path= "c:/tools/msys64/usr/bin/ar"), + tool_path (name= "compat-ld", path= "c:/tools/msys64/usr/bin/ld"), + tool_path (name= "cpp", path= "c:/tools/msys64/usr/bin/cpp"), + tool_path (name= "dwp", path= "c:/tools/msys64/usr/bin/dwp"), + tool_path (name= "gcc", path= "c:/tools/msys64/usr/bin/gcc"), + tool_path (name= "gcov", path= "c:/tools/msys64/usr/bin/gcov"), + tool_path (name= "ld", path= "c:/tools/msys64/usr/bin/ld"), + tool_path (name= "nm", path= "c:/tools/msys64/usr/bin/nm"), + tool_path (name= "objcopy", path= "c:/tools/msys64/usr/bin/objcopy"), + tool_path (name= "objdump", path= "c:/tools/msys64/usr/bin/objdump"), + tool_path (name= "strip", path= "c:/tools/msys64/usr/bin/strip"), + + ] + + cxx_builtin_include_directories = [ + # This is a workaround for https://github.com/bazelbuild/bazel/issues/5087. + "C:\\botcode\\w", + "c:/tools/msys64/usr/", + "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE", + "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\shared", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\um", + "C:\\Program Files (x86)\\Windows Kits\\8.1\\include\\winrt" + ] + + action_configs = [] + + compile_flags = [ + + ] + + dbg_compile_flags = [ + + ] + + opt_compile_flags = [ + + ] + + cxx_flags = [ + "-std=gnu++0x" + ] + + link_flags = [ + "-lstdc++" + ] + + opt_link_flags = [ + + ] + + unfiltered_compile_flags = [ + + ] + + targets_windows_feature = feature( + name = "targets_windows", + implies = ["copy_dynamic_libraries_to_binary"], + enabled = True, + ) + + copy_dynamic_libraries_to_binary_feature = feature(name= "copy_dynamic_libraries_to_binary") + + gcc_env_feature = feature( + name = "gcc_env", + enabled = True, + env_sets = [ + env_set ( + actions = [ + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.cpp_link_executable, + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, + ACTION_NAMES.cpp_link_static_library, + ], + env_entries = [ + env_entry(key = "PATH", value = "c:/tools/msys64/usr/bin") + ], + ), + ], + ) + + windows_features = [ + targets_windows_feature, + copy_dynamic_libraries_to_binary_feature, + gcc_env_feature, + ] + + + + supports_pic_feature = feature( + name = "supports_pic", + enabled = True, + ) + supports_start_end_lib_feature = feature( + name = "supports_start_end_lib", + enabled = True, + ) + + default_compile_flags_feature = feature( + name = "default_compile_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = ([flag_group(flags = compile_flags)] if compile_flags else []), + ), + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = ([flag_group(flags = dbg_compile_flags)] if dbg_compile_flags else []), + with_features = [with_feature_set(features = ["dbg"])], + ), + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = ([flag_group(flags = opt_compile_flags)] if opt_compile_flags else []), + with_features = [with_feature_set(features = ["opt"])], + ), + flag_set( + actions = [ + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = ([flag_group(flags = cxx_flags)] if cxx_flags else []), + ), + ], + ) + + default_link_flags_feature = feature( + name = "default_link_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = all_link_actions, + flag_groups = ([flag_group(flags = link_flags)] if link_flags else []), + ), + flag_set( + actions = all_link_actions, + flag_groups = ([flag_group(flags = opt_link_flags)] if opt_link_flags else []), + with_features = [with_feature_set(features = ["opt"])], + ), + ], + ) + + dbg_feature = feature(name = "dbg") + + opt_feature = feature(name = "opt") + + sysroot_feature = feature( + name = "sysroot", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ACTION_NAMES.cpp_link_executable, + ACTION_NAMES.cpp_link_dynamic_library, + ACTION_NAMES.cpp_link_nodeps_dynamic_library, + ], + flag_groups = [ + flag_group( + flags = ["--sysroot=%{sysroot}"], + expand_if_available = "sysroot", + ), + ], + ), + ], + ) + + fdo_optimize_feature = feature( + name = "fdo_optimize", + flag_sets = [ + flag_set( + actions = [ACTION_NAMES.c_compile, ACTION_NAMES.cpp_compile], + flag_groups = [ + flag_group( + flags = [ + "-fprofile-use=%{fdo_profile_path}", + "-fprofile-correction", + ], + expand_if_available = "fdo_profile_path", + ), + ], + ), + ], + provides = ["profile"], + ) + + supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True) + + user_compile_flags_feature = feature( + name = "user_compile_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = [ + flag_group( + flags = ["%{user_compile_flags}"], + iterate_over = "user_compile_flags", + expand_if_available = "user_compile_flags", + ), + ], + ), + ], + ) + + unfiltered_compile_flags_feature = feature( + name = "unfiltered_compile_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = ([flag_group(flags = unfiltered_compile_flags)] if unfiltered_compile_flags else []), + ), + ], + ) + + features = windows_features + [ + supports_pic_feature, + + + default_compile_flags_feature, + default_link_flags_feature, + fdo_optimize_feature, + supports_dynamic_linker_feature, + dbg_feature, + opt_feature, + user_compile_flags_feature, + sysroot_feature, + unfiltered_compile_flags_feature, + ] + + artifact_name_patterns = [ + artifact_name_pattern(category_name="executable", prefix="", extension=".exe"), + ] + + make_variables = [] + + return cc_common.create_cc_toolchain_config_info( + ctx = ctx, + features = features, + action_configs = action_configs, + artifact_name_patterns = artifact_name_patterns, + cxx_builtin_include_directories = cxx_builtin_include_directories, + toolchain_identifier = "msys_x64", + host_system_name = "local", + target_system_name = "local", + target_cpu = "x64_windows", + target_libc = "msys", + compiler = "msys-gcc", + abi_version = "local", + abi_libc_version = "local", + tool_paths = tool_paths, + make_variables = make_variables, + builtin_sysroot = "", + cc_target_os = None, + ) + +cc_toolchain_config = rule( + implementation = _impl, + attrs = { + "cpu" : attr.string(mandatory = True), + "compiler": attr.string(), + }, + provides = [CcToolchainConfigInfo], +) + diff --git a/third_party/upb b/third_party/upb index fa88c6017dd..423ea5ca9ce 160000 --- a/third_party/upb +++ b/third_party/upb @@ -1 +1 @@ -Subproject commit fa88c6017ddb490aa78c57bea682193f533ed69a +Subproject commit 423ea5ca9ce8da69611e6e95559efcb3a1ba8ad8 diff --git a/tools/buildgen/plugins/expand_filegroups.py b/tools/buildgen/plugins/expand_filegroups.py index 99d9463b3f9..99e33332c85 100755 --- a/tools/buildgen/plugins/expand_filegroups.py +++ b/tools/buildgen/plugins/expand_filegroups.py @@ -55,6 +55,7 @@ def mako_plugin(dictionary): libs = dictionary.get('libs') targets = dictionary.get('targets') filegroups_list = dictionary.get('filegroups') + filegroups_set = set(fg['name'] for fg in filegroups_list) filegroups = {} for fg in filegroups_list: @@ -78,8 +79,10 @@ def mako_plugin(dictionary): todo = todo[1:] # check all uses filegroups are present (if no, skip and come back later) skip = False - for uses in cur.get('uses', []): - if uses not in filegroups: + for use in cur.get('uses', []): + assert use in filegroups_set, ( + "filegroup(%s) uses non-existent %s" % (cur['name'], use)) + if use not in filegroups: skip = True if skip: skips += 1 diff --git a/tools/buildgen/plugins/expand_version.py b/tools/buildgen/plugins/expand_version.py index a73446940da..08cc10b3c60 100755 --- a/tools/buildgen/plugins/expand_version.py +++ b/tools/buildgen/plugins/expand_version.py @@ -34,18 +34,22 @@ LANGUAGES = [ class Version: - def __init__(self, s): + def __init__(self, version_str, override_major=None): self.tag = None - if '-' in s: - s, self.tag = s.split('-') - self.major, self.minor, self.patch = [int(x) for x in s.split('.')] + if '-' in version_str: + version_str, self.tag = version_str.split('-') + self.major, self.minor, self.patch = [ + int(x) for x in version_str.split('.') + ] + if override_major: + self.major = override_major def __str__(self): """Version string in a somewhat idiomatic style for most languages""" - s = '%d.%d.%d' % (self.major, self.minor, self.patch) + version_str = '%d.%d.%d' % (self.major, self.minor, self.patch) if self.tag: - s += '-%s' % self.tag - return s + version_str += '-%s' % self.tag + return version_str def pep440(self): """Version string in Python PEP440 style""" @@ -105,11 +109,15 @@ def mako_plugin(dictionary): """ settings = dictionary['settings'] - master_version = Version(settings['version']) + version_str = settings['version'] + master_version = Version(version_str) settings['version'] = master_version for language in LANGUAGES: version_tag = '%s_version' % language + override_major = settings.get('%s_major_version' % language, None) if version_tag in settings: - settings[version_tag] = Version(settings[version_tag]) + settings[version_tag] = Version( + settings[version_tag], override_major=override_major) else: - settings[version_tag] = master_version + settings[version_tag] = Version( + version_str, override_major=override_major) diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 95a545f5542..213efd22346 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -146,38 +146,35 @@ CONFIG = [ ('accept-encoding', ''), ('content-encoding', 'identity'), ('content-encoding', 'gzip'), - ('lb-token', ''), ('lb-cost-bin', ''), ] # All entries here are ignored when counting non-default initial metadata that # prevents the chttp2 server from sending a Trailers-Only response. METADATA_BATCH_CALLOUTS = [ - # (name) - (':path'), - (':method'), - (':status'), - (':authority'), - (':scheme'), - ('te'), - ('grpc-message'), - ('grpc-status'), - ('grpc-payload-bin'), - ('grpc-encoding'), - ('grpc-accept-encoding'), - ('grpc-server-stats-bin'), - ('grpc-tags-bin'), - ('grpc-trace-bin'), - ('content-type'), - ('content-encoding'), - ('accept-encoding'), - ('grpc-internal-encoding-request'), - ('grpc-internal-stream-encoding-request'), - ('user-agent'), - ('host'), - ('lb-token'), - ('grpc-previous-rpc-attempts'), - ('grpc-retry-pushback-ms'), + ':path', + ':method', + ':status', + ':authority', + ':scheme', + 'te', + 'grpc-message', + 'grpc-status', + 'grpc-payload-bin', + 'grpc-encoding', + 'grpc-accept-encoding', + 'grpc-server-stats-bin', + 'grpc-tags-bin', + 'grpc-trace-bin', + 'content-type', + 'content-encoding', + 'accept-encoding', + 'grpc-internal-encoding-request', + 'grpc-internal-stream-encoding-request', + 'user-agent', + 'host', + 'grpc-previous-rpc-attempts', + 'grpc-retry-pushback-ms', ] COMPRESSION_ALGORITHMS = [ @@ -395,16 +392,21 @@ for i, elem in enumerate(all_strs): def slice_def(i): - return ('{&grpc_static_metadata_refcounts[%d],' - ' {{%d, g_bytes+%d}}}') % (i, len(all_strs[i]), id2strofs[i]) + return ( + 'grpc_core::StaticMetadataSlice(&grpc_static_metadata_refcounts[%d], %d, g_bytes+%d)' + ) % (i, len(all_strs[i]), id2strofs[i]) # validate configuration for elem in METADATA_BATCH_CALLOUTS: assert elem in all_strs - +static_slice_dest_assert = ( + 'static_assert(std::is_trivially_destructible' + + '::value, ' + '"grpc_core::StaticMetadataSlice must be trivially destructible.");') +print >> H, static_slice_dest_assert print >> H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs) -print >> H, ('extern const grpc_slice ' +print >> H, ('extern const grpc_core::StaticMetadataSlice ' 'grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];') for i, elem in enumerate(all_strs): print >> H, '/* "%s" */' % elem @@ -428,8 +430,9 @@ print >> H, '#define GRPC_IS_STATIC_METADATA_STRING(slice) \\' print >> H, (' ((slice).refcount != NULL && (slice).refcount->GetType() == ' 'grpc_slice_refcount::Type::STATIC)') print >> H -print >> C, ('const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]' - ' = {') +print >> C, ( + 'const grpc_core::StaticMetadataSlice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]' + ' = {') for i, elem in enumerate(all_strs): print >> C, slice_def(i) + ',' print >> C, '};' diff --git a/tools/codegen/core/gen_upb_api.sh b/tools/codegen/core/gen_upb_api.sh index ff21c49362c..d7871d88671 100755 --- a/tools/codegen/core/gen_upb_api.sh +++ b/tools/codegen/core/gen_upb_api.sh @@ -16,47 +16,75 @@ # REQUIRES: Bazel set -ex -rm -rf src/core/ext/upb-generated -mkdir src/core/ext/upb-generated -cd third_party -cd upb -bazel build :protoc-gen-upb -cd ../.. +if [ $# -eq 0 ]; then + UPB_OUTPUT_DIR=$PWD/src/core/ext/upb-generated + rm -rf $UPB_OUTPUT_DIR + mkdir $UPB_OUTPUT_DIR +else + UPB_OUTPUT_DIR=$1 +fi + +pushd third_party/protobuf +bazel build :protoc +PROTOC=$PWD/bazel-bin/protoc +popd + +pushd third_party/upb +bazel build :protoc-gen-upb +UPB_PLUGIN=$PWD/bazel-bin/protoc-gen-upb +popd proto_files=( \ - "google/api/annotations.proto" \ - "google/api/http.proto" \ - "google/protobuf/any.proto" \ - "google/protobuf/descriptor.proto" \ - "google/protobuf/duration.proto" \ - "google/protobuf/empty.proto" \ - "google/protobuf/struct.proto" \ - "google/protobuf/timestamp.proto" \ - "google/protobuf/wrappers.proto" \ - "google/rpc/status.proto" \ - "gogoproto/gogo.proto" \ - "validate/validate.proto" \ - "envoy/type/percent.proto" \ - "envoy/type/range.proto" \ + "envoy/api/v2/auth/cert.proto" \ + "envoy/api/v2/cds.proto" \ + "envoy/api/v2/cluster/circuit_breaker.proto" \ + "envoy/api/v2/cluster/outlier_detection.proto" \ "envoy/api/v2/core/address.proto" \ "envoy/api/v2/core/base.proto" \ "envoy/api/v2/core/config_source.proto" \ "envoy/api/v2/core/grpc_service.proto" \ "envoy/api/v2/core/health_check.proto" \ "envoy/api/v2/core/protocol.proto" \ - "envoy/api/v2/auth/cert.proto" \ - "envoy/api/v2/cluster/circuit_breaker.proto" \ - "envoy/api/v2/cluster/outlier_detection.proto" \ "envoy/api/v2/discovery.proto" \ - "envoy/api/v2/cds.proto" \ "envoy/api/v2/eds.proto" \ "envoy/api/v2/endpoint/endpoint.proto" \ "envoy/api/v2/endpoint/load_report.proto" \ "envoy/service/discovery/v2/ads.proto" \ - "envoy/service/load_stats/v2/lrs.proto") + "envoy/service/load_stats/v2/lrs.proto" \ + "envoy/type/percent.proto" \ + "envoy/type/range.proto" \ + "gogoproto/gogo.proto" \ + "google/api/annotations.proto" \ + "google/api/http.proto" \ + "google/protobuf/any.proto" \ + "google/protobuf/descriptor.proto" \ + "google/protobuf/duration.proto" \ + "google/protobuf/empty.proto" \ + "google/protobuf/struct.proto" \ + "google/protobuf/timestamp.proto" \ + "google/protobuf/wrappers.proto" \ + "google/rpc/status.proto" \ + "grpc/gcp/altscontext.proto" \ + "grpc/gcp/handshaker.proto" \ + "grpc/gcp/transport_security_common.proto" \ + "grpc/health/v1/health.proto" \ + "grpc/lb/v1/load_balancer.proto" \ + "validate/validate.proto") for i in "${proto_files[@]}" do - protoc -I=$PWD/third_party/data-plane-api -I=$PWD/third_party/googleapis -I=$PWD/third_party/protobuf -I=$PWD/third_party/protoc-gen-validate $i --upb_out=./src/core/ext/upb-generated --plugin=protoc-gen-upb=third_party/upb/bazel-bin/protoc-gen-upb + $PROTOC \ + -I=$PWD/third_party/envoy-api \ + -I=$PWD/third_party/googleapis \ + -I=$PWD/third_party/protobuf/src \ + -I=$PWD/third_party/protoc-gen-validate \ + -I=$PWD/src/proto \ + -I=$PWD \ + $i \ + --upb_out=$UPB_OUTPUT_DIR \ + --plugin=protoc-gen-upb=$UPB_PLUGIN done + +find $UPB_OUTPUT_DIR -name "*.upbdefs.c" -type f -delete +find $UPB_OUTPUT_DIR -name "*.upbdefs.h" -type f -delete diff --git a/src/csharp/experimental/build_unitypackage.sh b/tools/distrib/check_upb_output.sh similarity index 54% rename from src/csharp/experimental/build_unitypackage.sh rename to tools/distrib/check_upb_output.sh index cca52658e85..6febd0e9835 100755 --- a/src/csharp/experimental/build_unitypackage.sh +++ b/tools/distrib/check_upb_output.sh @@ -1,5 +1,5 @@ -#!/bin/sh -# Copyright 2018 gRPC authors. +#!/bin/bash +# Copyright 2019 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,20 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Builds an experimental .unitypackage file to be imported into Unity projects. - set -ex -cd "$(dirname "$0")/.." - -dotnet restore Grpc.sln - -mkdir -p GrpcUnity -dotnet build --configuration Release --framework net45 Grpc.Core --output ../GrpcUnity +readonly UPB_GENERATED_SRC=src/core/ext/upb-generated +readonly UPB_TMP_OUTPUT="$(mktemp -d)" -#TODO: add ThirdParty/Grpc.Core: -# - assembly -# - native libraries (mac dylib need to be renamed to grpc_csharp_ext.bundle) +tools/codegen/core/gen_upb_api.sh "$UPB_TMP_OUTPUT" -#TODO: add ThirdParty/Grpc.Tools: -# - protoc and grpc plugin +diff -rq "$UPB_GENERATED_SRC" "$UPB_TMP_OUTPUT" diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 9bb01cb67f8..6c1253f7ae8 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -978,6 +978,7 @@ src/core/ext/filters/client_channel/subchannel.h \ src/core/ext/filters/client_channel/subchannel_interface.h \ src/core/ext/filters/client_channel/subchannel_pool_interface.cc \ src/core/ext/filters/client_channel/subchannel_pool_interface.h \ +src/core/ext/filters/client_idle/client_idle_filter.cc \ src/core/ext/filters/deadline/deadline_filter.cc \ src/core/ext/filters/deadline/deadline_filter.h \ src/core/ext/filters/http/client/http_client_filter.cc \ diff --git a/tools/internal_ci/macos/grpc_basictests_cpp_ios.cfg b/tools/internal_ci/macos/grpc_basictests_cpp_ios.cfg new file mode 100644 index 00000000000..3c8e402d3fc --- /dev/null +++ b/tools/internal_ci/macos/grpc_basictests_cpp_ios.cfg @@ -0,0 +1,31 @@ +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" +gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" +timeout_mins: 120 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests macos objc opt --internal_ci -j 1 --inner_jobs 4 --bq_result_table aggregate_results --extra_args -r ios-cpp-test-.*" +} diff --git a/tools/internal_ci/macos/grpc_run_bazel_tests.sh b/tools/internal_ci/macos/grpc_run_bazel_tests.sh index c64dcc5c95d..d3db59e9379 100644 --- a/tools/internal_ci/macos/grpc_run_bazel_tests.sh +++ b/tools/internal_ci/macos/grpc_run_bazel_tests.sh @@ -20,7 +20,7 @@ cd $(dirname $0)/../../.. # Download bazel temp_dir="$(mktemp -d)" -wget -q https://github.com/bazelbuild/bazel/releases/download/0.23.2/bazel-0.23.2-darwin-x86_64 -O "${temp_dir}/bazel" +wget -q https://github.com/bazelbuild/bazel/releases/download/0.26.0/bazel-0.26.0-darwin-x86_64 -O "${temp_dir}/bazel" chmod 755 "${temp_dir}/bazel" export PATH="${temp_dir}:${PATH}" # This should show ${temp_dir}/bazel diff --git a/tools/internal_ci/windows/bazel_rbe.bat b/tools/internal_ci/windows/bazel_rbe.bat index 8abab687ed2..153b2d59687 100644 --- a/tools/internal_ci/windows/bazel_rbe.bat +++ b/tools/internal_ci/windows/bazel_rbe.bat @@ -14,7 +14,7 @@ @rem TODO(jtattermusch): make this generate less output @rem TODO(jtattermusch): use tools/bazel script to keep the versions in sync -choco install bazel -y --version 0.24.1 --limit-output +choco install bazel -y --version 0.26.0 --limit-output cd github/grpc set PATH=C:\tools\msys64\usr\bin;C:\Python27;%PATH% diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 3f136b69bc2..585734283a7 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -143,6 +143,7 @@ LANG_RELEASE_MATRIX = { ReleaseInfo(runtimes=['go1.11'], testcases_file='go__v1.0.5')), ('v1.20.0', ReleaseInfo(runtimes=['go1.11'])), ('v1.21.0', ReleaseInfo(runtimes=['go1.11'])), + ('v1.22.0', ReleaseInfo(runtimes=['go1.11'])), ]), 'java': OrderedDict([ diff --git a/tools/remote_build/windows.bazelrc b/tools/remote_build/windows.bazelrc index 492489f3613..9fd3071e79f 100644 --- a/tools/remote_build/windows.bazelrc +++ b/tools/remote_build/windows.bazelrc @@ -4,9 +4,9 @@ build --remote_cache=remotebuildexecution.googleapis.com build --remote_executor=remotebuildexecution.googleapis.com build --tls_enabled=true -build --host_crosstool_top=//third_party/toolchains/bazel_0.23.2_rbe_windows:toolchain -build --crosstool_top=//third_party/toolchains/bazel_0.23.2_rbe_windows:toolchain -build --extra_toolchains=//third_party/toolchains/bazel_0.23.2_rbe_windows:cc-toolchain-x64_windows +build --host_crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain +build --crosstool_top=//third_party/toolchains/bazel_0.26.0_rbe_windows:toolchain +build --extra_toolchains=//third_party/toolchains/bazel_0.26.0_rbe_windows:cc-toolchain-x64_windows # Use custom execution platforms defined in third_party/toolchains build --extra_execution_platforms=//third_party/toolchains:rbe_windows build --host_platform=//third_party/toolchains:rbe_windows diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index ceec3f0e6c3..dc66e05873b 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3156,6 +3156,27 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "benchmark", + "gpr", + "grpc++_test_config", + "grpc++_test_util_unsecure", + "grpc++_unsecure", + "grpc_benchmark", + "grpc_test_util_unsecure", + "grpc_unsecure" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "bm_threadpool", + "src": [ + "test/cpp/microbenchmarks/bm_threadpool.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "benchmark", @@ -6680,6 +6701,7 @@ "gpr", "grpc_base", "grpc_client_authority_filter", + "grpc_client_idle_filter", "grpc_deadline_filter", "grpc_lb_policy_grpclb_secure", "grpc_lb_policy_pick_first", @@ -6722,6 +6744,7 @@ "language": "c", "name": "grpc_cronet", "src": [ + "src/core/ext/transport/cronet/plugin_registry/grpc_cronet_plugin_registry.cc", "src/core/lib/surface/init.cc" ], "third_party": false, @@ -6772,6 +6795,7 @@ "gpr", "grpc_base", "grpc_client_authority_filter", + "grpc_client_idle_filter", "grpc_deadline_filter", "grpc_lb_policy_grpclb", "grpc_lb_policy_pick_first", @@ -6938,31 +6962,6 @@ "third_party": false, "type": "lib" }, - { - "deps": [ - "census", - "gpr", - "grpc", - "grpc++_base", - "grpc++_codegen_base", - "grpc++_codegen_base_src", - "grpc_cronet", - "grpc_transport_chttp2_client_insecure", - "grpc_transport_chttp2_server_insecure" - ], - "headers": [], - "is_filegroup": false, - "language": "c++", - "name": "grpc++_cronet", - "src": [ - "src/cpp/client/cronet_credentials.cc", - "src/cpp/client/insecure_credentials.cc", - "src/cpp/common/insecure_create_auth_context.cc", - "src/cpp/server/insecure_server_credentials.cc" - ], - "third_party": false, - "type": "lib" - }, { "deps": [ "grpc++" @@ -7801,7 +7800,7 @@ { "deps": [], "headers": [ - "third_party/upb/google/protobuf/descriptor.upb.h", + "third_party/upb/generated_for_cmake/google/protobuf/descriptor.upb.h", "third_party/upb/upb/decode.h", "third_party/upb/upb/def.h", "third_party/upb/upb/encode.h", @@ -8207,6 +8206,27 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [], + "headers": [ + "src/core/ext/upb-generated/altscontext.upb.h", + "src/core/ext/upb-generated/handshaker.upb.h", + "src/core/ext/upb-generated/transport_security_common.upb.h" + ], + "is_filegroup": true, + "language": "c", + "name": "alts_upb", + "src": [ + "src/core/ext/upb-generated/altscontext.upb.c", + "src/core/ext/upb-generated/altscontext.upb.h", + "src/core/ext/upb-generated/handshaker.upb.c", + "src/core/ext/upb-generated/handshaker.upb.h", + "src/core/ext/upb-generated/transport_security_common.upb.c", + "src/core/ext/upb-generated/transport_security_common.upb.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "alts_proto", @@ -8285,6 +8305,39 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [], + "headers": [ + "src/core/ext/upb-generated/google/protobuf/any.upb.h", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", + "src/core/ext/upb-generated/google/protobuf/duration.upb.h", + "src/core/ext/upb-generated/google/protobuf/empty.upb.h", + "src/core/ext/upb-generated/google/protobuf/struct.upb.h", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h" + ], + "is_filegroup": true, + "language": "c", + "name": "google_api_upb", + "src": [ + "src/core/ext/upb-generated/google/protobuf/any.upb.c", + "src/core/ext/upb-generated/google/protobuf/any.upb.h", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.c", + "src/core/ext/upb-generated/google/protobuf/descriptor.upb.h", + "src/core/ext/upb-generated/google/protobuf/duration.upb.c", + "src/core/ext/upb-generated/google/protobuf/duration.upb.h", + "src/core/ext/upb-generated/google/protobuf/empty.upb.c", + "src/core/ext/upb-generated/google/protobuf/empty.upb.h", + "src/core/ext/upb-generated/google/protobuf/struct.upb.c", + "src/core/ext/upb-generated/google/protobuf/struct.upb.h", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.c", + "src/core/ext/upb-generated/google/protobuf/timestamp.upb.h", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.c", + "src/core/ext/upb-generated/google/protobuf/wrappers.upb.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "gpr_base_headers" @@ -9132,6 +9185,21 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "gpr", + "grpc_base" + ], + "headers": [], + "is_filegroup": true, + "language": "c", + "name": "grpc_client_idle_filter", + "src": [ + "src/core/ext/filters/client_idle/client_idle_filter.cc" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "gpr_codegen" @@ -9180,6 +9248,21 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [], + "headers": [ + "src/core/ext/upb-generated/grpc/health/v1/health.upb.c" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_health_upb", + "src": [ + "src/core/ext/upb-generated/grpc/health/v1/health.upb.c", + "src/core/ext/upb-generated/grpc/health/v1/health.upb.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "gpr", @@ -9389,6 +9472,23 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "google_api_upb" + ], + "headers": [ + "src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_lb_upb", + "src": [ + "src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.c", + "src/core/ext/upb-generated/grpc/lb/v1/load_balancer.upb.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "gpr", @@ -10024,6 +10124,7 @@ "include/grpc/grpc_cronet.h", "include/grpc/grpc_security.h", "include/grpc/grpc_security_constants.h", + "src/core/ext/transport/cronet/client/secure/cronet_channel_create.h", "src/core/ext/transport/cronet/transport/cronet_transport.h", "third_party/objective_c/Cronet/bidirectional_stream_c.h" ], @@ -10035,6 +10136,7 @@ "include/grpc/grpc_security.h", "include/grpc/grpc_security_constants.h", "src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc", + "src/core/ext/transport/cronet/client/secure/cronet_channel_create.h", "src/core/ext/transport/cronet/transport/cronet_api_dummy.cc", "src/core/ext/transport/cronet/transport/cronet_transport.cc", "src/core/ext/transport/cronet/transport/cronet_transport.h" diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index f6aac1d8cd0..33e4bc67152 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3927,6 +3927,28 @@ ], "uses_polling": true }, + { + "args": [], + "benchmark": true, + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": false, + "language": "c++", + "name": "bm_threadpool", + "platforms": [ + "linux", + "mac", + "posix" + ], + "uses_polling": false + }, { "args": [], "benchmark": true, diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 06991365136..dad570ee0ca 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1066,7 +1066,8 @@ class ObjCLanguage(object): cpu_cost=1e6, environ={ 'SCHEME': 'Sample', - 'EXAMPLE_PATH': 'src/objective-c/examples/Sample' + 'EXAMPLE_PATH': 'src/objective-c/examples/Sample', + 'FRAMEWORKS': 'NO' })) out.append( self.config.job_spec( @@ -1130,6 +1131,13 @@ class ObjCLanguage(object): environ={ 'SCHEME': 'CronetTests' })) + out.append( + self.config.job_spec( + ['test/cpp/ios/run_tests.sh'], + timeout_seconds=20 * 60, + shortname='ios-cpp-test-cronet', + cpu_cost=1e6, + environ=_FORCE_ENVIRON_FOR_WRAPPERS)) out.append( self.config.job_spec( ['src/objective-c/tests/run_one_test.sh'], @@ -1166,6 +1174,7 @@ class ObjCLanguage(object): return [ ['src/objective-c/tests/build_tests.sh'], ['test/core/iomgr/ios/CFStreamTests/build_tests.sh'], + ['test/cpp/ios/build_tests.sh'], ] def post_tests_steps(self): diff --git a/tools/run_tests/sanity/check_bazel_workspace.py b/tools/run_tests/sanity/check_bazel_workspace.py index 65aa72183d0..10fb0ccf6a8 100755 --- a/tools/run_tests/sanity/check_bazel_workspace.py +++ b/tools/run_tests/sanity/check_bazel_workspace.py @@ -54,6 +54,7 @@ _GRPC_DEP_NAMES = [ 'com_github_cares_cares', 'com_google_absl', 'io_opencensus_cpp', + 'envoy_api', _BAZEL_SKYLIB_DEP_NAME, _BAZEL_TOOLCHAINS_DEP_NAME, _TWISTED_TWISTED_DEP_NAME, @@ -61,9 +62,12 @@ _GRPC_DEP_NAMES = [ _TWISTED_INCREMENTAL_DEP_NAME, _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME, _TWISTED_CONSTANTLY_DEP_NAME, + 'io_bazel_rules_go', ] _GRPC_BAZEL_ONLY_DEPS = [ + 'com_google_absl', + 'io_opencensus_cpp', _BAZEL_SKYLIB_DEP_NAME, _BAZEL_TOOLCHAINS_DEP_NAME, _TWISTED_TWISTED_DEP_NAME, @@ -71,6 +75,7 @@ _GRPC_BAZEL_ONLY_DEPS = [ _TWISTED_INCREMENTAL_DEP_NAME, _ZOPEFOUNDATION_ZOPE_INTERFACE_DEP_NAME, _TWISTED_CONSTANTLY_DEP_NAME, + 'io_bazel_rules_go', ] diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 7b11d49655c..e518e912719 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -26,13 +26,13 @@ want_submodules=$(mktemp /tmp/submXXXXXX) git submodule | awk '{ print $1 }' | sort > "$submodules" cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" - cc4bed2d74f7c8717e31f9579214ab52a9c9c610 third_party/abseil-cpp (cc4bed2) + 74d91756c11bc22f9b0108b94da9326f7f9e376f third_party/abseil-cpp (74d9175) e776aa0275e293707b6a0901e0e8d8a8a3679508 third_party/benchmark (v1.2.0) 73594cde8c9a52a102c4341c244c833aa61b9c06 third_party/bloaty (remotes/origin/wide-14-g73594cd) b29b21a81b32ec273f118f589f46d56ad3332420 third_party/boringssl (remotes/origin/chromium-stable) afc30d43eef92979b05776ec0963c9cede5fb80f third_party/boringssl-with-bazel (fips-20180716-116-gafc30d43e) e982924acee7f7313b4baa4ee5ec000c5e373c30 third_party/cares/cares (cares-1_15_0) - 911001cdca003337bdb93fab32740cde61bafee3 third_party/data-plane-api (heads/master) + a83394157ad97f4dadbc8ed81f56ad5b3a72e542 third_party/envoy-api (heads/master) 28f50e0fed19872e0fd50dd23ce2ee8cd759338e third_party/gflags (v2.2.0-5-g30dbc81) 80ed4d0bbf65d57cc267dfc63bd2584557f11f9b third_party/googleapis (common-protos-1_3_1-915-g80ed4d0bb) 2fe3bd994b3189899d93f1d5a881e725e046fdc2 third_party/googletest (release-1.8.1) @@ -40,7 +40,7 @@ cat << EOF | awk '{ print $1 }' | sort > "$want_submodules" 9245d481eb3e890f708ff2d7dadf2a10c04748ba third_party/libcxxabi (heads/release_60) 09745575a923640154bcf307fba8aedff47f240a third_party/protobuf (v3.7.0-rc.2-247-g09745575) e143189bf6f37b3957fb31743df6a1bcf4a8c685 third_party/protoc-gen-validate (v0.0.10) - fa88c6017ddb490aa78c57bea682193f533ed69a third_party/upb (heads/master) + 423ea5ca9ce8da69611e6e95559efcb3a1ba8ad8 third_party/upb (heads/master) cacf7f1d4e3d44d871b605da3b647f07d718623f third_party/zlib (v1.2.11) EOF diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml index 1c5dc5d4312..e9459911a1e 100644 --- a/tools/run_tests/sanity/sanity_tests.yaml +++ b/tools/run_tests/sanity/sanity_tests.yaml @@ -2,7 +2,9 @@ - script: tools/run_tests/sanity/check_bad_dependencies.sh - script: tools/run_tests/sanity/check_bazel_workspace.py - script: tools/run_tests/sanity/check_cache_mk.sh +- script: tools/run_tests/sanity/check_deprecated_grpc++.py - script: tools/run_tests/sanity/check_owners.sh +- script: tools/run_tests/sanity/check_port_platform.py - script: tools/run_tests/sanity/check_qps_scenario_changes.py - script: tools/run_tests/sanity/check_shellcheck.sh - script: tools/run_tests/sanity/check_submodules.sh @@ -10,19 +12,18 @@ - script: tools/run_tests/sanity/check_tracer_sanity.py - script: tools/run_tests/sanity/core_banned_functions.py - script: tools/run_tests/sanity/core_untyped_structs.sh -- script: tools/run_tests/sanity/check_deprecated_grpc++.py -- script: tools/run_tests/sanity/check_port_platform.py - script: tools/buildgen/generate_projects.sh -j 3 cpu_cost: 3 - script: tools/distrib/check_copyright.py +- script: tools/distrib/check_include_guards.py +- script: tools/distrib/check_nanopb_output.sh +- script: tools/distrib/check_trailing_newlines.sh +- script: tools/distrib/check_upb_output.sh - script: tools/distrib/clang_format_code.sh - script: tools/distrib/clang_tidy_code.sh -- script: tools/distrib/check_trailing_newlines.sh -- script: tools/distrib/check_nanopb_output.sh -- script: tools/distrib/check_include_guards.py - script: tools/distrib/pylint_code.sh -- script: tools/distrib/yapf_code.sh - script: tools/distrib/python/check_grpcio_tools.py +- script: tools/distrib/yapf_code.sh cpu_cost: 1000 -- script: tools/distrib/check_shadow_boringssl_symbol_list.sh - script: tools/distrib/check_protobuf_pod_version.sh +- script: tools/distrib/check_shadow_boringssl_symbol_list.sh