Merge branch 'master' into server-context

pull/23916/head
Karthik Ravi Shankar 5 years ago
commit 9afbf02198
  1. 29
      BUILD
  2. 7
      BUILD.gn
  3. 12
      CMakeLists.txt
  4. 34
      Makefile
  5. 3
      bazel/grpc_build_system.bzl
  6. 8
      build_autogenerated.yaml
  7. 2
      build_config.rb
  8. 6
      build_handwritten.yaml
  9. 3
      doc/g_stands_for.md
  10. 58
      doc/xds-test-descriptions.md
  11. 3
      examples/android/helloworld/app/CMakeLists.txt
  12. 2
      examples/android/helloworld/build.gradle
  13. 2
      examples/android/helloworld/gradle/wrapper/gradle-wrapper.properties
  14. 15
      gRPC-C++.podspec
  15. 14
      gRPC-Core.podspec
  16. 2
      gRPC-ProtoRPC.podspec
  17. 2
      gRPC-RxLibrary.podspec
  18. 2
      gRPC.podspec
  19. 6
      grpc.gemspec
  20. 12
      include/grpcpp/impl/codegen/async_generic_service.h
  21. 2
      include/grpcpp/impl/codegen/async_stream_impl.h
  22. 12
      include/grpcpp/impl/codegen/completion_queue.h
  23. 6
      include/grpcpp/impl/codegen/server_context.h
  24. 2
      include/grpcpp/impl/codegen/service_type.h
  25. 7
      include/grpcpp/security/server_credentials.h
  26. 354
      include/grpcpp/server.h
  27. 387
      include/grpcpp/server_impl.h
  28. 12
      package.xml
  29. 22
      setup.py
  30. 3
      src/android/test/interop/app/CMakeLists.txt
  31. 3
      src/android/test/interop/app/build.gradle
  32. 2
      src/android/test/interop/build.gradle
  33. 2
      src/android/test/interop/gradle/wrapper/gradle-wrapper.properties
  34. 69
      src/compiler/csharp_generator.cc
  35. 2
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  36. 88
      src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc
  37. 64
      src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc
  38. 5
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  39. 4
      src/core/ext/transport/chttp2/transport/internal.h
  40. 425
      src/core/ext/xds/xds_api.cc
  41. 167
      src/core/ext/xds/xds_api.h
  42. 50
      src/core/ext/xds/xds_client.cc
  43. 2
      src/core/ext/xds/xds_client.h
  44. 42
      src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h
  45. 68
      src/core/lib/security/authorization/mock_cel/cel_expression.h
  46. 67
      src/core/lib/security/authorization/mock_cel/evaluator_core.h
  47. 56
      src/core/lib/security/authorization/mock_cel/flat_expr_builder.h
  48. 50
      src/core/lib/security/authorization/mock_cel/statusor.h
  49. 59
      src/core/lib/security/certificate_provider.h
  50. 4
      src/core/lib/surface/version.cc
  51. 2
      src/cpp/common/version_cc.cc
  52. 6
      src/cpp/server/server_cc.cc
  53. 4
      src/csharp/Grpc.Core.Api/VersionInfo.cs
  54. 38
      src/csharp/Grpc.Examples/MathGrpc.cs
  55. 34
      src/csharp/Grpc.HealthCheck/HealthGrpc.cs
  56. 34
      src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs
  57. 36
      src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs
  58. 34
      src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs
  59. 178
      src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
  60. 44
      src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs
  61. 34
      src/csharp/Grpc.Reflection/ReflectionGrpc.cs
  62. 2
      src/csharp/build/dependencies.props
  63. 2
      src/csharp/build_unitypackage.bat
  64. 2
      src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec
  65. 2
      src/objective-c/!ProtoCompiler-gRPCPlugin.podspec
  66. 2
      src/objective-c/GRPCClient/version.h
  67. 4
      src/objective-c/tests/version.h
  68. 2
      src/php/composer.json
  69. 2
      src/php/ext/grpc/version.h
  70. 2
      src/python/grpcio/grpc/_grpcio_metadata.py
  71. 2
      src/python/grpcio/grpc_version.py
  72. 2
      src/python/grpcio_channelz/grpc_version.py
  73. 2
      src/python/grpcio_health_checking/grpc_version.py
  74. 2
      src/python/grpcio_reflection/grpc_version.py
  75. 2
      src/python/grpcio_status/grpc_version.py
  76. 2
      src/python/grpcio_testing/grpc_version.py
  77. 2
      src/python/grpcio_tests/grpc_version.py
  78. 28
      src/python/grpcio_tests/tests/unit/_exit_test.py
  79. 2
      src/ruby/lib/grpc/version.rb
  80. 2
      src/ruby/tools/version.rb
  81. 165
      test/core/security/evaluate_args_test.cc
  82. 12
      test/cpp/end2end/xds_end2end_test.cc
  83. 12
      test/distrib/csharp/DistribTest/DistribTest.csproj
  84. 2
      test/distrib/csharp/DistribTest/DistribTestDotNet.csproj
  85. 2
      test/distrib/csharp/DistribTest/packages.config
  86. 2
      tools/distrib/python/grpc_version.py
  87. 2
      tools/distrib/python/grpcio_tools/grpc_version.py
  88. 23
      tools/dockerfile/distribtest/python_dev_centos7_x64/Dockerfile
  89. 3
      tools/doxygen/Doxyfile.c++
  90. 9
      tools/doxygen/Doxyfile.c++.internal
  91. 2
      tools/doxygen/Doxyfile.core
  92. 8
      tools/doxygen/Doxyfile.core.internal
  93. 2
      tools/doxygen/Doxyfile.objc
  94. 2
      tools/doxygen/Doxyfile.objc.internal
  95. 2
      tools/doxygen/Doxyfile.php
  96. 2
      tools/internal_ci/helper_scripts/prepare_build_macos_rc
  97. 7
      tools/internal_ci/linux/grpc_android.sh
  98. 2
      tools/internal_ci/linux/grpc_xds_csharp.cfg
  99. 2
      tools/internal_ci/linux/grpc_xds_python.cfg
  100. 10
      tools/internal_ci/macos/grpc_build_artifacts.sh
  101. Some files were not shown because too many files have changed in this diff Show More

29
BUILD

@ -75,11 +75,11 @@ config_setting(
python_config_settings() python_config_settings()
# This should be updated along with build_handwritten.yaml # This should be updated along with build_handwritten.yaml
g_stands_for = "giggle" g_stands_for = "geeky"
core_version = "11.0.0" core_version = "12.0.0"
version = "1.32.0-dev" version = "1.33.0-dev"
GPR_PUBLIC_HDRS = [ GPR_PUBLIC_HDRS = [
"include/grpc/support/alloc.h", "include/grpc/support/alloc.h",
@ -251,7 +251,6 @@ GRPCXX_PUBLIC_HDRS = [
"include/grpcpp/security/server_credentials.h", "include/grpcpp/security/server_credentials.h",
"include/grpcpp/security/tls_credentials_options.h", "include/grpcpp/security/tls_credentials_options.h",
"include/grpcpp/server.h", "include/grpcpp/server.h",
"include/grpcpp/server_impl.h",
"include/grpcpp/server_builder.h", "include/grpcpp/server_builder.h",
"include/grpcpp/server_context.h", "include/grpcpp/server_context.h",
"include/grpcpp/server_posix.h", "include/grpcpp/server_posix.h",
@ -1811,6 +1810,7 @@ grpc_cc_library(
hdrs = [ hdrs = [
"src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h", "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h",
"src/core/ext/xds/xds_channel_args.h", "src/core/ext/xds/xds_channel_args.h",
"src/core/lib/security/certificate_provider.h",
"src/core/lib/security/context/security_context.h", "src/core/lib/security/context/security_context.h",
"src/core/lib/security/credentials/alts/alts_credentials.h", "src/core/lib/security/credentials/alts/alts_credentials.h",
"src/core/lib/security/credentials/composite/composite_credentials.h", "src/core/lib/security/credentials/composite/composite_credentials.h",
@ -1853,6 +1853,24 @@ grpc_cc_library(
], ],
) )
grpc_cc_library(
name = "grpc_mock_cel",
hdrs = [
"src/core/lib/security/authorization/mock_cel/activation.h",
"src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h",
"src/core/lib/security/authorization/mock_cel/cel_expression.h",
"src/core/lib/security/authorization/mock_cel/cel_value.h",
"src/core/lib/security/authorization/mock_cel/evaluator_core.h",
"src/core/lib/security/authorization/mock_cel/flat_expr_builder.h",
"src/core/lib/security/authorization/mock_cel/statusor.h",
],
language = "c++",
deps = [
"google_api_upb",
"grpc_base",
],
)
grpc_cc_library( grpc_cc_library(
name = "grpc_authorization_engine", name = "grpc_authorization_engine",
srcs = [ srcs = [
@ -1862,8 +1880,6 @@ grpc_cc_library(
hdrs = [ hdrs = [
"src/core/lib/security/authorization/authorization_engine.h", "src/core/lib/security/authorization/authorization_engine.h",
"src/core/lib/security/authorization/evaluate_args.h", "src/core/lib/security/authorization/evaluate_args.h",
"src/core/lib/security/authorization/mock_cel/activation.h",
"src/core/lib/security/authorization/mock_cel/cel_value.h",
], ],
external_deps = [ external_deps = [
"absl/container:flat_hash_set", "absl/container:flat_hash_set",
@ -1873,6 +1889,7 @@ grpc_cc_library(
"envoy_ads_upb", "envoy_ads_upb",
"google_api_upb", "google_api_upb",
"grpc_base", "grpc_base",
"grpc_mock_cel",
"grpc_secure", "grpc_secure",
], ],
) )

@ -793,7 +793,13 @@ config("grpc_config") {
"src/core/lib/security/authorization/evaluate_args.cc", "src/core/lib/security/authorization/evaluate_args.cc",
"src/core/lib/security/authorization/evaluate_args.h", "src/core/lib/security/authorization/evaluate_args.h",
"src/core/lib/security/authorization/mock_cel/activation.h", "src/core/lib/security/authorization/mock_cel/activation.h",
"src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h",
"src/core/lib/security/authorization/mock_cel/cel_expression.h",
"src/core/lib/security/authorization/mock_cel/cel_value.h", "src/core/lib/security/authorization/mock_cel/cel_value.h",
"src/core/lib/security/authorization/mock_cel/evaluator_core.h",
"src/core/lib/security/authorization/mock_cel/flat_expr_builder.h",
"src/core/lib/security/authorization/mock_cel/statusor.h",
"src/core/lib/security/certificate_provider.h",
"src/core/lib/security/context/security_context.cc", "src/core/lib/security/context/security_context.cc",
"src/core/lib/security/context/security_context.h", "src/core/lib/security/context/security_context.h",
"src/core/lib/security/credentials/alts/alts_credentials.cc", "src/core/lib/security/credentials/alts/alts_credentials.cc",
@ -1195,7 +1201,6 @@ config("grpc_config") {
"include/grpcpp/server.h", "include/grpcpp/server.h",
"include/grpcpp/server_builder.h", "include/grpcpp/server_builder.h",
"include/grpcpp/server_context.h", "include/grpcpp/server_context.h",
"include/grpcpp/server_impl.h",
"include/grpcpp/server_posix.h", "include/grpcpp/server_posix.h",
"include/grpcpp/support/async_stream.h", "include/grpcpp/support/async_stream.h",
"include/grpcpp/support/async_stream_impl.h", "include/grpcpp/support/async_stream_impl.h",

@ -25,12 +25,12 @@
cmake_minimum_required(VERSION 3.5.1) cmake_minimum_required(VERSION 3.5.1)
set(PACKAGE_NAME "grpc") set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "1.32.0-dev") set(PACKAGE_VERSION "1.33.0-dev")
set(gRPC_CORE_VERSION "11.0.0") set(gRPC_CORE_VERSION "12.0.0")
set(gRPC_CORE_SOVERSION "11") set(gRPC_CORE_SOVERSION "12")
set(gRPC_CPP_VERSION "1.32.0-dev") set(gRPC_CPP_VERSION "1.33.0-dev")
set(gRPC_CPP_SOVERSION "1") set(gRPC_CPP_SOVERSION "1")
set(gRPC_CSHARP_VERSION "2.32.0-dev") set(gRPC_CSHARP_VERSION "2.33.0-dev")
set(gRPC_CSHARP_SOVERSION "2") set(gRPC_CSHARP_SOVERSION "2")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
@ -2856,7 +2856,6 @@ foreach(_hdr
include/grpcpp/server.h include/grpcpp/server.h
include/grpcpp/server_builder.h include/grpcpp/server_builder.h
include/grpcpp/server_context.h include/grpcpp/server_context.h
include/grpcpp/server_impl.h
include/grpcpp/server_posix.h include/grpcpp/server_posix.h
include/grpcpp/support/async_stream.h include/grpcpp/support/async_stream.h
include/grpcpp/support/async_stream_impl.h include/grpcpp/support/async_stream_impl.h
@ -3540,7 +3539,6 @@ foreach(_hdr
include/grpcpp/server.h include/grpcpp/server.h
include/grpcpp/server_builder.h include/grpcpp/server_builder.h
include/grpcpp/server_context.h include/grpcpp/server_context.h
include/grpcpp/server_impl.h
include/grpcpp/server_posix.h include/grpcpp/server_posix.h
include/grpcpp/support/async_stream.h include/grpcpp/support/async_stream.h
include/grpcpp/support/async_stream_impl.h include/grpcpp/support/async_stream_impl.h

@ -456,9 +456,9 @@ E = @echo
Q = @ Q = @
endif endif
CORE_VERSION = 11.0.0 CORE_VERSION = 12.0.0
CPP_VERSION = 1.32.0-dev CPP_VERSION = 1.33.0-dev
CSHARP_VERSION = 2.32.0-dev CSHARP_VERSION = 2.33.0-dev
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
@ -500,7 +500,7 @@ SHARED_EXT_CORE = dll
SHARED_EXT_CPP = dll SHARED_EXT_CPP = dll
SHARED_EXT_CSHARP = dll SHARED_EXT_CSHARP = dll
SHARED_PREFIX = SHARED_PREFIX =
SHARED_VERSION_CORE = -11 SHARED_VERSION_CORE = -12
SHARED_VERSION_CPP = -1 SHARED_VERSION_CPP = -1
SHARED_VERSION_CSHARP = -2 SHARED_VERSION_CSHARP = -2
else ifeq ($(SYSTEM),Darwin) else ifeq ($(SYSTEM),Darwin)
@ -1872,8 +1872,8 @@ $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE):
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libaddress_sorting.so.11 -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libaddress_sorting.so.12 -o $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBADDRESS_SORTING_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so.11 $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so.12
$(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)address_sorting$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libaddress_sorting$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -1997,8 +1997,8 @@ $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OB
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.11 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.12 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.11 $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.12
$(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -2490,8 +2490,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.11 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.12 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.11 $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.12
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -2549,8 +2549,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE):
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.11 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.12 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).so.11 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).so.12
$(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -2958,8 +2958,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.11 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.12 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.11 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.12
$(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so
endif endif
endif endif
@ -3189,7 +3189,6 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/server.h \ include/grpcpp/server.h \
include/grpcpp/server_builder.h \ include/grpcpp/server_builder.h \
include/grpcpp/server_context.h \ include/grpcpp/server_context.h \
include/grpcpp/server_impl.h \
include/grpcpp/server_posix.h \ include/grpcpp/server_posix.h \
include/grpcpp/support/async_stream.h \ include/grpcpp/support/async_stream.h \
include/grpcpp/support/async_stream_impl.h \ include/grpcpp/support/async_stream_impl.h \
@ -3718,7 +3717,6 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/server.h \ include/grpcpp/server.h \
include/grpcpp/server_builder.h \ include/grpcpp/server_builder.h \
include/grpcpp/server_context.h \ include/grpcpp/server_context.h \
include/grpcpp/server_impl.h \
include/grpcpp/server_posix.h \ include/grpcpp/server_posix.h \
include/grpcpp/support/async_stream.h \ include/grpcpp/support/async_stream.h \
include/grpcpp/support/async_stream_impl.h \ include/grpcpp/support/async_stream_impl.h \
@ -4303,8 +4301,8 @@ $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBUPB_OB
ifeq ($(SYSTEM),Darwin) ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBUPB_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBUPB_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
else else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libupb.so.11 -o $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBUPB_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libupb.so.12 -o $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBUPB_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).so.11 $(Q) ln -sf $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).so.12
$(Q) ln -sf $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).so $(Q) ln -sf $(SHARED_PREFIX)upb$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libupb$(SHARED_VERSION_CORE).so
endif endif
endif endif

@ -231,7 +231,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
**args **args
) )
def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = [], tags = []): def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = [], tags = [], features = []):
copts = [] copts = []
if language.upper() == "C": if language.upper() == "C":
copts = ["-std=c99"] copts = ["-std=c99"]
@ -246,6 +246,7 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da
copts = copts, copts = copts,
linkopts = if_not_windows(["-pthread"]) + linkopts, linkopts = if_not_windows(["-pthread"]) + linkopts,
tags = tags, tags = tags,
features = features,
) )
def grpc_generate_one_off_targets(): def grpc_generate_one_off_targets():

@ -654,7 +654,13 @@ libs:
- src/core/lib/security/authorization/authorization_engine.h - src/core/lib/security/authorization/authorization_engine.h
- src/core/lib/security/authorization/evaluate_args.h - src/core/lib/security/authorization/evaluate_args.h
- src/core/lib/security/authorization/mock_cel/activation.h - src/core/lib/security/authorization/mock_cel/activation.h
- src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h
- src/core/lib/security/authorization/mock_cel/cel_expression.h
- src/core/lib/security/authorization/mock_cel/cel_value.h - src/core/lib/security/authorization/mock_cel/cel_value.h
- src/core/lib/security/authorization/mock_cel/evaluator_core.h
- src/core/lib/security/authorization/mock_cel/flat_expr_builder.h
- src/core/lib/security/authorization/mock_cel/statusor.h
- src/core/lib/security/certificate_provider.h
- src/core/lib/security/context/security_context.h - src/core/lib/security/context/security_context.h
- src/core/lib/security/credentials/alts/alts_credentials.h - src/core/lib/security/credentials/alts/alts_credentials.h
- src/core/lib/security/credentials/alts/check_gcp_environment.h - src/core/lib/security/credentials/alts/check_gcp_environment.h
@ -2188,7 +2194,6 @@ libs:
- include/grpcpp/server.h - include/grpcpp/server.h
- include/grpcpp/server_builder.h - include/grpcpp/server_builder.h
- include/grpcpp/server_context.h - include/grpcpp/server_context.h
- include/grpcpp/server_impl.h
- include/grpcpp/server_posix.h - include/grpcpp/server_posix.h
- include/grpcpp/support/async_stream.h - include/grpcpp/support/async_stream.h
- include/grpcpp/support/async_stream_impl.h - include/grpcpp/support/async_stream_impl.h
@ -2564,7 +2569,6 @@ libs:
- include/grpcpp/server.h - include/grpcpp/server.h
- include/grpcpp/server_builder.h - include/grpcpp/server_builder.h
- include/grpcpp/server_context.h - include/grpcpp/server_context.h
- include/grpcpp/server_impl.h
- include/grpcpp/server_posix.h - include/grpcpp/server_posix.h
- include/grpcpp/support/async_stream.h - include/grpcpp/support/async_stream.h
- include/grpcpp/support/async_stream_impl.h - include/grpcpp/support/async_stream_impl.h

@ -13,5 +13,5 @@
# limitations under the License. # limitations under the License.
module GrpcBuildConfig module GrpcBuildConfig
CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-11.dll' CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-12.dll'
end end

@ -12,10 +12,10 @@ settings:
'#08': Use "-preN" suffixes to identify pre-release versions '#08': Use "-preN" suffixes to identify pre-release versions
'#09': Per-language overrides are possible with (eg) ruby_version tag here '#09': Per-language overrides are possible with (eg) ruby_version tag here
'#10': See the expand_version.py for all the quirks here '#10': See the expand_version.py for all the quirks here
core_version: 11.0.0 core_version: 12.0.0
csharp_major_version: 2 csharp_major_version: 2
g_stands_for: giggle g_stands_for: geeky
version: 1.32.0-dev version: 1.33.0-dev
targets: targets:
- name: check_epollexclusive - name: check_epollexclusive
build: tool build: tool

@ -31,4 +31,5 @@
- 1.29 'g' stands for ['gringotts'](https://github.com/grpc/grpc/tree/v1.29.x) - 1.29 'g' stands for ['gringotts'](https://github.com/grpc/grpc/tree/v1.29.x)
- 1.30 'g' stands for ['gradius'](https://github.com/grpc/grpc/tree/v1.30.x) - 1.30 'g' stands for ['gradius'](https://github.com/grpc/grpc/tree/v1.30.x)
- 1.31 'g' stands for ['galore'](https://github.com/grpc/grpc/tree/v1.31.x) - 1.31 'g' stands for ['galore'](https://github.com/grpc/grpc/tree/v1.31.x)
- 1.32 'g' stands for ['giggle'](https://github.com/grpc/grpc/tree/master) - 1.32 'g' stands for ['giggle'](https://github.com/grpc/grpc/tree/v1.32.x)
- 1.33 'g' stands for ['geeky'](https://github.com/grpc/grpc/tree/master)

@ -218,31 +218,6 @@ Test driver asserts:
1. All backends in the primary locality receive at least 1 RPC. 1. All backends in the primary locality receive at least 1 RPC.
1. No backends in the secondary locality receive RPCs. 1. No backends in the secondary locality receive RPCs.
### new_instance_group_receives_traffic
This test verifies that new instance groups added to a backend service in the
same zone receive traffic.
Client parameters:
1. --num_channels=1
1. --qps=100
1. --fail_on_failed_rpc=true
Load balancer configuration:
1. One MIG with two backends, using rate balancing mode.
Test driver asserts:
1. All backends receive at least one RPC.
The test driver adds a new MIG with two backends in the same zone.
Test driver asserts:
1. All backends in each MIG receive at least one RPC.
### remove_instance_group ### remove_instance_group
This test verifies that a remaining instance group can successfully serve RPCs This test verifies that a remaining instance group can successfully serve RPCs
@ -321,3 +296,36 @@ Assert:
1. Once all backends receive at least one RPC, the following 1000 RPCs are 1. Once all backends receive at least one RPC, the following 1000 RPCs are
distributed across the 2 backends as a: 20, b: 80. distributed across the 2 backends as a: 20, b: 80.
### gentle_failover
This test verifies that traffic is partially diverted to a secondary locality
when > 50% of the instances in the primary locality are unhealthy.
Client parameters:
1. --num_channels=1
1. --qps=100
Load balancer configuration:
1. The primary MIG with 3 backends in the same zone as the client
1. The secondary MIG with 2 backends in a different zone
Test driver asserts:
1. All backends in the primary locality receive at least 1 RPC.
1. No backends in the secondary locality receive RPCs.
The test driver stops 2 of 3 backends in the primary locality.
Test driver asserts:
1. All backends in the secondary locality receive at least 1 RPC.
1. The remaining backend in the primary locality receives at least 1 RPC.
The test driver resumes the backends in the primary locality.
Test driver asserts:
1. All backends in the primary locality receive at least 1 RPC.
1. No backends in the secondary locality receive RPCs.

@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# https://github.com/abseil/abseil-cpp/issues/626
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DABSL_NO_XRAY_ATTRIBUTES=1")
set(helloworld_PROTOBUF_PROTOC_EXECUTABLE "/usr/local/bin/protoc" CACHE STRING "Protoc binary on host") set(helloworld_PROTOBUF_PROTOC_EXECUTABLE "/usr/local/bin/protoc" CACHE STRING "Protoc binary on host")
set(helloworld_GRPC_CPP_PLUGIN_EXECUTABLE "/usr/local/bin/grpc_cpp_plugin" CACHE STRING "gRPC CPP plugin binary on host") set(helloworld_GRPC_CPP_PLUGIN_EXECUTABLE "/usr/local/bin/grpc_cpp_plugin" CACHE STRING "gRPC CPP plugin binary on host")

@ -6,7 +6,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip

@ -22,7 +22,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'gRPC-C++' s.name = 'gRPC-C++'
# TODO (mxyan): use version that match gRPC version when pod is stabilized # TODO (mxyan): use version that match gRPC version when pod is stabilized
version = '1.32.0-dev' version = '1.33.0-dev'
s.version = version s.version = version
s.summary = 'gRPC C++ library' s.summary = 'gRPC C++ library'
s.homepage = 'https://grpc.io' s.homepage = 'https://grpc.io'
@ -163,7 +163,6 @@ Pod::Spec.new do |s|
'include/grpcpp/server.h', 'include/grpcpp/server.h',
'include/grpcpp/server_builder.h', 'include/grpcpp/server_builder.h',
'include/grpcpp/server_context.h', 'include/grpcpp/server_context.h',
'include/grpcpp/server_impl.h',
'include/grpcpp/server_posix.h', 'include/grpcpp/server_posix.h',
'include/grpcpp/support/async_stream.h', 'include/grpcpp/support/async_stream.h',
'include/grpcpp/support/async_stream_impl.h', 'include/grpcpp/support/async_stream_impl.h',
@ -516,7 +515,13 @@ Pod::Spec.new do |s|
'src/core/lib/security/authorization/authorization_engine.h', 'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/evaluate_args.h', 'src/core/lib/security/authorization/evaluate_args.h',
'src/core/lib/security/authorization/mock_cel/activation.h', 'src/core/lib/security/authorization/mock_cel/activation.h',
'src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h',
'src/core/lib/security/authorization/mock_cel/cel_expression.h',
'src/core/lib/security/authorization/mock_cel/cel_value.h', 'src/core/lib/security/authorization/mock_cel/cel_value.h',
'src/core/lib/security/authorization/mock_cel/evaluator_core.h',
'src/core/lib/security/authorization/mock_cel/flat_expr_builder.h',
'src/core/lib/security/authorization/mock_cel/statusor.h',
'src/core/lib/security/certificate_provider.h',
'src/core/lib/security/context/security_context.h', 'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h', 'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h', 'src/core/lib/security/credentials/alts/check_gcp_environment.h',
@ -1010,7 +1015,13 @@ Pod::Spec.new do |s|
'src/core/lib/security/authorization/authorization_engine.h', 'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/evaluate_args.h', 'src/core/lib/security/authorization/evaluate_args.h',
'src/core/lib/security/authorization/mock_cel/activation.h', 'src/core/lib/security/authorization/mock_cel/activation.h',
'src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h',
'src/core/lib/security/authorization/mock_cel/cel_expression.h',
'src/core/lib/security/authorization/mock_cel/cel_value.h', 'src/core/lib/security/authorization/mock_cel/cel_value.h',
'src/core/lib/security/authorization/mock_cel/evaluator_core.h',
'src/core/lib/security/authorization/mock_cel/flat_expr_builder.h',
'src/core/lib/security/authorization/mock_cel/statusor.h',
'src/core/lib/security/certificate_provider.h',
'src/core/lib/security/context/security_context.h', 'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h', 'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h', 'src/core/lib/security/credentials/alts/check_gcp_environment.h',

@ -21,7 +21,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'gRPC-Core' s.name = 'gRPC-Core'
version = '1.32.0-dev' version = '1.33.0-dev'
s.version = version s.version = version
s.summary = 'Core cross-platform gRPC library, written in C' s.summary = 'Core cross-platform gRPC library, written in C'
s.homepage = 'https://grpc.io' s.homepage = 'https://grpc.io'
@ -848,7 +848,13 @@ Pod::Spec.new do |s|
'src/core/lib/security/authorization/evaluate_args.cc', 'src/core/lib/security/authorization/evaluate_args.cc',
'src/core/lib/security/authorization/evaluate_args.h', 'src/core/lib/security/authorization/evaluate_args.h',
'src/core/lib/security/authorization/mock_cel/activation.h', 'src/core/lib/security/authorization/mock_cel/activation.h',
'src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h',
'src/core/lib/security/authorization/mock_cel/cel_expression.h',
'src/core/lib/security/authorization/mock_cel/cel_value.h', 'src/core/lib/security/authorization/mock_cel/cel_value.h',
'src/core/lib/security/authorization/mock_cel/evaluator_core.h',
'src/core/lib/security/authorization/mock_cel/flat_expr_builder.h',
'src/core/lib/security/authorization/mock_cel/statusor.h',
'src/core/lib/security/certificate_provider.h',
'src/core/lib/security/context/security_context.cc', 'src/core/lib/security/context/security_context.cc',
'src/core/lib/security/context/security_context.h', 'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.cc', 'src/core/lib/security/credentials/alts/alts_credentials.cc',
@ -1422,7 +1428,13 @@ Pod::Spec.new do |s|
'src/core/lib/security/authorization/authorization_engine.h', 'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/evaluate_args.h', 'src/core/lib/security/authorization/evaluate_args.h',
'src/core/lib/security/authorization/mock_cel/activation.h', 'src/core/lib/security/authorization/mock_cel/activation.h',
'src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h',
'src/core/lib/security/authorization/mock_cel/cel_expression.h',
'src/core/lib/security/authorization/mock_cel/cel_value.h', 'src/core/lib/security/authorization/mock_cel/cel_value.h',
'src/core/lib/security/authorization/mock_cel/evaluator_core.h',
'src/core/lib/security/authorization/mock_cel/flat_expr_builder.h',
'src/core/lib/security/authorization/mock_cel/statusor.h',
'src/core/lib/security/certificate_provider.h',
'src/core/lib/security/context/security_context.h', 'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h', 'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h', 'src/core/lib/security/credentials/alts/check_gcp_environment.h',

@ -21,7 +21,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'gRPC-ProtoRPC' s.name = 'gRPC-ProtoRPC'
version = '1.32.0-dev' version = '1.33.0-dev'
s.version = version s.version = version
s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.summary = 'RPC library for Protocol Buffers, based on gRPC'
s.homepage = 'https://grpc.io' s.homepage = 'https://grpc.io'

@ -21,7 +21,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'gRPC-RxLibrary' s.name = 'gRPC-RxLibrary'
version = '1.32.0-dev' version = '1.33.0-dev'
s.version = version s.version = version
s.summary = 'Reactive Extensions library for iOS/OSX.' s.summary = 'Reactive Extensions library for iOS/OSX.'
s.homepage = 'https://grpc.io' s.homepage = 'https://grpc.io'

@ -20,7 +20,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'gRPC' s.name = 'gRPC'
version = '1.32.0-dev' version = '1.33.0-dev'
s.version = version s.version = version
s.summary = 'gRPC client library for iOS/OSX' s.summary = 'gRPC client library for iOS/OSX'
s.homepage = 'https://grpc.io' s.homepage = 'https://grpc.io'

@ -766,7 +766,13 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/security/authorization/evaluate_args.cc ) s.files += %w( src/core/lib/security/authorization/evaluate_args.cc )
s.files += %w( src/core/lib/security/authorization/evaluate_args.h ) s.files += %w( src/core/lib/security/authorization/evaluate_args.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/activation.h ) s.files += %w( src/core/lib/security/authorization/mock_cel/activation.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/cel_expression.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/cel_value.h ) s.files += %w( src/core/lib/security/authorization/mock_cel/cel_value.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/evaluator_core.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/flat_expr_builder.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/statusor.h )
s.files += %w( src/core/lib/security/certificate_provider.h )
s.files += %w( src/core/lib/security/context/security_context.cc ) s.files += %w( src/core/lib/security/context/security_context.cc )
s.files += %w( src/core/lib/security/context/security_context.h ) s.files += %w( src/core/lib/security/context/security_context.h )
s.files += %w( src/core/lib/security/credentials/alts/alts_credentials.cc ) s.files += %w( src/core/lib/security/credentials/alts/alts_credentials.cc )

@ -44,7 +44,7 @@ class GenericServerContext final : public ::grpc::ServerContext {
const std::string& host() const { return host_; } const std::string& host() const { return host_; }
private: private:
friend class grpc_impl::Server; friend class grpc::Server;
friend class grpc::ServerInterface; friend class grpc::ServerInterface;
void Clear() { void Clear() {
@ -84,8 +84,8 @@ class AsyncGenericService final {
::grpc::ServerCompletionQueue* notification_cq, void* tag); ::grpc::ServerCompletionQueue* notification_cq, void* tag);
private: private:
friend class grpc_impl::Server; friend class grpc::Server;
grpc_impl::Server* server_; grpc::Server* server_;
}; };
#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL #ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
@ -105,7 +105,7 @@ class GenericCallbackServerContext final
const std::string& host() const { return host_; } const std::string& host() const { return host_; }
private: private:
friend class ::grpc_impl::Server; friend class ::grpc::Server;
friend class ::grpc::ServerInterface; friend class ::grpc::ServerInterface;
void Clear() { void Clear() {
@ -140,7 +140,7 @@ class CallbackGenericService {
} }
private: private:
friend class ::grpc_impl::Server; friend class grpc::Server;
::grpc_impl::internal::CallbackBidiHandler<ByteBuffer, ByteBuffer>* ::grpc_impl::internal::CallbackBidiHandler<ByteBuffer, ByteBuffer>*
Handler() { Handler() {
@ -151,7 +151,7 @@ class CallbackGenericService {
}); });
} }
grpc_impl::Server* server_{nullptr}; grpc::Server* server_{nullptr};
}; };
#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL #ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL

@ -1097,7 +1097,7 @@ class ServerAsyncReaderWriter final
} }
private: private:
friend class ::grpc_impl::Server; friend class ::grpc::Server;
void BindCall(::grpc::internal::Call* call) override { call_ = *call; } void BindCall(::grpc::internal::Call* call) override { call_ = *call; }

