merge and resolve conflict

pull/6181/head
yang-g 9 years ago
commit 6b16aaae96
  1. 2
      .gitignore
  2. 27
      BUILD
  3. 300
      Makefile
  4. 2
      binding.gyp
  5. 340
      build.yaml
  6. 2
      config.m4
  7. 20
      examples/node/greeter_client.js
  8. 12
      examples/node/greeter_server.js
  9. 39
      examples/node/helloworld_grpc_pb.js
  10. 332
      examples/node/helloworld_pb.js
  11. 1
      examples/node/package.json
  12. 3
      gRPC.podspec
  13. 1
      grpc.def
  14. 7
      grpc.gemspec
  15. 8
      include/grpc++/impl/codegen/client_context.h
  16. 10
      include/grpc++/impl/codegen/create_auth_context.h
  17. 10
      include/grpc++/impl/codegen/server_context.h
  18. 15
      include/grpc++/security/server_credentials.h
  19. 38
      include/grpc/grpc_security.h
  20. 114
      include/grpc/grpc_security_constants.h
  21. 25
      package.json
  22. 3
      package.xml
  23. 5
      requirements.txt
  24. 21
      src/compiler/cpp_generator.cc
  25. 3
      src/compiler/cpp_generator.h
  26. 5
      src/compiler/cpp_plugin.cc
  27. 10
      src/compiler/generator_helpers.h
  28. 277
      src/compiler/node_generator.cc
  29. 49
      src/compiler/node_generator.h
  30. 50
      src/compiler/node_generator_helpers.h
  31. 77
      src/compiler/node_plugin.cc
  32. 24
      src/core/ext/client_config/client_channel.c
  33. 7
      src/core/ext/client_config/subchannel.c
  34. 6
      src/core/ext/client_config/subchannel_call_holder.c
  35. 14
      src/core/ext/resolver/dns/native/dns_resolver.c
  36. 6
      src/core/ext/resolver/zookeeper/zookeeper_resolver.c
  37. 4
      src/core/ext/transport/chttp2/client/insecure/channel_create.c
  38. 18
      src/core/ext/transport/chttp2/transport/bin_encoder.c
  39. 2
      src/core/ext/transport/chttp2/transport/hpack_parser.c
  40. 10
      src/core/lib/channel/compress_filter.c
  41. 2
      src/core/lib/http/httpcli.c
  42. 48
      src/core/lib/http/parser.c
  43. 3
      src/core/lib/http/parser.h
  44. 6
      src/core/lib/iomgr/closure.c
  45. 3
      src/core/lib/iomgr/closure.h
  46. 2
      src/core/lib/iomgr/exec_ctx.h
  47. 3
      src/core/lib/iomgr/resolve_address.h
  48. 9
      src/core/lib/iomgr/resolve_address_posix.c
  49. 9
      src/core/lib/iomgr/resolve_address_windows.c
  50. 23
      src/core/lib/iomgr/tcp_client_posix.c
  51. 15
      src/core/lib/iomgr/timer.c
  52. 3
      src/core/lib/iomgr/udp_server.c
  53. 27
      src/core/lib/security/credentials.c
  54. 34
      src/core/lib/security/security_connector.c
  55. 2
      src/core/lib/security/security_connector.h
  56. 10
      src/core/lib/support/time_posix.c
  57. 93
      src/core/lib/surface/call.c
  58. 2
      src/core/lib/surface/init.c
  59. 3
      src/core/lib/surface/lame_client.c
  60. 2
      src/core/lib/surface/validate_metadata.c
  61. 1
      src/core/lib/transport/metadata.h
  62. 54
      src/core/lib/tsi/ssl_transport_security.c
  63. 17
      src/core/lib/tsi/ssl_transport_security.h
  64. 9
      src/core/lib/tsi/transport_security_interface.h
  65. 8
      src/cpp/client/client_context.cc
  66. 8
      src/cpp/server/secure_server_credentials.cc
  67. 13
      src/cpp/server/server_context.cc
  68. 16
      src/csharp/Grpc.Core.Tests/CallOptionsTest.cs
  69. 51
      src/csharp/Grpc.Core/CallOptions.cs
  70. 3
      src/csharp/Grpc.Core/Version.cs
  71. 11
      src/csharp/Grpc.Core/VersionInfo.cs
  72. 3
      src/csharp/Grpc.IntegrationTesting.StressClient/.gitignore
  73. 60
      src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj
  74. 26
      src/csharp/Grpc.IntegrationTesting.StressClient/Program.cs
  75. 11
      src/csharp/Grpc.IntegrationTesting.StressClient/Properties/AssemblyInfo.cs
  76. 160
      src/csharp/Grpc.IntegrationTesting/Control.cs
  77. 3
      src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
  78. 452
      src/csharp/Grpc.IntegrationTesting/Metrics.cs
  79. 146
      src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs
  80. 318
      src/csharp/Grpc.IntegrationTesting/StressTestClient.cs
  81. 8
      src/csharp/Grpc.sln
  82. 9
      src/csharp/ext/grpc_csharp_ext.c
  83. 2
      src/csharp/generate_proto_csharp.sh
  84. 2
      src/node/.gitignore
  85. 1
      src/node/.jshintignore
  86. 28
      src/node/.jshintrc
  87. 13
      src/node/ext/server_credentials.cc
  88. 99
      src/node/test/math/math_grpc_pb.js
  89. 866
      src/node/test/math/math_pb.js
  90. 40
      src/node/test/math/math_server.js
  91. 37
      src/node/test/math/node_modules/grpc.js
  92. 43
      src/node/test/math_client_test.js
  93. 9
      src/php/ext/grpc/server_credentials.c
  94. 10
      src/proto/grpc/testing/control.proto
  95. 1
      src/python/.gitignore
  96. 34
      src/python/grpcio/commands.py
  97. 4
      src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
  98. 7
      src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
  99. 2
      src/python/grpcio/grpc/_cython/imports.generated.c
  100. 3
      src/python/grpcio/grpc/_cython/imports.generated.h
  101. Some files were not shown because too many files have changed in this diff Show More

2
.gitignore vendored

@ -14,7 +14,7 @@ dist/
*.egg *.egg
# Node installation output # Node installation output
node_modules/ ^node_modules
src/node/extension_binary/ src/node/extension_binary/
# gcov coverage data # gcov coverage data

27
BUILD

