Merge branch 'grpc_trace_granularity' into ruby_garbage_collection_fixes

pull/6886/head
murgatroid99 9 years ago
commit 89f7cc517c
  1. 17
      .travis.yml
  2. 636
      BUILD
  3. 1516
      Makefile
  4. 1
      PYTHON-MANIFEST.in
  5. 2
      Rakefile
  6. 33
      binding.gyp
  7. 308
      build.yaml
  8. 1
      composer.json
  9. 36
      config.m4
  10. 4
      doc/PROTOCOL-HTTP2.md
  11. 2
      doc/c-style-guide.md
  12. 77
      doc/command_line_tool.md
  13. 111
      doc/compression.md
  14. 91
      doc/cpp-style-guide.md
  15. 373
      doc/interop-test-descriptions.md
  16. 2
      doc/statuscodes.md
  17. 4
      examples/cpp/helloworld/greeter_async_client.cc
  18. 4
      examples/cpp/helloworld/greeter_async_server.cc
  19. 32
      examples/node/static_codegen/helloworld_grpc_pb.js
  20. 4
      examples/node/static_codegen/helloworld_pb.js
  21. 51
      examples/node/static_codegen/route_guide/route_guide_grpc_pb.js
  22. 10
      examples/node/static_codegen/route_guide/route_guide_pb.js
  23. 28
      examples/objective-c/auth_sample/AuthSample.xcodeproj/project.pbxproj
  24. 4
      examples/objective-c/auth_sample/AuthTestService.podspec
  25. 4
      examples/objective-c/helloworld/HelloWorld.podspec
  26. 24
      examples/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj
  27. 4
      examples/objective-c/route_guide/RouteGuide.podspec
  28. 18
      examples/objective-c/route_guide/RouteGuideClient.xcodeproj/project.pbxproj
  29. 26
      examples/php/greeter_client.php
  30. 160
      examples/php/helloworld.php
  31. 768
      examples/php/route_guide/route_guide.php
  32. 266
      examples/php/route_guide/route_guide_client.php
  33. 2
      examples/python/route_guide/route_guide_server.py
  34. 34
      examples/ruby/lib/helloworld_services.rb
  35. 53
      examples/ruby/lib/route_guide_services.rb
  36. 77
      gRPC.podspec
  37. 5
      grpc.def
  38. 63
      grpc.gemspec
  39. 57
      include/grpc++/create_channel_posix.h
  40. 69
      include/grpc++/ext/proto_server_reflection_plugin.h
  41. 184
      include/grpc++/ext/reflection.grpc.pb.h
  42. 2035
      include/grpc++/ext/reflection.pb.h
  43. 2
      include/grpc++/grpc++.h
  44. 44
      include/grpc++/impl/codegen/async_stream.h
  45. 1
      include/grpc++/impl/codegen/async_unary_call.h
  46. 38
      include/grpc++/impl/codegen/call.h
  47. 10
      include/grpc++/impl/codegen/client_context.h
  48. 17
      include/grpc++/impl/codegen/config.h
  49. 22
      include/grpc++/impl/codegen/config_protobuf.h
  50. 46
      include/grpc++/impl/codegen/core_codegen.h
  51. 2
      include/grpc++/impl/codegen/core_codegen_interface.h
  52. 43
      include/grpc++/impl/codegen/impl/async_stream.h
  53. 7
      include/grpc++/impl/codegen/server_context.h
  54. 8
      include/grpc++/impl/codegen/server_interface.h
  55. 1
      include/grpc++/impl/codegen/sync_stream.h
  56. 3
      include/grpc++/impl/grpc_library.h
  57. 3
      include/grpc++/impl/server_builder_option.h
  58. 6
      include/grpc++/server.h
  59. 67
      include/grpc++/server_builder.h
  60. 56
      include/grpc++/server_posix.h
  61. 3
      include/grpc/compression.h
  62. 70
      include/grpc/grpc_posix.h
  63. 4
      include/grpc/impl/codegen/atm.h
  64. 6
      include/grpc/impl/codegen/atm_windows.h
  65. 27
      include/grpc/impl/codegen/compression_types.h
  66. 2
      include/grpc/impl/codegen/connectivity_state.h
  67. 8
      include/grpc/impl/codegen/grpc_types.h
  68. 3
      include/grpc/impl/codegen/log.h
  69. 42
      include/grpc/impl/codegen/port_platform.h
  70. 4
      include/grpc/impl/codegen/sync.h
  71. 6
      include/grpc/impl/codegen/sync_windows.h
  72. 8
      include/grpc/support/atm_windows.h
  73. 5
      include/grpc/support/avl.h
  74. 6
      include/grpc/support/log_windows.h
  75. 3
      include/grpc/support/string_util.h
  76. 8
      include/grpc/support/sync_windows.h
  77. 78
      package.xml
  78. 16
      setup.py
  79. 29
      src/compiler/config.h
  80. 7
      src/compiler/cpp_generator.cc
  81. 7
      src/compiler/cpp_generator_helpers.h
  82. 2
      src/compiler/cpp_plugin.cc
  83. 119
      src/compiler/csharp_generator.cc
  84. 7
      src/compiler/csharp_generator_helpers.h
  85. 11
      src/compiler/generator_helpers.h
  86. 117
      src/compiler/node_generator.cc
  87. 6
      src/compiler/node_generator.h
  88. 7
      src/compiler/node_generator_helpers.h
  89. 8
      src/compiler/node_plugin.cc
  90. 46
      src/compiler/objective_c_generator.cc
  91. 148
      src/compiler/python_generator.cc
  92. 1
      src/compiler/python_generator.h
  93. 1
      src/compiler/python_plugin.cc
  94. 18
      src/compiler/ruby_generator.cc
  95. 8
      src/compiler/ruby_generator_helpers-inl.h
  96. 18
      src/core/ext/census/grpc_filter.c
  97. 36
      src/core/ext/client_config/channel_connectivity.c
  98. 130
      src/core/ext/client_config/client_channel.c
  99. 2
      src/core/ext/client_config/connector.h
  100. 15
      src/core/ext/client_config/lb_policy.c
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,20 +1,23 @@
language: objective-c
osx_image: xcode7.2
osx_image: xcode7.3
env:
global:
- CONFIG=opt
- TEST=objc
- JOBS=1
before_install:
- pod --version
- gem uninstall cocoapods -a
- gem install cocoapods -v '1.0.0'
- pod --version
- brew install gflags
# Pod install does this too, but we don't want the output.
- pod repo update --silent
- pushd third_party/protobuf
- git checkout v3.0.0-beta-3
- popd
install:
- make grpc_objective_c_plugin
- pushd src/objective-c/tests
# Needs to be verbose, or otherwise OpenSSL's prepare_command makes Travis
# time out:
- pod install --verbose
- pod install
- popd
before_script:
- make interop_server
@ -27,6 +30,6 @@ xcode_scheme:
- InteropTestsLocalCleartext
# TODO(jcanizales): Investigate why they time out:
# - InteropTestsRemote
xcode_sdk: iphonesimulator9.2
xcode_sdk: iphonesimulator9.3
notifications:
email: false

636
BUILD

File diff suppressed because it is too large Load Diff

1516
Makefile

File diff suppressed because it is too large Load Diff

@ -1,6 +1,7 @@
recursive-include src/python/grpcio/grpc *.c *.h *.py *.pyx *.pxd *.pxi *.python *.pem
recursive-exclude src/python/grpcio/grpc/_cython *.so *.pyd
graft src/python/grpcio/tests
graft src/python/grpcio/grpcio.egg-info
graft src/core
graft src/boringssl
graft include/grpc

@ -77,7 +77,7 @@ task 'dlls' do
grpc_config = ENV['GRPC_CONFIG'] || 'opt'
verbose = ENV['V'] || '0'
env = 'CPPFLAGS="-D_WIN32_WINNT=0x600 -DUNICODE -D_UNICODE" '
env = 'CPPFLAGS="-D_WIN32_WINNT=0x600 -DUNICODE -D_UNICODE -Wno-unused-variable -Wno-unused-result" '
env += 'LDFLAGS=-static '
env += 'SYSTEM=MINGW32 '
env += 'EMBED_ZLIB=true '

@ -507,39 +507,38 @@
'src/core/lib/support/cpu_windows.c',
'src/core/lib/support/env_linux.c',
'src/core/lib/support/env_posix.c',
'src/core/lib/support/env_win32.c',
'src/core/lib/support/env_windows.c',
'src/core/lib/support/histogram.c',
'src/core/lib/support/host_port.c',
'src/core/lib/support/load_file.c',
'src/core/lib/support/log.c',
'src/core/lib/support/log_android.c',
'src/core/lib/support/log_linux.c',
'src/core/lib/support/log_posix.c',
'src/core/lib/support/log_win32.c',
'src/core/lib/support/log_windows.c',
'src/core/lib/support/murmur_hash.c',
'src/core/lib/support/slice.c',
'src/core/lib/support/slice_buffer.c',
'src/core/lib/support/stack_lockfree.c',
'src/core/lib/support/string.c',
'src/core/lib/support/string_posix.c',
'src/core/lib/support/string_util_win32.c',
'src/core/lib/support/string_win32.c',
'src/core/lib/support/string_util_windows.c',
'src/core/lib/support/string_windows.c',
'src/core/lib/support/subprocess_posix.c',
'src/core/lib/support/subprocess_windows.c',
'src/core/lib/support/sync.c',
'src/core/lib/support/sync_posix.c',
'src/core/lib/support/sync_win32.c',
'src/core/lib/support/sync_windows.c',
'src/core/lib/support/thd.c',
'src/core/lib/support/thd_posix.c',
'src/core/lib/support/thd_win32.c',
'src/core/lib/support/thd_windows.c',
'src/core/lib/support/time.c',
'src/core/lib/support/time_posix.c',
'src/core/lib/support/time_precise.c',
'src/core/lib/support/time_win32.c',
'src/core/lib/support/time_windows.c',
'src/core/lib/support/tls_pthread.c',
'src/core/lib/support/tmpfile_msys.c',
'src/core/lib/support/tmpfile_posix.c',
'src/core/lib/support/tmpfile_win32.c',
'src/core/lib/support/tmpfile_windows.c',
'src/core/lib/support/wrap_memcpy.c',
],
"conditions": [
@ -571,7 +570,7 @@
'src/core/lib/channel/connected_channel.c',
'src/core/lib/channel/http_client_filter.c',
'src/core/lib/channel/http_server_filter.c',
'src/core/lib/compression/compression_algorithm.c',
'src/core/lib/compression/compression.c',
'src/core/lib/compression/message_compress.c',
'src/core/lib/debug/trace.c',
'src/core/lib/http/format_request.c',
@ -581,6 +580,7 @@
'src/core/lib/iomgr/endpoint.c',
'src/core/lib/iomgr/endpoint_pair_posix.c',
'src/core/lib/iomgr/endpoint_pair_windows.c',
'src/core/lib/iomgr/error.c',
'src/core/lib/iomgr/ev_poll_and_epoll_posix.c',
'src/core/lib/iomgr/ev_poll_posix.c',
'src/core/lib/iomgr/ev_posix.c',
@ -590,6 +590,8 @@
'src/core/lib/iomgr/iomgr.c',
'src/core/lib/iomgr/iomgr_posix.c',
'src/core/lib/iomgr/iomgr_windows.c',
'src/core/lib/iomgr/load_file.c',
'src/core/lib/iomgr/polling_entity.c',
'src/core/lib/iomgr/pollset_set_windows.c',
'src/core/lib/iomgr/pollset_windows.c',
'src/core/lib/iomgr/resolve_address_posix.c',
@ -647,6 +649,7 @@
'src/core/lib/transport/transport.c',
'src/core/lib/transport/transport_op_string.c',
'src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c',
'src/core/ext/transport/chttp2/transport/bin_decoder.c',
'src/core/ext/transport/chttp2/transport/bin_encoder.c',
'src/core/ext/transport/chttp2/transport/chttp2_plugin.c',
'src/core/ext/transport/chttp2/transport/chttp2_transport.c',
@ -676,7 +679,7 @@
'src/core/lib/security/credentials/credentials_metadata.c',
'src/core/lib/security/credentials/fake/fake_credentials.c',
'src/core/lib/security/credentials/google_default/credentials_posix.c',
'src/core/lib/security/credentials/google_default/credentials_win32.c',
'src/core/lib/security/credentials/google_default/credentials_windows.c',
'src/core/lib/security/credentials/google_default/google_default_credentials.c',
'src/core/lib/security/credentials/iam/iam_credentials.c',
'src/core/lib/security/credentials/jwt/json_token.c',
@ -690,6 +693,7 @@
'src/core/lib/security/transport/secure_endpoint.c',
'src/core/lib/security/transport/security_connector.c',
'src/core/lib/security/transport/server_auth_filter.c',
'src/core/lib/security/transport/tsi_error.c',
'src/core/lib/security/util/b64.c',
'src/core/lib/security/util/json_util.c',
'src/core/lib/surface/init_secure.c',
@ -717,10 +721,9 @@
'src/core/ext/client_config/subchannel_index.c',
'src/core/ext/client_config/uri_parser.c',
'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c',
'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c',
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
'src/core/ext/transport/cronet/client/secure/cronet_channel_create.c',
'src/core/ext/transport/cronet/transport/cronet_api_dummy.c',
'src/core/ext/transport/cronet/transport/cronet_transport.c',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c',
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
'third_party/nanopb/pb_common.c',
@ -730,6 +733,8 @@
'src/core/ext/lb_policy/round_robin/round_robin.c',
'src/core/ext/resolver/dns/native/dns_resolver.c',
'src/core/ext/resolver/sockaddr/sockaddr_resolver.c',
'src/core/ext/load_reporting/load_reporting.c',
'src/core/ext/load_reporting/load_reporting_filter.c',
'src/core/ext/census/context.c',
'src/core/ext/census/gen/census.pb.c',
'src/core/ext/census/grpc_context.c',

@ -41,14 +41,14 @@ filegroups:
- include/grpc/support/atm.h
- include/grpc/support/atm_gcc_atomic.h
- include/grpc/support/atm_gcc_sync.h
- include/grpc/support/atm_win32.h
- include/grpc/support/atm_windows.h
- include/grpc/support/avl.h
- include/grpc/support/cmdline.h
- include/grpc/support/cpu.h
- include/grpc/support/histogram.h
- include/grpc/support/host_port.h
- include/grpc/support/log.h
- include/grpc/support/log_win32.h
- include/grpc/support/log_windows.h
- include/grpc/support/port_platform.h
- include/grpc/support/slice.h
- include/grpc/support/slice_buffer.h
@ -57,7 +57,7 @@ filegroups:
- include/grpc/support/sync.h
- include/grpc/support/sync_generic.h
- include/grpc/support/sync_posix.h
- include/grpc/support/sync_win32.h
- include/grpc/support/sync_windows.h
- include/grpc/support/thd.h
- include/grpc/support/time.h
- include/grpc/support/tls.h
@ -70,11 +70,10 @@ filegroups:
- src/core/lib/support/backoff.h
- src/core/lib/support/block_annotate.h
- src/core/lib/support/env.h
- src/core/lib/support/load_file.h
- src/core/lib/support/murmur_hash.h
- src/core/lib/support/stack_lockfree.h
- src/core/lib/support/string.h
- src/core/lib/support/string_win32.h
- src/core/lib/support/string_windows.h
- src/core/lib/support/thd_internal.h
- src/core/lib/support/time_precise.h
- src/core/lib/support/tmpfile.h
@ -91,39 +90,38 @@ filegroups:
- src/core/lib/support/cpu_windows.c
- src/core/lib/support/env_linux.c
- src/core/lib/support/env_posix.c
- src/core/lib/support/env_win32.c
- src/core/lib/support/env_windows.c
- src/core/lib/support/histogram.c
- src/core/lib/support/host_port.c
- src/core/lib/support/load_file.c
- src/core/lib/support/log.c
- src/core/lib/support/log_android.c
- src/core/lib/support/log_linux.c
- src/core/lib/support/log_posix.c
- src/core/lib/support/log_win32.c
- src/core/lib/support/log_windows.c
- src/core/lib/support/murmur_hash.c
- src/core/lib/support/slice.c
- src/core/lib/support/slice_buffer.c
- src/core/lib/support/stack_lockfree.c
- src/core/lib/support/string.c
- src/core/lib/support/string_posix.c
- src/core/lib/support/string_util_win32.c
- src/core/lib/support/string_win32.c
- src/core/lib/support/string_util_windows.c
- src/core/lib/support/string_windows.c
- src/core/lib/support/subprocess_posix.c
- src/core/lib/support/subprocess_windows.c
- src/core/lib/support/sync.c
- src/core/lib/support/sync_posix.c
- src/core/lib/support/sync_win32.c
- src/core/lib/support/sync_windows.c
- src/core/lib/support/thd.c
- src/core/lib/support/thd_posix.c
- src/core/lib/support/thd_win32.c
- src/core/lib/support/thd_windows.c
- src/core/lib/support/time.c
- src/core/lib/support/time_posix.c
- src/core/lib/support/time_precise.c
- src/core/lib/support/time_win32.c
- src/core/lib/support/time_windows.c
- src/core/lib/support/tls_pthread.c
- src/core/lib/support/tmpfile_msys.c
- src/core/lib/support/tmpfile_posix.c
- src/core/lib/support/tmpfile_win32.c
- src/core/lib/support/tmpfile_windows.c
- src/core/lib/support/wrap_memcpy.c
uses:
- gpr_codegen
@ -133,7 +131,7 @@ filegroups:
- include/grpc/impl/codegen/atm.h
- include/grpc/impl/codegen/atm_gcc_atomic.h
- include/grpc/impl/codegen/atm_gcc_sync.h
- include/grpc/impl/codegen/atm_win32.h
- include/grpc/impl/codegen/atm_windows.h
- include/grpc/impl/codegen/log.h
- include/grpc/impl/codegen/port_platform.h
- include/grpc/impl/codegen/slice.h
@ -141,14 +139,20 @@ filegroups:
- include/grpc/impl/codegen/sync.h
- include/grpc/impl/codegen/sync_generic.h
- include/grpc/impl/codegen/sync_posix.h
- include/grpc/impl/codegen/sync_win32.h
- include/grpc/impl/codegen/sync_windows.h
- include/grpc/impl/codegen/time.h
- name: grpc++_codegen_base_src
src:
- src/cpp/codegen/codegen_init.cc
uses:
- grpc++_codegen_base
- name: grpc_base
public_headers:
- include/grpc/byte_buffer.h
- include/grpc/byte_buffer_reader.h
- include/grpc/compression.h
- include/grpc/grpc.h
- include/grpc/grpc_posix.h
- include/grpc/status.h
headers:
- src/core/lib/channel/channel_args.h
@ -168,6 +172,7 @@ filegroups:
- src/core/lib/iomgr/closure.h
- src/core/lib/iomgr/endpoint.h
- src/core/lib/iomgr/endpoint_pair.h
- src/core/lib/iomgr/error.h
- src/core/lib/iomgr/ev_poll_and_epoll_posix.h
- src/core/lib/iomgr/ev_poll_posix.h
- src/core/lib/iomgr/ev_posix.h
@ -177,6 +182,8 @@ filegroups:
- src/core/lib/iomgr/iomgr.h
- src/core/lib/iomgr/iomgr_internal.h
- src/core/lib/iomgr/iomgr_posix.h
- src/core/lib/iomgr/load_file.h
- src/core/lib/iomgr/polling_entity.h
- src/core/lib/iomgr/pollset.h
- src/core/lib/iomgr/pollset_set.h
- src/core/lib/iomgr/pollset_set_windows.h
@ -185,7 +192,7 @@ filegroups:
- src/core/lib/iomgr/sockaddr.h
- src/core/lib/iomgr/sockaddr_posix.h
- src/core/lib/iomgr/sockaddr_utils.h
- src/core/lib/iomgr/sockaddr_win32.h
- src/core/lib/iomgr/sockaddr_windows.h
- src/core/lib/iomgr/socket_utils_posix.h
- src/core/lib/iomgr/socket_windows.h
- src/core/lib/iomgr/tcp_client.h
@ -217,7 +224,6 @@ filegroups:
- src/core/lib/surface/init.h
- src/core/lib/surface/lame_client.h
- src/core/lib/surface/server.h
- src/core/lib/surface/surface_trace.h
- src/core/lib/transport/byte_stream.h
- src/core/lib/transport/connectivity_state.h
- src/core/lib/transport/metadata.h
@ -233,7 +239,7 @@ filegroups:
- src/core/lib/channel/connected_channel.c
- src/core/lib/channel/http_client_filter.c
- src/core/lib/channel/http_server_filter.c
- src/core/lib/compression/compression_algorithm.c
- src/core/lib/compression/compression.c
- src/core/lib/compression/message_compress.c
- src/core/lib/debug/trace.c
- src/core/lib/http/format_request.c
@ -243,6 +249,7 @@ filegroups:
- src/core/lib/iomgr/endpoint.c
- src/core/lib/iomgr/endpoint_pair_posix.c
- src/core/lib/iomgr/endpoint_pair_windows.c
- src/core/lib/iomgr/error.c
- src/core/lib/iomgr/ev_poll_and_epoll_posix.c
- src/core/lib/iomgr/ev_poll_posix.c
- src/core/lib/iomgr/ev_posix.c
@ -252,6 +259,8 @@ filegroups:
- src/core/lib/iomgr/iomgr.c
- src/core/lib/iomgr/iomgr_posix.c
- src/core/lib/iomgr/iomgr_windows.c
- src/core/lib/iomgr/load_file.c
- src/core/lib/iomgr/polling_entity.c
- src/core/lib/iomgr/pollset_set_windows.c
- src/core/lib/iomgr/pollset_windows.c
- src/core/lib/iomgr/resolve_address_posix.c
@ -389,6 +398,16 @@ filegroups:
uses:
- grpc_base
- grpc_client_config
- name: grpc_load_reporting
headers:
- src/core/ext/load_reporting/load_reporting.h
- src/core/ext/load_reporting/load_reporting_filter.h
src:
- src/core/ext/load_reporting/load_reporting.c
- src/core/ext/load_reporting/load_reporting_filter.c
plugin: grpc_load_reporting_plugin
uses:
- grpc_base
- name: grpc_resolver_dns_native
src:
- src/core/ext/resolver/dns/native/dns_resolver.c
@ -405,7 +424,6 @@ filegroups:
- grpc_client_config
- name: grpc_secure
public_headers:
- include/grpc/grpc_cronet.h
- include/grpc/grpc_security.h
- include/grpc/grpc_security_constants.h
headers:
@ -425,6 +443,7 @@ filegroups:
- src/core/lib/security/transport/handshake.h
- src/core/lib/security/transport/secure_endpoint.h
- src/core/lib/security/transport/security_connector.h
- src/core/lib/security/transport/tsi_error.h
- src/core/lib/security/util/b64.h
- src/core/lib/security/util/json_util.h
src:
@ -435,7 +454,7 @@ filegroups:
- src/core/lib/security/credentials/credentials_metadata.c
- src/core/lib/security/credentials/fake/fake_credentials.c
- src/core/lib/security/credentials/google_default/credentials_posix.c
- src/core/lib/security/credentials/google_default/credentials_win32.c
- src/core/lib/security/credentials/google_default/credentials_windows.c
- src/core/lib/security/credentials/google_default/google_default_credentials.c
- src/core/lib/security/credentials/iam/iam_credentials.c
- src/core/lib/security/credentials/jwt/json_token.c
@ -449,6 +468,7 @@ filegroups:
- src/core/lib/security/transport/secure_endpoint.c
- src/core/lib/security/transport/security_connector.c
- src/core/lib/security/transport/server_auth_filter.c
- src/core/lib/security/transport/tsi_error.c
- src/core/lib/security/util/b64.c
- src/core/lib/security/util/json_util.c
- src/core/lib/surface/init_secure.c
@ -489,6 +509,7 @@ filegroups:
- gpr_test_util
- name: grpc_transport_chttp2
headers:
- src/core/ext/transport/chttp2/transport/bin_decoder.h
- src/core/ext/transport/chttp2/transport/bin_encoder.h
- src/core/ext/transport/chttp2/transport/chttp2_transport.h
- src/core/ext/transport/chttp2/transport/frame.h
@ -510,6 +531,7 @@ filegroups:
- src/core/ext/transport/chttp2/transport/timeout_encoding.h
- src/core/ext/transport/chttp2/transport/varint.h
src:
- src/core/ext/transport/chttp2/transport/bin_decoder.c
- src/core/ext/transport/chttp2/transport/bin_encoder.c
- src/core/ext/transport/chttp2/transport/chttp2_plugin.c
- src/core/ext/transport/chttp2/transport/chttp2_transport.c
@ -545,6 +567,7 @@ filegroups:
- name: grpc_transport_chttp2_client_insecure
src:
- src/core/ext/transport/chttp2/client/insecure/channel_create.c
- src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c
uses:
- grpc_transport_chttp2
- grpc_base
@ -560,6 +583,7 @@ filegroups:
- name: grpc_transport_chttp2_server_insecure
src:
- src/core/ext/transport/chttp2/server/insecure/server_chttp2.c
- src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c
uses:
- grpc_transport_chttp2
- grpc_base
@ -571,6 +595,10 @@ filegroups:
- grpc_base
- grpc_secure
- name: grpc_transport_cronet_client_secure
public_headers:
- include/grpc/grpc_cronet.h
- include/grpc/grpc_security.h
- include/grpc/grpc_security_constants.h
headers:
- third_party/objective_c/Cronet/cronet_c_for_grpc.h
src:
@ -612,14 +640,15 @@ filegroups:
- include/grpc++/client_context.h
- include/grpc++/completion_queue.h
- include/grpc++/create_channel.h
- include/grpc++/create_channel_posix.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/codegen/core_codegen.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
@ -640,10 +669,12 @@ filegroups:
- include/grpc++/server.h
- include/grpc++/server_builder.h
- include/grpc++/server_context.h
- include/grpc++/server_posix.h
- include/grpc++/support/async_stream.h
- include/grpc++/support/async_unary_call.h
- include/grpc++/support/byte_buffer.h
- include/grpc++/support/channel_arguments.h
- include/grpc++/support/config.h
- include/grpc++/support/slice.h
- include/grpc++/support/status.h
- include/grpc++/support/status_code_enum.h
@ -653,7 +684,6 @@ filegroups:
- 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:
@ -661,6 +691,7 @@ filegroups:
- src/cpp/client/client_context.cc
- src/cpp/client/create_channel.cc
- src/cpp/client/create_channel_internal.cc
- src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials.cc
- src/cpp/client/generic_stub.cc
- src/cpp/client/insecure_credentials.cc
@ -676,6 +707,7 @@ filegroups:
- src/cpp/server/server_builder.cc
- src/cpp/server/server_context.cc
- src/cpp/server/server_credentials.cc
- src/cpp/server/server_posix.cc
- src/cpp/util/byte_buffer.cc
- src/cpp/util/slice.cc
- src/cpp/util/status.cc
@ -684,9 +716,8 @@ filegroups:
deps:
- grpc
uses:
- grpc++_codegen
- grpc++_config
- name: grpc++_codegen
- grpc++_codegen_base
- name: grpc++_codegen_base
language: c++
public_headers:
- include/grpc++/impl/codegen/async_stream.h
@ -698,11 +729,11 @@ filegroups:
- include/grpc++/impl/codegen/client_unary_call.h
- include/grpc++/impl/codegen/completion_queue.h
- include/grpc++/impl/codegen/completion_queue_tag.h
- include/grpc++/impl/codegen/config.h
- include/grpc++/impl/codegen/core_codegen_interface.h
- include/grpc++/impl/codegen/create_auth_context.h
- include/grpc++/impl/codegen/grpc_library.h
- include/grpc++/impl/codegen/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
@ -719,22 +750,18 @@ filegroups:
- 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
- name: grpc++_codegen_proto
language: c++
public_headers:
- include/grpc++/support/config.h
- include/grpc++/support/config_protobuf.h
- include/grpc++/impl/codegen/proto_utils.h
uses:
- grpc++_config_codegen
- name: grpc++_config_codegen
- grpc++_codegen_base
- grpc++_config_proto
- name: grpc++_config_proto
language: c++
public_headers:
- include/grpc++/impl/codegen/config.h
- include/grpc++/impl/codegen/config_protobuf.h
libs:
- name: gpr
@ -769,12 +796,12 @@ libs:
- grpc_transport_chttp2_client_secure
- grpc_transport_chttp2_server_insecure
- grpc_transport_chttp2_client_insecure
- grpc_transport_cronet_client_secure
- grpc_lb_policy_grpclb
- grpc_lb_policy_pick_first
- grpc_lb_policy_round_robin
- grpc_resolver_dns_native
- grpc_resolver_sockaddr
- grpc_load_reporting
- grpc_secure
- census
generate_plugin_registry: true
@ -783,6 +810,22 @@ libs:
- grpc.dependencies.openssl
- grpc.dependencies.zlib
vs_project_guid: '{29D16885-7228-4C31-81ED-5F9187C7F2A9}'
- name: grpc_cronet
build: all
language: c
src:
- src/core/lib/surface/init.c
baselib: true
deps_linkage: static
dll: true
filegroups:
- grpc_base
- grpc_transport_cronet_client_secure
- grpc_transport_chttp2_client_secure
generate_plugin_registry: true
platforms:
- linux
secure: true
- name: grpc_dll
build: private
language: c
@ -849,6 +892,7 @@ libs:
- grpc_transport_chttp2_client_insecure
- grpc_resolver_dns_native
- grpc_resolver_sockaddr
- grpc_load_reporting
- grpc_lb_policy_grpclb
- grpc_lb_policy_pick_first
- grpc_lb_policy_round_robin
@ -856,21 +900,6 @@ libs:
generate_plugin_registry: true
secure: false
vs_project_guid: '{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}'
- name: grpc_zookeeper
build: all
language: c
public_headers:
- include/grpc/grpc_zookeeper.h
src:
- src/core/ext/resolver/zookeeper/zookeeper_resolver.c
deps:
- gpr
- grpc
external_deps:
- zookeeper
platforms:
- linux
secure: false
- name: reconnect_server
build: private
language: c
@ -900,8 +929,8 @@ libs:
build: all
language: c++
headers:
- include/grpc++/impl/codegen/core_codegen.h
- src/cpp/client/secure_credentials.h
- src/cpp/common/core_codegen.h
- src/cpp/common/secure_auth_context.h
- src/cpp/server/secure_server_credentials.h
src:
@ -917,9 +946,28 @@ libs:
dll: true
filegroups:
- grpc++_base
- grpc++_codegen
- grpc++_codegen_base
- grpc++_codegen_base_src
secure: check
vs_project_guid: '{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}'
- name: grpc++_reflection
build: all
language: c++
public_headers:
- include/grpc++/ext/proto_server_reflection_plugin.h
- include/grpc++/ext/reflection.grpc.pb.h
- include/grpc++/ext/reflection.pb.h
headers:
- src/cpp/ext/proto_server_reflection.h
src:
- src/cpp/ext/proto_server_reflection.cc
- src/cpp/ext/proto_server_reflection_plugin.cc
- src/cpp/ext/reflection.grpc.pb.cc
- src/cpp/ext/reflection.pb.cc
deps:
- grpc++
filegroups:
- grpc++_codegen_proto
- name: grpc++_test_config
build: private
language: c++
@ -933,7 +981,6 @@ libs:
headers:
- test/cpp/end2end/test_service_impl.h
- test/cpp/util/byte_buffer_proto_helper.h
- test/cpp/util/cli_call.h
- test/cpp/util/create_test_channel.h
- test/cpp/util/string_ref_helper.h
- test/cpp/util/subprocess.h
@ -944,7 +991,6 @@ libs:
- src/proto/grpc/testing/duplicate/echo_duplicate.proto
- test/cpp/end2end/test_service_impl.cc
- test/cpp/util/byte_buffer_proto_helper.cc
- test/cpp/util/cli_call.cc
- test/cpp/util/create_test_channel.cc
- test/cpp/util/string_ref_helper.cc
- test/cpp/util/subprocess.cc
@ -952,6 +998,11 @@ libs:
deps:
- grpc++
- grpc_test_util
filegroups:
- grpc++_codegen_base
- grpc++_codegen_base_src
- grpc++_codegen_proto
- grpc++_config_proto
- name: grpc++_unsecure
build: all
language: c++
@ -964,9 +1015,22 @@ libs:
dll: true
filegroups:
- grpc++_base
- grpc++_codegen
- grpc++_codegen_base
- grpc++_codegen_base_src
secure: false
vs_project_guid: '{6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}'
- name: grpc_cli_libs
build: private
language: c++
headers:
- test/cpp/util/cli_call.h
- test/cpp/util/proto_file_parser.h
src:
- test/cpp/util/cli_call.cc
- test/cpp/util/proto_file_parser.cc
deps:
- grpc++
- grpc_plugin_support
- name: grpc_plugin_support
build: protoc
language: c++
@ -994,7 +1058,7 @@ libs:
- src/compiler/python_generator.cc
- src/compiler/ruby_generator.cc
filegroups:
- grpc++_config
- grpc++_config_proto
secure: false
vs_project_guid: '{B6E81D84-2ACB-41B8-8781-493A944C7817}'
vs_props:
@ -1052,7 +1116,7 @@ libs:
- src/proto/grpc/testing/empty.proto
- src/proto/grpc/testing/messages.proto
- src/proto/grpc/testing/test.proto
- test/cpp/interop/server_main.cc
- test/cpp/interop/interop_server.cc
deps:
- interop_server_helper
- grpc++_test_util
@ -1071,7 +1135,7 @@ libs:
- test/cpp/qps/histogram.h
- test/cpp/qps/interarrival.h
- test/cpp/qps/limit_cores.h
- test/cpp/qps/perf_db_client.h
- test/cpp/qps/parse_json.h
- test/cpp/qps/qps_worker.h
- test/cpp/qps/report.h
- test/cpp/qps/server.h
@ -1084,12 +1148,11 @@ libs:
- src/proto/grpc/testing/stats.proto
- src/proto/grpc/testing/control.proto
- src/proto/grpc/testing/services.proto
- src/proto/grpc/testing/perf_db.proto
- test/cpp/qps/client_async.cc
- test/cpp/qps/client_sync.cc
- test/cpp/qps/driver.cc
- test/cpp/qps/limit_cores.cc
- test/cpp/qps/perf_db_client.cc
- test/cpp/qps/parse_json.cc
- test/cpp/qps/qps_worker.cc
- test/cpp/qps/report.cc
- test/cpp/qps/server_async.cc
@ -1174,6 +1237,14 @@ targets:
- test/core/end2end/fuzzers/api_fuzzer_corpus
dict: test/core/end2end/fuzzers/api_fuzzer.dictionary
maxlen: 2048
- name: bin_decoder_test
build: test
language: c
src:
- test/core/transport/chttp2/bin_decoder_test.c
deps:
- grpc_test_util
- grpc
- name: bin_encoder_test
build: test
language: c
@ -1373,7 +1444,7 @@ targets:
- gpr_test_util
- gpr
- name: fling_stream_test
cpu_cost: 2
cpu_cost: 1.5
build: test
language: c
src:
@ -1388,7 +1459,7 @@ targets:
- linux
- posix
- name: fling_test
cpu_cost: 2
cpu_cost: 1.5
build: test
language: c
src:
@ -1487,14 +1558,6 @@ targets:
deps:
- gpr_test_util
- gpr
- name: gpr_load_file_test
build: test
language: c
src:
- test/core/support/load_file_test.c
deps:
- gpr_test_util
- gpr
- name: gpr_log_test
build: test
language: c
@ -1520,7 +1583,7 @@ targets:
- gpr_test_util
- gpr
- name: gpr_stack_lockfree_test
cpu_cost: 10
cpu_cost: 7
build: test
language: c
src:
@ -1537,7 +1600,7 @@ targets:
- gpr_test_util
- gpr
- name: gpr_sync_test
cpu_cost: 10
cpu_cost: 3
build: test
language: c
src:
@ -1546,7 +1609,7 @@ targets:
- gpr_test_util
- gpr
- name: gpr_thd_test
cpu_cost: 10
cpu_cost: 1
build: test
language: c
src:
@ -1766,11 +1829,21 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: http_fuzzer_test
- name: http_parser_test
build: test
language: c
src:
- test/core/http/parser_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: http_request_fuzzer_test
build: fuzzer
language: c
src:
- test/core/http/fuzzer.c
- test/core/http/request_fuzzer.c
deps:
- grpc_test_util
- grpc
@ -1779,16 +1852,19 @@ targets:
corpus_dirs:
- test/core/http/corpus
maxlen: 2048
- name: http_parser_test
build: test
- name: http_response_fuzzer_test
build: fuzzer
language: c
src:
- test/core/http/parser_test.c
- test/core/http/response_fuzzer.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- test/core/http/corpus
maxlen: 2048
- name: httpcli_format_request_test
build: test
language: c
@ -1871,6 +1947,7 @@ targets:
- gpr_test_util
- gpr
- name: invalid_call_argument_test
cpu_cost: 0.1
build: test
language: c
src:
@ -1954,6 +2031,16 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: load_file_test
build: test
language: c
src:
- test/core/iomgr/load_file_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: low_level_ping_pong_benchmark
build: benchmark
language: c
@ -2074,6 +2161,16 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: sequential_connectivity_test
build: test
language: c
src:
- test/core/surface/sequential_connectivity_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: server_chttp2_test
build: test
language: c
@ -2170,7 +2267,7 @@ targets:
- linux
- posix
- name: tcp_posix_test
cpu_cost: 0.5
cpu_cost: 0.2
build: test
language: c
src:
@ -2389,6 +2486,7 @@ targets:
src:
- test/cpp/util/cli_call_test.cc
deps:
- grpc_cli_libs
- grpc++_test_util
- grpc_test_util
- grpc++
@ -2434,7 +2532,6 @@ targets:
- src/proto/grpc/testing/control.proto
- src/proto/grpc/testing/messages.proto
- src/proto/grpc/testing/payloads.proto
- src/proto/grpc/testing/perf_db.proto
- src/proto/grpc/testing/services.proto
- src/proto/grpc/testing/stats.proto
- test/cpp/codegen/codegen_test_full.cc
@ -2443,7 +2540,7 @@ targets:
- grpc
- gpr
filegroups:
- grpc++_codegen
- grpc++_codegen_base
- name: codegen_test_minimal
gtest: true
build: test
@ -2452,12 +2549,12 @@ targets:
- src/proto/grpc/testing/control.proto
- src/proto/grpc/testing/messages.proto
- src/proto/grpc/testing/payloads.proto
- src/proto/grpc/testing/perf_db.proto
- src/proto/grpc/testing/services.proto
- src/proto/grpc/testing/stats.proto
- test/cpp/codegen/codegen_test_minimal.cc
filegroups:
- grpc++_codegen
- grpc++_codegen_base
- grpc++_codegen_base_src
- name: credentials_test
gtest: true
build: test
@ -2557,6 +2654,7 @@ targets:
src:
- test/cpp/util/grpc_cli.cc
deps:
- grpc_cli_libs
- grpc++_test_util
- grpc_test_util
- grpc++
@ -2742,6 +2840,23 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: proto_server_reflection_test
gtest: true
build: test
language: c++
headers:
- test/cpp/util/proto_reflection_descriptor_database.h
src:
- test/cpp/end2end/proto_server_reflection_test.cc
- test/cpp/util/proto_reflection_descriptor_database.cc
deps:
- grpc++_reflection
- grpc++_test_util
- grpc_test_util
- grpc++
- grpc
- gpr_test_util
- gpr
- name: qps_interarrival_test
build: test
run: false
@ -2764,10 +2879,7 @@ targets:
build: test
run: false
language: c++
headers:
- test/cpp/qps/parse_json.h
src:
- test/cpp/qps/parse_json.cc
- test/cpp/qps/qps_json_driver.cc
deps:
- qps
@ -3006,26 +3118,6 @@ targets:
- grpc
- gpr_test_util
- gpr
- name: zookeeper_test
gtest: true
build: test
run: false
language: c++
src:
- src/proto/grpc/testing/echo.proto
- test/cpp/end2end/zookeeper_test.cc
deps:
- grpc++_test_util
- grpc_test_util
- grpc++
- grpc_zookeeper
- grpc
- gpr_test_util
- gpr
external_deps:
- zookeeper
platforms:
- linux
- name: public_headers_must_be_c89
build: test
language: c89

@ -2,7 +2,6 @@
"name": "grpc/grpc",
"type": "library",
"description": "gRPC library for PHP",
"version": "0.15.0",
"keywords": ["rpc"],
"homepage": "http://grpc.io",
"license": "BSD-3-Clause",

@ -48,39 +48,38 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/support/cpu_windows.c \
src/core/lib/support/env_linux.c \
src/core/lib/support/env_posix.c \
src/core/lib/support/env_win32.c \
src/core/lib/support/env_windows.c \
src/core/lib/support/histogram.c \
src/core/lib/support/host_port.c \
src/core/lib/support/load_file.c \
src/core/lib/support/log.c \
src/core/lib/support/log_android.c \
src/core/lib/support/log_linux.c \
src/core/lib/support/log_posix.c \
src/core/lib/support/log_win32.c \
src/core/lib/support/log_windows.c \
src/core/lib/support/murmur_hash.c \
src/core/lib/support/slice.c \
src/core/lib/support/slice_buffer.c \
src/core/lib/support/stack_lockfree.c \
src/core/lib/support/string.c \
src/core/lib/support/string_posix.c \
src/core/lib/support/string_util_win32.c \
src/core/lib/support/string_win32.c \
src/core/lib/support/string_util_windows.c \
src/core/lib/support/string_windows.c \
src/core/lib/support/subprocess_posix.c \
src/core/lib/support/subprocess_windows.c \
src/core/lib/support/sync.c \
src/core/lib/support/sync_posix.c \
src/core/lib/support/sync_win32.c \
src/core/lib/support/sync_windows.c \
src/core/lib/support/thd.c \
src/core/lib/support/thd_posix.c \
src/core/lib/support/thd_win32.c \
src/core/lib/support/thd_windows.c \
src/core/lib/support/time.c \
src/core/lib/support/time_posix.c \
src/core/lib/support/time_precise.c \
src/core/lib/support/time_win32.c \
src/core/lib/support/time_windows.c \
src/core/lib/support/tls_pthread.c \
src/core/lib/support/tmpfile_msys.c \
src/core/lib/support/tmpfile_posix.c \
src/core/lib/support/tmpfile_win32.c \
src/core/lib/support/tmpfile_windows.c \
src/core/lib/support/wrap_memcpy.c \
src/core/lib/surface/init.c \
src/core/lib/channel/channel_args.c \
@ -90,7 +89,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/channel/connected_channel.c \
src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \
src/core/lib/compression/compression_algorithm.c \
src/core/lib/compression/compression.c \
src/core/lib/compression/message_compress.c \
src/core/lib/debug/trace.c \
src/core/lib/http/format_request.c \
@ -100,6 +99,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/endpoint.c \
src/core/lib/iomgr/endpoint_pair_posix.c \
src/core/lib/iomgr/endpoint_pair_windows.c \
src/core/lib/iomgr/error.c \
src/core/lib/iomgr/ev_poll_and_epoll_posix.c \
src/core/lib/iomgr/ev_poll_posix.c \
src/core/lib/iomgr/ev_posix.c \
@ -109,6 +109,8 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/iomgr.c \
src/core/lib/iomgr/iomgr_posix.c \
src/core/lib/iomgr/iomgr_windows.c \
src/core/lib/iomgr/load_file.c \
src/core/lib/iomgr/polling_entity.c \
src/core/lib/iomgr/pollset_set_windows.c \
src/core/lib/iomgr/pollset_windows.c \
src/core/lib/iomgr/resolve_address_posix.c \
@ -166,6 +168,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/transport/transport.c \
src/core/lib/transport/transport_op_string.c \
src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c \
src/core/ext/transport/chttp2/transport/bin_decoder.c \
src/core/ext/transport/chttp2/transport/bin_encoder.c \
src/core/ext/transport/chttp2/transport/chttp2_plugin.c \
src/core/ext/transport/chttp2/transport/chttp2_transport.c \
@ -195,7 +198,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/security/credentials/credentials_metadata.c \
src/core/lib/security/credentials/fake/fake_credentials.c \
src/core/lib/security/credentials/google_default/credentials_posix.c \
src/core/lib/security/credentials/google_default/credentials_win32.c \
src/core/lib/security/credentials/google_default/credentials_windows.c \
src/core/lib/security/credentials/google_default/google_default_credentials.c \
src/core/lib/security/credentials/iam/iam_credentials.c \
src/core/lib/security/credentials/jwt/json_token.c \
@ -209,6 +212,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/security/transport/secure_endpoint.c \
src/core/lib/security/transport/security_connector.c \
src/core/lib/security/transport/server_auth_filter.c \
src/core/lib/security/transport/tsi_error.c \
src/core/lib/security/util/b64.c \
src/core/lib/security/util/json_util.c \
src/core/lib/surface/init_secure.c \
@ -236,10 +240,9 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/client_config/subchannel_index.c \
src/core/ext/client_config/uri_parser.c \
src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \
src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \
src/core/ext/transport/chttp2/client/insecure/channel_create.c \
src/core/ext/transport/cronet/client/secure/cronet_channel_create.c \
src/core/ext/transport/cronet/transport/cronet_api_dummy.c \
src/core/ext/transport/cronet/transport/cronet_transport.c \
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \
third_party/nanopb/pb_common.c \
@ -249,6 +252,8 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/lb_policy/round_robin/round_robin.c \
src/core/ext/resolver/dns/native/dns_resolver.c \
src/core/ext/resolver/sockaddr/sockaddr_resolver.c \
src/core/ext/load_reporting/load_reporting.c \
src/core/ext/load_reporting/load_reporting_filter.c \
src/core/ext/census/context.c \
src/core/ext/census/gen/census.pb.c \
src/core/ext/census/grpc_context.c \
@ -572,6 +577,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/pick_first)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/round_robin)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/load_reporting)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/resolver/dns/native)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/resolver/sockaddr)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/alpn)
@ -580,8 +586,6 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/insecure)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/cronet/client/secure)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/cronet/transport)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/compression)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/debug)