@ -46,7 +46,6 @@ struct grpc_completion_queue;
namespace grpc_impl { namespace grpc_impl {
class Server;
template <class R> template <class R>
class ClientReader; class ClientReader;
template <class W> template <class W>
@ -77,6 +76,7 @@ namespace grpc {
class Channel; class Channel;
class ChannelInterface; class ChannelInterface;
class Server;
class ServerBuilder; class ServerBuilder;
class ServerContextBase; class ServerContextBase;
class ServerInterface; class ServerInterface;
@ -252,7 +252,7 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
// Friends for access to server registration lists that enable checking and // Friends for access to server registration lists that enable checking and
// logging on shutdown // logging on shutdown
friend class ::grpc::ServerBuilder; friend class ::grpc::ServerBuilder;
friend class ::grpc_impl::Server; friend class ::grpc::Server;
// Friend synchronous wrappers so that they can access Pluck(), which is // Friend synchronous wrappers so that they can access Pluck(), which is
// a semi-private API geared towards the synchronous implementation. // a semi-private API geared towards the synchronous implementation.
@ -382,14 +382,14 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
} }
} }
void RegisterServer(const ::grpc_impl::Server* server) { void RegisterServer(const ::grpc::Server* server) {
(void)server; (void)server;
#ifndef NDEBUG #ifndef NDEBUG
grpc::internal::MutexLock l(&server_list_mutex_); grpc::internal::MutexLock l(&server_list_mutex_);
server_list_.push_back(server); server_list_.push_back(server);
#endif #endif
} }
void UnregisterServer(const ::grpc_impl::Server* server) { void UnregisterServer(const ::grpc::Server* server) {
(void)server; (void)server;
#ifndef NDEBUG #ifndef NDEBUG
grpc::internal::MutexLock l(&server_list_mutex_); grpc::internal::MutexLock l(&server_list_mutex_);
@ -412,7 +412,7 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
// NDEBUG, instantiate it in all cases since otherwise the size will be // NDEBUG, instantiate it in all cases since otherwise the size will be
// inconsistent. // inconsistent.
mutable grpc::internal::Mutex server_list_mutex_; mutable grpc::internal::Mutex server_list_mutex_;
std::list<const ::grpc_impl::Server*> std::list<const ::grpc::Server*>
server_list_ /* GUARDED_BY(server_list_mutex_) */; server_list_ /* GUARDED_BY(server_list_mutex_) */;
}; };
@ -443,7 +443,7 @@ class ServerCompletionQueue : public CompletionQueue {
grpc_cq_polling_type polling_type_; grpc_cq_polling_type polling_type_;
friend class ::grpc::ServerBuilder; friend class ::grpc::ServerBuilder;
friend class ::grpc_impl::Server; friend class ::grpc::Server;
}; };
} // namespace grpc } // namespace grpc