@ -291,6 +291,7 @@ cc_library(
"src/core/ext/census/grpc_filter.h", "src/core/ext/census/grpc_filter.h",
"src/core/ext/census/mlog.h", "src/core/ext/census/mlog.h",
"src/core/ext/census/rpc_metric_id.h", "src/core/ext/census/rpc_metric_id.h",
"src/core/lib/surface/init.c",
"src/core/lib/channel/channel_args.c", "src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_stack.c", "src/core/lib/channel/channel_stack.c",
"src/core/lib/channel/channel_stack_builder.c", "src/core/lib/channel/channel_stack_builder.c",
@ -360,7 +361,6 @@ cc_library(
"src/core/lib/surface/channel_stack_type.c", "src/core/lib/surface/channel_stack_type.c",
"src/core/lib/surface/completion_queue.c", "src/core/lib/surface/completion_queue.c",
"src/core/lib/surface/event_string.c", "src/core/lib/surface/event_string.c",
"src/core/lib/surface/init.c",
"src/core/lib/surface/lame_client.c", "src/core/lib/surface/lame_client.c",
"src/core/lib/surface/metadata_array.c", "src/core/lib/surface/metadata_array.c",
"src/core/lib/surface/server.c", "src/core/lib/surface/server.c",
@ -481,6 +481,7 @@ cc_library(
"include/grpc/impl/codegen/sync_win32.h", "include/grpc/impl/codegen/sync_win32.h",
"include/grpc/impl/codegen/time.h", "include/grpc/impl/codegen/time.h",
"include/grpc/grpc_security.h", "include/grpc/grpc_security.h",
"include/grpc/grpc_security_constants.h",
"include/grpc/census.h", "include/grpc/census.h",
], ],
includes = [ includes = [
@ -621,6 +622,7 @@ cc_library(
"src/core/ext/census/grpc_filter.h", "src/core/ext/census/grpc_filter.h",
"src/core/ext/census/mlog.h", "src/core/ext/census/mlog.h",
"src/core/ext/census/rpc_metric_id.h", "src/core/ext/census/rpc_metric_id.h",
"src/core/lib/surface/init.c",
"src/core/lib/surface/init_unsecure.c", "src/core/lib/surface/init_unsecure.c",
"src/core/lib/channel/channel_args.c", "src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_stack.c", "src/core/lib/channel/channel_stack.c",
@ -691,7 +693,6 @@ cc_library(
"src/core/lib/surface/channel_stack_type.c", "src/core/lib/surface/channel_stack_type.c",
"src/core/lib/surface/completion_queue.c", "src/core/lib/surface/completion_queue.c",
"src/core/lib/surface/event_string.c", "src/core/lib/surface/event_string.c",
"src/core/lib/surface/init.c",
"src/core/lib/surface/lame_client.c", "src/core/lib/surface/lame_client.c",
"src/core/lib/surface/metadata_array.c", "src/core/lib/surface/metadata_array.c",
"src/core/lib/surface/server.c", "src/core/lib/surface/server.c",
@ -835,7 +836,6 @@ cc_library(
"src/cpp/common/secure_auth_context.h", "src/cpp/common/secure_auth_context.h",
"src/cpp/server/secure_server_credentials.h", "src/cpp/server/secure_server_credentials.h",
"src/cpp/client/create_channel_internal.h", "src/cpp/client/create_channel_internal.h",
"src/cpp/common/create_auth_context.h",
"src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/dynamic_thread_pool.h",
"src/cpp/server/thread_pool_interface.h", "src/cpp/server/thread_pool_interface.h",
"src/cpp/client/secure_credentials.cc", "src/cpp/client/secure_credentials.cc",
@ -923,6 +923,7 @@ cc_library(
"include/grpc++/impl/codegen/completion_queue.h", "include/grpc++/impl/codegen/completion_queue.h",
"include/grpc++/impl/codegen/completion_queue_tag.h", "include/grpc++/impl/codegen/completion_queue_tag.h",
"include/grpc++/impl/codegen/core_codegen_interface.h", "include/grpc++/impl/codegen/core_codegen_interface.h",
"include/grpc++/impl/codegen/create_auth_context.h",
"include/grpc++/impl/codegen/grpc_library.h", "include/grpc++/impl/codegen/grpc_library.h",
"include/grpc++/impl/codegen/method_handler_impl.h", "include/grpc++/impl/codegen/method_handler_impl.h",
"include/grpc++/impl/codegen/proto_utils.h", "include/grpc++/impl/codegen/proto_utils.h",
@ -985,7 +986,6 @@ cc_library(
srcs = [ srcs = [
"src/cpp/client/create_channel_internal.h", "src/cpp/client/create_channel_internal.h",
"src/cpp/common/core_codegen.h", "src/cpp/common/core_codegen.h",
"src/cpp/common/create_auth_context.h",
"src/cpp/server/dynamic_thread_pool.h", "src/cpp/server/dynamic_thread_pool.h",
"src/cpp/server/thread_pool_interface.h", "src/cpp/server/thread_pool_interface.h",
"src/cpp/common/insecure_create_auth_context.cc", "src/cpp/common/insecure_create_auth_context.cc",
@ -1068,6 +1068,7 @@ cc_library(
"include/grpc++/impl/codegen/completion_queue.h", "include/grpc++/impl/codegen/completion_queue.h",
"include/grpc++/impl/codegen/completion_queue_tag.h", "include/grpc++/impl/codegen/completion_queue_tag.h",
"include/grpc++/impl/codegen/core_codegen_interface.h", "include/grpc++/impl/codegen/core_codegen_interface.h",
"include/grpc++/impl/codegen/create_auth_context.h",
"include/grpc++/impl/codegen/grpc_library.h", "include/grpc++/impl/codegen/grpc_library.h",
"include/grpc++/impl/codegen/method_handler_impl.h", "include/grpc++/impl/codegen/method_handler_impl.h",
"include/grpc++/impl/codegen/proto_utils.h", "include/grpc++/impl/codegen/proto_utils.h",
@ -1135,6 +1136,8 @@ cc_library(
"src/compiler/csharp_generator.h", "src/compiler/csharp_generator.h",
"src/compiler/csharp_generator_helpers.h", "src/compiler/csharp_generator_helpers.h",
"src/compiler/generator_helpers.h", "src/compiler/generator_helpers.h",
"src/compiler/node_generator.h",
"src/compiler/node_generator_helpers.h",
"src/compiler/objective_c_generator.h", "src/compiler/objective_c_generator.h",
"src/compiler/objective_c_generator_helpers.h", "src/compiler/objective_c_generator_helpers.h",
"src/compiler/python_generator.h", "src/compiler/python_generator.h",
@ -1144,6 +1147,7 @@ cc_library(
"src/compiler/ruby_generator_string-inl.h", "src/compiler/ruby_generator_string-inl.h",
"src/compiler/cpp_generator.cc", "src/compiler/cpp_generator.cc",
"src/compiler/csharp_generator.cc", "src/compiler/csharp_generator.cc",
"src/compiler/node_generator.cc",
"src/compiler/objective_c_generator.cc", "src/compiler/objective_c_generator.cc",
"src/compiler/python_generator.cc", "src/compiler/python_generator.cc",
"src/compiler/ruby_generator.cc", "src/compiler/ruby_generator.cc",
@ -1302,6 +1306,7 @@ objc_library(
objc_library( objc_library(
name = "grpc_objc", name = "grpc_objc",
srcs = [ srcs = [
"src/core/lib/surface/init.c",
"src/core/lib/channel/channel_args.c", "src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_stack.c", "src/core/lib/channel/channel_stack.c",
"src/core/lib/channel/channel_stack_builder.c", "src/core/lib/channel/channel_stack_builder.c",
@ -1371,7 +1376,6 @@ objc_library(
"src/core/lib/surface/channel_stack_type.c", "src/core/lib/surface/channel_stack_type.c",
"src/core/lib/surface/completion_queue.c", "src/core/lib/surface/completion_queue.c",
"src/core/lib/surface/event_string.c", "src/core/lib/surface/event_string.c",
"src/core/lib/surface/init.c",
"src/core/lib/surface/lame_client.c", "src/core/lib/surface/lame_client.c",
"src/core/lib/surface/metadata_array.c", "src/core/lib/surface/metadata_array.c",
"src/core/lib/surface/server.c", "src/core/lib/surface/server.c",
@ -1492,6 +1496,7 @@ objc_library(
"include/grpc/impl/codegen/sync_win32.h", "include/grpc/impl/codegen/sync_win32.h",
"include/grpc/impl/codegen/time.h", "include/grpc/impl/codegen/time.h",
"include/grpc/grpc_security.h", "include/grpc/grpc_security.h",
"include/grpc/grpc_security_constants.h",
"include/grpc/census.h", "include/grpc/census.h",
"src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_args.h",
"src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack.h",
@ -1664,6 +1669,18 @@ cc_binary(
) )
cc_binary(
name = "grpc_node_plugin",
srcs = [
"src/compiler/node_plugin.cc",
],
deps = [
"//external:protobuf_compiler",
":grpc_plugin_support",
],
)
cc_binary( cc_binary(
name = "grpc_objective_c_plugin", name = "grpc_objective_c_plugin",
srcs = [ srcs = [

@ -779,7 +779,7 @@ endif
.SECONDARY = %.pb.h %.pb.cc .SECONDARY = %.pb.h %.pb.cc
PROTOC_PLUGINS = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin PROTOC_PLUGINS = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(BINDIR)/$(CONFIG)/grpc_node_plugin $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
ifeq ($(DEP_MISSING),) ifeq ($(DEP_MISSING),)
all: static shared plugins all: static shared plugins
dep_error: dep_error:
@ -881,6 +881,7 @@ alarm_test: $(BINDIR)/$(CONFIG)/alarm_test
algorithm_test: $(BINDIR)/$(CONFIG)/algorithm_test algorithm_test: $(BINDIR)/$(CONFIG)/algorithm_test
alloc_test: $(BINDIR)/$(CONFIG)/alloc_test alloc_test: $(BINDIR)/$(CONFIG)/alloc_test
alpn_test: $(BINDIR)/$(CONFIG)/alpn_test alpn_test: $(BINDIR)/$(CONFIG)/alpn_test
api_fuzzer: $(BINDIR)/$(CONFIG)/api_fuzzer
bin_encoder_test: $(BINDIR)/$(CONFIG)/bin_encoder_test bin_encoder_test: $(BINDIR)/$(CONFIG)/bin_encoder_test
census_context_test: $(BINDIR)/$(CONFIG)/census_context_test census_context_test: $(BINDIR)/$(CONFIG)/census_context_test
channel_create_test: $(BINDIR)/$(CONFIG)/channel_create_test channel_create_test: $(BINDIR)/$(CONFIG)/channel_create_test
@ -1013,6 +1014,7 @@ golden_file_test: $(BINDIR)/$(CONFIG)/golden_file_test
grpc_cli: $(BINDIR)/$(CONFIG)/grpc_cli grpc_cli: $(BINDIR)/$(CONFIG)/grpc_cli
grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin
grpc_csharp_plugin: $(BINDIR)/$(CONFIG)/grpc_csharp_plugin grpc_csharp_plugin: $(BINDIR)/$(CONFIG)/grpc_csharp_plugin
grpc_node_plugin: $(BINDIR)/$(CONFIG)/grpc_node_plugin
grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin
grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin
grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
@ -1024,7 +1026,6 @@ interop_test: $(BINDIR)/$(CONFIG)/interop_test
json_run_localhost: $(BINDIR)/$(CONFIG)/json_run_localhost json_run_localhost: $(BINDIR)/$(CONFIG)/json_run_localhost
metrics_client: $(BINDIR)/$(CONFIG)/metrics_client metrics_client: $(BINDIR)/$(CONFIG)/metrics_client
mock_test: $(BINDIR)/$(CONFIG)/mock_test mock_test: $(BINDIR)/$(CONFIG)/mock_test
qps_driver: $(BINDIR)/$(CONFIG)/qps_driver
qps_interarrival_test: $(BINDIR)/$(CONFIG)/qps_interarrival_test qps_interarrival_test: $(BINDIR)/$(CONFIG)/qps_interarrival_test
qps_json_driver: $(BINDIR)/$(CONFIG)/qps_json_driver qps_json_driver: $(BINDIR)/$(CONFIG)/qps_json_driver
qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test qps_openloop_test: $(BINDIR)/$(CONFIG)/qps_openloop_test
@ -1108,6 +1109,7 @@ h2_sockpair_test: $(BINDIR)/$(CONFIG)/h2_sockpair_test
h2_sockpair+trace_test: $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test h2_sockpair+trace_test: $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test
h2_sockpair_1byte_test: $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test h2_sockpair_1byte_test: $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test
h2_ssl_test: $(BINDIR)/$(CONFIG)/h2_ssl_test h2_ssl_test: $(BINDIR)/$(CONFIG)/h2_ssl_test
h2_ssl_cert_test: $(BINDIR)/$(CONFIG)/h2_ssl_cert_test
h2_ssl_proxy_test: $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test h2_ssl_proxy_test: $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test
h2_uds_test: $(BINDIR)/$(CONFIG)/h2_uds_test h2_uds_test: $(BINDIR)/$(CONFIG)/h2_uds_test
h2_census_nosec_test: $(BINDIR)/$(CONFIG)/h2_census_nosec_test h2_census_nosec_test: $(BINDIR)/$(CONFIG)/h2_census_nosec_test
@ -1120,6 +1122,7 @@ h2_sockpair_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair_nosec_test
h2_sockpair+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test h2_sockpair+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test
h2_sockpair_1byte_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_nosec_test h2_sockpair_1byte_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_nosec_test
h2_uds_nosec_test: $(BINDIR)/$(CONFIG)/h2_uds_nosec_test h2_uds_nosec_test: $(BINDIR)/$(CONFIG)/h2_uds_nosec_test
api_fuzzer_one_entry: $(BINDIR)/$(CONFIG)/api_fuzzer_one_entry
client_fuzzer_one_entry: $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry client_fuzzer_one_entry: $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry
hpack_parser_fuzzer_test_one_entry: $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry hpack_parser_fuzzer_test_one_entry: $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry
http_fuzzer_test_one_entry: $(BINDIR)/$(CONFIG)/http_fuzzer_test_one_entry http_fuzzer_test_one_entry: $(BINDIR)/$(CONFIG)/http_fuzzer_test_one_entry
@ -1184,7 +1187,7 @@ plugins: $(PROTOC_PLUGINS)
privatelibs: privatelibs_c privatelibs_cxx privatelibs: privatelibs_c privatelibs_cxx
privatelibs_c: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libreconnect_server.a $(LIBDIR)/$(CONFIG)/libtest_tcp_server.a $(LIBDIR)/$(CONFIG)/libz.a $(LIBDIR)/$(CONFIG)/libbad_client_test.a $(LIBDIR)/$(CONFIG)/libbad_ssl_test_server.a $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a privatelibs_c: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libreconnect_server.a $(LIBDIR)/$(CONFIG)/libtest_tcp_server.a $(LIBDIR)/$(CONFIG)/libz.a $(LIBDIR)/$(CONFIG)/libbad_client_test.a $(LIBDIR)/$(CONFIG)/libbad_ssl_test_server.a $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a
pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc
pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc
@ -1335,6 +1338,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/h2_sockpair+trace_test \ $(BINDIR)/$(CONFIG)/h2_sockpair+trace_test \
$(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test \ $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_test \
$(BINDIR)/$(CONFIG)/h2_ssl_test \ $(BINDIR)/$(CONFIG)/h2_ssl_test \
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test \
$(BINDIR)/$(CONFIG)/h2_ssl_proxy_test \ $(BINDIR)/$(CONFIG)/h2_ssl_proxy_test \
$(BINDIR)/$(CONFIG)/h2_uds_test \ $(BINDIR)/$(CONFIG)/h2_uds_test \
$(BINDIR)/$(CONFIG)/h2_census_nosec_test \ $(BINDIR)/$(CONFIG)/h2_census_nosec_test \
@ -1347,6 +1351,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test \ $(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test \
$(BINDIR)/$(CONFIG)/h2_sockpair_1byte_nosec_test \ $(BINDIR)/$(CONFIG)/h2_sockpair_1byte_nosec_test \
$(BINDIR)/$(CONFIG)/h2_uds_nosec_test \ $(BINDIR)/$(CONFIG)/h2_uds_nosec_test \
$(BINDIR)/$(CONFIG)/api_fuzzer_one_entry \
$(BINDIR)/$(CONFIG)/client_fuzzer_one_entry \ $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry \
$(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry \ $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry \
$(BINDIR)/$(CONFIG)/http_fuzzer_test_one_entry \ $(BINDIR)/$(CONFIG)/http_fuzzer_test_one_entry \
@ -1770,7 +1775,7 @@ tools_c: privatelibs_c $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/
tools_cxx: privatelibs_cxx tools_cxx: privatelibs_cxx
buildbenchmarks: privatelibs $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark $(BINDIR)/$(CONFIG)/qps_driver buildbenchmarks: privatelibs $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark
benchmarks: buildbenchmarks benchmarks: buildbenchmarks
@ -2260,6 +2265,8 @@ else
$(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(prefix)/bin/grpc_csharp_plugin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(prefix)/bin/grpc_csharp_plugin
$(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_node_plugin $(prefix)/bin/grpc_node_plugin
$(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(prefix)/bin/grpc_objective_c_plugin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(prefix)/bin/grpc_objective_c_plugin
$(Q) $(INSTALL) -d $(prefix)/bin $(Q) $(INSTALL) -d $(prefix)/bin
$(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin
@ -2468,6 +2475,7 @@ endif
LIBGRPC_SRC = \ LIBGRPC_SRC = \
src/core/lib/surface/init.c \
src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_args.c \
src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack.c \
src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/channel_stack_builder.c \
@ -2537,7 +2545,6 @@ LIBGRPC_SRC = \
src/core/lib/surface/channel_stack_type.c \ src/core/lib/surface/channel_stack_type.c \
src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue.c \
src/core/lib/surface/event_string.c \ src/core/lib/surface/event_string.c \
src/core/lib/surface/init.c \
src/core/lib/surface/lame_client.c \ src/core/lib/surface/lame_client.c \
src/core/lib/surface/metadata_array.c \ src/core/lib/surface/metadata_array.c \
src/core/lib/surface/server.c \ src/core/lib/surface/server.c \
@ -2661,6 +2668,7 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/sync_win32.h \ include/grpc/impl/codegen/sync_win32.h \
include/grpc/impl/codegen/time.h \ include/grpc/impl/codegen/time.h \
include/grpc/grpc_security.h \ include/grpc/grpc_security.h \
include/grpc/grpc_security_constants.h \
include/grpc/census.h \ include/grpc/census.h \
LIBGRPC_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_SRC)))) LIBGRPC_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_SRC))))
@ -2716,6 +2724,7 @@ endif
LIBGRPC_TEST_UTIL_SRC = \ LIBGRPC_TEST_UTIL_SRC = \
test/core/end2end/data/client_certs.c \
test/core/end2end/data/server1_cert.c \ test/core/end2end/data/server1_cert.c \
test/core/end2end/data/server1_key.c \ test/core/end2end/data/server1_key.c \
test/core/end2end/data/test_root_cert.c \ test/core/end2end/data/test_root_cert.c \
@ -2727,6 +2736,7 @@ LIBGRPC_TEST_UTIL_SRC = \
test/core/util/memory_counters.c \ test/core/util/memory_counters.c \
test/core/util/mock_endpoint.c \ test/core/util/mock_endpoint.c \
test/core/util/parse_hexstring.c \ test/core/util/parse_hexstring.c \
test/core/util/passthru_endpoint.c \
test/core/util/port_posix.c \ test/core/util/port_posix.c \
test/core/util/port_server_client.c \ test/core/util/port_server_client.c \
test/core/util/port_windows.c \ test/core/util/port_windows.c \
@ -2776,6 +2786,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \
test/core/util/memory_counters.c \ test/core/util/memory_counters.c \
test/core/util/mock_endpoint.c \ test/core/util/mock_endpoint.c \
test/core/util/parse_hexstring.c \ test/core/util/parse_hexstring.c \
test/core/util/passthru_endpoint.c \
test/core/util/port_posix.c \ test/core/util/port_posix.c \
test/core/util/port_server_client.c \ test/core/util/port_server_client.c \
test/core/util/port_windows.c \ test/core/util/port_windows.c \
@ -2804,6 +2815,7 @@ endif
LIBGRPC_UNSECURE_SRC = \ LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/init.c \
src/core/lib/surface/init_unsecure.c \ src/core/lib/surface/init_unsecure.c \
src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_args.c \
src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack.c \
@ -2874,7 +2886,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/channel_stack_type.c \ src/core/lib/surface/channel_stack_type.c \
src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue.c \
src/core/lib/surface/event_string.c \ src/core/lib/surface/event_string.c \
src/core/lib/surface/init.c \
src/core/lib/surface/lame_client.c \ src/core/lib/surface/lame_client.c \
src/core/lib/surface/metadata_array.c \ src/core/lib/surface/metadata_array.c \
src/core/lib/surface/server.c \ src/core/lib/surface/server.c \
@ -3058,31 +3069,6 @@ ifneq ($(NO_DEPS),true)
endif endif
LIBONE_INPUT_FUZZER_SRC = \
test/core/util/one_corpus_entry_fuzzer.c \
PUBLIC_HEADERS_C += \
LIBONE_INPUT_FUZZER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBONE_INPUT_FUZZER_SRC))))
$(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a: $(ZLIB_DEP) $(LIBONE_INPUT_FUZZER_OBJS)
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a
$(Q) $(AR) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBONE_INPUT_FUZZER_OBJS)
ifeq ($(SYSTEM),Darwin)
$(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a
endif
ifneq ($(NO_DEPS),true)
-include $(LIBONE_INPUT_FUZZER_OBJS:.o=.dep)
endif
LIBRECONNECT_SERVER_SRC = \ LIBRECONNECT_SERVER_SRC = \
test/core/util/reconnect_server.c \ test/core/util/reconnect_server.c \
@ -3247,6 +3233,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/codegen/completion_queue.h \ include/grpc++/impl/codegen/completion_queue.h \
include/grpc++/impl/codegen/completion_queue_tag.h \ include/grpc++/impl/codegen/completion_queue_tag.h \
include/grpc++/impl/codegen/core_codegen_interface.h \ include/grpc++/impl/codegen/core_codegen_interface.h \
include/grpc++/impl/codegen/create_auth_context.h \
include/grpc++/impl/codegen/grpc_library.h \ include/grpc++/impl/codegen/grpc_library.h \
include/grpc++/impl/codegen/method_handler_impl.h \ include/grpc++/impl/codegen/method_handler_impl.h \
include/grpc++/impl/codegen/proto_utils.h \ include/grpc++/impl/codegen/proto_utils.h \
@ -3549,6 +3536,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/codegen/completion_queue.h \ include/grpc++/impl/codegen/completion_queue.h \
include/grpc++/impl/codegen/completion_queue_tag.h \ include/grpc++/impl/codegen/completion_queue_tag.h \
include/grpc++/impl/codegen/core_codegen_interface.h \ include/grpc++/impl/codegen/core_codegen_interface.h \
include/grpc++/impl/codegen/create_auth_context.h \
include/grpc++/impl/codegen/grpc_library.h \ include/grpc++/impl/codegen/grpc_library.h \
include/grpc++/impl/codegen/method_handler_impl.h \ include/grpc++/impl/codegen/method_handler_impl.h \
include/grpc++/impl/codegen/proto_utils.h \ include/grpc++/impl/codegen/proto_utils.h \
@ -3645,6 +3633,7 @@ endif
LIBGRPC_PLUGIN_SUPPORT_SRC = \ LIBGRPC_PLUGIN_SUPPORT_SRC = \
src/compiler/cpp_generator.cc \ src/compiler/cpp_generator.cc \
src/compiler/csharp_generator.cc \ src/compiler/csharp_generator.cc \
src/compiler/node_generator.cc \
src/compiler/objective_c_generator.cc \ src/compiler/objective_c_generator.cc \
src/compiler/python_generator.cc \ src/compiler/python_generator.cc \
src/compiler/ruby_generator.cc \ src/compiler/ruby_generator.cc \
@ -6091,6 +6080,38 @@ endif
endif endif
API_FUZZER_SRC = \
test/core/end2end/fuzzers/api_fuzzer.c \
API_FUZZER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(API_FUZZER_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/api_fuzzer: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/api_fuzzer: $(API_FUZZER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(API_FUZZER_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -lFuzzer -o $(BINDIR)/$(CONFIG)/api_fuzzer
endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/fuzzers/api_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_api_fuzzer: $(API_FUZZER_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(API_FUZZER_OBJS:.o=.dep)
endif
endif
BIN_ENCODER_TEST_SRC = \ BIN_ENCODER_TEST_SRC = \
test/core/transport/chttp2/bin_encoder_test.c \ test/core/transport/chttp2/bin_encoder_test.c \
@ -10594,6 +10615,37 @@ ifneq ($(NO_DEPS),true)
endif endif
GRPC_NODE_PLUGIN_SRC = \
src/compiler/node_plugin.cc \
GRPC_NODE_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_NODE_PLUGIN_SRC))))
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
$(BINDIR)/$(CONFIG)/grpc_node_plugin: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/grpc_node_plugin: $(PROTOBUF_DEP) $(GRPC_NODE_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
$(E) "[HOSTLD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_NODE_PLUGIN_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_node_plugin
endif
$(OBJDIR)/$(CONFIG)/src/compiler/node_plugin.o: $(LIBDIR)/$(CONFIG)/libgrpc_plugin_support.a
deps_grpc_node_plugin: $(GRPC_NODE_PLUGIN_OBJS:.o=.dep)
ifneq ($(NO_DEPS),true)
-include $(GRPC_NODE_PLUGIN_OBJS:.o=.dep)
endif
GRPC_OBJECTIVE_C_PLUGIN_SRC = \ GRPC_OBJECTIVE_C_PLUGIN_SRC = \
src/compiler/objective_c_plugin.cc \ src/compiler/objective_c_plugin.cc \
@ -11015,49 +11067,6 @@ endif
endif endif
QPS_DRIVER_SRC = \
test/cpp/qps/qps_driver.cc \
QPS_DRIVER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_DRIVER_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/qps_driver: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
$(BINDIR)/$(CONFIG)/qps_driver: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/qps_driver: $(PROTOBUF_DEP) $(QPS_DRIVER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(QPS_DRIVER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/qps_driver
endif
endif
$(OBJDIR)/$(CONFIG)/test/cpp/qps/qps_driver.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
deps_qps_driver: $(QPS_DRIVER_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(QPS_DRIVER_OBJS:.o=.dep)
endif
endif
QPS_INTERARRIVAL_TEST_SRC = \ QPS_INTERARRIVAL_TEST_SRC = \
test/cpp/qps/qps_interarrival_test.cc \ test/cpp/qps/qps_interarrival_test.cc \
@ -11102,6 +11111,7 @@ endif
QPS_JSON_DRIVER_SRC = \ QPS_JSON_DRIVER_SRC = \
test/cpp/qps/parse_json.cc \
test/cpp/qps/qps_json_driver.cc \ test/cpp/qps/qps_json_driver.cc \
QPS_JSON_DRIVER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_JSON_DRIVER_SRC)))) QPS_JSON_DRIVER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(QPS_JSON_DRIVER_SRC))))
@ -11133,6 +11143,8 @@ endif
endif endif
$(OBJDIR)/$(CONFIG)/test/cpp/qps/parse_json.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
$(OBJDIR)/$(CONFIG)/test/cpp/qps/qps_json_driver.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(OBJDIR)/$(CONFIG)/test/cpp/qps/qps_json_driver.o: $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
deps_qps_json_driver: $(QPS_JSON_DRIVER_OBJS:.o=.dep) deps_qps_json_driver: $(QPS_JSON_DRIVER_OBJS:.o=.dep)
@ -13678,6 +13690,38 @@ endif
endif endif
H2_SSL_CERT_TEST_SRC = \
test/core/end2end/fixtures/h2_ssl_cert.c \
H2_SSL_CERT_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_SSL_CERT_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/h2_ssl_cert_test: $(H2_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(H2_SSL_CERT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_ssl_cert_test
endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_ssl_cert.o: $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_h2_ssl_cert_test: $(H2_SSL_CERT_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(H2_SSL_CERT_TEST_OBJS:.o=.dep)
endif
endif
H2_SSL_PROXY_TEST_SRC = \ H2_SSL_PROXY_TEST_SRC = \
test/core/end2end/fixtures/h2_ssl_proxy.c \ test/core/end2end/fixtures/h2_ssl_proxy.c \
@ -13942,8 +13986,44 @@ ifneq ($(NO_DEPS),true)
endif endif
API_FUZZER_ONE_ENTRY_SRC = \
test/core/end2end/fuzzers/api_fuzzer.c \
test/core/util/one_corpus_entry_fuzzer.c \
API_FUZZER_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(API_FUZZER_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/api_fuzzer_one_entry: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/api_fuzzer_one_entry: $(API_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(API_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/api_fuzzer_one_entry
endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/fuzzers/api_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_api_fuzzer_one_entry: $(API_FUZZER_ONE_ENTRY_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(API_FUZZER_ONE_ENTRY_OBJS:.o=.dep)
endif
endif
CLIENT_FUZZER_ONE_ENTRY_SRC = \ CLIENT_FUZZER_ONE_ENTRY_SRC = \
test/core/end2end/fuzzers/client_fuzzer.c \ test/core/end2end/fuzzers/client_fuzzer.c \
test/core/util/one_corpus_entry_fuzzer.c \
CLIENT_FUZZER_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CLIENT_FUZZER_ONE_ENTRY_SRC)))) CLIENT_FUZZER_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CLIENT_FUZZER_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -13956,14 +14036,16 @@ else
$(BINDIR)/$(CONFIG)/client_fuzzer_one_entry: $(CLIENT_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry: $(CLIENT_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(CLIENT_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry $(Q) $(LD) $(LDFLAGS) $(CLIENT_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry
endif endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/fuzzers/client_fuzzer.o: $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/end2end/fuzzers/client_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_client_fuzzer_one_entry: $(CLIENT_FUZZER_ONE_ENTRY_OBJS:.o=.dep) deps_client_fuzzer_one_entry: $(CLIENT_FUZZER_ONE_ENTRY_OBJS:.o=.dep)
@ -13976,6 +14058,7 @@ endif
HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_SRC = \ HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_SRC = \
test/core/transport/chttp2/hpack_parser_fuzzer_test.c \ test/core/transport/chttp2/hpack_parser_fuzzer_test.c \
test/core/util/one_corpus_entry_fuzzer.c \
HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_SRC)))) HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -13988,14 +14071,16 @@ else
$(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry: $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry: $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry $(Q) $(LD) $(LDFLAGS) $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/hpack_parser_fuzzer_test_one_entry
endif endif
$(OBJDIR)/$(CONFIG)/test/core/transport/chttp2/hpack_parser_fuzzer_test.o: $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/transport/chttp2/hpack_parser_fuzzer_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_hpack_parser_fuzzer_test_one_entry: $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS:.o=.dep) deps_hpack_parser_fuzzer_test_one_entry: $(HPACK_PARSER_FUZZER_TEST_ONE_ENTRY_OBJS:.o=.dep)
@ -14008,6 +14093,7 @@ endif
HTTP_FUZZER_TEST_ONE_ENTRY_SRC = \ HTTP_FUZZER_TEST_ONE_ENTRY_SRC = \
test/core/http/fuzzer.c \ test/core/http/fuzzer.c \
test/core/util/one_corpus_entry_fuzzer.c \
HTTP_FUZZER_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_FUZZER_TEST_ONE_ENTRY_SRC)))) HTTP_FUZZER_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(HTTP_FUZZER_TEST_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -14020,14 +14106,16 @@ else
$(BINDIR)/$(CONFIG)/http_fuzzer_test_one_entry: $(HTTP_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/http_fuzzer_test_one_entry: $(HTTP_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(HTTP_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_fuzzer_test_one_entry $(Q) $(LD) $(LDFLAGS) $(HTTP_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/http_fuzzer_test_one_entry
endif endif
$(OBJDIR)/$(CONFIG)/test/core/http/fuzzer.o: $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/http/fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_http_fuzzer_test_one_entry: $(HTTP_FUZZER_TEST_ONE_ENTRY_OBJS:.o=.dep) deps_http_fuzzer_test_one_entry: $(HTTP_FUZZER_TEST_ONE_ENTRY_OBJS:.o=.dep)
@ -14040,6 +14128,7 @@ endif
JSON_FUZZER_TEST_ONE_ENTRY_SRC = \ JSON_FUZZER_TEST_ONE_ENTRY_SRC = \
test/core/json/fuzzer.c \ test/core/json/fuzzer.c \
test/core/util/one_corpus_entry_fuzzer.c \
JSON_FUZZER_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(JSON_FUZZER_TEST_ONE_ENTRY_SRC)))) JSON_FUZZER_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(JSON_FUZZER_TEST_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -14052,14 +14141,16 @@ else
$(BINDIR)/$(CONFIG)/json_fuzzer_test_one_entry: $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/json_fuzzer_test_one_entry: $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_fuzzer_test_one_entry $(Q) $(LD) $(LDFLAGS) $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/json_fuzzer_test_one_entry
endif endif
$(OBJDIR)/$(CONFIG)/test/core/json/fuzzer.o: $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/json/fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_json_fuzzer_test_one_entry: $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS:.o=.dep) deps_json_fuzzer_test_one_entry: $(JSON_FUZZER_TEST_ONE_ENTRY_OBJS:.o=.dep)
@ -14072,6 +14163,7 @@ endif
NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_SRC = \ NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_SRC = \
test/core/nanopb/fuzzer_response.c \ test/core/nanopb/fuzzer_response.c \
test/core/util/one_corpus_entry_fuzzer.c \
NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_SRC)))) NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -14084,14 +14176,16 @@ else
$(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test_one_entry: $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test_one_entry: $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test_one_entry $(Q) $(LD) $(LDFLAGS) $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test_one_entry
endif endif
$(OBJDIR)/$(CONFIG)/test/core/nanopb/fuzzer_response.o: $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/nanopb/fuzzer_response.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_nanopb_fuzzer_response_test_one_entry: $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS:.o=.dep) deps_nanopb_fuzzer_response_test_one_entry: $(NANOPB_FUZZER_RESPONSE_TEST_ONE_ENTRY_OBJS:.o=.dep)
@ -14104,6 +14198,7 @@ endif
NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_SRC = \ NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_SRC = \
test/core/nanopb/fuzzer_serverlist.c \ test/core/nanopb/fuzzer_serverlist.c \
test/core/util/one_corpus_entry_fuzzer.c \
NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_SRC)))) NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -14116,14 +14211,16 @@ else
$(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test_one_entry: $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test_one_entry: $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test_one_entry $(Q) $(LD) $(LDFLAGS) $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test_one_entry
endif endif
$(OBJDIR)/$(CONFIG)/test/core/nanopb/fuzzer_serverlist.o: $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/nanopb/fuzzer_serverlist.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_nanopb_fuzzer_serverlist_test_one_entry: $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS:.o=.dep) deps_nanopb_fuzzer_serverlist_test_one_entry: $(NANOPB_FUZZER_SERVERLIST_TEST_ONE_ENTRY_OBJS:.o=.dep)
@ -14136,6 +14233,7 @@ endif
SERVER_FUZZER_ONE_ENTRY_SRC = \ SERVER_FUZZER_ONE_ENTRY_SRC = \
test/core/end2end/fuzzers/server_fuzzer.c \ test/core/end2end/fuzzers/server_fuzzer.c \
test/core/util/one_corpus_entry_fuzzer.c \
SERVER_FUZZER_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(SERVER_FUZZER_ONE_ENTRY_SRC)))) SERVER_FUZZER_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(SERVER_FUZZER_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -14148,14 +14246,16 @@ else
$(BINDIR)/$(CONFIG)/server_fuzzer_one_entry: $(SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/server_fuzzer_one_entry: $(SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/server_fuzzer_one_entry $(Q) $(LD) $(LDFLAGS) $(SERVER_FUZZER_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/server_fuzzer_one_entry
endif endif
$(OBJDIR)/$(CONFIG)/test/core/end2end/fuzzers/server_fuzzer.o: $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/end2end/fuzzers/server_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_server_fuzzer_one_entry: $(SERVER_FUZZER_ONE_ENTRY_OBJS:.o=.dep) deps_server_fuzzer_one_entry: $(SERVER_FUZZER_ONE_ENTRY_OBJS:.o=.dep)
@ -14168,6 +14268,7 @@ endif
URI_FUZZER_TEST_ONE_ENTRY_SRC = \ URI_FUZZER_TEST_ONE_ENTRY_SRC = \
test/core/client_config/uri_fuzzer_test.c \ test/core/client_config/uri_fuzzer_test.c \
test/core/util/one_corpus_entry_fuzzer.c \
URI_FUZZER_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(URI_FUZZER_TEST_ONE_ENTRY_SRC)))) URI_FUZZER_TEST_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(URI_FUZZER_TEST_ONE_ENTRY_SRC))))
ifeq ($(NO_SECURE),true) ifeq ($(NO_SECURE),true)
@ -14180,14 +14281,16 @@ else
$(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry: $(URI_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry: $(URI_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(URI_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry $(Q) $(LD) $(LDFLAGS) $(URI_FUZZER_TEST_ONE_ENTRY_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry
endif endif
$(OBJDIR)/$(CONFIG)/test/core/client_config/uri_fuzzer_test.o: $(LIBDIR)/$(CONFIG)/libone_input_fuzzer.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/core/client_config/uri_fuzzer_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_uri_fuzzer_test_one_entry: $(URI_FUZZER_TEST_ONE_ENTRY_OBJS:.o=.dep) deps_uri_fuzzer_test_one_entry: $(URI_FUZZER_TEST_ONE_ENTRY_OBJS:.o=.dep)
@ -14237,6 +14340,7 @@ src/cpp/server/secure_server_credentials.cc: $(OPENSSL_DEP)
src/csharp/ext/grpc_csharp_ext.c: $(OPENSSL_DEP) src/csharp/ext/grpc_csharp_ext.c: $(OPENSSL_DEP)
test/core/bad_client/bad_client.c: $(OPENSSL_DEP) test/core/bad_client/bad_client.c: $(OPENSSL_DEP)
test/core/bad_ssl/server_common.c: $(OPENSSL_DEP) test/core/bad_ssl/server_common.c: $(OPENSSL_DEP)
test/core/end2end/data/client_certs.c: $(OPENSSL_DEP)
test/core/end2end/data/server1_cert.c: $(OPENSSL_DEP) test/core/end2end/data/server1_cert.c: $(OPENSSL_DEP)
test/core/end2end/data/server1_key.c: $(OPENSSL_DEP) test/core/end2end/data/server1_key.c: $(OPENSSL_DEP)
test/core/end2end/data/test_root_cert.c: $(OPENSSL_DEP) test/core/end2end/data/test_root_cert.c: $(OPENSSL_DEP)

@ -561,6 +561,7 @@
'gpr', 'gpr',
], ],
'sources': [ 'sources': [
'src/core/lib/surface/init.c',
'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_args.c',
'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack.c',
'src/core/lib/channel/channel_stack_builder.c', 'src/core/lib/channel/channel_stack_builder.c',
@ -630,7 +631,6 @@
'src/core/lib/surface/channel_stack_type.c', 'src/core/lib/surface/channel_stack_type.c',
'src/core/lib/surface/completion_queue.c', 'src/core/lib/surface/completion_queue.c',
'src/core/lib/surface/event_string.c', 'src/core/lib/surface/event_string.c',
'src/core/lib/surface/init.c',
'src/core/lib/surface/lame_client.c', 'src/core/lib/surface/lame_client.c',
'src/core/lib/surface/metadata_array.c', 'src/core/lib/surface/metadata_array.c',
'src/core/lib/surface/server.c', 'src/core/lib/surface/server.c',

@ -138,132 +138,6 @@ filegroups:
- include/grpc/impl/codegen/sync_posix.h - include/grpc/impl/codegen/sync_posix.h
- include/grpc/impl/codegen/sync_win32.h - include/grpc/impl/codegen/sync_win32.h
- include/grpc/impl/codegen/time.h - include/grpc/impl/codegen/time.h
- name: grpc++_base
public_headers:
- include/grpc++/alarm.h
- include/grpc++/channel.h
- include/grpc++/client_context.h
- include/grpc++/completion_queue.h
- include/grpc++/create_channel.h
- include/grpc++/generic/async_generic_service.h
- include/grpc++/generic/generic_stub.h
- include/grpc++/grpc++.h
- include/grpc++/impl/call.h
- include/grpc++/impl/client_unary_call.h
- include/grpc++/impl/grpc_library.h
- include/grpc++/impl/method_handler_impl.h
- include/grpc++/impl/proto_utils.h
- include/grpc++/impl/rpc_method.h
- include/grpc++/impl/rpc_service_method.h
- include/grpc++/impl/serialization_traits.h
- include/grpc++/impl/server_builder_option.h
- include/grpc++/impl/service_type.h
- include/grpc++/impl/sync.h
- include/grpc++/impl/sync_cxx11.h
- include/grpc++/impl/sync_no_cxx11.h
- include/grpc++/impl/thd.h
- include/grpc++/impl/thd_cxx11.h
- include/grpc++/impl/thd_no_cxx11.h
- include/grpc++/security/auth_context.h
- include/grpc++/security/auth_metadata_processor.h
- include/grpc++/security/credentials.h
- include/grpc++/security/server_credentials.h
- include/grpc++/server.h
- include/grpc++/server_builder.h
- include/grpc++/server_context.h
- include/grpc++/support/async_stream.h
- include/grpc++/support/async_unary_call.h
- include/grpc++/support/byte_buffer.h
- include/grpc++/support/channel_arguments.h
- include/grpc++/support/slice.h
- include/grpc++/support/status.h
- include/grpc++/support/status_code_enum.h
- include/grpc++/support/string_ref.h
- include/grpc++/support/stub_options.h
- include/grpc++/support/sync_stream.h
- include/grpc++/support/time.h
headers:
- src/cpp/client/create_channel_internal.h
- src/cpp/common/core_codegen.h
- src/cpp/common/create_auth_context.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/thread_pool_interface.h
src:
- src/cpp/client/channel.cc
- src/cpp/client/client_context.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/credentials.cc
- src/cpp/client/generic_stub.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue.cc
- src/cpp/common/core_codegen.cc
- src/cpp/common/rpc_method.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/dynamic_thread_pool.cc
- src/cpp/server/insecure_server_credentials.cc
- src/cpp/server/server.cc
- src/cpp/server/server_builder.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/util/byte_buffer.cc
- src/cpp/util/slice.cc
- src/cpp/util/status.cc
- src/cpp/util/string_ref.cc
- src/cpp/util/time.cc
deps:
- grpc
uses:
- grpc++_codegen
- grpc++_config
- name: grpc++_codegen
public_headers:
- include/grpc++/impl/codegen/async_stream.h
- include/grpc++/impl/codegen/async_unary_call.h
- include/grpc++/impl/codegen/call.h
- include/grpc++/impl/codegen/call_hook.h
- include/grpc++/impl/codegen/channel_interface.h
- include/grpc++/impl/codegen/client_context.h
- include/grpc++/impl/codegen/client_unary_call.h
- include/grpc++/impl/codegen/completion_queue.h
- include/grpc++/impl/codegen/completion_queue_tag.h
- include/grpc++/impl/codegen/core_codegen_interface.h
- include/grpc++/impl/codegen/grpc_library.h
- include/grpc++/impl/codegen/method_handler_impl.h
- include/grpc++/impl/codegen/proto_utils.h
- include/grpc++/impl/codegen/rpc_method.h
- include/grpc++/impl/codegen/rpc_service_method.h
- include/grpc++/impl/codegen/security/auth_context.h
- include/grpc++/impl/codegen/serialization_traits.h
- include/grpc++/impl/codegen/server_context.h
- include/grpc++/impl/codegen/server_interface.h
- include/grpc++/impl/codegen/service_type.h
- include/grpc++/impl/codegen/status.h
- include/grpc++/impl/codegen/status_code_enum.h
- include/grpc++/impl/codegen/string_ref.h
- include/grpc++/impl/codegen/stub_options.h
- include/grpc++/impl/codegen/sync.h
- include/grpc++/impl/codegen/sync_cxx11.h
- include/grpc++/impl/codegen/sync_no_cxx11.h
- include/grpc++/impl/codegen/sync_stream.h
- include/grpc++/impl/codegen/time.h
src:
- src/cpp/codegen/codegen_init.cc
uses:
- grpc_codegen
- grpc++_config_codegen
- name: grpc++_config
public_headers:
- include/grpc++/support/config.h
- include/grpc++/support/config_protobuf.h
uses:
- grpc++_config_codegen
- name: grpc++_config_codegen
public_headers:
- include/grpc++/impl/codegen/config.h
- include/grpc++/impl/codegen/config_protobuf.h
- name: grpc_base - name: grpc_base
public_headers: public_headers:
- include/grpc/byte_buffer.h - include/grpc/byte_buffer.h
@ -415,7 +289,6 @@ filegroups:
- src/core/lib/surface/channel_stack_type.c - src/core/lib/surface/channel_stack_type.c
- src/core/lib/surface/completion_queue.c - src/core/lib/surface/completion_queue.c
- src/core/lib/surface/event_string.c - src/core/lib/surface/event_string.c
- src/core/lib/surface/init.c
- src/core/lib/surface/lame_client.c - src/core/lib/surface/lame_client.c
- src/core/lib/surface/metadata_array.c - src/core/lib/surface/metadata_array.c
- src/core/lib/surface/server.c - src/core/lib/surface/server.c
@ -525,6 +398,7 @@ filegroups:
- name: grpc_secure - name: grpc_secure
public_headers: public_headers:
- include/grpc/grpc_security.h - include/grpc/grpc_security.h
- include/grpc/grpc_security_constants.h
headers: headers:
- src/core/lib/security/auth_filters.h - src/core/lib/security/auth_filters.h
- src/core/lib/security/b64.h - src/core/lib/security/b64.h
@ -535,11 +409,6 @@ filegroups:
- src/core/lib/security/secure_endpoint.h - src/core/lib/security/secure_endpoint.h
- src/core/lib/security/security_connector.h - src/core/lib/security/security_connector.h
- src/core/lib/security/security_context.h - src/core/lib/security/security_context.h
- src/core/lib/tsi/fake_transport_security.h
- src/core/lib/tsi/ssl_transport_security.h
- src/core/lib/tsi/ssl_types.h
- src/core/lib/tsi/transport_security.h
- src/core/lib/tsi/transport_security_interface.h
src: src:
- src/core/lib/http/httpcli_security_connector.c - src/core/lib/http/httpcli_security_connector.c
- src/core/lib/security/b64.c - src/core/lib/security/b64.c
@ -557,13 +426,13 @@ filegroups:
- src/core/lib/security/security_context.c - src/core/lib/security/security_context.c
- src/core/lib/security/server_auth_filter.c - src/core/lib/security/server_auth_filter.c
- src/core/lib/surface/init_secure.c - src/core/lib/surface/init_secure.c
- src/core/lib/tsi/fake_transport_security.c secure: true
- src/core/lib/tsi/ssl_transport_security.c
- src/core/lib/tsi/transport_security.c
uses: uses:
- grpc_base - grpc_base
- grpc_transport_chttp2_alpn - grpc_transport_chttp2_alpn
- tsi
- name: grpc_test_util_base - name: grpc_test_util_base
build: test
headers: headers:
- test/core/end2end/cq_verifier.h - test/core/end2end/cq_verifier.h
- test/core/end2end/fixtures/proxy.h - test/core/end2end/fixtures/proxy.h
@ -572,6 +441,7 @@ filegroups:
- test/core/util/memory_counters.h - test/core/util/memory_counters.h
- test/core/util/mock_endpoint.h - test/core/util/mock_endpoint.h
- test/core/util/parse_hexstring.h - test/core/util/parse_hexstring.h
- test/core/util/passthru_endpoint.h
- test/core/util/port.h - test/core/util/port.h
- test/core/util/port_server_client.h - test/core/util/port_server_client.h
- test/core/util/slice_splitter.h - test/core/util/slice_splitter.h
@ -583,6 +453,7 @@ filegroups:
- test/core/util/memory_counters.c - test/core/util/memory_counters.c
- test/core/util/mock_endpoint.c - test/core/util/mock_endpoint.c
- test/core/util/parse_hexstring.c - test/core/util/parse_hexstring.c
- test/core/util/passthru_endpoint.c
- test/core/util/port_posix.c - test/core/util/port_posix.c
- test/core/util/port_server_client.c - test/core/util/port_server_client.c
- test/core/util/port_windows.c - test/core/util/port_windows.c
@ -683,6 +554,150 @@ filegroups:
- third_party/nanopb/pb_common.c - third_party/nanopb/pb_common.c
- third_party/nanopb/pb_decode.c - third_party/nanopb/pb_decode.c
- third_party/nanopb/pb_encode.c - third_party/nanopb/pb_encode.c
- name: tsi
headers:
- src/core/lib/tsi/fake_transport_security.h
- src/core/lib/tsi/ssl_transport_security.h
- src/core/lib/tsi/ssl_types.h
- src/core/lib/tsi/transport_security.h
- src/core/lib/tsi/transport_security_interface.h
src:
- src/core/lib/tsi/fake_transport_security.c
- src/core/lib/tsi/ssl_transport_security.c
- src/core/lib/tsi/transport_security.c
deps:
- gpr
secure: true
- name: grpc++_base
language: c++
public_headers:
- include/grpc++/alarm.h
- include/grpc++/channel.h
- include/grpc++/client_context.h
- include/grpc++/completion_queue.h
- include/grpc++/create_channel.h
- include/grpc++/generic/async_generic_service.h
- include/grpc++/generic/generic_stub.h
- include/grpc++/grpc++.h
- include/grpc++/impl/call.h
- include/grpc++/impl/client_unary_call.h
- include/grpc++/impl/grpc_library.h
- include/grpc++/impl/method_handler_impl.h
- include/grpc++/impl/proto_utils.h
- include/grpc++/impl/rpc_method.h
- include/grpc++/impl/rpc_service_method.h
- include/grpc++/impl/serialization_traits.h
- include/grpc++/impl/server_builder_option.h
- include/grpc++/impl/service_type.h
- include/grpc++/impl/sync.h
- include/grpc++/impl/sync_cxx11.h
- include/grpc++/impl/sync_no_cxx11.h
- include/grpc++/impl/thd.h
- include/grpc++/impl/thd_cxx11.h
- include/grpc++/impl/thd_no_cxx11.h
- include/grpc++/security/auth_context.h
- include/grpc++/security/auth_metadata_processor.h
- include/grpc++/security/credentials.h
- include/grpc++/security/server_credentials.h
- include/grpc++/server.h
- include/grpc++/server_builder.h
- include/grpc++/server_context.h
- include/grpc++/support/async_stream.h
- include/grpc++/support/async_unary_call.h
- include/grpc++/support/byte_buffer.h
- include/grpc++/support/channel_arguments.h
- include/grpc++/support/slice.h
- include/grpc++/support/status.h
- include/grpc++/support/status_code_enum.h
- include/grpc++/support/string_ref.h
- include/grpc++/support/stub_options.h
- include/grpc++/support/sync_stream.h
- include/grpc++/support/time.h
headers:
- src/cpp/client/create_channel_internal.h
- src/cpp/common/core_codegen.h
- src/cpp/server/dynamic_thread_pool.h
- src/cpp/server/thread_pool_interface.h
src:
- src/cpp/client/channel.cc
- src/cpp/client/client_context.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/credentials.cc
- src/cpp/client/generic_stub.cc
- src/cpp/client/insecure_credentials.cc
- src/cpp/common/channel_arguments.cc
- src/cpp/common/completion_queue.cc
- src/cpp/common/core_codegen.cc
- src/cpp/common/rpc_method.cc
- src/cpp/server/async_generic_service.cc
- src/cpp/server/create_default_thread_pool.cc
- src/cpp/server/dynamic_thread_pool.cc
- src/cpp/server/insecure_server_credentials.cc
- src/cpp/server/server.cc
- src/cpp/server/server_builder.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/util/byte_buffer.cc
- src/cpp/util/slice.cc
- src/cpp/util/status.cc
- src/cpp/util/string_ref.cc
- src/cpp/util/time.cc
deps:
- grpc
uses:
- grpc++_codegen
- grpc++_config
- name: grpc++_codegen
language: c++
public_headers:
- include/grpc++/impl/codegen/async_stream.h
- include/grpc++/impl/codegen/async_unary_call.h
- include/grpc++/impl/codegen/call.h
- include/grpc++/impl/codegen/call_hook.h
- include/grpc++/impl/codegen/channel_interface.h
- include/grpc++/impl/codegen/client_context.h
- include/grpc++/impl/codegen/client_unary_call.h
- include/grpc++/impl/codegen/completion_queue.h
- include/grpc++/impl/codegen/completion_queue_tag.h
- include/grpc++/impl/codegen/core_codegen_interface.h
- include/grpc++/impl/codegen/create_auth_context.h
- include/grpc++/impl/codegen/grpc_library.h
- include/grpc++/impl/codegen/method_handler_impl.h
- include/grpc++/impl/codegen/proto_utils.h
- include/grpc++/impl/codegen/rpc_method.h
- include/grpc++/impl/codegen/rpc_service_method.h
- include/grpc++/impl/codegen/security/auth_context.h
- include/grpc++/impl/codegen/serialization_traits.h
- include/grpc++/impl/codegen/server_context.h
- include/grpc++/impl/codegen/server_interface.h
- include/grpc++/impl/codegen/service_type.h
- include/grpc++/impl/codegen/status.h
- include/grpc++/impl/codegen/status_code_enum.h
- include/grpc++/impl/codegen/string_ref.h
- include/grpc++/impl/codegen/stub_options.h
- include/grpc++/impl/codegen/sync.h
- include/grpc++/impl/codegen/sync_cxx11.h
- include/grpc++/impl/codegen/sync_no_cxx11.h
- include/grpc++/impl/codegen/sync_stream.h
- include/grpc++/impl/codegen/time.h
src:
- src/cpp/codegen/codegen_init.cc
uses:
- grpc_codegen
- grpc++_config_codegen
- name: grpc++_config
language: c++
public_headers:
- include/grpc++/support/config.h
- include/grpc++/support/config_protobuf.h
uses:
- grpc++_config_codegen
- name: grpc++_config_codegen
language: c++
public_headers:
- include/grpc++/impl/codegen/config.h
- include/grpc++/impl/codegen/config_protobuf.h
libs: libs:
- name: gpr - name: gpr
build: all build: all
@ -705,6 +720,8 @@ libs:
- name: grpc - name: grpc
build: all build: all
language: c language: c
src:
- src/core/lib/surface/init.c
baselib: true baselib: true
deps_linkage: static deps_linkage: static
dll: true dll: true
@ -755,6 +772,7 @@ libs:
- test/core/end2end/data/ssl_test_data.h - test/core/end2end/data/ssl_test_data.h
- test/core/security/oauth2_utils.h - test/core/security/oauth2_utils.h
src: src:
- test/core/end2end/data/client_certs.c
- test/core/end2end/data/server1_cert.c - test/core/end2end/data/server1_cert.c
- test/core/end2end/data/server1_key.c - test/core/end2end/data/server1_key.c
- test/core/end2end/data/test_root_cert.c - test/core/end2end/data/test_root_cert.c
@ -781,6 +799,7 @@ libs:
build: all build: all
language: c language: c
src: src:
- src/core/lib/surface/init.c
- src/core/lib/surface/init_unsecure.c - src/core/lib/surface/init_unsecure.c
baselib: true baselib: true
deps_linkage: static deps_linkage: static
@ -813,14 +832,6 @@ libs:
platforms: platforms:
- linux - linux
secure: false secure: false
- name: one_input_fuzzer
build: private
language: c
src:
- test/core/util/one_corpus_entry_fuzzer.c
deps:
- gpr
secure: false
- name: reconnect_server - name: reconnect_server
build: private build: private
language: c language: c
@ -927,6 +938,8 @@ libs:
- src/compiler/csharp_generator.h - src/compiler/csharp_generator.h
- src/compiler/csharp_generator_helpers.h - src/compiler/csharp_generator_helpers.h
- src/compiler/generator_helpers.h - src/compiler/generator_helpers.h
- src/compiler/node_generator.h
- src/compiler/node_generator_helpers.h
- src/compiler/objective_c_generator.h - src/compiler/objective_c_generator.h
- src/compiler/objective_c_generator_helpers.h - src/compiler/objective_c_generator_helpers.h
- src/compiler/python_generator.h - src/compiler/python_generator.h
@ -937,6 +950,7 @@ libs:
src: src:
- src/compiler/cpp_generator.cc - src/compiler/cpp_generator.cc
- src/compiler/csharp_generator.cc - src/compiler/csharp_generator.cc
- src/compiler/node_generator.cc
- src/compiler/objective_c_generator.cc - src/compiler/objective_c_generator.cc
- src/compiler/python_generator.cc - src/compiler/python_generator.cc
- src/compiler/ruby_generator.cc - src/compiler/ruby_generator.cc
@ -1107,6 +1121,20 @@ targets:
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
- name: api_fuzzer
build: fuzzer
language: c
src:
- test/core/end2end/fuzzers/api_fuzzer.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- test/core/end2end/fuzzers/api_fuzzer_corpus
dict: test/core/end2end/fuzzers/api_fuzzer.dictionary
maxlen: 2048
- name: bin_encoder_test - name: bin_encoder_test
build: test build: test
language: c language: c
@ -2568,6 +2596,15 @@ targets:
secure: false secure: false
vs_config_type: Application vs_config_type: Application
vs_project_guid: '{3C813052-A49A-4662-B90A-1ADBEC7EE453}' vs_project_guid: '{3C813052-A49A-4662-B90A-1ADBEC7EE453}'
- name: grpc_node_plugin
build: protoc
language: c++
src:
- src/compiler/node_plugin.cc
deps:
- grpc_plugin_support
secure: false
vs_config_type: Application
- name: grpc_objective_c_plugin - name: grpc_objective_c_plugin
build: protoc build: protoc
language: c++ language: c++
@ -2717,20 +2754,6 @@ targets:
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
- name: qps_driver
build: benchmark
language: c++
src:
- test/cpp/qps/qps_driver.cc
deps:
- qps
- grpc++_test_util
- grpc_test_util
- grpc++
- grpc
- gpr_test_util
- gpr
- grpc++_test_config
- name: qps_interarrival_test - name: qps_interarrival_test
build: test build: test
run: false run: false
@ -2753,7 +2776,10 @@ targets:
build: test build: test
run: false run: false
language: c++ language: c++
headers:
- test/cpp/qps/parse_json.h
src: src:
- test/cpp/qps/parse_json.cc
- test/cpp/qps/qps_json_driver.cc - test/cpp/qps/qps_json_driver.cc
deps: deps:
- qps - qps

@ -80,6 +80,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/support/tmpfile_posix.c \ src/core/lib/support/tmpfile_posix.c \
src/core/lib/support/tmpfile_win32.c \ src/core/lib/support/tmpfile_win32.c \
src/core/lib/support/wrap_memcpy.c \ src/core/lib/support/wrap_memcpy.c \
src/core/lib/surface/init.c \
src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_args.c \
src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack.c \
src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/channel_stack_builder.c \
@ -149,7 +150,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/surface/channel_stack_type.c \ src/core/lib/surface/channel_stack_type.c \
src/core/lib/surface/completion_queue.c \ src/core/lib/surface/completion_queue.c \
src/core/lib/surface/event_string.c \ src/core/lib/surface/event_string.c \
src/core/lib/surface/init.c \
src/core/lib/surface/lame_client.c \ src/core/lib/surface/lame_client.c \
src/core/lib/surface/metadata_array.c \ src/core/lib/surface/metadata_array.c \
src/core/lib/surface/server.c \ src/core/lib/surface/server.c \

@ -31,13 +31,13 @@
* *
*/ */
var PROTO_PATH = __dirname + '/../protos/helloworld.proto';
var grpc = require('grpc'); var grpc = require('grpc');
var hello_proto = grpc.load(PROTO_PATH).helloworld;
var hello_messages = require('./helloworld_pb');
var hello_service = require('./helloworld_grpc_pb');
function main() { function main() {
var client = new hello_proto.Greeter('localhost:50051', var client = new hello_service.GreeterClient('localhost:50051',
grpc.credentials.createInsecure()); grpc.credentials.createInsecure());
var user; var user;
if (process.argv.length >= 3) { if (process.argv.length >= 3) {
@ -45,8 +45,16 @@ function main() {
} else { } else {
user = 'world'; user = 'world';
} }
client.sayHello({name: user}, function(err, response) {
console.log('Greeting:', response.message); var request = new hello_messages.HelloRequest();
request.setName(user);
client.sayHello(request, function(err, response) {
if (err) {
debugger;
throw err;
}
console.log('Greeting:', response.getMessage());
}); });
} }

@ -31,16 +31,18 @@
* *
*/ */
var PROTO_PATH = __dirname + '/../protos/helloworld.proto';
var grpc = require('grpc'); var grpc = require('grpc');
var hello_proto = grpc.load(PROTO_PATH).helloworld;
var hello_messages = require('./helloworld_pb');
var hello_service = require('./helloworld_grpc_pb');
/** /**
* Implements the SayHello RPC method. * Implements the SayHello RPC method.
*/ */
function sayHello(call, callback) { function sayHello(call, callback) {
callback(null, {message: 'Hello ' + call.request.name}); var reply = new hello_messages.HelloReply();
reply.setMessage("Hello " + call.request.getName());
callback(null, reply);
} }
/** /**
@ -49,7 +51,7 @@ function sayHello(call, callback) {
*/ */
function main() { function main() {
var server = new grpc.Server(); var server = new grpc.Server();
server.addProtoService(hello_proto.Greeter.service, {sayHello: sayHello}); server.addService(hello_service.GreeterService, {sayHello: sayHello});
server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure()); server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure());
server.start(); server.start();
} }

@ -0,0 +1,39 @@
// GENERATED CODE -- DO NOT EDIT!
var grpc = require('grpc');
var helloworld_pb = require('./helloworld_pb.js');
function serialize_HelloReply(arg) {
if (!(arg instanceof helloworld_pb.HelloReply)) {
throw new Error('Expected argument of type HelloReply');
}
return new Buffer(arg.serializeBinary());
}
function deserialize_HelloReply(buffer_arg) {
return helloworld_pb.HelloReply.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_HelloRequest(arg) {
if (!(arg instanceof helloworld_pb.HelloRequest)) {
throw new Error('Expected argument of type HelloRequest');
}
return new Buffer(arg.serializeBinary());
}
function deserialize_HelloRequest(buffer_arg) {
return helloworld_pb.HelloRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
var GreeterService = exports.GreeterService = {
sayHello: {
path: '/helloworld.Greeter/SayHello',
requestStream: false,
responseStream: false,
requestType: helloworld_pb.HelloRequest,
responseType: helloworld_pb.HelloReply,
requestSerialize: serialize_HelloRequest,
requestDeserialize: deserialize_HelloRequest,
responseSerialize: serialize_HelloReply,
responseDeserialize: deserialize_HelloReply,
},
};
exports.GreeterClient = grpc.makeGenericClientConstructor(GreeterService);

@ -0,0 +1,332 @@
/**
* @fileoverview
* @enhanceable
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
goog.exportSymbol('proto.helloworld.HelloReply', null, global);
goog.exportSymbol('proto.helloworld.HelloRequest', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.helloworld.HelloRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.helloworld.HelloRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.helloworld.HelloRequest.displayName = 'proto.helloworld.HelloRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.helloworld.HelloRequest.prototype.toObject = function(opt_includeInstance) {
return proto.helloworld.HelloRequest.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.helloworld.HelloRequest} msg The msg instance to transform.
* @return {!Object}
*/
proto.helloworld.HelloRequest.toObject = function(includeInstance, msg) {
var f, obj = {
name: msg.getName()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.helloworld.HelloRequest}
*/
proto.helloworld.HelloRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.helloworld.HelloRequest;
return proto.helloworld.HelloRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.helloworld.HelloRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.helloworld.HelloRequest}
*/
proto.helloworld.HelloRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.helloworld.HelloRequest} message
* @param {!jspb.BinaryWriter} writer
*/
proto.helloworld.HelloRequest.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.helloworld.HelloRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.helloworld.HelloRequest.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.helloworld.HelloRequest} The clone.
*/
proto.helloworld.HelloRequest.prototype.cloneMessage = function() {
return /** @type {!proto.helloworld.HelloRequest} */ (jspb.Message.cloneMessage(this));
};
/**
* optional string name = 1;
* @return {string}
*/
proto.helloworld.HelloRequest.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, ""));
};
/** @param {string} value */
proto.helloworld.HelloRequest.prototype.setName = function(value) {
jspb.Message.setField(this, 1, value);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.helloworld.HelloReply = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.helloworld.HelloReply, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.helloworld.HelloReply.displayName = 'proto.helloworld.HelloReply';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.helloworld.HelloReply.prototype.toObject = function(opt_includeInstance) {
return proto.helloworld.HelloReply.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.helloworld.HelloReply} msg The msg instance to transform.
* @return {!Object}
*/
proto.helloworld.HelloReply.toObject = function(includeInstance, msg) {
var f, obj = {
message: msg.getMessage()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.helloworld.HelloReply}
*/
proto.helloworld.HelloReply.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.helloworld.HelloReply;
return proto.helloworld.HelloReply.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.helloworld.HelloReply} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.helloworld.HelloReply}
*/
proto.helloworld.HelloReply.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setMessage(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.helloworld.HelloReply} message
* @param {!jspb.BinaryWriter} writer
*/
proto.helloworld.HelloReply.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.helloworld.HelloReply.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.helloworld.HelloReply.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getMessage();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.helloworld.HelloReply} The clone.
*/
proto.helloworld.HelloReply.prototype.cloneMessage = function() {
return /** @type {!proto.helloworld.HelloReply} */ (jspb.Message.cloneMessage(this));
};
/**
* optional string message = 1;
* @return {string}
*/
proto.helloworld.HelloReply.prototype.getMessage = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, ""));
};
/** @param {string} value */
proto.helloworld.HelloReply.prototype.setMessage = function(value) {
jspb.Message.setField(this, 1, value);
};
goog.object.extend(exports, proto.helloworld);

@ -4,6 +4,7 @@
"dependencies": { "dependencies": {
"async": "^1.5.2", "async": "^1.5.2",
"grpc": "0.13.0", "grpc": "0.13.0",
"google-protobuf": "*",
"lodash": "^4.6.1", "lodash": "^4.6.1",
"minimist": "^1.2.0" "minimist": "^1.2.0"
} }

@ -323,7 +323,9 @@ Pod::Spec.new do |s|
'include/grpc/impl/codegen/sync_win32.h', 'include/grpc/impl/codegen/sync_win32.h',
'include/grpc/impl/codegen/time.h', 'include/grpc/impl/codegen/time.h',
'include/grpc/grpc_security.h', 'include/grpc/grpc_security.h',
'include/grpc/grpc_security_constants.h',
'include/grpc/census.h', 'include/grpc/census.h',
'src/core/lib/surface/init.c',
'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_args.c',
'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack.c',
'src/core/lib/channel/channel_stack_builder.c', 'src/core/lib/channel/channel_stack_builder.c',
@ -393,7 +395,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/channel_stack_type.c', 'src/core/lib/surface/channel_stack_type.c',
'src/core/lib/surface/completion_queue.c', 'src/core/lib/surface/completion_queue.c',
'src/core/lib/surface/event_string.c', 'src/core/lib/surface/event_string.c',
'src/core/lib/surface/init.c',
'src/core/lib/surface/lame_client.c', 'src/core/lib/surface/lame_client.c',
'src/core/lib/surface/metadata_array.c', 'src/core/lib/surface/metadata_array.c',
'src/core/lib/surface/server.c', 'src/core/lib/surface/server.c',

@ -114,6 +114,7 @@ EXPORTS
grpc_secure_channel_create grpc_secure_channel_create
grpc_server_credentials_release grpc_server_credentials_release
grpc_ssl_server_credentials_create grpc_ssl_server_credentials_create
grpc_ssl_server_credentials_create_ex
grpc_server_add_secure_http2_port grpc_server_add_secure_http2_port
grpc_call_set_credentials grpc_call_set_credentials
grpc_server_credentials_set_auth_metadata_processor grpc_server_credentials_set_auth_metadata_processor

@ -24,10 +24,6 @@ Gem::Specification.new do |s|
s.files += Dir.glob('include/grpc/**/*') s.files += Dir.glob('include/grpc/**/*')
s.test_files = Dir.glob('src/ruby/spec/**/*') s.test_files = Dir.glob('src/ruby/spec/**/*')
s.bindir = 'src/ruby/bin' s.bindir = 'src/ruby/bin'
%w(math noproto).each do |b|
s.executables += ["#{b}_client.rb", "#{b}_server.rb"]
end
s.executables += %w(grpc_ruby_interop_client grpc_ruby_interop_server)
s.require_paths = %w( src/ruby/bin src/ruby/lib src/ruby/pb ) s.require_paths = %w( src/ruby/bin src/ruby/lib src/ruby/pb )
s.platform = Gem::Platform::RUBY s.platform = Gem::Platform::RUBY
@ -171,6 +167,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/sync_win32.h ) s.files += %w( include/grpc/impl/codegen/sync_win32.h )
s.files += %w( include/grpc/impl/codegen/time.h ) s.files += %w( include/grpc/impl/codegen/time.h )
s.files += %w( include/grpc/grpc_security.h ) s.files += %w( include/grpc/grpc_security.h )
s.files += %w( include/grpc/grpc_security_constants.h )
s.files += %w( include/grpc/census.h ) s.files += %w( include/grpc/census.h )
s.files += %w( src/core/lib/channel/channel_args.h ) s.files += %w( src/core/lib/channel/channel_args.h )
s.files += %w( src/core/lib/channel/channel_stack.h ) s.files += %w( src/core/lib/channel/channel_stack.h )
@ -308,6 +305,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/census/grpc_filter.h ) s.files += %w( src/core/ext/census/grpc_filter.h )
s.files += %w( src/core/ext/census/mlog.h ) s.files += %w( src/core/ext/census/mlog.h )
s.files += %w( src/core/ext/census/rpc_metric_id.h ) s.files += %w( src/core/ext/census/rpc_metric_id.h )
s.files += %w( src/core/lib/surface/init.c )
s.files += %w( src/core/lib/channel/channel_args.c ) s.files += %w( src/core/lib/channel/channel_args.c )
s.files += %w( src/core/lib/channel/channel_stack.c ) s.files += %w( src/core/lib/channel/channel_stack.c )
s.files += %w( src/core/lib/channel/channel_stack_builder.c ) s.files += %w( src/core/lib/channel/channel_stack_builder.c )
@ -377,7 +375,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/channel_stack_type.c ) s.files += %w( src/core/lib/surface/channel_stack_type.c )
s.files += %w( src/core/lib/surface/completion_queue.c ) s.files += %w( src/core/lib/surface/completion_queue.c )
s.files += %w( src/core/lib/surface/event_string.c ) s.files += %w( src/core/lib/surface/event_string.c )
s.files += %w( src/core/lib/surface/init.c )
s.files += %w( src/core/lib/surface/lame_client.c ) s.files += %w( src/core/lib/surface/lame_client.c )
s.files += %w( src/core/lib/surface/metadata_array.c ) s.files += %w( src/core/lib/surface/metadata_array.c )
s.files += %w( src/core/lib/surface/server.c ) s.files += %w( src/core/lib/surface/server.c )