@ -38,7 +38,7 @@ Request-Headers are delivered as HTTP2 headers in HEADERS + CONTINUATION frames.
* **Nanosecond** → "n"
* **Content-Type** → "content-type" "application/grpc" [("+proto" / "+json" / {_custom_})]
* **Content-Coding** → "identity" / "gzip" / "deflate" / "snappy" / {_custom_}
* **Message-Encoding** → "grpc-encoding" Content-Coding
* <a name="message-encoding"></a>**Message-Encoding** → "grpc-encoding" Content-Coding
* **Message-Accept-Encoding** → "grpc-accept-encoding" Content-Coding \*("," Content-Coding)
* **User-Agent** → "user-agent" {_structured user-agent string_}
* **Message-Type** → "grpc-message-type" {_type name for message schema_}
@ -83,7 +83,7 @@ binary values' lengths being post-Base64.
The repeated sequence of **Length-Prefixed-Message** items is delivered in DATA frames
* **Length-Prefixed-Message** → Compressed-Flag Message-Length Message
* **Compressed-Flag** → 0 / 1 # encoded as 1 byte unsigned integer
* <a name="compressed-flag"></a>**Compressed-Flag** → 0 / 1 # encoded as 1 byte unsigned integer
* **Message-Length** → {_length of Message_} # encoded as 4 byte unsigned integer
* **Message** → \*{binary octet}

@ -11,7 +11,7 @@ General
- Layout rules are defined by clang-format, and all code should be passed through
clang-format. A (docker-based) script to do so is included in
tools/distrib/clang_format_code.sh.
[tools/distrib/clang\_format\_code.sh] (../tools/distrib/clang_format_code.sh).
Header Files
------------

@ -0,0 +1,77 @@
# gRPC command line tool
## Overview
This document describes the command line tool that comes with gRPC repository. It is desireable to have command line
tools written in other languages to roughly follow the same syntax and flags.
At this point, the tool needs to be built from source, and it should be moved out to grpc-tools repository as a stand
alone application once it is mature enough.
## Core functionality
The command line tool can do the following things:
- Send unary rpc.
- Attach metadata and display received metadata.
- Handle common authentication to server.
- Find the request/response types from a given proto file.
- Read proto request in text form.
- Read request in wire form (for protobuf messages, this means serialized binary form).
- Display proto response in text form.
- Write response in wire form to a file.
The command line tool should support the following things:
- List server services and methods through server reflection.
- Infer request/response types from server reflection result.
- Fine-grained auth control (such as, use this oauth token to talk to the server).
- Send streaming rpc.
## Code location
To use the tool, you need to get the grpc repository and in the grpc directory execute
```
$ make grpc_cli
```
The main file can be found at
https://github.com/grpc/grpc/blob/master/test/cpp/util/grpc_cli.cc
## Usage
### Basic usage
Send a rpc to a helloworld server at `localhost:50051`:
```
$ bins/opt/grpc_cli call localhost:50051 SayHello examples/protos/helloworld.proto \
"name: 'world'" --enable_ssl=false
```
On success, the tool will print out
```
Rpc succeeded with OK status
Response:
message: "Hello world"
```
The `localhost:50051` part indicates the server you are connecting to. `SayHello` is (part of) the
gRPC method string. Then there is the path to the proto file containing the service definition,
if it is not under current directory, you can use `--proto_path` to specify a new search root.
`"name: 'world'"` is the text format of the request proto message.
We are not using ssl here by `--enable_ssl=false`. For information on more
flags, look at the comments of `grpc_cli.cc`.
### Send non-proto rpc
For using gRPC with protocols other than probobuf, you will need the exact method name string
and a file containing the raw bytes to be sent on the wire
```
$ bins/opt/grpc_cli call localhost:50051 /helloworld.Greeter/SayHello --input_binary_file=input.bin \
--output_binary_file=output.bin
```
On success, you will need to read or decode the response from the `output.bin` file.