@ -49,7 +49,6 @@ struct grpc_call;
struct census_context; struct census_context;
namespace grpc_impl { namespace grpc_impl {
class Server;
template <class W, class R> template <class W, class R>
class ServerAsyncReader; class ServerAsyncReader;
template <class W> template <class W>
@ -96,6 +95,7 @@ namespace grpc {
class ClientContext; class ClientContext;
class CompletionQueue; class CompletionQueue;
class GenericServerContext; class GenericServerContext;
class Server;
class ServerInterface; class ServerInterface;
// TODO(vjpai): Remove namespace experimental when de-experimentalized fully. // TODO(vjpai): Remove namespace experimental when de-experimentalized fully.
@ -342,7 +342,7 @@ class ServerContextBase {
friend class ::grpc::testing::ServerContextTestSpouse; friend class ::grpc::testing::ServerContextTestSpouse;
friend class ::grpc::testing::DefaultReactorTestPeer; friend class ::grpc::testing::DefaultReactorTestPeer;
friend class ::grpc::ServerInterface; friend class ::grpc::ServerInterface;
friend class ::grpc_impl::Server; friend class ::grpc::Server;
template <class W, class R> template <class W, class R>
friend class ::grpc_impl::ServerAsyncReader; friend class ::grpc_impl::ServerAsyncReader;
template <class W> template <class W>
@ -548,7 +548,7 @@ class ServerContext : public ServerContextBase {
private: private:
// Constructor for internal use by server only // Constructor for internal use by server only
friend class ::grpc_impl::Server; friend class ::grpc::Server;
ServerContext(gpr_timespec deadline, grpc_metadata_array* arr) ServerContext(gpr_timespec deadline, grpc_metadata_array* arr)
: ServerContextBase(deadline, arr) {} : ServerContextBase(deadline, arr) {}

@ -268,7 +268,7 @@ class Service {
return methods_[idx]->handler(); return methods_[idx]->handler();
} }
friend class grpc_impl::Server; friend class Server;
friend class ServerInterface; friend class ServerInterface;
ServerInterface* server_; ServerInterface* server_;
std::vector<std::unique_ptr<internal::RpcServiceMethod>> methods_; std::vector<std::unique_ptr<internal::RpcServiceMethod>> methods_;

@ -29,12 +29,9 @@
struct grpc_server; struct grpc_server;
namespace grpc_impl {
class Server;
} // namespace grpc_impl
namespace grpc { namespace grpc {
class Server;
/// Options to create ServerCredentials with SSL /// Options to create ServerCredentials with SSL
struct SslServerCredentialsOptions { struct SslServerCredentialsOptions {
/// \warning Deprecated /// \warning Deprecated
@ -72,7 +69,7 @@ class ServerCredentials {
const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) = 0; const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) = 0;
private: private:
friend class ::grpc_impl::Server; friend class Server;
/// Tries to bind \a server to the given \a addr (eg, localhost:1234, /// Tries to bind \a server to the given \a addr (eg, localhost:1234,
/// 192.168.1.1:31416, [::1]:27182, etc.) /// 192.168.1.1:31416, [::1]:27182, etc.)

@ -1,6 +1,6 @@
/* /*
* *
* Copyright 2019 gRPC authors. * Copyright 2015 gRPC authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,11 +19,359 @@
#ifndef GRPCPP_SERVER_H #ifndef GRPCPP_SERVER_H
#define GRPCPP_SERVER_H #define GRPCPP_SERVER_H
#include <grpcpp/server_impl.h> #include <list>
#include <memory>
#include <vector>
#include <grpc/impl/codegen/port_platform.h>
#include <grpc/compression.h>
#include <grpc/support/atm.h>
#include <grpcpp/channel.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/impl/codegen/completion_queue.h>
#include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/impl/codegen/server_interface.h>
#include <grpcpp/impl/rpc_service_method.h>
#include <grpcpp/security/server_credentials.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
struct grpc_server;
namespace grpc_impl {
class ServerContext;
class ServerInitializer;
} // namespace grpc_impl
namespace grpc { namespace grpc {
class AsyncGenericService;
namespace internal {
class ExternalConnectionAcceptorImpl;
} // namespace internal
/// Represents a gRPC server.
///
/// Use a \a grpc::ServerBuilder to create, configure, and start
/// \a Server instances.
class Server : public ServerInterface, private GrpcLibraryCodegen {
public:
~Server();
/// Block until the server shuts down.
///
/// \warning The server must be either shutting down or some other thread must
/// call \a Shutdown for this function to ever return.
void Wait() override;
/// Global callbacks are a set of hooks that are called when server
/// events occur. \a SetGlobalCallbacks method is used to register
/// the hooks with gRPC. Note that
/// the \a GlobalCallbacks instance will be shared among all
/// \a Server instances in an application and can be set exactly
/// once per application.
class GlobalCallbacks {
public:
virtual ~GlobalCallbacks() {}
/// Called before server is created.
virtual void UpdateArguments(ChannelArguments* /*args*/) {}
/// Called before application callback for each synchronous server request
virtual void PreSynchronousRequest(ServerContext* context) = 0;
/// Called after application callback for each synchronous server request
virtual void PostSynchronousRequest(ServerContext* context) = 0;
/// Called before server is started.
virtual void PreServerStart(Server* /*server*/) {}
/// Called after a server port is added.
virtual void AddPort(Server* /*server*/, const std::string& /*addr*/,
ServerCredentials* /*creds*/, int /*port*/) {}
};
/// Set the global callback object. Can only be called once per application.
/// Does not take ownership of callbacks, and expects the pointed to object
/// to be alive until all server objects in the process have been destroyed.
/// The same \a GlobalCallbacks object will be used throughout the
/// application and is shared among all \a Server objects.
static void SetGlobalCallbacks(GlobalCallbacks* callbacks);
/// Returns a \em raw pointer to the underlying \a grpc_server instance.
/// EXPERIMENTAL: for internal/test use only
grpc_server* c_server();
/// Returns the health check service.
HealthCheckServiceInterface* GetHealthCheckService() const {
return health_check_service_.get();
}
/// Establish a channel for in-process communication
std::shared_ptr<Channel> InProcessChannel(const ChannelArguments& args);
/// NOTE: class experimental_type is not part of the public API of this class.
/// TODO(yashykt): Integrate into public API when this is no longer
/// experimental.
class experimental_type {
public:
explicit experimental_type(Server* server) : server_(server) {}
/// Establish a channel for in-process communication with client
/// interceptors
std::shared_ptr<Channel> InProcessChannelWithInterceptors(
const ChannelArguments& args,
std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
private:
Server* server_;
};
/// NOTE: The function experimental() is not stable public API. It is a view
/// to the experimental components of this class. It may be changed or removed
/// at any time.
experimental_type experimental() { return experimental_type(this); }
protected:
/// Register a service. This call does not take ownership of the service.
/// The service must exist for the lifetime of the Server instance.
bool RegisterService(const std::string* host, Service* service) override;
/// Try binding the server to the given \a addr endpoint
/// (port, and optionally including IP address to bind to).
///
/// It can be invoked multiple times. Should be used before
/// starting the server.
///
/// \param addr The address to try to bind to the server (eg, localhost:1234,
/// 192.168.1.1:31416, [::1]:27182, etc.).
/// \param creds The credentials associated with the server.
///
/// \return bound port number on success, 0 on failure.
///
/// \warning It is an error to call this method on an already started server.
int AddListeningPort(const std::string& addr,
ServerCredentials* creds) override;
/// NOTE: This is *NOT* a public API. The server constructors are supposed to
/// be used by \a ServerBuilder class only. The constructor will be made
/// 'private' very soon.
///
/// Server constructors. To be used by \a ServerBuilder only.
///
/// \param args The channel args
///
/// \param sync_server_cqs The completion queues to use if the server is a
/// synchronous server (or a hybrid server). The server polls for new RPCs on
/// these queues
///
/// \param min_pollers The minimum number of polling threads per server
/// completion queue (in param sync_server_cqs) to use for listening to
/// incoming requests (used only in case of sync server)
///
/// \param max_pollers The maximum number of polling threads per server
/// completion queue (in param sync_server_cqs) to use for listening to
/// incoming requests (used only in case of sync server)
///
/// \param sync_cq_timeout_msec The timeout to use when calling AsyncNext() on
/// server completion queues passed via sync_server_cqs param.
Server(ChannelArguments* args,
std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>>
sync_server_cqs,
int min_pollers, int max_pollers, int sync_cq_timeout_msec,
std::vector<std::shared_ptr<internal::ExternalConnectionAcceptorImpl>>
acceptors,
grpc_resource_quota* server_rq = nullptr,
std::vector<
std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>
interceptor_creators = std::vector<std::unique_ptr<
experimental::ServerInterceptorFactoryInterface>>());
/// Start the server.
///
/// \param cqs Completion queues for handling asynchronous services. The
/// caller is required to keep all completion queues live until the server is
/// destroyed.
/// \param num_cqs How many completion queues does \a cqs hold.
void Start(ServerCompletionQueue** cqs, size_t num_cqs) override;
grpc_server* server() override { return server_; }
protected:
/// NOTE: This method is not part of the public API for this class.
void set_health_check_service(
std::unique_ptr<HealthCheckServiceInterface> service) {
health_check_service_ = std::move(service);
}
/// NOTE: This method is not part of the public API for this class.
bool health_check_service_disabled() const {
return health_check_service_disabled_;
}
private:
std::vector<std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>*
interceptor_creators() override {
return &interceptor_creators_;
}
friend class AsyncGenericService;
friend class ServerBuilder;
friend class grpc_impl::ServerInitializer;
class SyncRequest;
class CallbackRequestBase;
template <class ServerContextType>
class CallbackRequest;
class UnimplementedAsyncRequest;
class UnimplementedAsyncResponse;
/// SyncRequestThreadManager is an implementation of ThreadManager. This class
/// is responsible for polling for incoming RPCs and calling the RPC handlers.
/// This is only used in case of a Sync server (i.e a server exposing a sync
/// interface)
class SyncRequestThreadManager;
/// Register a generic service. This call does not take ownership of the
/// service. The service must exist for the lifetime of the Server instance.
void RegisterAsyncGenericService(AsyncGenericService* service) override;
#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
/// Register a callback-based generic service. This call does not take
/// ownership of theservice. The service must exist for the lifetime of the
/// Server instance.
void RegisterCallbackGenericService(CallbackGenericService* service) override;
#else
/// NOTE: class experimental_registration_type is not part of the public API
/// of this class
/// TODO(vjpai): Move these contents to the public API of Server when
/// they are no longer experimental
class experimental_registration_type final
: public experimental_registration_interface {
public:
explicit experimental_registration_type(Server* server) : server_(server) {}
void RegisterCallbackGenericService(
experimental::CallbackGenericService* service) override {
server_->RegisterCallbackGenericService(service);
}
private:
Server* server_;
};
/// TODO(vjpai): Mark this override when experimental type above is deleted
void RegisterCallbackGenericService(
experimental::CallbackGenericService* service);
/// NOTE: The function experimental_registration() is not stable public API.
/// It is a view to the experimental components of this class. It may be
/// changed or removed at any time.
experimental_registration_interface* experimental_registration() override {
return &experimental_registration_;
}
#endif
void PerformOpsOnCall(internal::CallOpSetInterface* ops,
internal::Call* call) override;
void ShutdownInternal(gpr_timespec deadline) override;
int max_receive_message_size() const override {
return max_receive_message_size_;
}
CompletionQueue* CallbackCQ() override;
grpc_impl::ServerInitializer* initializer();
// Functions to manage the server shutdown ref count. Things that increase
// the ref count are the running state of the server (take a ref at start and
// drop it at shutdown) and each running callback RPC.
void Ref();
void UnrefWithPossibleNotify() /* LOCKS_EXCLUDED(mu_) */;
void UnrefAndWaitLocked() /* EXCLUSIVE_LOCKS_REQUIRED(mu_) */;
std::vector<std::shared_ptr<internal::ExternalConnectionAcceptorImpl>>
acceptors_;
// A vector of interceptor factory objects.
// This should be destroyed after health_check_service_ and this requirement
// is satisfied by declaring interceptor_creators_ before
// health_check_service_. (C++ mandates that member objects be destroyed in
// the reverse order of initialization.)
std::vector<std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>
interceptor_creators_;
int max_receive_message_size_;
/// The following completion queues are ONLY used in case of Sync API
/// i.e. if the server has any services with sync methods. The server uses
/// these completion queues to poll for new RPCs
std::shared_ptr<std::vector<std::unique_ptr<ServerCompletionQueue>>>
sync_server_cqs_;
/// List of \a ThreadManager instances (one for each cq in
/// the \a sync_server_cqs)
std::vector<std::unique_ptr<SyncRequestThreadManager>> sync_req_mgrs_;
#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
// For registering experimental callback generic service; remove when that
// method longer experimental
experimental_registration_type experimental_registration_{this};
#endif
// Server status
internal::Mutex mu_;
bool started_;
bool shutdown_;
bool shutdown_notified_; // Was notify called on the shutdown_cv_
internal::CondVar shutdown_done_cv_;
bool shutdown_done_ = false;
std::atomic_int shutdown_refs_outstanding_{1};
internal::CondVar shutdown_cv_;
std::shared_ptr<GlobalCallbacks> global_callbacks_;
std::vector<std::string> services_;
bool has_async_generic_service_ = false;
bool has_callback_generic_service_ = false;
bool has_callback_methods_ = false;
// Pointer to the wrapped grpc_server.
grpc_server* server_;
std::unique_ptr<grpc_impl::ServerInitializer> server_initializer_;
std::unique_ptr<HealthCheckServiceInterface> health_check_service_;
bool health_check_service_disabled_;
// When appropriate, use a default callback generic service to handle
// unimplemented methods
#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
std::unique_ptr<CallbackGenericService> unimplemented_service_;
#else
std::unique_ptr<experimental::CallbackGenericService> unimplemented_service_;
#endif
// A special handler for resource exhausted in sync case
std::unique_ptr<internal::MethodHandler> resource_exhausted_handler_;
// Handler for callback generic service, if any
std::unique_ptr<internal::MethodHandler> generic_handler_;
// callback_cq_ references the callbackable completion queue associated
// with this server (if any). It is set on the first call to CallbackCQ().
// It is _not owned_ by the server; ownership belongs with its internal
// shutdown callback tag (invoked when the CQ is fully shutdown).
CompletionQueue* callback_cq_ /* GUARDED_BY(mu_) */ = nullptr;
typedef ::grpc_impl::Server Server; // List of CQs passed in by user that must be Shutdown only after Server is
// Shutdown. Even though this is only used with NDEBUG, instantiate it in all
// cases since otherwise the size will be inconsistent.
std::vector<CompletionQueue*> cq_list_;
};
} // namespace grpc } // namespace grpc

@ -1,387 +0,0 @@
/*
*
* 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.
*
*/
#ifndef GRPCPP_SERVER_IMPL_H
#define GRPCPP_SERVER_IMPL_H
#include <list>
#include <memory>
#include <vector>
#include <grpc/impl/codegen/port_platform.h>
#include <grpc/compression.h>
#include <grpc/support/atm.h>
#include <grpcpp/channel.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/impl/codegen/completion_queue.h>
#include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/impl/codegen/server_interface.h>
#include <grpcpp/impl/rpc_service_method.h>
#include <grpcpp/security/server_credentials.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
struct grpc_server;
namespace grpc {
class AsyncGenericService;
class ServerContext;
namespace internal {
class ExternalConnectionAcceptorImpl;
} // namespace internal
} // namespace grpc
namespace grpc_impl {
class ServerInitializer;
/// Represents a gRPC server.
///
/// Use a \a grpc::ServerBuilder to create, configure, and start
/// \a Server instances.
class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen {
public:
~Server();
/// Block until the server shuts down.
///
/// \warning The server must be either shutting down or some other thread must
/// call \a Shutdown for this function to ever return.
void Wait() override;
/// Global callbacks are a set of hooks that are called when server
/// events occur. \a SetGlobalCallbacks method is used to register
/// the hooks with gRPC. Note that
/// the \a GlobalCallbacks instance will be shared among all
/// \a Server instances in an application and can be set exactly
/// once per application.
class GlobalCallbacks {
public:
virtual ~GlobalCallbacks() {}
/// Called before server is created.
virtual void UpdateArguments(grpc::ChannelArguments* /*args*/) {}
/// Called before application callback for each synchronous server request
virtual void PreSynchronousRequest(grpc::ServerContext* context) = 0;
/// Called after application callback for each synchronous server request
virtual void PostSynchronousRequest(grpc::ServerContext* context) = 0;
/// Called before server is started.
virtual void PreServerStart(Server* /*server*/) {}
/// Called after a server port is added.
virtual void AddPort(Server* /*server*/, const std::string& /*addr*/,
grpc::ServerCredentials* /*creds*/, int /*port*/) {}
};
/// Set the global callback object. Can only be called once per application.
/// Does not take ownership of callbacks, and expects the pointed to object
/// to be alive until all server objects in the process have been destroyed.
/// The same \a GlobalCallbacks object will be used throughout the
/// application and is shared among all \a Server objects.
static void SetGlobalCallbacks(GlobalCallbacks* callbacks);
/// Returns a \em raw pointer to the underlying \a grpc_server instance.
/// EXPERIMENTAL: for internal/test use only
grpc_server* c_server();
/// Returns the health check service.
grpc::HealthCheckServiceInterface* GetHealthCheckService() const {
return health_check_service_.get();
}
/// Establish a channel for in-process communication
std::shared_ptr<grpc::Channel> InProcessChannel(
const grpc::ChannelArguments& args);
/// NOTE: class experimental_type is not part of the public API of this class.
/// TODO(yashykt): Integrate into public API when this is no longer
/// experimental.
class experimental_type {
public:
explicit experimental_type(Server* server) : server_(server) {}
/// Establish a channel for in-process communication with client
/// interceptors
std::shared_ptr<grpc::Channel> InProcessChannelWithInterceptors(
const grpc::ChannelArguments& args,
std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators);
private:
Server* server_;
};
/// NOTE: The function experimental() is not stable public API. It is a view
/// to the experimental components of this class. It may be changed or removed
/// at any time.
experimental_type experimental() { return experimental_type(this); }
protected:
/// Register a service. This call does not take ownership of the service.
/// The service must exist for the lifetime of the Server instance.
bool RegisterService(const std::string* host,
grpc::Service* service) override;
/// Try binding the server to the given \a addr endpoint
/// (port, and optionally including IP address to bind to).
///
/// It can be invoked multiple times. Should be used before
/// starting the server.
///
/// \param addr The address to try to bind to the server (eg, localhost:1234,
/// 192.168.1.1:31416, [::1]:27182, etc.).
/// \param creds The credentials associated with the server.
///
/// \return bound port number on success, 0 on failure.
///
/// \warning It is an error to call this method on an already started server.
int AddListeningPort(const std::string& addr,
grpc::ServerCredentials* creds) override;
/// NOTE: This is *NOT* a public API. The server constructors are supposed to
/// be used by \a ServerBuilder class only. The constructor will be made
/// 'private' very soon.
///
/// Server constructors. To be used by \a ServerBuilder only.
///
/// \param args The channel args
///
/// \param sync_server_cqs The completion queues to use if the server is a
/// synchronous server (or a hybrid server). The server polls for new RPCs on
/// these queues
///
/// \param min_pollers The minimum number of polling threads per server
/// completion queue (in param sync_server_cqs) to use for listening to
/// incoming requests (used only in case of sync server)
///
/// \param max_pollers The maximum number of polling threads per server
/// completion queue (in param sync_server_cqs) to use for listening to
/// incoming requests (used only in case of sync server)
///
/// \param sync_cq_timeout_msec The timeout to use when calling AsyncNext() on
/// server completion queues passed via sync_server_cqs param.
Server(
grpc::ChannelArguments* args,
std::shared_ptr<std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>
sync_server_cqs,
int min_pollers, int max_pollers, int sync_cq_timeout_msec,
std::vector<
std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
acceptors,
grpc_resource_quota* server_rq = nullptr,
std::vector<std::unique_ptr<
grpc::experimental::ServerInterceptorFactoryInterface>>
interceptor_creators = std::vector<std::unique_ptr<
grpc::experimental::ServerInterceptorFactoryInterface>>());
/// Start the server.
///
/// \param cqs Completion queues for handling asynchronous services. The
/// caller is required to keep all completion queues live until the server is
/// destroyed.
/// \param num_cqs How many completion queues does \a cqs hold.
void Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) override;
grpc_server* server() override { return server_; }
protected:
/// NOTE: This method is not part of the public API for this class.
void set_health_check_service(
std::unique_ptr<grpc::HealthCheckServiceInterface> service) {
health_check_service_ = std::move(service);
}
/// NOTE: This method is not part of the public API for this class.
bool health_check_service_disabled() const {
return health_check_service_disabled_;
}
private:
std::vector<
std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>*
interceptor_creators() override {
return &interceptor_creators_;
}
friend class grpc::AsyncGenericService;
friend class grpc::ServerBuilder;
friend class grpc_impl::ServerInitializer;
class SyncRequest;
class CallbackRequestBase;
template <class ServerContextType>
class CallbackRequest;
class UnimplementedAsyncRequest;
class UnimplementedAsyncResponse;
/// SyncRequestThreadManager is an implementation of ThreadManager. This class
/// is responsible for polling for incoming RPCs and calling the RPC handlers.
/// This is only used in case of a Sync server (i.e a server exposing a sync
/// interface)
class SyncRequestThreadManager;
/// Register a generic service. This call does not take ownership of the
/// service. The service must exist for the lifetime of the Server instance.
void RegisterAsyncGenericService(grpc::AsyncGenericService* service) override;
#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
/// Register a callback-based generic service. This call does not take
/// ownership of theservice. The service must exist for the lifetime of the
/// Server instance.
void RegisterCallbackGenericService(
grpc::CallbackGenericService* service) override;
#else
/// NOTE: class experimental_registration_type is not part of the public API
/// of this class
/// TODO(vjpai): Move these contents to the public API of Server when
/// they are no longer experimental
class experimental_registration_type final
: public experimental_registration_interface {
public:
explicit experimental_registration_type(Server* server) : server_(server) {}
void RegisterCallbackGenericService(
grpc::experimental::CallbackGenericService* service) override {
server_->RegisterCallbackGenericService(service);
}
private:
Server* server_;
};
/// TODO(vjpai): Mark this override when experimental type above is deleted
void RegisterCallbackGenericService(
grpc::experimental::CallbackGenericService* service);
/// NOTE: The function experimental_registration() is not stable public API.
/// It is a view to the experimental components of this class. It may be
/// changed or removed at any time.
experimental_registration_interface* experimental_registration() override {
return &experimental_registration_;
}
#endif
void PerformOpsOnCall(grpc::internal::CallOpSetInterface* ops,
grpc::internal::Call* call) override;
void ShutdownInternal(gpr_timespec deadline) override;
int max_receive_message_size() const override {
return max_receive_message_size_;
}
grpc::CompletionQueue* CallbackCQ() override;
grpc_impl::ServerInitializer* initializer();
// Functions to manage the server shutdown ref count. Things that increase
// the ref count are the running state of the server (take a ref at start and
// drop it at shutdown) and each running callback RPC.
void Ref();
void UnrefWithPossibleNotify() /* LOCKS_EXCLUDED(mu_) */;
void UnrefAndWaitLocked() /* EXCLUSIVE_LOCKS_REQUIRED(mu_) */;
std::vector<std::shared_ptr<grpc::internal::ExternalConnectionAcceptorImpl>>
acceptors_;
// A vector of interceptor factory objects.
// This should be destroyed after health_check_service_ and this requirement
// is satisfied by declaring interceptor_creators_ before
// health_check_service_. (C++ mandates that member objects be destroyed in
// the reverse order of initialization.)
std::vector<
std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>
interceptor_creators_;
int max_receive_message_size_;
/// The following completion queues are ONLY used in case of Sync API
/// i.e. if the server has any services with sync methods. The server uses
/// these completion queues to poll for new RPCs
std::shared_ptr<std::vector<std::unique_ptr<grpc::ServerCompletionQueue>>>
sync_server_cqs_;
/// List of \a ThreadManager instances (one for each cq in
/// the \a sync_server_cqs)
std::vector<std::unique_ptr<SyncRequestThreadManager>> sync_req_mgrs_;
#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
// For registering experimental callback generic service; remove when that
// method longer experimental
experimental_registration_type experimental_registration_{this};
#endif
// Server status
grpc::internal::Mutex mu_;
bool started_;
bool shutdown_;
bool shutdown_notified_; // Was notify called on the shutdown_cv_
grpc::internal::CondVar shutdown_done_cv_;
bool shutdown_done_ = false;
std::atomic_int shutdown_refs_outstanding_{1};
grpc::internal::CondVar shutdown_cv_;
std::shared_ptr<GlobalCallbacks> global_callbacks_;
std::vector<std::string> services_;
bool has_async_generic_service_ = false;
bool has_callback_generic_service_ = false;
bool has_callback_methods_ = false;
// Pointer to the wrapped grpc_server.
grpc_server* server_;
std::unique_ptr<grpc_impl::ServerInitializer> server_initializer_;
std::unique_ptr<grpc::HealthCheckServiceInterface> health_check_service_;
bool health_check_service_disabled_;
// When appropriate, use a default callback generic service to handle
// unimplemented methods
#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
std::unique_ptr<grpc::CallbackGenericService> unimplemented_service_;
#else
std::unique_ptr<grpc::experimental::CallbackGenericService>
unimplemented_service_;
#endif
// A special handler for resource exhausted in sync case
std::unique_ptr<grpc::internal::MethodHandler> resource_exhausted_handler_;
// Handler for callback generic service, if any
std::unique_ptr<grpc::internal::MethodHandler> generic_handler_;
// callback_cq_ references the callbackable completion queue associated
// with this server (if any). It is set on the first call to CallbackCQ().
// It is _not owned_ by the server; ownership belongs with its internal
// shutdown callback tag (invoked when the CQ is fully shutdown).
grpc::CompletionQueue* callback_cq_ /* GUARDED_BY(mu_) */ = nullptr;
// List of CQs passed in by user that must be Shutdown only after Server is
// Shutdown. Even though this is only used with NDEBUG, instantiate it in all
// cases since otherwise the size will be inconsistent.
std::vector<grpc::CompletionQueue*> cq_list_;
};
} // namespace grpc_impl
#endif // GRPCPP_SERVER_IMPL_H

@ -13,8 +13,8 @@
<date>2019-09-24</date> <date>2019-09-24</date>
<time>16:06:07</time> <time>16:06:07</time>
<version> <version>
<release>1.32.0dev</release> <release>1.33.0dev</release>
<api>1.32.0dev</api> <api>1.33.0dev</api>
</version> </version>
<stability> <stability>
<release>beta</release> <release>beta</release>
@ -22,7 +22,7 @@
</stability> </stability>
<license>Apache 2.0</license> <license>Apache 2.0</license>
<notes> <notes>
- gRPC Core 1.32.0 update - gRPC Core 1.33.0 update
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="/" name="/"> <dir baseinstalldir="/" name="/">
@ -746,7 +746,13 @@
<file baseinstalldir="/" name="src/core/lib/security/authorization/evaluate_args.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/security/authorization/evaluate_args.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/evaluate_args.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/security/authorization/evaluate_args.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/activation.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/activation.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/cel_expression.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/cel_value.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/cel_value.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/evaluator_core.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/flat_expr_builder.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/statusor.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/certificate_provider.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/context/security_context.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/security/context/security_context.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/context/security_context.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/security/context/security_context.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/alts/alts_credentials.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/security/credentials/alts/alts_credentials.cc" role="src" />

@ -166,12 +166,22 @@ def check_linker_need_libatomic():
"""Test if linker on system needs libatomic.""" """Test if linker on system needs libatomic."""
code_test = (b'#include <atomic>\n' + code_test = (b'#include <atomic>\n' +
b'int main() { return std::atomic<int64_t>{}; }') b'int main() { return std::atomic<int64_t>{}; }')
cc_test = subprocess.Popen(['cc', '-x', 'c++', '-std=c++11', '-'], cpp_test = subprocess.Popen(['c++', '-x', 'c++', '-std=c++11', '-'],
stdin=PIPE, stdin=PIPE,
stdout=PIPE, stdout=PIPE,
stderr=PIPE) stderr=PIPE)
cc_test.communicate(input=code_test) cpp_test.communicate(input=code_test)
return cc_test.returncode != 0 if cpp_test.returncode == 0:
return False
# Double-check to see if -latomic actually can solve the problem.
# https://github.com/grpc/grpc/issues/22491
cpp_test = subprocess.Popen(
['c++', '-x', 'c++', '-std=c++11', '-latomic', '-'],
stdin=PIPE,
stdout=PIPE,
stderr=PIPE)
cpp_test.communicate(input=code_test)
return cpp_test.returncode == 0
# There are some situations (like on Windows) where CC, CFLAGS, and LDFLAGS are # There are some situations (like on Windows) where CC, CFLAGS, and LDFLAGS are

@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# https://github.com/abseil/abseil-cpp/issues/626
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DABSL_NO_XRAY_ATTRIBUTES=1")
set(PROTOBUF_PROTOC_EXECUTABLE "/usr/local/bin/protoc" CACHE STRING "Protoc binary on host") set(PROTOBUF_PROTOC_EXECUTABLE "/usr/local/bin/protoc" CACHE STRING "Protoc binary on host")
set(gRPC_CPP_PLUGIN_EXECUTABLE "/usr/local/bin/grpc_cpp_plugin" CACHE STRING "gRPC CPP plugin binary on host") set(gRPC_CPP_PLUGIN_EXECUTABLE "/usr/local/bin/grpc_cpp_plugin" CACHE STRING "gRPC CPP plugin binary on host")

@ -29,6 +29,9 @@ android {
arguments '-DgRPC_CPP_PLUGIN_EXECUTABLE=' + grpc_cpp_plugin arguments '-DgRPC_CPP_PLUGIN_EXECUTABLE=' + grpc_cpp_plugin
} }
} }
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
} }
buildTypes { buildTypes {
debug { debug {

@ -6,7 +6,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip

@ -325,13 +325,76 @@ std::vector<const Descriptor*> GetUsedMessages(
void GenerateMarshallerFields(Printer* out, const ServiceDescriptor* service) { void GenerateMarshallerFields(Printer* out, const ServiceDescriptor* service) {
std::vector<const Descriptor*> used_messages = GetUsedMessages(service); std::vector<const Descriptor*> used_messages = GetUsedMessages(service);
if (used_messages.size() != 0) {
// Generate static helper methods for serialization/deserialization
out->Print(
"static void __Helper_SerializeMessage("
"global::Google.Protobuf.IMessage message, "
"grpc::SerializationContext context)\n"
"{\n");
out->Indent();
out->Print(
"#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION\n"
"if (message is global::Google.Protobuf.IBufferMessage)\n"
"{\n");
out->Indent();
out->Print(
"context.SetPayloadLength(message.CalculateSize());\n"
"global::Google.Protobuf.MessageExtensions.WriteTo(message, "
"context.GetBufferWriter());\n"
"context.Complete();\n"
"return;\n");
out->Outdent();
out->Print(
"}\n"
"#endif\n");
out->Print(
"context.Complete("
"global::Google.Protobuf.MessageExtensions.ToByteArray(message));\n");
out->Outdent();
out->Print("}\n\n");
out->Print(
"static class __Helper_MessageCache<T>\n"
"{\n");
out->Indent();
out->Print(
"public static readonly bool IsBufferMessage = "
"global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof("
"global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));"
"\n");
out->Outdent();
out->Print("}\n\n");
out->Print(
"static T __Helper_DeserializeMessage<T>("
"grpc::DeserializationContext context, "
"global::Google.Protobuf.MessageParser<T> parser) "
"where T : global::Google.Protobuf.IMessage<T>\n"
"{\n");
out->Indent();
out->Print(
"#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION\n"
"if (__Helper_MessageCache<T>.IsBufferMessage)\n"
"{\n");
out->Indent();
out->Print(
"return parser.ParseFrom(context.PayloadAsReadOnlySequence());\n");
out->Outdent();
out->Print(
"}\n"
"#endif\n");
out->Print("return parser.ParseFrom(context.PayloadAsNewBuffer());\n");
out->Outdent();
out->Print("}\n\n");
}
for (size_t i = 0; i < used_messages.size(); i++) { for (size_t i = 0; i < used_messages.size(); i++) {
const Descriptor* message = used_messages[i]; const Descriptor* message = used_messages[i];
out->Print( out->Print(
"static readonly grpc::Marshaller<$type$> $fieldname$ = " "static readonly grpc::Marshaller<$type$> $fieldname$ = "
"grpc::Marshallers.Create((arg) => " "grpc::Marshallers.Create(__Helper_SerializeMessage, "
"global::Google.Protobuf.MessageExtensions.ToByteArray(arg), " "context => __Helper_DeserializeMessage(context, $type$.Parser));\n",
"$type$.Parser.ParseFrom);\n",
"fieldname", GetMarshallerFieldName(message), "type", "fieldname", GetMarshallerFieldName(message), "type",
GetClassName(message)); GetClassName(message));
} }

@ -801,7 +801,7 @@ void GrpcLb::BalancerCallState::Orphan() {
// lb_on_balancer_status_received_ will complete the cancellation and clean // lb_on_balancer_status_received_ will complete the cancellation and clean
// up. Otherwise, we are here because grpclb_policy has to orphan a failed // up. Otherwise, we are here because grpclb_policy has to orphan a failed
// call, then the following cancellation will be a no-op. // call, then the following cancellation will be a no-op.
grpc_call_cancel(lb_call_, nullptr); grpc_call_cancel_internal(lb_call_);
if (client_load_report_timer_callback_pending_) { if (client_load_report_timer_callback_pending_) {
grpc_timer_cancel(&client_load_report_timer_); grpc_timer_cancel(&client_load_report_timer_);
} }

@ -58,7 +58,7 @@ constexpr char kXdsRouting[] = "xds_routing_experimental";
class XdsRoutingLbConfig : public LoadBalancingPolicy::Config { class XdsRoutingLbConfig : public LoadBalancingPolicy::Config {
public: public:
struct Route { struct Route {
XdsApi::RdsUpdate::RdsRoute::Matchers matchers; XdsApi::Route::Matchers matchers;
std::string action; std::string action;
}; };
using RouteTable = std::vector<Route>; using RouteTable = std::vector<Route>;
@ -112,7 +112,7 @@ class XdsRoutingLb : public LoadBalancingPolicy {
class RoutePicker : public SubchannelPicker { class RoutePicker : public SubchannelPicker {
public: public:
struct Route { struct Route {
const XdsApi::RdsUpdate::RdsRoute::Matchers* matchers; const XdsApi::Route::Matchers* matchers;
RefCountedPtr<ChildPickerWrapper> picker; RefCountedPtr<ChildPickerWrapper> picker;
}; };
@ -128,7 +128,7 @@ class XdsRoutingLb : public LoadBalancingPolicy {
private: private:
RouteTable route_table_; RouteTable route_table_;
// Take a reference to config so that we can use // Take a reference to config so that we can use
// XdsApi::RdsUpdate::RdsRoute::Matchers from it. // XdsApi::Route::Matchers from it.
RefCountedPtr<XdsRoutingLbConfig> config_; RefCountedPtr<XdsRoutingLbConfig> config_;
}; };
@ -222,18 +222,14 @@ class XdsRoutingLb : public LoadBalancingPolicy {
// XdsRoutingLb::RoutePicker // XdsRoutingLb::RoutePicker
// //
bool PathMatch( bool PathMatch(const absl::string_view& path,
const absl::string_view& path, const XdsApi::Route::Matchers::PathMatcher& path_matcher) {
const XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher& path_matcher) {
switch (path_matcher.type) { switch (path_matcher.type) {
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType:: case XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PREFIX:
PREFIX:
return absl::StartsWith(path, path_matcher.string_matcher); return absl::StartsWith(path, path_matcher.string_matcher);
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType:: case XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PATH:
PATH:
return path == path_matcher.string_matcher; return path == path_matcher.string_matcher;
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType:: case XdsApi::Route::Matchers::PathMatcher::PathMatcherType::REGEX:
REGEX:
return RE2::FullMatch(path.data(), *path_matcher.regex_matcher); return RE2::FullMatch(path.data(), *path_matcher.regex_matcher);
default: default:
return false; return false;
@ -262,7 +258,7 @@ absl::optional<absl::string_view> GetMetadataValue(
} }
bool HeaderMatchHelper( bool HeaderMatchHelper(
const XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher& header_matcher, const XdsApi::Route::Matchers::HeaderMatcher& header_matcher,
LoadBalancingPolicy::MetadataInterface* initial_metadata) { LoadBalancingPolicy::MetadataInterface* initial_metadata) {
std::string concatenated_value; std::string concatenated_value;
absl::optional<absl::string_view> value; absl::optional<absl::string_view> value;
@ -279,8 +275,8 @@ bool HeaderMatchHelper(
&concatenated_value); &concatenated_value);
} }
if (!value.has_value()) { if (!value.has_value()) {
if (header_matcher.type == XdsApi::RdsUpdate::RdsRoute::Matchers:: if (header_matcher.type ==
HeaderMatcher::HeaderMatcherType::PRESENT) { XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PRESENT) {
return !header_matcher.present_match; return !header_matcher.present_match;
} else { } else {
// For all other header matcher types, we need the header value to // For all other header matcher types, we need the header value to
@ -289,25 +285,20 @@ bool HeaderMatchHelper(
} }
} }
switch (header_matcher.type) { switch (header_matcher.type) {
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::EXACT:
HeaderMatcherType::EXACT:
return value.value() == header_matcher.string_matcher; return value.value() == header_matcher.string_matcher;
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::REGEX:
HeaderMatcherType::REGEX:
return RE2::FullMatch(value.value().data(), *header_matcher.regex_match); return RE2::FullMatch(value.value().data(), *header_matcher.regex_match);
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::RANGE:
HeaderMatcherType::RANGE:
int64_t int_value; int64_t int_value;
if (!absl::SimpleAtoi(value.value(), &int_value)) { if (!absl::SimpleAtoi(value.value(), &int_value)) {
return false; return false;
} }
return int_value >= header_matcher.range_start && return int_value >= header_matcher.range_start &&
int_value < header_matcher.range_end; int_value < header_matcher.range_end;
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PREFIX:
HeaderMatcherType::PREFIX:
return absl::StartsWith(value.value(), header_matcher.string_matcher); return absl::StartsWith(value.value(), header_matcher.string_matcher);
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::SUFFIX:
HeaderMatcherType::SUFFIX:
return absl::EndsWith(value.value(), header_matcher.string_matcher); return absl::EndsWith(value.value(), header_matcher.string_matcher);
default: default:
return false; return false;
@ -315,8 +306,7 @@ bool HeaderMatchHelper(
} }
bool HeadersMatch( bool HeadersMatch(
const std::vector<XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher>& const std::vector<XdsApi::Route::Matchers::HeaderMatcher>& header_matchers,
header_matchers,
LoadBalancingPolicy::MetadataInterface* initial_metadata) { LoadBalancingPolicy::MetadataInterface* initial_metadata) {
for (const auto& header_matcher : header_matchers) { for (const auto& header_matcher : header_matchers) {
bool match = HeaderMatchHelper(header_matcher, initial_metadata); bool match = HeaderMatchHelper(header_matcher, initial_metadata);
@ -865,8 +855,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
"field:prefix error: should be string")); "field:prefix error: should be string"));
} else { } else {
path_matcher_seen = true; path_matcher_seen = true;
route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute:: route->matchers.path_matcher.type =
Matchers::PathMatcher::PathMatcherType::PREFIX; XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PREFIX;
route->matchers.path_matcher.string_matcher = it->second.string_value(); route->matchers.path_matcher.string_matcher = it->second.string_value();
} }
} }
@ -881,8 +871,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:path error: should be string")); "field:path error: should be string"));
} else { } else {
route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute:: route->matchers.path_matcher.type =
Matchers::PathMatcher::PathMatcherType::PATH; XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PATH;
route->matchers.path_matcher.string_matcher = route->matchers.path_matcher.string_matcher =
it->second.string_value(); it->second.string_value();
} }
@ -899,8 +889,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:regex error: should be string")); "field:regex error: should be string"));
} else { } else {
route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute:: route->matchers.path_matcher.type =
Matchers::PathMatcher::PathMatcherType::REGEX; XdsApi::Route::Matchers::PathMatcher::PathMatcherType::REGEX;
route->matchers.path_matcher.regex_matcher = route->matchers.path_matcher.regex_matcher =
absl::make_unique<RE2>(it->second.string_value()); absl::make_unique<RE2>(it->second.string_value());
} }
@ -925,8 +915,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
"value should be of type object")); "value should be of type object"));
} else { } else {
route->matchers.header_matchers.emplace_back(); route->matchers.header_matchers.emplace_back();
XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher& XdsApi::Route::Matchers::HeaderMatcher& header_matcher =
header_matcher = route->matchers.header_matchers.back(); route->matchers.header_matchers.back();
auto header_it = header_json.object_value().find("name"); auto header_it = header_json.object_value().find("name");
if (header_it == header_json.object_value().end()) { if (header_it == header_json.object_value().end()) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
@ -960,8 +950,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:exact_match error: should be string")); "field:exact_match error: should be string"));
} else { } else {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type = XdsApi::Route::Matchers::HeaderMatcher::
HeaderMatcher::HeaderMatcherType::EXACT; HeaderMatcherType::EXACT;
header_matcher.string_matcher = header_matcher.string_matcher =
header_it->second.string_value(); header_it->second.string_value();
} }
@ -978,8 +968,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:regex_match error: should be string")); "field:regex_match error: should be string"));
} else { } else {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type = XdsApi::Route::Matchers::HeaderMatcher::
HeaderMatcher::HeaderMatcherType::REGEX; HeaderMatcherType::REGEX;
header_matcher.regex_match = header_matcher.regex_match =
absl::make_unique<RE2>(header_it->second.string_value()); absl::make_unique<RE2>(header_it->second.string_value());
} }
@ -1025,8 +1015,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
"field:end missing")); "field:end missing"));
} }
if (header_matcher.range_end > header_matcher.range_start) { if (header_matcher.range_end > header_matcher.range_start) {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute:: header_matcher.type = XdsApi::Route::Matchers::
Matchers::HeaderMatcher::HeaderMatcherType::RANGE; HeaderMatcher::HeaderMatcherType::RANGE;
} }
} }
} }
@ -1040,12 +1030,12 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
} else { } else {
header_matcher_seen = true; header_matcher_seen = true;
if (header_it->second.type() == Json::Type::JSON_TRUE) { if (header_it->second.type() == Json::Type::JSON_TRUE) {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type = XdsApi::Route::Matchers::HeaderMatcher::
HeaderMatcher::HeaderMatcherType::PRESENT; HeaderMatcherType::PRESENT;
header_matcher.present_match = true; header_matcher.present_match = true;
} else if (header_it->second.type() == Json::Type::JSON_FALSE) { } else if (header_it->second.type() == Json::Type::JSON_FALSE) {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type = XdsApi::Route::Matchers::HeaderMatcher::
HeaderMatcher::HeaderMatcherType::PRESENT; HeaderMatcherType::PRESENT;
header_matcher.present_match = false; header_matcher.present_match = false;
} else { } else {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
@ -1065,8 +1055,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:prefix_match error: should be string")); "field:prefix_match error: should be string"));
} else { } else {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type = XdsApi::Route::Matchers::HeaderMatcher::
HeaderMatcher::HeaderMatcherType::PREFIX; HeaderMatcherType::PREFIX;
header_matcher.string_matcher = header_matcher.string_matcher =
header_it->second.string_value(); header_it->second.string_value();
} }
@ -1084,8 +1074,8 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:suffix_match error: should be string")); "field:suffix_match error: should be string"));
} else { } else {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type = XdsApi::Route::Matchers::HeaderMatcher::
HeaderMatcher::HeaderMatcherType::SUFFIX; HeaderMatcherType::SUFFIX;
header_matcher.string_matcher = header_matcher.string_matcher =
header_it->second.string_value(); header_it->second.string_value();
} }