@ -55,6 +55,7 @@
#include <grpc++/impl/codegen/config.h> #include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/core_codegen_interface.h> #include <grpc++/impl/codegen/core_codegen_interface.h>
#include <grpc++/impl/codegen/create_auth_context.h>
#include <grpc++/impl/codegen/security/auth_context.h> #include <grpc++/impl/codegen/security/auth_context.h>
#include <grpc++/impl/codegen/status.h> #include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/string_ref.h> #include <grpc++/impl/codegen/string_ref.h>
@ -244,7 +245,12 @@ class ClientContext {
/// Return the authentication context for this client call. /// Return the authentication context for this client call.
/// ///
/// \see grpc::AuthContext. /// \see grpc::AuthContext.
std::shared_ptr<const AuthContext> auth_context() const; std::shared_ptr<const AuthContext> auth_context() const {
if (auth_context_.get() == nullptr) {
auth_context_ = CreateAuthContext(call_);
}
return auth_context_;
}
/// Set credentials for the client call. /// Set credentials for the client call.
/// ///

@ -30,13 +30,19 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
#ifndef GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
#define GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H
#include <memory> #include <memory>
#include <grpc++/security/auth_context.h> #include <grpc++/impl/codegen/security/auth_context.h>
#include <grpc/grpc.h> #include <grpc/impl/codegen/grpc_types.h>
namespace grpc { namespace grpc {
std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call); std::shared_ptr<const AuthContext> CreateAuthContext(grpc_call* call);
} // namespace grpc } // namespace grpc
#endif // GRPCXX_IMPL_CODEGEN_CREATE_AUTH_CONTEXT_H

@ -38,6 +38,7 @@
#include <memory> #include <memory>
#include <grpc++/impl/codegen/config.h> #include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/create_auth_context.h>
#include <grpc++/impl/codegen/security/auth_context.h> #include <grpc++/impl/codegen/security/auth_context.h>
#include <grpc++/impl/codegen/string_ref.h> #include <grpc++/impl/codegen/string_ref.h>
#include <grpc++/impl/codegen/time.h> #include <grpc++/impl/codegen/time.h>
@ -135,7 +136,12 @@ class ServerContext {
} }
void set_compression_algorithm(grpc_compression_algorithm algorithm); void set_compression_algorithm(grpc_compression_algorithm algorithm);
std::shared_ptr<const AuthContext> auth_context() const; std::shared_ptr<const AuthContext> auth_context() const {
if (auth_context_.get() == nullptr) {
auth_context_ = CreateAuthContext(call_);
}
return auth_context_;
}
// Return the peer uri in a string. // Return the peer uri in a string.
// WARNING: this value is never authenticated or subject to any security // WARNING: this value is never authenticated or subject to any security
@ -193,7 +199,7 @@ class ServerContext {
ServerContext(gpr_timespec deadline, grpc_metadata* metadata, ServerContext(gpr_timespec deadline, grpc_metadata* metadata,
size_t metadata_count); size_t metadata_count);
void set_call(grpc_call* call); void set_call(grpc_call* call) { call_ = call; }
uint32_t initial_metadata_flags() const { return 0; } uint32_t initial_metadata_flags() const { return 0; }

@ -39,6 +39,7 @@
#include <grpc++/security/auth_metadata_processor.h> #include <grpc++/security/auth_metadata_processor.h>
#include <grpc++/support/config.h> #include <grpc++/support/config.h>
#include <grpc/grpc_security_constants.h>
struct grpc_server; struct grpc_server;
@ -69,7 +70,13 @@ class ServerCredentials {
/// Options to create ServerCredentials with SSL /// Options to create ServerCredentials with SSL
struct SslServerCredentialsOptions { struct SslServerCredentialsOptions {
SslServerCredentialsOptions() : force_client_auth(false) {} // Deprecated
SslServerCredentialsOptions()
: force_client_auth(false),
client_certificate_request(GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE) {}
SslServerCredentialsOptions(
grpc_ssl_client_certificate_request_type request_type)
: force_client_auth(false), client_certificate_request(request_type) {}
struct PemKeyCertPair { struct PemKeyCertPair {
grpc::string private_key; grpc::string private_key;
@ -77,7 +84,13 @@ struct SslServerCredentialsOptions {
}; };
grpc::string pem_root_certs; grpc::string pem_root_certs;
std::vector<PemKeyCertPair> pem_key_cert_pairs; std::vector<PemKeyCertPair> pem_key_cert_pairs;
// Deprecated
bool force_client_auth; bool force_client_auth;
// If both force_client_auth and client_certificate_request fields are set,
// force_client_auth takes effect i.e
// REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY will be enforced.
grpc_ssl_client_certificate_request_type client_certificate_request;
}; };
/// Builds SSL ServerCredentials given SSL specific options /// Builds SSL ServerCredentials given SSL specific options

@ -35,6 +35,7 @@
#define GRPC_GRPC_SECURITY_H #define GRPC_GRPC_SECURITY_H
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security_constants.h>
#include <grpc/status.h> #include <grpc/status.h>
#ifdef __cplusplus #ifdef __cplusplus
@ -43,13 +44,6 @@ extern "C" {
/* --- Authentication Context. --- */ /* --- Authentication Context. --- */
#define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME "transport_security_type"
#define GRPC_SSL_TRANSPORT_SECURITY_TYPE "ssl"
#define GRPC_X509_CN_PROPERTY_NAME "x509_common_name"
#define GRPC_X509_SAN_PROPERTY_NAME "x509_subject_alternative_name"
#define GRPC_X509_PEM_CERT_PROPERTY_NAME "x509_pem_cert"
typedef struct grpc_auth_context grpc_auth_context; typedef struct grpc_auth_context grpc_auth_context;
typedef struct grpc_auth_property_iterator { typedef struct grpc_auth_property_iterator {
@ -130,29 +124,11 @@ typedef struct grpc_channel_credentials grpc_channel_credentials;
The creator of the credentials object is responsible for its release. */ The creator of the credentials object is responsible for its release. */
GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials *creds); GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials *creds);
/* Environment variable that points to the google default application
credentials json key or refresh token. Used in the
grpc_google_default_credentials_create function. */
#define GRPC_GOOGLE_CREDENTIALS_ENV_VAR "GOOGLE_APPLICATION_CREDENTIALS"
/* Creates default credentials to connect to a google gRPC service. /* Creates default credentials to connect to a google gRPC service.
WARNING: Do NOT use this credentials to connect to a non-google service as WARNING: Do NOT use this credentials to connect to a non-google service as
this could result in an oauth2 token leak. */ this could result in an oauth2 token leak. */
GRPCAPI grpc_channel_credentials *grpc_google_default_credentials_create(void); GRPCAPI grpc_channel_credentials *grpc_google_default_credentials_create(void);
/* Environment variable that points to the default SSL roots file. This file
must be a PEM encoded file with all the roots such as the one that can be
downloaded from https://pki.google.com/roots.pem. */
#define GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR \
"GRPC_DEFAULT_SSL_ROOTS_FILE_PATH"
/* Results for the SSL roots override callback. */
typedef enum {
GRPC_SSL_ROOTS_OVERRIDE_OK,
GRPC_SSL_ROOTS_OVERRIDE_FAIL_PERMANENTLY, /* Do not try fallback options. */
GRPC_SSL_ROOTS_OVERRIDE_FAIL
} grpc_ssl_roots_override_result;
/* Callback for getting the SSL roots override from the application. /* Callback for getting the SSL roots override from the application.
In case of success, *pem_roots_certs must be set to a NULL terminated string In case of success, *pem_roots_certs must be set to a NULL terminated string
containing the list of PEM encoded root certificates. The ownership is passed containing the list of PEM encoded root certificates. The ownership is passed
@ -334,7 +310,8 @@ typedef struct grpc_server_credentials grpc_server_credentials;
*/ */
GRPCAPI void grpc_server_credentials_release(grpc_server_credentials *creds); GRPCAPI void grpc_server_credentials_release(grpc_server_credentials *creds);
/* Creates an SSL server_credentials object. /* Deprecated in favor of grpc_ssl_server_credentials_create_ex.
Creates an SSL server_credentials object.
- pem_roots_cert is the NULL-terminated string containing the PEM encoding of - pem_roots_cert is the NULL-terminated string containing the PEM encoding of
the client root certificates. This parameter may be NULL if the server does the client root certificates. This parameter may be NULL if the server does
not want the client to be authenticated with SSL. not want the client to be authenticated with SSL.
@ -349,6 +326,15 @@ GRPCAPI grpc_server_credentials *grpc_ssl_server_credentials_create(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
size_t num_key_cert_pairs, int force_client_auth, void *reserved); size_t num_key_cert_pairs, int force_client_auth, void *reserved);
/* Same as grpc_ssl_server_credentials_create method except uses
grpc_ssl_client_certificate_request_type enum to support more ways to
authenticate client cerificates.*/
GRPCAPI grpc_server_credentials *grpc_ssl_server_credentials_create_ex(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
size_t num_key_cert_pairs,
grpc_ssl_client_certificate_request_type client_certificate_request,
void *reserved);
/* --- Server-side secure ports. --- */ /* --- Server-side secure ports. --- */
/* Add a HTTP2 over an encrypted link over tcp listener. /* Add a HTTP2 over an encrypted link over tcp listener.

@ -0,0 +1,114 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_GRPC_SECURITY_CONSTANTS_H
#define GRPC_GRPC_SECURITY_CONSTANTS_H
#ifdef __cplusplus
extern "C" {
#endif
#define GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME "transport_security_type"
#define GRPC_SSL_TRANSPORT_SECURITY_TYPE "ssl"
#define GRPC_X509_CN_PROPERTY_NAME "x509_common_name"
#define GRPC_X509_SAN_PROPERTY_NAME "x509_subject_alternative_name"
#define GRPC_X509_PEM_CERT_PROPERTY_NAME "x509_pem_cert"
/* Environment variable that points to the default SSL roots file. This file
must be a PEM encoded file with all the roots such as the one that can be
downloaded from https://pki.google.com/roots.pem. */
#define GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR \
"GRPC_DEFAULT_SSL_ROOTS_FILE_PATH"
/* Environment variable that points to the google default application
credentials json key or refresh token. Used in the
grpc_google_default_credentials_create function. */
#define GRPC_GOOGLE_CREDENTIALS_ENV_VAR "GOOGLE_APPLICATION_CREDENTIALS"
/* Results for the SSL roots override callback. */
typedef enum {
GRPC_SSL_ROOTS_OVERRIDE_OK,
GRPC_SSL_ROOTS_OVERRIDE_FAIL_PERMANENTLY, /* Do not try fallback options. */
GRPC_SSL_ROOTS_OVERRIDE_FAIL
} grpc_ssl_roots_override_result;
typedef enum {
/* Server does not request client certificate. A client can present a self
signed or signed certificates if it wishes to do so and they would be
accepted. */
GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
/* Server requests client certificate but does not enforce that the client
presents a certificate.
If the client presents a certificate, the client authentication is left to
the application based on the metadata like certificate etc.
The key cert pair should still be valid for the SSL connection to be
established. */
GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
/* Server requests client certificate but does not enforce that the client
presents a certificate.
If the client presents a certificate, the client authentication is done by
grpc framework (The client needs to either present a signed cert or skip no
certificate for a successful connection).
The key cert pair should still be valid for the SSL connection to be
established. */
GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY,
/* Server requests client certificate but enforces that the client presents a
certificate.
If the client presents a certificate, the client authentication is left to
the application based on the metadata like certificate etc.
The key cert pair should still be valid for the SSL connection to be
established. */
GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
/* Server requests client certificate but enforces that the client presents a
certificate.
The cerificate presented by the client is verified by grpc framework (The
client needs to present signed certs for a successful connection).
The key cert pair should still be valid for the SSL connection to be
established. */
GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
} grpc_ssl_client_certificate_request_type;
#ifdef __cplusplus
}
#endif
#endif /* GRPC_GRPC_SECURITY_CONSTANTS_H */

@ -19,7 +19,7 @@
"lib": "src/node/src" "lib": "src/node/src"
}, },
"scripts": { "scripts": {
"lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js", "lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js --exclude-path=src/node/.jshintignore",
"test": "./node_modules/.bin/mocha src/node/test && npm run-script lint", "test": "./node_modules/.bin/mocha src/node/test && npm run-script lint",
"gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json", "gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test",
@ -35,6 +35,7 @@
"devDependencies": { "devDependencies": {
"async": "^1.5.0", "async": "^1.5.0",
"google-auth-library": "^0.9.2", "google-auth-library": "^0.9.2",
"google-protobuf": "^3.0.0-alpha.5",
"istanbul": "^0.3.21", "istanbul": "^0.3.21",
"jsdoc": "^3.3.2", "jsdoc": "^3.3.2",
"jshint": "^2.5.0", "jshint": "^2.5.0",
@ -72,5 +73,25 @@
"binding.gyp" "binding.gyp"
], ],
"main": "src/node/index.js", "main": "src/node/index.js",
"license": "BSD-3-Clause" "license": "BSD-3-Clause",
"jshintConfig" : {
"bitwise": true,
"curly": true,
"eqeqeq": true,
"esnext": true,
"freeze": true,
"immed": true,
"indent": 2,
"latedef": "nofunc",
"maxlen": 80,
"mocha": true,
"newcap": true,
"node": true,
"noarg": true,
"quotmark": "single",
"strict": true,
"trailing": true,
"undef": true,
"unused": "vars"
}
} }

@ -174,6 +174,7 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_win32.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/sync_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/time.h" role="src" /> <file baseinstalldir="/" name="include/grpc/impl/codegen/time.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc_security.h" role="src" /> <file baseinstalldir="/" name="include/grpc/grpc_security.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc_security_constants.h" role="src" />
<file baseinstalldir="/" name="include/grpc/census.h" role="src" /> <file baseinstalldir="/" name="include/grpc/census.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/channel_args.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/channel_stack.h" role="src" />
@ -311,6 +312,7 @@
<file baseinstalldir="/" name="src/core/ext/census/grpc_filter.h" role="src" /> <file baseinstalldir="/" name="src/core/ext/census/grpc_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/mlog.h" role="src" /> <file baseinstalldir="/" name="src/core/ext/census/mlog.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/rpc_metric_id.h" role="src" /> <file baseinstalldir="/" name="src/core/ext/census/rpc_metric_id.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/init.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/channel_args.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/channel_stack.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder.c" role="src" />
@ -380,7 +382,6 @@
<file baseinstalldir="/" name="src/core/lib/surface/channel_stack_type.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/channel_stack_type.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/completion_queue.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/completion_queue.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/event_string.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/event_string.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/init.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/lame_client.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/lame_client.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/metadata_array.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/metadata_array.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/server.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/surface/server.c" role="src" />

@ -1,7 +1,8 @@
# GRPC Python setup requirements # GRPC Python setup requirements
coverage>=4.0
cython>=0.23
enum34>=1.0.4 enum34>=1.0.4
futures>=2.2.0 futures>=2.2.0
cython>=0.23 protobuf>=3.0.0a3
coverage>=4.0
six>=1.10 six>=1.10
wheel>=0.29 wheel>=0.29

@ -86,7 +86,7 @@ void PrintIncludes(Printer *printer, const std::vector<grpc::string>& headers, c
} }
} }
grpc::string GetHeaderPrologue(File *file, const Parameters &params) { grpc::string GetHeaderPrologue(File *file, const Parameters & /*params*/) {
grpc::string output; grpc::string output;
{ {
// Scope the output stream so it closes and finalizes output to the string. // Scope the output stream so it closes and finalizes output to the string.
@ -96,6 +96,7 @@ grpc::string GetHeaderPrologue(File *file, const Parameters &params) {
vars["filename"] = file->filename(); vars["filename"] = file->filename();
vars["filename_identifier"] = FilenameIdentifier(file->filename()); vars["filename_identifier"] = FilenameIdentifier(file->filename());
vars["filename_base"] = file->filename_without_ext(); vars["filename_base"] = file->filename_without_ext();
vars["message_header_ext"] = file->message_header_ext();
printer->Print(vars, "// Generated by the gRPC protobuf plugin.\n"); printer->Print(vars, "// Generated by the gRPC protobuf plugin.\n");
printer->Print(vars, printer->Print(vars,
@ -109,7 +110,7 @@ grpc::string GetHeaderPrologue(File *file, const Parameters &params) {
printer->Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n"); printer->Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n");
printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n"); printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n");
printer->Print(vars, "\n"); printer->Print(vars, "\n");
printer->Print(vars, "#include \"$filename_base$.pb.h\"\n"); printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
printer->Print(vars, "\n"); printer->Print(vars, "\n");
} }
return output; return output;
@ -805,8 +806,7 @@ grpc::string GetHeaderServices(File *file,
return output; return output;
} }
grpc::string GetHeaderEpilogue(File *file, grpc::string GetHeaderEpilogue(File *file, const Parameters & /*params*/) {
const Parameters &params) {
grpc::string output; grpc::string output;
{ {
// Scope the output stream so it closes and finalizes output to the string. // Scope the output stream so it closes and finalizes output to the string.
@ -834,8 +834,7 @@ grpc::string GetHeaderEpilogue(File *file,
return output; return output;
} }
grpc::string GetSourcePrologue(File *file, grpc::string GetSourcePrologue(File *file, const Parameters & /*params*/) {
const Parameters &params) {
grpc::string output; grpc::string output;
{ {
// Scope the output stream so it closes and finalizes output to the string. // Scope the output stream so it closes and finalizes output to the string.
@ -844,14 +843,17 @@ grpc::string GetSourcePrologue(File *file,
vars["filename"] = file->filename(); vars["filename"] = file->filename();
vars["filename_base"] = file->filename_without_ext(); vars["filename_base"] = file->filename_without_ext();
vars["message_header_ext"] = file->message_header_ext();
vars["service_header_ext"] = file->service_header_ext();
printer->Print(vars, "// Generated by the gRPC protobuf plugin.\n"); printer->Print(vars, "// Generated by the gRPC protobuf plugin.\n");
printer->Print(vars, printer->Print(vars,
"// If you make any local change, they will be lost.\n"); "// If you make any local change, they will be lost.\n");
printer->Print(vars, "// source: $filename$\n\n"); printer->Print(vars, "// source: $filename$\n\n");
printer->Print(vars, "#include \"$filename_base$.pb.h\"\n"); printer->Print(vars, "#include \"$filename_base$$message_header_ext$\"\n");
printer->Print(vars, "#include \"$filename_base$.grpc.pb.h\"\n"); printer->Print(vars, "#include \"$filename_base$$service_header_ext$\"\n");
printer->Print(vars, file->additional_headers().c_str());
printer->Print(vars, "\n"); printer->Print(vars, "\n");
} }
return output; return output;
@ -1194,8 +1196,7 @@ grpc::string GetSourceServices(File *file,
return output; return output;
} }
grpc::string GetSourceEpilogue(File *file, grpc::string GetSourceEpilogue(File *file, const Parameters & /*params*/) {
const Parameters &params) {
grpc::string temp; grpc::string temp;
if (!file->package().empty()) { if (!file->package().empty()) {

@ -114,8 +114,11 @@ struct File : public CommentHolder {
virtual grpc::string filename() const = 0; virtual grpc::string filename() const = 0;
virtual grpc::string filename_without_ext() const = 0; virtual grpc::string filename_without_ext() const = 0;
virtual grpc::string message_header_ext() const = 0;
virtual grpc::string service_header_ext() const = 0;
virtual grpc::string package() const = 0; virtual grpc::string package() const = 0;
virtual std::vector<grpc::string> package_parts() const = 0; virtual std::vector<grpc::string> package_parts() const = 0;
virtual grpc::string additional_headers() const = 0;
virtual int service_count() const = 0; virtual int service_count() const = 0;
virtual std::unique_ptr<const Service> service(int i) const = 0; virtual std::unique_ptr<const Service> service(int i) const = 0;

@ -140,11 +140,16 @@ class ProtoBufFile : public grpc_cpp_generator::File {
return grpc_generator::StripProto(filename()); return grpc_generator::StripProto(filename());
} }
grpc::string message_header_ext() const { return ".pb.h"; }
grpc::string service_header_ext() const { return ".grpc.pb.h"; }
grpc::string package() const { return file_->package(); } grpc::string package() const { return file_->package(); }
std::vector<grpc::string> package_parts() const { std::vector<grpc::string> package_parts() const {
return grpc_generator::tokenize(package(), "."); return grpc_generator::tokenize(package(), ".");
} }
grpc::string additional_headers() const { return ""; }
int service_count() const { return file_->service_count(); }; int service_count() const { return file_->service_count(); };
std::unique_ptr<const grpc_cpp_generator::Service> service(int i) const { std::unique_ptr<const grpc_cpp_generator::Service> service(int i) const {
return std::unique_ptr<const grpc_cpp_generator::Service> ( return std::unique_ptr<const grpc_cpp_generator::Service> (

@ -56,6 +56,16 @@ inline bool StripSuffix(grpc::string *filename, const grpc::string &suffix) {
return false; return false;
} }
inline bool StripPrefix(grpc::string *name, const grpc::string &prefix) {
if (name->length() >= prefix.length()) {
if (name->substr(0, prefix.size()) == prefix) {
*name = name->substr(prefix.size());
return true;
}
}
return false;
}
inline grpc::string StripProto(grpc::string filename) { inline grpc::string StripProto(grpc::string filename) {
if (!StripSuffix(&filename, ".protodevel")) { if (!StripSuffix(&filename, ".protodevel")) {
StripSuffix(&filename, ".proto"); StripSuffix(&filename, ".proto");

@ -0,0 +1,277 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <map>
#include "src/compiler/config.h"
#include "src/compiler/generator_helpers.h"
#include "src/compiler/node_generator_helpers.h"
using grpc::protobuf::FileDescriptor;
using grpc::protobuf::ServiceDescriptor;
using grpc::protobuf::MethodDescriptor;
using grpc::protobuf::Descriptor;
using grpc::protobuf::io::Printer;
using grpc::protobuf::io::StringOutputStream;
using std::map;
namespace grpc_node_generator {
namespace {
// Returns the alias we assign to the module of the given .proto filename
// when importing. Copied entirely from
// github:google/protobuf/src/google/protobuf/compiler/js/js_generator.cc#L154
grpc::string ModuleAlias(const grpc::string filename) {
// This scheme could technically cause problems if a file includes any 2 of:
// foo/bar_baz.proto
// foo_bar_baz.proto
// foo_bar/baz.proto
//
// We'll worry about this problem if/when we actually see it. This name isn't
// exposed to users so we can change it later if we need to.
grpc::string basename = grpc_generator::StripProto(filename);
basename = grpc_generator::StringReplace(basename, "-", "$");
basename = grpc_generator::StringReplace(basename, "/", "_");
return basename + "_pb";
}
// Given a filename like foo/bar/baz.proto, returns the corresponding JavaScript
// message file foo/bar/baz.js
grpc::string GetJSMessageFilename(const grpc::string& filename) {
grpc::string name = filename;
return grpc_generator::StripProto(name) + "_pb.js";
}
// Given a filename like foo/bar/baz.proto, returns the root directory
// path ../../
grpc::string GetRootPath(const grpc::string& filename) {
size_t slashes = std::count(filename.begin(), filename.end(), '/');
if (slashes == 0) {
return "./";
}
grpc::string result = "";
for (size_t i = 0; i < slashes; i++) {
result += "../";
}
return result;
}
// Return the relative path to load to_file from the directory containing
// from_file, assuming that both paths are relative to the same directory
grpc::string GetRelativePath(const grpc::string& from_file,
const grpc::string& to_file) {
return GetRootPath(from_file) + to_file;
}
/* Finds all message types used in all services in the file, and returns them
* as a map of fully qualified message type name to message descriptor */
map<grpc::string, const Descriptor*> GetAllMessages(const FileDescriptor *file) {
map<grpc::string, const Descriptor*> message_types;
for (int service_num = 0; service_num < file->service_count(); service_num++) {
const ServiceDescriptor* service = file->service(service_num);
for (int method_num = 0; method_num < service->method_count(); method_num++) {
const MethodDescriptor* method = service->method(method_num);
const Descriptor* input_type = method->input_type();
const Descriptor* output_type = method->output_type();
message_types[input_type->name()] = input_type;
message_types[output_type->name()] = output_type;
}
}
return message_types;
}
grpc::string MessageIdentifierName(const grpc::string& name) {
return grpc_generator::StringReplace(name, ".", "_");
}
grpc::string NodeObjectPath(const Descriptor *descriptor) {
grpc::string module_alias = ModuleAlias(descriptor->file()->name());
grpc::string name = descriptor->name();
grpc_generator::StripPrefix(&name, descriptor->file()->package() + ".");
return module_alias + "." + name;
}
// Prints out the message serializer and deserializer functions
void PrintMessageTransformer(const Descriptor *descriptor, Printer *out) {
map<grpc::string, grpc::string> template_vars;
template_vars["identifier_name"] = MessageIdentifierName(descriptor->name());
template_vars["name"] = descriptor->name();
template_vars["node_name"] = NodeObjectPath(descriptor);
// Print the serializer
out->Print(template_vars, "function serialize_$identifier_name$(arg) {\n");
out->Indent();
out->Print(template_vars, "if (!(arg instanceof $node_name$)) {\n");
out->Indent();
out->Print(template_vars,
"throw new Error('Expected argument of type $name$');\n");
out->Outdent();
out->Print("}\n");
out->Print("return new Buffer(arg.serializeBinary());\n");
out->Outdent();
out->Print("}\n\n");
// Print the deserializer
out->Print(template_vars,
"function deserialize_$identifier_name$(buffer_arg) {\n");
out->Indent();
out->Print(
template_vars,
"return $node_name$.deserializeBinary(new Uint8Array(buffer_arg));\n");
out->Outdent();
out->Print("}\n\n");
}
void PrintMethod(const MethodDescriptor *method, Printer *out) {
const Descriptor *input_type = method->input_type();
const Descriptor *output_type = method->output_type();
map<grpc::string, grpc::string> vars;
vars["service_name"] = method->service()->full_name();
vars["name"] = method->name();
vars["input_type"] = NodeObjectPath(input_type);
vars["input_type_id"] = MessageIdentifierName(input_type->name());
vars["output_type"] = NodeObjectPath(output_type);
vars["output_type_id"] = MessageIdentifierName(output_type->name());
vars["client_stream"] = method->client_streaming() ? "true" : "false";
vars["server_stream"] = method->server_streaming() ? "true" : "false";
out->Print("{\n");
out->Indent();
out->Print(vars, "path: '/$service_name$/$name$',\n");
out->Print(vars, "requestStream: $client_stream$,\n");
out->Print(vars, "responseStream: $server_stream$,\n");
out->Print(vars, "requestType: $input_type$,\n");
out->Print(vars, "responseType: $output_type$,\n");
out->Print(vars, "requestSerialize: serialize_$input_type_id$,\n");
out->Print(vars, "requestDeserialize: deserialize_$input_type_id$,\n");
out->Print(vars, "responseSerialize: serialize_$output_type_id$,\n");
out->Print(vars, "responseDeserialize: deserialize_$output_type_id$,\n");
out->Outdent();
out->Print("}");
}
// Prints out the service descriptor object
void PrintService(const ServiceDescriptor *service, Printer *out) {
map<grpc::string, grpc::string> template_vars;
template_vars["name"] = service->name();
out->Print(template_vars, "var $name$Service = exports.$name$Service = {\n");
out->Indent();
for (int i = 0; i < service->method_count(); i++) {
grpc::string method_name = grpc_generator::LowercaseFirstLetter(
service->method(i)->name());
out->Print("$method_name$: ",
"method_name", method_name);
PrintMethod(service->method(i), out);
out->Print(",\n");
}
out->Outdent();
out->Print("};\n\n");
out->Print(template_vars, "exports.$name$Client = "
"grpc.makeGenericClientConstructor($name$Service);\n");
}
}
grpc::string GetImports(const FileDescriptor *file) {
grpc::string output;
{
StringOutputStream output_stream(&output);
Printer out(&output_stream, '$');
if (file->service_count() == 0) {
return output;
}
out.Print("// GENERATED CODE -- DO NOT EDIT!\n\n");
out.Print("'use strict';\n");
out.Print("var grpc = require('grpc');\n");
if (file->message_type_count() > 0) {
grpc::string file_path = GetRelativePath(file->name(),
GetJSMessageFilename(
file->name()));
out.Print("var $module_alias$ = require('$file_path$');\n",
"module_alias", ModuleAlias(file->name()),
"file_path", file_path);
}
for (int i = 0; i < file->dependency_count(); i++) {
grpc::string file_path = GetRelativePath(
file->name(), GetJSMessageFilename(file->dependency(i)->name()));
out.Print("var $module_alias$ = require('$file_path$');\n",
"module_alias", ModuleAlias(file->dependency(i)->name()),
"file_path", file_path);
}
out.Print("\n");
}
return output;
}
grpc::string GetTransformers(const FileDescriptor *file) {
grpc::string output;
{
StringOutputStream output_stream(&output);
Printer out(&output_stream, '$');
if (file->service_count() == 0) {
return output;
}
map<grpc::string, const Descriptor*> messages = GetAllMessages(file);
for (std::map<grpc::string, const Descriptor*>::iterator it =
messages.begin();
it != messages.end(); it++) {
PrintMessageTransformer(it->second, &out);
}
out.Print("\n");
}
return output;
}
grpc::string GetServices(const FileDescriptor *file) {
grpc::string output;
{
StringOutputStream output_stream(&output);
Printer out(&output_stream, '$');
if (file->service_count() == 0) {
return output;
}
for (int i = 0; i < file->service_count(); i++) {
PrintService(file->service(i), &out);
}
}
return output;
}
} // namespace grpc_node_generator

@ -0,0 +1,49 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
#define GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H
#include "src/compiler/config.h"
namespace grpc_node_generator {
grpc::string GetImports(const grpc::protobuf::FileDescriptor *file);
grpc::string GetTransformers(const grpc::protobuf::FileDescriptor *file);
grpc::string GetServices(const grpc::protobuf::FileDescriptor *file);
} // namespace grpc_node_generator
#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_H

@ -0,0 +1,50 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
#define GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H
#include <algorithm>
#include "src/compiler/config.h"
#include "src/compiler/generator_helpers.h"
namespace grpc_node_generator {
inline grpc::string GetJSServiceFilename(const grpc::string& filename) {
return grpc_generator::StripProto(filename) + "_grpc_pb.js";
}
} // namespace grpc_node_generator
#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H

@ -0,0 +1,77 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// Generates Node gRPC service interface out of Protobuf IDL.
#include <memory>
#include "src/compiler/config.h"
#include "src/compiler/node_generator.h"
#include "src/compiler/node_generator_helpers.h"
using grpc_node_generator::GetImports;
using grpc_node_generator::GetJSServiceFilename;
using grpc_node_generator::GetServices;
using grpc_node_generator::GetTransformers;
class NodeGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
public:
NodeGrpcGenerator() {}
~NodeGrpcGenerator() {}
bool Generate(const grpc::protobuf::FileDescriptor *file,
const grpc::string &parameter,
grpc::protobuf::compiler::GeneratorContext *context,
grpc::string *error) const {
grpc::string code = GetImports(file) +
GetTransformers(file) +
GetServices(file);
if (code.size() == 0) {
return true;
}
// Get output file name
grpc::string file_name = GetJSServiceFilename(file->name());
std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> output(
context->Open(file_name));
grpc::protobuf::io::CodedOutputStream coded_out(output.get());
coded_out.WriteRaw(code.data(), code.size());
return true;
}
};
int main(int argc, char *argv[]) {
NodeGrpcGenerator generator;
return grpc::protobuf::compiler::PluginMain(argc, argv, &generator);
}

@ -205,7 +205,11 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
gpr_mu_lock(&chand->mu_config); gpr_mu_lock(&chand->mu_config);
old_lb_policy = chand->lb_policy; old_lb_policy = chand->lb_policy;
chand->lb_policy = lb_policy; chand->lb_policy = lb_policy;
if (lb_policy != NULL || chand->resolver == NULL /* disconnected */) { if (lb_policy != NULL) {
grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures,
NULL);
} else if (chand->resolver == NULL /* disconnected */) {
grpc_closure_list_fail_all(&chand->waiting_for_config_closures);
grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures, grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures,
NULL); NULL);
} }
@ -293,6 +297,11 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
grpc_resolver_shutdown(exec_ctx, chand->resolver); grpc_resolver_shutdown(exec_ctx, chand->resolver);
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel"); GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
chand->resolver = NULL; chand->resolver = NULL;
if (!chand->started_resolving) {
grpc_closure_list_fail_all(&chand->waiting_for_config_closures);
grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures,
NULL);
}
if (chand->lb_policy != NULL) { if (chand->lb_policy != NULL) {
grpc_pollset_set_del_pollset_set(exec_ctx, grpc_pollset_set_del_pollset_set(exec_ctx,
chand->lb_policy->interested_parties, chand->lb_policy->interested_parties,
@ -321,10 +330,10 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg, bool success) { static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
continue_picking_args *cpa = arg; continue_picking_args *cpa = arg;
if (!success) { if (cpa->connected_subchannel == NULL) {
grpc_exec_ctx_enqueue(exec_ctx, cpa->on_ready, false, NULL);
} else if (cpa->connected_subchannel == NULL) {
/* cancelled, do nothing */ /* cancelled, do nothing */
} else if (!success) {
grpc_exec_ctx_enqueue(exec_ctx, cpa->on_ready, false, NULL);
} else if (cc_pick_subchannel(exec_ctx, cpa->elem, cpa->initial_metadata, } else if (cc_pick_subchannel(exec_ctx, cpa->elem, cpa->initial_metadata,
cpa->initial_metadata_flags, cpa->initial_metadata_flags,
cpa->connected_subchannel, cpa->on_ready)) { cpa->connected_subchannel, cpa->on_ready)) {
@ -381,6 +390,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
&chand->incoming_configuration, &chand->incoming_configuration,
&chand->on_config_changed); &chand->on_config_changed);
} }
if (chand->resolver != NULL) {
cpa = gpr_malloc(sizeof(*cpa)); cpa = gpr_malloc(sizeof(*cpa));
cpa->initial_metadata = initial_metadata; cpa->initial_metadata = initial_metadata;
cpa->initial_metadata_flags = initial_metadata_flags; cpa->initial_metadata_flags = initial_metadata_flags;
@ -388,7 +398,11 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
cpa->on_ready = on_ready; cpa->on_ready = on_ready;
cpa->elem = elem; cpa->elem = elem;
grpc_closure_init(&cpa->closure, continue_picking, cpa); grpc_closure_init(&cpa->closure, continue_picking, cpa);
grpc_closure_list_add(&chand->waiting_for_config_closures, &cpa->closure, 1); grpc_closure_list_add(&chand->waiting_for_config_closures, &cpa->closure,
1);
} else {
grpc_exec_ctx_enqueue(exec_ctx, on_ready, false, NULL);
}
gpr_mu_unlock(&chand->mu_config); gpr_mu_unlock(&chand->mu_config);
return 0; return 0;
} }

@ -135,8 +135,6 @@ struct grpc_subchannel {
int have_alarm; int have_alarm;
/** our alarm */ /** our alarm */
grpc_timer alarm; grpc_timer alarm;
/** current random value */
uint32_t random;
}; };
struct grpc_subchannel_call { struct grpc_subchannel_call {
@ -297,10 +295,6 @@ void grpc_subchannel_weak_unref(grpc_exec_ctx *exec_ctx,
} }
} }
static uint32_t random_seed() {
return (uint32_t)(gpr_time_to_millis(gpr_now(GPR_CLOCK_MONOTONIC)));
}
grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx, grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
grpc_connector *connector, grpc_connector *connector,
grpc_subchannel_args *args) { grpc_subchannel_args *args) {
@ -332,7 +326,6 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
grpc_set_initial_connect_string(&c->addr, &c->addr_len, grpc_set_initial_connect_string(&c->addr, &c->addr_len,
&c->initial_connect_string); &c->initial_connect_string);
c->args = grpc_channel_args_copy(args->args); c->args = grpc_channel_args_copy(args->args);
c->random = random_seed();
c->root_external_state_watcher.next = c->root_external_state_watcher.prev = c->root_external_state_watcher.next = c->root_external_state_watcher.prev =
&c->root_external_state_watcher; &c->root_external_state_watcher;
grpc_closure_init(&c->connected, subchannel_connected, c); grpc_closure_init(&c->connected, subchannel_connected, c);

@ -252,9 +252,9 @@ char *grpc_subchannel_call_holder_get_peer(
grpc_exec_ctx *exec_ctx, grpc_subchannel_call_holder *holder) { grpc_exec_ctx *exec_ctx, grpc_subchannel_call_holder *holder) {
grpc_subchannel_call *subchannel_call = GET_CALL(holder); grpc_subchannel_call *subchannel_call = GET_CALL(holder);
if (subchannel_call) { if (subchannel_call == NULL || subchannel_call == CANCELLED_CALL) {
return grpc_subchannel_call_get_peer(exec_ctx, subchannel_call);
} else {
return NULL; return NULL;
} else {
return grpc_subchannel_call_get_peer(exec_ctx, subchannel_call);
} }
} }

@ -86,7 +86,8 @@ typedef struct {
static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *r); static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
static void dns_start_resolving_locked(dns_resolver *r); static void dns_start_resolving_locked(grpc_exec_ctx *exec_ctx,
dns_resolver *r);
static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx, static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
dns_resolver *r); dns_resolver *r);
@ -119,7 +120,7 @@ static void dns_channel_saw_error(grpc_exec_ctx *exec_ctx,
gpr_mu_lock(&r->mu); gpr_mu_lock(&r->mu);
if (!r->resolving) { if (!r->resolving) {
gpr_backoff_reset(&r->backoff_state); gpr_backoff_reset(&r->backoff_state);
dns_start_resolving_locked(r); dns_start_resolving_locked(exec_ctx, r);
} }
gpr_mu_unlock(&r->mu); gpr_mu_unlock(&r->mu);
} }
@ -134,7 +135,7 @@ static void dns_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
r->target_config = target_config; r->target_config = target_config;
if (r->resolved_version == 0 && !r->resolving) { if (r->resolved_version == 0 && !r->resolving) {
gpr_backoff_reset(&r->backoff_state); gpr_backoff_reset(&r->backoff_state);
dns_start_resolving_locked(r); dns_start_resolving_locked(exec_ctx, r);
} else { } else {
dns_maybe_finish_next_locked(exec_ctx, r); dns_maybe_finish_next_locked(exec_ctx, r);
} }
@ -149,7 +150,7 @@ static void dns_on_retry_timer(grpc_exec_ctx *exec_ctx, void *arg,
r->have_retry_timer = false; r->have_retry_timer = false;
if (success) { if (success) {
if (!r->resolving) { if (!r->resolving) {
dns_start_resolving_locked(r); dns_start_resolving_locked(exec_ctx, r);
} }
} }
gpr_mu_unlock(&r->mu); gpr_mu_unlock(&r->mu);
@ -201,11 +202,12 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "dns-resolving"); GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "dns-resolving");
} }
static void dns_start_resolving_locked(dns_resolver *r) { static void dns_start_resolving_locked(grpc_exec_ctx *exec_ctx,
dns_resolver *r) {
GRPC_RESOLVER_REF(&r->base, "dns-resolving"); GRPC_RESOLVER_REF(&r->base, "dns-resolving");
GPR_ASSERT(!r->resolving); GPR_ASSERT(!r->resolving);
r->resolving = 1; r->resolving = 1;
grpc_resolve_address(r->name, r->default_port, dns_on_resolved, r); grpc_resolve_address(exec_ctx, r->name, r->default_port, dns_on_resolved, r);
} }
static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx, static void dns_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,

@ -299,7 +299,7 @@ static void zookeeper_get_children_node_completion(int rc, const char *value,
address = zookeeper_parse_address(value, (size_t)value_len); address = zookeeper_parse_address(value, (size_t)value_len);
if (address != NULL) { if (address != NULL) {
/** Further resolves address by DNS */ /** Further resolves address by DNS */
grpc_resolve_address(address, NULL, zookeeper_dns_resolved, r); grpc_resolve_address(&exec_ctx, address, NULL, zookeeper_dns_resolved, r);
gpr_free(address); gpr_free(address);
} else { } else {
gpr_log(GPR_ERROR, "Error in resolving a child node of %s", r->name); gpr_log(GPR_ERROR, "Error in resolving a child node of %s", r->name);
@ -375,8 +375,10 @@ static void zookeeper_get_node_completion(int rc, const char *value,
r->resolved_addrs->naddrs = 0; r->resolved_addrs->naddrs = 0;
r->resolved_total = 1; r->resolved_total = 1;
/** Further resolves address by DNS */ /** Further resolves address by DNS */
grpc_resolve_address(address, NULL, zookeeper_dns_resolved, r); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resolve_address(&exec_ctx, address, NULL, zookeeper_dns_resolved, r);
gpr_free(address); gpr_free(address);
grpc_exec_ctx_finish(&exec_ctx);
return; return;
} }

@ -235,5 +235,7 @@ grpc_channel *grpc_insecure_channel_create(const char *target,
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
return channel; /* may be NULL */ return channel != NULL ? channel : grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL,
"Failed to create client channel");
} }

@ -194,9 +194,13 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(gpr_slice input) {
/* encode full triplets */ /* encode full triplets */
for (i = 0; i < input_triplets; i++) { for (i = 0; i < input_triplets; i++) {
enc_add2(&out, in[0] >> 2, (uint8_t)((in[0] & 0x3) << 4) | (in[1] >> 4)); const uint8_t low_to_high = (uint8_t)((in[0] & 0x3) << 4);
enc_add2(&out, (uint8_t)((in[1] & 0xf) << 2) | (in[2] >> 6), const uint8_t high_to_low = in[1] >> 4;
(uint8_t)(in[2] & 0x3f)); enc_add2(&out, in[0] >> 2, low_to_high | high_to_low);
const uint8_t a = (uint8_t)((in[1] & 0xf) << 2);
const uint8_t b = (in[2] >> 6);
enc_add2(&out, a | b, in[2] & 0x3f);
in += 3; in += 3;
} }
@ -208,13 +212,15 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(gpr_slice input) {
enc_add2(&out, in[0] >> 2, (uint8_t)((in[0] & 0x3) << 4)); enc_add2(&out, in[0] >> 2, (uint8_t)((in[0] & 0x3) << 4));
in += 1; in += 1;
break; break;
case 2: case 2: {
enc_add2(&out, in[0] >> 2, const uint8_t low_to_high = (uint8_t)((in[0] & 0x3) << 4);
(uint8_t)((in[0] & 0x3) << 4) | (uint8_t)(in[1] >> 4)); const uint8_t high_to_low = in[1] >> 4;
enc_add2(&out, in[0] >> 2, low_to_high | high_to_low);
enc_add1(&out, (uint8_t)((in[1] & 0xf) << 2)); enc_add1(&out, (uint8_t)((in[1] & 0xf) << 2));
in += 2; in += 2;
break; break;
} }
}
if (out.temp_length) { if (out.temp_length) {
/* NB: the following integer arithmetic operation needs to be in its /* NB: the following integer arithmetic operation needs to be in its

@ -639,7 +639,7 @@ static int on_hdr(grpc_chttp2_hpack_parser *p, grpc_mdelem *md,
} }
} }
if (p->on_header == NULL) { if (p->on_header == NULL) {
grpc_mdelem_unref(md); GRPC_MDELEM_UNREF(md);
return 0; return 0;
} }
p->on_header(p->on_header_user_data, md); p->on_header(p->on_header_user_data, md);

@ -268,8 +268,14 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
channeld->default_compression_algorithm = channeld->default_compression_algorithm =
grpc_channel_args_get_compression_algorithm(args->channel_args); grpc_channel_args_get_compression_algorithm(args->channel_args);
/* Make sure the default isn't disabled. */ /* Make sure the default isn't disabled. */
GPR_ASSERT(grpc_compression_options_is_algorithm_enabled( if (!grpc_compression_options_is_algorithm_enabled(
&channeld->compression_options, channeld->default_compression_algorithm)); &channeld->compression_options,
channeld->default_compression_algorithm)) {
gpr_log(GPR_DEBUG,
"compression algorithm %d not enabled: switching to none",
channeld->default_compression_algorithm);
channeld->default_compression_algorithm = GRPC_COMPRESS_NONE;
}
channeld->compression_options.default_compression_algorithm = channeld->compression_options.default_compression_algorithm =
channeld->default_compression_algorithm; channeld->default_compression_algorithm;

@ -246,7 +246,7 @@ static void internal_request_begin(
grpc_pollset_set_add_pollset(exec_ctx, req->context->pollset_set, grpc_pollset_set_add_pollset(exec_ctx, req->context->pollset_set,
req->pollset); req->pollset);
grpc_resolve_address(request->host, req->handshaker->default_port, grpc_resolve_address(exec_ctx, request->host, req->handshaker->default_port,
on_resolved, req); on_resolved, req);
} }

@ -39,7 +39,7 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/useful.h> #include <grpc/support/useful.h>
extern int grpc_http_trace; int grpc_http1_trace = 0;
static char *buf2str(void *buffer, size_t length) { static char *buf2str(void *buffer, size_t length) {
char *out = gpr_malloc(length + 1); char *out = gpr_malloc(length + 1);
@ -74,7 +74,7 @@ static int handle_response_line(grpc_http_parser *parser) {
return 1; return 1;
error: error:
if (grpc_http_trace) gpr_log(GPR_ERROR, "Failed parsing response line"); if (grpc_http1_trace) gpr_log(GPR_ERROR, "Failed parsing response line");
return 0; return 0;
} }
@ -127,7 +127,7 @@ static int handle_request_line(grpc_http_parser *parser) {
return 1; return 1;
error: error:
if (grpc_http_trace) gpr_log(GPR_ERROR, "Failed parsing request line"); if (grpc_http1_trace) gpr_log(GPR_ERROR, "Failed parsing request line");
return 0; return 0;
} }
@ -152,7 +152,7 @@ static int add_header(grpc_http_parser *parser) {
GPR_ASSERT(cur != end); GPR_ASSERT(cur != end);
if (*cur == ' ' || *cur == '\t') { if (*cur == ' ' || *cur == '\t') {
if (grpc_http_trace) if (grpc_http1_trace)
gpr_log(GPR_ERROR, "Continued header lines not supported yet"); gpr_log(GPR_ERROR, "Continued header lines not supported yet");
goto error; goto error;
} }
@ -161,7 +161,8 @@ static int add_header(grpc_http_parser *parser) {
cur++; cur++;
} }
if (cur == end) { if (cur == end) {
if (grpc_http_trace) gpr_log(GPR_ERROR, "Didn't find ':' in header string"); if (grpc_http1_trace)
gpr_log(GPR_ERROR, "Didn't find ':' in header string");
goto error; goto error;
} }
GPR_ASSERT(cur >= beg); GPR_ASSERT(cur >= beg);
@ -171,8 +172,8 @@ static int add_header(grpc_http_parser *parser) {
while (cur != end && (*cur == ' ' || *cur == '\t')) { while (cur != end && (*cur == ' ' || *cur == '\t')) {
cur++; cur++;
} }
GPR_ASSERT(end - cur >= 2); GPR_ASSERT((size_t)(end - cur) >= parser->cur_line_end_length);
hdr.value = buf2str(cur, (size_t)(end - cur) - 2); hdr.value = buf2str(cur, (size_t)(end - cur) - parser->cur_line_end_length);
if (parser->type == GRPC_HTTP_RESPONSE) { if (parser->type == GRPC_HTTP_RESPONSE) {
hdr_count = &parser->http.response.hdr_count; hdr_count = &parser->http.response.hdr_count;
@ -207,7 +208,7 @@ static int finish_line(grpc_http_parser *parser) {
parser->state = GRPC_HTTP_HEADERS; parser->state = GRPC_HTTP_HEADERS;
break; break;
case GRPC_HTTP_HEADERS: case GRPC_HTTP_HEADERS:
if (parser->cur_line_length == 2) { if (parser->cur_line_length == parser->cur_line_end_length) {
parser->state = GRPC_HTTP_BODY; parser->state = GRPC_HTTP_BODY;
break; break;
} }
@ -247,21 +248,43 @@ static int addbyte_body(grpc_http_parser *parser, uint8_t byte) {
return 1; return 1;
} }
static int check_line(grpc_http_parser *parser) {
if (parser->cur_line_length >= 2 &&
parser->cur_line[parser->cur_line_length - 2] == '\r' &&
parser->cur_line[parser->cur_line_length - 1] == '\n') {
return 1;
}
// HTTP request with \n\r line termiantors.
else if (parser->cur_line_length >= 2 &&
parser->cur_line[parser->cur_line_length - 2] == '\n' &&
parser->cur_line[parser->cur_line_length - 1] == '\r') {
return 1;
}
// HTTP request with only \n line terminators.
else if (parser->cur_line_length >= 1 &&
parser->cur_line[parser->cur_line_length - 1] == '\n') {
parser->cur_line_end_length = 1;
return 1;
}
return 0;
}
static int addbyte(grpc_http_parser *parser, uint8_t byte) { static int addbyte(grpc_http_parser *parser, uint8_t byte) {
switch (parser->state) { switch (parser->state) {
case GRPC_HTTP_FIRST_LINE: case GRPC_HTTP_FIRST_LINE:
case GRPC_HTTP_HEADERS: case GRPC_HTTP_HEADERS:
if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) { if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) {
if (grpc_http_trace) if (grpc_http1_trace)
gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded", gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded",
GRPC_HTTP_PARSER_MAX_HEADER_LENGTH); GRPC_HTTP_PARSER_MAX_HEADER_LENGTH);
return 0; return 0;
} }
parser->cur_line[parser->cur_line_length] = byte; parser->cur_line[parser->cur_line_length] = byte;
parser->cur_line_length++; parser->cur_line_length++;
if (parser->cur_line_length >= 2 && if (check_line(parser)) {
parser->cur_line[parser->cur_line_length - 2] == '\r' &&
parser->cur_line[parser->cur_line_length - 1] == '\n') {
return finish_line(parser); return finish_line(parser);
} else { } else {
return 1; return 1;
@ -277,6 +300,7 @@ void grpc_http_parser_init(grpc_http_parser *parser) {
memset(parser, 0, sizeof(*parser)); memset(parser, 0, sizeof(*parser));
parser->state = GRPC_HTTP_FIRST_LINE; parser->state = GRPC_HTTP_FIRST_LINE;
parser->type = GRPC_HTTP_UNKNOWN; parser->type = GRPC_HTTP_UNKNOWN;
parser->cur_line_end_length = 2;
} }
void grpc_http_parser_destroy(grpc_http_parser *parser) { void grpc_http_parser_destroy(grpc_http_parser *parser) {

@ -105,6 +105,7 @@ typedef struct {
uint8_t cur_line[GRPC_HTTP_PARSER_MAX_HEADER_LENGTH]; uint8_t cur_line[GRPC_HTTP_PARSER_MAX_HEADER_LENGTH];
size_t cur_line_length; size_t cur_line_length;
size_t cur_line_end_length;
} grpc_http_parser; } grpc_http_parser;
void grpc_http_parser_init(grpc_http_parser *parser); void grpc_http_parser_init(grpc_http_parser *parser);
@ -113,4 +114,6 @@ void grpc_http_parser_destroy(grpc_http_parser *parser);
int grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice); int grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice);
int grpc_http_parser_eof(grpc_http_parser *parser); int grpc_http_parser_eof(grpc_http_parser *parser);
extern int grpc_http1_trace;
#endif /* GRPC_CORE_LIB_HTTP_PARSER_H */ #endif /* GRPC_CORE_LIB_HTTP_PARSER_H */

@ -54,6 +54,12 @@ void grpc_closure_list_add(grpc_closure_list *closure_list,
closure_list->tail = closure; closure_list->tail = closure;
} }
void grpc_closure_list_fail_all(grpc_closure_list *list) {
for (grpc_closure *c = list->head; c != NULL; c = grpc_closure_next(c)) {
c->final_data &= ~(uintptr_t)1;
}
}
bool grpc_closure_list_empty(grpc_closure_list closure_list) { bool grpc_closure_list_empty(grpc_closure_list closure_list) {
return closure_list.head == NULL; return closure_list.head == NULL;
} }

@ -86,6 +86,9 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg);
void grpc_closure_list_add(grpc_closure_list *list, grpc_closure *closure, void grpc_closure_list_add(grpc_closure_list *list, grpc_closure *closure,
bool success); bool success);
/** force all success bits in \a list to false */
void grpc_closure_list_fail_all(grpc_closure_list *list);
/** append all closures from \a src to \a dst and empty \a src. */ /** append all closures from \a src to \a dst and empty \a src. */
void grpc_closure_list_move(grpc_closure_list *src, grpc_closure_list *dst); void grpc_closure_list_move(grpc_closure_list *src, grpc_closure_list *dst);

@ -92,6 +92,8 @@ void grpc_exec_ctx_enqueue_list(grpc_exec_ctx *exec_ctx,
grpc_closure_list *list, grpc_closure_list *list,
grpc_workqueue *offload_target_or_null); grpc_workqueue *offload_target_or_null);
void grpc_exec_ctx_global_init(void);
void grpc_exec_ctx_global_init(void); void grpc_exec_ctx_global_init(void);
void grpc_exec_ctx_global_shutdown(void); void grpc_exec_ctx_global_shutdown(void);

@ -59,7 +59,8 @@ typedef void (*grpc_resolve_cb)(grpc_exec_ctx *exec_ctx, void *arg,
/* Asynchronously resolve addr. Use default_port if a port isn't designated /* Asynchronously resolve addr. Use default_port if a port isn't designated
in addr, otherwise use the port in addr. */ in addr, otherwise use the port in addr. */
/* TODO(ctiller): add a timeout here */ /* TODO(ctiller): add a timeout here */
void grpc_resolve_address(const char *addr, const char *default_port, extern void (*grpc_resolve_address)(grpc_exec_ctx *exec_ctx, const char *addr,
const char *default_port,
grpc_resolve_cb cb, void *arg); grpc_resolve_cb cb, void *arg);
/* Destroy resolved addresses */ /* Destroy resolved addresses */
void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addresses); void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addresses);

@ -164,8 +164,9 @@ void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addrs) {
gpr_free(addrs); gpr_free(addrs);
} }
void grpc_resolve_address(const char *name, const char *default_port, static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name,
grpc_resolve_cb cb, void *arg) { const char *default_port, grpc_resolve_cb cb,
void *arg) {
request *r = gpr_malloc(sizeof(request)); request *r = gpr_malloc(sizeof(request));
grpc_closure_init(&r->request_closure, do_request_thread, r); grpc_closure_init(&r->request_closure, do_request_thread, r);
r->name = gpr_strdup(name); r->name = gpr_strdup(name);
@ -175,4 +176,8 @@ void grpc_resolve_address(const char *name, const char *default_port,
grpc_executor_enqueue(&r->request_closure, 1); grpc_executor_enqueue(&r->request_closure, 1);
} }
void (*grpc_resolve_address)(grpc_exec_ctx *exec_ctx, const char *name,
const char *default_port, grpc_resolve_cb cb,
void *arg) = resolve_address_impl;
#endif #endif

@ -155,8 +155,9 @@ void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addrs) {
gpr_free(addrs); gpr_free(addrs);
} }
void grpc_resolve_address(const char *name, const char *default_port, static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name,
grpc_resolve_cb cb, void *arg) { const char *default_port, grpc_resolve_cb cb,
void *arg) {
request *r = gpr_malloc(sizeof(request)); request *r = gpr_malloc(sizeof(request));
grpc_closure_init(&r->request_closure, do_request_thread, r); grpc_closure_init(&r->request_closure, do_request_thread, r);
r->name = gpr_strdup(name); r->name = gpr_strdup(name);
@ -166,4 +167,8 @@ void grpc_resolve_address(const char *name, const char *default_port,
grpc_executor_enqueue(&r->request_closure, 1); grpc_executor_enqueue(&r->request_closure, 1);
} }
void (*grpc_resolve_address)(grpc_exec_ctx *exec_ctx, const char *name,
const char *default_port, grpc_resolve_cb cb,
void *arg) = resolve_address_impl;
#endif #endif

@ -211,11 +211,11 @@ finish:
grpc_exec_ctx_enqueue(exec_ctx, closure, *ep != NULL, NULL); grpc_exec_ctx_enqueue(exec_ctx, closure, *ep != NULL, NULL);
} }
void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx,
grpc_endpoint **ep, grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties, grpc_pollset_set *interested_parties,
const struct sockaddr *addr, size_t addr_len, const struct sockaddr *addr,
gpr_timespec deadline) { size_t addr_len, gpr_timespec deadline) {
int fd; int fd;
grpc_dualstack_mode dsmode; grpc_dualstack_mode dsmode;
int err; int err;
@ -303,4 +303,19 @@ done:
gpr_free(addr_str); gpr_free(addr_str);
} }
// overridden by api_fuzzer.c
void (*grpc_tcp_client_connect_impl)(
grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep,
grpc_pollset_set *interested_parties, const struct sockaddr *addr,
size_t addr_len, gpr_timespec deadline) = tcp_client_connect_impl;
void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
grpc_endpoint **ep,
grpc_pollset_set *interested_parties,
const struct sockaddr *addr, size_t addr_len,
gpr_timespec deadline) {
grpc_tcp_client_connect_impl(exec_ctx, closure, ep, interested_parties, addr,
addr_len, deadline);
}
#endif #endif