@ -0,0 +1,111 @@
## **gRPC Compression**
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in [RFC 2119](http://www.ietf.org/rfc/rfc2119.txt).
### Intent
Compression is used to reduce the amount of bandwidth used between peers. The
compression supported by gRPC acts _at the individual message level_, taking
_message_ [as defined in the wire format
document](PROTOCOL-HTTP2.md).
The implementation supports different compression algorithms. A _default
compression level_, to be used in the absence of message-specific settings, MAY
be specified for during channel creation.
The ability to control compression settings per call and to enable/disable
compression on a per message basis MAY be used to prevent CRIME/BEAST attacks.
It also allows for asymmetric compression communication, whereby a response MAY
be compressed differently, if at all.
### Specification
Compression MAY be configured by the Client Application by calling the
appropriate API method. There are two scenarios where compression MAY be
configured:
+ At channel creation time, which sets the channel default compression and
therefore the compression that SHALL be used in the absence of per-RPC
compression configuration.
+ At response time, via:
+ For unary RPCs, the {Client,Server}Context instance.
+ For streaming RPCs, the {Client,Server}Writer instance. In this case,
configuration is reduced to disabling compression altogether.
### Compression Method Asymmetry Between Peers
A gRPC peer MAY choose to respond using a different compression method to that
of the request, including not performing any compression, regardless of channel
and RPC settings (for example, if compression would result in small or negative
gains).
When a message from a client compressed with an unsupported algorithm is
processed by a server, it WILL result in an INVALID\_ARGUMENT error on the
server. The server will then include in its response a `grpc-accept-encoding`
header specifying the algorithms it does accept. If an INTERNAL error is
returned from the server despite having used one of the algorithms from the
`grpc-accept-encoding` header, the cause MUST NOT be related to compression.
Data sent from a server compressed with an algorithm not supported by the client
WILL result in an INTERNAL error on the client side.
Note that a peer MAY choose to not disclose all the encodings it supports.
However, if it receives a message compressed in an undisclosed but supported
encoding, it MUST include said encoding in the response's `grpc-accept-encoding
h`eader.
For every message a server is requested to compress using an algorithm it knows
the client doesn't support (as indicated by the last `grpc-accept-encoding`
header received from the client), it SHALL send the message uncompressed.
### Specific Disabling of Compression
If the user (through the previously described mechanisms) requests to disable
compression the next message MUST be sent uncompressed. This is instrumental in
preventing BEAST/CRIME attacks. This applies to both the the unary and streaming
cases.
### Compression Levels and Algorithms
The set of supported algorithm is implementation dependent. In order to simplify
the public API and to operate seamlessly across implementations (both in terms
of languages but also different version of the same one), we introduce the idea
of _compression levels_ (such as "low", "medium", "high").
Levels map to concrete algorithms and/or their settings (such as "low" mapping
to "gzip -3" and "high" mapping to "gzip -9") automatically depending on what a
peer is known to support. A server is always aware of what its clients support,
as clients disclose it in their Message-Accept-Encoding header as part of their
initial call. A client doesn't a priori (presently) know which algorithms a
server supports. This issue can be addressed with an initial negotiation of
capabilities or an automatic retry mechanism. These features will be implemented
in the future. Currently however, compression levels are only supported at the
server side, which is aware of the client's capabilities through the incoming
Message-Accept-Encoding header.
### Propagation to child RPCs
The inheritance of the compression configuration by child RPCs is left up to the
implementation. Note that in the absence of changes to the parent channel, its
configuration will be used.
### Test cases
1. When a compression level is not specified for either the channel or the
message, the default channel level _none_ is considered: data MUST NOT be
compressed.
1. When per-RPC compression configuration isn't present for a message, the
channel compression configuration MUST be used.
1. When a compression method (including no compression) is specified for an
outgoing message, the message MUST be compressed accordingly.
1. A message compressed in a way not supported by its endpoint MUST fail with
INVALID\_ARGUMENT status, its associated description indicating the unsupported
condition as well as the supported ones. The returned `grpc-accept-encoding`
header MUST NOT contain the compression method (encoding) used.
1. An ill-constructed message with its [Compressed-Flag
bit](PROTOCOL-HTTP2.md#compressed-flag)
set but lacking a
"[grpc-encoding](PROTOCOL-HTTP2.md#message-encoding)"
entry different from _identity_ in its metadata MUST fail with INTERNAL status,
its associated description indicating the invalid Compressed-Flag condition.

@ -0,0 +1,91 @@
GRPC C++ STYLE GUIDE
=====================
Background
----------
Here we document style rules for C++ usage in the gRPC C++ bindings
and tests.
General
-------
- The majority of gRPC's C++ requirements are drawn from the [Google C++ style
guide] (https://google.github.io/styleguide/cppguide.html)
- However, gRPC has some additional requirements to maintain
[portability] (#portability)
- As in C, layout rules are defined by clang-format, and all code
should be passed through clang-format. A (docker-based) script to do
so is included in [tools/distrib/clang\_format\_code.sh]
(../tools/distrib/clang_format_code.sh).
<a name="portability"></a>
Portability Restrictions
-------------------
gRPC supports a large number of compilers, ranging from those that are
missing many key C++11 features to those that have quite detailed
analysis. As a result, gRPC compiles with a high level of warnings and
treat all warnings as errors. gRPC also forbids the use of some common
C++11 constructs. Here are some guidelines, to be extended as needed:
- Do not use range-based for. Expressions of the form
```c
for (auto& i: vec) {
// code
}
```
are not allowed and should be replaced with code such as
```c
for (auto it = vec.begin; it != vec.end(); it++) {
auto& i = *it;
// code
}
```
- Do not use lambda of any kind (no capture, explicit capture, or
default capture). Other C++ functional features such as
`std::function` or `std::bind` are allowed
- Do not use brace-list initializers.
- Do not compare a pointer to `nullptr` . This is because gcc 4.4
does not support `nullptr` directly and gRPC implements a subset of
its features in [include/grpc++/impl/codegen/config.h]
(../include/grpc++/impl/codegen/config.h). Instead, pointers should
be checked for validity using their implicit conversion to `bool`.
In other words, use `if (p)` rather than `if (p != nullptr)`
- Do not initialize global/static pointer variables to `nullptr`. Just let
the compiler implicitly initialize them to `nullptr` (which it will
definitely do). The reason is that `nullptr` is an actual object in
our implementation rather than just a constant pointer value, so
static/global constructors will be called in a potentially
undesirable sequence.
- Do not use `final` or `override` as these are not supported by some
compilers. Instead use `GRPC_FINAL` and `GRPC_OVERRIDE` . These
compile down to the traditional C++ forms for compilers that support
them but are just elided if the compiler does not support those features.
- In the [include] (../../../tree/master/include/grpc++) and [src]
(../../../tree/master/src/cpp) directory trees, you should also not
use certain STL objects like `std::mutex`, `std::lock_guard`,
`std::unique_lock`, `std::nullptr`, `std::thread` . Instead, use
`grpc::mutex`, `grpc::lock_guard`, etc., which are gRPC
implementations of the prominent features of these objects that are
not always available. You can use the `std` versions of those in [test]
(../../../tree/master/test/cpp)
- Similarly, in the same directories, do not use `std::chrono` unless
it is guarded by `#ifndef GRPC_CXX0X_NO_CHRONO` . For platforms that
lack`std::chrono,` there is a C-language timer called gpr_timespec that can
be used instead.
- `std::unique_ptr` must be used with extreme care in any kind of
collection. For example `vector<std::unique_ptr>` does not work in
gcc 4.4 if the vector is constructed to its full size at
initialization but does work if elements are added to the vector
using functions like `push_back`. `map` and other pair-based
collections do not work with `unique_ptr` under gcc 4.4. The issue
is that many of these collection implementations assume a copy
constructor
to be available.
- Don't use `std::this_thread` . Use `gpr_sleep_until` for sleeping a thread.
- [Some adjacent character combinations cause problems]
(https://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C). If declaring a
template against some class relative to the global namespace,
`<::name` will be non-portable. Separate the `<` from the `:` and use `< ::name`.

@ -68,14 +68,12 @@ control (even if compression is enabled on the channel).
Server features:
* [UnaryCall][]
* [Compressable Payload][]
Procedure:
1. Client calls UnaryCall with:
```
{
response_type: COMPRESSABLE
response_size: 314159
payload:{
body: 271828 bytes of zeros
@ -85,80 +83,106 @@ Procedure:
Client asserts:
* call was successful
* response payload type is COMPRESSABLE
* response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are zero
and comparing the entire response message against a golden response
### large_compressed_unary
This test verifies compressed unary calls succeed in sending messages. It
sends one unary request for every combination of compression algorithm and
payload type.
In all scenarios, whether compression was actually performed is determined by
the compression bit in the response's message flags. The response's compression
value indicates which algorithm was used if said compression bit is set.
### client_compressed_unary
This test verifies the client can compress unary messages by sending two unary
calls, for compressed and uncompressed payloads. It also sends an initial
probing request to verify whether the server supports the [CompressedRequest][]
feature by checking if the probing call fails with an `INVALID_ARGUMENT` status.
Server features:
* [UnaryCall][]
* [Compressable Payload][]
* [Uncompressable Payload][]
* [Random Payload][]
* [CompressedRequest][]
Procedure:
1. Client calls UnaryCall with:
1. Client calls UnaryCall with the feature probe, an *uncompressed* message:
```
{
expect_compressed:{
value: true
}
response_size: 314159
payload:{
body: 271828 bytes of zeros
}
}
```
1. Client calls UnaryCall with the *compressed* message:
```
{
response_compression: <one of {NONE, GZIP, DEFLATE}>
response_type: COMPRESSABLE
expect_compressed:{
value: true
}
response_size: 314159
payload:{
body: 271828 bytes of zeros
}
}
```
Client asserts:
* call was successful
* response payload type is COMPRESSABLE
* response compression is consistent with the requested one.
* if `response_compression == NONE`, the response MUST NOT have the
compressed message flag set.
* if `response_compression != NONE`, the response MUST have the compressed
message flag set.
* response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are
zero and comparing the entire response message against a golden response
1. Client calls UnaryCall with the *uncompressed* message:
2. Client calls UnaryCall with:
```
{
response_compression: <one of {NONE, GZIP, DEFLATE}>
response_type: UNCOMPRESSABLE
expect_compressed:{
value: false
}
response_size: 314159
payload:{
body: 271828 bytes of zeros
}
}
```
Client asserts:
* call was successful
* response payload type is UNCOMPRESSABLE
* response compression is consistent with the requested one.
* the response MUST NOT have the compressed message flag set.
* response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are
identical to the golden uncompressable data at `test/cpp/interop/rnd.dat`.
* First call failed with `INVALID_ARGUMENT` status.
* Subsequent calls were successful.
* Response payload body is 314159 bytes in size.
* Clients are free to assert that the response payload body contents are
zeros and comparing the entire response message against a golden response.
### server_compressed_unary
This test verifies the server can compress unary messages. It sends two unary
requests, expecting the server's response to be compressed or not according to
the `response_compressed` boolean.
Whether compression was actually performed is determined by the compression bit
in the response's message flags. *Note that some languages may not have access
to the message flags*.
Server features:
* [UnaryCall][]
* [CompressedResponse][]
Procedure:
1. Client calls UnaryCall with `SimpleRequest`:
```
{
response_compressed:{
value: true
}
response_size: 314159
payload:{
body: 271828 bytes of zeros
}
}
```
3. Client calls UnaryCall with:
```
{
response_compression: <one of {NONE, GZIP, DEFLATE}>
response_type: RANDOM
response_compressed:{
value: false
}
response_size: 314159
payload:{
body: 271828 bytes of zeros
@ -167,9 +191,14 @@ Procedure:
```
Client asserts:
* call was successful
* response payload type is either COMPRESSABLE or UNCOMPRESSABLE
* the behavior is consistent with the randomly chosen incoming payload type,
as described in their respective sections.
* when `response_compressed` is true, the response MUST have the
compressed message flag set.
* when `response_compressed` is false, the response MUST NOT have
the compressed message flag set.
* response payload body is 314159 bytes in size in both cases.
* clients are free to assert that the response payload body contents are
zero and comparing the entire response message against a golden response
### client_streaming
@ -177,7 +206,6 @@ This test verifies that client-only streaming succeeds.
Server features:
* [StreamingInputCall][]
* [Compressable Payload][]
Procedure:
1. Client calls StreamingInputCall
@ -227,61 +255,76 @@ Client asserts:
* call was successful
* response aggregated_payload_size is 74922
### server_streaming
This test verifies that server-only streaming succeeds.
### client_compressed_streaming
Server features:
* [StreamingOutputCall][]
* [Compressable Payload][]
This test verifies the client can compress requests on per-message basis by
performing a two-request streaming call. It also sends an initial probing
request to verify whether the server supports the [CompressedRequest][] feature
by checking if the probing call fails with an `INVALID_ARGUMENT` status.
Procedure:
1. Client calls StreamingOutputCall with:
1. Client calls `StreamingInputCall` and sends the following feature-probing
*uncompressed* `StreamingInputCallRequest` message
```
{
response_type:COMPRESSABLE
response_parameters:{
size: 31415
expect_compressed:{
value: true
}
response_parameters:{
size: 9
payload:{
body: 27182 bytes of zeros
}
response_parameters:{
size: 2653
}
```
If the call fails with `INVALID_ARGUMENT`, the test fails. Otherwise, we
continue.
1. Client calls `StreamingInputCall` again, sending the *compressed* message
```
{
expect_compressed:{
value: true
}
response_parameters:{
size: 58979
payload:{
body: 27182 bytes of zeros
}
}
```
1. And finally, the *uncompressed* message
```
{
expect_compressed:{
value: false
}
payload:{
body: 45904 bytes of zeros
}
}
```
1. Client half-closes
Client asserts:
* call was successful
* exactly four responses
* response payloads are COMPRESSABLE
* response payload bodies are sized (in order): 31415, 9, 2653, 58979
* clients are free to assert that the response payload body contents are zero
and comparing the entire response messages against golden responses
* First call fails with `INVALID_ARGUMENT`.
* Next calls succeeds.
* Response aggregated payload size is 73086.
### server_compressed_streaming
This test verifies that server-only compressed streaming succeeds.
### server_streaming
This test verifies that server-only streaming succeeds.
Server features:
* [StreamingOutputCall][]
* [Compressable Payload][]
* [Uncompressable Payload][]
* [Random Payload][]
Procedure:
1. Client calls StreamingOutputCall with:
1. Client calls StreamingOutputCall with `StreamingOutputCallRequest`:
```
{
response_compression: <one of {NONE, GZIP, DEFLATE}>
response_type:COMPRESSABLE
response_parameters:{
size: 31415
}
@ -297,78 +340,54 @@ Procedure:
}
```
Client asserts:
* call was successful
* exactly four responses
* response payloads are COMPRESSABLE
* response compression is consistent with the requested one.
* if `response_compression == NONE`, the response MUST NOT have the
compressed message flag set.
* if `response_compression != NONE`, the response MUST have the compressed
message flag set.
* response payload bodies are sized (in order): 31415, 9, 2653, 58979
* clients are free to assert that the response payload body contents are
zero and comparing the entire response messages against golden responses
Client asserts:
* call was successful
* exactly four responses
* response payload bodies are sized (in order): 31415, 9, 2653, 58979
* clients are free to assert that the response payload body contents are zero
and comparing the entire response messages against golden responses
2. Client calls StreamingOutputCall with:
### server_compressed_streaming
```
{
response_compression: <one of {NONE, GZIP, DEFLATE}>
response_type:UNCOMPRESSABLE
response_parameters:{
size: 31415
}
response_parameters:{
size: 9
}
response_parameters:{
size: 2653
}
response_parameters:{
size: 58979
}
}
```
This test verifies that the server can compress streaming messages and disable
compression on individual messages.
Client asserts:
* call was successful
* exactly four responses
* response payloads are UNCOMPRESSABLE
* response compressions are consistent with the requested one.
* the responses MUST NOT have the compressed message flag set.
* response payload bodies are sized (in order): 31415, 9, 2653, 58979
* clients are free to assert that the body of the responses are identical to
the golden uncompressable data at `test/cpp/interop/rnd.dat`.
Server features:
* [StreamingOutputCall][]
* [CompressedResponse][]
3. Client calls StreamingOutputCall with:
Procedure:
1. Client calls StreamingOutputCall with `StreamingOutputCallRequest`:
```
{
response_compression: <one of {NONE, GZIP, DEFLATE}>
response_type:RANDOM
response_parameters:{
compressed: {
value: true
}
size: 31415
}
response_parameters:{
size: 9
}
response_parameters:{
size: 2653
}
response_parameters:{
size: 58979
compressed: {
value: false
}
size: 92653
}
}
```
Client asserts:
* call was successful
* response payload type is either COMPRESSABLE or UNCOMPRESSABLE
* the behavior is consistent with the randomly chosen incoming payload type,
as described in their respective sections.
* exactly two responses
* when `response_compressed` is false, the response's messages MUST
NOT have the compressed message flag set.
* when `response_compressed` is true, the response's messages MUST
have the compressed message flag set.
* response payload bodies are sized (in order): 31415, 92653
* clients are free to assert that the response payload body contents are
zero and comparing the entire response messages against golden responses
### ping_pong
@ -376,14 +395,12 @@ This test verifies that full duplex bidi is supported.
Server features:
* [FullDuplexCall][]
* [Compressable Payload][]
Procedure:
1. Client calls FullDuplexCall with:
```
{
response_type: COMPRESSABLE
response_parameters:{
size: 31415
}
@ -397,7 +414,6 @@ Procedure:
```
{
response_type: COMPRESSABLE
response_parameters:{
size: 9
}
@ -411,7 +427,6 @@ Procedure:
```
{
response_type: COMPRESSABLE
response_parameters:{
size: 2653
}
@ -425,7 +440,6 @@ Procedure:
```
{
response_type: COMPRESSABLE
response_parameters:{
size: 58979
}
@ -440,7 +454,6 @@ Procedure:
Client asserts:
* call was successful
* exactly four responses
* response payloads are COMPRESSABLE
* response payload bodies are sized (in order): 31415, 9, 2653, 58979
* clients are free to assert that the response payload body contents are zero
and comparing the entire response messages against golden responses
@ -470,12 +483,12 @@ with desired oauth scope.
The test uses `--default_service_account` with GCE service account email and
`--oauth_scope` with the OAuth scope to use. For testing against
grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo" should
grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo"
should
be passed in as `--oauth_scope`.
Server features:
* [UnaryCall][]
* [Compressable Payload][]
* [Echo Authenticated Username][]
* [Echo OAuth Scope][]
@ -485,7 +498,6 @@ Procedure:
```
{
response_type: COMPRESSABLE
response_size: 314159
payload:{
body: 271828 bytes of zeros
@ -497,7 +509,8 @@ Procedure:
Client asserts:
* call was successful
* received SimpleResponse.username equals the value of `--default_service_account` flag
* received SimpleResponse.username equals the value of
`--default_service_account` flag
* received SimpleResponse.oauth_scope is in `--oauth_scope`
* response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are zero
@ -518,7 +531,6 @@ variable GOOGLE_APPLICATION_CREDENTIALS.
Server features:
* [UnaryCall][]
* [Compressable Payload][]
* [Echo Authenticated Username][]
* [Echo OAuth Scope][]
@ -528,7 +540,6 @@ Procedure:
```
{
response_type: COMPRESSABLE
response_size: 314159
payload:{
body: 271828 bytes of zeros
@ -541,7 +552,8 @@ Client asserts:
* call was successful
* received SimpleResponse.username is not empty and is in the json key file used
by the auth library. The client can optionally check the username matches the
email address in the key file or equals the value of `--default_service_account` flag.
email address in the key file or equals the value of `--default_service_account`
flag.
* response payload body is 314159 bytes in size
* clients are free to assert that the response payload body contents are zero
and comparing the entire response message against a golden response
@ -567,18 +579,18 @@ variable GOOGLE_APPLICATION_CREDENTIALS, *OR* if GCE credentials is used to
fetch the token, `--default_service_account` can be used to pass in GCE service
account email.
- uses the flag `--oauth_scope` for the oauth scope. For testing against
grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo" should
be passed as the `--oauth_scope`.
grpc-test.sandbox.googleapis.com, "https://www.googleapis.com/auth/xapi.zoo"
should be passed as the `--oauth_scope`.
Server features:
* [UnaryCall][]
* [Compressable Payload][]
* [Echo Authenticated Username][]
* [Echo OAuth Scope][]
Procedure:
1. Client uses the auth library to obtain an authorization token
2. Client configures the channel to use AccessTokenCredentials with the access token obtained in step 1
2. Client configures the channel to use AccessTokenCredentials with the access
token obtained in step 1
3. Client calls UnaryCall with the following message
```
@ -599,22 +611,21 @@ json key file or GCE default service account email.
Similar to the other auth tests, this test is only for cloud-to-prod path.
This test verifies unary calls succeed in sending messages using a JWT or a service account
credentials set on the RPC.
This test verifies unary calls succeed in sending messages using a JWT or a
service account credentials set on the RPC.
The test
- uses the flag `--service_account_key_file` with the path to a json key file
downloaded from https://console.developers.google.com. Alternately, if using a
usable auth implementation, it may specify the file location in the environment
variable GOOGLE_APPLICATION_CREDENTIALS
- optionally uses the flag `--oauth_scope` for the oauth scope if implementator
- optionally uses the flag `--oauth_scope` for the oauth scope if implementator
wishes to use service account credential instead of JWT credential. For testing
against grpc-test.sandbox.googleapis.com, oauth scope
against grpc-test.sandbox.googleapis.com, oauth scope
"https://www.googleapis.com/auth/xapi.zoo" should be used.
Server features:
* [UnaryCall][]
* [Compressable Payload][]
* [Echo Authenticated Username][]
* [Echo OAuth Scope][]
@ -645,7 +656,6 @@ by the server.
Server features:
* [UnaryCall][]
* [FullDuplexCall][]
* [Compressable Payload][]
* [Echo Metadata][]
Procedure:
@ -660,7 +670,6 @@ Procedure:
```
{
response_type: COMPRESSABLE
response_size: 314159
payload:{
body: 271828 bytes of zeros
@ -679,7 +688,6 @@ Procedure:
```
{
response_type: COMPRESSABLE
response_size: 314159
payload:{
body: 271828 bytes of zeros
@ -785,14 +793,12 @@ from the server.
Server features:
* [FullDuplexCall][]
* [Compressable Payload][]
Procedure:
1. Client starts FullDuplexCall with
```
{
response_type: COMPRESSABLE
response_parameters:{
size: 31415
}
@ -932,9 +938,24 @@ Server implements EmptyCall which immediately returns the empty message.
[UnaryCall]: #unarycall
Server implements UnaryCall which immediately returns a SimpleResponse with a
payload body of size SimpleRequest.response_size bytes and type as appropriate
for the SimpleRequest.response_type. If the server does not support the
response_type, then it should fail the RPC with INVALID_ARGUMENT.
payload body of size `SimpleRequest.response_size` bytes and type as appropriate
for the `SimpleRequest.response_type`. If the server does not support the
`response_type`, then it should fail the RPC with `INVALID_ARGUMENT`.
### CompressedResponse
[CompressedResponse]: #compressedresponse
When the client sets `response_compressed` to true, the server's response is
sent back compressed. Note that `response_compressed` is present on both
`SimpleRequest` (unary) and `StreamingOutputCallRequest` (streaming).
### CompressedRequest
[CompressedRequest]: #compressedrequest
When the client sets `expect_compressed` to true, the server expects the client
request to be compressed. If it's not, it fails the RPC with `INVALID_ARGUMENT`.
Note that `response_compressed` is present on both `SimpleRequest` (unary) and
`StreamingOutputCallRequest` (streaming).
### StreamingInputCall
[StreamingInputCall]: #streaminginputcall
@ -962,28 +983,6 @@ payload body of size ResponseParameters.size bytes, as specified by its
respective ResponseParameters. After receiving half close and sending all
responses, it closes with OK.
### Compressable Payload
[Compressable Payload]: #compressable-payload
When the client requests COMPRESSABLE payload, the response includes a payload
of the size requested containing all zeros and the payload type is
COMPRESSABLE.
### Uncompressable Payload
[Uncompressable Payload]: #uncompressable-payload
When the client requests UNCOMPRESSABLE payload, the response includes a payload
of the size requested containing uncompressable data and the payload type is
UNCOMPRESSABLE. A 512 kB dump from /dev/urandom is the current golden data,
stored at `test/cpp/interop/rnd.dat`
### Random Payload
[Random Payload]: #random-payload
When the client requests RANDOM payload, the response includes either a randomly
chosen COMPRESSABLE or UNCOMPRESSABLE payload. The data and the payload type
will be consistent with this choice.
### Echo Status
[Echo Status]: #echo-status
When the client sends a response_status in the request payload, the server closes
@ -1004,8 +1003,8 @@ key and the corresponding value back to the client as trailing metadata.
[Observe ResponseParameters.interval_us]: #observe-responseparametersinterval_us
In StreamingOutputCall and FullDuplexCall, server delays sending a
StreamingOutputCallResponse by the ResponseParameters's interval_us for that
particular response, relative to the last response sent. That is, interval_us
StreamingOutputCallResponse by the ResponseParameters's `interval_us` for that
particular response, relative to the last response sent. That is, `interval_us`
acts like a sleep *before* sending the response and accumulates from one
response to the next.
@ -1027,13 +1026,13 @@ an email address.
#### Echo OAuth scope
[Echo OAuth Scope]: #echo-oauth-scope
If a SimpleRequest has fill_oauth_scope=true and that request was successfully
If a SimpleRequest has `fill_oauth_scope=true` and that request was successfully
authenticated via OAuth, then the SimpleResponse should have oauth_scope filled
with the scope of the method being invoked.
Although a general server-side feature, most test servers won't implement this
feature. The TLS server grpc-test.sandbox.googleapis.com:443 supports this feature.
It requires at least the OAuth scope
feature. The TLS server `grpc-test.sandbox.googleapis.com:443` supports this
feature. It requires at least the OAuth scope
`https://www.googleapis.com/auth/xapi.zoo` for authentication to succeed.
Discussion:

@ -21,6 +21,8 @@ Only a subset of the pre-defined status codes are generated by the gRPC librarie
| Flow-control protocol violation | INTERNAL | Both |
| Error parsing returned status | UNKNOWN | Client |
| Incorrect Auth metadata ( Credentials failed to get metadata, Incompatible credentials set on channel and call, Invalid host set in `:authority` metadata, etc.) | UNAUTHENTICATED | Both |
| Request cardinality violation (method requires exactly one request but client sent some other number of requests) | UNIMPLEMENTED | Server|
| Response cardinality violation (method requires exactly one response but server sent some other number of responses) | UNIMPLEMENTED | Client|
| Error parsing response proto | INTERNAL | Client|
| Error parsing request proto | INTERNAL | Server|

@ -87,7 +87,9 @@ class GreeterClient {
void* got_tag;
bool ok = false;
// Block until the next result is available in the completion queue "cq".
cq.Next(&got_tag, &ok);
// The return value of Next should always be checked. This return value
// tells us whether there is any kind of event or the cq_ is shutting down.
GPR_ASSERT(cq.Next(&got_tag, &ok));
// Verify that the result from "cq" corresponds, by its tag, our previous
// request.

@ -160,7 +160,9 @@ class ServerImpl final {
// Block waiting to read the next event from the completion queue. The
// event is uniquely identified by its tag, which in this case is the
// memory address of a CallData instance.
cq_->Next(&tag, &ok);
// The return value of Next should always be checked. This return value
// tells us whether there is any kind of event or cq_ is shutting down.
GPR_ASSERT(cq_->Next(&tag, &ok));
GPR_ASSERT(ok);
static_cast<CallData*>(tag)->Proceed();
}

@ -1,5 +1,35 @@
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// 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.
//
'use strict';
var grpc = require('grpc');
var helloworld_pb = require('./helloworld_pb.js');
@ -27,7 +57,9 @@ function deserialize_HelloRequest(buffer_arg) {
}
// The greeting service definition.
var GreeterService = exports.GreeterService = {
// Sends a greeting
sayHello: {
path: '/helloworld.Greeter/SayHello',
requestStream: false,

@ -61,7 +61,7 @@ proto.helloworld.HelloRequest.toObject = function(includeInstance, msg) {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
obj.$jspbMessageInstance = msg;
}
return obj;
};
@ -220,7 +220,7 @@ proto.helloworld.HelloReply.toObject = function(includeInstance, msg) {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
obj.$jspbMessageInstance = msg;
}
return obj;
};

@ -1,5 +1,35 @@
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// 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.
//
'use strict';
var grpc = require('grpc');
var route_guide_pb = require('./route_guide_pb.js');
@ -60,7 +90,14 @@ function deserialize_RouteSummary(buffer_arg) {
}
// Interface exported by the server.
var RouteGuideService = exports.RouteGuideService = {
// A simple RPC.
//
// Obtains the feature at a given position.
//
// A feature with an empty name is returned if there's no feature at the given
// position.
getFeature: {
path: '/routeguide.RouteGuide/GetFeature',
requestStream: false,
@ -72,6 +109,12 @@ var RouteGuideService = exports.RouteGuideService = {
responseSerialize: serialize_Feature,
responseDeserialize: deserialize_Feature,
},
// A server-to-client streaming RPC.
//
// Obtains the Features available within the given Rectangle. Results are
// streamed rather than returned at once (e.g. in a response message with a
// repeated field), as the rectangle may cover a large area and contain a
// huge number of features.
listFeatures: {
path: '/routeguide.RouteGuide/ListFeatures',
requestStream: false,
@ -83,6 +126,10 @@ var RouteGuideService = exports.RouteGuideService = {
responseSerialize: serialize_Feature,
responseDeserialize: deserialize_Feature,
},
// A client-to-server streaming RPC.
//
// Accepts a stream of Points on a route being traversed, returning a
// RouteSummary when traversal is completed.
recordRoute: {
path: '/routeguide.RouteGuide/RecordRoute',
requestStream: true,
@ -94,6 +141,10 @@ var RouteGuideService = exports.RouteGuideService = {
responseSerialize: serialize_RouteSummary,
responseDeserialize: deserialize_RouteSummary,
},
// A Bidirectional streaming RPC.
//
// Accepts a stream of RouteNotes sent while a route is being traversed,
// while receiving other RouteNotes (e.g. from other users).
routeChat: {
path: '/routeguide.RouteGuide/RouteChat',
requestStream: true,

@ -65,7 +65,7 @@ proto.routeguide.Point.toObject = function(includeInstance, msg) {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
obj.$jspbMessageInstance = msg;
}
return obj;
};
@ -251,7 +251,7 @@ proto.routeguide.Rectangle.toObject = function(includeInstance, msg) {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
obj.$jspbMessageInstance = msg;
}
return obj;
};
@ -453,7 +453,7 @@ proto.routeguide.Feature.toObject = function(includeInstance, msg) {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
obj.$jspbMessageInstance = msg;
}
return obj;
};
@ -647,7 +647,7 @@ proto.routeguide.RouteNote.toObject = function(includeInstance, msg) {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
obj.$jspbMessageInstance = msg;
}
return obj;
};
@ -843,7 +843,7 @@ proto.routeguide.RouteSummary.toObject = function(includeInstance, msg) {
};
if (includeInstance) {
obj.$jspbMessageInstance = msg
obj.$jspbMessageInstance = msg;
}
return obj;
};

@ -116,11 +116,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 63E1E9A21B28CB2100EF0978 /* Build configuration list for PBXNativeTarget "AuthSample" */;
buildPhases = (
DAABBA7B5788A39108D7CA83 /* Check Pods Manifest.lock */,
DAABBA7B5788A39108D7CA83 /* [CP] Check Pods Manifest.lock */,
63E1E9781B28CB2000EF0978 /* Sources */,
63E1E9791B28CB2000EF0978 /* Frameworks */,
63E1E97A1B28CB2000EF0978 /* Resources */,
AEFCCC69DD59CE8F6EB769D7 /* Copy Pods Resources */,
AEFCCC69DD59CE8F6EB769D7 /* [CP] Copy Pods Resources */,
D24F6598302C412D4B863D6F /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -177,14 +178,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
AEFCCC69DD59CE8F6EB769D7 /* Copy Pods Resources */ = {
AEFCCC69DD59CE8F6EB769D7 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@ -192,14 +193,29 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AuthSample/Pods-AuthSample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
DAABBA7B5788A39108D7CA83 /* Check Pods Manifest.lock */ = {
D24F6598302C412D4B863D6F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AuthSample/Pods-AuthSample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
DAABBA7B5788A39108D7CA83 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;

@ -2,6 +2,10 @@ Pod::Spec.new do |s|
s.name = "AuthTestService"
s.version = "0.0.1"
s.license = "New BSD"
s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' }
s.homepage = "http://www.grpc.io/"
s.summary = "AuthTestService example"
s.source = { :git => 'https://github.com/grpc/grpc.git' }
s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9"

@ -2,6 +2,10 @@ Pod::Spec.new do |s|
s.name = "HelloWorld"
s.version = "0.0.1"
s.license = "New BSD"
s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' }
s.homepage = "http://www.grpc.io/"
s.summary = "HelloWorld example"
s.source = { :git => 'https://github.com/grpc/grpc.git' }
s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9"

@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
3EF35C14BDC2B65E21837F02 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 43AB08B32839A6700EA00DD4 /* libPods.a */; };
5E3690661B2A23800040F884 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3690651B2A23800040F884 /* main.m */; };
5E3690691B2A23800040F884 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E3690681B2A23800040F884 /* AppDelegate.m */; };
5E36906C1B2A23800040F884 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E36906B1B2A23800040F884 /* ViewController.m */; };
@ -18,7 +17,6 @@
/* Begin PBXFileReference section */
0C432EF610DB15C0F47A66BB /* Pods-HelloWorld.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.release.xcconfig"; path = "Pods/Target Support Files/Pods-HelloWorld/Pods-HelloWorld.release.xcconfig"; sourceTree = "<group>"; };
43AB08B32839A6700EA00DD4 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
5E3690601B2A23800040F884 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; };
5E3690641B2A23800040F884 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5E3690651B2A23800040F884 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
@ -37,7 +35,6 @@
buildActionMask = 2147483647;
files = (
EF61CF6AE2536A31D47F0E63 /* libPods-HelloWorld.a in Frameworks */,
3EF35C14BDC2B65E21837F02 /* libPods.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -88,7 +85,6 @@
isa = PBXGroup;
children = (
6B4E1F55F8A2EC95A0E7EE88 /* libPods-HelloWorld.a */,
43AB08B32839A6700EA00DD4 /* libPods.a */,
);
name = Frameworks;
sourceTree = "<group>";
@ -109,12 +105,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 5E3690831B2A23810040F884 /* Build configuration list for PBXNativeTarget "HelloWorld" */;
buildPhases = (
ACF9162361FB8F24C70657DE /* Check Pods Manifest.lock */,
ACF9162361FB8F24C70657DE /* [CP] Check Pods Manifest.lock */,
5E36905C1B2A23800040F884 /* Sources */,
5E36905D1B2A23800040F884 /* Frameworks */,
5E36905E1B2A23800040F884 /* Resources */,
4C7D815378D98AB3BFC1A7D5 /* Copy Pods Resources */,
BB76529986A8BFAF19A385B1 /* Embed Pods Frameworks */,
4C7D815378D98AB3BFC1A7D5 /* [CP] Copy Pods Resources */,
BB76529986A8BFAF19A385B1 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -170,14 +166,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
4C7D815378D98AB3BFC1A7D5 /* Copy Pods Resources */ = {
4C7D815378D98AB3BFC1A7D5 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@ -185,14 +181,14 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-resources.sh\"\n";
showEnvVarsInLog = 0;
};
ACF9162361FB8F24C70657DE /* Check Pods Manifest.lock */ = {
ACF9162361FB8F24C70657DE /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@ -200,19 +196,19 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
BB76529986A8BFAF19A385B1 /* Embed Pods Frameworks */ = {
BB76529986A8BFAF19A385B1 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-frameworks.sh\"\n";
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

@ -2,6 +2,10 @@ Pod::Spec.new do |s|
s.name = "RouteGuide"
s.version = "0.0.1"
s.license = "New BSD"
s.authors = { 'gRPC contributors' => 'grpc-io@googlegroups.com' }
s.homepage = "http://www.grpc.io/"
s.summary = "RouteGuide example"
s.source = { :git => 'https://github.com/grpc/grpc.git' }
s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9"

@ -116,12 +116,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 632527A31B1D0396003073D9 /* Build configuration list for PBXNativeTarget "RouteGuideClient" */;
buildPhases = (
C6FC30AD2376EC04317237C5 /* Check Pods Manifest.lock */,
C6FC30AD2376EC04317237C5 /* [CP] Check Pods Manifest.lock */,
632527791B1D0395003073D9 /* Sources */,
6325277A1B1D0395003073D9 /* Frameworks */,
6325277B1B1D0395003073D9 /* Resources */,
FFE0BCF30339E7A50A989EAB /* Copy Pods Resources */,
B5388EC5A25E89021740B916 /* Embed Pods Frameworks */,
FFE0BCF30339E7A50A989EAB /* [CP] Copy Pods Resources */,
B5388EC5A25E89021740B916 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@ -178,14 +178,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
B5388EC5A25E89021740B916 /* Embed Pods Frameworks */ = {
B5388EC5A25E89021740B916 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@ -193,14 +193,14 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RouteGuideClient/Pods-RouteGuideClient-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C6FC30AD2376EC04317237C5 /* Check Pods Manifest.lock */ = {
C6FC30AD2376EC04317237C5 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
@ -208,14 +208,14 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
FFE0BCF30339E7A50A989EAB /* Copy Pods Resources */ = {
FFE0BCF30339E7A50A989EAB /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;

@ -32,19 +32,21 @@
*
*/
require dirname(__FILE__) . '/vendor/autoload.php';
require dirname(__FILE__) . '/helloworld.php';
require dirname(__FILE__).'/vendor/autoload.php';
require dirname(__FILE__).'/helloworld.php';
function greet($name) {
$client = new helloworld\GreeterClient('localhost:50051', [
'credentials' => Grpc\ChannelCredentials::createInsecure()
]);
$request = new helloworld\HelloRequest();
$request->setName($name);
list($reply, $status) = $client->SayHello($request)->wait();
$message = $reply->getMessage();
return $message;
function greet($name)
{
$client = new helloworld\GreeterClient('localhost:50051', [
'credentials' => Grpc\ChannelCredentials::createInsecure(),
]);
$request = new helloworld\HelloRequest();
$request->setName($name);
list($reply, $status) = $client->SayHello($request)->wait();
$message = $reply->getMessage();
return $message;
}
$name = !empty($argv[1]) ? $argv[1] : 'world';
print(greet($name)."\n");
echo greet($name)."\n";

@ -5,154 +5,164 @@
namespace helloworld {
class HelloRequest extends \DrSlump\Protobuf\Message {
/** @var string */
class HelloRequest extends \DrSlump\Protobuf\Message
{
/** @var string */
public $name = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'helloworld.HelloRequest');
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'helloworld.HelloRequest');
// OPTIONAL STRING name = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "name";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
$f->number = 1;
$f->name = 'name';
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
return $descriptor;
}
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if <name> has a value
* Check if <name> has a value.
*
* @return boolean
* @return bool
*/
public function hasName(){
return $this->_has(1);
public function hasName()
{
return $this->_has(1);
}
/**
* Clear <name> value
* Clear <name> value.
*
* @return \helloworld\HelloRequest
*/
public function clearName(){
return $this->_clear(1);
public function clearName()
{
return $this->_clear(1);
}
/**
* Get <name> value
* Get <name> value.
*
* @return string
*/
public function getName(){
return $this->_get(1);
public function getName()
{
return $this->_get(1);
}
/**
* Set <name> value
* Set <name> value.
*
* @param string $value
*
* @return \helloworld\HelloRequest
*/
public function setName( $value){
return $this->_set(1, $value);
public function setName($value)
{
return $this->_set(1, $value);
}
}
}
namespace helloworld {
class HelloReply extends \DrSlump\Protobuf\Message {
/** @var string */
class HelloReply extends \DrSlump\Protobuf\Message
{
/** @var string */
public $message = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'helloworld.HelloReply');
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'helloworld.HelloReply');
// OPTIONAL STRING message = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "message";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
$f->number = 1;
$f->name = 'message';
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
return $descriptor;
}
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if <message> has a value
* Check if <message> has a value.
*
* @return boolean
* @return bool
*/
public function hasMessage(){
return $this->_has(1);
public function hasMessage()
{
return $this->_has(1);
}
/**
* Clear <message> value
* Clear <message> value.
*
* @return \helloworld\HelloReply
*/
public function clearMessage(){
return $this->_clear(1);
public function clearMessage()
{
return $this->_clear(1);
}
/**
* Get <message> value
* Get <message> value.
*
* @return string
*/
public function getMessage(){
return $this->_get(1);
public function getMessage()
{
return $this->_get(1);
}
/**
* Set <message> value
* Set <message> value.
*
* @param string $value
*
* @return \helloworld\HelloReply
*/
public function setMessage( $value){
return $this->_set(1, $value);
public function setMessage($value)
{
return $this->_set(1, $value);
}
}
}
namespace helloworld {
class GreeterClient extends \Grpc\BaseStub {
public function __construct($hostname, $opts) {
parent::__construct($hostname, $opts);
}
class GreeterClient extends \Grpc\BaseStub
{
public function __construct($hostname, $opts)
{
parent::__construct($hostname, $opts);
}
/**
* @param helloworld\HelloRequest $input
*/
public function SayHello(\helloworld\HelloRequest $argument, $metadata = array(), $options = array()) {
return $this->_simpleRequest('/helloworld.Greeter/SayHello', $argument, '\helloworld\HelloReply::deserialize', $metadata, $options);
public function SayHello(\helloworld\HelloRequest $argument, $metadata = array(), $options = array())
{
return $this->_simpleRequest('/helloworld.Greeter/SayHello', $argument, '\helloworld\HelloReply::deserialize', $metadata, $options);
}
}
}

File diff suppressed because it is too large Load Diff

@ -32,48 +32,50 @@
*
*/
require dirname(__FILE__) . '/../vendor/autoload.php';
require dirname(__FILE__) . '/route_guide.php';
require dirname(__FILE__).'/../vendor/autoload.php';
require dirname(__FILE__).'/route_guide.php';
define('COORD_FACTOR', 1e7);
$client = new routeguide\RouteGuideClient('localhost:50051', [
'credentials' => Grpc\ChannelCredentials::createInsecure()
'credentials' => Grpc\ChannelCredentials::createInsecure(),
]);
function printFeature($feature) {
$name = $feature->getName();
if (!$name) {
$name_str = "no feature";
} else {
$name_str = "feature called $name";
}
print sprintf("Found %s \n at %f, %f\n", $name_str,
$feature->getLocation()->getLatitude() / COORD_FACTOR,
$feature->getLocation()->getLongitude() / COORD_FACTOR);
function printFeature($feature)
{
$name = $feature->getName();
if (!$name) {
$name_str = 'no feature';
} else {
$name_str = "feature called $name";
}
echo sprintf("Found %s \n at %f, %f\n", $name_str,
$feature->getLocation()->getLatitude() / COORD_FACTOR,
$feature->getLocation()->getLongitude() / COORD_FACTOR);
}
/**
* Run the getFeature demo. Calls getFeature with a point known to have a
* feature and a point known not to have a feature.
*/
function runGetFeature() {
print "Running GetFeature...\n";
global $client;
$point = new routeguide\Point();
$points = array(
array(409146138, -746188906),
array(0, 0),
);
foreach ($points as $p) {
$point->setLatitude($p[0]);
$point->setLongitude($p[1]);
// make a unary grpc call
list($feature, $status) = $client->GetFeature($point)->wait();
printFeature($feature);
}
function runGetFeature()
{
echo "Running GetFeature...\n";
global $client;
$point = new routeguide\Point();
$points = array(
array(409146138, -746188906),
array(0, 0),
);
foreach ($points as $p) {
$point->setLatitude($p[0]);
$point->setLongitude($p[1]);
// make a unary grpc call
list($feature, $status) = $client->GetFeature($point)->wait();
printFeature($feature);
}
}
/**
@ -81,29 +83,30 @@ function runGetFeature() {
* containing all of the features in the pre-generated
* database. Prints each response as it comes in.
*/
function runListFeatures() {
print "Running ListFeatures...\n";
global $client;
$lo_point = new routeguide\Point();
$hi_point = new routeguide\Point();
$lo_point->setLatitude(400000000);
$lo_point->setLongitude(-750000000);
$hi_point->setLatitude(420000000);
$hi_point->setLongitude(-730000000);
$rectangle = new routeguide\Rectangle();
$rectangle->setLo($lo_point);
$rectangle->setHi($hi_point);
// start the server streaming call
$call = $client->ListFeatures($rectangle);
// an iterator over the server streaming responses
$features = $call->responses();
foreach ($features as $feature) {
printFeature($feature);
}
function runListFeatures()
{
echo "Running ListFeatures...\n";
global $client;
$lo_point = new routeguide\Point();
$hi_point = new routeguide\Point();
$lo_point->setLatitude(400000000);
$lo_point->setLongitude(-750000000);
$hi_point->setLatitude(420000000);
$hi_point->setLongitude(-730000000);
$rectangle = new routeguide\Rectangle();
$rectangle->setLo($lo_point);
$rectangle->setHi($hi_point);
// start the server streaming call
$call = $client->ListFeatures($rectangle);
// an iterator over the server streaming responses
$features = $call->responses();
foreach ($features as $feature) {
printFeature($feature);
}
}
/**
@ -111,96 +114,99 @@ function runListFeatures() {
* pre-generated feature database with a variable delay in between. Prints
* the statistics when they are sent from the server.
*/
function runRecordRoute() {
print "Running RecordRoute...\n";
global $client, $argv;
// start the client streaming call
$call = $client->RecordRoute();
$db = json_decode(file_get_contents($argv[1]), true);
$num_points_in_db = count($db);
$num_points = 10;
for ($i = 0; $i < $num_points; $i++) {
$point = new routeguide\Point();
$index = rand(0, $num_points_in_db - 1);
$lat = $db[$index]['location']['latitude'];
$long = $db[$index]['location']['longitude'];
$feature_name = $db[$index]['name'];
$point->setLatitude($lat);
$point->setLongitude($long);
print sprintf("Visiting point %f, %f,\n with feature name: %s\n",
$lat / COORD_FACTOR, $long / COORD_FACTOR,
$feature_name ? $feature_name : '<empty>');
usleep(rand(300000, 800000));
$call->write($point);
}
list($route_summary, $status) = $call->wait();
print sprintf("Finished trip with %d points\nPassed %d features\n".
"Travelled %d meters\nIt took %d seconds\n",
$route_summary->getPointCount(),
$route_summary->getFeatureCount(),
$route_summary->getDistance(),
$route_summary->getElapsedTime());
function runRecordRoute()
{
echo "Running RecordRoute...\n";
global $client, $argv;
// start the client streaming call
$call = $client->RecordRoute();
$db = json_decode(file_get_contents($argv[1]), true);
$num_points_in_db = count($db);
$num_points = 10;
for ($i = 0; $i < $num_points; ++$i) {
$point = new routeguide\Point();
$index = rand(0, $num_points_in_db - 1);
$lat = $db[$index]['location']['latitude'];
$long = $db[$index]['location']['longitude'];
$feature_name = $db[$index]['name'];
$point->setLatitude($lat);
$point->setLongitude($long);
echo sprintf("Visiting point %f, %f,\n with feature name: %s\n",
$lat / COORD_FACTOR, $long / COORD_FACTOR,
$feature_name ? $feature_name : '<empty>');
usleep(rand(300000, 800000));
$call->write($point);
}
list($route_summary, $status) = $call->wait();
echo sprintf("Finished trip with %d points\nPassed %d features\n".
"Travelled %d meters\nIt took %d seconds\n",
$route_summary->getPointCount(),
$route_summary->getFeatureCount(),
$route_summary->getDistance(),
$route_summary->getElapsedTime());
}
/**
* Run the routeChat demo. Send some chat messages, and print any chat
* messages that are sent from the server.
*/
function runRouteChat() {
print "Running RouteChat...\n";
global $client;
// start the bidirectional streaming call
$call = $client->RouteChat();
$notes = array(
array(1, 1, 'first message'),
array(1, 2, 'second message'),
array(2, 1, 'third message'),
array(1, 1, 'fourth message'),
array(1, 1, 'fifth message'),
);
foreach ($notes as $n) {
$point = new routeguide\Point();
$point->setLatitude($lat = $n[0]);
$point->setLongitude($long = $n[1]);
$route_note = new routeguide\RouteNote();
$route_note->setLocation($point);
$route_note->setMessage($message = $n[2]);
print sprintf("Sending message: '%s' at (%d, %d)\n",
$message, $lat, $long);
// send a bunch of messages to the server
$call->write($route_note);
}
$call->writesDone();
// read from the server until there's no more
while ($route_note_reply = $call->read()) {
print sprintf("Previous left message at (%d, %d): '%s'\n",
$route_note_reply->getLocation()->getLatitude(),
$route_note_reply->getLocation()->getLongitude(),
$route_note_reply->getMessage());
}
function runRouteChat()
{
echo "Running RouteChat...\n";
global $client;
// start the bidirectional streaming call
$call = $client->RouteChat();
$notes = array(
array(1, 1, 'first message'),
array(1, 2, 'second message'),
array(2, 1, 'third message'),
array(1, 1, 'fourth message'),
array(1, 1, 'fifth message'),
);
foreach ($notes as $n) {
$point = new routeguide\Point();
$point->setLatitude($lat = $n[0]);
$point->setLongitude($long = $n[1]);
$route_note = new routeguide\RouteNote();
$route_note->setLocation($point);
$route_note->setMessage($message = $n[2]);
echo sprintf("Sending message: '%s' at (%d, %d)\n",
$message, $lat, $long);
// send a bunch of messages to the server
$call->write($route_note);
}
$call->writesDone();
// read from the server until there's no more
while ($route_note_reply = $call->read()) {
echo sprintf("Previous left message at (%d, %d): '%s'\n",
$route_note_reply->getLocation()->getLatitude(),
$route_note_reply->getLocation()->getLongitude(),
$route_note_reply->getMessage());
}
}
/**
* Run all of the demos in order
* Run all of the demos in order.
*/
function main() {
runGetFeature();
runListFeatures();
runRecordRoute();
runRouteChat();
function main()
{
runGetFeature();
runListFeatures();
runRecordRoute();
runRouteChat();
}
if (empty($argv[1])) {
print "Usage: php -d extension=grpc.so route_guide_client.php " .
echo 'Usage: php -d extension=grpc.so route_guide_client.php '.
"<path to route_guide_db.json>\n";
exit(1);
exit(1);
}
main();

@ -51,7 +51,7 @@ def get_distance(start, end):
coord_factor = 10000000.0
lat_1 = start.latitude / coord_factor
lat_2 = end.latitude / coord_factor
lon_1 = start.latitude / coord_factor
lon_1 = start.longitude / coord_factor
lon_2 = end.longitude / coord_factor
lat_rad_1 = math.radians(lat_1)
lat_rad_2 = math.radians(lat_2)

@ -1,13 +1,42 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: helloworld.proto for package 'helloworld'
# Original file comments:
# 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.
#
require 'grpc'
require 'helloworld'
module Helloworld
module Greeter
# TODO: add proto service documentation here
# The greeting service definition.
class Service
include GRPC::GenericService
@ -16,6 +45,7 @@ module Helloworld
self.unmarshal_class_method = :decode
self.service_name = 'helloworld.Greeter'
# Sends a greeting
rpc :SayHello, HelloRequest, HelloReply
end

@ -1,13 +1,42 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: route_guide.proto for package 'routeguide'
# Original file comments:
# 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.
#
require 'grpc'
require 'route_guide'
module Routeguide
module RouteGuide
# TODO: add proto service documentation here
# Interface exported by the server.
class Service
include GRPC::GenericService
@ -16,9 +45,29 @@ module Routeguide
self.unmarshal_class_method = :decode
self.service_name = 'routeguide.RouteGuide'
# A simple RPC.
#
# Obtains the feature at a given position.
#
# A feature with an empty name is returned if there's no feature at the given
# position.
rpc :GetFeature, Point, Feature
# A server-to-client streaming RPC.
#
# Obtains the Features available within the given Rectangle. Results are
# streamed rather than returned at once (e.g. in a response message with a
# repeated field), as the rectangle may cover a large area and contain a
# huge number of features.
rpc :ListFeatures, Rectangle, stream(Feature)
# A client-to-server streaming RPC.
#
# Accepts a stream of Points on a route being traversed, returning a
# RouteSummary when traversal is completed.
rpc :RecordRoute, stream(Point), RouteSummary
# A Bidirectional streaming RPC.
#
# Accepts a stream of RouteNotes sent while a route is being traversed,
# while receiving other RouteNotes (e.g. from other users).
rpc :RouteChat, stream(RouteNote), stream(RouteNote)
end

@ -68,11 +68,10 @@ Pod::Spec.new do |s|
'src/core/lib/support/backoff.h',
'src/core/lib/support/block_annotate.h',
'src/core/lib/support/env.h',
'src/core/lib/support/load_file.h',
'src/core/lib/support/murmur_hash.h',
'src/core/lib/support/stack_lockfree.h',
'src/core/lib/support/string.h',
'src/core/lib/support/string_win32.h',
'src/core/lib/support/string_windows.h',
'src/core/lib/support/thd_internal.h',
'src/core/lib/support/time_precise.h',
'src/core/lib/support/tmpfile.h',
@ -80,14 +79,14 @@ Pod::Spec.new do |s|
'include/grpc/support/atm.h',
'include/grpc/support/atm_gcc_atomic.h',
'include/grpc/support/atm_gcc_sync.h',
'include/grpc/support/atm_win32.h',
'include/grpc/support/atm_windows.h',
'include/grpc/support/avl.h',
'include/grpc/support/cmdline.h',
'include/grpc/support/cpu.h',
'include/grpc/support/histogram.h',
'include/grpc/support/host_port.h',
'include/grpc/support/log.h',
'include/grpc/support/log_win32.h',
'include/grpc/support/log_windows.h',
'include/grpc/support/port_platform.h',
'include/grpc/support/slice.h',
'include/grpc/support/slice_buffer.h',
@ -96,7 +95,7 @@ Pod::Spec.new do |s|
'include/grpc/support/sync.h',
'include/grpc/support/sync_generic.h',
'include/grpc/support/sync_posix.h',
'include/grpc/support/sync_win32.h',
'include/grpc/support/sync_windows.h',
'include/grpc/support/thd.h',
'include/grpc/support/time.h',
'include/grpc/support/tls.h',
@ -108,7 +107,7 @@ Pod::Spec.new do |s|
'include/grpc/impl/codegen/atm.h',
'include/grpc/impl/codegen/atm_gcc_atomic.h',
'include/grpc/impl/codegen/atm_gcc_sync.h',
'include/grpc/impl/codegen/atm_win32.h',
'include/grpc/impl/codegen/atm_windows.h',
'include/grpc/impl/codegen/log.h',
'include/grpc/impl/codegen/port_platform.h',
'include/grpc/impl/codegen/slice.h',
@ -116,7 +115,7 @@ Pod::Spec.new do |s|
'include/grpc/impl/codegen/sync.h',
'include/grpc/impl/codegen/sync_generic.h',
'include/grpc/impl/codegen/sync_posix.h',
'include/grpc/impl/codegen/sync_win32.h',
'include/grpc/impl/codegen/sync_windows.h',
'include/grpc/impl/codegen/time.h',
'src/core/lib/profiling/basic_timers.c',
'src/core/lib/profiling/stap_timers.c',
@ -130,39 +129,38 @@ Pod::Spec.new do |s|
'src/core/lib/support/cpu_windows.c',
'src/core/lib/support/env_linux.c',
'src/core/lib/support/env_posix.c',
'src/core/lib/support/env_win32.c',
'src/core/lib/support/env_windows.c',
'src/core/lib/support/histogram.c',
'src/core/lib/support/host_port.c',
'src/core/lib/support/load_file.c',
'src/core/lib/support/log.c',
'src/core/lib/support/log_android.c',
'src/core/lib/support/log_linux.c',
'src/core/lib/support/log_posix.c',
'src/core/lib/support/log_win32.c',
'src/core/lib/support/log_windows.c',
'src/core/lib/support/murmur_hash.c',
'src/core/lib/support/slice.c',
'src/core/lib/support/slice_buffer.c',
'src/core/lib/support/stack_lockfree.c',
'src/core/lib/support/string.c',
'src/core/lib/support/string_posix.c',
'src/core/lib/support/string_util_win32.c',
'src/core/lib/support/string_win32.c',
'src/core/lib/support/string_util_windows.c',
'src/core/lib/support/string_windows.c',
'src/core/lib/support/subprocess_posix.c',
'src/core/lib/support/subprocess_windows.c',
'src/core/lib/support/sync.c',
'src/core/lib/support/sync_posix.c',
'src/core/lib/support/sync_win32.c',
'src/core/lib/support/sync_windows.c',
'src/core/lib/support/thd.c',
'src/core/lib/support/thd_posix.c',
'src/core/lib/support/thd_win32.c',
'src/core/lib/support/thd_windows.c',
'src/core/lib/support/time.c',
'src/core/lib/support/time_posix.c',
'src/core/lib/support/time_precise.c',
'src/core/lib/support/time_win32.c',
'src/core/lib/support/time_windows.c',
'src/core/lib/support/tls_pthread.c',
'src/core/lib/support/tmpfile_msys.c',
'src/core/lib/support/tmpfile_posix.c',
'src/core/lib/support/tmpfile_win32.c',
'src/core/lib/support/tmpfile_windows.c',
'src/core/lib/support/wrap_memcpy.c',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_stack.h',
@ -181,6 +179,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/closure.h',
'src/core/lib/iomgr/endpoint.h',
'src/core/lib/iomgr/endpoint_pair.h',
'src/core/lib/iomgr/error.h',
'src/core/lib/iomgr/ev_poll_and_epoll_posix.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
@ -190,6 +189,8 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/iomgr.h',
'src/core/lib/iomgr/iomgr_internal.h',
'src/core/lib/iomgr/iomgr_posix.h',
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
'src/core/lib/iomgr/pollset_set.h',
'src/core/lib/iomgr/pollset_set_windows.h',
@ -198,7 +199,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/sockaddr.h',
'src/core/lib/iomgr/sockaddr_posix.h',
'src/core/lib/iomgr/sockaddr_utils.h',
'src/core/lib/iomgr/sockaddr_win32.h',
'src/core/lib/iomgr/sockaddr_windows.h',
'src/core/lib/iomgr/socket_utils_posix.h',
'src/core/lib/iomgr/socket_windows.h',
'src/core/lib/iomgr/tcp_client.h',
@ -230,7 +231,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/init.h',
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/surface_trace.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/metadata.h',
@ -238,6 +238,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/static_metadata.h',
'src/core/lib/transport/transport.h',
'src/core/lib/transport/transport_impl.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
'src/core/ext/transport/chttp2/transport/bin_encoder.h',
'src/core/ext/transport/chttp2/transport/chttp2_transport.h',
'src/core/ext/transport/chttp2/transport/frame.h',
@ -275,6 +276,7 @@ Pod::Spec.new do |s|
'src/core/lib/security/transport/handshake.h',
'src/core/lib/security/transport/secure_endpoint.h',
'src/core/lib/security/transport/security_connector.h',
'src/core/lib/security/transport/tsi_error.h',
'src/core/lib/security/util/b64.h',
'src/core/lib/security/util/json_util.h',
'src/core/lib/tsi/fake_transport_security.h',
@ -298,13 +300,14 @@ Pod::Spec.new do |s|
'src/core/ext/client_config/subchannel_call_holder.h',
'src/core/ext/client_config/subchannel_index.h',
'src/core/ext/client_config/uri_parser.h',
'third_party/objective_c/Cronet/cronet_c_for_grpc.h',
'src/core/ext/lb_policy/grpclb/load_balancer_api.h',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h',
'third_party/nanopb/pb.h',
'third_party/nanopb/pb_common.h',
'third_party/nanopb/pb_decode.h',
'third_party/nanopb/pb_encode.h',
'src/core/ext/load_reporting/load_reporting.h',
'src/core/ext/load_reporting/load_reporting_filter.h',
'src/core/ext/census/aggregation.h',
'src/core/ext/census/census_interface.h',
'src/core/ext/census/census_rpc_stats.h',
@ -316,6 +319,7 @@ Pod::Spec.new do |s|
'include/grpc/byte_buffer_reader.h',
'include/grpc/compression.h',
'include/grpc/grpc.h',
'include/grpc/grpc_posix.h',
'include/grpc/status.h',
'include/grpc/impl/codegen/byte_buffer.h',
'include/grpc/impl/codegen/byte_buffer_reader.h',
@ -328,7 +332,7 @@ Pod::Spec.new do |s|
'include/grpc/impl/codegen/atm.h',
'include/grpc/impl/codegen/atm_gcc_atomic.h',
'include/grpc/impl/codegen/atm_gcc_sync.h',
'include/grpc/impl/codegen/atm_win32.h',
'include/grpc/impl/codegen/atm_windows.h',
'include/grpc/impl/codegen/log.h',
'include/grpc/impl/codegen/port_platform.h',
'include/grpc/impl/codegen/slice.h',
@ -336,9 +340,8 @@ Pod::Spec.new do |s|
'include/grpc/impl/codegen/sync.h',
'include/grpc/impl/codegen/sync_generic.h',
'include/grpc/impl/codegen/sync_posix.h',
'include/grpc/impl/codegen/sync_win32.h',
'include/grpc/impl/codegen/sync_windows.h',
'include/grpc/impl/codegen/time.h',
'include/grpc/grpc_cronet.h',
'include/grpc/grpc_security.h',
'include/grpc/grpc_security_constants.h',
'include/grpc/census.h',
@ -350,7 +353,7 @@ Pod::Spec.new do |s|
'src/core/lib/channel/connected_channel.c',
'src/core/lib/channel/http_client_filter.c',
'src/core/lib/channel/http_server_filter.c',
'src/core/lib/compression/compression_algorithm.c',
'src/core/lib/compression/compression.c',
'src/core/lib/compression/message_compress.c',
'src/core/lib/debug/trace.c',
'src/core/lib/http/format_request.c',
@ -360,6 +363,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/endpoint.c',
'src/core/lib/iomgr/endpoint_pair_posix.c',
'src/core/lib/iomgr/endpoint_pair_windows.c',
'src/core/lib/iomgr/error.c',
'src/core/lib/iomgr/ev_poll_and_epoll_posix.c',
'src/core/lib/iomgr/ev_poll_posix.c',
'src/core/lib/iomgr/ev_posix.c',
@ -369,6 +373,8 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/iomgr.c',
'src/core/lib/iomgr/iomgr_posix.c',
'src/core/lib/iomgr/iomgr_windows.c',
'src/core/lib/iomgr/load_file.c',
'src/core/lib/iomgr/polling_entity.c',
'src/core/lib/iomgr/pollset_set_windows.c',
'src/core/lib/iomgr/pollset_windows.c',
'src/core/lib/iomgr/resolve_address_posix.c',
@ -426,6 +432,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/transport.c',
'src/core/lib/transport/transport_op_string.c',
'src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c',
'src/core/ext/transport/chttp2/transport/bin_decoder.c',
'src/core/ext/transport/chttp2/transport/bin_encoder.c',
'src/core/ext/transport/chttp2/transport/chttp2_plugin.c',
'src/core/ext/transport/chttp2/transport/chttp2_transport.c',
@ -455,7 +462,7 @@ Pod::Spec.new do |s|
'src/core/lib/security/credentials/credentials_metadata.c',
'src/core/lib/security/credentials/fake/fake_credentials.c',
'src/core/lib/security/credentials/google_default/credentials_posix.c',
'src/core/lib/security/credentials/google_default/credentials_win32.c',
'src/core/lib/security/credentials/google_default/credentials_windows.c',
'src/core/lib/security/credentials/google_default/google_default_credentials.c',
'src/core/lib/security/credentials/iam/iam_credentials.c',
'src/core/lib/security/credentials/jwt/json_token.c',
@ -469,6 +476,7 @@ Pod::Spec.new do |s|
'src/core/lib/security/transport/secure_endpoint.c',
'src/core/lib/security/transport/security_connector.c',
'src/core/lib/security/transport/server_auth_filter.c',
'src/core/lib/security/transport/tsi_error.c',
'src/core/lib/security/util/b64.c',
'src/core/lib/security/util/json_util.c',
'src/core/lib/surface/init_secure.c',
@ -496,10 +504,9 @@ Pod::Spec.new do |s|
'src/core/ext/client_config/subchannel_index.c',
'src/core/ext/client_config/uri_parser.c',
'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c',
'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c',
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
'src/core/ext/transport/cronet/client/secure/cronet_channel_create.c',
'src/core/ext/transport/cronet/transport/cronet_api_dummy.c',
'src/core/ext/transport/cronet/transport/cronet_transport.c',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c',
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
'third_party/nanopb/pb_common.c',
@ -509,6 +516,8 @@ Pod::Spec.new do |s|
'src/core/ext/lb_policy/round_robin/round_robin.c',
'src/core/ext/resolver/dns/native/dns_resolver.c',
'src/core/ext/resolver/sockaddr/sockaddr_resolver.c',
'src/core/ext/load_reporting/load_reporting.c',
'src/core/ext/load_reporting/load_reporting_filter.c',
'src/core/ext/census/context.c',
'src/core/ext/census/gen/census.pb.c',
'src/core/ext/census/grpc_context.c',
@ -525,11 +534,10 @@ Pod::Spec.new do |s|
'src/core/lib/support/backoff.h',
'src/core/lib/support/block_annotate.h',
'src/core/lib/support/env.h',
'src/core/lib/support/load_file.h',
'src/core/lib/support/murmur_hash.h',
'src/core/lib/support/stack_lockfree.h',
'src/core/lib/support/string.h',
'src/core/lib/support/string_win32.h',
'src/core/lib/support/string_windows.h',
'src/core/lib/support/thd_internal.h',
'src/core/lib/support/time_precise.h',
'src/core/lib/support/tmpfile.h',
@ -550,6 +558,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/closure.h',
'src/core/lib/iomgr/endpoint.h',
'src/core/lib/iomgr/endpoint_pair.h',
'src/core/lib/iomgr/error.h',
'src/core/lib/iomgr/ev_poll_and_epoll_posix.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
@ -559,6 +568,8 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/iomgr.h',
'src/core/lib/iomgr/iomgr_internal.h',
'src/core/lib/iomgr/iomgr_posix.h',
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
'src/core/lib/iomgr/pollset_set.h',
'src/core/lib/iomgr/pollset_set_windows.h',
@ -567,7 +578,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/sockaddr.h',
'src/core/lib/iomgr/sockaddr_posix.h',
'src/core/lib/iomgr/sockaddr_utils.h',
'src/core/lib/iomgr/sockaddr_win32.h',
'src/core/lib/iomgr/sockaddr_windows.h',
'src/core/lib/iomgr/socket_utils_posix.h',
'src/core/lib/iomgr/socket_windows.h',
'src/core/lib/iomgr/tcp_client.h',
@ -599,7 +610,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/init.h',
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/surface_trace.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/metadata.h',
@ -607,6 +617,7 @@ Pod::Spec.new do |s|
'src/core/lib/transport/static_metadata.h',
'src/core/lib/transport/transport.h',
'src/core/lib/transport/transport_impl.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
'src/core/ext/transport/chttp2/transport/bin_encoder.h',
'src/core/ext/transport/chttp2/transport/chttp2_transport.h',
'src/core/ext/transport/chttp2/transport/frame.h',
@ -644,6 +655,7 @@ Pod::Spec.new do |s|
'src/core/lib/security/transport/handshake.h',
'src/core/lib/security/transport/secure_endpoint.h',
'src/core/lib/security/transport/security_connector.h',
'src/core/lib/security/transport/tsi_error.h',
'src/core/lib/security/util/b64.h',
'src/core/lib/security/util/json_util.h',
'src/core/lib/tsi/fake_transport_security.h',
@ -667,13 +679,14 @@ Pod::Spec.new do |s|
'src/core/ext/client_config/subchannel_call_holder.h',
'src/core/ext/client_config/subchannel_index.h',
'src/core/ext/client_config/uri_parser.h',
'third_party/objective_c/Cronet/cronet_c_for_grpc.h',
'src/core/ext/lb_policy/grpclb/load_balancer_api.h',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h',
'third_party/nanopb/pb.h',
'third_party/nanopb/pb_common.h',
'third_party/nanopb/pb_decode.h',
'third_party/nanopb/pb_encode.h',
'src/core/ext/load_reporting/load_reporting.h',
'src/core/ext/load_reporting/load_reporting_filter.h',
'src/core/ext/census/aggregation.h',
'src/core/ext/census/census_interface.h',
'src/core/ext/census/census_rpc_stats.h',

@ -88,7 +88,8 @@ EXPORTS
grpc_header_nonbin_value_is_legal
grpc_is_binary_header
grpc_call_error_to_string
grpc_cronet_secure_channel_create
grpc_insecure_channel_create_from_fd
grpc_server_add_insecure_channel_from_fd
grpc_auth_property_iterator_next
grpc_auth_context_property_iterator
grpc_auth_context_peer_identity
@ -221,6 +222,8 @@ EXPORTS
gpr_avl_add
gpr_avl_remove
gpr_avl_get
gpr_avl_maybe_get
gpr_avl_is_empty
gpr_cmdline_create
gpr_cmdline_add_int
gpr_cmdline_add_flag

@ -47,14 +47,14 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/support/atm.h )
s.files += %w( include/grpc/support/atm_gcc_atomic.h )
s.files += %w( include/grpc/support/atm_gcc_sync.h )
s.files += %w( include/grpc/support/atm_win32.h )
s.files += %w( include/grpc/support/atm_windows.h )
s.files += %w( include/grpc/support/avl.h )
s.files += %w( include/grpc/support/cmdline.h )
s.files += %w( include/grpc/support/cpu.h )
s.files += %w( include/grpc/support/histogram.h )
s.files += %w( include/grpc/support/host_port.h )
s.files += %w( include/grpc/support/log.h )
s.files += %w( include/grpc/support/log_win32.h )
s.files += %w( include/grpc/support/log_windows.h )
s.files += %w( include/grpc/support/port_platform.h )
s.files += %w( include/grpc/support/slice.h )
s.files += %w( include/grpc/support/slice_buffer.h )
@ -63,7 +63,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/support/sync.h )
s.files += %w( include/grpc/support/sync_generic.h )
s.files += %w( include/grpc/support/sync_posix.h )
s.files += %w( include/grpc/support/sync_win32.h )
s.files += %w( include/grpc/support/sync_windows.h )
s.files += %w( include/grpc/support/thd.h )
s.files += %w( include/grpc/support/time.h )
s.files += %w( include/grpc/support/tls.h )
@ -75,7 +75,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/atm.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h )
s.files += %w( include/grpc/impl/codegen/atm_win32.h )
s.files += %w( include/grpc/impl/codegen/atm_windows.h )
s.files += %w( include/grpc/impl/codegen/log.h )
s.files += %w( include/grpc/impl/codegen/port_platform.h )
s.files += %w( include/grpc/impl/codegen/slice.h )
@ -83,17 +83,16 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/sync.h )
s.files += %w( include/grpc/impl/codegen/sync_generic.h )
s.files += %w( include/grpc/impl/codegen/sync_posix.h )
s.files += %w( include/grpc/impl/codegen/sync_win32.h )
s.files += %w( include/grpc/impl/codegen/sync_windows.h )
s.files += %w( include/grpc/impl/codegen/time.h )
s.files += %w( src/core/lib/profiling/timers.h )
s.files += %w( src/core/lib/support/backoff.h )
s.files += %w( src/core/lib/support/block_annotate.h )
s.files += %w( src/core/lib/support/env.h )
s.files += %w( src/core/lib/support/load_file.h )
s.files += %w( src/core/lib/support/murmur_hash.h )
s.files += %w( src/core/lib/support/stack_lockfree.h )
s.files += %w( src/core/lib/support/string.h )
s.files += %w( src/core/lib/support/string_win32.h )
s.files += %w( src/core/lib/support/string_windows.h )
s.files += %w( src/core/lib/support/thd_internal.h )
s.files += %w( src/core/lib/support/time_precise.h )
s.files += %w( src/core/lib/support/tmpfile.h )
@ -109,44 +108,44 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/support/cpu_windows.c )
s.files += %w( src/core/lib/support/env_linux.c )
s.files += %w( src/core/lib/support/env_posix.c )
s.files += %w( src/core/lib/support/env_win32.c )
s.files += %w( src/core/lib/support/env_windows.c )
s.files += %w( src/core/lib/support/histogram.c )
s.files += %w( src/core/lib/support/host_port.c )
s.files += %w( src/core/lib/support/load_file.c )
s.files += %w( src/core/lib/support/log.c )
s.files += %w( src/core/lib/support/log_android.c )
s.files += %w( src/core/lib/support/log_linux.c )
s.files += %w( src/core/lib/support/log_posix.c )
s.files += %w( src/core/lib/support/log_win32.c )
s.files += %w( src/core/lib/support/log_windows.c )
s.files += %w( src/core/lib/support/murmur_hash.c )
s.files += %w( src/core/lib/support/slice.c )
s.files += %w( src/core/lib/support/slice_buffer.c )
s.files += %w( src/core/lib/support/stack_lockfree.c )
s.files += %w( src/core/lib/support/string.c )
s.files += %w( src/core/lib/support/string_posix.c )
s.files += %w( src/core/lib/support/string_util_win32.c )
s.files += %w( src/core/lib/support/string_win32.c )
s.files += %w( src/core/lib/support/string_util_windows.c )
s.files += %w( src/core/lib/support/string_windows.c )
s.files += %w( src/core/lib/support/subprocess_posix.c )
s.files += %w( src/core/lib/support/subprocess_windows.c )
s.files += %w( src/core/lib/support/sync.c )
s.files += %w( src/core/lib/support/sync_posix.c )
s.files += %w( src/core/lib/support/sync_win32.c )
s.files += %w( src/core/lib/support/sync_windows.c )
s.files += %w( src/core/lib/support/thd.c )
s.files += %w( src/core/lib/support/thd_posix.c )
s.files += %w( src/core/lib/support/thd_win32.c )
s.files += %w( src/core/lib/support/thd_windows.c )
s.files += %w( src/core/lib/support/time.c )
s.files += %w( src/core/lib/support/time_posix.c )
s.files += %w( src/core/lib/support/time_precise.c )
s.files += %w( src/core/lib/support/time_win32.c )
s.files += %w( src/core/lib/support/time_windows.c )
s.files += %w( src/core/lib/support/tls_pthread.c )
s.files += %w( src/core/lib/support/tmpfile_msys.c )
s.files += %w( src/core/lib/support/tmpfile_posix.c )
s.files += %w( src/core/lib/support/tmpfile_win32.c )
s.files += %w( src/core/lib/support/tmpfile_windows.c )
s.files += %w( src/core/lib/support/wrap_memcpy.c )
s.files += %w( include/grpc/byte_buffer.h )
s.files += %w( include/grpc/byte_buffer_reader.h )
s.files += %w( include/grpc/compression.h )
s.files += %w( include/grpc/grpc.h )
s.files += %w( include/grpc/grpc_posix.h )
s.files += %w( include/grpc/status.h )
s.files += %w( include/grpc/impl/codegen/byte_buffer.h )
s.files += %w( include/grpc/impl/codegen/byte_buffer_reader.h )
@ -159,7 +158,7 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/atm.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h )
s.files += %w( include/grpc/impl/codegen/atm_win32.h )
s.files += %w( include/grpc/impl/codegen/atm_windows.h )
s.files += %w( include/grpc/impl/codegen/log.h )
s.files += %w( include/grpc/impl/codegen/port_platform.h )
s.files += %w( include/grpc/impl/codegen/slice.h )
@ -167,9 +166,8 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/impl/codegen/sync.h )
s.files += %w( include/grpc/impl/codegen/sync_generic.h )
s.files += %w( include/grpc/impl/codegen/sync_posix.h )
s.files += %w( include/grpc/impl/codegen/sync_win32.h )
s.files += %w( include/grpc/impl/codegen/sync_windows.h )
s.files += %w( include/grpc/impl/codegen/time.h )
s.files += %w( include/grpc/grpc_cronet.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 )
@ -190,6 +188,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/closure.h )
s.files += %w( src/core/lib/iomgr/endpoint.h )
s.files += %w( src/core/lib/iomgr/endpoint_pair.h )
s.files += %w( src/core/lib/iomgr/error.h )
s.files += %w( src/core/lib/iomgr/ev_poll_and_epoll_posix.h )
s.files += %w( src/core/lib/iomgr/ev_poll_posix.h )
s.files += %w( src/core/lib/iomgr/ev_posix.h )
@ -199,6 +198,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/iomgr.h )
s.files += %w( src/core/lib/iomgr/iomgr_internal.h )
s.files += %w( src/core/lib/iomgr/iomgr_posix.h )
s.files += %w( src/core/lib/iomgr/load_file.h )
s.files += %w( src/core/lib/iomgr/polling_entity.h )
s.files += %w( src/core/lib/iomgr/pollset.h )
s.files += %w( src/core/lib/iomgr/pollset_set.h )
s.files += %w( src/core/lib/iomgr/pollset_set_windows.h )
@ -207,7 +208,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/sockaddr.h )
s.files += %w( src/core/lib/iomgr/sockaddr_posix.h )
s.files += %w( src/core/lib/iomgr/sockaddr_utils.h )
s.files += %w( src/core/lib/iomgr/sockaddr_win32.h )
s.files += %w( src/core/lib/iomgr/sockaddr_windows.h )
s.files += %w( src/core/lib/iomgr/socket_utils_posix.h )
s.files += %w( src/core/lib/iomgr/socket_windows.h )
s.files += %w( src/core/lib/iomgr/tcp_client.h )
@ -239,7 +240,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/init.h )
s.files += %w( src/core/lib/surface/lame_client.h )
s.files += %w( src/core/lib/surface/server.h )
s.files += %w( src/core/lib/surface/surface_trace.h )
s.files += %w( src/core/lib/transport/byte_stream.h )
s.files += %w( src/core/lib/transport/connectivity_state.h )
s.files += %w( src/core/lib/transport/metadata.h )
@ -247,6 +247,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/transport/static_metadata.h )
s.files += %w( src/core/lib/transport/transport.h )
s.files += %w( src/core/lib/transport/transport_impl.h )
s.files += %w( src/core/ext/transport/chttp2/transport/bin_decoder.h )
s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h )
s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h )
s.files += %w( src/core/ext/transport/chttp2/transport/frame.h )
@ -284,6 +285,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/security/transport/handshake.h )
s.files += %w( src/core/lib/security/transport/secure_endpoint.h )
s.files += %w( src/core/lib/security/transport/security_connector.h )
s.files += %w( src/core/lib/security/transport/tsi_error.h )
s.files += %w( src/core/lib/security/util/b64.h )
s.files += %w( src/core/lib/security/util/json_util.h )
s.files += %w( src/core/lib/tsi/fake_transport_security.h )
@ -307,13 +309,14 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/client_config/subchannel_call_holder.h )
s.files += %w( src/core/ext/client_config/subchannel_index.h )
s.files += %w( src/core/ext/client_config/uri_parser.h )
s.files += %w( third_party/objective_c/Cronet/cronet_c_for_grpc.h )
s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h )
s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h )
s.files += %w( third_party/nanopb/pb.h )
s.files += %w( third_party/nanopb/pb_common.h )
s.files += %w( third_party/nanopb/pb_decode.h )
s.files += %w( third_party/nanopb/pb_encode.h )
s.files += %w( src/core/ext/load_reporting/load_reporting.h )
s.files += %w( src/core/ext/load_reporting/load_reporting_filter.h )
s.files += %w( src/core/ext/census/aggregation.h )
s.files += %w( src/core/ext/census/census_interface.h )
s.files += %w( src/core/ext/census/census_rpc_stats.h )
@ -329,7 +332,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/channel/connected_channel.c )
s.files += %w( src/core/lib/channel/http_client_filter.c )
s.files += %w( src/core/lib/channel/http_server_filter.c )
s.files += %w( src/core/lib/compression/compression_algorithm.c )
s.files += %w( src/core/lib/compression/compression.c )
s.files += %w( src/core/lib/compression/message_compress.c )
s.files += %w( src/core/lib/debug/trace.c )
s.files += %w( src/core/lib/http/format_request.c )
@ -339,6 +342,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/endpoint.c )
s.files += %w( src/core/lib/iomgr/endpoint_pair_posix.c )
s.files += %w( src/core/lib/iomgr/endpoint_pair_windows.c )
s.files += %w( src/core/lib/iomgr/error.c )
s.files += %w( src/core/lib/iomgr/ev_poll_and_epoll_posix.c )
s.files += %w( src/core/lib/iomgr/ev_poll_posix.c )
s.files += %w( src/core/lib/iomgr/ev_posix.c )
@ -348,6 +352,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/iomgr.c )
s.files += %w( src/core/lib/iomgr/iomgr_posix.c )
s.files += %w( src/core/lib/iomgr/iomgr_windows.c )
s.files += %w( src/core/lib/iomgr/load_file.c )
s.files += %w( src/core/lib/iomgr/polling_entity.c )
s.files += %w( src/core/lib/iomgr/pollset_set_windows.c )
s.files += %w( src/core/lib/iomgr/pollset_windows.c )
s.files += %w( src/core/lib/iomgr/resolve_address_posix.c )
@ -405,6 +411,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/transport/transport.c )
s.files += %w( src/core/lib/transport/transport_op_string.c )
s.files += %w( src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c )
s.files += %w( src/core/ext/transport/chttp2/transport/bin_decoder.c )
s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.c )
s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_plugin.c )
s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.c )
@ -434,7 +441,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/security/credentials/credentials_metadata.c )
s.files += %w( src/core/lib/security/credentials/fake/fake_credentials.c )
s.files += %w( src/core/lib/security/credentials/google_default/credentials_posix.c )
s.files += %w( src/core/lib/security/credentials/google_default/credentials_win32.c )
s.files += %w( src/core/lib/security/credentials/google_default/credentials_windows.c )
s.files += %w( src/core/lib/security/credentials/google_default/google_default_credentials.c )
s.files += %w( src/core/lib/security/credentials/iam/iam_credentials.c )
s.files += %w( src/core/lib/security/credentials/jwt/json_token.c )
@ -448,6 +455,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/security/transport/secure_endpoint.c )
s.files += %w( src/core/lib/security/transport/security_connector.c )
s.files += %w( src/core/lib/security/transport/server_auth_filter.c )
s.files += %w( src/core/lib/security/transport/tsi_error.c )
s.files += %w( src/core/lib/security/util/b64.c )
s.files += %w( src/core/lib/security/util/json_util.c )
s.files += %w( src/core/lib/surface/init_secure.c )
@ -475,10 +483,9 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/client_config/subchannel_index.c )
s.files += %w( src/core/ext/client_config/uri_parser.c )
s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2.c )
s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c )
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.c )
s.files += %w( src/core/ext/transport/cronet/client/secure/cronet_channel_create.c )
s.files += %w( src/core/ext/transport/cronet/transport/cronet_api_dummy.c )
s.files += %w( src/core/ext/transport/cronet/transport/cronet_transport.c )
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c )
s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c )
s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c )
s.files += %w( third_party/nanopb/pb_common.c )
@ -488,6 +495,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.c )
s.files += %w( src/core/ext/resolver/dns/native/dns_resolver.c )
s.files += %w( src/core/ext/resolver/sockaddr/sockaddr_resolver.c )
s.files += %w( src/core/ext/load_reporting/load_reporting.c )
s.files += %w( src/core/ext/load_reporting/load_reporting_filter.c )
s.files += %w( src/core/ext/census/context.c )
s.files += %w( src/core/ext/census/gen/census.pb.c )
s.files += %w( src/core/ext/census/grpc_context.c )