@ -74,7 +74,7 @@ class XdsResolver : public Resolver {
public: public:
explicit ListenerWatcher(RefCountedPtr<XdsResolver> resolver) explicit ListenerWatcher(RefCountedPtr<XdsResolver> resolver)
: resolver_(std::move(resolver)) {} : resolver_(std::move(resolver)) {}
void OnListenerChanged(XdsApi::LdsUpdate listener_data) override; void OnListenerChanged(std::vector<XdsApi::Route> routes) override;
void OnError(grpc_error* error) override; void OnError(grpc_error* error) override;
void OnResourceDoesNotExist() override; void OnResourceDoesNotExist() override;
@ -92,15 +92,14 @@ class XdsResolver : public Resolver {
// Returns the weighted_clusters action name to use from // Returns the weighted_clusters action name to use from
// weighted_cluster_index_map_ for a WeightedClusters route action. // weighted_cluster_index_map_ for a WeightedClusters route action.
std::string WeightedClustersActionName( std::string WeightedClustersActionName(
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& const std::vector<XdsApi::Route::ClusterWeight>& weighted_clusters);
weighted_clusters);
// Updates weighted_cluster_index_map_ that will // Updates weighted_cluster_index_map_ that will
// determine the names of the WeightedCluster actions for the current update. // determine the names of the WeightedCluster actions for the current update.
void UpdateWeightedClusterIndexMap(const XdsApi::RdsUpdate& rds_update); void UpdateWeightedClusterIndexMap(const std::vector<XdsApi::Route>& routes);
// Create the service config generated by the RdsUpdate. // Create the service config generated by the list of routes.
grpc_error* CreateServiceConfig(const XdsApi::RdsUpdate& rds_update, grpc_error* CreateServiceConfig(const std::vector<XdsApi::Route>& routes,
RefCountedPtr<ServiceConfig>* service_config); RefCountedPtr<ServiceConfig>* service_config);
std::string server_name_; std::string server_name_;
@ -131,15 +130,15 @@ class XdsResolver : public Resolver {
// //
void XdsResolver::ListenerWatcher::OnListenerChanged( void XdsResolver::ListenerWatcher::OnListenerChanged(
XdsApi::LdsUpdate listener_data) { std::vector<XdsApi::Route> routes) {
if (resolver_->xds_client_ == nullptr) return; if (resolver_->xds_client_ == nullptr) return;
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_resolver_trace)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_resolver_trace)) {
gpr_log(GPR_INFO, "[xds_resolver %p] received updated listener data", gpr_log(GPR_INFO, "[xds_resolver %p] received updated listener data",
resolver_.get()); resolver_.get());
} }
Result result; Result result;
grpc_error* error = resolver_->CreateServiceConfig(*listener_data.rds_update, grpc_error* error =
&result.service_config); resolver_->CreateServiceConfig(routes, &result.service_config);
if (error != GRPC_ERROR_NONE) { if (error != GRPC_ERROR_NONE) {
OnError(error); OnError(error);
return; return;
@ -214,23 +213,20 @@ std::string CreateServiceConfigActionCluster(const std::string& cluster_name) {
} }
std::string CreateServiceConfigRoute(const std::string& action_name, std::string CreateServiceConfigRoute(const std::string& action_name,
const XdsApi::RdsUpdate::RdsRoute& route) { const XdsApi::Route& route) {
std::vector<std::string> headers; std::vector<std::string> headers;
for (const auto& header : route.matchers.header_matchers) { for (const auto& header : route.matchers.header_matchers) {
std::string header_matcher; std::string header_matcher;
switch (header.type) { switch (header.type) {
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::EXACT:
HeaderMatcherType::EXACT:
header_matcher = absl::StrFormat(" \"exact_match\": \"%s\"", header_matcher = absl::StrFormat(" \"exact_match\": \"%s\"",
header.string_matcher); header.string_matcher);
break; break;
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::REGEX:
HeaderMatcherType::REGEX:
header_matcher = absl::StrFormat(" \"regex_match\": \"%s\"", header_matcher = absl::StrFormat(" \"regex_match\": \"%s\"",
header.regex_match->pattern()); header.regex_match->pattern());
break; break;
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::RANGE:
HeaderMatcherType::RANGE:
header_matcher = absl::StrFormat( header_matcher = absl::StrFormat(
" \"range_match\":{\n" " \"range_match\":{\n"
" \"start\":%d,\n" " \"start\":%d,\n"
@ -238,19 +234,16 @@ std::string CreateServiceConfigRoute(const std::string& action_name,
" }", " }",
header.range_start, header.range_end); header.range_start, header.range_end);
break; break;
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PRESENT:
HeaderMatcherType::PRESENT:
header_matcher = header_matcher =
absl::StrFormat(" \"present_match\": %s", absl::StrFormat(" \"present_match\": %s",
header.present_match ? "true" : "false"); header.present_match ? "true" : "false");
break; break;
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PREFIX:
HeaderMatcherType::PREFIX:
header_matcher = absl::StrFormat( header_matcher = absl::StrFormat(
" \"prefix_match\": \"%s\"", header.string_matcher); " \"prefix_match\": \"%s\"", header.string_matcher);
break; break;
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher:: case XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::SUFFIX:
HeaderMatcherType::SUFFIX:
header_matcher = absl::StrFormat( header_matcher = absl::StrFormat(
" \"suffix_match\": \"%s\"", header.string_matcher); " \"suffix_match\": \"%s\"", header.string_matcher);
break; break;
@ -281,18 +274,15 @@ std::string CreateServiceConfigRoute(const std::string& action_name,
} }
std::string path_match_str; std::string path_match_str;
switch (route.matchers.path_matcher.type) { switch (route.matchers.path_matcher.type) {
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType:: case XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PREFIX:
PREFIX:
path_match_str = absl::StrFormat( path_match_str = absl::StrFormat(
"\"prefix\": \"%s\",\n", route.matchers.path_matcher.string_matcher); "\"prefix\": \"%s\",\n", route.matchers.path_matcher.string_matcher);
break; break;
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType:: case XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PATH:
PATH:
path_match_str = absl::StrFormat( path_match_str = absl::StrFormat(
"\"path\": \"%s\",\n", route.matchers.path_matcher.string_matcher); "\"path\": \"%s\",\n", route.matchers.path_matcher.string_matcher);
break; break;
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType:: case XdsApi::Route::Matchers::PathMatcher::PathMatcherType::REGEX:
REGEX:
path_match_str = path_match_str =
absl::StrFormat("\"regex\": \"%s\",\n", absl::StrFormat("\"regex\": \"%s\",\n",
route.matchers.path_matcher.regex_matcher->pattern()); route.matchers.path_matcher.regex_matcher->pattern());
@ -316,7 +306,7 @@ std::string CreateServiceConfigRoute(const std::string& action_name,
// Create the service config for one weighted cluster. // Create the service config for one weighted cluster.
std::string CreateServiceConfigActionWeightedCluster( std::string CreateServiceConfigActionWeightedCluster(
const std::string& name, const std::string& name,
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& clusters) { const std::vector<XdsApi::Route::ClusterWeight>& clusters) {
std::vector<std::string> config_parts; std::vector<std::string> config_parts;
config_parts.push_back( config_parts.push_back(
absl::StrFormat(" \"weighted:%s\":{\n" absl::StrFormat(" \"weighted:%s\":{\n"
@ -354,8 +344,7 @@ struct WeightedClustersKeys {
// Returns the cluster names and weights key or the cluster names only key. // Returns the cluster names and weights key or the cluster names only key.
WeightedClustersKeys GetWeightedClustersKey( WeightedClustersKeys GetWeightedClustersKey(
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& const std::vector<XdsApi::Route::ClusterWeight>& weighted_clusters) {
weighted_clusters) {
std::set<std::string> cluster_names; std::set<std::string> cluster_names;
std::set<std::string> cluster_weights; std::set<std::string> cluster_weights;
for (const auto& cluster_weight : weighted_clusters) { for (const auto& cluster_weight : weighted_clusters) {
@ -368,8 +357,7 @@ WeightedClustersKeys GetWeightedClustersKey(
} }
std::string XdsResolver::WeightedClustersActionName( std::string XdsResolver::WeightedClustersActionName(
const std::vector<XdsApi::RdsUpdate::RdsRoute::ClusterWeight>& const std::vector<XdsApi::Route::ClusterWeight>& weighted_clusters) {
weighted_clusters) {
WeightedClustersKeys keys = GetWeightedClustersKey(weighted_clusters); WeightedClustersKeys keys = GetWeightedClustersKey(weighted_clusters);
auto cluster_names_map_it = auto cluster_names_map_it =
weighted_cluster_index_map_.find(keys.cluster_names_key); weighted_cluster_index_map_.find(keys.cluster_names_key);
@ -384,13 +372,13 @@ std::string XdsResolver::WeightedClustersActionName(
} }
void XdsResolver::UpdateWeightedClusterIndexMap( void XdsResolver::UpdateWeightedClusterIndexMap(
const XdsApi::RdsUpdate& rds_update) { const std::vector<XdsApi::Route>& routes) {
// Construct a list of unique WeightedCluster // Construct a list of unique WeightedCluster
// actions which we need to process: to find action names // actions which we need to process: to find action names
std::map<std::string /* cluster_weights_key */, std::map<std::string /* cluster_weights_key */,
std::string /* cluster_names_key */> std::string /* cluster_names_key */>
actions_to_process; actions_to_process;
for (const auto& route : rds_update.routes) { for (const auto& route : routes) {
if (!route.weighted_clusters.empty()) { if (!route.weighted_clusters.empty()) {
WeightedClustersKeys keys = WeightedClustersKeys keys =
GetWeightedClustersKey(route.weighted_clusters); GetWeightedClustersKey(route.weighted_clusters);
@ -467,13 +455,13 @@ void XdsResolver::UpdateWeightedClusterIndexMap(
} }
grpc_error* XdsResolver::CreateServiceConfig( grpc_error* XdsResolver::CreateServiceConfig(
const XdsApi::RdsUpdate& rds_update, const std::vector<XdsApi::Route>& routes,
RefCountedPtr<ServiceConfig>* service_config) { RefCountedPtr<ServiceConfig>* service_config) {
UpdateWeightedClusterIndexMap(rds_update); UpdateWeightedClusterIndexMap(routes);
std::vector<std::string> actions_vector; std::vector<std::string> actions_vector;
std::vector<std::string> route_table; std::vector<std::string> route_table;
std::set<std::string> actions_set; std::set<std::string> actions_set;
for (const auto& route : rds_update.routes) { for (const auto& route : routes) {
const std::string action_name = const std::string action_name =
route.weighted_clusters.empty() route.weighted_clusters.empty()
? route.cluster_name ? route.cluster_name

@ -675,9 +675,6 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
grpc_slice_buffer_destroy_internal(&decompressed_data_buffer); grpc_slice_buffer_destroy_internal(&decompressed_data_buffer);
} }
grpc_chttp2_list_remove_stalled_by_transport(t, this);
grpc_chttp2_list_remove_stalled_by_stream(t, this);
for (int i = 0; i < STREAM_LIST_COUNT; i++) { for (int i = 0; i < STREAM_LIST_COUNT; i++) {
if (GPR_UNLIKELY(included[i])) { if (GPR_UNLIKELY(included[i])) {
gpr_log(GPR_ERROR, "%s stream %d still included in list %d", gpr_log(GPR_ERROR, "%s stream %d still included in list %d",
@ -2030,6 +2027,8 @@ static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
if (grpc_chttp2_list_remove_writable_stream(t, s)) { if (grpc_chttp2_list_remove_writable_stream(t, s)) {
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:remove_stream"); GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:remove_stream");
} }
grpc_chttp2_list_remove_stalled_by_stream(t, s);
grpc_chttp2_list_remove_stalled_by_transport(t, s);
GRPC_ERROR_UNREF(error); GRPC_ERROR_UNREF(error);

@ -52,8 +52,12 @@ class ContextList;
/* streams are kept in various linked lists depending on what things need to /* streams are kept in various linked lists depending on what things need to
happen to them... this enum labels each list */ happen to them... this enum labels each list */
typedef enum { typedef enum {
/* If a stream is in the following two lists, an explicit ref is associated
with the stream */
GRPC_CHTTP2_LIST_WRITABLE, GRPC_CHTTP2_LIST_WRITABLE,
GRPC_CHTTP2_LIST_WRITING, GRPC_CHTTP2_LIST_WRITING,
/* No additional ref is taken for the following refs. Make sure to remove the
stream from these lists when the stream is removed. */
GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT, GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT,
GRPC_CHTTP2_LIST_STALLED_BY_STREAM, GRPC_CHTTP2_LIST_STALLED_BY_STREAM,
/** streams that are waiting to start because there are too many concurrent /** streams that are waiting to start because there are too many concurrent

@ -74,11 +74,10 @@
namespace grpc_core { namespace grpc_core {
// //
// XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher // XdsApi::Route::Matchers::PathMatcher
// //
XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcher( XdsApi::Route::Matchers::PathMatcher::PathMatcher(const PathMatcher& other)
const PathMatcher& other)
: type(other.type) { : type(other.type) {
if (type == PathMatcherType::REGEX) { if (type == PathMatcherType::REGEX) {
regex_matcher = absl::make_unique<RE2>(other.regex_matcher->pattern()); regex_matcher = absl::make_unique<RE2>(other.regex_matcher->pattern());
@ -87,9 +86,8 @@ XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcher(
} }
} }
XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher& XdsApi::Route::Matchers::PathMatcher& XdsApi::Route::Matchers::PathMatcher::
XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::operator=( operator=(const PathMatcher& other) {
const PathMatcher& other) {
type = other.type; type = other.type;
if (type == PathMatcherType::REGEX) { if (type == PathMatcherType::REGEX) {
regex_matcher = absl::make_unique<RE2>(other.regex_matcher->pattern()); regex_matcher = absl::make_unique<RE2>(other.regex_matcher->pattern());
@ -99,7 +97,7 @@ XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::operator=(
return *this; return *this;
} }
bool XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::operator==( bool XdsApi::Route::Matchers::PathMatcher::operator==(
const PathMatcher& other) const { const PathMatcher& other) const {
if (type != other.type) return false; if (type != other.type) return false;
if (type == PathMatcherType::REGEX) { if (type == PathMatcherType::REGEX) {
@ -112,8 +110,7 @@ bool XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::operator==(
return string_matcher == other.string_matcher; return string_matcher == other.string_matcher;
} }
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::ToString() std::string XdsApi::Route::Matchers::PathMatcher::ToString() const {
const {
std::string path_type_string; std::string path_type_string;
switch (type) { switch (type) {
case PathMatcherType::PATH: case PathMatcherType::PATH:
@ -135,10 +132,10 @@ std::string XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::ToString()
} }
// //
// XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher // XdsApi::Route::Matchers::HeaderMatcher
// //
XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::HeaderMatcher( XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcher(
const HeaderMatcher& other) const HeaderMatcher& other)
: name(other.name), type(other.type), invert_match(other.invert_match) { : name(other.name), type(other.type), invert_match(other.invert_match) {
switch (type) { switch (type) {
@ -157,9 +154,8 @@ XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::HeaderMatcher(
} }
} }
XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher& XdsApi::Route::Matchers::HeaderMatcher& XdsApi::Route::Matchers::HeaderMatcher::
XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::operator=( operator=(const HeaderMatcher& other) {
const HeaderMatcher& other) {
name = other.name; name = other.name;
type = other.type; type = other.type;
invert_match = other.invert_match; invert_match = other.invert_match;
@ -180,7 +176,7 @@ XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::operator=(
return *this; return *this;
} }
bool XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::operator==( bool XdsApi::Route::Matchers::HeaderMatcher::operator==(
const HeaderMatcher& other) const { const HeaderMatcher& other) const {
if (name != other.name) return false; if (name != other.name) return false;
if (type != other.type) return false; if (type != other.type) return false;
@ -197,8 +193,7 @@ bool XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::operator==(
} }
} }
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::ToString() std::string XdsApi::Route::Matchers::HeaderMatcher::ToString() const {
const {
switch (type) { switch (type) {
case HeaderMatcherType::EXACT: case HeaderMatcherType::EXACT:
return absl::StrFormat("Header exact match:%s %s:%s", return absl::StrFormat("Header exact match:%s %s:%s",
@ -226,7 +221,11 @@ std::string XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::ToString()
} }
} }
std::string XdsApi::RdsUpdate::RdsRoute::Matchers::ToString() const { //
// XdsApi::Route
//
std::string XdsApi::Route::Matchers::ToString() const {
std::vector<std::string> contents; std::vector<std::string> contents;
contents.push_back(path_matcher.ToString()); contents.push_back(path_matcher.ToString());
for (const auto& header_it : header_matchers) { for (const auto& header_it : header_matchers) {
@ -239,11 +238,11 @@ std::string XdsApi::RdsUpdate::RdsRoute::Matchers::ToString() const {
return absl::StrJoin(contents, "\n"); return absl::StrJoin(contents, "\n");
} }
std::string XdsApi::RdsUpdate::RdsRoute::ClusterWeight::ToString() const { std::string XdsApi::Route::ClusterWeight::ToString() const {
return absl::StrFormat("{cluster=%s, weight=%d}", name, weight); return absl::StrFormat("{cluster=%s, weight=%d}", name, weight);
} }
std::string XdsApi::RdsUpdate::RdsRoute::ToString() const { std::string XdsApi::Route::ToString() const {
std::vector<std::string> contents; std::vector<std::string> contents;
contents.push_back(matchers.ToString()); contents.push_back(matchers.ToString());
if (!cluster_name.empty()) { if (!cluster_name.empty()) {
@ -255,12 +254,124 @@ std::string XdsApi::RdsUpdate::RdsRoute::ToString() const {
return absl::StrJoin(contents, "\n"); return absl::StrJoin(contents, "\n");
} }
//
// XdsApi::RdsUpdate
//
std::string XdsApi::RdsUpdate::ToString() const { std::string XdsApi::RdsUpdate::ToString() const {
std::vector<std::string> contents; std::vector<std::string> vhosts;
for (const auto& route_it : routes) { for (const VirtualHost& vhost : virtual_hosts) {
contents.push_back(route_it.ToString()); vhosts.push_back(
absl::StrCat("vhost={\n"
" domains=[",
absl::StrJoin(vhost.domains, ", "),
"]\n"
" routes=[\n"));
for (const XdsApi::Route& route : vhost.routes) {
vhosts.push_back(" {\n");
vhosts.push_back(route.ToString());
vhosts.push_back("\n }\n");
}
vhosts.push_back(" ]\n");
vhosts.push_back("]\n");
} }
return absl::StrJoin(contents, ",\n"); return absl::StrJoin(vhosts, "");
}
namespace {
// Better match type has smaller value.
enum MatchType {
EXACT_MATCH,
SUFFIX_MATCH,
PREFIX_MATCH,
UNIVERSE_MATCH,
INVALID_MATCH,
};
// Returns true if match succeeds.
bool DomainMatch(MatchType match_type, std::string domain_pattern,
std::string expected_host_name) {
// Normalize the args to lower-case. Domain matching is case-insensitive.
std::transform(domain_pattern.begin(), domain_pattern.end(),
domain_pattern.begin(),
[](unsigned char c) { return std::tolower(c); });
std::transform(expected_host_name.begin(), expected_host_name.end(),
expected_host_name.begin(),
[](unsigned char c) { return std::tolower(c); });
if (match_type == EXACT_MATCH) {
return domain_pattern == expected_host_name;
} else if (match_type == SUFFIX_MATCH) {
// Asterisk must match at least one char.
if (expected_host_name.size() < domain_pattern.size()) return false;
absl::string_view pattern_suffix(domain_pattern.c_str() + 1);
absl::string_view host_suffix(expected_host_name.c_str() +
expected_host_name.size() -
pattern_suffix.size());
return pattern_suffix == host_suffix;
} else if (match_type == PREFIX_MATCH) {
// Asterisk must match at least one char.
if (expected_host_name.size() < domain_pattern.size()) return false;
absl::string_view pattern_prefix(domain_pattern.c_str(),
domain_pattern.size() - 1);
absl::string_view host_prefix(expected_host_name.c_str(),
pattern_prefix.size());
return pattern_prefix == host_prefix;
} else {
return match_type == UNIVERSE_MATCH;
}
}
MatchType DomainPatternMatchType(const std::string& domain_pattern) {
if (domain_pattern.empty()) return INVALID_MATCH;
if (domain_pattern.find('*') == std::string::npos) return EXACT_MATCH;
if (domain_pattern == "*") return UNIVERSE_MATCH;
if (domain_pattern[0] == '*') return SUFFIX_MATCH;
if (domain_pattern[domain_pattern.size() - 1] == '*') return PREFIX_MATCH;
return INVALID_MATCH;
}
} // namespace
const XdsApi::RdsUpdate::VirtualHost*
XdsApi::RdsUpdate::FindVirtualHostForDomain(const std::string& domain) const {
// Find the best matched virtual host.
// The search order for 4 groups of domain patterns:
// 1. Exact match.
// 2. Suffix match (e.g., "*ABC").
// 3. Prefix match (e.g., "ABC*").
// 4. Universe match (i.e., "*").
// Within each group, longest match wins.
// If the same best matched domain pattern appears in multiple virtual hosts,
// the first matched virtual host wins.
const VirtualHost* target_vhost = nullptr;
MatchType best_match_type = INVALID_MATCH;
size_t longest_match = 0;
// Check each domain pattern in each virtual host to determine the best
// matched virtual host.
for (const VirtualHost& vhost : virtual_hosts) {
for (const std::string& domain_pattern : vhost.domains) {
// Check the match type first. Skip the pattern if it's not better than
// current match.
const MatchType match_type = DomainPatternMatchType(domain_pattern);
// This should be caught by RouteConfigParse().
GPR_ASSERT(match_type != INVALID_MATCH);
if (match_type > best_match_type) continue;
if (match_type == best_match_type &&
domain_pattern.size() <= longest_match) {
continue;
}
// Skip if match fails.
if (!DomainMatch(match_type, domain_pattern, domain)) continue;
// Choose this match.
target_vhost = &vhost;
best_match_type = match_type;
longest_match = domain_pattern.size();
if (best_match_type == EXACT_MATCH) break;
}
if (best_match_type == EXACT_MATCH) break;
}
return target_vhost;
} }
// //
@ -1163,60 +1274,8 @@ void MaybeLogClusterLoadAssignment(
} }
} }
// Better match type has smaller value.
enum MatchType {
EXACT_MATCH,
SUFFIX_MATCH,
PREFIX_MATCH,
UNIVERSE_MATCH,
INVALID_MATCH,
};
// Returns true if match succeeds.
bool DomainMatch(MatchType match_type, std::string domain_pattern,
std::string expected_host_name) {
// Normalize the args to lower-case. Domain matching is case-insensitive.
std::transform(domain_pattern.begin(), domain_pattern.end(),
domain_pattern.begin(),
[](unsigned char c) { return std::tolower(c); });
std::transform(expected_host_name.begin(), expected_host_name.end(),
expected_host_name.begin(),
[](unsigned char c) { return std::tolower(c); });
if (match_type == EXACT_MATCH) {
return domain_pattern == expected_host_name;
} else if (match_type == SUFFIX_MATCH) {
// Asterisk must match at least one char.
if (expected_host_name.size() < domain_pattern.size()) return false;
absl::string_view pattern_suffix(domain_pattern.c_str() + 1);
absl::string_view host_suffix(expected_host_name.c_str() +
expected_host_name.size() -
pattern_suffix.size());
return pattern_suffix == host_suffix;
} else if (match_type == PREFIX_MATCH) {
// Asterisk must match at least one char.
if (expected_host_name.size() < domain_pattern.size()) return false;
absl::string_view pattern_prefix(domain_pattern.c_str(),
domain_pattern.size() - 1);
absl::string_view host_prefix(expected_host_name.c_str(),
pattern_prefix.size());
return pattern_prefix == host_prefix;
} else {
return match_type == UNIVERSE_MATCH;
}
}
MatchType DomainPatternMatchType(const std::string& domain_pattern) {
if (domain_pattern.empty()) return INVALID_MATCH;
if (domain_pattern.find('*') == std::string::npos) return EXACT_MATCH;
if (domain_pattern == "*") return UNIVERSE_MATCH;
if (domain_pattern[0] == '*') return SUFFIX_MATCH;
if (domain_pattern[domain_pattern.size() - 1] == '*') return PREFIX_MATCH;
return INVALID_MATCH;
}
grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match, grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
XdsApi::RdsUpdate::RdsRoute* rds_route, XdsApi::Route* route, bool* ignore_route) {
bool* ignore_route) {
if (envoy_config_route_v3_RouteMatch_has_prefix(match)) { if (envoy_config_route_v3_RouteMatch_has_prefix(match)) {
absl::string_view prefix = absl::string_view prefix =
UpbStringToAbsl(envoy_config_route_v3_RouteMatch_prefix(match)); UpbStringToAbsl(envoy_config_route_v3_RouteMatch_prefix(match));
@ -1241,9 +1300,9 @@ grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
} }
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute:: route->matchers.path_matcher.type =
Matchers::PathMatcher::PathMatcherType::PREFIX; XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PREFIX;
rds_route->matchers.path_matcher.string_matcher = std::string(prefix); route->matchers.path_matcher.string_matcher = std::string(prefix);
} else if (envoy_config_route_v3_RouteMatch_has_path(match)) { } else if (envoy_config_route_v3_RouteMatch_has_path(match)) {
absl::string_view path = absl::string_view path =
UpbStringToAbsl(envoy_config_route_v3_RouteMatch_path(match)); UpbStringToAbsl(envoy_config_route_v3_RouteMatch_path(match));
@ -1276,9 +1335,9 @@ grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
*ignore_route = true; *ignore_route = true;
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute:: route->matchers.path_matcher.type =
Matchers::PathMatcher::PathMatcherType::PATH; XdsApi::Route::Matchers::PathMatcher::PathMatcherType::PATH;
rds_route->matchers.path_matcher.string_matcher = std::string(path); route->matchers.path_matcher.string_matcher = std::string(path);
} else if (envoy_config_route_v3_RouteMatch_has_safe_regex(match)) { } else if (envoy_config_route_v3_RouteMatch_has_safe_regex(match)) {
const envoy_type_matcher_v3_RegexMatcher* regex_matcher = const envoy_type_matcher_v3_RegexMatcher* regex_matcher =
envoy_config_route_v3_RouteMatch_safe_regex(match); envoy_config_route_v3_RouteMatch_safe_regex(match);
@ -1290,9 +1349,9 @@ grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Invalid regex string specified in path matcher."); "Invalid regex string specified in path matcher.");
} }
rds_route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute:: route->matchers.path_matcher.type =
Matchers::PathMatcher::PathMatcherType::REGEX; XdsApi::Route::Matchers::PathMatcher::PathMatcherType::REGEX;
rds_route->matchers.path_matcher.regex_matcher = std::move(regex); route->matchers.path_matcher.regex_matcher = std::move(regex);
} else { } else {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Invalid route path specifier specified."); "Invalid route path specifier specified.");
@ -1301,19 +1360,18 @@ grpc_error* RoutePathMatchParse(const envoy_config_route_v3_RouteMatch* match,
} }
grpc_error* RouteHeaderMatchersParse( grpc_error* RouteHeaderMatchersParse(
const envoy_config_route_v3_RouteMatch* match, const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route) {
XdsApi::RdsUpdate::RdsRoute* rds_route) {
size_t size; size_t size;
const envoy_config_route_v3_HeaderMatcher* const* headers = const envoy_config_route_v3_HeaderMatcher* const* headers =
envoy_config_route_v3_RouteMatch_headers(match, &size); envoy_config_route_v3_RouteMatch_headers(match, &size);
for (size_t i = 0; i < size; ++i) { for (size_t i = 0; i < size; ++i) {
const envoy_config_route_v3_HeaderMatcher* header = headers[i]; const envoy_config_route_v3_HeaderMatcher* header = headers[i];
XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher header_matcher; XdsApi::Route::Matchers::HeaderMatcher header_matcher;
header_matcher.name = header_matcher.name =
UpbStringToStdString(envoy_config_route_v3_HeaderMatcher_name(header)); UpbStringToStdString(envoy_config_route_v3_HeaderMatcher_name(header));
if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) { if (envoy_config_route_v3_HeaderMatcher_has_exact_match(header)) {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type =
HeaderMatcher::HeaderMatcherType::EXACT; XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::EXACT;
header_matcher.string_matcher = UpbStringToStdString( header_matcher.string_matcher = UpbStringToStdString(
envoy_config_route_v3_HeaderMatcher_exact_match(header)); envoy_config_route_v3_HeaderMatcher_exact_match(header));
} else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match( } else if (envoy_config_route_v3_HeaderMatcher_has_safe_regex_match(
@ -1328,12 +1386,12 @@ grpc_error* RouteHeaderMatchersParse(
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Invalid regex string specified in header matcher."); "Invalid regex string specified in header matcher.");
} }
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type =
HeaderMatcher::HeaderMatcherType::REGEX; XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::REGEX;
header_matcher.regex_match = std::move(regex); header_matcher.regex_match = std::move(regex);
} else if (envoy_config_route_v3_HeaderMatcher_has_range_match(header)) { } else if (envoy_config_route_v3_HeaderMatcher_has_range_match(header)) {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type =
HeaderMatcher::HeaderMatcherType::RANGE; XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::RANGE;
const envoy_type_v3_Int64Range* range_matcher = const envoy_type_v3_Int64Range* range_matcher =
envoy_config_route_v3_HeaderMatcher_range_match(header); envoy_config_route_v3_HeaderMatcher_range_match(header);
header_matcher.range_start = header_matcher.range_start =
@ -1345,18 +1403,18 @@ grpc_error* RouteHeaderMatchersParse(
"cannot be smaller than start."); "cannot be smaller than start.");
} }
} else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) { } else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type =
HeaderMatcher::HeaderMatcherType::PRESENT; XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PRESENT;
header_matcher.present_match = header_matcher.present_match =
envoy_config_route_v3_HeaderMatcher_present_match(header); envoy_config_route_v3_HeaderMatcher_present_match(header);
} else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) { } else if (envoy_config_route_v3_HeaderMatcher_has_prefix_match(header)) {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type =
HeaderMatcher::HeaderMatcherType::PREFIX; XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::PREFIX;
header_matcher.string_matcher = UpbStringToStdString( header_matcher.string_matcher = UpbStringToStdString(
envoy_config_route_v3_HeaderMatcher_prefix_match(header)); envoy_config_route_v3_HeaderMatcher_prefix_match(header));
} else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) { } else if (envoy_config_route_v3_HeaderMatcher_has_suffix_match(header)) {
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers:: header_matcher.type =
HeaderMatcher::HeaderMatcherType::SUFFIX; XdsApi::Route::Matchers::HeaderMatcher::HeaderMatcherType::SUFFIX;
header_matcher.string_matcher = UpbStringToStdString( header_matcher.string_matcher = UpbStringToStdString(
envoy_config_route_v3_HeaderMatcher_suffix_match(header)); envoy_config_route_v3_HeaderMatcher_suffix_match(header));
} else { } else {
@ -1365,14 +1423,13 @@ grpc_error* RouteHeaderMatchersParse(
} }
header_matcher.invert_match = header_matcher.invert_match =
envoy_config_route_v3_HeaderMatcher_invert_match(header); envoy_config_route_v3_HeaderMatcher_invert_match(header);
rds_route->matchers.header_matchers.emplace_back(std::move(header_matcher)); route->matchers.header_matchers.emplace_back(std::move(header_matcher));
} }
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
grpc_error* RouteRuntimeFractionParse( grpc_error* RouteRuntimeFractionParse(
const envoy_config_route_v3_RouteMatch* match, const envoy_config_route_v3_RouteMatch* match, XdsApi::Route* route) {
XdsApi::RdsUpdate::RdsRoute* rds_route) {
const envoy_config_core_v3_RuntimeFractionalPercent* runtime_fraction = const envoy_config_core_v3_RuntimeFractionalPercent* runtime_fraction =
envoy_config_route_v3_RouteMatch_runtime_fraction(match); envoy_config_route_v3_RouteMatch_runtime_fraction(match);
if (runtime_fraction != nullptr) { if (runtime_fraction != nullptr) {
@ -1398,26 +1455,25 @@ grpc_error* RouteRuntimeFractionParse(
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Unknown denominator type"); "Unknown denominator type");
} }
rds_route->matchers.fraction_per_million = numerator; route->matchers.fraction_per_million = numerator;
} }
} }
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
grpc_error* RouteActionParse(const envoy_config_route_v3_Route* route, grpc_error* RouteActionParse(const envoy_config_route_v3_Route* route_msg,
XdsApi::RdsUpdate::RdsRoute* rds_route, XdsApi::Route* route, bool* ignore_route) {
bool* ignore_route) { if (!envoy_config_route_v3_Route_has_route(route_msg)) {
if (!envoy_config_route_v3_Route_has_route(route)) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No RouteAction found in route."); "No RouteAction found in route.");
} }
const envoy_config_route_v3_RouteAction* route_action = const envoy_config_route_v3_RouteAction* route_action =
envoy_config_route_v3_Route_route(route); envoy_config_route_v3_Route_route(route_msg);
// Get the cluster or weighted_clusters in the RouteAction. // Get the cluster or weighted_clusters in the RouteAction.
if (envoy_config_route_v3_RouteAction_has_cluster(route_action)) { if (envoy_config_route_v3_RouteAction_has_cluster(route_action)) {
rds_route->cluster_name = UpbStringToStdString( route->cluster_name = UpbStringToStdString(
envoy_config_route_v3_RouteAction_cluster(route_action)); envoy_config_route_v3_RouteAction_cluster(route_action));
if (rds_route->cluster_name.size() == 0) { if (route->cluster_name.size() == 0) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"RouteAction cluster contains empty cluster name."); "RouteAction cluster contains empty cluster name.");
} }
@ -1439,7 +1495,7 @@ grpc_error* RouteActionParse(const envoy_config_route_v3_Route* route,
for (size_t j = 0; j < clusters_size; ++j) { for (size_t j = 0; j < clusters_size; ++j) {
const envoy_config_route_v3_WeightedCluster_ClusterWeight* const envoy_config_route_v3_WeightedCluster_ClusterWeight*
cluster_weight = clusters[j]; cluster_weight = clusters[j];
XdsApi::RdsUpdate::RdsRoute::ClusterWeight cluster; XdsApi::Route::ClusterWeight cluster;
cluster.name = UpbStringToStdString( cluster.name = UpbStringToStdString(
envoy_config_route_v3_WeightedCluster_ClusterWeight_name( envoy_config_route_v3_WeightedCluster_ClusterWeight_name(
cluster_weight)); cluster_weight));
@ -1457,13 +1513,13 @@ grpc_error* RouteActionParse(const envoy_config_route_v3_Route* route,
} }
cluster.weight = google_protobuf_UInt32Value_value(weight); cluster.weight = google_protobuf_UInt32Value_value(weight);
sum_of_weights += cluster.weight; sum_of_weights += cluster.weight;
rds_route->weighted_clusters.emplace_back(std::move(cluster)); route->weighted_clusters.emplace_back(std::move(cluster));
} }
if (total_weight != sum_of_weights) { if (total_weight != sum_of_weights) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"RouteAction weighted_cluster has incorrect total weight"); "RouteAction weighted_cluster has incorrect total weight");
} }
if (rds_route->weighted_clusters.empty()) { if (route->weighted_clusters.empty()) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING( return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"RouteAction weighted_cluster has no valid clusters specified."); "RouteAction weighted_cluster has no valid clusters specified.");
} }
@ -1478,101 +1534,73 @@ grpc_error* RouteActionParse(const envoy_config_route_v3_Route* route,
grpc_error* RouteConfigParse( grpc_error* RouteConfigParse(
XdsClient* client, TraceFlag* tracer, XdsClient* client, TraceFlag* tracer,
const envoy_config_route_v3_RouteConfiguration* route_config, const envoy_config_route_v3_RouteConfiguration* route_config,
const std::string& expected_server_name, XdsApi::RdsUpdate* rds_update) { XdsApi::RdsUpdate* rds_update) {
MaybeLogRouteConfiguration(client, tracer, route_config); MaybeLogRouteConfiguration(client, tracer, route_config);
// Get the virtual hosts. // Get the virtual hosts.
size_t size; size_t size;
const envoy_config_route_v3_VirtualHost* const* virtual_hosts = const envoy_config_route_v3_VirtualHost* const* virtual_hosts =
envoy_config_route_v3_RouteConfiguration_virtual_hosts(route_config, envoy_config_route_v3_RouteConfiguration_virtual_hosts(route_config,
&size); &size);
// Find the best matched virtual host.
// The search order for 4 groups of domain patterns:
// 1. Exact match.
// 2. Suffix match (e.g., "*ABC").
// 3. Prefix match (e.g., "ABC*").
// 4. Universe match (i.e., "*").
// Within each group, longest match wins.
// If the same best matched domain pattern appears in multiple virtual hosts,
// the first matched virtual host wins.
const envoy_config_route_v3_VirtualHost* target_virtual_host = nullptr;
MatchType best_match_type = INVALID_MATCH;
size_t longest_match = 0;
// Check each domain pattern in each virtual host to determine the best
// matched virtual host.
for (size_t i = 0; i < size; ++i) { for (size_t i = 0; i < size; ++i) {
rds_update->virtual_hosts.emplace_back();
XdsApi::RdsUpdate::VirtualHost& vhost = rds_update->virtual_hosts.back();
// Parse domains.
size_t domain_size; size_t domain_size;
upb_strview const* domains = envoy_config_route_v3_VirtualHost_domains( upb_strview const* domains = envoy_config_route_v3_VirtualHost_domains(
virtual_hosts[i], &domain_size); virtual_hosts[i], &domain_size);
for (size_t j = 0; j < domain_size; ++j) { for (size_t j = 0; j < domain_size; ++j) {
const std::string domain_pattern(domains[j].data, domains[j].size); std::string domain_pattern = UpbStringToStdString(domains[j]);
// Check the match type first. Skip the pattern if it's not better than
// current match.
const MatchType match_type = DomainPatternMatchType(domain_pattern); const MatchType match_type = DomainPatternMatchType(domain_pattern);
if (match_type == INVALID_MATCH) { if (match_type == INVALID_MATCH) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid domain pattern."); return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Invalid domain pattern.");
} }
if (match_type > best_match_type) continue; vhost.domains.emplace_back(std::move(domain_pattern));
if (match_type == best_match_type && }
domain_pattern.size() <= longest_match) { if (vhost.domains.empty()) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("VirtualHost has no domains");
}
// Parse routes.
size_t num_routes;
const envoy_config_route_v3_Route* const* routes =
envoy_config_route_v3_VirtualHost_routes(virtual_hosts[i], &num_routes);
if (num_routes < 1) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No route found in the virtual host.");
}
// Loop over the whole list of routes
for (size_t j = 0; j < num_routes; ++j) {
const envoy_config_route_v3_RouteMatch* match =
envoy_config_route_v3_Route_match(routes[j]);
size_t query_parameters_size;
static_cast<void>(envoy_config_route_v3_RouteMatch_query_parameters(
match, &query_parameters_size));
if (query_parameters_size > 0) {
continue; continue;
} }
// Skip if match fails. XdsApi::Route route;
if (!DomainMatch(match_type, domain_pattern, expected_server_name)) { bool ignore_route = false;
continue; grpc_error* error = RoutePathMatchParse(match, &route, &ignore_route);
if (error != GRPC_ERROR_NONE) return error;
if (ignore_route) continue;
error = RouteHeaderMatchersParse(match, &route);
if (error != GRPC_ERROR_NONE) return error;
error = RouteRuntimeFractionParse(match, &route);
if (error != GRPC_ERROR_NONE) return error;
error = RouteActionParse(routes[j], &route, &ignore_route);
if (error != GRPC_ERROR_NONE) return error;
if (ignore_route) continue;
const google_protobuf_BoolValue* case_sensitive =
envoy_config_route_v3_RouteMatch_case_sensitive(match);
if (case_sensitive != nullptr &&
!google_protobuf_BoolValue_value(case_sensitive)) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"case_sensitive if set must be set to true.");
} }
// Choose this match. vhost.routes.emplace_back(std::move(route));
target_virtual_host = virtual_hosts[i];
best_match_type = match_type;
longest_match = domain_pattern.size();
if (best_match_type == EXACT_MATCH) break;
}
if (best_match_type == EXACT_MATCH) break;
}
if (target_virtual_host == nullptr) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No matched virtual host found in the route config.");
}
// Get the route list from the matched virtual host.
const envoy_config_route_v3_Route* const* routes =
envoy_config_route_v3_VirtualHost_routes(target_virtual_host, &size);
if (size < 1) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No route found in the virtual host.");
}
// Loop over the whole list of routes
for (size_t i = 0; i < size; ++i) {
const envoy_config_route_v3_Route* route = routes[i];
const envoy_config_route_v3_RouteMatch* match =
envoy_config_route_v3_Route_match(route);
size_t query_parameters_size;
static_cast<void>(envoy_config_route_v3_RouteMatch_query_parameters(
match, &query_parameters_size));
if (query_parameters_size > 0) {
continue;
} }
XdsApi::RdsUpdate::RdsRoute rds_route; if (vhost.routes.empty()) {
bool ignore_route = false; return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No valid routes specified.");
grpc_error* error = RoutePathMatchParse(match, &rds_route, &ignore_route);
if (error != GRPC_ERROR_NONE) return error;
if (ignore_route) continue;
error = RouteHeaderMatchersParse(match, &rds_route);
if (error != GRPC_ERROR_NONE) return error;
error = RouteRuntimeFractionParse(match, &rds_route);
if (error != GRPC_ERROR_NONE) return error;
error = RouteActionParse(route, &rds_route, &ignore_route);
if (error != GRPC_ERROR_NONE) return error;
if (ignore_route) continue;
const google_protobuf_BoolValue* case_sensitive =
envoy_config_route_v3_RouteMatch_case_sensitive(match);
if (case_sensitive != nullptr &&
!google_protobuf_BoolValue_value(case_sensitive)) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"case_sensitive if set must be set to true.");
} }
rds_update->routes.emplace_back(std::move(rds_route));
}
if (rds_update->routes.empty()) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("No valid routes specified.");
} }
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
@ -1630,11 +1658,11 @@ grpc_error* LdsResponseParse(
envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_route_config( envoy_extensions_filters_network_http_connection_manager_v3_HttpConnectionManager_route_config(
http_connection_manager); http_connection_manager);
XdsApi::RdsUpdate rds_update; XdsApi::RdsUpdate rds_update;
grpc_error* error = RouteConfigParse(client, tracer, route_config, grpc_error* error =
expected_server_name, &rds_update); RouteConfigParse(client, tracer, route_config, &rds_update);
if (error != GRPC_ERROR_NONE) return error; if (error != GRPC_ERROR_NONE) return error;
lds_update->emplace(); lds_update->emplace();
(*lds_update)->rds_update.emplace(std::move(rds_update)); (*lds_update)->rds_update = std::move(rds_update);
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
// Validate that RDS must be used to get the route_config dynamically. // Validate that RDS must be used to get the route_config dynamically.
@ -1671,7 +1699,6 @@ grpc_error* LdsResponseParse(
grpc_error* RdsResponseParse( grpc_error* RdsResponseParse(
XdsClient* client, TraceFlag* tracer, XdsClient* client, TraceFlag* tracer,
const envoy_service_discovery_v3_DiscoveryResponse* response, const envoy_service_discovery_v3_DiscoveryResponse* response,
const std::string& expected_server_name,
const std::set<absl::string_view>& expected_route_configuration_names, const std::set<absl::string_view>& expected_route_configuration_names,
absl::optional<XdsApi::RdsUpdate>* rds_update, upb_arena* arena) { absl::optional<XdsApi::RdsUpdate>* rds_update, upb_arena* arena) {
// Get the resources from the response. // Get the resources from the response.
@ -1703,8 +1730,8 @@ grpc_error* RdsResponseParse(
} }
// Parse the route_config. // Parse the route_config.
XdsApi::RdsUpdate local_rds_update; XdsApi::RdsUpdate local_rds_update;
grpc_error* error = RouteConfigParse( grpc_error* error =
client, tracer, route_config, expected_server_name, &local_rds_update); RouteConfigParse(client, tracer, route_config, &local_rds_update);
if (error != GRPC_ERROR_NONE) return error; if (error != GRPC_ERROR_NONE) return error;
rds_update->emplace(std::move(local_rds_update)); rds_update->emplace(std::move(local_rds_update));
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
@ -2043,9 +2070,9 @@ XdsApi::AdsParseResult XdsApi::ParseAdsResponse(
LdsResponseParse(client_, tracer_, response, expected_server_name, LdsResponseParse(client_, tracer_, response, expected_server_name,
&result.lds_update, arena.ptr()); &result.lds_update, arena.ptr());
} else if (IsRds(result.type_url)) { } else if (IsRds(result.type_url)) {
result.parse_error = RdsResponseParse( result.parse_error = RdsResponseParse(client_, tracer_, response,
client_, tracer_, response, expected_server_name, expected_route_configuration_names,
expected_route_configuration_names, &result.rds_update, arena.ptr()); &result.rds_update, arena.ptr());
} else if (IsCds(result.type_url)) { } else if (IsCds(result.type_url)) {
result.parse_error = result.parse_error =
CdsResponseParse(client_, tracer_, response, expected_cluster_names, CdsResponseParse(client_, tracer_, response, expected_cluster_names,

@ -46,98 +46,109 @@ class XdsApi {
static const char* kCdsTypeUrl; static const char* kCdsTypeUrl;
static const char* kEdsTypeUrl; static const char* kEdsTypeUrl;
struct RdsUpdate { // TODO(donnadionne): When we can use absl::variant<>, consider using that
// TODO(donnadionne): When we can use absl::variant<>, consider using that // for: PathMatcher, HeaderMatcher, cluster_name and weighted_clusters
// for: PathMatcher, HeaderMatcher, cluster_name and weighted_clusters struct Route {
struct RdsRoute { // Matchers for this route.
// Matchers for this route. struct Matchers {
struct Matchers { struct PathMatcher {
struct PathMatcher { enum class PathMatcherType {
enum class PathMatcherType { PATH, // path stored in string_matcher field
PATH, // path stored in string_matcher field PREFIX, // prefix stored in string_matcher field
PREFIX, // prefix stored in string_matcher field REGEX, // regex stored in regex_matcher field
REGEX, // regex stored in regex_matcher field
};
PathMatcherType type;
std::string string_matcher;
std::unique_ptr<RE2> regex_matcher;
PathMatcher() = default;
PathMatcher(const PathMatcher& other);
PathMatcher& operator=(const PathMatcher& other);
bool operator==(const PathMatcher& other) const;
std::string ToString() const;
};
struct HeaderMatcher {
enum class HeaderMatcherType {
EXACT, // value stored in string_matcher field
REGEX, // uses regex_match field
RANGE, // uses range_start and range_end fields
PRESENT, // uses present_match field
PREFIX, // prefix stored in string_matcher field
SUFFIX, // suffix stored in string_matcher field
};
std::string name;
HeaderMatcherType type;
int64_t range_start;
int64_t range_end;
std::string string_matcher;
std::unique_ptr<RE2> regex_match;
bool present_match;
// invert_match field may or may not exisit, so initialize it to
// false.
bool invert_match = false;
HeaderMatcher() = default;
HeaderMatcher(const HeaderMatcher& other);
HeaderMatcher& operator=(const HeaderMatcher& other);
bool operator==(const HeaderMatcher& other) const;
std::string ToString() const;
}; };
PathMatcherType type;
PathMatcher path_matcher; std::string string_matcher;
std::vector<HeaderMatcher> header_matchers; std::unique_ptr<RE2> regex_matcher;
absl::optional<uint32_t> fraction_per_million;
PathMatcher() = default;
bool operator==(const Matchers& other) const { PathMatcher(const PathMatcher& other);
return (path_matcher == other.path_matcher && PathMatcher& operator=(const PathMatcher& other);
header_matchers == other.header_matchers && bool operator==(const PathMatcher& other) const;
fraction_per_million == other.fraction_per_million);
}
std::string ToString() const; std::string ToString() const;
}; };
Matchers matchers; struct HeaderMatcher {
enum class HeaderMatcherType {
// Action for this route. EXACT, // value stored in string_matcher field
// TODO(roth): When we can use absl::variant<>, consider using that REGEX, // uses regex_match field
// here, to enforce the fact that only one of the two fields can be set. RANGE, // uses range_start and range_end fields
std::string cluster_name; PRESENT, // uses present_match field
struct ClusterWeight { PREFIX, // prefix stored in string_matcher field
SUFFIX, // suffix stored in string_matcher field
};
std::string name; std::string name;
uint32_t weight; HeaderMatcherType type;
bool operator==(const ClusterWeight& other) const { int64_t range_start;
return (name == other.name && weight == other.weight); int64_t range_end;
} std::string string_matcher;
std::unique_ptr<RE2> regex_match;
bool present_match;
// invert_match field may or may not exisit, so initialize it to
// false.
bool invert_match = false;
HeaderMatcher() = default;
HeaderMatcher(const HeaderMatcher& other);
HeaderMatcher& operator=(const HeaderMatcher& other);
bool operator==(const HeaderMatcher& other) const;
std::string ToString() const; std::string ToString() const;
}; };
std::vector<ClusterWeight> weighted_clusters;
bool operator==(const RdsRoute& other) const { PathMatcher path_matcher;
return (matchers == other.matchers && std::vector<HeaderMatcher> header_matchers;
cluster_name == other.cluster_name && absl::optional<uint32_t> fraction_per_million;
weighted_clusters == other.weighted_clusters);
bool operator==(const Matchers& other) const {
return (path_matcher == other.path_matcher &&
header_matchers == other.header_matchers &&
fraction_per_million == other.fraction_per_million);
} }
std::string ToString() const; std::string ToString() const;
}; };
std::vector<RdsRoute> routes; Matchers matchers;
// Action for this route.
// TODO(roth): When we can use absl::variant<>, consider using that
// here, to enforce the fact that only one of the two fields can be set.
std::string cluster_name;
struct ClusterWeight {
std::string name;
uint32_t weight;
bool operator==(const ClusterWeight& other) const {
return (name == other.name && weight == other.weight);
}
std::string ToString() const;
};
std::vector<ClusterWeight> weighted_clusters;
bool operator==(const Route& other) const {
return (matchers == other.matchers &&
cluster_name == other.cluster_name &&
weighted_clusters == other.weighted_clusters);
}
std::string ToString() const;
};
struct RdsUpdate {
struct VirtualHost {
std::vector<std::string> domains;
std::vector<Route> routes;
bool operator==(const VirtualHost& other) const {
return domains == other.domains && routes == other.routes;
}
};
std::vector<VirtualHost> virtual_hosts;
bool operator==(const RdsUpdate& other) const { bool operator==(const RdsUpdate& other) const {
return routes == other.routes; return virtual_hosts == other.virtual_hosts;
} }
std::string ToString() const; std::string ToString() const;
const VirtualHost* FindVirtualHostForDomain(
const std::string& domain) const;
}; };
// TODO(roth): When we can use absl::variant<>, consider using that // TODO(roth): When we can use absl::variant<>, consider using that
@ -145,8 +156,8 @@ class XdsApi {
struct LdsUpdate { struct LdsUpdate {
// The name to use in the RDS request. // The name to use in the RDS request.
std::string route_config_name; std::string route_config_name;
// The name to use in the CDS request. Present if the LDS response has it // The RouteConfiguration to use for this listener.
// inlined. // Present only if it is inlined in the LDS response.
absl::optional<RdsUpdate> rds_update; absl::optional<RdsUpdate> rds_update;
bool operator==(const LdsUpdate& other) const { bool operator==(const LdsUpdate& other) const {

@ -448,7 +448,7 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) {
absl::InlinedVector<grpc_arg, 3> args_to_add; absl::InlinedVector<grpc_arg, 3> args_to_add;
// Keepalive interval. // Keepalive interval.
args_to_add.emplace_back(grpc_channel_arg_integer_create( args_to_add.emplace_back(grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5000)); const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5 * 60 * GPR_MS_PER_SEC));
// A channel arg indicating that the target is an xds server. // A channel arg indicating that the target is an xds server.
// TODO(roth): Once we figure out our fallback and credentials story, decide // TODO(roth): Once we figure out our fallback and credentials story, decide
// whether this is actually needed. Note that it's currently used by the // whether this is actually needed. Note that it's currently used by the
@ -787,7 +787,7 @@ void XdsClient::ChannelState::AdsCallState::Orphan() {
// on_status_received_ will complete the cancellation and clean up. Otherwise, // on_status_received_ will complete the cancellation and clean up. Otherwise,
// we are here because xds_client has to orphan a failed call, then the // we are here because xds_client has to orphan a failed call, then the
// following cancellation will be a no-op. // following cancellation will be a no-op.
grpc_call_cancel(call_, nullptr); grpc_call_cancel_internal(call_);
state_map_.clear(); state_map_.clear();
// Note that the initial ref is hold by on_status_received_. So the // Note that the initial ref is hold by on_status_received_. So the
// corresponding unref happens in on_status_received_ instead of here. // corresponding unref happens in on_status_received_ instead of here.
@ -892,13 +892,8 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
? lds_update->route_config_name.c_str() ? lds_update->route_config_name.c_str()
: "<inlined>")); : "<inlined>"));
if (lds_update->rds_update.has_value()) { if (lds_update->rds_update.has_value()) {
gpr_log(GPR_INFO, "RouteConfiguration contains %" PRIuPTR " routes", gpr_log(GPR_INFO, "RouteConfiguration: %s",
lds_update->rds_update.value().routes.size()); lds_update->rds_update->ToString().c_str());
for (size_t i = 0; i < lds_update->rds_update.value().routes.size();
++i) {
gpr_log(GPR_INFO, "Route %" PRIuPTR ":\n%s", i,
lds_update->rds_update.value().routes[i].ToString().c_str());
}
} }
} }
auto& lds_state = state_map_[XdsApi::kLdsTypeUrl]; auto& lds_state = state_map_[XdsApi::kLdsTypeUrl];
@ -924,8 +919,16 @@ void XdsClient::ChannelState::AdsCallState::AcceptLdsUpdate(
if (xds_client()->lds_result_->rds_update.has_value()) { if (xds_client()->lds_result_->rds_update.has_value()) {
// If the RouteConfiguration was found inlined in LDS response, notify // If the RouteConfiguration was found inlined in LDS response, notify
// the watcher immediately. // the watcher immediately.
xds_client()->listener_watcher_->OnListenerChanged( const XdsApi::RdsUpdate::VirtualHost* vhost =
*xds_client()->lds_result_); xds_client()->lds_result_->rds_update->FindVirtualHostForDomain(
xds_client()->server_name_);
if (vhost == nullptr) {
xds_client()->listener_watcher_->OnError(
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"no VirtualHost found for domain"));
} else {
xds_client()->listener_watcher_->OnListenerChanged(vhost->routes);
}
} else { } else {
// Send RDS request for dynamic resolution. // Send RDS request for dynamic resolution.
Subscribe(XdsApi::kRdsTypeUrl, Subscribe(XdsApi::kRdsTypeUrl,
@ -944,14 +947,8 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
return; return;
} }
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
gpr_log(GPR_INFO, gpr_log(GPR_INFO, "[xds_client %p] RDS update received:\n%s", xds_client(),
"[xds_client %p] RDS update received; RouteConfiguration contains " rds_update->ToString().c_str());
"%" PRIuPTR " routes",
this, rds_update.value().routes.size());
for (size_t i = 0; i < rds_update.value().routes.size(); ++i) {
gpr_log(GPR_INFO, "Route %" PRIuPTR ":\n%s", i,
rds_update.value().routes[i].ToString().c_str());
}
} }
auto& rds_state = state_map_[XdsApi::kRdsTypeUrl]; auto& rds_state = state_map_[XdsApi::kRdsTypeUrl];
auto& state = auto& state =
@ -969,9 +966,16 @@ void XdsClient::ChannelState::AdsCallState::AcceptRdsUpdate(
} }
xds_client()->rds_result_ = std::move(rds_update); xds_client()->rds_result_ = std::move(rds_update);
// Notify the watcher. // Notify the watcher.
XdsApi::LdsUpdate lds_result = *xds_client()->lds_result_; const XdsApi::RdsUpdate::VirtualHost* vhost =
lds_result.rds_update = xds_client()->rds_result_; xds_client()->rds_result_->FindVirtualHostForDomain(
xds_client()->listener_watcher_->OnListenerChanged(lds_result); xds_client()->server_name_);
if (vhost == nullptr) {
xds_client()->listener_watcher_->OnError(
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"no VirtualHost found for domain"));
} else {
xds_client()->listener_watcher_->OnListenerChanged(vhost->routes);
}
} }
void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate( void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
@ -1553,7 +1557,7 @@ void XdsClient::ChannelState::LrsCallState::Orphan() {
// on_status_received_ will complete the cancellation and clean up. Otherwise, // on_status_received_ will complete the cancellation and clean up. Otherwise,
// we are here because xds_client has to orphan a failed call, then the // we are here because xds_client has to orphan a failed call, then the
// following cancellation will be a no-op. // following cancellation will be a no-op.
grpc_call_cancel(call_, nullptr); grpc_call_cancel_internal(call_);
// Note that the initial ref is hold by on_status_received_. So the // Note that the initial ref is hold by on_status_received_. So the
// corresponding unref happens in on_status_received_ instead of here. // corresponding unref happens in on_status_received_ instead of here.
} }

@ -45,7 +45,7 @@ class XdsClient : public InternallyRefCounted<XdsClient> {
public: public:
virtual ~ListenerWatcherInterface() = default; virtual ~ListenerWatcherInterface() = default;
virtual void OnListenerChanged(XdsApi::LdsUpdate listener_data) = 0; virtual void OnListenerChanged(std::vector<XdsApi::Route> routes) = 0;
virtual void OnError(grpc_error* error) = 0; virtual void OnError(grpc_error* error) = 0;

@ -0,0 +1,42 @@
// Copyright 2020 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_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPR_BUILDER_FACTORY_H
#define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPR_BUILDER_FACTORY_H
#include <grpc/support/port_platform.h>
#include <memory>
#include "src/core/lib/security/authorization/mock_cel/flat_expr_builder.h"
namespace grpc_core {
namespace mock_cel {
// This is a temporary stub implementation of CEL APIs.
// Once gRPC imports the CEL library, this file will be removed.
struct InterpreterOptions {
bool short_circuiting = true;
};
std::unique_ptr<CelExpressionBuilder> CreateCelExpressionBuilder(
const InterpreterOptions& options) {
return absl::make_unique<FlatExprBuilder>();
}
} // namespace mock_cel
} // namespace grpc_core
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPR_BUILDER_FACTORY_H

@ -0,0 +1,68 @@
// Copyright 2020 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_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPRESSION_H
#define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPRESSION_H
#include <grpc/support/port_platform.h>
#include <memory>
#include <vector>
#include "google/api/expr/v1alpha1/syntax.upb.h"
#include "src/core/lib/security/authorization/mock_cel/activation.h"
#include "src/core/lib/security/authorization/mock_cel/cel_value.h"
#include "src/core/lib/security/authorization/mock_cel/statusor.h"
namespace grpc_core {
namespace mock_cel {
// This is a temporary stub implementation of CEL APIs.
// Once gRPC imports the CEL library, this file will be removed.
// Base interface for expression evaluating objects.
class CelExpression {
public:
virtual ~CelExpression() = default;
// Evaluates expression and returns value.
// activation contains bindings from parameter names to values
virtual StatusOr<CelValue> Evaluate(
const BaseActivation& activation) const = 0;
};
// Base class for Expression Builder implementations
// Provides user with factory to register extension functions.
// ExpressionBuilder MUST NOT be destroyed before CelExpression objects
// it built.
class CelExpressionBuilder {
public:
virtual ~CelExpressionBuilder() = default;
// Creates CelExpression object from AST tree.
// expr specifies root of AST tree
virtual StatusOr<std::unique_ptr<CelExpression>> CreateExpression(
const google_api_expr_v1alpha1_Expr* expr,
const google_api_expr_v1alpha1_SourceInfo* source_info) const = 0;
virtual StatusOr<std::unique_ptr<CelExpression>> CreateExpression(
const google_api_expr_v1alpha1_Expr* expr,
const google_api_expr_v1alpha1_SourceInfo* source_info,
std::vector<absl::Status>* warnings) const = 0;
};
} // namespace mock_cel
} // namespace grpc_core
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_EXPRESSION_H

@ -0,0 +1,67 @@
// Copyright 2020 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_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_EVALUATOR_CORE_H
#define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_EVALUATOR_CORE_H
#include <grpc/support/port_platform.h>
#include <memory>
#include <set>
#include <vector>
#include "google/api/expr/v1alpha1/syntax.upb.h"
#include "src/core/lib/security/authorization/mock_cel/activation.h"
#include "src/core/lib/security/authorization/mock_cel/cel_expression.h"
#include "src/core/lib/security/authorization/mock_cel/cel_value.h"
#include "src/core/lib/security/authorization/mock_cel/statusor.h"
namespace grpc_core {
namespace mock_cel {
// This is a temporary stub implementation of CEL APIs.
// Once gRPC imports the CEL library, this file will be removed.
class ExpressionStep {
public:
virtual ~ExpressionStep() = default;
};
using ExecutionPath = std::vector<std::unique_ptr<const ExpressionStep>>;
// Implementation of the CelExpression that utilizes flattening
// of the expression tree.
class CelExpressionFlatImpl : public CelExpression {
// Constructs CelExpressionFlatImpl instance.
// path is flat execution path that is based upon
// flattened AST tree. Max iterations dictates the maximum number of
// iterations in the comprehension expressions (use 0 to disable the upper
// bound).
public:
CelExpressionFlatImpl(const google_api_expr_v1alpha1_Expr* root_expr,
ExecutionPath path, int max_iterations,
std::set<std::string> iter_variable_names,
bool enable_unknowns = false,
bool enable_unknown_function_results = false) {}
// Implementation of CelExpression evaluate method.
StatusOr<CelValue> Evaluate(const BaseActivation& activation) const override {
return CelValue::CreateNull();
}
};
} // namespace mock_cel
} // namespace grpc_core
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_EVALUATOR_CORE_H

@ -0,0 +1,56 @@
// Copyright 2020 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_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_FLAT_EXPR_BUILDER_H
#define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_FLAT_EXPR_BUILDER_H
#include <grpc/support/port_platform.h>
#include <memory>
#include "src/core/lib/security/authorization/mock_cel/evaluator_core.h"
namespace grpc_core {
namespace mock_cel {
// This is a temporary stub implementation of CEL APIs.
// Once gRPC imports the CEL library, this file will be removed.
// CelExpressionBuilder implementation.
// Builds instances of CelExpressionFlatImpl.
class FlatExprBuilder : public CelExpressionBuilder {
public:
FlatExprBuilder() = default;
cel_base::StatusOr<std::unique_ptr<CelExpression>> CreateExpression(
const google::api::expr::v1alpha1::Expr* expr,
const google::api::expr::v1alpha1::SourceInfo* source_info)
const override {
ExecutionPath path;
return absl::make_unique<CelExpressionFlatImpl>(nullptr, path, 0);
}
cel_base::StatusOr<std::unique_ptr<CelExpression>> CreateExpression(
const google::api::expr::v1alpha1::Expr* expr,
const google::api::expr::v1alpha1::SourceInfo* source_info,
std::vector<absl::Status>* warnings) const override {
ExecutionPath path;
return absl::make_unique<CelExpressionFlatImpl>(nullptr, path, 0);
}
};
} // namespace mock_cel
} // namespace grpc_core
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_FLAT_EXPR_BUILDER_H

@ -0,0 +1,50 @@
// Copyright 2020 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_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_STATUSOR_H
#define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_STATUSOR_H
#include <grpc/support/port_platform.h>
#include <memory>
#include "absl/status/status.h"
namespace grpc_core {
namespace mock_cel {
// This is a temporary stub implementation of CEL APIs.
// Once gRPC imports the CEL library, this file will be removed.
template <typename T>
class ABSL_MUST_USE_RESULT StatusOr;
template <typename T>
class StatusOr {
public:
StatusOr() = default;
StatusOr(const T& value) {}
StatusOr(const absl::Status& status) {}
StatusOr(absl::Status&& status) {}
bool ok() const { return true; }
};
} // namespace mock_cel
} // namespace grpc_core
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_STATUSOR_H

@ -0,0 +1,59 @@
//
//
// Copyright 2020 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_LIB_SECURITY_CERTIFICATE_PROVIDER_H
#define GRPC_CORE_LIB_SECURITY_CERTIFICATE_PROVIDER_H
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/pollset_set.h"
// TODO(yashkt): After https://github.com/grpc/grpc/pull/23572, remove this
// forward declaration and include the header for the distributor instead.
struct grpc_tls_certificate_distributor;
// Interface for a grpc_tls_certificate_provider that handles the process to
// fetch credentials and validation contexts. Implementations are free to rely
// on local or remote sources to fetch the latest secrets, and free to share any
// state among different instances as they deem fit.
//
// On creation, grpc_tls_certificate_provider creates a
// grpc_tls_certificate_distributor object. When the credentials and validation
// contexts become valid or changed, a grpc_tls_certificate_provider should
// notify its distributor so as to propagate the update to the watchers.
struct grpc_tls_certificate_provider
: public RefCounted<grpc_tls_certificate_provider> {
public:
grpc_tls_certificate_provider()
: interested_parties_(grpc_pollset_set_create()) {}
virtual ~grpc_tls_certificate_provider() {
grpc_pollset_set_destroy(interested_parties_);
}
grpc_pollset_set* interested_parties() const { return interested_parties_; }
virtual RefCountedPtr<grpc_tls_certificate_distributor> distributor()
const = 0;
private:
grpc_pollset_set* interested_parties_;
};
#endif // GRPC_CORE_LIB_SECURITY_CERTIFICATE_PROVIDER_H

@ -23,6 +23,6 @@
#include <grpc/grpc.h> #include <grpc/grpc.h>
const char* grpc_version_string(void) { return "11.0.0"; } const char* grpc_version_string(void) { return "12.0.0"; }
const char* grpc_g_stands_for(void) { return "giggle"; } const char* grpc_g_stands_for(void) { return "geeky"; }

@ -22,5 +22,5 @@
#include <grpcpp/grpcpp.h> #include <grpcpp/grpcpp.h>
namespace grpc { namespace grpc {
std::string Version() { return "1.32.0-dev"; } std::string Version() { return "1.33.0-dev"; }
} // namespace grpc } // namespace grpc

@ -283,10 +283,6 @@ class ShutdownCallback : public grpc_experimental_completion_queue_functor {
}; };
} // namespace } // namespace
} // namespace grpc
namespace grpc_impl {
/// Use private inheritance rather than composition only to establish order /// Use private inheritance rather than composition only to establish order
/// of construction, since the public base class should be constructed after the /// of construction, since the public base class should be constructed after the
/// elements belonging to the private base class are constructed. This is not /// elements belonging to the private base class are constructed. This is not
@ -1358,4 +1354,4 @@ grpc::CompletionQueue* Server::CallbackCQ() {
return callback_cq_; return callback_cq_;
} }
} // namespace grpc_impl } // namespace grpc

@ -33,11 +33,11 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Current <c>AssemblyFileVersion</c> of gRPC C# assemblies /// Current <c>AssemblyFileVersion</c> of gRPC C# assemblies
/// </summary> /// </summary>
public const string CurrentAssemblyFileVersion = "2.32.0.0"; public const string CurrentAssemblyFileVersion = "2.33.0.0";
/// <summary> /// <summary>
/// Current version of gRPC C# /// Current version of gRPC C#
/// </summary> /// </summary>
public const string CurrentVersion = "2.32.0-dev"; public const string CurrentVersion = "2.33.0-dev";
} }
} }

@ -27,10 +27,40 @@ namespace Math {
{ {
static readonly string __ServiceName = "math.Math"; static readonly string __ServiceName = "math.Math";
static readonly grpc::Marshaller<global::Math.DivArgs> __Marshaller_math_DivArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.DivArgs.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Math.DivReply> __Marshaller_math_DivReply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.DivReply.Parser.ParseFrom); {
static readonly grpc::Marshaller<global::Math.FibArgs> __Marshaller_math_FibArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.FibArgs.Parser.ParseFrom); #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
static readonly grpc::Marshaller<global::Math.Num> __Marshaller_math_Num = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Math.Num.Parser.ParseFrom); if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Math.DivArgs> __Marshaller_math_DivArgs = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Math.DivArgs.Parser));
static readonly grpc::Marshaller<global::Math.DivReply> __Marshaller_math_DivReply = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Math.DivReply.Parser));
static readonly grpc::Marshaller<global::Math.FibArgs> __Marshaller_math_FibArgs = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Math.FibArgs.Parser));
static readonly grpc::Marshaller<global::Math.Num> __Marshaller_math_Num = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Math.Num.Parser));
static readonly grpc::Method<global::Math.DivArgs, global::Math.DivReply> __Method_Div = new grpc::Method<global::Math.DivArgs, global::Math.DivReply>( static readonly grpc::Method<global::Math.DivArgs, global::Math.DivReply> __Method_Div = new grpc::Method<global::Math.DivArgs, global::Math.DivReply>(
grpc::MethodType.Unary, grpc::MethodType.Unary,

@ -30,8 +30,38 @@ namespace Grpc.Health.V1 {
{ {
static readonly string __ServiceName = "grpc.health.v1.Health"; static readonly string __ServiceName = "grpc.health.v1.Health";
static readonly grpc::Marshaller<global::Grpc.Health.V1.HealthCheckRequest> __Marshaller_grpc_health_v1_HealthCheckRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1.HealthCheckRequest.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Health.V1.HealthCheckResponse> __Marshaller_grpc_health_v1_HealthCheckResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1.HealthCheckResponse.Parser.ParseFrom); {
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Health.V1.HealthCheckRequest> __Marshaller_grpc_health_v1_HealthCheckRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Health.V1.HealthCheckRequest.Parser));
static readonly grpc::Marshaller<global::Grpc.Health.V1.HealthCheckResponse> __Marshaller_grpc_health_v1_HealthCheckResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Health.V1.HealthCheckResponse.Parser));
static readonly grpc::Method<global::Grpc.Health.V1.HealthCheckRequest, global::Grpc.Health.V1.HealthCheckResponse> __Method_Check = new grpc::Method<global::Grpc.Health.V1.HealthCheckRequest, global::Grpc.Health.V1.HealthCheckResponse>( static readonly grpc::Method<global::Grpc.Health.V1.HealthCheckRequest, global::Grpc.Health.V1.HealthCheckResponse> __Method_Check = new grpc::Method<global::Grpc.Health.V1.HealthCheckRequest, global::Grpc.Health.V1.HealthCheckResponse>(
grpc::MethodType.Unary, grpc::MethodType.Unary,

@ -29,8 +29,38 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.BenchmarkService"; static readonly string __ServiceName = "grpc.testing.BenchmarkService";
static readonly grpc::Marshaller<global::Grpc.Testing.SimpleRequest> __Marshaller_grpc_testing_SimpleRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.SimpleRequest.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Testing.SimpleResponse> __Marshaller_grpc_testing_SimpleResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.SimpleResponse.Parser.ParseFrom); {
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.SimpleRequest> __Marshaller_grpc_testing_SimpleRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.SimpleRequest.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.SimpleResponse> __Marshaller_grpc_testing_SimpleResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.SimpleResponse.Parser));
static readonly grpc::Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> __Method_UnaryCall = new grpc::Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse>( static readonly grpc::Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> __Method_UnaryCall = new grpc::Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse>(
grpc::MethodType.Unary, grpc::MethodType.Unary,

@ -33,9 +33,39 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.MetricsService"; static readonly string __ServiceName = "grpc.testing.MetricsService";
static readonly grpc::Marshaller<global::Grpc.Testing.EmptyMessage> __Marshaller_grpc_testing_EmptyMessage = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.EmptyMessage.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Testing.GaugeResponse> __Marshaller_grpc_testing_GaugeResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.GaugeResponse.Parser.ParseFrom); {
static readonly grpc::Marshaller<global::Grpc.Testing.GaugeRequest> __Marshaller_grpc_testing_GaugeRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.GaugeRequest.Parser.ParseFrom); #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.EmptyMessage> __Marshaller_grpc_testing_EmptyMessage = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.EmptyMessage.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.GaugeResponse> __Marshaller_grpc_testing_GaugeResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.GaugeResponse.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.GaugeRequest> __Marshaller_grpc_testing_GaugeRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.GaugeRequest.Parser));
static readonly grpc::Method<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse> __Method_GetAllGauges = new grpc::Method<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse>( static readonly grpc::Method<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse> __Method_GetAllGauges = new grpc::Method<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse>(
grpc::MethodType.ServerStreaming, grpc::MethodType.ServerStreaming,

@ -29,8 +29,38 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.ReportQpsScenarioService"; static readonly string __ServiceName = "grpc.testing.ReportQpsScenarioService";
static readonly grpc::Marshaller<global::Grpc.Testing.ScenarioResult> __Marshaller_grpc_testing_ScenarioResult = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ScenarioResult.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Testing.Void> __Marshaller_grpc_testing_Void = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Void.Parser.ParseFrom); {
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.ScenarioResult> __Marshaller_grpc_testing_ScenarioResult = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ScenarioResult.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.Void> __Marshaller_grpc_testing_Void = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.Void.Parser));
static readonly grpc::Method<global::Grpc.Testing.ScenarioResult, global::Grpc.Testing.Void> __Method_ReportScenario = new grpc::Method<global::Grpc.Testing.ScenarioResult, global::Grpc.Testing.Void>( static readonly grpc::Method<global::Grpc.Testing.ScenarioResult, global::Grpc.Testing.Void> __Method_ReportScenario = new grpc::Method<global::Grpc.Testing.ScenarioResult, global::Grpc.Testing.Void>(
grpc::MethodType.Unary, grpc::MethodType.Unary,

@ -34,13 +34,43 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.TestService"; static readonly string __ServiceName = "grpc.testing.TestService";
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Empty.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Testing.SimpleRequest> __Marshaller_grpc_testing_SimpleRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.SimpleRequest.Parser.ParseFrom); {
static readonly grpc::Marshaller<global::Grpc.Testing.SimpleResponse> __Marshaller_grpc_testing_SimpleResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.SimpleResponse.Parser.ParseFrom); #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
static readonly grpc::Marshaller<global::Grpc.Testing.StreamingOutputCallRequest> __Marshaller_grpc_testing_StreamingOutputCallRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.StreamingOutputCallRequest.Parser.ParseFrom); if (message is global::Google.Protobuf.IBufferMessage)
static readonly grpc::Marshaller<global::Grpc.Testing.StreamingOutputCallResponse> __Marshaller_grpc_testing_StreamingOutputCallResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.StreamingOutputCallResponse.Parser.ParseFrom); {
static readonly grpc::Marshaller<global::Grpc.Testing.StreamingInputCallRequest> __Marshaller_grpc_testing_StreamingInputCallRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.StreamingInputCallRequest.Parser.ParseFrom); context.SetPayloadLength(message.CalculateSize());
static readonly grpc::Marshaller<global::Grpc.Testing.StreamingInputCallResponse> __Marshaller_grpc_testing_StreamingInputCallResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.StreamingInputCallResponse.Parser.ParseFrom); global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.Empty.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.SimpleRequest> __Marshaller_grpc_testing_SimpleRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.SimpleRequest.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.SimpleResponse> __Marshaller_grpc_testing_SimpleResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.SimpleResponse.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.StreamingOutputCallRequest> __Marshaller_grpc_testing_StreamingOutputCallRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.StreamingOutputCallRequest.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.StreamingOutputCallResponse> __Marshaller_grpc_testing_StreamingOutputCallResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.StreamingOutputCallResponse.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.StreamingInputCallRequest> __Marshaller_grpc_testing_StreamingInputCallRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.StreamingInputCallRequest.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.StreamingInputCallResponse> __Marshaller_grpc_testing_StreamingInputCallResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.StreamingInputCallResponse.Parser));
static readonly grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty> __Method_EmptyCall = new grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>( static readonly grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty> __Method_EmptyCall = new grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>(
grpc::MethodType.Unary, grpc::MethodType.Unary,
@ -565,7 +595,37 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.UnimplementedService"; static readonly string __ServiceName = "grpc.testing.UnimplementedService";
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Empty.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.Empty.Parser));
static readonly grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty> __Method_UnimplementedCall = new grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>( static readonly grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty> __Method_UnimplementedCall = new grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>(
grpc::MethodType.Unary, grpc::MethodType.Unary,
@ -696,9 +756,39 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.ReconnectService"; static readonly string __ServiceName = "grpc.testing.ReconnectService";
static readonly grpc::Marshaller<global::Grpc.Testing.ReconnectParams> __Marshaller_grpc_testing_ReconnectParams = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ReconnectParams.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Empty.Parser.ParseFrom); {
static readonly grpc::Marshaller<global::Grpc.Testing.ReconnectInfo> __Marshaller_grpc_testing_ReconnectInfo = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ReconnectInfo.Parser.ParseFrom); #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.ReconnectParams> __Marshaller_grpc_testing_ReconnectParams = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ReconnectParams.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.Empty.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.ReconnectInfo> __Marshaller_grpc_testing_ReconnectInfo = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ReconnectInfo.Parser));
static readonly grpc::Method<global::Grpc.Testing.ReconnectParams, global::Grpc.Testing.Empty> __Method_Start = new grpc::Method<global::Grpc.Testing.ReconnectParams, global::Grpc.Testing.Empty>( static readonly grpc::Method<global::Grpc.Testing.ReconnectParams, global::Grpc.Testing.Empty> __Method_Start = new grpc::Method<global::Grpc.Testing.ReconnectParams, global::Grpc.Testing.Empty>(
grpc::MethodType.Unary, grpc::MethodType.Unary,
@ -825,8 +915,38 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.LoadBalancerStatsService"; static readonly string __ServiceName = "grpc.testing.LoadBalancerStatsService";
static readonly grpc::Marshaller<global::Grpc.Testing.LoadBalancerStatsRequest> __Marshaller_grpc_testing_LoadBalancerStatsRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.LoadBalancerStatsRequest.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Testing.LoadBalancerStatsResponse> __Marshaller_grpc_testing_LoadBalancerStatsResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.LoadBalancerStatsResponse.Parser.ParseFrom); {
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.LoadBalancerStatsRequest> __Marshaller_grpc_testing_LoadBalancerStatsRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.LoadBalancerStatsRequest.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.LoadBalancerStatsResponse> __Marshaller_grpc_testing_LoadBalancerStatsResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.LoadBalancerStatsResponse.Parser));
static readonly grpc::Method<global::Grpc.Testing.LoadBalancerStatsRequest, global::Grpc.Testing.LoadBalancerStatsResponse> __Method_GetClientStats = new grpc::Method<global::Grpc.Testing.LoadBalancerStatsRequest, global::Grpc.Testing.LoadBalancerStatsResponse>( static readonly grpc::Method<global::Grpc.Testing.LoadBalancerStatsRequest, global::Grpc.Testing.LoadBalancerStatsResponse> __Method_GetClientStats = new grpc::Method<global::Grpc.Testing.LoadBalancerStatsRequest, global::Grpc.Testing.LoadBalancerStatsResponse>(
grpc::MethodType.Unary, grpc::MethodType.Unary,
@ -957,7 +1077,37 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.XdsUpdateHealthService"; static readonly string __ServiceName = "grpc.testing.XdsUpdateHealthService";
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Empty.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.Empty.Parser));
static readonly grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty> __Method_SetServing = new grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>( static readonly grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty> __Method_SetServing = new grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>(
grpc::MethodType.Unary, grpc::MethodType.Unary,

@ -29,13 +29,43 @@ namespace Grpc.Testing {
{ {
static readonly string __ServiceName = "grpc.testing.WorkerService"; static readonly string __ServiceName = "grpc.testing.WorkerService";
static readonly grpc::Marshaller<global::Grpc.Testing.ServerArgs> __Marshaller_grpc_testing_ServerArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ServerArgs.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Testing.ServerStatus> __Marshaller_grpc_testing_ServerStatus = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ServerStatus.Parser.ParseFrom); {
static readonly grpc::Marshaller<global::Grpc.Testing.ClientArgs> __Marshaller_grpc_testing_ClientArgs = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ClientArgs.Parser.ParseFrom); #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
static readonly grpc::Marshaller<global::Grpc.Testing.ClientStatus> __Marshaller_grpc_testing_ClientStatus = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ClientStatus.Parser.ParseFrom); if (message is global::Google.Protobuf.IBufferMessage)
static readonly grpc::Marshaller<global::Grpc.Testing.CoreRequest> __Marshaller_grpc_testing_CoreRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.CoreRequest.Parser.ParseFrom); {
static readonly grpc::Marshaller<global::Grpc.Testing.CoreResponse> __Marshaller_grpc_testing_CoreResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.CoreResponse.Parser.ParseFrom); context.SetPayloadLength(message.CalculateSize());
static readonly grpc::Marshaller<global::Grpc.Testing.Void> __Marshaller_grpc_testing_Void = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Void.Parser.ParseFrom); global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Testing.ServerArgs> __Marshaller_grpc_testing_ServerArgs = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ServerArgs.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.ServerStatus> __Marshaller_grpc_testing_ServerStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ServerStatus.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.ClientArgs> __Marshaller_grpc_testing_ClientArgs = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ClientArgs.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.ClientStatus> __Marshaller_grpc_testing_ClientStatus = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.ClientStatus.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.CoreRequest> __Marshaller_grpc_testing_CoreRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.CoreRequest.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.CoreResponse> __Marshaller_grpc_testing_CoreResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.CoreResponse.Parser));
static readonly grpc::Marshaller<global::Grpc.Testing.Void> __Marshaller_grpc_testing_Void = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Testing.Void.Parser));
static readonly grpc::Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> __Method_RunServer = new grpc::Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus>( static readonly grpc::Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> __Method_RunServer = new grpc::Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus>(
grpc::MethodType.DuplexStreaming, grpc::MethodType.DuplexStreaming,

@ -29,8 +29,38 @@ namespace Grpc.Reflection.V1Alpha {
{ {
static readonly string __ServiceName = "grpc.reflection.v1alpha.ServerReflection"; static readonly string __ServiceName = "grpc.reflection.v1alpha.ServerReflection";
static readonly grpc::Marshaller<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest> __Marshaller_grpc_reflection_v1alpha_ServerReflectionRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Reflection.V1Alpha.ServerReflectionRequest.Parser.ParseFrom); static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
static readonly grpc::Marshaller<global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> __Marshaller_grpc_reflection_v1alpha_ServerReflectionResponse = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Reflection.V1Alpha.ServerReflectionResponse.Parser.ParseFrom); {
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
static readonly grpc::Marshaller<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest> __Marshaller_grpc_reflection_v1alpha_ServerReflectionRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Reflection.V1Alpha.ServerReflectionRequest.Parser));
static readonly grpc::Marshaller<global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> __Marshaller_grpc_reflection_v1alpha_ServerReflectionResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse.Parser));
static readonly grpc::Method<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> __Method_ServerReflectionInfo = new grpc::Method<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse>( static readonly grpc::Method<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> __Method_ServerReflectionInfo = new grpc::Method<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse>(
grpc::MethodType.DuplexStreaming, grpc::MethodType.DuplexStreaming,

@ -1,7 +1,7 @@
<!-- This file is generated --> <!-- This file is generated -->
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<GrpcCsharpVersion>2.32.0-dev</GrpcCsharpVersion> <GrpcCsharpVersion>2.33.0-dev</GrpcCsharpVersion>
<GoogleProtobufVersion>3.13.0</GoogleProtobufVersion> <GoogleProtobufVersion>3.13.0</GoogleProtobufVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

@ -13,7 +13,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem Current package versions @rem Current package versions
set VERSION=2.32.0-dev set VERSION=2.33.0-dev
@rem Adjust the location of nuget.exe @rem Adjust the location of nuget.exe
set NUGET=C:\nuget\nuget.exe set NUGET=C:\nuget\nuget.exe

@ -42,7 +42,7 @@ Pod::Spec.new do |s|
# exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
# before them. # before them.
s.name = '!ProtoCompiler-gRPCCppPlugin' s.name = '!ProtoCompiler-gRPCCppPlugin'
v = '1.32.0-dev' v = '1.33.0-dev'
s.version = v s.version = v
s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.'
s.description = <<-DESC s.description = <<-DESC

@ -42,7 +42,7 @@ Pod::Spec.new do |s|
# exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
# before them. # before them.
s.name = '!ProtoCompiler-gRPCPlugin' s.name = '!ProtoCompiler-gRPCPlugin'
v = '1.32.0-dev' v = '1.33.0-dev'
s.version = v s.version = v
s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.'
s.description = <<-DESC s.description = <<-DESC

@ -22,4 +22,4 @@
// instead. This file can be regenerated from the template by running // instead. This file can be regenerated from the template by running
// `tools/buildgen/generate_projects.sh`. // `tools/buildgen/generate_projects.sh`.
#define GRPC_OBJC_VERSION_STRING @"1.32.0-dev" #define GRPC_OBJC_VERSION_STRING @"1.33.0-dev"

@ -22,5 +22,5 @@
// instead. This file can be regenerated from the template by running // instead. This file can be regenerated from the template by running
// `tools/buildgen/generate_projects.sh`. // `tools/buildgen/generate_projects.sh`.
#define GRPC_OBJC_VERSION_STRING @"1.32.0-dev" #define GRPC_OBJC_VERSION_STRING @"1.33.0-dev"
#define GRPC_C_VERSION_STRING @"11.0.0" #define GRPC_C_VERSION_STRING @"12.0.0"

@ -2,7 +2,7 @@
"name": "grpc/grpc-dev", "name": "grpc/grpc-dev",
"description": "gRPC library for PHP - for Development use only", "description": "gRPC library for PHP - for Development use only",
"license": "Apache-2.0", "license": "Apache-2.0",
"version": "1.32.0", "version": "1.33.0",
"require": { "require": {
"php": ">=5.5.0", "php": ">=5.5.0",
"google/protobuf": "^v3.3.0" "google/protobuf": "^v3.3.0"

@ -20,6 +20,6 @@
#ifndef VERSION_H #ifndef VERSION_H
#define VERSION_H #define VERSION_H
#define PHP_GRPC_VERSION "1.32.0dev" #define PHP_GRPC_VERSION "1.33.0dev"
#endif /* VERSION_H */ #endif /* VERSION_H */

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!!
__version__ = """1.32.0.dev0""" __version__ = """1.33.0.dev0"""

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -24,6 +24,7 @@ import six
import subprocess import subprocess
import sys import sys
import threading import threading
import datetime
import time import time
import unittest import unittest
import logging import logging
@ -37,7 +38,9 @@ INTERPRETER = sys.executable
BASE_COMMAND = [INTERPRETER, SCENARIO_FILE] BASE_COMMAND = [INTERPRETER, SCENARIO_FILE]
BASE_SIGTERM_COMMAND = BASE_COMMAND + ['--wait_for_interrupt'] BASE_SIGTERM_COMMAND = BASE_COMMAND + ['--wait_for_interrupt']
INIT_TIME = 1.0 INIT_TIME = datetime.timedelta(seconds=1)
WAIT_CHECK_INTERVAL = datetime.timedelta(milliseconds=100)
WAIT_CHECK_DEFAULT_TIMEOUT = datetime.timedelta(seconds=5)
processes = [] processes = []
process_lock = threading.Lock() process_lock = threading.Lock()
@ -57,18 +60,27 @@ def cleanup_processes():
atexit.register(cleanup_processes) atexit.register(cleanup_processes)
def _process_wait_with_timeout(process, timeout=WAIT_CHECK_DEFAULT_TIMEOUT):
"""A funciton to mimic 3.3+ only timeout argument in process.wait."""
deadline = datetime.datetime.now() + timeout
while (process.poll() is None) and (datetime.datetime.now() < deadline):
time.sleep(WAIT_CHECK_INTERVAL.total_seconds())
if process.returncode is None:
raise RuntimeError('Process failed to exit within %s' % timeout)
def interrupt_and_wait(process): def interrupt_and_wait(process):
with process_lock: with process_lock:
processes.append(process) processes.append(process)
time.sleep(INIT_TIME) time.sleep(INIT_TIME.total_seconds())
os.kill(process.pid, signal.SIGINT) os.kill(process.pid, signal.SIGINT)
process.wait() _process_wait_with_timeout(process)
def wait(process): def wait(process):
with process_lock: with process_lock:
processes.append(process) processes.append(process)
process.wait() _process_wait_with_timeout(process)
class ExitTest(unittest.TestCase): class ExitTest(unittest.TestCase):
@ -138,7 +150,6 @@ class ExitTest(unittest.TestCase):
stderr=sys.stderr) stderr=sys.stderr)
interrupt_and_wait(process) interrupt_and_wait(process)
@unittest.skipIf(six.PY2, 'https://github.com/grpc/grpc/issues/6999')
@unittest.skipIf(os.name == 'nt', @unittest.skipIf(os.name == 'nt',
'os.kill does not have required permission on Windows') 'os.kill does not have required permission on Windows')
def test_in_flight_unary_stream_call(self): def test_in_flight_unary_stream_call(self):
@ -157,7 +168,7 @@ class ExitTest(unittest.TestCase):
stderr=sys.stderr) stderr=sys.stderr)
interrupt_and_wait(process) interrupt_and_wait(process)
@unittest.skipIf(six.PY2, 'https://github.com/grpc/grpc/issues/6999') @unittest.skip('https://github.com/grpc/grpc/issues/23982')
@unittest.skipIf(os.name == 'nt', @unittest.skipIf(os.name == 'nt',
'os.kill does not have required permission on Windows') 'os.kill does not have required permission on Windows')
def test_in_flight_stream_stream_call(self): def test_in_flight_stream_stream_call(self):
@ -167,7 +178,6 @@ class ExitTest(unittest.TestCase):
stderr=sys.stderr) stderr=sys.stderr)
interrupt_and_wait(process) interrupt_and_wait(process)
@unittest.skipIf(six.PY2, 'https://github.com/grpc/grpc/issues/6999')
@unittest.skipIf(os.name == 'nt', @unittest.skipIf(os.name == 'nt',
'os.kill does not have required permission on Windows') 'os.kill does not have required permission on Windows')
def test_in_flight_partial_unary_stream_call(self): def test_in_flight_partial_unary_stream_call(self):
@ -188,7 +198,7 @@ class ExitTest(unittest.TestCase):
stderr=sys.stderr) stderr=sys.stderr)
interrupt_and_wait(process) interrupt_and_wait(process)
@unittest.skipIf(six.PY2, 'https://github.com/grpc/grpc/issues/6999') @unittest.skip('https://github.com/grpc/grpc/issues/23982')
@unittest.skipIf(os.name == 'nt', @unittest.skipIf(os.name == 'nt',
'os.kill does not have required permission on Windows') 'os.kill does not have required permission on Windows')
def test_in_flight_partial_stream_stream_call(self): def test_in_flight_partial_stream_stream_call(self):
@ -201,5 +211,5 @@ class ExitTest(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
logging.basicConfig() logging.basicConfig(level=logging.DEBUG)
unittest.main(verbosity=2) unittest.main(verbosity=2)

@ -14,5 +14,5 @@
# GRPC contains the General RPC module. # GRPC contains the General RPC module.
module GRPC module GRPC
VERSION = '1.32.0.dev' VERSION = '1.33.0.dev'
end end

@ -14,6 +14,6 @@
module GRPC module GRPC
module Tools module Tools
VERSION = '1.32.0.dev' VERSION = '1.33.0.dev'
end end
end end

@ -14,7 +14,9 @@
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "src/core/lib/security/authorization/evaluate_args.h" #include "src/core/lib/security/authorization/evaluate_args.h"
@ -45,27 +47,172 @@ class EvaluateArgsTest : public ::testing::Test {
TEST_F(EvaluateArgsTest, TestEvaluateArgsLocalAddress) { TEST_F(EvaluateArgsTest, TestEvaluateArgsLocalAddress) {
absl::string_view src_address = evaluate_args_->GetLocalAddress(); absl::string_view src_address = evaluate_args_->GetLocalAddress();
EXPECT_EQ(src_address, local_address_) EXPECT_EQ(src_address, local_address_);
<< "Error: Failed to extract correct Local address from EvaluateArgs.";
} }
TEST_F(EvaluateArgsTest, TestEvaluateArgsLocalPort) { TEST_F(EvaluateArgsTest, TestEvaluateArgsLocalPort) {
int src_port = evaluate_args_->GetLocalPort(); int src_port = evaluate_args_->GetLocalPort();
EXPECT_EQ(src_port, local_port_) EXPECT_EQ(src_port, local_port_);
<< "Error: Failed to extract correct Local port from EvaluateArgs.";
} }
TEST_F(EvaluateArgsTest, TestEvaluateArgsPeerAddress) { TEST_F(EvaluateArgsTest, TestEvaluateArgsPeerAddress) {
absl::string_view dest_address = evaluate_args_->GetPeerAddress(); absl::string_view dest_address = evaluate_args_->GetPeerAddress();
EXPECT_EQ(dest_address, peer_address_) EXPECT_EQ(dest_address, peer_address_);
<< "Error: Failed to extract correct Peer address from "
"EvaluateArgs. ";
} }
TEST_F(EvaluateArgsTest, TestEvaluateArgsPeerPort) { TEST_F(EvaluateArgsTest, TestEvaluateArgsPeerPort) {
int dest_port = evaluate_args_->GetPeerPort(); int dest_port = evaluate_args_->GetPeerPort();
EXPECT_EQ(dest_port, peer_port_) EXPECT_EQ(dest_port, peer_port_);
<< "Error: Failed to extract correct Peer port from EvaluateArgs."; }
TEST(EvaluateArgsMetadataTest, HandlesNullMetadata) {
EvaluateArgs eval_args(nullptr, nullptr, nullptr);
EXPECT_EQ(eval_args.GetPath(), nullptr);
EXPECT_EQ(eval_args.GetMethod(), nullptr);
EXPECT_EQ(eval_args.GetHost(), nullptr);
EXPECT_THAT(eval_args.GetHeaders(), ::testing::ElementsAre());
}
TEST(EvaluateArgsMetadataTest, HandlesEmptyMetadata) {
grpc_metadata_batch metadata;
grpc_metadata_batch_init(&metadata);
EvaluateArgs eval_args(&metadata, nullptr, nullptr);
EXPECT_EQ(eval_args.GetPath(), nullptr);
EXPECT_EQ(eval_args.GetMethod(), nullptr);
EXPECT_EQ(eval_args.GetHost(), nullptr);
EXPECT_THAT(eval_args.GetHeaders(), ::testing::ElementsAre());
grpc_metadata_batch_destroy(&metadata);
}
TEST(EvaluateArgsMetadataTest, GetPathSuccess) {
grpc_init();
const char* kPath = "/some/path";
grpc_metadata_batch metadata;
grpc_metadata_batch_init(&metadata);
grpc_slice fake_val = grpc_slice_intern(grpc_slice_from_static_string(kPath));
grpc_mdelem fake_val_md = grpc_mdelem_from_slices(GRPC_MDSTR_PATH, fake_val);
grpc_linked_mdelem storage;
storage.md = fake_val_md;
ASSERT_EQ(grpc_metadata_batch_link_head(&metadata, &storage),
GRPC_ERROR_NONE);
EvaluateArgs eval_args(&metadata, nullptr, nullptr);
EXPECT_EQ(eval_args.GetPath(), kPath);
grpc_metadata_batch_destroy(&metadata);
grpc_shutdown();
}
TEST(EvaluateArgsMetadataTest, GetHostSuccess) {
grpc_init();
const char* kHost = "host";
grpc_metadata_batch metadata;
grpc_metadata_batch_init(&metadata);
grpc_slice fake_val = grpc_slice_intern(grpc_slice_from_static_string(kHost));
grpc_mdelem fake_val_md = grpc_mdelem_from_slices(GRPC_MDSTR_HOST, fake_val);
grpc_linked_mdelem storage;
storage.md = fake_val_md;
ASSERT_EQ(grpc_metadata_batch_link_head(&metadata, &storage),
GRPC_ERROR_NONE);
EvaluateArgs eval_args(&metadata, nullptr, nullptr);
EXPECT_EQ(eval_args.GetHost(), kHost);
grpc_metadata_batch_destroy(&metadata);
grpc_shutdown();
}
TEST(EvaluateArgsMetadataTest, GetMethodSuccess) {
grpc_init();
const char* kMethod = "GET";
grpc_metadata_batch metadata;
grpc_metadata_batch_init(&metadata);
grpc_slice fake_val =
grpc_slice_intern(grpc_slice_from_static_string(kMethod));
grpc_mdelem fake_val_md =
grpc_mdelem_from_slices(GRPC_MDSTR_METHOD, fake_val);
grpc_linked_mdelem storage;
storage.md = fake_val_md;
ASSERT_EQ(grpc_metadata_batch_link_head(&metadata, &storage),
GRPC_ERROR_NONE);
EvaluateArgs eval_args(&metadata, nullptr, nullptr);
EXPECT_EQ(eval_args.GetMethod(), kMethod);
grpc_metadata_batch_destroy(&metadata);
grpc_shutdown();
}
TEST(EvaluateArgsMetadataTest, GetHeadersSuccess) {
grpc_init();
const char* kPath = "/some/path";
const char* kHost = "host";
grpc_metadata_batch metadata;
grpc_metadata_batch_init(&metadata);
grpc_slice fake_path =
grpc_slice_intern(grpc_slice_from_static_string(kPath));
grpc_mdelem fake_path_md =
grpc_mdelem_from_slices(GRPC_MDSTR_PATH, fake_path);
grpc_linked_mdelem storage;
storage.md = fake_path_md;
ASSERT_EQ(grpc_metadata_batch_link_head(&metadata, &storage, GRPC_BATCH_PATH),
GRPC_ERROR_NONE);
grpc_slice fake_host =
grpc_slice_intern(grpc_slice_from_static_string(kHost));
grpc_mdelem fake_host_md =
grpc_mdelem_from_slices(GRPC_MDSTR_HOST, fake_host);
grpc_linked_mdelem storage2;
storage2.md = fake_host_md;
ASSERT_EQ(
grpc_metadata_batch_link_tail(&metadata, &storage2, GRPC_BATCH_HOST),
GRPC_ERROR_NONE);
EvaluateArgs eval_args(&metadata, nullptr, nullptr);
EXPECT_THAT(
eval_args.GetHeaders(),
::testing::UnorderedElementsAre(
::testing::Pair(StringViewFromSlice(GRPC_MDSTR_HOST), kHost),
::testing::Pair(StringViewFromSlice(GRPC_MDSTR_PATH), kPath)));
grpc_metadata_batch_destroy(&metadata);
grpc_shutdown();
}
TEST(EvaluateArgsAuthContextTest, HandlesNullAuthContext) {
EvaluateArgs eval_args(nullptr, nullptr, nullptr);
EXPECT_EQ(eval_args.GetSpiffeId(), nullptr);
EXPECT_EQ(eval_args.GetCertServerName(), nullptr);
}
TEST(EvaluateArgsAuthContextTest, HandlesEmptyAuthCtx) {
grpc_auth_context auth_context(nullptr);
EvaluateArgs eval_args(nullptr, &auth_context, nullptr);
EXPECT_EQ(eval_args.GetSpiffeId(), nullptr);
EXPECT_EQ(eval_args.GetCertServerName(), nullptr);
}
TEST(EvaluateArgsAuthContextTest, GetSpiffeIdSuccessOneProperty) {
grpc_auth_context auth_context(nullptr);
const char* kId = "spiffeid";
auth_context.add_cstring_property(GRPC_PEER_SPIFFE_ID_PROPERTY_NAME, kId);
EvaluateArgs eval_args(nullptr, &auth_context, nullptr);
EXPECT_EQ(eval_args.GetSpiffeId(), kId);
}
TEST(EvaluateArgsAuthContextTest, GetSpiffeIdFailDuplicateProperty) {
grpc_auth_context auth_context(nullptr);
auth_context.add_cstring_property(GRPC_PEER_SPIFFE_ID_PROPERTY_NAME, "id1");
auth_context.add_cstring_property(GRPC_PEER_SPIFFE_ID_PROPERTY_NAME, "id2");
EvaluateArgs eval_args(nullptr, &auth_context, nullptr);
EXPECT_EQ(eval_args.GetSpiffeId(), nullptr);
}
TEST(EvaluateArgsAuthContextTest, GetCertServerNameSuccessOneProperty) {
grpc_auth_context auth_context(nullptr);
const char* kServer = "server";
auth_context.add_cstring_property(GRPC_X509_CN_PROPERTY_NAME, kServer);
EvaluateArgs eval_args(nullptr, &auth_context, nullptr);
EXPECT_EQ(eval_args.GetCertServerName(), kServer);
}
TEST(EvaluateArgsAuthContextTest, GetCertServerNameFailDuplicateProperty) {
grpc_auth_context auth_context(nullptr);
auth_context.add_cstring_property(GRPC_X509_CN_PROPERTY_NAME, "server1");
auth_context.add_cstring_property(GRPC_X509_CN_PROPERTY_NAME, "server2");
EvaluateArgs eval_args(nullptr, &auth_context, nullptr);
EXPECT_EQ(eval_args.GetCertServerName(), nullptr);
} }
} // namespace grpc_core } // namespace grpc_core

@ -2500,7 +2500,7 @@ TEST_P(LdsRdsTest, ListenerRemoved) {
AdsServiceImpl::ResponseState::ACKED); AdsServiceImpl::ResponseState::ACKED);
} }
// Tests that LDS client should send a NACK if matching domain can't be found in // Tests that LDS client ACKs but fails if matching domain can't be found in
// the LDS response. // the LDS response.
TEST_P(LdsRdsTest, NoMatchedDomain) { TEST_P(LdsRdsTest, NoMatchedDomain) {
RouteConfiguration route_config = RouteConfiguration route_config =
@ -2511,10 +2511,10 @@ TEST_P(LdsRdsTest, NoMatchedDomain) {
SetNextResolution({}); SetNextResolution({});
SetNextResolutionForLbChannelAllBalancers(); SetNextResolutionForLbChannelAllBalancers();
CheckRpcSendFailure(); CheckRpcSendFailure();
// Do a bit of polling, to allow the ACK to get to the ADS server.
channel_->WaitForConnected(grpc_timeout_milliseconds_to_deadline(100));
const auto& response_state = RouteConfigurationResponseState(0); const auto& response_state = RouteConfigurationResponseState(0);
EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::NACKED); EXPECT_EQ(response_state.state, AdsServiceImpl::ResponseState::ACKED);
EXPECT_EQ(response_state.error_message,
"No matched virtual host found in the route config.");
} }
// Tests that LDS client should choose the virtual host with matching domain if // Tests that LDS client should choose the virtual host with matching domain if
@ -2525,10 +2525,6 @@ TEST_P(LdsRdsTest, ChooseMatchedDomain) {
*(route_config.add_virtual_hosts()) = route_config.virtual_hosts(0); *(route_config.add_virtual_hosts()) = route_config.virtual_hosts(0);
route_config.mutable_virtual_hosts(0)->clear_domains(); route_config.mutable_virtual_hosts(0)->clear_domains();
route_config.mutable_virtual_hosts(0)->add_domains("unmatched_domain"); route_config.mutable_virtual_hosts(0)->add_domains("unmatched_domain");
route_config.mutable_virtual_hosts(0)
->mutable_routes(0)
->mutable_route()
->mutable_cluster_header();
SetRouteConfiguration(0, route_config); SetRouteConfiguration(0, route_config);
SetNextResolution({}); SetNextResolution({});
SetNextResolutionForLbChannelAllBalancers(); SetNextResolutionForLbChannelAllBalancers();

@ -56,6 +56,16 @@
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<!-- this project is built with a legacy C# compiler, so ref structs are not supported.
Use GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE to still allow building the protobuf
generate code -->
<DefineConstants>$(DefineConstants);GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE</DefineConstants>
<!-- Create a binding redirect to avoid mismatch between different versions of System.Memory
being referenced by Grpc.Core and Google.Protobuf.
See http://go.microsoft.com/fwlink/?LinkId=294190 -->
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Grpc.Auth"> <Reference Include="Grpc.Auth">
<HintPath>..\packages\Grpc.Auth.__GRPC_NUGET_VERSION__\lib\net45\Grpc.Auth.dll</HintPath> <HintPath>..\packages\Grpc.Auth.__GRPC_NUGET_VERSION__\lib\net45\Grpc.Auth.dll</HintPath>
@ -101,7 +111,7 @@
<HintPath>..\packages\Google.Apis.Auth.1.15.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath> <HintPath>..\packages\Google.Apis.Auth.1.15.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath>
</Reference> </Reference>
<Reference Include="Google.Protobuf"> <Reference Include="Google.Protobuf">
<HintPath>..\packages\Google.Protobuf.3.12.2\lib\net45\Google.Protobuf.dll</HintPath> <HintPath>..\packages\Google.Protobuf.3.13.0\lib\net45\Google.Protobuf.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -16,7 +16,7 @@
<PackageReference Include="Grpc" Version="__GRPC_NUGET_VERSION__" /> <PackageReference Include="Grpc" Version="__GRPC_NUGET_VERSION__" />
<PackageReference Include="Grpc.Auth" Version="__GRPC_NUGET_VERSION__" /> <PackageReference Include="Grpc.Auth" Version="__GRPC_NUGET_VERSION__" />
<PackageReference Include="Grpc.Tools" Version="__GRPC_NUGET_VERSION__" /> <PackageReference Include="Grpc.Tools" Version="__GRPC_NUGET_VERSION__" />
<PackageReference Include="Google.Protobuf" Version="3.12.2" /> <PackageReference Include="Google.Protobuf" Version="3.13.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -8,7 +8,7 @@
<package id="Grpc.Core" version="__GRPC_NUGET_VERSION__" targetFramework="net45" /> <package id="Grpc.Core" version="__GRPC_NUGET_VERSION__" targetFramework="net45" />
<package id="Grpc.Core.Api" version="__GRPC_NUGET_VERSION__" targetFramework="net45" /> <package id="Grpc.Core.Api" version="__GRPC_NUGET_VERSION__" targetFramework="net45" />
<package id="Grpc.Tools" version="__GRPC_NUGET_VERSION__" targetFramework="net45" /> <package id="Grpc.Tools" version="__GRPC_NUGET_VERSION__" targetFramework="net45" />
<package id="Google.Protobuf" version="3.12.2" targetFramework="net45" /> <package id="Google.Protobuf" version="3.13.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="System.Buffers" version="4.4.0" targetFramework="net45" /> <package id="System.Buffers" version="4.4.0" targetFramework="net45" />
<package id="System.Memory" version="4.5.3" targetFramework="net45" /> <package id="System.Memory" version="4.5.3" targetFramework="net45" />

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!!
VERSION = '1.32.0.dev0' VERSION = '1.33.0.dev0'

@ -15,8 +15,25 @@
FROM centos:7 FROM centos:7
RUN yum install -y python RUN yum install -y python
RUN yum install -y python-devel
RUN yum install -y epel-release RUN yum install -y epel-release
RUN yum install -y python-pip RUN yum install -y python-pip
RUN pip install virtualenv RUN pip install --upgrade pip
RUN yum groupinstall -y 'Development Tools' RUN pip install -U virtualenv
RUN yum install -y python-devel
# The default gcc of CentOS 7 is gcc 4.8 which is older than gcc 4.9,
# the minimum supported gcc version for gRPC Core so let's upgrade to
# the oldest one that can build gRPC on Centos 7.
RUN yum install -y centos-release-scl
RUN yum install -y devtoolset-8-binutils devtoolset-8-gcc devtoolset-8-gcc-c++
# Activate devtoolset-8 by default
# https://austindewey.com/2019/03/26/enabling-software-collections-binaries-on-a-docker-image/
RUN echo $'#!/bin/bash\n\
source scl_source enable devtoolset-8\n\
"$@"\n' > /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
RUN cat /usr/bin/entrypoint.sh
ENTRYPOINT [ "/usr/bin/entrypoint.sh" ]
CMD ["/bin/bash"]

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 1.32.0-dev PROJECT_NUMBER = 1.33.0-dev
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
@ -1023,7 +1023,6 @@ include/grpcpp/security/tls_credentials_options.h \
include/grpcpp/server.h \ include/grpcpp/server.h \
include/grpcpp/server_builder.h \ include/grpcpp/server_builder.h \
include/grpcpp/server_context.h \ include/grpcpp/server_context.h \
include/grpcpp/server_impl.h \
include/grpcpp/server_posix.h \ include/grpcpp/server_posix.h \
include/grpcpp/support/async_stream.h \ include/grpcpp/support/async_stream.h \
include/grpcpp/support/async_stream_impl.h \ include/grpcpp/support/async_stream_impl.h \

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 1.32.0-dev PROJECT_NUMBER = 1.33.0-dev
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
@ -1023,7 +1023,6 @@ include/grpcpp/security/tls_credentials_options.h \
include/grpcpp/server.h \ include/grpcpp/server.h \
include/grpcpp/server_builder.h \ include/grpcpp/server_builder.h \
include/grpcpp/server_context.h \ include/grpcpp/server_context.h \
include/grpcpp/server_impl.h \
include/grpcpp/server_posix.h \ include/grpcpp/server_posix.h \
include/grpcpp/support/async_stream.h \ include/grpcpp/support/async_stream.h \
include/grpcpp/support/async_stream_impl.h \ include/grpcpp/support/async_stream_impl.h \
@ -1714,7 +1713,13 @@ src/core/lib/security/authorization/authorization_engine.h \
src/core/lib/security/authorization/evaluate_args.cc \ src/core/lib/security/authorization/evaluate_args.cc \
src/core/lib/security/authorization/evaluate_args.h \ src/core/lib/security/authorization/evaluate_args.h \
src/core/lib/security/authorization/mock_cel/activation.h \ src/core/lib/security/authorization/mock_cel/activation.h \
src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h \
src/core/lib/security/authorization/mock_cel/cel_expression.h \
src/core/lib/security/authorization/mock_cel/cel_value.h \ src/core/lib/security/authorization/mock_cel/cel_value.h \
src/core/lib/security/authorization/mock_cel/evaluator_core.h \
src/core/lib/security/authorization/mock_cel/flat_expr_builder.h \
src/core/lib/security/authorization/mock_cel/statusor.h \
src/core/lib/security/certificate_provider.h \
src/core/lib/security/context/security_context.cc \ src/core/lib/security/context/security_context.cc \
src/core/lib/security/context/security_context.h \ src/core/lib/security/context/security_context.h \
src/core/lib/security/credentials/alts/alts_credentials.cc \ src/core/lib/security/credentials/alts/alts_credentials.cc \

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 11.0.0 PROJECT_NUMBER = 12.0.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 11.0.0 PROJECT_NUMBER = 12.0.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
@ -1542,7 +1542,13 @@ src/core/lib/security/authorization/authorization_engine.h \
src/core/lib/security/authorization/evaluate_args.cc \ src/core/lib/security/authorization/evaluate_args.cc \
src/core/lib/security/authorization/evaluate_args.h \ src/core/lib/security/authorization/evaluate_args.h \
src/core/lib/security/authorization/mock_cel/activation.h \ src/core/lib/security/authorization/mock_cel/activation.h \
src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h \
src/core/lib/security/authorization/mock_cel/cel_expression.h \
src/core/lib/security/authorization/mock_cel/cel_value.h \ src/core/lib/security/authorization/mock_cel/cel_value.h \
src/core/lib/security/authorization/mock_cel/evaluator_core.h \
src/core/lib/security/authorization/mock_cel/flat_expr_builder.h \
src/core/lib/security/authorization/mock_cel/statusor.h \
src/core/lib/security/certificate_provider.h \
src/core/lib/security/context/security_context.cc \ src/core/lib/security/context/security_context.cc \
src/core/lib/security/context/security_context.h \ src/core/lib/security/context/security_context.h \
src/core/lib/security/credentials/alts/alts_credentials.cc \ src/core/lib/security/credentials/alts/alts_credentials.cc \

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Objective-C"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 1.32.0-dev PROJECT_NUMBER = 1.33.0-dev
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Objective-C"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 1.32.0-dev PROJECT_NUMBER = 1.33.0-dev
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC PHP"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 1.32.0-dev PROJECT_NUMBER = 1.33.0-dev
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a

@ -88,7 +88,7 @@ if [ "${PREPARE_BUILD_INSTALL_DEPS_PYTHON}" == "true" ]
then then
# python # python
time pip install --user virtualenv time pip install --user virtualenv
time pip install --user --upgrade Mako six tox setuptools twisted pyyaml pyjwt cryptography requests time pip install --user --upgrade Mako six tox setuptools==44.1.1 twisted pyyaml pyjwt cryptography requests
export PYTHONPATH=/Library/Python/3.4/site-packages export PYTHONPATH=/Library/Python/3.4/site-packages
# make sure md5sum is available (requires coreutils 8.31+) # make sure md5sum is available (requires coreutils 8.31+)

@ -15,6 +15,13 @@
set -ex set -ex
# Install packages which were not preinstalled yet.
# Protobuf needs autoconf & automake to build
sudo apt-get install -y autoconf automake
# Accept the Android SDK licences.
yes | /opt/android-sdk/current/tools/bin/sdkmanager --licenses
# change to grpc repo root # change to grpc repo root
cd $(dirname $0)/../../.. cd $(dirname $0)/../../..

@ -16,7 +16,7 @@
# Location of the continuous shell script in repository. # Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/linux/grpc_xds_csharp.sh" build_file: "grpc/tools/internal_ci/linux/grpc_xds_csharp.sh"
timeout_mins: 90 timeout_mins: 120
action { action {
define_artifacts { define_artifacts {
regex: "**/*sponge_log.*" regex: "**/*sponge_log.*"

@ -16,7 +16,7 @@
# Location of the continuous shell script in repository. # Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/linux/grpc_xds.sh" build_file: "grpc/tools/internal_ci/linux/grpc_xds.sh"
timeout_mins: 90 timeout_mins: 120
env_vars { env_vars {
key: "BAZEL_SCRIPT" key: "BAZEL_SCRIPT"
value: "tools/internal_ci/linux/grpc_xds_bazel_python_test_in_docker.sh" value: "tools/internal_ci/linux/grpc_xds_bazel_python_test_in_docker.sh"

@ -24,11 +24,11 @@ export PREPARE_BUILD_INSTALL_DEPS_RUBY=true
source tools/internal_ci/helper_scripts/prepare_build_macos_rc source tools/internal_ci/helper_scripts/prepare_build_macos_rc
# install cython for all python versions # install cython for all python versions
python2.7 -m pip install -U cython setuptools wheel --user python2.7 -m pip install -U cython setuptools==44.1.1 wheel --user
python3.5 -m pip install -U cython setuptools wheel --user python3.5 -m pip install -U cython setuptools==44.1.1 wheel --user
python3.6 -m pip install -U cython setuptools wheel --user python3.6 -m pip install -U cython setuptools==44.1.1 wheel --user
python3.7 -m pip install -U cython setuptools wheel --user python3.7 -m pip install -U cython setuptools==44.1.1 wheel --user
python3.8 -m pip install -U cython setuptools wheel --user python3.8 -m pip install -U cython setuptools==44.1.1 wheel --user
# needed to build ruby artifacts # needed to build ruby artifacts
time bash tools/distrib/build_ruby_environment_macos.sh time bash tools/distrib/build_ruby_environment_macos.sh

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save