@ -70,6 +70,7 @@ static gpr_clock_type g_clock_type;
static shard_type g_shards[NUM_SHARDS]; static shard_type g_shards[NUM_SHARDS];
/* Protected by g_mu */ /* Protected by g_mu */
static shard_type *g_shard_queue[NUM_SHARDS]; static shard_type *g_shard_queue[NUM_SHARDS];
static bool g_initialized = false;
static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now, static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now,
gpr_timespec *next, int success); gpr_timespec *next, int success);
@ -83,6 +84,7 @@ static gpr_timespec compute_min_deadline(shard_type *shard) {
void grpc_timer_list_init(gpr_timespec now) { void grpc_timer_list_init(gpr_timespec now) {
uint32_t i; uint32_t i;
g_initialized = true;
gpr_mu_init(&g_mu); gpr_mu_init(&g_mu);
gpr_mu_init(&g_checker_mu); gpr_mu_init(&g_checker_mu);
g_clock_type = now.clock_type; g_clock_type = now.clock_type;
@ -111,6 +113,7 @@ void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx) {
} }
gpr_mu_destroy(&g_mu); gpr_mu_destroy(&g_mu);
gpr_mu_destroy(&g_checker_mu); gpr_mu_destroy(&g_checker_mu);
g_initialized = false;
} }
/* This is a cheap, but good enough, pointer hash for sharding the tasks: */ /* This is a cheap, but good enough, pointer hash for sharding the tasks: */
@ -180,6 +183,18 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
timer->deadline = deadline; timer->deadline = deadline;
timer->triggered = 0; timer->triggered = 0;
if (!g_initialized) {
timer->triggered = 1;
grpc_exec_ctx_enqueue(exec_ctx, &timer->closure, false, NULL);
return;
}
if (gpr_time_cmp(deadline, now) <= 0) {
timer->triggered = 1;
grpc_exec_ctx_enqueue(exec_ctx, &timer->closure, true, NULL);
return;
}
/* TODO(ctiller): check deadline expired */ /* TODO(ctiller): check deadline expired */
gpr_mu_lock(&shard->mu); gpr_mu_lock(&shard->mu);