@ -0,0 +1,57 @@
/*
*
* 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 GRPCXX_CREATE_CHANNEL_POSIX_H
#define GRPCXX_CREATE_CHANNEL_POSIX_H
#include <memory>
#include <grpc++/channel.h>
#include <grpc/support/port_platform.h>
namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
/// Create a new \a Channel communicating over given file descriptor
///
/// \param target The name of the target.
/// \param fd The file descriptor representing a socket.
std::shared_ptr<Channel> CreateInsecureChannelFromFd(const grpc::string& target,
int fd);
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
} // namespace grpc
#endif // GRPCXX_CREATE_CHANNEL_POSIX_H

@ -0,0 +1,69 @@
/*
*
* 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.
*
*/
#ifndef GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H
#define GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H
#include <grpc++/impl/server_builder_plugin.h>
#include <grpc++/support/config.h>
namespace grpc {
class ServerInitializer;
class ProtoServerReflection;
} // namespace grpc
namespace grpc {
namespace reflection {
class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin {
public:
ProtoServerReflectionPlugin();
::grpc::string name() GRPC_OVERRIDE;
void InitServer(::grpc::ServerInitializer* si) GRPC_OVERRIDE;
void Finish(::grpc::ServerInitializer* si) GRPC_OVERRIDE;
void ChangeArguments(const ::grpc::string& name, void* value) GRPC_OVERRIDE;
bool has_async_methods() const GRPC_OVERRIDE;
bool has_sync_methods() const GRPC_OVERRIDE;
private:
std::shared_ptr<grpc::ProtoServerReflection> reflection_service_;
};
// Add proto reflection plugin to ServerBuilder. This function should be called
// at the static initialization time.
void InitProtoReflectionServerBuilderPlugin();
} // namespace reflection
} // namespace grpc
#endif // GRPCXX_EXT_PROTO_SERVER_REFLECTION_PLUGIN_H