@ -166,7 +166,6 @@ static void deactivated_all_ports(grpc_exec_ctx *exec_ctx, grpc_udp_server *s) {
if (s->nports) { if (s->nports) {
for (i = 0; i < s->nports; i++) { for (i = 0; i < s->nports; i++) {
server_port *sp = &s->ports[i]; server_port *sp = &s->ports[i];
grpc_unlink_if_unix_domain_socket(&sp->addr.sockaddr);
sp->destroyed_closure.cb = destroyed_port; sp->destroyed_closure.cb = destroyed_port;
sp->destroyed_closure.cb_arg = s; sp->destroyed_closure.cb_arg = s;
grpc_fd_orphan(exec_ctx, sp->emfd, &sp->destroyed_closure, NULL, grpc_fd_orphan(exec_ctx, sp->emfd, &sp->destroyed_closure, NULL,
@ -317,8 +316,6 @@ int grpc_udp_server_add_port(grpc_udp_server *s, const void *addr,
socklen_t sockname_len; socklen_t sockname_len;
int port; int port;
grpc_unlink_if_unix_domain_socket((struct sockaddr *)addr);
/* Check if this is a wildcard port, and if so, try to keep the port the same /* Check if this is a wildcard port, and if so, try to keep the port the same
as some previously created listener. */ as some previously created listener. */
if (grpc_sockaddr_get_port(addr) == 0) { if (grpc_sockaddr_get_port(addr) == 0) {

@ -338,10 +338,11 @@ static void ssl_build_config(const char *pem_root_certs,
static void ssl_build_server_config( static void ssl_build_server_config(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
size_t num_key_cert_pairs, int force_client_auth, size_t num_key_cert_pairs,
grpc_ssl_client_certificate_request_type client_certificate_request,
grpc_ssl_server_config *config) { grpc_ssl_server_config *config) {
size_t i; size_t i;
config->force_client_auth = force_client_auth; config->client_certificate_request = client_certificate_request;
if (pem_root_certs != NULL) { if (pem_root_certs != NULL) {
ssl_copy_key_material(pem_root_certs, &config->pem_root_certs, ssl_copy_key_material(pem_root_certs, &config->pem_root_certs,
&config->pem_root_certs_size); &config->pem_root_certs_size);
@ -391,21 +392,35 @@ grpc_channel_credentials *grpc_ssl_credentials_create(
grpc_server_credentials *grpc_ssl_server_credentials_create( grpc_server_credentials *grpc_ssl_server_credentials_create(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
size_t num_key_cert_pairs, int force_client_auth, void *reserved) { size_t num_key_cert_pairs, int force_client_auth, void *reserved) {
return grpc_ssl_server_credentials_create_ex(
pem_root_certs, pem_key_cert_pairs, num_key_cert_pairs,
force_client_auth
? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
: GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
reserved);
}
grpc_server_credentials *grpc_ssl_server_credentials_create_ex(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
size_t num_key_cert_pairs,
grpc_ssl_client_certificate_request_type client_certificate_request,
void *reserved) {
grpc_ssl_server_credentials *c = grpc_ssl_server_credentials *c =
gpr_malloc(sizeof(grpc_ssl_server_credentials)); gpr_malloc(sizeof(grpc_ssl_server_credentials));
GRPC_API_TRACE( GRPC_API_TRACE(
"grpc_ssl_server_credentials_create(" "grpc_ssl_server_credentials_create_ex("
"pem_root_certs=%s, pem_key_cert_pairs=%p, num_key_cert_pairs=%lu, " "pem_root_certs=%s, pem_key_cert_pairs=%p, num_key_cert_pairs=%lu, "
"force_client_auth=%d, reserved=%p)", "client_certificate_request=%d, reserved=%p)",
5, (pem_root_certs, pem_key_cert_pairs, (unsigned long)num_key_cert_pairs, 5, (pem_root_certs, pem_key_cert_pairs, (unsigned long)num_key_cert_pairs,
force_client_auth, reserved)); client_certificate_request, reserved));
GPR_ASSERT(reserved == NULL); GPR_ASSERT(reserved == NULL);
memset(c, 0, sizeof(grpc_ssl_server_credentials)); memset(c, 0, sizeof(grpc_ssl_server_credentials));
c->base.type = GRPC_CHANNEL_CREDENTIALS_TYPE_SSL; c->base.type = GRPC_CHANNEL_CREDENTIALS_TYPE_SSL;
gpr_ref_init(&c->base.refcount, 1); gpr_ref_init(&c->base.refcount, 1);
c->base.vtable = &ssl_server_vtable; c->base.vtable = &ssl_server_vtable;
ssl_build_server_config(pem_root_certs, pem_key_cert_pairs, ssl_build_server_config(pem_root_certs, pem_key_cert_pairs,
num_key_cert_pairs, force_client_auth, &c->config); num_key_cert_pairs, client_certificate_request,
&c->config);
return &c->base; return &c->base;
} }

@ -668,6 +668,31 @@ gpr_slice grpc_get_default_ssl_roots_for_testing(void) {
return compute_default_pem_root_certs_once(); return compute_default_pem_root_certs_once();
} }
static tsi_client_certificate_request_type
get_tsi_client_certificate_request_type(
grpc_ssl_client_certificate_request_type grpc_request_type) {
switch (grpc_request_type) {
case GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE:
return TSI_DONT_REQUEST_CLIENT_CERTIFICATE;
case GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
return TSI_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY;
case GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY:
return TSI_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY;
case GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
return TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY;
case GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY:
return TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY;
default:
// Is this a sane default
return TSI_DONT_REQUEST_CLIENT_CERTIFICATE;
}
}
size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) { size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) {
/* TODO(jboeuf@google.com): Maybe revisit the approach which consists in /* TODO(jboeuf@google.com): Maybe revisit the approach which consists in
loading all the roots once for the lifetime of the process. */ loading all the roots once for the lifetime of the process. */
@ -782,15 +807,16 @@ grpc_security_status grpc_ssl_server_security_connector_create(
gpr_ref_init(&c->base.base.refcount, 1); gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.url_scheme = GRPC_SSL_URL_SCHEME; c->base.base.url_scheme = GRPC_SSL_URL_SCHEME;
c->base.base.vtable = &ssl_server_vtable; c->base.base.vtable = &ssl_server_vtable;
result = tsi_create_ssl_server_handshaker_factory( result = tsi_create_ssl_server_handshaker_factory_ex(
(const unsigned char **)config->pem_private_keys, (const unsigned char **)config->pem_private_keys,
config->pem_private_keys_sizes, config->pem_private_keys_sizes,
(const unsigned char **)config->pem_cert_chains, (const unsigned char **)config->pem_cert_chains,
config->pem_cert_chains_sizes, config->num_key_cert_pairs, config->pem_cert_chains_sizes, config->num_key_cert_pairs,
config->pem_root_certs, config->pem_root_certs_size, config->pem_root_certs, config->pem_root_certs_size,
config->force_client_auth, ssl_cipher_suites(), alpn_protocol_strings, get_tsi_client_certificate_request_type(
alpn_protocol_string_lengths, (uint16_t)num_alpn_protocols, config->client_certificate_request),
&c->handshaker_factory); ssl_cipher_suites(), alpn_protocol_strings, alpn_protocol_string_lengths,
(uint16_t)num_alpn_protocols, &c->handshaker_factory);
if (result != TSI_OK) { if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.", gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result)); tsi_result_to_string(result));

@ -241,7 +241,7 @@ typedef struct {
size_t num_key_cert_pairs; size_t num_key_cert_pairs;
unsigned char *pem_root_certs; unsigned char *pem_root_certs;
size_t pem_root_certs_size; size_t pem_root_certs_size;
int force_client_auth; grpc_ssl_client_certificate_request_type client_certificate_request;
} grpc_ssl_server_config; } grpc_ssl_server_config;
/* Creates an SSL server_security_connector. /* Creates an SSL server_security_connector.

@ -78,7 +78,7 @@ static const clockid_t clockid_for_gpr_clock[] = {CLOCK_MONOTONIC,
void gpr_time_init(void) { gpr_precise_clock_init(); } void gpr_time_init(void) { gpr_precise_clock_init(); }
gpr_timespec gpr_now(gpr_clock_type clock_type) { static gpr_timespec now_impl(gpr_clock_type clock_type) {
struct timespec now; struct timespec now;
GPR_ASSERT(clock_type != GPR_TIMESPAN); GPR_ASSERT(clock_type != GPR_TIMESPAN);
if (clock_type == GPR_CLOCK_PRECISE) { if (clock_type == GPR_CLOCK_PRECISE) {
@ -114,7 +114,7 @@ void gpr_time_init(void) {
g_time_start = mach_absolute_time(); g_time_start = mach_absolute_time();
} }
gpr_timespec gpr_now(gpr_clock_type clock) { static gpr_timespec now_impl(gpr_clock_type clock) {
gpr_timespec now; gpr_timespec now;
struct timeval now_tv; struct timeval now_tv;
double now_dbl; double now_dbl;
@ -142,6 +142,12 @@ gpr_timespec gpr_now(gpr_clock_type clock) {
} }
#endif #endif
gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type) = now_impl;
gpr_timespec gpr_now(gpr_clock_type clock_type) {
return gpr_now_impl(clock_type);
}
void gpr_sleep_until(gpr_timespec until) { void gpr_sleep_until(gpr_timespec until) {
gpr_timespec now; gpr_timespec now;
gpr_timespec delta; gpr_timespec delta;

@ -142,22 +142,23 @@ struct grpc_call {
gpr_mu mu; gpr_mu mu;
/* client or server call */ /* client or server call */
uint8_t is_client; bool is_client;
/* is the alarm set */ /* is the alarm set */
uint8_t have_alarm; bool have_alarm;
/** has grpc_call_destroy been called */ /** has grpc_call_destroy been called */
uint8_t destroy_called; bool destroy_called;
/** flag indicating that cancellation is inherited */ /** flag indicating that cancellation is inherited */
uint8_t cancellation_is_inherited; bool cancellation_is_inherited;
/** bitmask of live batches */ /** bitmask of live batches */
uint8_t used_batches; uint8_t used_batches;
/** which ops are in-flight */ /** which ops are in-flight */
uint8_t sent_initial_metadata; bool sent_initial_metadata;
uint8_t sending_message; bool sending_message;
uint8_t sent_final_op; bool sent_final_op;
uint8_t received_initial_metadata; bool received_initial_metadata;
uint8_t receiving_message; bool receiving_message;
uint8_t received_final_op; bool requested_final_op;
bool received_final_op;
/* have we received initial metadata */ /* have we received initial metadata */
bool has_initial_md_been_received; bool has_initial_md_been_received;
@ -220,10 +221,7 @@ struct grpc_call {
} server; } server;
} final_op; } final_op;
struct { void *saved_receiving_stream_ready_bctlp;
void *bctlp;
bool success;
} saved_receiving_stream_ready_ctx;
}; };
#define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1)) #define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1))
@ -554,21 +552,6 @@ static int prepare_application_metadata(grpc_call *call, int count,
int i; int i;
grpc_metadata_batch *batch = grpc_metadata_batch *batch =
&call->metadata_batch[0 /* is_receiving */][is_trailing]; &call->metadata_batch[0 /* is_receiving */][is_trailing];
if (prepend_extra_metadata) {
if (call->send_extra_metadata_count == 0) {
prepend_extra_metadata = 0;
} else {
for (i = 0; i < call->send_extra_metadata_count; i++) {
GRPC_MDELEM_REF(call->send_extra_metadata[i].md);
}
for (i = 1; i < call->send_extra_metadata_count; i++) {
call->send_extra_metadata[i].prev = &call->send_extra_metadata[i - 1];
}
for (i = 0; i < call->send_extra_metadata_count - 1; i++) {
call->send_extra_metadata[i].next = &call->send_extra_metadata[i + 1];
}
}
}
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
grpc_metadata *md = &metadata[i]; grpc_metadata *md = &metadata[i];
grpc_linked_mdelem *l = (grpc_linked_mdelem *)&md->internal_data; grpc_linked_mdelem *l = (grpc_linked_mdelem *)&md->internal_data;
@ -579,15 +562,38 @@ static int prepare_application_metadata(grpc_call *call, int count,
GRPC_MDSTR_LENGTH(l->md->key))) { GRPC_MDSTR_LENGTH(l->md->key))) {
gpr_log(GPR_ERROR, "attempt to send invalid metadata key: %s", gpr_log(GPR_ERROR, "attempt to send invalid metadata key: %s",
grpc_mdstr_as_c_string(l->md->key)); grpc_mdstr_as_c_string(l->md->key));
return 0; break;
} else if (!grpc_is_binary_header(grpc_mdstr_as_c_string(l->md->key), } else if (!grpc_is_binary_header(grpc_mdstr_as_c_string(l->md->key),
GRPC_MDSTR_LENGTH(l->md->key)) && GRPC_MDSTR_LENGTH(l->md->key)) &&
!grpc_header_nonbin_value_is_legal( !grpc_header_nonbin_value_is_legal(
grpc_mdstr_as_c_string(l->md->value), grpc_mdstr_as_c_string(l->md->value),
GRPC_MDSTR_LENGTH(l->md->value))) { GRPC_MDSTR_LENGTH(l->md->value))) {
gpr_log(GPR_ERROR, "attempt to send invalid metadata value"); gpr_log(GPR_ERROR, "attempt to send invalid metadata value");
break;
}
}
if (i != count) {
for (int j = 0; j <= i; j++) {
grpc_metadata *md = &metadata[j];
grpc_linked_mdelem *l = (grpc_linked_mdelem *)&md->internal_data;
GRPC_MDELEM_UNREF(l->md);
}
return 0; return 0;
} }
if (prepend_extra_metadata) {
if (call->send_extra_metadata_count == 0) {
prepend_extra_metadata = 0;
} else {
for (i = 0; i < call->send_extra_metadata_count; i++) {
GRPC_MDELEM_REF(call->send_extra_metadata[i].md);
}
for (i = 1; i < call->send_extra_metadata_count; i++) {
call->send_extra_metadata[i].prev = &call->send_extra_metadata[i - 1];
}
for (i = 0; i < call->send_extra_metadata_count - 1; i++) {
call->send_extra_metadata[i].next = &call->send_extra_metadata[i + 1];
}
}
} }
for (i = 1; i < count; i++) { for (i = 1; i < count; i++) {
linked_from_md(&metadata[i])->prev = linked_from_md(&metadata[i - 1]); linked_from_md(&metadata[i])->prev = linked_from_md(&metadata[i - 1]);
@ -1057,12 +1063,12 @@ static void receiving_stream_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
grpc_call *call = bctl->call; grpc_call *call = bctl->call;
gpr_mu_lock(&bctl->call->mu); gpr_mu_lock(&bctl->call->mu);
if (bctl->call->has_initial_md_been_received) { if (bctl->call->has_initial_md_been_received || !success ||
call->receiving_stream == NULL) {
gpr_mu_unlock(&bctl->call->mu); gpr_mu_unlock(&bctl->call->mu);
process_data_after_md(exec_ctx, bctlp, success); process_data_after_md(exec_ctx, bctlp, success);
} else { } else {
call->saved_receiving_stream_ready_ctx.bctlp = bctlp; call->saved_receiving_stream_ready_bctlp = bctlp;
call->saved_receiving_stream_ready_ctx.success = success;
gpr_mu_unlock(&bctl->call->mu); gpr_mu_unlock(&bctl->call->mu);
} }
} }
@ -1091,13 +1097,11 @@ static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx,
} }
call->has_initial_md_been_received = true; call->has_initial_md_been_received = true;
if (call->saved_receiving_stream_ready_ctx.bctlp != NULL) { if (call->saved_receiving_stream_ready_bctlp != NULL) {
grpc_closure *saved_rsr_closure = grpc_closure_create( grpc_closure *saved_rsr_closure = grpc_closure_create(
receiving_stream_ready, call->saved_receiving_stream_ready_ctx.bctlp); receiving_stream_ready, call->saved_receiving_stream_ready_bctlp);
grpc_exec_ctx_enqueue( call->saved_receiving_stream_ready_bctlp = NULL;
exec_ctx, saved_rsr_closure, grpc_exec_ctx_enqueue(exec_ctx, saved_rsr_closure, success, NULL);
call->saved_receiving_stream_ready_ctx.success && success, NULL);
call->saved_receiving_stream_ready_ctx.bctlp = NULL;
} }
gpr_mu_unlock(&call->mu); gpr_mu_unlock(&call->mu);
@ -1133,6 +1137,7 @@ static void finish_batch(grpc_exec_ctx *exec_ctx, void *bctlp, bool success) {
&call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */]; &call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
grpc_metadata_batch_filter(md, recv_trailing_filter, call); grpc_metadata_batch_filter(md, recv_trailing_filter, call);
call->received_final_op = true;
if (call->have_alarm) { if (call->have_alarm) {
grpc_timer_cancel(exec_ctx, &call->alarm); grpc_timer_cancel(exec_ctx, &call->alarm);
} }
@ -1377,11 +1382,11 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
error = GRPC_CALL_ERROR_NOT_ON_SERVER; error = GRPC_CALL_ERROR_NOT_ON_SERVER;
goto done_with_error; goto done_with_error;
} }
if (call->received_final_op) { if (call->requested_final_op) {
error = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS; error = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS;
goto done_with_error; goto done_with_error;
} }
call->received_final_op = 1; call->requested_final_op = 1;
call->buffered_metadata[1] = call->buffered_metadata[1] =
op->data.recv_status_on_client.trailing_metadata; op->data.recv_status_on_client.trailing_metadata;
call->final_op.client.status = op->data.recv_status_on_client.status; call->final_op.client.status = op->data.recv_status_on_client.status;
@ -1404,11 +1409,11 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
error = GRPC_CALL_ERROR_NOT_ON_CLIENT; error = GRPC_CALL_ERROR_NOT_ON_CLIENT;
goto done_with_error; goto done_with_error;
} }
if (call->received_final_op) { if (call->requested_final_op) {
error = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS; error = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS;
goto done_with_error; goto done_with_error;
} }
call->received_final_op = 1; call->requested_final_op = 1;
call->final_op.server.cancelled = call->final_op.server.cancelled =
op->data.recv_close_on_server.cancelled; op->data.recv_close_on_server.cancelled;
bctl->recv_final_op = 1; bctl->recv_final_op = 1;
@ -1457,7 +1462,7 @@ done_with_error:
call->receiving_message = 0; call->receiving_message = 0;
} }
if (bctl->recv_final_op) { if (bctl->recv_final_op) {
call->received_final_op = 0; call->requested_final_op = 0;
} }
gpr_mu_unlock(&call->mu); gpr_mu_unlock(&call->mu);
goto done; goto done;

@ -46,6 +46,7 @@
#include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/channel/http_client_filter.h"
#include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/debug/trace.h" #include "src/core/lib/debug/trace.h"
#include "src/core/lib/http/parser.h"
#include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
@ -162,6 +163,7 @@ void grpc_init(void) {
grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace); grpc_register_tracer("connectivity_state", &grpc_connectivity_state_trace);
grpc_register_tracer("channel_stack_builder", grpc_register_tracer("channel_stack_builder",
&grpc_trace_channel_stack_builder); &grpc_trace_channel_stack_builder);
grpc_register_tracer("http1", &grpc_http1_trace);
grpc_security_pre_init(); grpc_security_pre_init();
grpc_iomgr_init(); grpc_iomgr_init();
grpc_executor_init(); grpc_executor_init();

@ -99,6 +99,9 @@ static void lame_start_transport_op(grpc_exec_ctx *exec_ctx,
if (op->on_consumed != NULL) { if (op->on_consumed != NULL) {
op->on_consumed->cb(exec_ctx, op->on_consumed->cb_arg, 1); op->on_consumed->cb(exec_ctx, op->on_consumed->cb_arg, 1);
} }
if (op->send_ping != NULL) {
op->send_ping->cb(exec_ctx, op->send_ping->cb_arg, 0);
}
} }
static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,

@ -40,7 +40,7 @@ static int conforms_to(const char *s, size_t len, const uint8_t *legal_bits) {
const char *p = s; const char *p = s;
const char *e = s + len; const char *e = s + len;
for (; p != e; p++) { for (; p != e; p++) {
int idx = *p; int idx = (uint8_t)*p;
int byte = idx / 8; int byte = idx / 8;
int bit = idx % 8; int bit = idx % 8;
if ((legal_bits[byte] & (1 << bit)) == 0) return 0; if ((legal_bits[byte] & (1 << bit)) == 0) return 0;

@ -120,6 +120,7 @@ void grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *),
void *user_data); void *user_data);
/* Reference counting */ /* Reference counting */
//#define GRPC_METADATA_REFCOUNT_DEBUG
#ifdef GRPC_METADATA_REFCOUNT_DEBUG #ifdef GRPC_METADATA_REFCOUNT_DEBUG
#define GRPC_MDSTR_REF(s) grpc_mdstr_ref((s), __FILE__, __LINE__) #define GRPC_MDSTR_REF(s) grpc_mdstr_ref((s), __FILE__, __LINE__)
#define GRPC_MDSTR_UNREF(s) grpc_mdstr_unref((s), __FILE__, __LINE__) #define GRPC_MDSTR_UNREF(s) grpc_mdstr_unref((s), __FILE__, __LINE__)

@ -718,6 +718,14 @@ static tsi_result build_alpn_protocol_name_list(
return TSI_OK; return TSI_OK;
} }
// The verification callback is used for clients that don't really care about
// the server's certificate, but we need to pull it anyway, in case a higher
// layer wants to look at it. In this case the verification may fail, but
// we don't really care.
static int NullVerifyCallback(int preverify_ok, X509_STORE_CTX *ctx) {
return 1;
}
/* --- tsi_frame_protector methods implementation. ---*/ /* --- tsi_frame_protector methods implementation. ---*/
static tsi_result ssl_protector_protect(tsi_frame_protector *self, static tsi_result ssl_protector_protect(tsi_frame_protector *self,
@ -1390,6 +1398,26 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
const char *cipher_list, const unsigned char **alpn_protocols, const char *cipher_list, const unsigned char **alpn_protocols,
const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols, const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
tsi_ssl_handshaker_factory **factory) { tsi_ssl_handshaker_factory **factory) {
return tsi_create_ssl_server_handshaker_factory_ex(
pem_private_keys, pem_private_keys_sizes, pem_cert_chains,
pem_cert_chains_sizes, key_cert_pair_count, pem_client_root_certs,
pem_client_root_certs_size,
force_client_auth ? TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
: TSI_DONT_REQUEST_CLIENT_CERTIFICATE,
cipher_list, alpn_protocols, alpn_protocols_lengths, num_alpn_protocols,
factory);
}
tsi_result tsi_create_ssl_server_handshaker_factory_ex(
const unsigned char **pem_private_keys,
const size_t *pem_private_keys_sizes, const unsigned char **pem_cert_chains,
const size_t *pem_cert_chains_sizes, size_t key_cert_pair_count,
const unsigned char *pem_client_root_certs,
size_t pem_client_root_certs_size,
tsi_client_certificate_request_type client_certificate_request,
const char *cipher_list, const unsigned char **alpn_protocols,
const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
tsi_ssl_handshaker_factory **factory) {
tsi_ssl_server_handshaker_factory *impl = NULL; tsi_ssl_server_handshaker_factory *impl = NULL;
tsi_result result = TSI_OK; tsi_result result = TSI_OK;
size_t i = 0; size_t i = 0;
@ -1445,7 +1473,6 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
if (result != TSI_OK) break; if (result != TSI_OK) break;
if (pem_client_root_certs != NULL) { if (pem_client_root_certs != NULL) {
int flags = SSL_VERIFY_PEER;
STACK_OF(X509_NAME) *root_names = NULL; STACK_OF(X509_NAME) *root_names = NULL;
result = ssl_ctx_load_verification_certs( result = ssl_ctx_load_verification_certs(
impl->ssl_contexts[i], pem_client_root_certs, impl->ssl_contexts[i], pem_client_root_certs,
@ -1455,8 +1482,29 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
break; break;
} }
SSL_CTX_set_client_CA_list(impl->ssl_contexts[i], root_names); SSL_CTX_set_client_CA_list(impl->ssl_contexts[i], root_names);
if (force_client_auth) flags |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT; switch (client_certificate_request) {
SSL_CTX_set_verify(impl->ssl_contexts[i], flags, NULL); case TSI_DONT_REQUEST_CLIENT_CERTIFICATE:
SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_NONE, NULL);
break;
case TSI_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_PEER,
NullVerifyCallback);
break;
case TSI_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY:
SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_PEER, NULL);
break;
case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
SSL_CTX_set_verify(
impl->ssl_contexts[i],
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
NullVerifyCallback);
break;
case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY:
SSL_CTX_set_verify(
impl->ssl_contexts[i],
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
break;
}
/* TODO(jboeuf): Add revocation verification. */ /* TODO(jboeuf): Add revocation verification. */
} }

@ -142,6 +142,23 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols, const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
tsi_ssl_handshaker_factory **factory); tsi_ssl_handshaker_factory **factory);
/* Same as tsi_create_ssl_server_handshaker_factory method except uses
tsi_client_certificate_request_type to support more ways to handle client
certificate authentication.
- client_certificate_request, if set to non-zero will force the client to
authenticate with an SSL cert. Note that this option is ignored if
pem_client_root_certs is NULL or pem_client_roots_certs_size is 0 */
tsi_result tsi_create_ssl_server_handshaker_factory_ex(
const unsigned char **pem_private_keys,
const size_t *pem_private_keys_sizes, const unsigned char **pem_cert_chains,
const size_t *pem_cert_chains_sizes, size_t key_cert_pair_count,
const unsigned char *pem_client_root_certs,
size_t pem_client_root_certs_size,
tsi_client_certificate_request_type client_certificate_request,
const char *cipher_suites, const unsigned char **alpn_protocols,
const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols,
tsi_ssl_handshaker_factory **factory);
/* Creates a handshaker. /* Creates a handshaker.
- self is the factory from which the handshaker will be created. - self is the factory from which the handshaker will be created.
- server_name_indication indicates the name of the server the client is - server_name_indication indicates the name of the server the client is

@ -59,6 +59,15 @@ typedef enum {
TSI_OUT_OF_RESOURCES = 12 TSI_OUT_OF_RESOURCES = 12
} tsi_result; } tsi_result;
typedef enum {
// Default option
TSI_DONT_REQUEST_CLIENT_CERTIFICATE,
TSI_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
TSI_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY,
TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY,
TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY,
} tsi_client_certificate_request_type;
const char *tsi_result_to_string(tsi_result result); const char *tsi_result_to_string(tsi_result result);
/* --- tsi tracing --- */ /* --- tsi tracing --- */

@ -42,7 +42,6 @@
#include <grpc/support/string_util.h> #include <grpc/support/string_util.h>
#include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/channel/compress_filter.h"
#include "src/cpp/common/create_auth_context.h"
namespace grpc { namespace grpc {
@ -116,13 +115,6 @@ void ClientContext::set_compression_algorithm(
AddMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name); AddMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name);
} }
std::shared_ptr<const AuthContext> ClientContext::auth_context() const {
if (auth_context_.get() == nullptr) {
auth_context_ = CreateAuthContext(call_);
}
return auth_context_;
}
void ClientContext::TryCancel() { void ClientContext::TryCancel() {
grpc::unique_lock<grpc::mutex> lock(mu_); grpc::unique_lock<grpc::mutex> lock(mu_);
if (call_) { if (call_) {

@ -130,10 +130,14 @@ std::shared_ptr<ServerCredentials> SslServerCredentials(
key_cert_pair->cert_chain.c_str()}; key_cert_pair->cert_chain.c_str()};
pem_key_cert_pairs.push_back(p); pem_key_cert_pairs.push_back(p);
} }
grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create( grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create_ex(
options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(), options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(),
pem_key_cert_pairs.empty() ? nullptr : &pem_key_cert_pairs[0], pem_key_cert_pairs.empty() ? nullptr : &pem_key_cert_pairs[0],
pem_key_cert_pairs.size(), options.force_client_auth, nullptr); pem_key_cert_pairs.size(),
options.force_client_auth
? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
: options.client_certificate_request,
nullptr);
return std::shared_ptr<ServerCredentials>( return std::shared_ptr<ServerCredentials>(
new SecureServerCredentials(c_creds)); new SecureServerCredentials(c_creds));
} }

@ -44,7 +44,6 @@
#include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/channel/compress_filter.h"
#include "src/core/lib/surface/call.h" #include "src/core/lib/surface/call.h"
#include "src/cpp/common/create_auth_context.h"
namespace grpc { namespace grpc {
@ -214,18 +213,6 @@ void ServerContext::set_compression_algorithm(
AddInitialMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name); AddInitialMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name);
} }
void ServerContext::set_call(grpc_call* call) {
call_ = call;
auth_context_ = CreateAuthContext(call);
}
std::shared_ptr<const AuthContext> ServerContext::auth_context() const {
if (auth_context_.get() == nullptr) {
auth_context_ = CreateAuthContext(call_);
}
return auth_context_;
}
grpc::string ServerContext::peer() const { grpc::string ServerContext::peer() const {
grpc::string peer; grpc::string peer;
if (call_) { if (call_) {

@ -54,10 +54,20 @@ namespace Grpc.Core.Tests
var deadline = DateTime.UtcNow; var deadline = DateTime.UtcNow;
Assert.AreEqual(deadline, options.WithDeadline(deadline).Deadline.Value); Assert.AreEqual(deadline, options.WithDeadline(deadline).Deadline.Value);
var token = new CancellationTokenSource().Token; var cancellationToken = new CancellationTokenSource().Token;
Assert.AreEqual(token, options.WithCancellationToken(token).CancellationToken); Assert.AreEqual(cancellationToken, options.WithCancellationToken(cancellationToken).CancellationToken);
var writeOptions = new WriteOptions();
Assert.AreSame(writeOptions, options.WithWriteOptions(writeOptions).WriteOptions);
var propagationToken = new ContextPropagationToken(CallSafeHandle.NullInstance, DateTime.UtcNow,
CancellationToken.None, ContextPropagationOptions.Default);
Assert.AreSame(propagationToken, options.WithPropagationToken(propagationToken).PropagationToken);
var credentials = new FakeCallCredentials();
Assert.AreSame(credentials, options.WithCredentials(credentials).Credentials);
// Change original instance is unchanged. // Check that the original instance is unchanged.
Assert.IsNull(options.Headers); Assert.IsNull(options.Headers);
Assert.IsNull(options.Deadline); Assert.IsNull(options.Deadline);
Assert.AreEqual(CancellationToken.None, options.CancellationToken); Assert.AreEqual(CancellationToken.None, options.CancellationToken);

@ -100,10 +100,7 @@ namespace Grpc.Core
/// </summary> /// </summary>
public WriteOptions WriteOptions public WriteOptions WriteOptions
{ {
get get { return this.writeOptions; }
{
return this.writeOptions;
}
} }
/// <summary> /// <summary>
@ -111,10 +108,7 @@ namespace Grpc.Core
/// </summary> /// </summary>
public ContextPropagationToken PropagationToken public ContextPropagationToken PropagationToken
{ {
get get { return this.propagationToken; }
{
return this.propagationToken;
}
} }
/// <summary> /// <summary>
@ -122,10 +116,7 @@ namespace Grpc.Core
/// </summary> /// </summary>
public CallCredentials Credentials public CallCredentials Credentials
{ {
get get { return this.credentials; }
{
return this.credentials;
}
} }
/// <summary> /// <summary>
@ -164,6 +155,42 @@ namespace Grpc.Core
return newOptions; return newOptions;
} }
/// <summary>
/// Returns new instance of <see cref="CallOptions"/> with
/// <c>WriteOptions</c> set to the value provided. Values of all other fields are preserved.
/// </summary>
/// <param name="writeOptions">The write options.</param>
public CallOptions WithWriteOptions(WriteOptions writeOptions)
{
var newOptions = this;
newOptions.writeOptions = writeOptions;
return newOptions;
}
/// <summary>
/// Returns new instance of <see cref="CallOptions"/> with
/// <c>PropagationToken</c> set to the value provided. Values of all other fields are preserved.
/// </summary>
/// <param name="propagationToken">The context propagation token.</param>
public CallOptions WithPropagationToken(ContextPropagationToken propagationToken)
{
var newOptions = this;
newOptions.propagationToken = propagationToken;
return newOptions;
}
/// <summary>
/// Returns new instance of <see cref="CallOptions"/> with
/// <c>Credentials</c> set to the value provided. Values of all other fields are preserved.
/// </summary>
/// <param name="credentials">The call credentials.</param>
public CallOptions WithCredentials(CallCredentials credentials)
{
var newOptions = this;
newOptions.credentials = credentials;
return newOptions;
}
/// <summary> /// <summary>
/// Returns a new instance of <see cref="CallOptions"/> with /// Returns a new instance of <see cref="CallOptions"/> with
/// all previously unset values set to their defaults and deadline and cancellation /// all previously unset values set to their defaults and deadline and cancellation

@ -33,5 +33,6 @@
using System.Reflection; using System.Reflection;
// The current version of gRPC C#.
[assembly: AssemblyVersion(Grpc.Core.VersionInfo.CurrentAssemblyVersion)] [assembly: AssemblyVersion(Grpc.Core.VersionInfo.CurrentAssemblyVersion)]
[assembly: AssemblyFileVersion(Grpc.Core.VersionInfo.CurrentAssemblyFileVersion)]
[assembly: AssemblyInformationalVersion(Grpc.Core.VersionInfo.CurrentVersion)]

@ -35,13 +35,20 @@ namespace Grpc.Core
{ {
/// <summary> /// <summary>
/// Provides info about current version of gRPC. /// Provides info about current version of gRPC.
/// See https://codingforsmarties.wordpress.com/2016/01/21/how-to-version-assemblies-destined-for-nuget/
/// for rationale about assembly versioning.
/// </summary> /// </summary>
public static class VersionInfo public static class VersionInfo
{ {
/// <summary> /// <summary>
/// Current version of gRPC C# assemblies /// Current <c>AssemblyVersion</c> attribute of gRPC C# assemblies
/// </summary> /// </summary>
public const string CurrentAssemblyVersion = "0.14.0.0"; public const string CurrentAssemblyVersion = "1.0.0.0";
/// <summary>
/// Current <c>AssemblyFileVersion</c> of gRPC C# assemblies
/// </summary>
public const string CurrentAssemblyFileVersion = "0.14.0.0";
/// <summary> /// <summary>
/// Current version of gRPC C# /// Current version of gRPC C#

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{ADEBA147-80AE-4710-82E9-5B7F93690266}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Grpc.IntegrationTesting.StressClient</RootNamespace>
<AssemblyName>Grpc.IntegrationTesting.StressClient</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseSigned|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\ReleaseSigned</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Grpc.Core\Version.cs">
<Link>Version.cs</Link>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Grpc.Core\Grpc.Core.csproj">
<Project>{CCC4440E-49F7-4790-B0AF-FEABB0837AE7}</Project>
<Name>Grpc.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Grpc.IntegrationTesting\Grpc.IntegrationTesting.csproj">
<Project>{C61154BA-DD4A-4838-8420-0162A28925E0}</Project>
<Name>Grpc.IntegrationTesting</Name>
</ProjectReference>
</ItemGroup>
</Project>

@ -1,5 +1,6 @@
#region Copyright notice and license
// Copyright 2015, Google Inc. // Copyright 2016, Google Inc.
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
@ -28,16 +29,17 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3"; #endregion
package grpc.testing; using System;
// An empty message that you can re-use to avoid defining duplicated empty namespace Grpc.IntegrationTesting.StressClient
// messages in your project. A typical example is to use it as argument or the {
// return value of a service API. For instance: class MainClass
// {
// service Foo { public static void Main(string[] args)
// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; {
// }; StressTestClient.Run(args);
// }
message Empty {} }
}

@ -0,0 +1,11 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("Grpc.IntegrationTesting.StressClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

@ -31,7 +31,7 @@ namespace Grpc.Testing {
"cnBjLnRlc3RpbmcuQ2xvc2VkTG9vcFBhcmFtc0gAEi4KB3BvaXNzb24YAiAB", "cnBjLnRlc3RpbmcuQ2xvc2VkTG9vcFBhcmFtc0gAEi4KB3BvaXNzb24YAiAB",
"KAsyGy5ncnBjLnRlc3RpbmcuUG9pc3NvblBhcmFtc0gAQgYKBGxvYWQiQwoO", "KAsyGy5ncnBjLnRlc3RpbmcuUG9pc3NvblBhcmFtc0gAQgYKBGxvYWQiQwoO",
"U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy", "U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy",
"X2hvc3Rfb3ZlcnJpZGUYAiABKAki1gMKDENsaWVudENvbmZpZxIWCg5zZXJ2", "X2hvc3Rfb3ZlcnJpZGUYAiABKAki8AMKDENsaWVudENvbmZpZxIWCg5zZXJ2",
"ZXJfdGFyZ2V0cxgBIAMoCRItCgtjbGllbnRfdHlwZRgCIAEoDjIYLmdycGMu", "ZXJfdGFyZ2V0cxgBIAMoCRItCgtjbGllbnRfdHlwZRgCIAEoDjIYLmdycGMu",
"dGVzdGluZy5DbGllbnRUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgDIAEoCzIc", "dGVzdGluZy5DbGllbnRUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgDIAEoCzIc",
"LmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIkChxvdXRzdGFuZGluZ19y", "LmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIkChxvdXRzdGFuZGluZ19y",
@ -41,46 +41,48 @@ namespace Grpc.Testing {
"ASgLMhguZ3JwYy50ZXN0aW5nLkxvYWRQYXJhbXMSMwoOcGF5bG9hZF9jb25m", "ASgLMhguZ3JwYy50ZXN0aW5nLkxvYWRQYXJhbXMSMwoOcGF5bG9hZF9jb25m",
"aWcYCyABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxI3ChBoaXN0", "aWcYCyABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxI3ChBoaXN0",
"b2dyYW1fcGFyYW1zGAwgASgLMh0uZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbVBh", "b2dyYW1fcGFyYW1zGAwgASgLMh0uZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbVBh",
"cmFtcxIRCgljb3JlX2xpc3QYDSADKAUSEgoKY29yZV9saW1pdBgOIAEoBSI4", "cmFtcxIRCgljb3JlX2xpc3QYDSADKAUSEgoKY29yZV9saW1pdBgOIAEoBRIY",
"CgxDbGllbnRTdGF0dXMSKAoFc3RhdHMYASABKAsyGS5ncnBjLnRlc3Rpbmcu", "ChBvdGhlcl9jbGllbnRfYXBpGA8gASgJIjgKDENsaWVudFN0YXR1cxIoCgVz",
"Q2xpZW50U3RhdHMiFQoETWFyaxINCgVyZXNldBgBIAEoCCJoCgpDbGllbnRB", "dGF0cxgBIAEoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cyIVCgRNYXJr",
"cmdzEisKBXNldHVwGAEgASgLMhouZ3JwYy50ZXN0aW5nLkNsaWVudENvbmZp", "Eg0KBXJlc2V0GAEgASgIImgKCkNsaWVudEFyZ3MSKwoFc2V0dXAYASABKAsy",
"Z0gAEiIKBG1hcmsYAiABKAsyEi5ncnBjLnRlc3RpbmcuTWFya0gAQgkKB2Fy", "Gi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmlnSAASIgoEbWFyaxgCIAEoCzIS",
"Z3R5cGUi/AEKDFNlcnZlckNvbmZpZxItCgtzZXJ2ZXJfdHlwZRgBIAEoDjIY", "LmdycGMudGVzdGluZy5NYXJrSABCCQoHYXJndHlwZSKWAgoMU2VydmVyQ29u",
"LmdycGMudGVzdGluZy5TZXJ2ZXJUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgC", "ZmlnEi0KC3NlcnZlcl90eXBlGAEgASgOMhguZ3JwYy50ZXN0aW5nLlNlcnZl",
"IAEoCzIcLmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIMCgRwb3J0GAQg", "clR5cGUSNQoPc2VjdXJpdHlfcGFyYW1zGAIgASgLMhwuZ3JwYy50ZXN0aW5n",
"ASgFEhwKFGFzeW5jX3NlcnZlcl90aHJlYWRzGAcgASgFEhIKCmNvcmVfbGlt", "LlNlY3VyaXR5UGFyYW1zEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNfc2VydmVy",
"aXQYCCABKAUSMwoOcGF5bG9hZF9jb25maWcYCSABKAsyGy5ncnBjLnRlc3Rp", "X3RocmVhZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5wYXlsb2Fk",
"bmcuUGF5bG9hZENvbmZpZxIRCgljb3JlX2xpc3QYCiADKAUiaAoKU2VydmVy", "X2NvbmZpZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29uZmlnEhEK",
"QXJncxIrCgVzZXR1cBgBIAEoCzIaLmdycGMudGVzdGluZy5TZXJ2ZXJDb25m", "CWNvcmVfbGlzdBgKIAMoBRIYChBvdGhlcl9zZXJ2ZXJfYXBpGAsgASgJImgK",
"aWdIABIiCgRtYXJrGAIgASgLMhIuZ3JwYy50ZXN0aW5nLk1hcmtIAEIJCgdh", "ClNlcnZlckFyZ3MSKwoFc2V0dXAYASABKAsyGi5ncnBjLnRlc3RpbmcuU2Vy",
"cmd0eXBlIlUKDFNlcnZlclN0YXR1cxIoCgVzdGF0cxgBIAEoCzIZLmdycGMu", "dmVyQ29uZmlnSAASIgoEbWFyaxgCIAEoCzISLmdycGMudGVzdGluZy5NYXJr",
"dGVzdGluZy5TZXJ2ZXJTdGF0cxIMCgRwb3J0GAIgASgFEg0KBWNvcmVzGAMg", "SABCCQoHYXJndHlwZSJVCgxTZXJ2ZXJTdGF0dXMSKAoFc3RhdHMYASABKAsy",
"ASgFIg0KC0NvcmVSZXF1ZXN0Ih0KDENvcmVSZXNwb25zZRINCgVjb3JlcxgB", "GS5ncnBjLnRlc3RpbmcuU2VydmVyU3RhdHMSDAoEcG9ydBgCIAEoBRINCgVj",
"IAEoBSIGCgRWb2lkIv0BCghTY2VuYXJpbxIMCgRuYW1lGAEgASgJEjEKDWNs", "b3JlcxgDIAEoBSINCgtDb3JlUmVxdWVzdCIdCgxDb3JlUmVzcG9uc2USDQoF",
"aWVudF9jb25maWcYAiABKAsyGi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmln", "Y29yZXMYASABKAUiBgoEVm9pZCL9AQoIU2NlbmFyaW8SDAoEbmFtZRgBIAEo",
"EhMKC251bV9jbGllbnRzGAMgASgFEjEKDXNlcnZlcl9jb25maWcYBCABKAsy", "CRIxCg1jbGllbnRfY29uZmlnGAIgASgLMhouZ3JwYy50ZXN0aW5nLkNsaWVu",
"Gi5ncnBjLnRlc3RpbmcuU2VydmVyQ29uZmlnEhMKC251bV9zZXJ2ZXJzGAUg", "dENvbmZpZxITCgtudW1fY2xpZW50cxgDIAEoBRIxCg1zZXJ2ZXJfY29uZmln",
"ASgFEhYKDndhcm11cF9zZWNvbmRzGAYgASgFEhkKEWJlbmNobWFya19zZWNv", "GAQgASgLMhouZ3JwYy50ZXN0aW5nLlNlcnZlckNvbmZpZxITCgtudW1fc2Vy",
"bmRzGAcgASgFEiAKGHNwYXduX2xvY2FsX3dvcmtlcl9jb3VudBgIIAEoBSI2", "dmVycxgFIAEoBRIWCg53YXJtdXBfc2Vjb25kcxgGIAEoBRIZChFiZW5jaG1h",
"CglTY2VuYXJpb3MSKQoJc2NlbmFyaW9zGAEgAygLMhYuZ3JwYy50ZXN0aW5n", "cmtfc2Vjb25kcxgHIAEoBRIgChhzcGF3bl9sb2NhbF93b3JrZXJfY291bnQY",
"LlNjZW5hcmlvIpICChVTY2VuYXJpb1Jlc3VsdFN1bW1hcnkSCwoDcXBzGAEg", "CCABKAUiNgoJU2NlbmFyaW9zEikKCXNjZW5hcmlvcxgBIAMoCzIWLmdycGMu",
"ASgBEhsKE3Fwc19wZXJfc2VydmVyX2NvcmUYAiABKAESGgoSc2VydmVyX3N5", "dGVzdGluZy5TY2VuYXJpbyKSAgoVU2NlbmFyaW9SZXN1bHRTdW1tYXJ5EgsK",
"c3RlbV90aW1lGAMgASgBEhgKEHNlcnZlcl91c2VyX3RpbWUYBCABKAESGgoS", "A3FwcxgBIAEoARIbChNxcHNfcGVyX3NlcnZlcl9jb3JlGAIgASgBEhoKEnNl",
"Y2xpZW50X3N5c3RlbV90aW1lGAUgASgBEhgKEGNsaWVudF91c2VyX3RpbWUY", "cnZlcl9zeXN0ZW1fdGltZRgDIAEoARIYChBzZXJ2ZXJfdXNlcl90aW1lGAQg",
"BiABKAESEgoKbGF0ZW5jeV81MBgHIAEoARISCgpsYXRlbmN5XzkwGAggASgB", "ASgBEhoKEmNsaWVudF9zeXN0ZW1fdGltZRgFIAEoARIYChBjbGllbnRfdXNl",
"EhIKCmxhdGVuY3lfOTUYCSABKAESEgoKbGF0ZW5jeV85ORgKIAEoARITCgts", "cl90aW1lGAYgASgBEhIKCmxhdGVuY3lfNTAYByABKAESEgoKbGF0ZW5jeV85",
"YXRlbmN5Xzk5ORgLIAEoASKYAgoOU2NlbmFyaW9SZXN1bHQSKAoIc2NlbmFy", "MBgIIAEoARISCgpsYXRlbmN5Xzk1GAkgASgBEhIKCmxhdGVuY3lfOTkYCiAB",
"aW8YASABKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8SLgoJbGF0ZW5jaWVz", "KAESEwoLbGF0ZW5jeV85OTkYCyABKAEimAIKDlNjZW5hcmlvUmVzdWx0EigK",
"GAIgASgLMhsuZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbURhdGESLwoMY2xpZW50", "CHNjZW5hcmlvGAEgASgLMhYuZ3JwYy50ZXN0aW5nLlNjZW5hcmlvEi4KCWxh",
"X3N0YXRzGAMgAygLMhkuZ3JwYy50ZXN0aW5nLkNsaWVudFN0YXRzEi8KDHNl", "dGVuY2llcxgCIAEoCzIbLmdycGMudGVzdGluZy5IaXN0b2dyYW1EYXRhEi8K",
"cnZlcl9zdGF0cxgEIAMoCzIZLmdycGMudGVzdGluZy5TZXJ2ZXJTdGF0cxIU", "DGNsaWVudF9zdGF0cxgDIAMoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0",
"CgxzZXJ2ZXJfY29yZXMYBSADKAUSNAoHc3VtbWFyeRgGIAEoCzIjLmdycGMu", "cxIvCgxzZXJ2ZXJfc3RhdHMYBCADKAsyGS5ncnBjLnRlc3RpbmcuU2VydmVy",
"dGVzdGluZy5TY2VuYXJpb1Jlc3VsdFN1bW1hcnkqLwoKQ2xpZW50VHlwZRIP", "U3RhdHMSFAoMc2VydmVyX2NvcmVzGAUgAygFEjQKB3N1bW1hcnkYBiABKAsy",
"CgtTWU5DX0NMSUVOVBAAEhAKDEFTWU5DX0NMSUVOVBABKkkKClNlcnZlclR5", "Iy5ncnBjLnRlc3RpbmcuU2NlbmFyaW9SZXN1bHRTdW1tYXJ5KkEKCkNsaWVu",
"cGUSDwoLU1lOQ19TRVJWRVIQABIQCgxBU1lOQ19TRVJWRVIQARIYChRBU1lO", "dFR5cGUSDwoLU1lOQ19DTElFTlQQABIQCgxBU1lOQ19DTElFTlQQARIQCgxP",
"Q19HRU5FUklDX1NFUlZFUhACKiMKB1JwY1R5cGUSCQoFVU5BUlkQABINCglT", "VEhFUl9DTElFTlQQAipbCgpTZXJ2ZXJUeXBlEg8KC1NZTkNfU0VSVkVSEAAS",
"VFJFQU1JTkcQAWIGcHJvdG8z")); "EAoMQVNZTkNfU0VSVkVSEAESGAoUQVNZTkNfR0VORVJJQ19TRVJWRVIQAhIQ",
"CgxPVEhFUl9TRVJWRVIQAyojCgdScGNUeXBlEgkKBVVOQVJZEAASDQoJU1RS",
"RUFNSU5HEAFiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, },
new pbr::GeneratedCodeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedCodeInfo[] {
@ -88,11 +90,11 @@ namespace Grpc.Testing {
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), global::Grpc.Testing.ClosedLoopParams.Parser, null, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), global::Grpc.Testing.ClosedLoopParams.Parser, null, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerArgs), global::Grpc.Testing.ServerArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerArgs), global::Grpc.Testing.ServerArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStatus), global::Grpc.Testing.ServerStatus.Parser, new[]{ "Stats", "Port", "Cores" }, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStatus), global::Grpc.Testing.ServerStatus.Parser, new[]{ "Stats", "Port", "Cores" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.CoreRequest), global::Grpc.Testing.CoreRequest.Parser, null, null, null, null), new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.CoreRequest), global::Grpc.Testing.CoreRequest.Parser, null, null, null, null),
@ -109,14 +111,26 @@ namespace Grpc.Testing {
} }
#region Enums #region Enums
public enum ClientType { public enum ClientType {
/// <summary>
/// Many languages support a basic distinction between using
/// sync or async client, and this allows the specification
/// </summary>
SYNC_CLIENT = 0, SYNC_CLIENT = 0,
ASYNC_CLIENT = 1, ASYNC_CLIENT = 1,
/// <summary>
/// used for some language-specific variants
/// </summary>
OTHER_CLIENT = 2,
} }
public enum ServerType { public enum ServerType {
SYNC_SERVER = 0, SYNC_SERVER = 0,
ASYNC_SERVER = 1, ASYNC_SERVER = 1,
ASYNC_GENERIC_SERVER = 2, ASYNC_GENERIC_SERVER = 2,
/// <summary>
/// used for some language-specific variants
/// </summary>
OTHER_SERVER = 3,
} }
public enum RpcType { public enum RpcType {
@ -651,6 +665,7 @@ namespace Grpc.Testing {
HistogramParams = other.histogramParams_ != null ? other.HistogramParams.Clone() : null; HistogramParams = other.histogramParams_ != null ? other.HistogramParams.Clone() : null;
coreList_ = other.coreList_.Clone(); coreList_ = other.coreList_.Clone();
coreLimit_ = other.coreLimit_; coreLimit_ = other.coreLimit_;
otherClientApi_ = other.otherClientApi_;
} }
public ClientConfig Clone() { public ClientConfig Clone() {
@ -795,6 +810,19 @@ namespace Grpc.Testing {
} }
} }
/// <summary>Field number for the "other_client_api" field.</summary>
public const int OtherClientApiFieldNumber = 15;
private string otherClientApi_ = "";
/// <summary>
/// If we use an OTHER_CLIENT client_type, this string gives more detail
/// </summary>
public string OtherClientApi {
get { return otherClientApi_; }
set {
otherClientApi_ = pb::Preconditions.CheckNotNull(value, "value");
}
}
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as ClientConfig); return Equals(other as ClientConfig);
} }
@ -818,6 +846,7 @@ namespace Grpc.Testing {
if (!object.Equals(HistogramParams, other.HistogramParams)) return false; if (!object.Equals(HistogramParams, other.HistogramParams)) return false;
if(!coreList_.Equals(other.coreList_)) return false; if(!coreList_.Equals(other.coreList_)) return false;
if (CoreLimit != other.CoreLimit) return false; if (CoreLimit != other.CoreLimit) return false;
if (OtherClientApi != other.OtherClientApi) return false;
return true; return true;
} }
@ -835,6 +864,7 @@ namespace Grpc.Testing {
if (histogramParams_ != null) hash ^= HistogramParams.GetHashCode(); if (histogramParams_ != null) hash ^= HistogramParams.GetHashCode();
hash ^= coreList_.GetHashCode(); hash ^= coreList_.GetHashCode();
if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode(); if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode();
if (OtherClientApi.Length != 0) hash ^= OtherClientApi.GetHashCode();
return hash; return hash;
} }
@ -885,6 +915,10 @@ namespace Grpc.Testing {
output.WriteRawTag(112); output.WriteRawTag(112);
output.WriteInt32(CoreLimit); output.WriteInt32(CoreLimit);
} }
if (OtherClientApi.Length != 0) {
output.WriteRawTag(122);
output.WriteString(OtherClientApi);
}
} }
public int CalculateSize() { public int CalculateSize() {
@ -921,6 +955,9 @@ namespace Grpc.Testing {
if (CoreLimit != 0) { if (CoreLimit != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(CoreLimit); size += 1 + pb::CodedOutputStream.ComputeInt32Size(CoreLimit);
} }
if (OtherClientApi.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherClientApi);
}
return size; return size;
} }
@ -972,6 +1009,9 @@ namespace Grpc.Testing {
if (other.CoreLimit != 0) { if (other.CoreLimit != 0) {
CoreLimit = other.CoreLimit; CoreLimit = other.CoreLimit;
} }
if (other.OtherClientApi.Length != 0) {
OtherClientApi = other.OtherClientApi;
}
} }
public void MergeFrom(pb::CodedInputStream input) { public void MergeFrom(pb::CodedInputStream input) {
@ -1042,6 +1082,10 @@ namespace Grpc.Testing {
CoreLimit = input.ReadInt32(); CoreLimit = input.ReadInt32();
break; break;
} }
case 122: {
OtherClientApi = input.ReadString();
break;
}
} }
} }
} }
@ -1462,6 +1506,7 @@ namespace Grpc.Testing {
coreLimit_ = other.coreLimit_; coreLimit_ = other.coreLimit_;
PayloadConfig = other.payloadConfig_ != null ? other.PayloadConfig.Clone() : null; PayloadConfig = other.payloadConfig_ != null ? other.PayloadConfig.Clone() : null;
coreList_ = other.coreList_.Clone(); coreList_ = other.coreList_.Clone();
otherServerApi_ = other.otherServerApi_;
} }
public ServerConfig Clone() { public ServerConfig Clone() {
@ -1552,6 +1597,19 @@ namespace Grpc.Testing {
get { return coreList_; } get { return coreList_; }
} }
/// <summary>Field number for the "other_server_api" field.</summary>
public const int OtherServerApiFieldNumber = 11;
private string otherServerApi_ = "";
/// <summary>
/// If we use an OTHER_SERVER client_type, this string gives more detail
/// </summary>
public string OtherServerApi {
get { return otherServerApi_; }
set {
otherServerApi_ = pb::Preconditions.CheckNotNull(value, "value");
}
}
public override bool Equals(object other) { public override bool Equals(object other) {
return Equals(other as ServerConfig); return Equals(other as ServerConfig);
} }
@ -1570,6 +1628,7 @@ namespace Grpc.Testing {
if (CoreLimit != other.CoreLimit) return false; if (CoreLimit != other.CoreLimit) return false;
if (!object.Equals(PayloadConfig, other.PayloadConfig)) return false; if (!object.Equals(PayloadConfig, other.PayloadConfig)) return false;
if(!coreList_.Equals(other.coreList_)) return false; if(!coreList_.Equals(other.coreList_)) return false;
if (OtherServerApi != other.OtherServerApi) return false;
return true; return true;
} }
@ -1582,6 +1641,7 @@ namespace Grpc.Testing {
if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode(); if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode();
if (payloadConfig_ != null) hash ^= PayloadConfig.GetHashCode(); if (payloadConfig_ != null) hash ^= PayloadConfig.GetHashCode();
hash ^= coreList_.GetHashCode(); hash ^= coreList_.GetHashCode();
if (OtherServerApi.Length != 0) hash ^= OtherServerApi.GetHashCode();
return hash; return hash;
} }
@ -1615,6 +1675,10 @@ namespace Grpc.Testing {
output.WriteMessage(PayloadConfig); output.WriteMessage(PayloadConfig);
} }
coreList_.WriteTo(output, _repeated_coreList_codec); coreList_.WriteTo(output, _repeated_coreList_codec);
if (OtherServerApi.Length != 0) {
output.WriteRawTag(90);
output.WriteString(OtherServerApi);
}
} }
public int CalculateSize() { public int CalculateSize() {
@ -1638,6 +1702,9 @@ namespace Grpc.Testing {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(PayloadConfig); size += 1 + pb::CodedOutputStream.ComputeMessageSize(PayloadConfig);
} }
size += coreList_.CalculateSize(_repeated_coreList_codec); size += coreList_.CalculateSize(_repeated_coreList_codec);
if (OtherServerApi.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherServerApi);
}
return size; return size;
} }
@ -1670,6 +1737,9 @@ namespace Grpc.Testing {
PayloadConfig.MergeFrom(other.PayloadConfig); PayloadConfig.MergeFrom(other.PayloadConfig);
} }
coreList_.Add(other.coreList_); coreList_.Add(other.coreList_);
if (other.OtherServerApi.Length != 0) {
OtherServerApi = other.OtherServerApi;
}
} }
public void MergeFrom(pb::CodedInputStream input) { public void MergeFrom(pb::CodedInputStream input) {
@ -1714,6 +1784,10 @@ namespace Grpc.Testing {
coreList_.AddEntriesFrom(input, _repeated_coreList_codec); coreList_.AddEntriesFrom(input, _repeated_coreList_codec);
break; break;
} }
case 90: {
OtherServerApi = input.ReadString();
break;
}
} }
} }
} }