@ -0,0 +1,184 @@
/*
*
* 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.
*
*/
// Generated by the gRPC protobuf plugin.
// If you make any local change, they will be lost.
// source: reflection.proto
// Original file comments:
// 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.
//
// Service exported by server reflection
//
#ifndef GRPC_reflection_2eproto__INCLUDED
#define GRPC_reflection_2eproto__INCLUDED
#include <grpc++/ext/reflection.pb.h>
#include <grpc++/impl/codegen/async_stream.h>
#include <grpc++/impl/codegen/async_unary_call.h>
#include <grpc++/impl/codegen/proto_utils.h>
#include <grpc++/impl/codegen/rpc_method.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/stub_options.h>
#include <grpc++/impl/codegen/sync_stream.h>
namespace grpc {
class CompletionQueue;
class Channel;
class RpcService;
class ServerCompletionQueue;
class ServerContext;
} // namespace grpc
namespace grpc {
namespace reflection {
namespace v1alpha {
class ServerReflection GRPC_FINAL {
public:
class StubInterface {
public:
virtual ~StubInterface() {}
// The reflection service is structured as a bidirectional stream, ensuring
// all related requests go to a single server.
std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> ServerReflectionInfo(::grpc::ClientContext* context) {
return std::unique_ptr< ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(ServerReflectionInfoRaw(context));
}
std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> AsyncServerReflectionInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(AsyncServerReflectionInfoRaw(context, cq, tag));
}
private:
virtual ::grpc::ClientReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflectionInfoRaw(::grpc::ClientContext* context) = 0;
virtual ::grpc::ClientAsyncReaderWriterInterface< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* AsyncServerReflectionInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0;
};
class Stub GRPC_FINAL : public StubInterface {
public:
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> ServerReflectionInfo(::grpc::ClientContext* context) {
return std::unique_ptr< ::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(ServerReflectionInfoRaw(context));
}
std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>> AsyncServerReflectionInfo(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>>(AsyncServerReflectionInfoRaw(context, cq, tag));
}
private:
std::shared_ptr< ::grpc::ChannelInterface> channel_;
::grpc::ClientReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* ServerReflectionInfoRaw(::grpc::ClientContext* context) GRPC_OVERRIDE;
::grpc::ClientAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionRequest, ::grpc::reflection::v1alpha::ServerReflectionResponse>* AsyncServerReflectionInfoRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;
const ::grpc::RpcMethod rpcmethod_ServerReflectionInfo_;
};
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
class Service : public ::grpc::Service {
public:
Service();
virtual ~Service();
// The reflection service is structured as a bidirectional stream, ensuring
// all related requests go to a single server.
virtual ::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream);
};
template <class BaseClass>
class WithAsyncMethod_ServerReflectionInfo : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithAsyncMethod_ServerReflectionInfo() {
::grpc::Service::MarkMethodAsync(0);
}
~WithAsyncMethod_ServerReflectionInfo() GRPC_OVERRIDE {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream) GRPC_FINAL GRPC_OVERRIDE {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
void RequestServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
::grpc::Service::RequestAsyncBidiStreaming(0, context, stream, new_call_cq, notification_cq, tag);
}
};
typedef WithAsyncMethod_ServerReflectionInfo<Service > AsyncService;
template <class BaseClass>
class WithGenericMethod_ServerReflectionInfo : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithGenericMethod_ServerReflectionInfo() {
::grpc::Service::MarkMethodGeneric(0);
}
~WithGenericMethod_ServerReflectionInfo() GRPC_OVERRIDE {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status ServerReflectionInfo(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< ::grpc::reflection::v1alpha::ServerReflectionResponse, ::grpc::reflection::v1alpha::ServerReflectionRequest>* stream) GRPC_FINAL GRPC_OVERRIDE {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
};
};
} // namespace v1alpha
} // namespace reflection
} // namespace grpc
#endif // GRPC_reflection_2eproto__INCLUDED

File diff suppressed because it is too large Load Diff

@ -57,8 +57,10 @@
#include <grpc++/client_context.h>
#include <grpc++/completion_queue.h>
#include <grpc++/create_channel.h>
#include <grpc++/create_channel_posix.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_posix.h>
#endif // GRPCXX_GRPCXX_H