@ -113,6 +113,9 @@
<Compile Include="GeneratedClientTest.cs" /> <Compile Include="GeneratedClientTest.cs" />
<Compile Include="InterarrivalTimers.cs" /> <Compile Include="InterarrivalTimers.cs" />
<Compile Include="NUnitMain.cs" /> <Compile Include="NUnitMain.cs" />
<Compile Include="StressTestClient.cs" />
<Compile Include="Metrics.cs" />
<Compile Include="MetricsGrpc.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>

@ -0,0 +1,452 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: src/proto/grpc/testing/metrics.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Testing {
/// <summary>Holder for reflection information generated from src/proto/grpc/testing/metrics.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class MetricsReflection {
#region Descriptor
/// <summary>File descriptor for src/proto/grpc/testing/metrics.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static MetricsReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"CiRzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL21ldHJpY3MucHJvdG8SDGdycGMu",
"dGVzdGluZyJsCg1HYXVnZVJlc3BvbnNlEgwKBG5hbWUYASABKAkSFAoKbG9u",
"Z192YWx1ZRgCIAEoA0gAEhYKDGRvdWJsZV92YWx1ZRgDIAEoAUgAEhYKDHN0",
"cmluZ192YWx1ZRgEIAEoCUgAQgcKBXZhbHVlIhwKDEdhdWdlUmVxdWVzdBIM",
"CgRuYW1lGAEgASgJIg4KDEVtcHR5TWVzc2FnZTKgAQoOTWV0cmljc1NlcnZp",
"Y2USSQoMR2V0QWxsR2F1Z2VzEhouZ3JwYy50ZXN0aW5nLkVtcHR5TWVzc2Fn",
"ZRobLmdycGMudGVzdGluZy5HYXVnZVJlc3BvbnNlMAESQwoIR2V0R2F1Z2US",
"Gi5ncnBjLnRlc3RpbmcuR2F1Z2VSZXF1ZXN0GhsuZ3JwYy50ZXN0aW5nLkdh",
"dWdlUmVzcG9uc2ViBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.GaugeResponse), global::Grpc.Testing.GaugeResponse.Parser, new[]{ "Name", "LongValue", "DoubleValue", "StringValue" }, new[]{ "Value" }, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.GaugeRequest), global::Grpc.Testing.GaugeRequest.Parser, new[]{ "Name" }, null, null, null),
new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.EmptyMessage), global::Grpc.Testing.EmptyMessage.Parser, null, null, null, null)
}));
}
#endregion
}
#region Messages
/// <summary>
/// Reponse message containing the gauge name and value
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class GaugeResponse : pb::IMessage<GaugeResponse> {
private static readonly pb::MessageParser<GaugeResponse> _parser = new pb::MessageParser<GaugeResponse>(() => new GaugeResponse());
public static pb::MessageParser<GaugeResponse> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MetricsReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
public GaugeResponse() {
OnConstruction();
}
partial void OnConstruction();
public GaugeResponse(GaugeResponse other) : this() {
name_ = other.name_;
switch (other.ValueCase) {
case ValueOneofCase.LongValue:
LongValue = other.LongValue;
break;
case ValueOneofCase.DoubleValue:
DoubleValue = other.DoubleValue;
break;
case ValueOneofCase.StringValue:
StringValue = other.StringValue;
break;
}
}
public GaugeResponse Clone() {
return new GaugeResponse(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
get { return name_; }
set {
name_ = pb::Preconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "long_value" field.</summary>
public const int LongValueFieldNumber = 2;
public long LongValue {
get { return valueCase_ == ValueOneofCase.LongValue ? (long) value_ : 0L; }
set {
value_ = value;
valueCase_ = ValueOneofCase.LongValue;
}
}
/// <summary>Field number for the "double_value" field.</summary>
public const int DoubleValueFieldNumber = 3;
public double DoubleValue {
get { return valueCase_ == ValueOneofCase.DoubleValue ? (double) value_ : 0D; }
set {
value_ = value;
valueCase_ = ValueOneofCase.DoubleValue;
}
}
/// <summary>Field number for the "string_value" field.</summary>
public const int StringValueFieldNumber = 4;
public string StringValue {
get { return valueCase_ == ValueOneofCase.StringValue ? (string) value_ : ""; }
set {
value_ = pb::Preconditions.CheckNotNull(value, "value");
valueCase_ = ValueOneofCase.StringValue;
}
}
private object value_;
/// <summary>Enum of possible cases for the "value" oneof.</summary>
public enum ValueOneofCase {
None = 0,
LongValue = 2,
DoubleValue = 3,
StringValue = 4,
}
private ValueOneofCase valueCase_ = ValueOneofCase.None;
public ValueOneofCase ValueCase {
get { return valueCase_; }
}
public void ClearValue() {
valueCase_ = ValueOneofCase.None;
value_ = null;
}
public override bool Equals(object other) {
return Equals(other as GaugeResponse);
}
public bool Equals(GaugeResponse other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (LongValue != other.LongValue) return false;
if (DoubleValue != other.DoubleValue) return false;
if (StringValue != other.StringValue) return false;
if (ValueCase != other.ValueCase) return false;
return true;
}
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (valueCase_ == ValueOneofCase.LongValue) hash ^= LongValue.GetHashCode();
if (valueCase_ == ValueOneofCase.DoubleValue) hash ^= DoubleValue.GetHashCode();
if (valueCase_ == ValueOneofCase.StringValue) hash ^= StringValue.GetHashCode();
hash ^= (int) valueCase_;
return hash;
}
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (valueCase_ == ValueOneofCase.LongValue) {
output.WriteRawTag(16);
output.WriteInt64(LongValue);
}
if (valueCase_ == ValueOneofCase.DoubleValue) {
output.WriteRawTag(25);
output.WriteDouble(DoubleValue);
}
if (valueCase_ == ValueOneofCase.StringValue) {
output.WriteRawTag(34);
output.WriteString(StringValue);
}
}
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (valueCase_ == ValueOneofCase.LongValue) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(LongValue);
}
if (valueCase_ == ValueOneofCase.DoubleValue) {
size += 1 + 8;
}
if (valueCase_ == ValueOneofCase.StringValue) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(StringValue);
}
return size;
}
public void MergeFrom(GaugeResponse other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
switch (other.ValueCase) {
case ValueOneofCase.LongValue:
LongValue = other.LongValue;
break;
case ValueOneofCase.DoubleValue:
DoubleValue = other.DoubleValue;
break;
case ValueOneofCase.StringValue:
StringValue = other.StringValue;
break;
}
}
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
break;
}
case 16: {
LongValue = input.ReadInt64();
break;
}
case 25: {
DoubleValue = input.ReadDouble();
break;
}
case 34: {
StringValue = input.ReadString();
break;
}
}
}
}
}
/// <summary>
/// Request message containing the gauge name
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class GaugeRequest : pb::IMessage<GaugeRequest> {
private static readonly pb::MessageParser<GaugeRequest> _parser = new pb::MessageParser<GaugeRequest>(() => new GaugeRequest());
public static pb::MessageParser<GaugeRequest> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MetricsReflection.Descriptor.MessageTypes[1]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
public GaugeRequest() {
OnConstruction();
}
partial void OnConstruction();
public GaugeRequest(GaugeRequest other) : this() {
name_ = other.name_;
}
public GaugeRequest Clone() {
return new GaugeRequest(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
public string Name {
get { return name_; }
set {
name_ = pb::Preconditions.CheckNotNull(value, "value");
}
}
public override bool Equals(object other) {
return Equals(other as GaugeRequest);
}
public bool Equals(GaugeRequest other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
return true;
}
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
return hash;
}
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
}
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
return size;
}
public void MergeFrom(GaugeRequest other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
}
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
case 10: {
Name = input.ReadString();
break;
}
}
}
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class EmptyMessage : pb::IMessage<EmptyMessage> {
private static readonly pb::MessageParser<EmptyMessage> _parser = new pb::MessageParser<EmptyMessage>(() => new EmptyMessage());
public static pb::MessageParser<EmptyMessage> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.MetricsReflection.Descriptor.MessageTypes[2]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
public EmptyMessage() {
OnConstruction();
}
partial void OnConstruction();
public EmptyMessage(EmptyMessage other) : this() {
}
public EmptyMessage Clone() {
return new EmptyMessage(this);
}
public override bool Equals(object other) {
return Equals(other as EmptyMessage);
}
public bool Equals(EmptyMessage other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
return true;
}
public override int GetHashCode() {
int hash = 1;
return hash;
}
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
}
public int CalculateSize() {
int size = 0;
return size;
}
public void MergeFrom(EmptyMessage other) {
if (other == null) {
return;
}
}
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
input.SkipLastField();
break;
}
}
}
}
#endregion
}
#endregion Designer generated code

@ -0,0 +1,146 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: src/proto/grpc/testing/metrics.proto
#region Designer generated code
using System;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
namespace Grpc.Testing {
public static class MetricsService
{
static readonly string __ServiceName = "grpc.testing.MetricsService";
static readonly Marshaller<global::Grpc.Testing.EmptyMessage> __Marshaller_EmptyMessage = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.EmptyMessage.Parser.ParseFrom);
static readonly Marshaller<global::Grpc.Testing.GaugeResponse> __Marshaller_GaugeResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.GaugeResponse.Parser.ParseFrom);
static readonly Marshaller<global::Grpc.Testing.GaugeRequest> __Marshaller_GaugeRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.GaugeRequest.Parser.ParseFrom);
static readonly Method<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse> __Method_GetAllGauges = new Method<global::Grpc.Testing.EmptyMessage, global::Grpc.Testing.GaugeResponse>(
MethodType.ServerStreaming,
__ServiceName,
"GetAllGauges",
__Marshaller_EmptyMessage,
__Marshaller_GaugeResponse);
static readonly Method<global::Grpc.Testing.GaugeRequest, global::Grpc.Testing.GaugeResponse> __Method_GetGauge = new Method<global::Grpc.Testing.GaugeRequest, global::Grpc.Testing.GaugeResponse>(
MethodType.Unary,
__ServiceName,
"GetGauge",
__Marshaller_GaugeRequest,
__Marshaller_GaugeResponse);
// service descriptor
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Grpc.Testing.MetricsReflection.Descriptor.Services[0]; }
}
// client interface
[System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IMetricsServiceClient
{
AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options);
global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options);
AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options);
}
// server-side interface
[System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IMetricsService
{
Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, ServerCallContext context);
Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context);
}
// server-side abstract class
public abstract class MetricsServiceBase
{
public virtual Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, ServerCallContext context)
{
throw new RpcException(new Status(StatusCode.Unimplemented, ""));
}
public virtual Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context)
{
throw new RpcException(new Status(StatusCode.Unimplemented, ""));
}
}
// client stub
public class MetricsServiceClient : ClientBase<MetricsServiceClient>, IMetricsServiceClient
{
public MetricsServiceClient(Channel channel) : base(channel)
{
}
public MetricsServiceClient(CallInvoker callInvoker) : base(callInvoker)
{
}
///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected MetricsServiceClient() : base()
{
}
///<summary>Protected constructor to allow creation of configured clients.</summary>
protected MetricsServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetAllGauges(request, new CallOptions(headers, deadline, cancellationToken));
}
public virtual AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options)
{
return CallInvoker.AsyncServerStreamingCall(__Method_GetAllGauges, null, options, request);
}
public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetGauge(request, new CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_GetGauge, null, options, request);
}
public virtual AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
return GetGaugeAsync(request, new CallOptions(headers, deadline, cancellationToken));
}
public virtual AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_GetGauge, null, options, request);
}
protected override MetricsServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new MetricsServiceClient(configuration);
}
}
// creates service definition that can be registered with a server
public static ServerServiceDefinition BindService(IMetricsService serviceImpl)
{
return ServerServiceDefinition.CreateBuilder(__ServiceName)
.AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges)
.AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build();
}
// creates service definition that can be registered with a server
public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl)
{
return ServerServiceDefinition.CreateBuilder(__ServiceName)
.AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges)
.AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build();
}
// creates a new client
public static MetricsServiceClient NewClient(Channel channel)
{
return new MetricsServiceClient(channel);
}
}
}
#endregion

@ -0,0 +1,318 @@
#region Copyright notice and license
// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using CommandLine;
using CommandLine.Text;
using Grpc.Core;
using Grpc.Core.Logging;
using Grpc.Core.Utils;
using Grpc.Testing;
namespace Grpc.IntegrationTesting
{
public class StressTestClient
{
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<StressTestClient>();
const double SecondsToNanos = 1e9;
private class ClientOptions
{
[Option("server_addresses", DefaultValue = "localhost:8080")]
public string ServerAddresses { get; set; }
[Option("test_cases", DefaultValue = "large_unary:100")]
public string TestCases { get; set; }
[Option("test_duration_secs", DefaultValue = -1)]
public int TestDurationSecs { get; set; }
[Option("num_channels_per_server", DefaultValue = 1)]
public int NumChannelsPerServer { get; set; }
[Option("num_stubs_per_channel", DefaultValue = 1)]
public int NumStubsPerChannel { get; set; }
[Option("metrics_port", DefaultValue = 8081)]
public int MetricsPort { get; set; }
[HelpOption]
public string GetUsage()
{
var help = new HelpText
{
Heading = "gRPC C# stress test client",
AddDashesToOption = true
};
help.AddPreOptionsLine("Usage:");
help.AddOptions(this);
return help;
}
}
ClientOptions options;
List<string> serverAddresses;
Dictionary<string, int> weightedTestCases;
WeightedRandomGenerator testCaseGenerator;
// cancellation will be emitted once test_duration_secs has elapsed.
CancellationTokenSource finishedTokenSource = new CancellationTokenSource();
Histogram histogram = new Histogram(0.01, 60 * SecondsToNanos);
private StressTestClient(ClientOptions options, List<string> serverAddresses, Dictionary<string, int> weightedTestCases)
{
this.options = options;
this.serverAddresses = serverAddresses;
this.weightedTestCases = weightedTestCases;
this.testCaseGenerator = new WeightedRandomGenerator(this.weightedTestCases);
}
public static void Run(string[] args)
{
var options = new ClientOptions();
if (!Parser.Default.ParseArguments(args, options))
{
Environment.Exit(1);
}
GrpcPreconditions.CheckArgument(options.NumChannelsPerServer > 0);
GrpcPreconditions.CheckArgument(options.NumStubsPerChannel > 0);
var serverAddresses = options.ServerAddresses.Split(',');
GrpcPreconditions.CheckArgument(serverAddresses.Length > 0, "You need to provide at least one server address");
var testCases = ParseWeightedTestCases(options.TestCases);
GrpcPreconditions.CheckArgument(testCases.Count > 0, "You need to provide at least one test case");
var interopClient = new StressTestClient(options, serverAddresses.ToList(), testCases);
interopClient.Run().Wait();
}
async Task Run()
{
var metricsServer = new Server()
{
Services = { MetricsService.BindService(new MetricsServiceImpl(histogram)) },
Ports = { { "[::]", options.MetricsPort, ServerCredentials.Insecure } }
};
metricsServer.Start();
if (options.TestDurationSecs >= 0)
{
finishedTokenSource.CancelAfter(TimeSpan.FromSeconds(options.TestDurationSecs));
}
var tasks = new List<Task>();
var channels = new List<Channel>();
foreach (var serverAddress in serverAddresses)
{
for (int i = 0; i < options.NumChannelsPerServer; i++)
{
var channel = new Channel(serverAddress, ChannelCredentials.Insecure);
channels.Add(channel);
for (int j = 0; j < options.NumStubsPerChannel; j++)
{
var client = TestService.NewClient(channel);
var task = Task.Factory.StartNew(() => RunBodyAsync(client).GetAwaiter().GetResult(),
TaskCreationOptions.LongRunning);
tasks.Add(task);
}
}
}
await Task.WhenAll(tasks);
foreach (var channel in channels)
{
await channel.ShutdownAsync();
}
await metricsServer.ShutdownAsync();
}
async Task RunBodyAsync(TestService.TestServiceClient client)
{
Logger.Info("Starting stress test client thread.");
while (!finishedTokenSource.Token.IsCancellationRequested)
{
var testCase = testCaseGenerator.GetNext();
var stopwatch = Stopwatch.StartNew();
await RunTestCaseAsync(client, testCase);
stopwatch.Stop();
histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * SecondsToNanos);
}
Logger.Info("Stress test client thread finished.");
}
async Task RunTestCaseAsync(TestService.TestServiceClient client, string testCase)
{
switch (testCase)
{
case "empty_unary":
InteropClient.RunEmptyUnary(client);
break;
case "large_unary":
InteropClient.RunLargeUnary(client);
break;
case "client_streaming":
await InteropClient.RunClientStreamingAsync(client);
break;
case "server_streaming":
await InteropClient.RunServerStreamingAsync(client);
break;
case "ping_pong":
await InteropClient.RunPingPongAsync(client);
break;
case "empty_stream":
await InteropClient.RunEmptyStreamAsync(client);
break;
case "cancel_after_begin":
await InteropClient.RunCancelAfterBeginAsync(client);
break;
case "cancel_after_first_response":
await InteropClient.RunCancelAfterFirstResponseAsync(client);
break;
case "timeout_on_sleeping_server":
await InteropClient.RunTimeoutOnSleepingServerAsync(client);
break;
case "custom_metadata":
await InteropClient.RunCustomMetadataAsync(client);
break;
case "status_code_and_message":
await InteropClient.RunStatusCodeAndMessageAsync(client);
break;
default:
throw new ArgumentException("Unsupported test case " + testCase);
}
}
static Dictionary<string, int> ParseWeightedTestCases(string weightedTestCases)
{
var result = new Dictionary<string, int>();
foreach (var weightedTestCase in weightedTestCases.Split(','))
{
var parts = weightedTestCase.Split(new char[] {':'}, 2);
GrpcPreconditions.CheckArgument(parts.Length == 2, "Malformed test_cases option.");
result.Add(parts[0], int.Parse(parts[1]));
}
return result;
}
class WeightedRandomGenerator
{
readonly Random random = new Random();
readonly List<Tuple<int, string>> cumulativeSums;
readonly int weightSum;
public WeightedRandomGenerator(Dictionary<string, int> weightedItems)
{
cumulativeSums = new List<Tuple<int, string>>();
weightSum = 0;
foreach (var entry in weightedItems)
{
weightSum += entry.Value;
cumulativeSums.Add(Tuple.Create(weightSum, entry.Key));
}
}
public string GetNext()
{
int rand = random.Next(weightSum);
foreach (var entry in cumulativeSums)
{
if (rand < entry.Item1)
{
return entry.Item2;
}
}
throw new InvalidOperationException("GetNext() failed.");
}
}
class MetricsServiceImpl : MetricsService.MetricsServiceBase
{
const string GaugeName = "csharp_overall_qps";
readonly Histogram histogram;
readonly WallClockStopwatch wallClockStopwatch = new WallClockStopwatch();
public MetricsServiceImpl(Histogram histogram)
{
this.histogram = histogram;
}
public override Task<GaugeResponse> GetGauge(GaugeRequest request, ServerCallContext context)
{
if (request.Name == GaugeName)
{
long qps = GetQpsAndReset();
return Task.FromResult(new GaugeResponse
{
Name = GaugeName,
LongValue = qps
});
}
throw new RpcException(new Status(StatusCode.InvalidArgument, "Gauge does not exist"));
}
public override async Task GetAllGauges(EmptyMessage request, IServerStreamWriter<GaugeResponse> responseStream, ServerCallContext context)
{
long qps = GetQpsAndReset();
var response = new GaugeResponse
{
Name = GaugeName,
LongValue = qps
};
await responseStream.WriteAsync(response);
}
long GetQpsAndReset()
{
var snapshot = histogram.GetSnapshot(true);
var elapsedSnapshot = wallClockStopwatch.GetElapsedSnapshot(true);
return (long) (snapshot.Count / elapsedSnapshot.Seconds);
}
}
}
}

@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.HealthCheck.Tests", "G
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.QpsWorker", "Grpc.IntegrationTesting.QpsWorker\Grpc.IntegrationTesting.QpsWorker.csproj", "{B82B7DFE-7F7B-40EF-B3D6-064FF2B01294}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.QpsWorker", "Grpc.IntegrationTesting.QpsWorker\Grpc.IntegrationTesting.QpsWorker.csproj", "{B82B7DFE-7F7B-40EF-B3D6-064FF2B01294}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.StressClient", "Grpc.IntegrationTesting.StressClient\Grpc.IntegrationTesting.StressClient.csproj", "{ADEBA147-80AE-4710-82E9-5B7F93690266}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -83,6 +85,12 @@ Global
{AA5E328A-8835-49D7-98ED-C29F2B3049F0}.Release|Any CPU.Build.0 = Release|Any CPU {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.Release|Any CPU.Build.0 = Release|Any CPU
{AA5E328A-8835-49D7-98ED-C29F2B3049F0}.ReleaseSigned|Any CPU.ActiveCfg = ReleaseSigned|Any CPU {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.ReleaseSigned|Any CPU.ActiveCfg = ReleaseSigned|Any CPU
{AA5E328A-8835-49D7-98ED-C29F2B3049F0}.ReleaseSigned|Any CPU.Build.0 = ReleaseSigned|Any CPU {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.ReleaseSigned|Any CPU.Build.0 = ReleaseSigned|Any CPU
{ADEBA147-80AE-4710-82E9-5B7F93690266}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADEBA147-80AE-4710-82E9-5B7F93690266}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADEBA147-80AE-4710-82E9-5B7F93690266}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADEBA147-80AE-4710-82E9-5B7F93690266}.Release|Any CPU.Build.0 = Release|Any CPU
{ADEBA147-80AE-4710-82E9-5B7F93690266}.ReleaseSigned|Any CPU.ActiveCfg = Release|Any CPU
{ADEBA147-80AE-4710-82E9-5B7F93690266}.ReleaseSigned|Any CPU.Build.0 = Release|Any CPU
{AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Release|Any CPU.ActiveCfg = Release|Any CPU {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Release|Any CPU.ActiveCfg = Release|Any CPU

@ -911,9 +911,12 @@ grpcsharp_ssl_server_credentials_create(
key_cert_pairs[i].private_key = key_cert_pair_private_key_array[i]; key_cert_pairs[i].private_key = key_cert_pair_private_key_array[i];
} }
} }
creds = grpc_ssl_server_credentials_create(pem_root_certs, key_cert_pairs, creds = grpc_ssl_server_credentials_create_ex(
num_key_cert_pairs, pem_root_certs, key_cert_pairs, num_key_cert_pairs,
force_client_auth, NULL); force_client_auth
? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
: GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
NULL);
gpr_free(key_cert_pairs); gpr_free(key_cert_pairs);
return creds; return creds;
} }

@ -45,4 +45,4 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$HEALTHCHECK_DIR --grpc_out=$HEALTHCHECK_D
-I src/proto/grpc/health/v1 src/proto/grpc/health/v1/health.proto -I src/proto/grpc/health/v1 src/proto/grpc/health/v1/health.proto
$PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \ $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \
-I . src/proto/grpc/testing/{control,empty,messages,payloads,services,stats,test}.proto -I . src/proto/grpc/testing/{control,empty,messages,metrics,payloads,services,stats,test}.proto

@ -1,2 +0,0 @@
build
node_modules

@ -1,28 +0,0 @@
{
"bitwise": true,
"curly": true,
"eqeqeq": true,
"esnext": true,
"freeze": true,
"immed": true,
"indent": 2,
"latedef": "nofunc",
"maxlen": 80,
"newcap": true,
"node": true,
"noarg": true,
"quotmark": "single",
"strict": true,
"trailing": true,
"undef": true,
"unused": "vars",
"globals": {
/* Mocha-provided globals */
"describe": false,
"it": false,
"before": false,
"beforeEach": false,
"after": false,
"afterEach": false
}
}

@ -145,9 +145,13 @@ NAN_METHOD(ServerCredentials::CreateSsl) {
return Nan::ThrowTypeError( return Nan::ThrowTypeError(
"createSsl's second argument must be a list of objects"); "createSsl's second argument must be a list of objects");
} }
int force_client_auth = 0;
grpc_ssl_client_certificate_request_type client_certificate_request;
if (info[2]->IsBoolean()) { if (info[2]->IsBoolean()) {
force_client_auth = (int)Nan::To<bool>(info[2]).FromJust(); client_certificate_request =
Nan::To<bool>(info[2]).FromJust()
? GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
: GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE;
} else if (!(info[2]->IsUndefined() || info[2]->IsNull())) { } else if (!(info[2]->IsUndefined() || info[2]->IsNull())) {
return Nan::ThrowTypeError( return Nan::ThrowTypeError(
"createSsl's third argument must be a boolean if provided"); "createSsl's third argument must be a boolean if provided");
@ -180,8 +184,9 @@ NAN_METHOD(ServerCredentials::CreateSsl) {
key_cert_pairs[i].private_key = ::node::Buffer::Data(maybe_key); key_cert_pairs[i].private_key = ::node::Buffer::Data(maybe_key);
key_cert_pairs[i].cert_chain = ::node::Buffer::Data(maybe_cert); key_cert_pairs[i].cert_chain = ::node::Buffer::Data(maybe_cert);
} }
grpc_server_credentials *creds = grpc_ssl_server_credentials_create( grpc_server_credentials *creds = grpc_ssl_server_credentials_create_ex(
root_certs, key_cert_pairs, key_cert_pair_count, force_client_auth, NULL); root_certs, key_cert_pairs, key_cert_pair_count,
client_certificate_request, NULL);
delete key_cert_pairs; delete key_cert_pairs;
if (creds == NULL) { if (creds == NULL) {
info.GetReturnValue().SetNull(); info.GetReturnValue().SetNull();

@ -0,0 +1,99 @@
// GENERATED CODE -- DO NOT EDIT!
'use strict';
var grpc = require('grpc');
var math_pb = require('./math_pb.js');
function serialize_DivArgs(arg) {
if (!(arg instanceof math_pb.DivArgs)) {
throw new Error('Expected argument of type DivArgs');
}
return new Buffer(arg.serializeBinary());
}
function deserialize_DivArgs(buffer_arg) {
return math_pb.DivArgs.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_DivReply(arg) {
if (!(arg instanceof math_pb.DivReply)) {
throw new Error('Expected argument of type DivReply');
}
return new Buffer(arg.serializeBinary());
}
function deserialize_DivReply(buffer_arg) {
return math_pb.DivReply.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_FibArgs(arg) {
if (!(arg instanceof math_pb.FibArgs)) {
throw new Error('Expected argument of type FibArgs');
}
return new Buffer(arg.serializeBinary());
}
function deserialize_FibArgs(buffer_arg) {
return math_pb.FibArgs.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_Num(arg) {
if (!(arg instanceof math_pb.Num)) {
throw new Error('Expected argument of type Num');
}
return new Buffer(arg.serializeBinary());
}
function deserialize_Num(buffer_arg) {
return math_pb.Num.deserializeBinary(new Uint8Array(buffer_arg));
}
var MathService = exports.MathService = {
div: {
path: '/math.Math/Div',
requestStream: false,
responseStream: false,
requestType: math_pb.DivArgs,
responseType: math_pb.DivReply,
requestSerialize: serialize_DivArgs,
requestDeserialize: deserialize_DivArgs,
responseSerialize: serialize_DivReply,
responseDeserialize: deserialize_DivReply,
},
divMany: {
path: '/math.Math/DivMany',
requestStream: true,
responseStream: true,
requestType: math_pb.DivArgs,
responseType: math_pb.DivReply,
requestSerialize: serialize_DivArgs,
requestDeserialize: deserialize_DivArgs,
responseSerialize: serialize_DivReply,
responseDeserialize: deserialize_DivReply,
},
fib: {
path: '/math.Math/Fib',
requestStream: false,
responseStream: true,
requestType: math_pb.FibArgs,
responseType: math_pb.Num,
requestSerialize: serialize_FibArgs,
requestDeserialize: deserialize_FibArgs,
responseSerialize: serialize_Num,
responseDeserialize: deserialize_Num,
},
sum: {
path: '/math.Math/Sum',
requestStream: true,
responseStream: false,
requestType: math_pb.Num,
responseType: math_pb.Num,
requestSerialize: serialize_Num,
requestDeserialize: deserialize_Num,
responseSerialize: serialize_Num,
responseDeserialize: deserialize_Num,
},
};
exports.MathClient = grpc.makeGenericClientConstructor(MathService);

@ -0,0 +1,866 @@
/**
* @fileoverview
* @enhanceable
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
goog.exportSymbol('proto.math.DivArgs', null, global);
goog.exportSymbol('proto.math.DivReply', null, global);
goog.exportSymbol('proto.math.FibArgs', null, global);
goog.exportSymbol('proto.math.FibReply', null, global);
goog.exportSymbol('proto.math.Num', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.math.DivArgs = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.math.DivArgs, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.math.DivArgs.displayName = 'proto.math.DivArgs';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.math.DivArgs.prototype.toObject = function(opt_includeInstance) {
return proto.math.DivArgs.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.math.DivArgs} msg The msg instance to transform.
* @return {!Object}
*/
proto.math.DivArgs.toObject = function(includeInstance, msg) {
var f, obj = {
dividend: msg.getDividend(),
divisor: msg.getDivisor()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.math.DivArgs}
*/
proto.math.DivArgs.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.math.DivArgs;
return proto.math.DivArgs.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.math.DivArgs} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.math.DivArgs}
*/
proto.math.DivArgs.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readInt64());
msg.setDividend(value);
break;
case 2:
var value = /** @type {number} */ (reader.readInt64());
msg.setDivisor(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.math.DivArgs} message
* @param {!jspb.BinaryWriter} writer
*/
proto.math.DivArgs.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.math.DivArgs.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.math.DivArgs.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getDividend();
if (f !== 0) {
writer.writeInt64(
1,
f
);
}
f = this.getDivisor();
if (f !== 0) {
writer.writeInt64(
2,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.math.DivArgs} The clone.
*/
proto.math.DivArgs.prototype.cloneMessage = function() {
return /** @type {!proto.math.DivArgs} */ (jspb.Message.cloneMessage(this));
};
/**
* optional int64 dividend = 1;
* @return {number}
*/
proto.math.DivArgs.prototype.getDividend = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
};
/** @param {number} value */
proto.math.DivArgs.prototype.setDividend = function(value) {
jspb.Message.setField(this, 1, value);
};
/**
* optional int64 divisor = 2;
* @return {number}
*/
proto.math.DivArgs.prototype.getDivisor = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0));
};
/** @param {number} value */
proto.math.DivArgs.prototype.setDivisor = function(value) {
jspb.Message.setField(this, 2, value);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.math.DivReply = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.math.DivReply, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.math.DivReply.displayName = 'proto.math.DivReply';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.math.DivReply.prototype.toObject = function(opt_includeInstance) {
return proto.math.DivReply.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.math.DivReply} msg The msg instance to transform.
* @return {!Object}
*/
proto.math.DivReply.toObject = function(includeInstance, msg) {
var f, obj = {
quotient: msg.getQuotient(),
remainder: msg.getRemainder()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.math.DivReply}
*/
proto.math.DivReply.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.math.DivReply;
return proto.math.DivReply.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.math.DivReply} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.math.DivReply}
*/
proto.math.DivReply.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readInt64());
msg.setQuotient(value);
break;
case 2:
var value = /** @type {number} */ (reader.readInt64());
msg.setRemainder(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.math.DivReply} message
* @param {!jspb.BinaryWriter} writer
*/
proto.math.DivReply.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.math.DivReply.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.math.DivReply.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getQuotient();
if (f !== 0) {
writer.writeInt64(
1,
f
);
}
f = this.getRemainder();
if (f !== 0) {
writer.writeInt64(
2,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.math.DivReply} The clone.
*/
proto.math.DivReply.prototype.cloneMessage = function() {
return /** @type {!proto.math.DivReply} */ (jspb.Message.cloneMessage(this));
};
/**
* optional int64 quotient = 1;
* @return {number}
*/
proto.math.DivReply.prototype.getQuotient = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
};
/** @param {number} value */
proto.math.DivReply.prototype.setQuotient = function(value) {
jspb.Message.setField(this, 1, value);
};
/**
* optional int64 remainder = 2;
* @return {number}
*/
proto.math.DivReply.prototype.getRemainder = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0));
};
/** @param {number} value */
proto.math.DivReply.prototype.setRemainder = function(value) {
jspb.Message.setField(this, 2, value);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.math.FibArgs = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.math.FibArgs, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.math.FibArgs.displayName = 'proto.math.FibArgs';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.math.FibArgs.prototype.toObject = function(opt_includeInstance) {
return proto.math.FibArgs.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.math.FibArgs} msg The msg instance to transform.
* @return {!Object}
*/
proto.math.FibArgs.toObject = function(includeInstance, msg) {
var f, obj = {
limit: msg.getLimit()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.math.FibArgs}
*/
proto.math.FibArgs.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.math.FibArgs;
return proto.math.FibArgs.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.math.FibArgs} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.math.FibArgs}
*/
proto.math.FibArgs.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readInt64());
msg.setLimit(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.math.FibArgs} message
* @param {!jspb.BinaryWriter} writer
*/
proto.math.FibArgs.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.math.FibArgs.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.math.FibArgs.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getLimit();
if (f !== 0) {
writer.writeInt64(
1,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.math.FibArgs} The clone.
*/
proto.math.FibArgs.prototype.cloneMessage = function() {
return /** @type {!proto.math.FibArgs} */ (jspb.Message.cloneMessage(this));
};
/**
* optional int64 limit = 1;
* @return {number}
*/
proto.math.FibArgs.prototype.getLimit = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
};
/** @param {number} value */
proto.math.FibArgs.prototype.setLimit = function(value) {
jspb.Message.setField(this, 1, value);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.math.Num = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.math.Num, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.math.Num.displayName = 'proto.math.Num';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.math.Num.prototype.toObject = function(opt_includeInstance) {
return proto.math.Num.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.math.Num} msg The msg instance to transform.
* @return {!Object}
*/
proto.math.Num.toObject = function(includeInstance, msg) {
var f, obj = {
num: msg.getNum()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.math.Num}
*/
proto.math.Num.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.math.Num;
return proto.math.Num.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.math.Num} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.math.Num}
*/
proto.math.Num.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readInt64());
msg.setNum(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.math.Num} message
* @param {!jspb.BinaryWriter} writer
*/
proto.math.Num.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.math.Num.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.math.Num.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getNum();
if (f !== 0) {
writer.writeInt64(
1,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.math.Num} The clone.
*/
proto.math.Num.prototype.cloneMessage = function() {
return /** @type {!proto.math.Num} */ (jspb.Message.cloneMessage(this));
};
/**
* optional int64 num = 1;
* @return {number}
*/
proto.math.Num.prototype.getNum = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
};
/** @param {number} value */
proto.math.Num.prototype.setNum = function(value) {
jspb.Message.setField(this, 1, value);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.math.FibReply = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.math.FibReply, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.math.FibReply.displayName = 'proto.math.FibReply';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.math.FibReply.prototype.toObject = function(opt_includeInstance) {
return proto.math.FibReply.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.math.FibReply} msg The msg instance to transform.
* @return {!Object}
*/
proto.math.FibReply.toObject = function(includeInstance, msg) {
var f, obj = {
count: msg.getCount()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.math.FibReply}
*/
proto.math.FibReply.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.math.FibReply;
return proto.math.FibReply.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.math.FibReply} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.math.FibReply}
*/
proto.math.FibReply.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readInt64());
msg.setCount(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.math.FibReply} message
* @param {!jspb.BinaryWriter} writer
*/
proto.math.FibReply.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.math.FibReply.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.math.FibReply.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getCount();
if (f !== 0) {
writer.writeInt64(
1,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.math.FibReply} The clone.
*/
proto.math.FibReply.prototype.cloneMessage = function() {
return /** @type {!proto.math.FibReply} */ (jspb.Message.cloneMessage(this));
};
/**
* optional int64 count = 1;
* @return {number}
*/
proto.math.FibReply.prototype.getCount = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0));
};
/** @param {number} value */
proto.math.FibReply.prototype.setCount = function(value) {
jspb.Message.setField(this, 1, value);
};
goog.object.extend(exports, proto.math);

@ -34,8 +34,8 @@
'use strict'; 'use strict';
var grpc = require('../..'); var grpc = require('../..');
var math = grpc.load(__dirname + '/../../../proto/math/math.proto').math; var grpcMath = require('./math_grpc_pb');
var math = require('./math_pb');
/** /**
* Server function for division. Provides the /Math/DivMany and /Math/Div * Server function for division. Provides the /Math/DivMany and /Math/Div
@ -46,14 +46,16 @@ var math = grpc.load(__dirname + '/../../../proto/math/math.proto').math;
*/ */
function mathDiv(call, cb) { function mathDiv(call, cb) {
var req = call.request; var req = call.request;
var divisor = req.getDivisor();
var dividend = req.getDividend();
// Unary + is explicit coersion to integer // Unary + is explicit coersion to integer
if (+req.divisor === 0) { if (req.getDivisor() === 0) {
cb(new Error('cannot divide by zero')); cb(new Error('cannot divide by zero'));
} else { } else {
cb(null, { var response = new math.DivReply();
quotient: req.dividend / req.divisor, response.setQuotient(Math.floor(dividend / divisor));
remainder: req.dividend % req.divisor response.setRemainder(dividend % divisor);
}); cb(null, response);
} }
} }
@ -67,7 +69,9 @@ function mathFib(stream) {
// Here, call is a standard writable Node object Stream // Here, call is a standard writable Node object Stream
var previous = 0, current = 1; var previous = 0, current = 1;
for (var i = 0; i < stream.request.limit; i++) { for (var i = 0; i < stream.request.limit; i++) {
stream.write({num: current}); var response = new math.Num();
response.setNum(current);
stream.write(response);
var temp = current; var temp = current;
current += previous; current += previous;
previous = temp; previous = temp;
@ -85,22 +89,26 @@ function mathSum(call, cb) {
// Here, call is a standard readable Node object Stream // Here, call is a standard readable Node object Stream
var sum = 0; var sum = 0;
call.on('data', function(data) { call.on('data', function(data) {
sum += (+data.num); sum += data.getNum();
}); });
call.on('end', function() { call.on('end', function() {
cb(null, {num: sum}); var response = new math.Num();
response.setNum(sum);
cb(null, response);
}); });
} }
function mathDivMany(stream) { function mathDivMany(stream) {
stream.on('data', function(div_args) { stream.on('data', function(div_args) {
if (+div_args.divisor === 0) { var divisor = div_args.getDivisor();
var dividend = div_args.getDividend();
if (divisor === 0) {
stream.emit('error', new Error('cannot divide by zero')); stream.emit('error', new Error('cannot divide by zero'));
} else { } else {
stream.write({ var response = new math.DivReply();
quotient: div_args.dividend / div_args.divisor, response.setQuotient(Math.floor(dividend / divisor));
remainder: div_args.dividend % div_args.divisor response.setRemainder(dividend % divisor);
}); stream.write(response);
} }
}); });
stream.on('end', function() { stream.on('end', function() {
@ -110,7 +118,7 @@ function mathDivMany(stream) {
function getMathServer() { function getMathServer() {
var server = new grpc.Server(); var server = new grpc.Server();
server.addProtoService(math.Math.service, { server.addService(grpcMath.MathService, {
div: mathDiv, div: mathDiv,
fib: mathFib, fib: mathFib,
sum: mathSum, sum: mathSum,

@ -0,0 +1,37 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/* This exists solely to allow the generated code to import the grpc module
* without using a relative path */
module.exports = require('../../..');

@ -36,7 +36,8 @@
var assert = require('assert'); var assert = require('assert');
var grpc = require('..'); var grpc = require('..');
var math = grpc.load(__dirname + '/../../proto/math/math.proto').math; var math = require('./math/math_pb');
var MathClient = require('./math/math_grpc_pb').MathClient;
/** /**
* Client to use to make requests to a running server. * Client to use to make requests to a running server.
@ -55,7 +56,7 @@ describe('Math client', function() {
var port_num = server.bind('0.0.0.0:0', var port_num = server.bind('0.0.0.0:0',
grpc.ServerCredentials.createInsecure()); grpc.ServerCredentials.createInsecure());
server.start(); server.start();
math_client = new math.Math('localhost:' + port_num, math_client = new MathClient('localhost:' + port_num,
grpc.credentials.createInsecure()); grpc.credentials.createInsecure());
done(); done();
}); });
@ -63,27 +64,33 @@ describe('Math client', function() {
server.forceShutdown(); server.forceShutdown();
}); });
it('should handle a single request', function(done) { it('should handle a single request', function(done) {
var arg = {dividend: 7, divisor: 4}; var arg = new math.DivArgs();
arg.setDividend(7);
arg.setDivisor(4);
math_client.div(arg, function handleDivResult(err, value) { math_client.div(arg, function handleDivResult(err, value) {
assert.ifError(err); assert.ifError(err);
assert.equal(value.quotient, 1); assert.equal(value.getQuotient(), 1);
assert.equal(value.remainder, 3); assert.equal(value.getRemainder(), 3);
done(); done();
}); });
}); });
it('should handle an error from a unary request', function(done) { it('should handle an error from a unary request', function(done) {
var arg = {dividend: 7, divisor: 0}; var arg = new math.DivArgs();
arg.setDividend(7);
arg.setDivisor(0);
math_client.div(arg, function handleDivResult(err, value) { math_client.div(arg, function handleDivResult(err, value) {
assert(err); assert(err);
done(); done();
}); });
}); });
it('should handle a server streaming request', function(done) { it('should handle a server streaming request', function(done) {
var call = math_client.fib({limit: 7}); var arg = new math.FibArgs();
arg.setLimit(7);
var call = math_client.fib(arg);
var expected_results = [1, 1, 2, 3, 5, 8, 13]; var expected_results = [1, 1, 2, 3, 5, 8, 13];
var next_expected = 0; var next_expected = 0;
call.on('data', function checkResponse(value) { call.on('data', function checkResponse(value) {
assert.equal(value.num, expected_results[next_expected]); assert.equal(value.getNum(), expected_results[next_expected]);
next_expected += 1; next_expected += 1;
}); });
call.on('status', function checkStatus(status) { call.on('status', function checkStatus(status) {
@ -94,10 +101,12 @@ describe('Math client', function() {
it('should handle a client streaming request', function(done) { it('should handle a client streaming request', function(done) {
var call = math_client.sum(function handleSumResult(err, value) { var call = math_client.sum(function handleSumResult(err, value) {
assert.ifError(err); assert.ifError(err);
assert.equal(value.num, 21); assert.equal(value.getNum(), 21);
}); });
for (var i = 0; i < 7; i++) { for (var i = 0; i < 7; i++) {
call.write({'num': i}); var arg = new math.Num();
arg.setNum(i);
call.write(arg);
} }
call.end(); call.end();
call.on('status', function checkStatus(status) { call.on('status', function checkStatus(status) {
@ -107,8 +116,8 @@ describe('Math client', function() {
}); });
it('should handle a bidirectional streaming request', function(done) { it('should handle a bidirectional streaming request', function(done) {
function checkResponse(index, value) { function checkResponse(index, value) {
assert.equal(value.quotient, index); assert.equal(value.getQuotient(), index);
assert.equal(value.remainder, 1); assert.equal(value.getRemainder(), 1);
} }
var call = math_client.divMany(); var call = math_client.divMany();
var response_index = 0; var response_index = 0;
@ -117,7 +126,10 @@ describe('Math client', function() {
response_index += 1; response_index += 1;
}); });
for (var i = 0; i < 7; i++) { for (var i = 0; i < 7; i++) {
call.write({dividend: 2 * i + 1, divisor: 2}); var arg = new math.DivArgs();
arg.setDividend(2 * i + 1);
arg.setDivisor(2);
call.write(arg);
} }
call.end(); call.end();
call.on('status', function checkStatus(status) { call.on('status', function checkStatus(status) {
@ -131,7 +143,10 @@ describe('Math client', function() {
assert.fail(value, undefined, 'Unexpected data response on failing call', assert.fail(value, undefined, 'Unexpected data response on failing call',
'!='); '!=');
}); });
call.write({dividend: 7, divisor: 0}); var arg = new math.DivArgs();
arg.setDividend(7);
arg.setDivisor(0);
call.write(arg);
call.end(); call.end();
call.on('error', function checkStatus(status) { call.on('error', function checkStatus(status) {
done(); done();

@ -115,10 +115,11 @@ PHP_METHOD(ServerCredentials, createSsl) {
"createSsl expects 3 strings", 1 TSRMLS_CC); "createSsl expects 3 strings", 1 TSRMLS_CC);
return; return;
} }
/* TODO: add a force_client_auth field in ServerCredentials and pass it as /* TODO: add a client_certificate_request field in ServerCredentials and pass
* the last parameter. */ * it as the last parameter. */
grpc_server_credentials *creds = grpc_ssl_server_credentials_create( grpc_server_credentials *creds = grpc_ssl_server_credentials_create_ex(
pem_root_certs, &pem_key_cert_pair, 1, 0, NULL); pem_root_certs, &pem_key_cert_pair, 1,
GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE, NULL);
zval *creds_object = grpc_php_wrap_server_credentials(creds); zval *creds_object = grpc_php_wrap_server_credentials(creds);
RETURN_DESTROY_ZVAL(creds_object); RETURN_DESTROY_ZVAL(creds_object);
} }

@ -35,14 +35,18 @@ import "src/proto/grpc/testing/stats.proto";
package grpc.testing; package grpc.testing;
enum ClientType { enum ClientType {
// Many languages support a basic distinction between using
// sync or async client, and this allows the specification
SYNC_CLIENT = 0; SYNC_CLIENT = 0;
ASYNC_CLIENT = 1; ASYNC_CLIENT = 1;
OTHER_CLIENT = 2; // used for some language-specific variants
} }
enum ServerType { enum ServerType {
SYNC_SERVER = 0; SYNC_SERVER = 0;
ASYNC_SERVER = 1; ASYNC_SERVER = 1;
ASYNC_GENERIC_SERVER = 2; ASYNC_GENERIC_SERVER = 2;
OTHER_SERVER = 3; // used for some language-specific variants
} }
enum RpcType { enum RpcType {
@ -96,6 +100,9 @@ message ClientConfig {
// Specify the cores we should run the client on, if desired // Specify the cores we should run the client on, if desired
repeated int32 core_list = 13; repeated int32 core_list = 13;
int32 core_limit = 14; int32 core_limit = 14;
// If we use an OTHER_CLIENT client_type, this string gives more detail
string other_client_api = 15;
} }
message ClientStatus { ClientStats stats = 1; } message ClientStatus { ClientStats stats = 1; }
@ -127,6 +134,9 @@ message ServerConfig {
// Specify the cores we should run the server on, if desired // Specify the cores we should run the server on, if desired
repeated int32 core_list = 10; repeated int32 core_list = 10;
// If we use an OTHER_SERVER client_type, this string gives more detail
string other_server_api = 11;
} }
message ServerArgs { message ServerArgs {

@ -0,0 +1 @@
gens/

@ -50,6 +50,9 @@ from setuptools.command import test
import support import support
PYTHON_STEM = os.path.dirname(os.path.abspath(__file__)) PYTHON_STEM = os.path.dirname(os.path.abspath(__file__))
GRPC_STEM = os.path.abspath(PYTHON_STEM + '../../../../')
PROTO_STEM = os.path.join(GRPC_STEM, 'src', 'proto')
PROTO_GEN_STEM = os.path.join(GRPC_STEM, 'src', 'python', 'gens')
CONF_PY_ADDENDUM = """ CONF_PY_ADDENDUM = """
extensions.append('sphinx.ext.napoleon') extensions.append('sphinx.ext.napoleon')
@ -157,31 +160,46 @@ class BuildProtoModules(setuptools.Command):
if not self.grpc_python_plugin_command: if not self.grpc_python_plugin_command:
raise CommandError('could not find grpc_python_plugin ' raise CommandError('could not find grpc_python_plugin '
'(protoc plugin for GRPC Python)') '(protoc plugin for GRPC Python)')
if not os.path.exists(PROTO_GEN_STEM):
os.makedirs(PROTO_GEN_STEM)
include_regex = re.compile(self.include) include_regex = re.compile(self.include)
exclude_regex = re.compile(self.exclude) if self.exclude else None exclude_regex = re.compile(self.exclude) if self.exclude else None
paths = [] paths = []
root_directory = PYTHON_STEM for walk_root, directories, filenames in os.walk(PROTO_STEM):
for walk_root, directories, filenames in os.walk(root_directory):
for filename in filenames: for filename in filenames:
path = os.path.join(walk_root, filename) path = os.path.join(walk_root, filename)
if include_regex.match(path) and not ( if include_regex.match(path) and not (
exclude_regex and exclude_regex.match(path)): exclude_regex and exclude_regex.match(path)):
paths.append(path) paths.append(path)
# TODO(kpayson): It would be nice to do this in a batch command,
# but we currently have name conflicts in src/proto
for path in paths:
command = [ command = [
self.protoc_command, self.protoc_command,
'--plugin=protoc-gen-python-grpc={}'.format( '--plugin=protoc-gen-python-grpc={}'.format(
self.grpc_python_plugin_command), self.grpc_python_plugin_command),
'-I {}'.format(root_directory), '-I {}'.format(GRPC_STEM),
'--python_out={}'.format(root_directory), '--python_out={}'.format(PROTO_GEN_STEM),
'--python-grpc_out={}'.format(root_directory), '--python-grpc_out={}'.format(PROTO_GEN_STEM),
] + paths ] + [path]
try: try:
subprocess.check_output(' '.join(command), cwd=root_directory, shell=True, subprocess.check_output(' '.join(command), cwd=PYTHON_STEM, shell=True,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
raise CommandError('Command:\n{}\nMessage:\n{}\nOutput:\n{}'.format( sys.stderr.write(
'warning: Command:\n{}\nMessage:\n{}\nOutput:\n{}'.format(
command, e.message, e.output)) command, e.message, e.output))
# Generated proto directories dont include __init__.py, but
# these are needed for python package resolution
for walk_root, _, _ in os.walk(PROTO_GEN_STEM):
if walk_root != PROTO_GEN_STEM:
path = os.path.join(walk_root, '__init__.py')
open(path, 'a').close()
class BuildProjectMetadata(setuptools.Command): class BuildProjectMetadata(setuptools.Command):
"""Command to generate project metadata in a module.""" """Command to generate project metadata in a module."""

@ -302,6 +302,8 @@ def server_credentials_ssl(pem_root_certs, pem_key_cert_pairs,
(<SslPemKeyCertPair>pem_key_cert_pairs[i]).c_pair) (<SslPemKeyCertPair>pem_key_cert_pairs[i]).c_pair)
credentials.c_credentials = grpc_ssl_server_credentials_create( credentials.c_credentials = grpc_ssl_server_credentials_create(
c_pem_root_certs, credentials.c_ssl_pem_key_cert_pairs, c_pem_root_certs, credentials.c_ssl_pem_key_cert_pairs,
credentials.c_ssl_pem_key_cert_pairs_count, force_client_auth, NULL) credentials.c_ssl_pem_key_cert_pairs_count,
GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY if force_client_auth else GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
NULL)
return credentials return credentials

@ -105,6 +105,13 @@ cdef extern from "grpc/_cython/loader.h":
GRPC_SSL_ROOTS_OVERRIDE_FAILED_PERMANENTLY GRPC_SSL_ROOTS_OVERRIDE_FAILED_PERMANENTLY
GRPC_SSL_ROOTS_OVERRIDE_FAILED GRPC_SSL_ROOTS_OVERRIDE_FAILED
ctypedef enum grpc_ssl_client_certificate_request_type:
GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY
GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY
GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY
GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
struct grpc_byte_buffer_reader: struct grpc_byte_buffer_reader:
# We don't care about the internals # We don't care about the internals
pass pass

@ -152,6 +152,7 @@ grpc_metadata_credentials_create_from_plugin_type grpc_metadata_credentials_crea
grpc_secure_channel_create_type grpc_secure_channel_create_import; grpc_secure_channel_create_type grpc_secure_channel_create_import;
grpc_server_credentials_release_type grpc_server_credentials_release_import; grpc_server_credentials_release_type grpc_server_credentials_release_import;
grpc_ssl_server_credentials_create_type grpc_ssl_server_credentials_create_import; grpc_ssl_server_credentials_create_type grpc_ssl_server_credentials_create_import;
grpc_ssl_server_credentials_create_ex_type grpc_ssl_server_credentials_create_ex_import;
grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import; grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import;
grpc_call_set_credentials_type grpc_call_set_credentials_import; grpc_call_set_credentials_type grpc_call_set_credentials_import;
grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import; grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import;
@ -420,6 +421,7 @@ void pygrpc_load_imports(HMODULE library) {
grpc_secure_channel_create_import = (grpc_secure_channel_create_type) GetProcAddress(library, "grpc_secure_channel_create"); grpc_secure_channel_create_import = (grpc_secure_channel_create_type) GetProcAddress(library, "grpc_secure_channel_create");
grpc_server_credentials_release_import = (grpc_server_credentials_release_type) GetProcAddress(library, "grpc_server_credentials_release"); grpc_server_credentials_release_import = (grpc_server_credentials_release_type) GetProcAddress(library, "grpc_server_credentials_release");
grpc_ssl_server_credentials_create_import = (grpc_ssl_server_credentials_create_type) GetProcAddress(library, "grpc_ssl_server_credentials_create"); grpc_ssl_server_credentials_create_import = (grpc_ssl_server_credentials_create_type) GetProcAddress(library, "grpc_ssl_server_credentials_create");
grpc_ssl_server_credentials_create_ex_import = (grpc_ssl_server_credentials_create_ex_type) GetProcAddress(library, "grpc_ssl_server_credentials_create_ex");
grpc_server_add_secure_http2_port_import = (grpc_server_add_secure_http2_port_type) GetProcAddress(library, "grpc_server_add_secure_http2_port"); grpc_server_add_secure_http2_port_import = (grpc_server_add_secure_http2_port_type) GetProcAddress(library, "grpc_server_add_secure_http2_port");
grpc_call_set_credentials_import = (grpc_call_set_credentials_type) GetProcAddress(library, "grpc_call_set_credentials"); grpc_call_set_credentials_import = (grpc_call_set_credentials_type) GetProcAddress(library, "grpc_call_set_credentials");
grpc_server_credentials_set_auth_metadata_processor_import = (grpc_server_credentials_set_auth_metadata_processor_type) GetProcAddress(library, "grpc_server_credentials_set_auth_metadata_processor"); grpc_server_credentials_set_auth_metadata_processor_import = (grpc_server_credentials_set_auth_metadata_processor_type) GetProcAddress(library, "grpc_server_credentials_set_auth_metadata_processor");

@ -406,6 +406,9 @@ extern grpc_server_credentials_release_type grpc_server_credentials_release_impo
typedef grpc_server_credentials *(*grpc_ssl_server_credentials_create_type)(const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, size_t num_key_cert_pairs, int force_client_auth, void *reserved); typedef grpc_server_credentials *(*grpc_ssl_server_credentials_create_type)(const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, size_t num_key_cert_pairs, int force_client_auth, void *reserved);
extern grpc_ssl_server_credentials_create_type grpc_ssl_server_credentials_create_import; extern grpc_ssl_server_credentials_create_type grpc_ssl_server_credentials_create_import;
#define grpc_ssl_server_credentials_create grpc_ssl_server_credentials_create_import #define grpc_ssl_server_credentials_create grpc_ssl_server_credentials_create_import
typedef grpc_server_credentials *(*grpc_ssl_server_credentials_create_ex_type)(const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, size_t num_key_cert_pairs, grpc_ssl_client_certificate_request_type client_certificate_request, void *reserved);
extern grpc_ssl_server_credentials_create_ex_type grpc_ssl_server_credentials_create_ex_import;
#define grpc_ssl_server_credentials_create_ex grpc_ssl_server_credentials_create_ex_import
typedef int(*grpc_server_add_secure_http2_port_type)(grpc_server *server, const char *addr, grpc_server_credentials *creds); typedef int(*grpc_server_add_secure_http2_port_type)(grpc_server *server, const char *addr, grpc_server_credentials *creds);
extern grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import; extern grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import;
#define grpc_server_add_secure_http2_port grpc_server_add_secure_http2_port_import #define grpc_server_add_secure_http2_port grpc_server_add_secure_http2_port_import

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

Loading…
Cancel
Save