@ -172,6 +172,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
R* response, void* tag)
: context_(context), call_(channel->CreateCall(method, context, cq)) {
finish_ops_.RecvMessage(response);
finish_ops_.AllowNoMessage();
init_ops_.set_output_tag(tag);
init_ops_.SendInitialMetadata(context->send_initial_metadata_,
@ -298,8 +299,16 @@ class ClientAsyncReaderWriter GRPC_FINAL
};
template <class W, class R>
class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
public:
virtual void Finish(const W& msg, const Status& status, void* tag) = 0;
virtual void FinishWithError(const Status& status, void* tag) = 0;
};
template <class W, class R>
class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> {
public:
explicit ServerAsyncReader(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
@ -320,7 +329,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
call_.PerformOps(&read_ops_);
}
void Finish(const W& msg, const Status& status, void* tag) {
void Finish(const W& msg, const Status& status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@ -337,7 +346,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
call_.PerformOps(&finish_ops_);
}
void FinishWithError(const Status& status, void* tag) {
void FinishWithError(const Status& status, void* tag) GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!status.ok());
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
@ -362,8 +371,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
};
template <class W>
class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
public:
virtual void Finish(const Status& status, void* tag) = 0;
};
template <class W>
class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> {
public:
explicit ServerAsyncWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
@ -390,7 +405,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
call_.PerformOps(&write_ops_);
}
void Finish(const Status& status, void* tag) {
void Finish(const Status& status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@ -413,9 +428,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
/// Server-side interface for asynchronous bi-directional streaming.
template <class W, class R>
class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
public:
virtual void Finish(const Status& status, void* tag) = 0;
};
template <class W, class R>
class ServerAsyncReaderWriter GRPC_FINAL
: public ServerAsyncReaderWriterInterface<W, R> {
public:
explicit ServerAsyncReaderWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
@ -448,7 +470,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
call_.PerformOps(&write_ops_);
}
void Finish(const Status& status, void* tag) {
void Finish(const Status& status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,

@ -91,6 +91,7 @@ class ClientAsyncResponseReader GRPC_FINAL
collection_->finish_buf_.RecvInitialMetadata(context_);
}
collection_->finish_buf_.RecvMessage(msg);
collection_->finish_buf_.AllowNoMessage();
collection_->finish_buf_.ClientRecvStatus(context_, status);
call_.PerformOps(&collection_->finish_buf_);
}

@ -47,7 +47,9 @@
#include <grpc++/impl/codegen/serialization_traits.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/string_ref.h>
#include <grpc/impl/codegen/alloc.h>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/grpc_types.h>
struct grpc_byte_buffer;
@ -187,6 +189,8 @@ class CallOpSendInitialMetadata {
flags_ = flags;
initial_metadata_count_ = metadata.size();
initial_metadata_ = FillMetadataArray(metadata);
// TODO(dgq): expose compression level in API so it can be properly set.
maybe_compression_level_.is_set = false;
}
protected:
@ -198,6 +202,10 @@ class CallOpSendInitialMetadata {
op->reserved = NULL;
op->data.send_initial_metadata.count = initial_metadata_count_;
op->data.send_initial_metadata.metadata = initial_metadata_;
op->data.send_initial_metadata.maybe_compression_level.is_set =
maybe_compression_level_.is_set;
op->data.send_initial_metadata.maybe_compression_level.level =
maybe_compression_level_.level;
}
void FinishOp(bool* status, int max_message_size) {
if (!send_) return;
@ -209,6 +217,10 @@ class CallOpSendInitialMetadata {
uint32_t flags_;
size_t initial_metadata_count_;
grpc_metadata* initial_metadata_;
struct {
bool is_set;
grpc_compression_level level;
} maybe_compression_level_;
};
class CallOpSendMessage {
@ -261,10 +273,16 @@ Status CallOpSendMessage::SendMessage(const M& message) {
template <class R>
class CallOpRecvMessage {
public:
CallOpRecvMessage() : got_message(false), message_(nullptr) {}
CallOpRecvMessage()
: got_message(false),
message_(nullptr),
allow_not_getting_message_(false) {}
void RecvMessage(R* message) { message_ = message; }
// Do not change status if no message is received.
void AllowNoMessage() { allow_not_getting_message_ = true; }
bool got_message;
protected:
@ -290,7 +308,9 @@ class CallOpRecvMessage {
}
} else {
got_message = false;
*status = false;
if (!allow_not_getting_message_) {
*status = false;
}
}
message_ = nullptr;
}
@ -298,6 +318,7 @@ class CallOpRecvMessage {
private:
R* message_;
grpc_byte_buffer* recv_buf_;
bool allow_not_getting_message_;
};
namespace CallOpGenericRecvMessageHelper {
@ -316,7 +337,7 @@ class DeserializeFuncType GRPC_FINAL : public DeserializeFunc {
return SerializationTraits<R>::Deserialize(buf, message_, max_message_size);
}
~DeserializeFuncType() override {}
~DeserializeFuncType() GRPC_OVERRIDE {}
private:
R* message_; // Not a managed pointer because management is external to this
@ -325,7 +346,8 @@ class DeserializeFuncType GRPC_FINAL : public DeserializeFunc {
class CallOpGenericRecvMessage {
public:
CallOpGenericRecvMessage() : got_message(false) {}
CallOpGenericRecvMessage()
: got_message(false), allow_not_getting_message_(false) {}
template <class R>
void RecvMessage(R* message) {
@ -336,6 +358,9 @@ class CallOpGenericRecvMessage {
deserialize_.reset(func);
}
// Do not change status if no message is received.
void AllowNoMessage() { allow_not_getting_message_ = true; }
bool got_message;
protected:
@ -360,7 +385,9 @@ class CallOpGenericRecvMessage {
}
} else {
got_message = false;
*status = false;
if (!allow_not_getting_message_) {
*status = false;
}
}
deserialize_.reset();
}
@ -368,6 +395,7 @@ class CallOpGenericRecvMessage {
private:
std::unique_ptr<CallOpGenericRecvMessageHelper::DeserializeFunc> deserialize_;
grpc_byte_buffer* recv_buf_;
bool allow_not_getting_message_;
};
class CallOpClientSendClose {

@ -193,7 +193,7 @@ class ClientContext {
///
/// \return A multimap of initial metadata key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerInitialMetadata() {
GetServerInitialMetadata() const {
GPR_CODEGEN_ASSERT(initial_metadata_received_);
return recv_initial_metadata_;
}
@ -205,7 +205,7 @@ class ClientContext {
///
/// \return A multimap of metadata trailing key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerTrailingMetadata() {
GetServerTrailingMetadata() const {
// TODO(yangg) check finished
return trailing_metadata_;
}
@ -230,13 +230,13 @@ class ClientContext {
#ifndef GRPC_CXX0X_NO_CHRONO
/// Return the deadline for the client call.
std::chrono::system_clock::time_point deadline() {
std::chrono::system_clock::time_point deadline() const {
return Timespec2Timepoint(deadline_);
}
#endif // !GRPC_CXX0X_NO_CHRONO
/// Return a \a gpr_timespec representation of the client call's deadline.
gpr_timespec raw_deadline() { return deadline_; }
gpr_timespec raw_deadline() const { return deadline_; }
/// Set the per call authority header (see
/// https://tools.ietf.org/html/rfc7540#section-8.1.2.3).
@ -337,7 +337,7 @@ class ClientContext {
const InputMessage& request,
OutputMessage* result);
grpc_call* call() { return call_; }
grpc_call* call() const { return call_; }
void set_call(grpc_call* call, const std::shared_ptr<Channel>& channel);
uint32_t initial_metadata_flags() const {

@ -54,6 +54,7 @@
// nullptr was added in gcc 4.6
#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406)
#define GRPC_CXX0X_NO_NULLPTR 1
#define GRPC_CXX0X_LIMITED_TOSTRING 1
#endif
// final and override were added in gcc 4.7
#if (__GNUC__ * 100 + __GNUC_MINOR__ < 407)
@ -78,6 +79,7 @@
#endif
#ifdef GRPC_CXX0X_NO_NULLPTR
#include <functional>
#include <memory>
namespace grpc {
const class {
@ -95,6 +97,10 @@ const class {
return std::shared_ptr<T>(static_cast<T *>(0));
}
operator bool() const { return false; }
template <class F>
operator std::function<F>() const {
return std::function<F>();
}
private:
void operator&() const = delete;
@ -111,6 +117,17 @@ namespace grpc {
typedef GRPC_CUSTOM_STRING string;
#ifdef GRPC_CXX0X_LIMITED_TOSTRING
inline grpc::string to_string(const int x) {
return std::to_string(static_cast<const long long int>(x));
}
inline grpc::string to_string(const unsigned int x) {
return std::to_string(static_cast<const long long unsigned int>(x));
}
#else
using std::to_string;
#endif
} // namespace grpc
#endif // GRPCXX_IMPL_CODEGEN_CONFIG_H

@ -44,6 +44,19 @@
#define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message
#endif
#ifndef GRPC_CUSTOM_DESCRIPTOR
#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor.pb.h>
#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor
#define GRPC_CUSTOM_DESCRIPTORPOOL ::google::protobuf::DescriptorPool
#define GPRC_CUSTOM_FIELDDESCRIPTOR ::google::protobuf::FieldDescriptor
#define GRPC_CUSTOM_FILEDESCRIPTOR ::google::protobuf::FileDescriptor
#define GRPC_CUSTOM_FILEDESCRIPTORPROTO ::google::protobuf::FileDescriptorProto
#define GRPC_CUSTOM_METHODDESCRIPTOR ::google::protobuf::MethodDescriptor
#define GRPC_CUSTOM_SERVICEDESCRIPTOR ::google::protobuf::ServiceDescriptor
#define GRPC_CUSTOM_SOURCELOCATION ::google::protobuf::SourceLocation
#endif
#ifndef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream.h>
@ -60,6 +73,15 @@ namespace protobuf {
typedef GRPC_CUSTOM_MESSAGE Message;
typedef GRPC_CUSTOM_PROTOBUF_INT64 int64;
typedef GRPC_CUSTOM_DESCRIPTOR Descriptor;
typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool;
typedef GPRC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor;
typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor;
typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto;
typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor;
typedef GRPC_CUSTOM_SERVICEDESCRIPTOR ServiceDescriptor;
typedef GRPC_CUSTOM_SOURCELOCATION SourceLocation;
namespace io {
typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream;
typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream;

@ -42,42 +42,44 @@ namespace grpc {
/// Implementation of the core codegen interface.
class CoreCodegen : public CoreCodegenInterface {
private:
grpc_completion_queue* grpc_completion_queue_create(void* reserved) override;
void grpc_completion_queue_destroy(grpc_completion_queue* cq) override;
grpc_completion_queue* grpc_completion_queue_create(void* reserved)
GRPC_OVERRIDE;
void grpc_completion_queue_destroy(grpc_completion_queue* cq) GRPC_OVERRIDE;
grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag,
gpr_timespec deadline,
void* reserved) override;
void* reserved) GRPC_OVERRIDE;
void* gpr_malloc(size_t size) override;
void gpr_free(void* p) override;
void* gpr_malloc(size_t size) GRPC_OVERRIDE;
void gpr_free(void* p) GRPC_OVERRIDE;
void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override;
void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE;
void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
grpc_byte_buffer* buffer) override;
void grpc_byte_buffer_reader_destroy(
grpc_byte_buffer_reader* reader) override;
grpc_byte_buffer* buffer) GRPC_OVERRIDE;
void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader)
GRPC_OVERRIDE;
int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
gpr_slice* slice) override;
gpr_slice* slice) GRPC_OVERRIDE;
grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice,
size_t nslices) override;
size_t nslices) GRPC_OVERRIDE;
gpr_slice gpr_slice_malloc(size_t length) override;
void gpr_slice_unref(gpr_slice slice) override;
gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) override;
void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) override;
void gpr_slice_buffer_pop(gpr_slice_buffer* sb) override;
gpr_slice gpr_slice_malloc(size_t length) GRPC_OVERRIDE;
void gpr_slice_unref(gpr_slice slice) GRPC_OVERRIDE;
gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) GRPC_OVERRIDE;
void gpr_slice_buffer_add(gpr_slice_buffer* sb,
gpr_slice slice) GRPC_OVERRIDE;
void gpr_slice_buffer_pop(gpr_slice_buffer* sb) GRPC_OVERRIDE;
void grpc_metadata_array_init(grpc_metadata_array* array) override;
void grpc_metadata_array_destroy(grpc_metadata_array* array) override;
void grpc_metadata_array_init(grpc_metadata_array* array) GRPC_OVERRIDE;
void grpc_metadata_array_destroy(grpc_metadata_array* array) GRPC_OVERRIDE;
gpr_timespec gpr_inf_future(gpr_clock_type type) override;
gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE;
virtual const Status& ok() override;
virtual const Status& cancelled() override;
virtual const Status& ok() GRPC_OVERRIDE;
virtual const Status& cancelled() GRPC_OVERRIDE;
void assert_fail(const char* failed_assertion) override;
void assert_fail(const char* failed_assertion) GRPC_OVERRIDE;
};
} // namespace grpc

@ -34,7 +34,7 @@
#ifndef GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
#define GRPCXX_IMPL_CODEGEN_CORE_CODEGEN_INTERFACE_H
#include <grpc++/impl/codegen/config_protobuf.h>
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc/impl/codegen/grpc_types.h>

@ -295,8 +295,16 @@ class ClientAsyncReaderWriter GRPC_FINAL
};
template <class W, class R>
class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
public:
virtual void Finish(const W& msg, const Status& status, void* tag) = 0;
virtual void FinishWithError(const Status& status, void* tag) = 0;
};
template <class W, class R>
class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> {
public:
explicit ServerAsyncReader(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
@ -316,7 +324,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
call_.PerformOps(&read_ops_);
}
void Finish(const W& msg, const Status& status, void* tag) {
void Finish(const W& msg, const Status& status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
@ -332,7 +340,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
call_.PerformOps(&finish_ops_);
}
void FinishWithError(const Status& status, void* tag) {
void FinishWithError(const Status& status, void* tag) GRPC_OVERRIDE {
GPR_CODEGEN_ASSERT(!status.ok());
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
@ -356,8 +364,14 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
};
template <class W>
class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
public:
virtual void Finish(const Status& status, void* tag) = 0;
};
template <class W>
class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> {
public:
explicit ServerAsyncWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
@ -382,7 +396,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
call_.PerformOps(&write_ops_);
}
void Finish(const Status& status, void* tag) {
void Finish(const Status& status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
@ -404,9 +418,16 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
/// Server-side interface for asynchronous bi-directional streaming.
template <class W, class R>
class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
public:
virtual void Finish(const Status& status, void* tag) = 0;
};
template <class W, class R>
class ServerAsyncReaderWriter GRPC_FINAL
: public ServerAsyncReaderWriterInterface<W, R> {
public:
explicit ServerAsyncReaderWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
@ -437,7 +458,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
call_.PerformOps(&write_ops_);
}
void Finish(const Status& status, void* tag) {
void Finish(const Status& status, void* tag) GRPC_OVERRIDE {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);

@ -94,12 +94,12 @@ class ServerContext {
~ServerContext();
#ifndef GRPC_CXX0X_NO_CHRONO
std::chrono::system_clock::time_point deadline() {
std::chrono::system_clock::time_point deadline() const {
return Timespec2Timepoint(deadline_);
}
#endif // !GRPC_CXX0X_NO_CHRONO
gpr_timespec raw_deadline() { return deadline_; }
gpr_timespec raw_deadline() const { return deadline_; }
void AddInitialMetadata(const grpc::string& key, const grpc::string& value);
void AddTrailingMetadata(const grpc::string& key, const grpc::string& value);
@ -122,7 +122,8 @@ class ServerContext {
// was called.
void TryCancel() const;
const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata() {
const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata()
const {
return client_metadata_;
}

@ -62,6 +62,10 @@ class ServerInterface : public CallHook {
/// Shutdown the server, blocking until all rpc processing finishes.
/// Forcefully terminate pending calls after \a deadline expires.
///
/// All completion queue associated with the server (for example, for async
/// serving) must be shutdown *after* this method has returned:
/// See \a ServerBuilder::AddCompletionQueue for details.
///
/// \param deadline How long to wait until pending rpcs are forcefully
/// terminated.
template <class T>
@ -70,6 +74,10 @@ class ServerInterface : public CallHook {
}
/// Shutdown the server, waiting for all rpc processing to finish.
///
/// All completion queue associated with the server (for example, for async
/// serving) must be shutdown *after* this method has returned:
/// See \a ServerBuilder::AddCompletionQueue for details.
void Shutdown() { ShutdownInternal(gpr_inf_future(GPR_CLOCK_MONOTONIC)); }
/// Block waiting for all work to complete.

@ -189,6 +189,7 @@ class ClientWriter : public ClientWriterInterface<W> {
ClientContext* context, R* response)
: context_(context), call_(channel->CreateCall(method, context, &cq_)) {
finish_ops_.RecvMessage(response);
finish_ops_.AllowNoMessage();
CallOpSet<CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(context->send_initial_metadata_,

@ -37,11 +37,10 @@
#include <iostream>
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/core_codegen.h>
#include <grpc++/impl/codegen/grpc_library.h>
#include <grpc/grpc.h>
#include "src/cpp/common/core_codegen.h"
namespace grpc {
namespace internal {

@ -50,8 +50,7 @@ class ServerBuilderOption {
virtual void UpdateArguments(ChannelArguments* args) = 0;
/// Alter the ServerBuilderPlugin map that will be added into ServerBuilder.
virtual void UpdatePlugins(
std::map<grpc::string, std::unique_ptr<ServerBuilderPlugin> >*
plugins) = 0;
std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) = 0;
};
} // namespace grpc

@ -93,6 +93,12 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen {
/// until all server objects in the process have been destroyed.
static void SetGlobalCallbacks(GlobalCallbacks* callbacks);
// Returns a \em raw pointer to the underlying grpc_server instance.
grpc_server* c_server();
// Returns a \em raw pointer to the underlying CompletionQueue.
CompletionQueue* completion_queue();
private:
friend class AsyncGenericService;
friend class ServerBuilder;

@ -66,29 +66,43 @@ class ServerBuilder {
/// The service must exist for the lifetime of the \a Server instance returned
/// by \a BuildAndStart().
/// Matches requests with any :authority
void RegisterService(Service* service);
ServerBuilder& RegisterService(Service* service);
/// Register a generic service.
/// Matches requests with any :authority
void RegisterAsyncGenericService(AsyncGenericService* service);
ServerBuilder& RegisterAsyncGenericService(AsyncGenericService* service);
/// Register a service. This call does not take ownership of the service.
/// The service must exist for the lifetime of the \a Server instance returned
/// by BuildAndStart().
/// Only matches requests with :authority \a host
void RegisterService(const grpc::string& host, Service* service);
ServerBuilder& RegisterService(const grpc::string& host, Service* service);
/// Set max message size in bytes.
void SetMaxMessageSize(int max_message_size) {
ServerBuilder& SetMaxMessageSize(int max_message_size) {
max_message_size_ = max_message_size;
return *this;
}
/// Set the compression options to be used by the server.
void SetCompressionOptions(const grpc_compression_options& options) {
compression_options_ = options;
}
/// Set the support status for compression algorithms. All algorithms are
/// enabled by default.
///
/// Incoming calls compressed with an unsupported algorithm will fail with
/// GRPC_STATUS_UNIMPLEMENTED.
ServerBuilder& SetCompressionAlgorithmSupportStatus(
grpc_compression_algorithm algorithm, bool enabled);
/// The default compression level to use for all channel calls in the
/// absence of a call-specific level.
ServerBuilder& SetDefaultCompressionLevel(grpc_compression_level level);
/// The default compression algorithm to use for all channel calls in the
/// absence of a call-specific level. Note that it overrides any compression
/// level set by \a SetDefaultCompressionLevel.
ServerBuilder& SetDefaultCompressionAlgorithm(
grpc_compression_algorithm algorithm);
void SetOption(std::unique_ptr<ServerBuilderOption> option);
ServerBuilder& SetOption(std::unique_ptr<ServerBuilderOption> option);
/// Tries to bind \a server to the given \a addr.
///
@ -101,13 +115,24 @@ class ServerBuilder {
/// number. \a nullptr otherwise.
///
// TODO(dgq): the "port" part seems to be a misnomer.
void AddListeningPort(const grpc::string& addr,
std::shared_ptr<ServerCredentials> creds,
int* selected_port = nullptr);
ServerBuilder& AddListeningPort(const grpc::string& addr,
std::shared_ptr<ServerCredentials> creds,
int* selected_port = nullptr);
/// Add a completion queue for handling asynchronous services
/// Caller is required to keep this completion queue live until
/// the server is destroyed.
/// Add a completion queue for handling asynchronous services.
///
/// Caller is required to shutdown the server prior to shutting down the
/// returned completion queue. A typical usage scenario:
///
/// // While building the server:
/// ServerBuilder builder;
/// ...
/// cq_ = builder.AddCompletionQueue();
/// server_ = builder.BuildAndStart();
///
/// // While shutting down the server;
/// server_->Shutdown();
/// cq_->Shutdown(); // Always *after* the associated server's Shutdown()!
///
/// \param is_frequently_polled This is an optional parameter to inform GRPC
/// library about whether this completion queue would be frequently polled
@ -144,14 +169,22 @@ class ServerBuilder {
};
int max_message_size_;
grpc_compression_options compression_options_;
std::vector<std::unique_ptr<ServerBuilderOption>> options_;
std::vector<std::unique_ptr<NamedService>> services_;
std::vector<Port> ports_;
std::vector<ServerCompletionQueue*> cqs_;
std::shared_ptr<ServerCredentials> creds_;
std::map<grpc::string, std::unique_ptr<ServerBuilderPlugin>> plugins_;
std::vector<std::unique_ptr<ServerBuilderPlugin>> plugins_;
AsyncGenericService* generic_service_;
struct {
bool is_set;
grpc_compression_level level;
} maybe_default_compression_level_;
struct {
bool is_set;
grpc_compression_algorithm algorithm;
} maybe_default_compression_algorithm_;
uint32_t enabled_compression_algorithms_bitset_;
};
} // namespace grpc

@ -0,0 +1,56 @@
/*
*
* 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 GRPCXX_SERVER_POSIX_H
#define GRPCXX_SERVER_POSIX_H
#include <memory>
#include <grpc++/server.h>
#include <grpc/support/port_platform.h>
namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
/// Adds new client to a \a Server communicating over given file descriptor
///
/// \param server The server to add a client to.
/// \param fd The file descriptor representing a socket.
void AddInsecureChannelFromFd(Server* server, int fd);
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
} // namespace grpc
#endif // GRPCXX_SERVER_POSIX_H

@ -51,7 +51,8 @@ GRPCAPI int grpc_compression_algorithm_parse(
grpc_compression_algorithm *algorithm);
/** Updates \a name with the encoding name corresponding to a valid \a
* algorithm. Returns 1 upon success, 0 otherwise. */
* algorithm. Note that \a name is statically allocated and must *not* be freed.
* Returns 1 upon success, 0 otherwise. */
GRPCAPI int grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm, char **name);

@ -0,0 +1,70 @@
/*
*
* 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_POSIX_H
#define GRPC_GRPC_POSIX_H
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/port_platform.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/*! \mainpage GRPC Core POSIX
*
* The GRPC Core POSIX library provides some POSIX-specific low-level
* functionality on top of GRPC Core.
*/
/** Create a client channel to 'target' using file descriptor 'fd'. The 'target'
argument will be used to indicate the name for this channel. See the comment
for grpc_insecure_channel_create for description of 'args' argument. */
GRPCAPI grpc_channel *grpc_insecure_channel_create_from_fd(
const char *target, int fd, const grpc_channel_args *args);
/** Add the connected communication channel based on file descriptor 'fd' to the
'server'. The 'fd' must be an open file descriptor corresponding to a
connected socket. The 'cq' is a completion queue that will be getting events
from that descriptor. */
GRPCAPI void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
grpc_completion_queue *cq,
int fd);
#ifdef __cplusplus
}
#endif
#endif /* GRPC_GRPC_POSIX_H */

@ -83,8 +83,8 @@
#include <grpc/impl/codegen/atm_gcc_atomic.h>
#elif defined(GPR_GCC_SYNC)
#include <grpc/impl/codegen/atm_gcc_sync.h>
#elif defined(GPR_WIN32_ATOMIC)
#include <grpc/impl/codegen/atm_win32.h>
#elif defined(GPR_WINDOWS_ATOMIC)
#include <grpc/impl/codegen/atm_windows.h>
#else
#error could not determine platform for atm
#endif

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_IMPL_CODEGEN_ATM_WIN32_H
#define GRPC_IMPL_CODEGEN_ATM_WIN32_H
#ifndef GRPC_IMPL_CODEGEN_ATM_WINDOWS_H
#define GRPC_IMPL_CODEGEN_ATM_WINDOWS_H
/* Win32 variant of atm_platform.h */
#include <grpc/impl/codegen/port_platform.h>
@ -122,4 +122,4 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) {
return old;
}
#endif /* GRPC_IMPL_CODEGEN_ATM_WIN32_H */
#endif /* GRPC_IMPL_CODEGEN_ATM_WINDOWS_H */

@ -35,11 +35,17 @@
#define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
#include <grpc/impl/codegen/port_platform.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/** To be used as initial metadata key for the request of a concrete compression
* algorithm */
#define GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
"grpc-internal-encoding-request"
/** To be used in channel arguments */
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
"grpc.default_compression_algorithm"
@ -74,15 +80,24 @@ typedef struct grpc_compression_options {
*/
uint32_t enabled_algorithms_bitset;
/** The default channel compression algorithm. It'll be used in the absence of
/** The default channel compression level. It'll be used in the absence of
* call specific settings. This option corresponds to the channel argument key
* behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM */
grpc_compression_algorithm default_compression_algorithm;
* behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present, takes
* precedence over \a default_algorithm.
* TODO(dgq): currently only available for server channels. */
struct {
bool is_set;
grpc_compression_level level;
} default_level;
/** The default channel compression level. It'll be used in the absence of
/** The default channel compression algorithm. It'll be used in the absence of
* call specific settings. This option corresponds to the channel argument key
* behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL */
grpc_compression_algorithm default_compression_level;
* behind \a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM. */
struct {
bool is_set;
grpc_compression_algorithm algorithm;
} default_algorithm;
} grpc_compression_options;
#ifdef __cplusplus

@ -49,7 +49,7 @@ typedef enum {
/** channel has seen a failure but expects to recover */
GRPC_CHANNEL_TRANSIENT_FAILURE,
/** channel has seen a failure that it cannot recover from */
GRPC_CHANNEL_FATAL_FAILURE
GRPC_CHANNEL_SHUTDOWN
} grpc_connectivity_state;
#ifdef __cplusplus

@ -115,6 +115,8 @@ typedef struct {
/* Channel argument keys: */
/** Enable census for tracing and stats collection */
#define GRPC_ARG_ENABLE_CENSUS "grpc.census"
/** Enable load reporting */
#define GRPC_ARG_ENABLE_LOAD_REPORTING "grpc.loadreporting"
/** Maximum number of concurrent incoming streams to allow on a http2
connection */
#define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams"
@ -332,6 +334,12 @@ typedef struct grpc_op {
struct {
size_t count;
grpc_metadata *metadata;
/** If \a is_set, \a compression_level will be used for the call.
* Otherwise, \a compression_level won't be considered */
struct {
uint8_t is_set;
grpc_compression_level level;
} maybe_compression_level;
} send_initial_metadata;
grpc_byte_buffer *send_message;
struct {

@ -34,6 +34,7 @@
#ifndef GRPC_IMPL_CODEGEN_LOG_H
#define GRPC_IMPL_CODEGEN_LOG_H
#include <inttypes.h>
#include <stdarg.h>
#include <stdlib.h> /* for abort() */
@ -74,7 +75,7 @@ const char *gpr_log_severity_string(gpr_log_severity severity);
/* Log a message. It's advised to use GPR_xxx above to generate the context
* for each message */
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity,
const char *format, ...);
const char *format, ...) GPRC_PRINT_FORMAT_CHECK(4, 5);
GPRAPI void gpr_log_message(const char *file, int line,
gpr_log_severity severity, const char *message);

@ -89,10 +89,10 @@
#define GPR_ARCH_32 1
#endif
#define GPR_PLATFORM_STRING "windows"
#define GPR_WIN32 1
#define GPR_WINDOWS 1
#define GPR_WINSOCK_SOCKET 1
#define GPR_WINDOWS_SUBPROCESS 1
#define GPR_WIN32_ENV
#define GPR_WINDOWS_ENV
#ifdef __MSYS__
#define GPR_GETPID_IN_UNISTD_H 1
#define GPR_MSYS_TMPFILE
@ -101,17 +101,17 @@
#define GPR_POSIX_TIME
#else
#define GPR_GETPID_IN_PROCESS_H 1
#define GPR_WIN32_TMPFILE
#define GPR_WIN32_LOG
#define GPR_WINDOWS_TMPFILE
#define GPR_WINDOWS_LOG
#define GPR_WINDOWS_CRASH_HANDLER 1
#define GPR_WIN32_STRING
#define GPR_WIN32_TIME
#define GPR_WINDOWS_STRING
#define GPR_WINDOWS_TIME
#endif
#ifdef __GNUC__
#define GPR_GCC_ATOMIC 1
#define GPR_GCC_TLS 1
#else
#define GPR_WIN32_ATOMIC 1
#define GPR_WINDOWS_ATOMIC 1
#define GPR_MSVC_TLS 1
#endif
#elif defined(GPR_MANYLINUX1)
@ -129,6 +129,7 @@
#define GPR_POSIX_SOCKETADDR 1
#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1
#define GPR_POSIX_SOCKETUTILS 1
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
#define GPR_HAVE_UNIX_SOCKET 1
#define GPR_HAVE_IP_PKTINFO 1
#define GPR_HAVE_IPV6_RECVPKTINFO 1
@ -149,7 +150,11 @@
#elif defined(ANDROID) || defined(__ANDROID__)
#define GPR_PLATFORM_STRING "android"
#define GPR_ANDROID 1
#ifdef _LP64
#define GPR_ARCH_64 1
#else /* _LP64 */
#define GPR_ARCH_32 1
#endif /* _LP64 */
#define GPR_CPU_LINUX 1
#define GPR_GCC_SYNC 1
#define GPR_GCC_TLS 1
@ -168,6 +173,7 @@
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
#define GPR_HAVE_MSG_NOSIGNAL 1
#define GPR_HAVE_UNIX_SOCKET 1
#define GPR_HAVE_IP_PKTINFO 1
@ -194,6 +200,7 @@
#define GPR_POSIX_WAKEUP_FD 1
#define GPR_POSIX_SOCKET 1
#define GPR_POSIX_SOCKETADDR 1
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
#define GPR_HAVE_UNIX_SOCKET 1
#define GPR_HAVE_IP_PKTINFO 1
#define GPR_HAVE_IPV6_RECVPKTINFO 1
@ -258,6 +265,7 @@
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
#define GPR_HAVE_SO_NOSIGPIPE 1
#define GPR_HAVE_UNIX_SOCKET 1
#define GPR_HAVE_IP_PKTINFO 1
@ -289,6 +297,7 @@
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
#define GPR_HAVE_SO_NOSIGPIPE 1
#define GPR_HAVE_UNIX_SOCKET 1
#define GPR_HAVE_IP_PKTINFO 1
@ -386,19 +395,19 @@ typedef unsigned __int64 uint64_t;
/* Validate platform combinations */
#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \
defined(GPR_WIN32_ATOMIC) != \
defined(GPR_WINDOWS_ATOMIC) != \
1
#error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WIN32_ATOMIC
#error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WINDOWS_ATOMIC
#endif
#if defined(GPR_ARCH_32) + defined(GPR_ARCH_64) != 1
#error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64
#endif
#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + \
defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WINDOWS) + \
defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \
1
#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WINDOWS, GPR_CPU_IPHONE, GPR_CPU_CUSTOM
#endif
#if defined(GPR_POSIX_MULTIPOLL_WITH_POLL) && !defined(GPR_POSIX_SOCKET)
@ -429,6 +438,15 @@ typedef unsigned __int64 uint64_t;
#endif
#endif
#ifndef GPRC_PRINT_FORMAT_CHECK
#ifdef __GNUC__
#define GPRC_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS) \
__attribute__((format(printf, FORMAT_STR, ARGS)))
#else
#define GPRC_PRINT_FORMAT_CHECK(FORMAT_STR, ARGS)
#endif
#endif /* GPRC_PRINT_FORMAT_CHECK */
#if GPR_FORBID_UNREACHABLE_CODE
#define GPR_UNREACHABLE_CODE(STATEMENT)
#else

@ -58,8 +58,8 @@
#if defined(GPR_POSIX_SYNC)
#include <grpc/impl/codegen/sync_posix.h>
#elif defined(GPR_WIN32)
#include <grpc/impl/codegen/sync_win32.h>
#elif defined(GPR_WINDOWS)
#include <grpc/impl/codegen/sync_windows.h>
#elif !defined(GPR_CUSTOM_SYNC)
#error Unable to determine platform for sync
#endif

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_IMPL_CODEGEN_SYNC_WIN32_H
#define GRPC_IMPL_CODEGEN_SYNC_WIN32_H
#ifndef GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H
#define GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H
#include <grpc/impl/codegen/sync_generic.h>
@ -46,4 +46,4 @@ typedef CONDITION_VARIABLE gpr_cv;
typedef INIT_ONCE gpr_once;
#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT
#endif /* GRPC_IMPL_CODEGEN_SYNC_WIN32_H */
#endif /* GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H */

@ -31,9 +31,9 @@
*
*/
#ifndef GRPCXX_IMPL_PROTO_UTILS_H
#define GRPCXX_IMPL_PROTO_UTILS_H
#ifndef GRPC_SUPPORT_ATM_WINDOWS_H
#define GRPC_SUPPORT_ATM_WINDOWS_H
#include <grpc++/impl/codegen/proto_utils.h>
#include <grpc/impl/codegen/atm_windows.h>
#endif // GRPCXX_IMPL_PROTO_UTILS_H
#endif /* GRPC_SUPPORT_ATM_WINDOWS_H */

@ -88,5 +88,10 @@ GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void *key);
does not mutate avl.
returns NULL if key is not found. */
GPRAPI void *gpr_avl_get(gpr_avl avl, void *key);
/** Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to
its value*/
GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void *key, void **value);
/** Return 1 if avl is empty, 0 otherwise */
GPRAPI int gpr_avl_is_empty(gpr_avl avl);
#endif /* GRPC_SUPPORT_AVL_H */

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_SUPPORT_LOG_WIN32_H
#define GRPC_SUPPORT_LOG_WIN32_H
#ifndef GRPC_SUPPORT_LOG_WINDOWS_H
#define GRPC_SUPPORT_LOG_WINDOWS_H
#ifdef __cplusplus
extern "C" {
@ -48,4 +48,4 @@ GPRAPI char *gpr_format_message(int messageid);
}
#endif
#endif /* GRPC_SUPPORT_LOG_WIN32_H */
#endif /* GRPC_SUPPORT_LOG_WINDOWS_H */

@ -54,7 +54,8 @@ GPRAPI char *gpr_strdup(const char *src);
On error, returns -1 and sets *strp to NULL. If the format string is bad,
the result is undefined. */
GPRAPI int gpr_asprintf(char **strp, const char *format, ...);
GPRAPI int gpr_asprintf(char **strp, const char *format, ...)
GPRC_PRINT_FORMAT_CHECK(2, 3);
#ifdef __cplusplus
}

@ -31,9 +31,9 @@
*
*/
#ifndef GRPC_SUPPORT_ATM_WIN32_H
#define GRPC_SUPPORT_ATM_WIN32_H
#ifndef GRPC_SUPPORT_SYNC_WINDOWS_H
#define GRPC_SUPPORT_SYNC_WINDOWS_H
#include <grpc/impl/codegen/atm_win32.h>
#include <grpc/impl/codegen/sync_windows.h>
#endif /* GRPC_SUPPORT_ATM_WIN32_H */
#endif /* GRPC_SUPPORT_SYNC_WINDOWS_H */

@ -54,14 +54,14 @@
<file baseinstalldir="/" name="include/grpc/support/atm.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/atm_gcc_atomic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/atm_gcc_sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/atm_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/atm_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/avl.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/cmdline.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/cpu.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/histogram.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/host_port.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/log.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/log_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/log_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/port_platform.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/slice.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/slice_buffer.h" role="src" />
@ -70,7 +70,7 @@
<file baseinstalldir="/" name="include/grpc/support/sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_generic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_posix.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/thd.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/time.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/tls.h" role="src" />
@ -82,7 +82,7 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_atomic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/log.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/port_platform.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/slice.h" role="src" />
@ -90,17 +90,16 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_generic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_posix.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/time.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/profiling/timers.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/backoff.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/block_annotate.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/env.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/load_file.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/murmur_hash.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/stack_lockfree.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_win32.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/thd_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/time_precise.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/tmpfile.h" role="src" />
@ -116,44 +115,44 @@
<file baseinstalldir="/" name="src/core/lib/support/cpu_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/env_linux.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/env_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/env_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/env_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/histogram.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/host_port.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/load_file.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/log.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/log_android.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/log_linux.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/log_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/log_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/log_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/murmur_hash.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/slice.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/slice_buffer.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/stack_lockfree.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_util_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_util_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/subprocess_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/subprocess_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/sync.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/sync_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/sync_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/sync_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/thd.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/thd_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/thd_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/thd_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/time.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/time_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/time_precise.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/time_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/time_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/tls_pthread.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/tmpfile_msys.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/tmpfile_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/tmpfile_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/tmpfile_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/wrap_memcpy.c" role="src" />
<file baseinstalldir="/" name="include/grpc/byte_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/byte_buffer_reader.h" role="src" />
<file baseinstalldir="/" name="include/grpc/compression.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc_posix.h" role="src" />
<file baseinstalldir="/" name="include/grpc/status.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/byte_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/byte_buffer_reader.h" role="src" />
@ -166,7 +165,7 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_atomic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_gcc_sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/atm_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/log.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/port_platform.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/slice.h" role="src" />
@ -174,9 +173,8 @@
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_generic.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_posix.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_win32.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/sync_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/time.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc_cronet.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" />
@ -197,6 +195,7 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/closure.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint_pair.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/error.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_poll_and_epoll_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_poll_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_posix.h" role="src" />
@ -206,6 +205,8 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/iomgr.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/iomgr_internal.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/iomgr_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/load_file.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/polling_entity.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset_set.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset_set_windows.h" role="src" />
@ -214,7 +215,7 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_win32.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/socket_utils_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/socket_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/tcp_client.h" role="src" />
@ -246,7 +247,6 @@
<file baseinstalldir="/" name="src/core/lib/surface/init.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/lame_client.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/server.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/surface_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/byte_stream.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/connectivity_state.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/metadata.h" role="src" />
@ -254,6 +254,7 @@
<file baseinstalldir="/" name="src/core/lib/transport/static_metadata.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/transport.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/transport_impl.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/bin_decoder.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/bin_encoder.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/chttp2_transport.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/frame.h" role="src" />
@ -291,6 +292,7 @@
<file baseinstalldir="/" name="src/core/lib/security/transport/handshake.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/transport/secure_endpoint.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/transport/security_connector.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/transport/tsi_error.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/util/b64.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/util/json_util.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/tsi/fake_transport_security.h" role="src" />
@ -314,13 +316,14 @@
<file baseinstalldir="/" name="src/core/ext/client_config/subchannel_call_holder.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/subchannel_index.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/uri_parser.h" role="src" />
<file baseinstalldir="/" name="third_party/objective_c/Cronet/cronet_c_for_grpc.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/load_balancer_api.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" role="src" />
<file baseinstalldir="/" name="third_party/nanopb/pb.h" role="src" />
<file baseinstalldir="/" name="third_party/nanopb/pb_common.h" role="src" />
<file baseinstalldir="/" name="third_party/nanopb/pb_decode.h" role="src" />
<file baseinstalldir="/" name="third_party/nanopb/pb_encode.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/load_reporting/load_reporting.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/load_reporting/load_reporting_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/aggregation.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/census_interface.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/census_rpc_stats.h" role="src" />
@ -336,7 +339,7 @@
<file baseinstalldir="/" name="src/core/lib/channel/connected_channel.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_client_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_server_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/compression_algorithm.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/compression.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/message_compress.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/debug/trace.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/http/format_request.c" role="src" />
@ -346,6 +349,7 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint_pair_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint_pair_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/error.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_poll_and_epoll_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_poll_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/ev_posix.c" role="src" />
@ -355,6 +359,8 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/iomgr.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/iomgr_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/iomgr_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/load_file.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/polling_entity.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset_set_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/resolve_address_posix.c" role="src" />
@ -412,6 +418,7 @@
<file baseinstalldir="/" name="src/core/lib/transport/transport.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/transport_op_string.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/bin_decoder.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/bin_encoder.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/chttp2_plugin.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/chttp2_transport.c" role="src" />
@ -441,7 +448,7 @@
<file baseinstalldir="/" name="src/core/lib/security/credentials/credentials_metadata.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/fake/fake_credentials.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/google_default/credentials_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/google_default/credentials_win32.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/google_default/credentials_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/google_default/google_default_credentials.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/iam/iam_credentials.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/jwt/json_token.c" role="src" />
@ -455,6 +462,7 @@
<file baseinstalldir="/" name="src/core/lib/security/transport/secure_endpoint.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/transport/security_connector.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/transport/server_auth_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/transport/tsi_error.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/util/b64.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/util/json_util.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/init_secure.c" role="src" />
@ -482,10 +490,9 @@
<file baseinstalldir="/" name="src/core/ext/client_config/subchannel_index.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/client_config/uri_parser.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/server/insecure/server_chttp2.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/cronet/client/secure/cronet_channel_create.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/cronet/transport/cronet_api_dummy.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/cronet/transport/cronet_transport.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/load_balancer_api.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c" role="src" />
<file baseinstalldir="/" name="third_party/nanopb/pb_common.c" role="src" />
@ -495,6 +502,8 @@
<file baseinstalldir="/" name="src/core/ext/lb_policy/round_robin/round_robin.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/resolver/dns/native/dns_resolver.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/resolver/sockaddr/sockaddr_resolver.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/load_reporting/load_reporting.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/load_reporting/load_reporting_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/context.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/gen/census.pb.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/grpc_context.c" role="src" />
@ -1068,20 +1077,5 @@ Update to wrap gRPC C Core version 0.10.0
- Updated functions with TSRM macros for ZTS support #6607
</notes>
</release>
<release>
<version>
<release>0.15.0</release>
<api>0.15.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2016-05-19</date>
<license>BSD</license>
<notes>
- TBD
</notes>
</release>
</changelog>
</package>

@ -33,9 +33,11 @@ import os
import os.path
import shutil
import sys
import sysconfig
from distutils import core as _core
from distutils import extension as _extension
import pkg_resources
import setuptools
from setuptools.command import egg_info
@ -110,6 +112,16 @@ if "linux" in sys.platform or "darwin" in sys.platform:
DEFINE_MACROS += (('PyMODINIT_FUNC', pymodinit),)
# By default, Python3 distutils enforces compatibility of
# c plugins (.so files) with the OSX version Python3 was built with.
# For Python3.4, this is OSX 10.6, but we need Thread Local Support (__thread)
if 'darwin' in sys.platform and PY3:
mac_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
if mac_target and (pkg_resources.parse_version(mac_target) <
pkg_resources.parse_version('10.7.0')):
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
def cython_extensions(module_names, extra_sources, include_dirs,
libraries, define_macros, build_with_cython=False):
# Set compiler directives linetrace argument only if we care about tracing;
@ -202,7 +214,7 @@ TEST_PACKAGE_DATA = {
}
TESTS_REQUIRE = (
'oauth2client>=1.4.7',
'oauth2client>=2.1.0',
'protobuf>=3.0.0a3',
'coverage>=4.0',
) + INSTALL_REQUIRES
@ -234,8 +246,6 @@ setuptools.setup(
ext_modules=CYTHON_EXTENSION_MODULES,
packages=list(PACKAGES),
package_dir=PACKAGE_DIRECTORIES,
# TODO(atash): Figure out why auditwheel doesn't like namespace packages.
#namespace_packages=['grpc'],
package_data=PACKAGE_DATA,
install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES,

@ -34,19 +34,7 @@
#ifndef SRC_COMPILER_CONFIG_H
#define SRC_COMPILER_CONFIG_H
#include <grpc++/support/config.h>
#include <grpc++/support/config_protobuf.h>
#ifndef GRPC_CUSTOM_DESCRIPTOR
#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor.pb.h>
#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor
#define GRPC_CUSTOM_FILEDESCRIPTOR ::google::protobuf::FileDescriptor
#define GRPC_CUSTOM_FILEDESCRIPTORPROTO ::google::protobuf::FileDescriptorProto
#define GRPC_CUSTOM_METHODDESCRIPTOR ::google::protobuf::MethodDescriptor
#define GRPC_CUSTOM_SERVICEDESCRIPTOR ::google::protobuf::ServiceDescriptor
#define GRPC_CUSTOM_SOURCELOCATION ::google::protobuf::SourceLocation
#endif
#include <grpc++/impl/codegen/config_protobuf.h>
#ifndef GRPC_CUSTOM_CODEGENERATOR
#include <google/protobuf/compiler/code_generator.h>
@ -75,14 +63,17 @@
#define GRPC_CUSTOM_PARSEGENERATORPARAMETER ::google::protobuf::compiler::ParseGeneratorParameter
#endif
#ifndef GRPC_CUSTOM_STRING
#include <string>
#define GRPC_CUSTOM_STRING std::string
#endif
namespace grpc {
typedef GRPC_CUSTOM_STRING string;
namespace protobuf {
typedef GRPC_CUSTOM_DESCRIPTOR Descriptor;
typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor;
typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto;
typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor;
typedef GRPC_CUSTOM_SERVICEDESCRIPTOR ServiceDescriptor;
typedef GRPC_CUSTOM_SOURCELOCATION SourceLocation;
namespace compiler {
typedef GRPC_CUSTOM_CODEGENERATOR CodeGenerator;
typedef GRPC_CUSTOM_GENERATORCONTEXT GeneratorContext;

@ -73,9 +73,10 @@ void PrintIncludes(Printer *printer, const std::vector<grpc::string>& headers, c
vars["l"] = params.use_system_headers ? '<' : '"';
vars["r"] = params.use_system_headers ? '>' : '"';
if (!params.grpc_search_path.empty()) {
vars["l"] += params.grpc_search_path;
if (params.grpc_search_path.back() != '/') {
auto& s = params.grpc_search_path;
if (!s.empty()) {
vars["l"] += s;
if (s[s.size()-1] != '/') {
vars["l"] += '/';
}
}

@ -65,6 +65,13 @@ inline grpc::string ClassName(const grpc::protobuf::Descriptor *descriptor,
}
}
// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in in front of leading comments.
template <typename DescriptorType>
inline grpc::string GetCppComments(const DescriptorType *desc, bool leading) {
return grpc_generator::GetPrefixedComments(desc, leading, "//");
}
} // namespace grpc_cpp_generator
#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H

@ -43,7 +43,7 @@
#include "src/compiler/cpp_generator_helpers.h"
#include "src/compiler/generator_helpers.h"
using grpc_generator::GetCppComments;
using grpc_cpp_generator::GetCppComments;
class ProtoBufMethod : public grpc_cpp_generator::Method {
public:

@ -52,7 +52,6 @@ using grpc::protobuf::MethodDescriptor;
using grpc::protobuf::io::Printer;
using grpc::protobuf::io::StringOutputStream;
using grpc_generator::MethodType;
using grpc_generator::GetCppComments;
using grpc_generator::GetMethodType;
using grpc_generator::METHODTYPE_NO_STREAMING;
using grpc_generator::METHODTYPE_CLIENT_STREAMING;
@ -120,18 +119,10 @@ std::string GetServiceClassName(const ServiceDescriptor* service) {
return service->name();
}
std::string GetClientInterfaceName(const ServiceDescriptor* service) {
return "I" + service->name() + "Client";
}
std::string GetClientClassName(const ServiceDescriptor* service) {
return service->name() + "Client";
}
std::string GetServerInterfaceName(const ServiceDescriptor* service) {
return "I" + service->name();
}
std::string GetServerClassName(const ServiceDescriptor* service) {
return service->name() + "Base";
}
@ -303,86 +294,6 @@ void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *se
out->Print("\n");
}
void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
out->Print("/// <summary>Client for $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
out->Print("[System.Obsolete(\"Client side interfaced will be removed "
"in the next release. Use client class directly.\")]\n");
out->Print("public interface $name$\n", "name",
GetClientInterfaceName(service));
out->Print("{\n");
out->Indent();
for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor *method = service->method(i);
MethodType method_type = GetMethodType(method);
if (method_type == METHODTYPE_NO_STREAMING) {
// unary calls have an extra synchronous stub method
GenerateDocCommentBody(out, method);
out->Print(
"$response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n",
"methodname", method->name(), "request",
GetClassName(method->input_type()), "response",
GetClassName(method->output_type()));
// overload taking CallOptions as a param
GenerateDocCommentBody(out, method);
out->Print(
"$response$ $methodname$($request$ request, CallOptions options);\n",
"methodname", method->name(), "request",
GetClassName(method->input_type()), "response",
GetClassName(method->output_type()));
}
std::string method_name = method->name();
if (method_type == METHODTYPE_NO_STREAMING) {
method_name += "Async"; // prevent name clash with synchronous method.
}
GenerateDocCommentBody(out, method);
out->Print(
"$returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n",
"methodname", method_name, "request_maybe",
GetMethodRequestParamMaybe(method), "returntype",
GetMethodReturnTypeClient(method));
// overload taking CallOptions as a param
GenerateDocCommentBody(out, method);
out->Print(
"$returntype$ $methodname$($request_maybe$CallOptions options);\n",
"methodname", method_name, "request_maybe",
GetMethodRequestParamMaybe(method), "returntype",
GetMethodReturnTypeClient(method));
}
out->Outdent();
out->Print("}\n");
out->Print("\n");
}
void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) {
out->Print("/// <summary>Interface of server-side implementations of $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
out->Print("[System.Obsolete(\"Service implementations should inherit"
" from the generated abstract base class instead.\")]\n");
out->Print("public interface $name$\n", "name",
GetServerInterfaceName(service));
out->Print("{\n");
out->Indent();
for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor *method = service->method(i);
GenerateDocCommentBody(out, method);
out->Print(
"$returntype$ $methodname$($request$$response_stream_maybe$, "
"ServerCallContext context);\n",
"methodname", method->name(), "returntype",
GetMethodReturnTypeServer(method), "request",
GetMethodRequestParamServer(method), "response_stream_maybe",
GetMethodResponseStreamMaybe(method));
}
out->Outdent();
out->Print("}\n");
out->Print("\n");
}
void GenerateServerClass(Printer* out, const ServiceDescriptor *service) {
out->Print("/// <summary>Base class for server-side implementations of $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
@ -415,12 +326,9 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor *service) {
void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
out->Print("/// <summary>Client for $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
out->Print("#pragma warning disable 0618\n");
out->Print(
"public class $name$ : ClientBase<$name$>, $interface$\n",
"name", GetClientClassName(service),
"interface", GetClientInterfaceName(service));
out->Print("#pragma warning restore 0618\n");
"public class $name$ : ClientBase<$name$>\n",
"name", GetClientClassName(service));
out->Print("{\n");
out->Indent();
@ -547,22 +455,16 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
out->Print("\n");
}
void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service,
bool use_server_class) {
void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service) {
out->Print(
"/// <summary>Creates service definition that can be registered with a server</summary>\n");
out->Print("#pragma warning disable 0618\n");
out->Print(
"public static ServerServiceDefinition BindService($interface$ serviceImpl)\n",
"interface", use_server_class ? GetServerClassName(service) :
GetServerInterfaceName(service));
out->Print("#pragma warning restore 0618\n");
"public static ServerServiceDefinition BindService($implclass$ serviceImpl)\n",
"implclass", GetServerClassName(service));
out->Print("{\n");
out->Indent();
out->Print(
"return ServerServiceDefinition.CreateBuilder($servicenamefield$)\n",
"servicenamefield", GetServiceNameFieldName());
out->Print("return ServerServiceDefinition.CreateBuilder()\n");
out->Indent();
out->Indent();
for (int i = 0; i < service->method_count(); i++) {
@ -617,11 +519,7 @@ void GenerateService(Printer* out, const ServiceDescriptor *service,
}
GenerateServiceDescriptorProperty(out, service);
if (generate_client) {
GenerateClientInterface(out, service);
}
if (generate_server) {
GenerateServerInterface(out, service);
GenerateServerClass(out, service);
}
if (generate_client) {
@ -629,8 +527,7 @@ void GenerateService(Printer* out, const ServiceDescriptor *service,
GenerateNewStubMethods(out, service);
}
if (generate_server) {
GenerateBindServiceMethod(out, service, false);
GenerateBindServiceMethod(out, service, true);
GenerateBindServiceMethod(out, service);
}
out->Outdent();
@ -659,7 +556,7 @@ grpc::string GetServices(const FileDescriptor *file, bool generate_client,
out.Print("// source: $filename$\n", "filename", file->name());
// use C++ style as there are no file-level XML comments in .NET
grpc::string leading_comments = GetCppComments(file, true);
grpc::string leading_comments = GetCsharpComments(file, true);
if (!leading_comments.empty()) {
out.Print("// Original file comments:\n");
out.Print(leading_comments.c_str());

@ -45,6 +45,13 @@ inline bool ServicesFilename(const grpc::protobuf::FileDescriptor *file,
return true;
}
// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in in front of leading comments.
template <typename DescriptorType>
inline grpc::string GetCsharpComments(const DescriptorType *desc, bool leading) {
return grpc_generator::GetPrefixedComments(desc, leading, "//");
}
} // namespace grpc_csharp_generator
#endif // GRPC_INTERNAL_COMPILER_CSHARP_GENERATOR_HELPERS_H

@ -253,7 +253,8 @@ inline void GetComment(const grpc::protobuf::FileDescriptor *desc,
inline grpc::string GenerateCommentsWithPrefix(
const std::vector<grpc::string> &in, const grpc::string &prefix) {
std::ostringstream oss;
for (const grpc::string &elem : in) {
for (auto it = in.begin(); it != in.end(); it++) {
const grpc::string& elem = *it;
if (elem.empty()) {
oss << prefix << "\n";
} else if (elem[0] == ' ') {
@ -265,10 +266,10 @@ inline grpc::string GenerateCommentsWithPrefix(
return oss.str();
}
// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in in front of leading comments.
template <typename DescriptorType>
inline grpc::string GetCppComments(const DescriptorType *desc, bool leading) {
inline grpc::string GetPrefixedComments(const DescriptorType *desc,
bool leading,
const grpc::string &prefix) {
std::vector<grpc::string> out;
if (leading) {
grpc_generator::GetComment(
@ -281,7 +282,7 @@ inline grpc::string GetCppComments(const DescriptorType *desc, bool leading) {
grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING,
&out);
}
return GenerateCommentsWithPrefix(out, "//");
return GenerateCommentsWithPrefix(out, prefix);
}
} // namespace grpc_generator

@ -74,8 +74,16 @@ grpc::string GetJSMessageFilename(const grpc::string& filename) {
// 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(), '/');
grpc::string GetRootPath(const grpc::string& from_filename,
const grpc::string& to_filename) {
if (to_filename.find("google/protobuf") == 0) {
// Well-known types (.proto files in the google/protobuf directory) are
// assumed to come from the 'google-protobuf' npm package. We may want to
// generalize this exception later by letting others put generated code in
// their own npm packages.
return "google-protobuf/";
}
size_t slashes = std::count(from_filename.begin(), from_filename.end(), '/');
if (slashes == 0) {
return "./";
}
@ -90,7 +98,7 @@ grpc::string GetRootPath(const grpc::string& filename) {
// 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;
return GetRootPath(from_file, to_file) + to_file;
}
/* Finds all message types used in all services in the file, and returns them
@ -181,62 +189,67 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) {
// Prints out the service descriptor object
void PrintService(const ServiceDescriptor *service, Printer *out) {
map<grpc::string, grpc::string> template_vars;
out->Print(GetNodeComments(service, true).c_str());
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(GetNodeComments(service->method(i), true).c_str());
out->Print("$method_name$: ",
"method_name", method_name);
PrintMethod(service->method(i), out);
out->Print(",\n");
out->Print(GetNodeComments(service->method(i), false).c_str());
}
out->Outdent();
out->Print("};\n\n");
out->Print(template_vars, "exports.$name$Client = "
"grpc.makeGenericClientConstructor($name$Service);\n");
out->Print(GetNodeComments(service, false).c_str());
}
}
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");
void PrintImports(const FileDescriptor *file, Printer *out) {
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);
}
out.Print("'use strict';\n");
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");
}
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);
}
void PrintTransformers(const FileDescriptor *file, Printer *out) {
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");
}
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");
void PrintServices(const FileDescriptor *file, Printer *out) {
for (int i = 0; i < file->service_count(); i++) {
PrintService(file->service(i), out);
}
return output;
}
grpc::string GetTransformers(const FileDescriptor *file) {
}
grpc::string GenerateFile(const FileDescriptor *file) {
grpc::string output;
{
StringOutputStream output_stream(&output);
@ -245,31 +258,23 @@ grpc::string GetTransformers(const FileDescriptor *file) {
if (file->service_count() == 0) {
return output;
}
out.Print("// GENERATED CODE -- DO NOT EDIT!\n\n");
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);
grpc::string leading_comments = GetNodeComments(file, true);
if (!leading_comments.empty()) {
out.Print("// Original file comments:\n");
out.Print(leading_comments.c_str());
}
out.Print("\n");
}
return output;
}
grpc::string GetServices(const FileDescriptor *file) {
grpc::string output;
{
StringOutputStream output_stream(&output);
Printer out(&output_stream, '$');
out.Print("'use strict';\n");
if (file->service_count() == 0) {
return output;
}
PrintImports(file, &out);
for (int i = 0; i < file->service_count(); i++) {
PrintService(file->service(i), &out);
}
PrintTransformers(file, &out);
PrintServices(file, &out);
out.Print(GetNodeComments(file, false).c_str());
}
return output;
}

@ -38,11 +38,7 @@
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);
grpc::string GenerateFile(const grpc::protobuf::FileDescriptor *file);
} // namespace grpc_node_generator

@ -45,6 +45,13 @@ inline grpc::string GetJSServiceFilename(const grpc::string& filename) {
return grpc_generator::StripProto(filename) + "_grpc_pb.js";
}
// Get leading or trailing comments in a string. Comment lines start with "// ".
// Leading detached comments are put in in front of leading comments.
template <typename DescriptorType>
inline grpc::string GetNodeComments(const DescriptorType *desc, bool leading) {
return grpc_generator::GetPrefixedComments(desc, leading, "//");
}
} // namespace grpc_node_generator
#endif // GRPC_INTERNAL_COMPILER_NODE_GENERATOR_HELPERS_H

@ -39,10 +39,8 @@
#include "src/compiler/node_generator.h"
#include "src/compiler/node_generator_helpers.h"
using grpc_node_generator::GetImports;
using grpc_node_generator::GenerateFile;
using grpc_node_generator::GetJSServiceFilename;
using grpc_node_generator::GetServices;
using grpc_node_generator::GetTransformers;
class NodeGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
public:
@ -53,9 +51,7 @@ class NodeGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
const grpc::string &parameter,
grpc::protobuf::compiler::GeneratorContext *context,
grpc::string *error) const {
grpc::string code = GetImports(file) +
GetTransformers(file) +
GetServices(file);
grpc::string code = GenerateFile(file);
if (code.size() == 0) {
return true;
}

@ -60,9 +60,34 @@ void PrintProtoRpcDeclarationAsPragma(Printer *printer,
" returns ($server_stream$$response_type$)\n\n");
}
template <typename DescriptorType>
static void PrintAllComments(const DescriptorType* desc, Printer* printer) {
std::vector<grpc::string> comments;
grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING_DETACHED,
&comments);
grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_LEADING,
&comments);
grpc_generator::GetComment(desc, grpc_generator::COMMENTTYPE_TRAILING,
&comments);
if (comments.empty()) {
return;
}
printer->Print("/**\n");
for (auto it = comments.begin(); it != comments.end(); ++it) {
printer->Print(" * ");
size_t start_pos = it->find_first_not_of(' ');
if (start_pos != grpc::string::npos) {
printer->Print(it->c_str() + start_pos);
}
printer->Print("\n");
}
printer->Print(" */\n");
}
void PrintMethodSignature(Printer *printer, const MethodDescriptor *method,
const map< ::grpc::string, ::grpc::string> &vars) {
// TODO(jcanizales): Print method comments.
// Print comment
PrintAllComments(method, printer);
printer->Print(vars, "- ($return_type$)$method_name$With");
if (method->client_streaming()) {
@ -94,7 +119,7 @@ void PrintSimpleSignature(Printer *printer, const MethodDescriptor *method,
void PrintAdvancedSignature(Printer *printer, const MethodDescriptor *method,
map< ::grpc::string, ::grpc::string> vars) {
vars["method_name"] = "RPCTo" + vars["method_name"];
vars["return_type"] = "ProtoRPC *";
vars["return_type"] = "GRPCProtoCall *";
PrintMethodSignature(printer, method, vars);
}
@ -195,11 +220,13 @@ void PrintMethodImplementations(Printer *printer,
printer.Print("@end\n\n");
printer.Print(
"// Basic service implementation, over gRPC, that only does"
" marshalling and parsing.\n");
"/**\n"
" * Basic service implementation, over gRPC, that only does\n"
" * marshalling and parsing.\n"
" */\n");
printer.Print(vars,
"@interface $service_class$ :"
" ProtoService<$service_class$>\n");
" GRPCProtoService<$service_class$>\n");
printer.Print(
"- (instancetype)initWithHost:(NSString *)host"
" NS_DESIGNATED_INITIALIZER;\n");
@ -220,18 +247,13 @@ void PrintMethodImplementations(Printer *printer,
{"service_class", ServiceClassName(service)},
{"package", service->file()->package()}};
printer.Print(vars,
"static NSString *const kPackageName = @\"$package$\";\n");
printer.Print(
vars, "static NSString *const kServiceName = @\"$service_name$\";\n\n");
printer.Print(vars, "@implementation $service_class$\n\n");
printer.Print("// Designated initializer\n");
printer.Print("- (instancetype)initWithHost:(NSString *)host {\n");
printer.Print(
printer.Print(vars,
" return (self = [super initWithHost:host"
" packageName:kPackageName serviceName:kServiceName]);\n");
" packageName:@\"$package$\" serviceName:@\"$service_name$\"]);\n");
printer.Print("}\n\n");
printer.Print(
"// Override superclass initializer to disallow different"

@ -342,7 +342,7 @@ bool PrintBetaServerFactory(const grpc::string& package_qualified_service_name,
out->Print("}\n");
out->Print("method_implementations = {\n");
for (auto name_and_implementation_constructor =
method_implementation_constructors.begin();
method_implementation_constructors.begin();
name_and_implementation_constructor !=
method_implementation_constructors.end();
name_and_implementation_constructor++) {
@ -457,8 +457,149 @@ bool PrintBetaStubFactory(const grpc::string& package_qualified_service_name,
return true;
}
bool PrintStub(const grpc::string& package_qualified_service_name,
const ServiceDescriptor* service, Printer* out) {
out->Print("\n\n");
out->Print("class $Service$Stub(object):\n", "Service", service->name());
{
IndentScope raii_class_indent(out);
PrintAllComments(service, out);
out->Print("\n");
out->Print("def __init__(self, channel):\n");
{
IndentScope raii_init_indent(out);
out->Print("\"\"\"Constructor.\n");
out->Print("\n");
out->Print("Args:\n");
{
IndentScope raii_args_indent(out);
out->Print("channel: A grpc.Channel.\n");
}
out->Print("\"\"\"\n");
for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
auto multi_callable_constructor =
grpc::string(method->client_streaming() ? "stream" : "unary") +
"_" +
grpc::string(method->server_streaming() ? "stream" : "unary");
grpc::string request_module_and_class;
if (!GetModuleAndMessagePath(method->input_type(), service,
&request_module_and_class)) {
return false;
}
grpc::string response_module_and_class;
if (!GetModuleAndMessagePath(method->output_type(), service,
&response_module_and_class)) {
return false;
}
out->Print("self.$Method$ = channel.$MultiCallableConstructor$(\n",
"Method", method->name(),
"MultiCallableConstructor", multi_callable_constructor);
{
IndentScope raii_first_attribute_indent(out);
IndentScope raii_second_attribute_indent(out);
out->Print(
"'/$PackageQualifiedService$/$Method$',\n",
"PackageQualifiedService", package_qualified_service_name,
"Method", method->name());
out->Print(
"request_serializer=$RequestModuleAndClass$.SerializeToString,\n",
"RequestModuleAndClass", request_module_and_class);
out->Print(
"response_deserializer=$ResponseModuleAndClass$.FromString,\n",
"ResponseModuleAndClass", response_module_and_class);
out->Print(")\n");
}
}
}
}
return true;
}
bool PrintServicer(const ServiceDescriptor* service, Printer* out) {
out->Print("\n\n");
out->Print("class $Service$Servicer(object):\n", "Service", service->name());
{
IndentScope raii_class_indent(out);
PrintAllComments(service, out);
for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
grpc::string arg_name = method->client_streaming() ?
"request_iterator" : "request";
out->Print("\n");
out->Print("def $Method$(self, $ArgName$, context):\n",
"Method", method->name(), "ArgName", arg_name);
{
IndentScope raii_method_indent(out);
PrintAllComments(method, out);
out->Print("context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n");
out->Print("context.set_details('Method not implemented!')\n");
out->Print("raise NotImplementedError('Method not implemented!')\n");
}
}
}
return true;
}
bool PrintAddServicerToServer(const grpc::string& package_qualified_service_name,
const ServiceDescriptor* service, Printer* out) {
out->Print("\n\n");
out->Print("def add_$Service$Servicer_to_server(servicer, server):\n",
"Service", service->name());
{
IndentScope raii_class_indent(out);
out->Print("rpc_method_handlers = {\n");
{
IndentScope raii_dict_first_indent(out);
IndentScope raii_dict_second_indent(out);
for (int i = 0; i < service->method_count(); ++i) {
auto method = service->method(i);
auto method_handler_constructor =
grpc::string(method->client_streaming() ? "stream" : "unary") +
"_" +
grpc::string(method->server_streaming() ? "stream" : "unary") +
"_rpc_method_handler";
grpc::string request_module_and_class;
if (!GetModuleAndMessagePath(method->input_type(), service,
&request_module_and_class)) {
return false;
}
grpc::string response_module_and_class;
if (!GetModuleAndMessagePath(method->output_type(), service,
&response_module_and_class)) {
return false;
}
out->Print("'$Method$': grpc.$MethodHandlerConstructor$(\n",
"Method", method->name(),
"MethodHandlerConstructor", method_handler_constructor);
{
IndentScope raii_call_first_indent(out);
IndentScope raii_call_second_indent(out);
out->Print("servicer.$Method$,\n", "Method", method->name());
out->Print("request_deserializer=$RequestModuleAndClass$.FromString,\n",
"RequestModuleAndClass", request_module_and_class);
out->Print("response_serializer=$ResponseModuleAndClass$.SerializeToString,\n",
"ResponseModuleAndClass", response_module_and_class);
}
out->Print("),\n");
}
}
out->Print("}\n");
out->Print("generic_handler = grpc.method_handlers_generic_handler(\n");
{
IndentScope raii_call_first_indent(out);
IndentScope raii_call_second_indent(out);
out->Print("'$PackageQualifiedServiceName$', rpc_method_handlers)\n",
"PackageQualifiedServiceName", package_qualified_service_name);
}
out->Print("server.add_generic_rpc_handlers((generic_handler,))\n");
}
return true;
}
bool PrintPreamble(const FileDescriptor* file,
const GeneratorConfiguration& config, Printer* out) {
out->Print("import $Package$\n", "Package", config.grpc_package_root);
out->Print("from $Package$ import implementations as beta_implementations\n",
"Package", config.beta_package_root);
out->Print("from $Package$ import interfaces as beta_interfaces\n",
@ -487,7 +628,10 @@ pair<bool, grpc::string> GetServices(const FileDescriptor* file,
for (int i = 0; i < file->service_count(); ++i) {
auto service = file->service(i);
auto package_qualified_service_name = package + service->name();
if (!(PrintBetaServicer(service, &out) &&
if (!(PrintStub(package_qualified_service_name, service, &out) &&
PrintServicer(service, &out) &&
PrintAddServicerToServer(package_qualified_service_name, service, &out) &&
PrintBetaServicer(service, &out) &&
PrintBetaStub(service, &out) &&
PrintBetaServerFactory(package_qualified_service_name, service, &out) &&
PrintBetaStubFactory(package_qualified_service_name, service, &out))) {

@ -43,6 +43,7 @@ namespace grpc_python_generator {
// Data pertaining to configuration of the generator with respect to anything
// that may be used internally at Google.
struct GeneratorConfiguration {
grpc::string grpc_package_root;
grpc::string beta_package_root;
};

@ -38,6 +38,7 @@
int main(int argc, char* argv[]) {
grpc_python_generator::GeneratorConfiguration config;
config.grpc_package_root = "grpc";
config.beta_package_root = "grpc.beta";
grpc_python_generator::PythonGrpcGenerator generator(config);
return grpc::protobuf::compiler::PluginMain(argc, argv, &generator);

@ -66,7 +66,9 @@ void PrintMethod(const MethodDescriptor *method, const grpc::string &package,
std::map<grpc::string, grpc::string> method_vars =
ListToDict({"mth.name", method->name(), "input.type", input_type,
"output.type", output_type, });
out->Print(GetRubyComments(method, true).c_str());
out->Print(method_vars, "rpc :$mth.name$, $input.type$, $output.type$\n");
out->Print(GetRubyComments(method, false).c_str());
}
// Prints out the service using the ruby gRPC DSL.
@ -82,12 +84,7 @@ void PrintService(const ServiceDescriptor *service, const grpc::string &package,
out->Print(module_vars, "module $module.name$\n");
out->Indent();
// TODO(temiola): add documentation
grpc::string doc = "TODO: add proto service documentation here";
std::map<grpc::string, grpc::string> template_vars =
ListToDict({"Documentation", doc, });
out->Print("\n");
out->Print(template_vars, "# $Documentation$\n");
out->Print(GetRubyComments(service, true).c_str());
out->Print("class Service\n");
// Write the indented class body.
@ -113,6 +110,7 @@ void PrintService(const ServiceDescriptor *service, const grpc::string &package,
// End the service module
out->Outdent();
out->Print("end\n");
out->Print(GetRubyComments(service, false).c_str());
}
} // namespace
@ -138,6 +136,12 @@ grpc::string GetServices(const FileDescriptor *file) {
out.Print(header_comment_vars,
"# Source: $file.name$ for package '$file.package$'\n");
grpc::string leading_comments = GetRubyComments(file, true);
if (!leading_comments.empty()) {
out.Print("# Original file comments:\n");
out.Print(leading_comments.c_str());
}
out.Print("\n");
out.Print("require 'grpc'\n");
// Write out require statemment to import the separately generated file
@ -164,6 +168,8 @@ grpc::string GetServices(const FileDescriptor *file) {
out.Outdent();
out.Print("end\n");
}
out.Print(GetRubyComments(file, false).c_str());
}
return output;
}

@ -35,6 +35,7 @@
#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
#include "src/compiler/config.h"
#include "src/compiler/generator_helpers.h"
#include "src/compiler/ruby_generator_string-inl.h"
namespace grpc_ruby_generator {
@ -60,6 +61,13 @@ inline grpc::string MessagesRequireName(
return Replace(file->name(), ".proto", "");
}
// Get leading or trailing comments in a string. Comment lines start with "# ".
// Leading detached comments are put in in front of leading comments.
template <typename DescriptorType>
inline grpc::string GetRubyComments(const DescriptorType *desc, bool leading) {
return grpc_generator::GetPrefixedComments(desc, leading, "#");
}
} // namespace grpc_ruby_generator
#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H

@ -91,14 +91,14 @@ static void client_start_transport_op(grpc_exec_ctx *exec_ctx,
}
static void server_on_done_recv(grpc_exec_ctx *exec_ctx, void *ptr,
bool success) {
grpc_error *error) {
grpc_call_element *elem = ptr;
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
if (success) {
if (error == GRPC_ERROR_NONE) {
extract_and_annotate_method_tag(calld->recv_initial_metadata, calld, chand);
}
calld->on_done_recv->cb(exec_ctx, calld->on_done_recv->cb_arg, success);
calld->on_done_recv->cb(exec_ctx, calld->on_done_recv->cb_arg, error);
}
static void server_mutate_op(grpc_call_element *elem,
@ -134,7 +134,9 @@ static void client_init_call_elem(grpc_exec_ctx *exec_ctx,
}
static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem, void *ignored) {
grpc_call_element *elem,
const grpc_call_stats *stats,
void *ignored) {
call_data *d = elem->call_data;
GPR_ASSERT(d != NULL);
/* TODO(hongyu): record rpc client stats and census_rpc_end_op here */
@ -152,7 +154,9 @@ static void server_init_call_elem(grpc_exec_ctx *exec_ctx,
}
static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem, void *ignored) {
grpc_call_element *elem,
const grpc_call_stats *stats,
void *ignored) {
call_data *d = elem->call_data;
GPR_ASSERT(d != NULL);
/* TODO(hongyu): record rpc server stats and census_tracing_end_op here */
@ -176,7 +180,7 @@ const grpc_channel_filter grpc_client_census_filter = {
grpc_channel_next_op,
sizeof(call_data),
client_init_call_elem,
grpc_call_stack_ignore_set_pollset,
grpc_call_stack_ignore_set_pollset_or_pollset_set,
client_destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
@ -189,7 +193,7 @@ const grpc_channel_filter grpc_server_census_filter = {
grpc_channel_next_op,
sizeof(call_data),
server_init_call_elem,
grpc_call_stack_ignore_set_pollset,
grpc_call_stack_ignore_set_pollset_or_pollset_set,
server_destroy_call_elem,
sizeof(channel_data),
init_channel_elem,

@ -62,7 +62,7 @@ grpc_connectivity_state grpc_channel_check_connectivity_state(
"not a (u)client channel, but '%s'",
client_channel_elem->filter->name);
grpc_exec_ctx_finish(&exec_ctx);
return GRPC_CHANNEL_FATAL_FAILURE;
return GRPC_CHANNEL_SHUTDOWN;
}
typedef enum {
@ -75,7 +75,6 @@ typedef enum {
typedef struct {
gpr_mu mu;
callback_phase phase;
int success;
grpc_closure on_complete;
grpc_timer alarm;
grpc_connectivity_state state;
@ -122,7 +121,7 @@ static void finished_completion(grpc_exec_ctx *exec_ctx, void *pw,
}
static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
int due_to_completion) {
bool due_to_completion, grpc_error *error) {
int delete = 0;
if (due_to_completion) {
@ -130,14 +129,26 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
}
gpr_mu_lock(&w->mu);
if (due_to_completion) {
w->success = 1;
if (grpc_trace_operation_failures) {
GRPC_LOG_IF_ERROR("watch_completion_error", GRPC_ERROR_REF(error));
}
GRPC_ERROR_UNREF(error);
error = GRPC_ERROR_NONE;
} else {
if (error == GRPC_ERROR_NONE) {
error =
GRPC_ERROR_CREATE("Timed out waiting for connection state change");
} else if (error == GRPC_ERROR_CANCELLED) {
error = GRPC_ERROR_NONE;
}
}
switch (w->phase) {
case WAITING:
w->phase = CALLING_BACK;
grpc_cq_end_op(exec_ctx, w->cq, w->tag, w->success, finished_completion,
w, &w->completion_storage);
grpc_cq_end_op(exec_ctx, w->cq, w->tag, GRPC_ERROR_REF(error),
finished_completion, w, &w->completion_storage);
break;
case CALLING_BACK:
w->phase = CALLING_BACK_AND_FINISHED;
@ -153,14 +164,18 @@ static void partly_done(grpc_exec_ctx *exec_ctx, state_watcher *w,
if (delete) {
delete_state_watcher(exec_ctx, w);
}
GRPC_ERROR_UNREF(error);
}
static void watch_complete(grpc_exec_ctx *exec_ctx, void *pw, bool success) {
partly_done(exec_ctx, pw, 1);
static void watch_complete(grpc_exec_ctx *exec_ctx, void *pw,
grpc_error *error) {
partly_done(exec_ctx, pw, true, GRPC_ERROR_REF(error));
}
static void timeout_complete(grpc_exec_ctx *exec_ctx, void *pw, bool success) {
partly_done(exec_ctx, pw, 0);
static void timeout_complete(grpc_exec_ctx *exec_ctx, void *pw,
grpc_error *error) {
partly_done(exec_ctx, pw, false, GRPC_ERROR_REF(error));
}
void grpc_channel_watch_connectivity_state(
@ -185,7 +200,6 @@ void grpc_channel_watch_connectivity_state(
grpc_closure_init(&w->on_complete, watch_complete, w);
w->phase = WAITING;
w->state = last_observed_state;
w->success = 0;
w->cq = cq;
w->tag = tag;
w->channel = channel;

@ -117,9 +117,10 @@ static void watch_lb_policy(grpc_exec_ctx *exec_ctx, channel_data *chand,
static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx,
channel_data *chand,
grpc_connectivity_state state,
grpc_error *error,
const char *reason) {
if ((state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
state == GRPC_CHANNEL_FATAL_FAILURE) &&
state == GRPC_CHANNEL_SHUTDOWN) &&
chand->lb_policy != NULL) {
/* cancel fail-fast picks */
grpc_lb_policy_cancel_picks(
@ -127,35 +128,36 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx,
/* mask= */ GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY,
/* check= */ 0);
}
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state, reason);
grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state, error,
reason);
}
static void on_lb_policy_state_changed_locked(
grpc_exec_ctx *exec_ctx, lb_policy_connectivity_watcher *w) {
static void on_lb_policy_state_changed_locked(grpc_exec_ctx *exec_ctx,
lb_policy_connectivity_watcher *w,
grpc_error *error) {
grpc_connectivity_state publish_state = w->state;
/* check if the notification is for a stale policy */
if (w->lb_policy != w->chand->lb_policy) return;
if (publish_state == GRPC_CHANNEL_FATAL_FAILURE &&
w->chand->resolver != NULL) {
if (publish_state == GRPC_CHANNEL_SHUTDOWN && w->chand->resolver != NULL) {
publish_state = GRPC_CHANNEL_TRANSIENT_FAILURE;
grpc_resolver_channel_saw_error(exec_ctx, w->chand->resolver);
GRPC_LB_POLICY_UNREF(exec_ctx, w->chand->lb_policy, "channel");
w->chand->lb_policy = NULL;
}
set_channel_connectivity_state_locked(exec_ctx, w->chand, publish_state,
"lb_changed");
if (w->state != GRPC_CHANNEL_FATAL_FAILURE) {
GRPC_ERROR_REF(error), "lb_changed");
if (w->state != GRPC_CHANNEL_SHUTDOWN) {
watch_lb_policy(exec_ctx, w->chand, w->lb_policy, w->state);
}
}
static void on_lb_policy_state_changed(grpc_exec_ctx *exec_ctx, void *arg,
bool iomgr_success) {
grpc_error *error) {
lb_policy_connectivity_watcher *w = arg;
gpr_mu_lock(&w->chand->mu_config);
on_lb_policy_state_changed_locked(exec_ctx, w);
on_lb_policy_state_changed_locked(exec_ctx, w, error);
gpr_mu_unlock(&w->chand->mu_config);
GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack, "watch_lb_policy");
@ -177,19 +179,22 @@ static void watch_lb_policy(grpc_exec_ctx *exec_ctx, channel_data *chand,
}
static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
bool iomgr_success) {
grpc_error *error) {
channel_data *chand = arg;
grpc_lb_policy *lb_policy = NULL;
grpc_lb_policy *old_lb_policy;
grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE;
int exit_idle = 0;
grpc_error *state_error = GRPC_ERROR_CREATE("No load balancing policy");
if (chand->incoming_configuration != NULL) {
lb_policy = grpc_client_config_get_lb_policy(chand->incoming_configuration);
if (lb_policy != NULL) {
GRPC_LB_POLICY_REF(lb_policy, "channel");
GRPC_LB_POLICY_REF(lb_policy, "config_change");
state = grpc_lb_policy_check_connectivity(exec_ctx, lb_policy);
GRPC_ERROR_UNREF(state_error);
state =
grpc_lb_policy_check_connectivity(exec_ctx, lb_policy, &state_error);
}
grpc_client_config_unref(exec_ctx, chand->incoming_configuration);
@ -209,7 +214,9 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
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_closure_list_fail_all(
&chand->waiting_for_config_closures,
GRPC_ERROR_CREATE_REFERENCING("Channel disconnected", &error, 1));
grpc_exec_ctx_enqueue_list(exec_ctx, &chand->waiting_for_config_closures,
NULL);
}
@ -219,9 +226,9 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
chand->exit_idle_when_lb_policy_arrives = 0;
}
if (iomgr_success && chand->resolver) {
set_channel_connectivity_state_locked(exec_ctx, chand, state,
"new_lb+resolver");
if (error == GRPC_ERROR_NONE && chand->resolver) {
set_channel_connectivity_state_locked(
exec_ctx, chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver");
if (lb_policy != NULL) {
watch_lb_policy(exec_ctx, chand, lb_policy, state);
}
@ -236,8 +243,12 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
chand->resolver = NULL;
}
grpc_error *refs[] = {error, state_error};
set_channel_connectivity_state_locked(
exec_ctx, chand, GRPC_CHANNEL_FATAL_FAILURE, "resolver_gone");
exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_CREATE_REFERENCING("Got config after disconnection", refs,
GPR_ARRAY_SIZE(refs)),
"resolver_gone");
gpr_mu_unlock(&chand->mu_config);
}
@ -257,6 +268,7 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
}
GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver");
GRPC_ERROR_UNREF(state_error);
}
static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
@ -264,7 +276,7 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
grpc_transport_op *op) {
channel_data *chand = elem->channel_data;
grpc_exec_ctx_enqueue(exec_ctx, op->on_consumed, true, NULL);
grpc_exec_ctx_sched(exec_ctx, op->on_consumed, GRPC_ERROR_NONE, NULL);
GPR_ASSERT(op->set_accept_stream == false);
if (op->bind_pollset != NULL) {
@ -283,7 +295,9 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
if (op->send_ping != NULL) {
if (chand->lb_policy == NULL) {
grpc_exec_ctx_enqueue(exec_ctx, op->send_ping, false, NULL);
grpc_exec_ctx_sched(exec_ctx, op->send_ping,
GRPC_ERROR_CREATE("Ping with no load balancing"),
NULL);
} else {
grpc_lb_policy_ping_one(exec_ctx, chand->lb_policy, op->send_ping);
op->bind_pollset = NULL;
@ -291,24 +305,29 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
op->send_ping = NULL;
}
if (op->disconnect && chand->resolver != NULL) {
set_channel_connectivity_state_locked(
exec_ctx, chand, GRPC_CHANNEL_FATAL_FAILURE, "disconnect");
grpc_resolver_shutdown(exec_ctx, chand->resolver);
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
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) {
grpc_pollset_set_del_pollset_set(exec_ctx,
chand->lb_policy->interested_parties,
chand->interested_parties);
GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
chand->lb_policy = NULL;
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
if (chand->resolver != NULL) {
set_channel_connectivity_state_locked(
exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_REF(op->disconnect_with_error), "disconnect");
grpc_resolver_shutdown(exec_ctx, chand->resolver);
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
chand->resolver = NULL;
if (!chand->started_resolving) {
grpc_closure_list_fail_all(&chand->waiting_for_config_closures,
GRPC_ERROR_REF(op->disconnect_with_error));
grpc_exec_ctx_enqueue_list(exec_ctx,
&chand->waiting_for_config_closures, NULL);
}
if (chand->lb_policy != NULL) {
grpc_pollset_set_del_pollset_set(exec_ctx,
chand->lb_policy->interested_parties,
chand->interested_parties);
GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
chand->lb_policy = NULL;
}
}
GRPC_ERROR_UNREF(op->disconnect_with_error);
}
gpr_mu_unlock(&chand->mu_config);
}
@ -328,16 +347,17 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
grpc_connected_subchannel **connected_subchannel,
grpc_closure *on_ready);
static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
continue_picking_args *cpa = arg;
if (cpa->connected_subchannel == NULL) {
/* cancelled, do nothing */
} else if (!success) {
grpc_exec_ctx_enqueue(exec_ctx, cpa->on_ready, false, NULL);
} else if (error != GRPC_ERROR_NONE) {
grpc_exec_ctx_sched(exec_ctx, cpa->on_ready, GRPC_ERROR_REF(error), NULL);
} else if (cc_pick_subchannel(exec_ctx, cpa->elem, cpa->initial_metadata,
cpa->initial_metadata_flags,
cpa->connected_subchannel, cpa->on_ready)) {
grpc_exec_ctx_enqueue(exec_ctx, cpa->on_ready, true, NULL);
grpc_exec_ctx_sched(exec_ctx, cpa->on_ready, GRPC_ERROR_NONE, NULL);
}
gpr_free(cpa);
}
@ -362,11 +382,12 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
connected_subchannel);
}
for (closure = chand->waiting_for_config_closures.head; closure != NULL;
closure = grpc_closure_next(closure)) {
closure = closure->next_data.next) {
cpa = closure->cb_arg;
if (cpa->connected_subchannel == connected_subchannel) {
cpa->connected_subchannel = NULL;
grpc_exec_ctx_enqueue(exec_ctx, cpa->on_ready, false, NULL);
grpc_exec_ctx_sched(exec_ctx, cpa->on_ready,
GRPC_ERROR_CREATE("Pick cancelled"), NULL);
}
}
gpr_mu_unlock(&chand->mu_config);
@ -377,7 +398,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
int r;
GRPC_LB_POLICY_REF(lb_policy, "cc_pick_subchannel");
gpr_mu_unlock(&chand->mu_config);
r = grpc_lb_policy_pick(exec_ctx, lb_policy, calld->pollset,
r = grpc_lb_policy_pick(exec_ctx, lb_policy, calld->pollent,
initial_metadata, initial_metadata_flags,
connected_subchannel, on_ready);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "cc_pick_subchannel");
@ -398,10 +419,11 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
cpa->on_ready = on_ready;
cpa->elem = elem;
grpc_closure_init(&cpa->closure, continue_picking, cpa);
grpc_closure_list_add(&chand->waiting_for_config_closures, &cpa->closure,
1);
grpc_closure_list_append(&chand->waiting_for_config_closures, &cpa->closure,
GRPC_ERROR_NONE);
} else {
grpc_exec_ctx_enqueue(exec_ctx, on_ready, false, NULL);
grpc_exec_ctx_sched(exec_ctx, on_ready, GRPC_ERROR_CREATE("Disconnected"),
NULL);
}
gpr_mu_unlock(&chand->mu_config);
return 0;
@ -416,6 +438,7 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
/* Destructor for call_data */
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
const grpc_call_stats *stats,
void *and_free_memory) {
grpc_subchannel_call_holder_destroy(exec_ctx, elem->call_data);
gpr_free(and_free_memory);
@ -461,10 +484,11 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
gpr_mu_destroy(&chand->mu_config);
}
static void cc_set_pollset(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_pollset *pollset) {
static void cc_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_polling_entity *pollent) {
call_data *calld = elem->call_data;
calld->pollset = pollset;
calld->pollent = pollent;
}
const grpc_channel_filter grpc_client_channel_filter = {
@ -472,7 +496,7 @@ const grpc_channel_filter grpc_client_channel_filter = {
cc_start_transport_op,
sizeof(call_data),
init_call_elem,
cc_set_pollset,
cc_set_pollset_or_pollset_set,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
@ -506,7 +530,7 @@ grpc_connectivity_state grpc_client_channel_check_connectivity_state(
channel_data *chand = elem->channel_data;
grpc_connectivity_state out;
gpr_mu_lock(&chand->mu_config);
out = grpc_connectivity_state_check(&chand->state_tracker);
out = grpc_connectivity_state_check(&chand->state_tracker, NULL);
if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
if (chand->lb_policy != NULL) {
grpc_lb_policy_exit_idle(exec_ctx, chand->lb_policy);
@ -533,7 +557,7 @@ typedef struct {
} external_connectivity_watcher;
static void on_external_watch_complete(grpc_exec_ctx *exec_ctx, void *arg,
bool iomgr_success) {
grpc_error *error) {
external_connectivity_watcher *w = arg;
grpc_closure *follow_up = w->on_complete;
grpc_pollset_set_del_pollset(exec_ctx, w->chand->interested_parties,
@ -541,7 +565,7 @@ static void on_external_watch_complete(grpc_exec_ctx *exec_ctx, void *arg,
GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack,
"external_connectivity_watcher");
gpr_free(w);
follow_up->cb(exec_ctx, follow_up->cb_arg, iomgr_success);
follow_up->cb(exec_ctx, follow_up->cb_arg, error);
}
void grpc_client_channel_watch_connectivity_state(

@ -64,7 +64,7 @@ typedef struct {
grpc_transport *transport;
/** channel arguments (to be passed to the filters) */
const grpc_channel_args *channel_args;
grpc_channel_args *channel_args;
} grpc_connect_out_args;
struct grpc_connector_vtable {

@ -60,8 +60,9 @@ static gpr_atm ref_mutate(grpc_lb_policy *c, gpr_atm delta,
: gpr_atm_no_barrier_fetch_add(&c->ref_pair, delta);
#ifdef GRPC_LB_POLICY_REFCOUNT_DEBUG
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"LB_POLICY: %p % 12s 0x%08x -> 0x%08x [%s]", c, purpose, old_val,
old_val + delta, reason);
"LB_POLICY: 0x%" PRIxPTR " %12s 0x%" PRIxPTR " -> 0x%" PRIxPTR
" [%s]",
(intptr_t)c, purpose, old_val, old_val + delta, reason);
#endif
return old_val;
}
@ -99,12 +100,12 @@ void grpc_lb_policy_weak_unref(grpc_exec_ctx *exec_ctx,
}
int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
grpc_pollset *pollset,
grpc_polling_entity *pollent,
grpc_metadata_batch *initial_metadata,
uint32_t initial_metadata_flags,
grpc_connected_subchannel **target,
grpc_closure *on_complete) {
return policy->vtable->pick(exec_ctx, policy, pollset, initial_metadata,
return policy->vtable->pick(exec_ctx, policy, pollent, initial_metadata,
initial_metadata_flags, target, on_complete);
}
@ -138,6 +139,8 @@ void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
}
grpc_connectivity_state grpc_lb_policy_check_connectivity(
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy) {
return policy->vtable->check_connectivity(exec_ctx, policy);
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
grpc_error **connectivity_error) {
return policy->vtable->check_connectivity(exec_ctx, policy,
connectivity_error);
}

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

Loading…
Cancel
Save