Merge branch 'master' into sreek-doc

pull/14891/head
Sree Kuchibhotla 7 years ago
commit 1222efeb5a
  1. 5
      .clang-format
  2. 18
      BUILD
  3. 86
      CMakeLists.txt
  4. 2
      INSTALL.md
  5. 88
      Makefile
  6. 3
      PYTHON-MANIFEST.in
  7. 8
      bazel/grpc_deps.bzl
  8. 21
      build.yaml
  9. 4
      config.w32
  10. 1
      doc/g_stands_for.md
  11. 44
      examples/android/helloworld/app/CMakeLists.txt
  12. 63
      examples/cpp/helloworld/CMakeLists.txt
  13. 7
      gRPC-C++.podspec
  14. 964
      gRPC-Core.podspec
  15. 2
      gRPC-ProtoRPC.podspec
  16. 2
      gRPC-RxLibrary.podspec
  17. 2
      gRPC.podspec
  18. 7
      grpc.def
  19. 2
      grpc.gyp
  20. 70
      include/grpc/grpc_security.h
  21. 3
      include/grpc/impl/codegen/grpc_types.h
  22. 11
      include/grpc/impl/codegen/port_platform.h
  23. 4
      include/grpc/support/log.h
  24. 2
      include/grpcpp/client_context.h
  25. 46
      include/grpcpp/impl/codegen/byte_buffer.h
  26. 3
      include/grpcpp/impl/codegen/core_codegen.h
  27. 5
      include/grpcpp/impl/codegen/core_codegen_interface.h
  28. 151
      include/grpcpp/impl/codegen/proto_buffer_reader.h
  29. 167
      include/grpcpp/impl/codegen/proto_buffer_writer.h
  30. 219
      include/grpcpp/impl/codegen/proto_utils.h
  31. 4
      include/grpcpp/impl/codegen/server_context.h
  32. 13
      include/grpcpp/impl/codegen/server_interface.h
  33. 39
      include/grpcpp/impl/codegen/slice.h
  34. 16
      include/grpcpp/security/credentials.h
  35. 12
      include/grpcpp/security/server_credentials.h
  36. 24
      include/grpcpp/support/proto_buffer_reader.h
  37. 24
      include/grpcpp/support/proto_buffer_writer.h
  38. 4
      package.xml
  39. 3
      setup.py
  40. 9
      src/android/test/interop/.gitignore
  41. 37
      src/android/test/interop/README.md
  42. 1
      src/android/test/interop/app/.gitignore
  43. 119
      src/android/test/interop/app/CMakeLists.txt
  44. 56
      src/android/test/interop/app/build.gradle
  45. 21
      src/android/test/interop/app/proguard-rules.pro
  46. 93
      src/android/test/interop/app/src/androidTest/java/io/grpc/interop/cpp/InteropTest.java
  47. 22
      src/android/test/interop/app/src/main/AndroidManifest.xml
  48. 4475
      src/android/test/interop/app/src/main/assets/roots.pem
  49. 124
      src/android/test/interop/app/src/main/cpp/grpc-interop.cc
  50. 122
      src/android/test/interop/app/src/main/java/io/grpc/interop/cpp/InteropActivity.java
  51. 48
      src/android/test/interop/app/src/main/res/layout/activity_interop.xml
  52. BIN
      src/android/test/interop/app/src/main/res/mipmap-hdpi/ic_launcher.png
  53. BIN
      src/android/test/interop/app/src/main/res/mipmap-mdpi/ic_launcher.png
  54. BIN
      src/android/test/interop/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  55. BIN
      src/android/test/interop/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  56. 3
      src/android/test/interop/app/src/main/res/values/strings.xml
  57. 24
      src/android/test/interop/build.gradle
  58. 17
      src/android/test/interop/gradle.properties
  59. BIN
      src/android/test/interop/gradle/wrapper/gradle-wrapper.jar
  60. 6
      src/android/test/interop/gradle/wrapper/gradle-wrapper.properties
  61. 160
      src/android/test/interop/gradlew
  62. 90
      src/android/test/interop/gradlew.bat
  63. 1
      src/android/test/interop/settings.gradle
  64. 2
      src/compiler/objective_c_generator.cc
  65. 10
      src/compiler/objective_c_plugin.cc
  66. 27
      src/core/ext/filters/client_channel/client_channel.cc
  67. 1
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  68. 11
      src/core/ext/filters/http/client_authority_filter.cc
  69. 30
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  70. 3
      src/core/lib/debug/trace.cc
  71. 10
      src/core/lib/gpr/log.cc
  72. 4
      src/core/lib/gpr/log_android.cc
  73. 4
      src/core/lib/gpr/log_linux.cc
  74. 4
      src/core/lib/gpr/log_posix.cc
  75. 5
      src/core/lib/gpr/log_windows.cc
  76. 62
      src/core/lib/gprpp/inlined_vector.h
  77. 23
      src/core/lib/iomgr/ev_epollex_linux.cc
  78. 6
      src/core/lib/iomgr/ev_poll_posix.cc
  79. 11
      src/core/lib/iomgr/lockfree_event.h
  80. 24
      src/core/lib/iomgr/socket_utils_common_posix.cc
  81. 2
      src/core/lib/iomgr/socket_utils_linux.cc
  82. 6
      src/core/lib/iomgr/socket_utils_posix.cc
  83. 3
      src/core/lib/iomgr/socket_utils_posix.h
  84. 4
      src/core/lib/iomgr/socket_utils_uv.cc
  85. 2
      src/core/lib/iomgr/tcp_custom.h
  86. 7
      src/core/lib/iomgr/tcp_server_custom.cc
  87. 27
      src/core/lib/iomgr/tcp_server_posix.cc
  88. 1
      src/core/lib/iomgr/tcp_server_utils_posix_common.cc
  89. 1
      src/core/lib/iomgr/tcp_server_windows.cc
  90. 35
      src/core/lib/iomgr/tcp_uv.cc
  91. 10
      src/core/lib/iomgr/timer_generic.cc
  92. 102
      src/core/lib/iomgr/udp_server.cc
  93. 10
      src/core/lib/iomgr/udp_server.h
  94. 20
      src/core/lib/security/credentials/alts/alts_credentials.h
  95. 14
      src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc
  96. 39
      src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h
  97. 4
      src/core/lib/slice/slice.cc
  98. 8
      src/core/lib/slice/slice_buffer.cc
  99. 4
      src/core/lib/surface/call.cc
  100. 2
      src/core/lib/surface/version.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -3,5 +3,10 @@ Language: Cpp
BasedOnStyle: Google BasedOnStyle: Google
DerivePointerAlignment: false DerivePointerAlignment: false
PointerAlignment: Left PointerAlignment: Left
---
Language: ObjC
BasedOnStyle: Google
ColumnLimit: 100
ObjCBlockIndentWidth: 2
... ...

18
BUILD

@ -64,11 +64,11 @@ config_setting(
) )
# This should be updated along with build.yaml # This should be updated along with build.yaml
g_stands_for = "gorgeous" g_stands_for = "glorious"
core_version = "6.0.0-dev" core_version = "6.0.0-dev"
version = "1.11.0-dev" version = "1.12.0-dev"
GPR_PUBLIC_HDRS = [ GPR_PUBLIC_HDRS = [
"include/grpc/support/alloc.h", "include/grpc/support/alloc.h",
@ -141,7 +141,6 @@ GRPCXX_SRCS = [
"src/cpp/server/server_posix.cc", "src/cpp/server/server_posix.cc",
"src/cpp/thread_manager/thread_manager.cc", "src/cpp/thread_manager/thread_manager.cc",
"src/cpp/util/byte_buffer_cc.cc", "src/cpp/util/byte_buffer_cc.cc",
"src/cpp/util/slice_cc.cc",
"src/cpp/util/status.cc", "src/cpp/util/status.cc",
"src/cpp/util/string_ref.cc", "src/cpp/util/string_ref.cc",
"src/cpp/util/time_cc.cc", "src/cpp/util/time_cc.cc",
@ -245,6 +244,8 @@ GRPCXX_PUBLIC_HDRS = [
"include/grpcpp/support/byte_buffer.h", "include/grpcpp/support/byte_buffer.h",
"include/grpcpp/support/channel_arguments.h", "include/grpcpp/support/channel_arguments.h",
"include/grpcpp/support/config.h", "include/grpcpp/support/config.h",
"include/grpcpp/support/proto_buffer_reader.h",
"include/grpcpp/support/proto_buffer_writer.h",
"include/grpcpp/support/slice.h", "include/grpcpp/support/slice.h",
"include/grpcpp/support/status.h", "include/grpcpp/support/status.h",
"include/grpcpp/support/status_code_enum.h", "include/grpcpp/support/status_code_enum.h",
@ -307,16 +308,8 @@ grpc_cc_library(
language = "c++", language = "c++",
deps = [ deps = [
"grpc_base", "grpc_base",
"grpc_deadline_filter",
"grpc_http_filters", "grpc_http_filters",
"grpc_lb_policy_pick_first",
"grpc_max_age_filter",
"grpc_message_size_filter",
"grpc_resolver_dns_native",
"grpc_resolver_sockaddr",
"grpc_server_load_reporting",
"grpc_transport_chttp2_client_secure", "grpc_transport_chttp2_client_secure",
"grpc_transport_chttp2_server_secure",
"grpc_transport_cronet_client_secure", "grpc_transport_cronet_client_secure",
], ],
) )
@ -1715,6 +1708,7 @@ grpc_cc_library(
"src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h", "src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h",
"src/core/tsi/alts/handshaker/transport_security_common_api.h", "src/core/tsi/alts/handshaker/transport_security_common_api.h",
], ],
public_hdrs = GRPC_SECURE_PUBLIC_HDRS,
external_deps = [ external_deps = [
"nanopb", "nanopb",
], ],
@ -1879,6 +1873,8 @@ grpc_cc_library(
language = "c++", language = "c++",
public_hdrs = [ public_hdrs = [
"include/grpc++/impl/codegen/proto_utils.h", "include/grpc++/impl/codegen/proto_utils.h",
"include/grpcpp/impl/codegen/proto_buffer_reader.h",
"include/grpcpp/impl/codegen/proto_buffer_writer.h",
"include/grpcpp/impl/codegen/proto_utils.h", "include/grpcpp/impl/codegen/proto_utils.h",
], ],
deps = [ deps = [

@ -24,7 +24,7 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "grpc") set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "1.11.0-dev") set(PACKAGE_VERSION "1.12.0-dev")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
@ -1451,36 +1451,6 @@ add_library(grpc_cronet
src/core/lib/transport/transport.cc src/core/lib/transport/transport.cc
src/core/lib/transport/transport_op_string.cc src/core/lib/transport/transport_op_string.cc
src/core/lib/debug/trace.cc src/core/lib/debug/trace.cc
src/core/ext/filters/deadline/deadline_filter.cc
src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
src/core/ext/filters/client_channel/backup_poller.cc
src/core/ext/filters/client_channel/channel_connectivity.cc
src/core/ext/filters/client_channel/client_channel.cc
src/core/ext/filters/client_channel/client_channel_factory.cc
src/core/ext/filters/client_channel/client_channel_plugin.cc
src/core/ext/filters/client_channel/connector.cc
src/core/ext/filters/client_channel/http_connect_handshaker.cc
src/core/ext/filters/client_channel/http_proxy.cc
src/core/ext/filters/client_channel/lb_policy.cc
src/core/ext/filters/client_channel/lb_policy_factory.cc
src/core/ext/filters/client_channel/lb_policy_registry.cc
src/core/ext/filters/client_channel/method_params.cc
src/core/ext/filters/client_channel/parse_address.cc
src/core/ext/filters/client_channel/proxy_mapper.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver_registry.cc
src/core/ext/filters/client_channel/retry_throttle.cc
src/core/ext/filters/client_channel/subchannel.cc
src/core/ext/filters/client_channel/subchannel_index.cc
src/core/ext/filters/client_channel/uri_parser.cc
src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
src/core/ext/filters/max_age/max_age_filter.cc
src/core/ext/filters/message_size/message_size_filter.cc
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
src/core/ext/transport/cronet/transport/cronet_api_dummy.cc src/core/ext/transport/cronet/transport/cronet_api_dummy.cc
src/core/ext/transport/cronet/transport/cronet_transport.cc src/core/ext/transport/cronet/transport/cronet_transport.cc
@ -1512,6 +1482,28 @@ add_library(grpc_cronet
src/core/ext/filters/http/http_filters_plugin.cc src/core/ext/filters/http/http_filters_plugin.cc
src/core/ext/filters/http/message_compress/message_compress_filter.cc src/core/ext/filters/http/message_compress/message_compress_filter.cc
src/core/ext/filters/http/server/http_server_filter.cc src/core/ext/filters/http/server/http_server_filter.cc
src/core/ext/filters/client_channel/backup_poller.cc
src/core/ext/filters/client_channel/channel_connectivity.cc
src/core/ext/filters/client_channel/client_channel.cc
src/core/ext/filters/client_channel/client_channel_factory.cc
src/core/ext/filters/client_channel/client_channel_plugin.cc
src/core/ext/filters/client_channel/connector.cc
src/core/ext/filters/client_channel/http_connect_handshaker.cc
src/core/ext/filters/client_channel/http_proxy.cc
src/core/ext/filters/client_channel/lb_policy.cc
src/core/ext/filters/client_channel/lb_policy_factory.cc
src/core/ext/filters/client_channel/lb_policy_registry.cc
src/core/ext/filters/client_channel/method_params.cc
src/core/ext/filters/client_channel/parse_address.cc
src/core/ext/filters/client_channel/proxy_mapper.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver_registry.cc
src/core/ext/filters/client_channel/retry_throttle.cc
src/core/ext/filters/client_channel/subchannel.cc
src/core/ext/filters/client_channel/subchannel_index.cc
src/core/ext/filters/client_channel/uri_parser.cc
src/core/ext/filters/deadline/deadline_filter.cc
src/core/lib/http/httpcli_security_connector.cc src/core/lib/http/httpcli_security_connector.cc
src/core/lib/security/context/security_context.cc src/core/lib/security/context/security_context.cc
src/core/lib/security/credentials/alts/alts_credentials.cc src/core/lib/security/credentials/alts/alts_credentials.cc
@ -1585,8 +1577,8 @@ add_library(grpc_cronet
src/core/tsi/ssl/session_cache/ssl_session_openssl.cc src/core/tsi/ssl/session_cache/ssl_session_openssl.cc
src/core/tsi/ssl_transport_security.cc src/core/tsi/ssl_transport_security.cc
src/core/tsi/transport_security_grpc.cc src/core/tsi/transport_security_grpc.cc
src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
src/core/ext/transport/chttp2/server/chttp2_server.cc src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
src/core/plugin_registry/grpc_cronet_plugin_registry.cc src/core/plugin_registry/grpc_cronet_plugin_registry.cc
) )
@ -1646,20 +1638,9 @@ foreach(_hdr
include/grpc/impl/codegen/sync_generic.h include/grpc/impl/codegen/sync_generic.h
include/grpc/impl/codegen/sync_posix.h include/grpc/impl/codegen/sync_posix.h
include/grpc/impl/codegen/sync_windows.h include/grpc/impl/codegen/sync_windows.h
include/grpc/byte_buffer.h
include/grpc/byte_buffer_reader.h
include/grpc/compression.h
include/grpc/fork.h
include/grpc/grpc.h
include/grpc/grpc_posix.h
include/grpc/grpc_security_constants.h
include/grpc/load_reporting.h
include/grpc/slice.h
include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/support/workaround_list.h
include/grpc/grpc_cronet.h include/grpc/grpc_cronet.h
include/grpc/grpc_security.h include/grpc/grpc_security.h
include/grpc/grpc_security_constants.h
) )
string(REPLACE "include/" "" _path ${_hdr}) string(REPLACE "include/" "" _path ${_hdr})
get_filename_component(_path ${_path} PATH) get_filename_component(_path ${_path} PATH)
@ -2735,7 +2716,6 @@ add_library(grpc++
src/cpp/server/server_posix.cc src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc src/cpp/util/byte_buffer_cc.cc
src/cpp/util/slice_cc.cc
src/cpp/util/status.cc src/cpp/util/status.cc
src/cpp/util/string_ref.cc src/cpp/util/string_ref.cc
src/cpp/util/time_cc.cc src/cpp/util/time_cc.cc
@ -2860,6 +2840,8 @@ foreach(_hdr
include/grpcpp/support/byte_buffer.h include/grpcpp/support/byte_buffer.h
include/grpcpp/support/channel_arguments.h include/grpcpp/support/channel_arguments.h
include/grpcpp/support/config.h include/grpcpp/support/config.h
include/grpcpp/support/proto_buffer_reader.h
include/grpcpp/support/proto_buffer_writer.h
include/grpcpp/support/slice.h include/grpcpp/support/slice.h
include/grpcpp/support/status.h include/grpcpp/support/status.h
include/grpcpp/support/status_code_enum.h include/grpcpp/support/status_code_enum.h
@ -2978,6 +2960,8 @@ foreach(_hdr
include/grpcpp/impl/codegen/sync_stream.h include/grpcpp/impl/codegen/sync_stream.h
include/grpcpp/impl/codegen/time.h include/grpcpp/impl/codegen/time.h
include/grpc++/impl/codegen/proto_utils.h include/grpc++/impl/codegen/proto_utils.h
include/grpcpp/impl/codegen/proto_buffer_reader.h
include/grpcpp/impl/codegen/proto_buffer_writer.h
include/grpcpp/impl/codegen/proto_utils.h include/grpcpp/impl/codegen/proto_utils.h
include/grpc++/impl/codegen/config_protobuf.h include/grpc++/impl/codegen/config_protobuf.h
include/grpcpp/impl/codegen/config_protobuf.h include/grpcpp/impl/codegen/config_protobuf.h
@ -3086,7 +3070,6 @@ add_library(grpc++_cronet
src/cpp/server/server_posix.cc src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc src/cpp/util/byte_buffer_cc.cc
src/cpp/util/slice_cc.cc
src/cpp/util/status.cc src/cpp/util/status.cc
src/cpp/util/string_ref.cc src/cpp/util/string_ref.cc
src/cpp/util/time_cc.cc src/cpp/util/time_cc.cc
@ -3421,6 +3404,8 @@ foreach(_hdr
include/grpcpp/support/byte_buffer.h include/grpcpp/support/byte_buffer.h
include/grpcpp/support/channel_arguments.h include/grpcpp/support/channel_arguments.h
include/grpcpp/support/config.h include/grpcpp/support/config.h
include/grpcpp/support/proto_buffer_reader.h
include/grpcpp/support/proto_buffer_writer.h
include/grpcpp/support/slice.h include/grpcpp/support/slice.h
include/grpcpp/support/status.h include/grpcpp/support/status.h
include/grpcpp/support/status_code_enum.h include/grpcpp/support/status_code_enum.h
@ -3964,6 +3949,8 @@ foreach(_hdr
include/grpc/impl/codegen/sync_posix.h include/grpc/impl/codegen/sync_posix.h
include/grpc/impl/codegen/sync_windows.h include/grpc/impl/codegen/sync_windows.h
include/grpc++/impl/codegen/proto_utils.h include/grpc++/impl/codegen/proto_utils.h
include/grpcpp/impl/codegen/proto_buffer_reader.h
include/grpcpp/impl/codegen/proto_buffer_writer.h
include/grpcpp/impl/codegen/proto_utils.h include/grpcpp/impl/codegen/proto_utils.h
include/grpc++/impl/codegen/config_protobuf.h include/grpc++/impl/codegen/config_protobuf.h
include/grpcpp/impl/codegen/config_protobuf.h include/grpcpp/impl/codegen/config_protobuf.h
@ -4137,6 +4124,8 @@ foreach(_hdr
include/grpc/impl/codegen/sync_posix.h include/grpc/impl/codegen/sync_posix.h
include/grpc/impl/codegen/sync_windows.h include/grpc/impl/codegen/sync_windows.h
include/grpc++/impl/codegen/proto_utils.h include/grpc++/impl/codegen/proto_utils.h
include/grpcpp/impl/codegen/proto_buffer_reader.h
include/grpcpp/impl/codegen/proto_buffer_writer.h
include/grpcpp/impl/codegen/proto_utils.h include/grpcpp/impl/codegen/proto_utils.h
include/grpc++/impl/codegen/config_protobuf.h include/grpc++/impl/codegen/config_protobuf.h
include/grpcpp/impl/codegen/config_protobuf.h include/grpcpp/impl/codegen/config_protobuf.h
@ -4185,7 +4174,6 @@ add_library(grpc++_unsecure
src/cpp/server/server_posix.cc src/cpp/server/server_posix.cc
src/cpp/thread_manager/thread_manager.cc src/cpp/thread_manager/thread_manager.cc
src/cpp/util/byte_buffer_cc.cc src/cpp/util/byte_buffer_cc.cc
src/cpp/util/slice_cc.cc
src/cpp/util/status.cc src/cpp/util/status.cc
src/cpp/util/string_ref.cc src/cpp/util/string_ref.cc
src/cpp/util/time_cc.cc src/cpp/util/time_cc.cc
@ -4309,6 +4297,8 @@ foreach(_hdr
include/grpcpp/support/byte_buffer.h include/grpcpp/support/byte_buffer.h
include/grpcpp/support/channel_arguments.h include/grpcpp/support/channel_arguments.h
include/grpcpp/support/config.h include/grpcpp/support/config.h
include/grpcpp/support/proto_buffer_reader.h
include/grpcpp/support/proto_buffer_writer.h
include/grpcpp/support/slice.h include/grpcpp/support/slice.h
include/grpcpp/support/status.h include/grpcpp/support/status.h
include/grpcpp/support/status_code_enum.h include/grpcpp/support/status_code_enum.h

@ -142,7 +142,7 @@ installed to be able to compile the C/C++ sources.
> call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64 > call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" x64
> cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release > cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release
> cmake --build . > cmake --build .
> ninja > ninja install
``` ```
### msys2 (with mingw) ### msys2 (with mingw)

@ -421,8 +421,8 @@ Q = @
endif endif
CORE_VERSION = 6.0.0-dev CORE_VERSION = 6.0.0-dev
CPP_VERSION = 1.11.0-dev CPP_VERSION = 1.12.0-dev
CSHARP_VERSION = 1.11.0-dev CSHARP_VERSION = 1.12.0-dev
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
@ -3801,36 +3801,6 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/transport/transport.cc \ src/core/lib/transport/transport.cc \
src/core/lib/transport/transport_op_string.cc \ src/core/lib/transport/transport_op_string.cc \
src/core/lib/debug/trace.cc \ src/core/lib/debug/trace.cc \
src/core/ext/filters/deadline/deadline_filter.cc \
src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc \
src/core/ext/filters/client_channel/backup_poller.cc \
src/core/ext/filters/client_channel/channel_connectivity.cc \
src/core/ext/filters/client_channel/client_channel.cc \
src/core/ext/filters/client_channel/client_channel_factory.cc \
src/core/ext/filters/client_channel/client_channel_plugin.cc \
src/core/ext/filters/client_channel/connector.cc \
src/core/ext/filters/client_channel/http_connect_handshaker.cc \
src/core/ext/filters/client_channel/http_proxy.cc \
src/core/ext/filters/client_channel/lb_policy.cc \
src/core/ext/filters/client_channel/lb_policy_factory.cc \
src/core/ext/filters/client_channel/lb_policy_registry.cc \
src/core/ext/filters/client_channel/method_params.cc \
src/core/ext/filters/client_channel/parse_address.cc \
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
src/core/ext/filters/client_channel/subchannel_index.cc \
src/core/ext/filters/client_channel/uri_parser.cc \
src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc \
src/core/ext/filters/max_age/max_age_filter.cc \
src/core/ext/filters/message_size/message_size_filter.cc \
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
src/core/ext/filters/load_reporting/server_load_reporting_filter.cc \
src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc \
src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc \ src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc \
src/core/ext/transport/cronet/transport/cronet_api_dummy.cc \ src/core/ext/transport/cronet/transport/cronet_api_dummy.cc \
src/core/ext/transport/cronet/transport/cronet_transport.cc \ src/core/ext/transport/cronet/transport/cronet_transport.cc \
@ -3862,6 +3832,28 @@ LIBGRPC_CRONET_SRC = \
src/core/ext/filters/http/http_filters_plugin.cc \ src/core/ext/filters/http/http_filters_plugin.cc \
src/core/ext/filters/http/message_compress/message_compress_filter.cc \ src/core/ext/filters/http/message_compress/message_compress_filter.cc \
src/core/ext/filters/http/server/http_server_filter.cc \ src/core/ext/filters/http/server/http_server_filter.cc \
src/core/ext/filters/client_channel/backup_poller.cc \
src/core/ext/filters/client_channel/channel_connectivity.cc \
src/core/ext/filters/client_channel/client_channel.cc \
src/core/ext/filters/client_channel/client_channel_factory.cc \
src/core/ext/filters/client_channel/client_channel_plugin.cc \
src/core/ext/filters/client_channel/connector.cc \
src/core/ext/filters/client_channel/http_connect_handshaker.cc \
src/core/ext/filters/client_channel/http_proxy.cc \
src/core/ext/filters/client_channel/lb_policy.cc \
src/core/ext/filters/client_channel/lb_policy_factory.cc \
src/core/ext/filters/client_channel/lb_policy_registry.cc \
src/core/ext/filters/client_channel/method_params.cc \
src/core/ext/filters/client_channel/parse_address.cc \
src/core/ext/filters/client_channel/proxy_mapper.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver_registry.cc \
src/core/ext/filters/client_channel/retry_throttle.cc \
src/core/ext/filters/client_channel/subchannel.cc \
src/core/ext/filters/client_channel/subchannel_index.cc \
src/core/ext/filters/client_channel/uri_parser.cc \
src/core/ext/filters/deadline/deadline_filter.cc \
src/core/lib/http/httpcli_security_connector.cc \ src/core/lib/http/httpcli_security_connector.cc \
src/core/lib/security/context/security_context.cc \ src/core/lib/security/context/security_context.cc \
src/core/lib/security/credentials/alts/alts_credentials.cc \ src/core/lib/security/credentials/alts/alts_credentials.cc \
@ -3935,8 +3927,8 @@ LIBGRPC_CRONET_SRC = \
src/core/tsi/ssl/session_cache/ssl_session_openssl.cc \ src/core/tsi/ssl/session_cache/ssl_session_openssl.cc \
src/core/tsi/ssl_transport_security.cc \ src/core/tsi/ssl_transport_security.cc \
src/core/tsi/transport_security_grpc.cc \ src/core/tsi/transport_security_grpc.cc \
src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc \ src/core/ext/filters/load_reporting/server_load_reporting_filter.cc \
src/core/ext/transport/chttp2/server/chttp2_server.cc \ src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc \
src/core/plugin_registry/grpc_cronet_plugin_registry.cc \ src/core/plugin_registry/grpc_cronet_plugin_registry.cc \
PUBLIC_HEADERS_C += \ PUBLIC_HEADERS_C += \
@ -3961,20 +3953,9 @@ PUBLIC_HEADERS_C += \
include/grpc/impl/codegen/sync_generic.h \ include/grpc/impl/codegen/sync_generic.h \
include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_windows.h \ include/grpc/impl/codegen/sync_windows.h \
include/grpc/byte_buffer.h \
include/grpc/byte_buffer_reader.h \
include/grpc/compression.h \
include/grpc/fork.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
include/grpc/grpc_security_constants.h \
include/grpc/load_reporting.h \
include/grpc/slice.h \
include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/support/workaround_list.h \
include/grpc/grpc_cronet.h \ include/grpc/grpc_cronet.h \
include/grpc/grpc_security.h \ include/grpc/grpc_security.h \
include/grpc/grpc_security_constants.h \
LIBGRPC_CRONET_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_CRONET_SRC)))) LIBGRPC_CRONET_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_CRONET_SRC))))
@ -5038,7 +5019,6 @@ LIBGRPC++_SRC = \
src/cpp/server/server_posix.cc \ src/cpp/server/server_posix.cc \
src/cpp/thread_manager/thread_manager.cc \ src/cpp/thread_manager/thread_manager.cc \
src/cpp/util/byte_buffer_cc.cc \ src/cpp/util/byte_buffer_cc.cc \
src/cpp/util/slice_cc.cc \
src/cpp/util/status.cc \ src/cpp/util/status.cc \
src/cpp/util/string_ref.cc \ src/cpp/util/string_ref.cc \
src/cpp/util/time_cc.cc \ src/cpp/util/time_cc.cc \
@ -5128,6 +5108,8 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/support/byte_buffer.h \ include/grpcpp/support/byte_buffer.h \
include/grpcpp/support/channel_arguments.h \ include/grpcpp/support/channel_arguments.h \
include/grpcpp/support/config.h \ include/grpcpp/support/config.h \
include/grpcpp/support/proto_buffer_reader.h \
include/grpcpp/support/proto_buffer_writer.h \
include/grpcpp/support/slice.h \ include/grpcpp/support/slice.h \
include/grpcpp/support/status.h \ include/grpcpp/support/status.h \
include/grpcpp/support/status_code_enum.h \ include/grpcpp/support/status_code_enum.h \
@ -5246,6 +5228,8 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/impl/codegen/sync_stream.h \ include/grpcpp/impl/codegen/sync_stream.h \
include/grpcpp/impl/codegen/time.h \ include/grpcpp/impl/codegen/time.h \
include/grpc++/impl/codegen/proto_utils.h \ include/grpc++/impl/codegen/proto_utils.h \
include/grpcpp/impl/codegen/proto_buffer_reader.h \
include/grpcpp/impl/codegen/proto_buffer_writer.h \
include/grpcpp/impl/codegen/proto_utils.h \ include/grpcpp/impl/codegen/proto_utils.h \
include/grpc++/impl/codegen/config_protobuf.h \ include/grpc++/impl/codegen/config_protobuf.h \
include/grpcpp/impl/codegen/config_protobuf.h \ include/grpcpp/impl/codegen/config_protobuf.h \
@ -5399,7 +5383,6 @@ LIBGRPC++_CRONET_SRC = \
src/cpp/server/server_posix.cc \ src/cpp/server/server_posix.cc \
src/cpp/thread_manager/thread_manager.cc \ src/cpp/thread_manager/thread_manager.cc \
src/cpp/util/byte_buffer_cc.cc \ src/cpp/util/byte_buffer_cc.cc \
src/cpp/util/slice_cc.cc \
src/cpp/util/status.cc \ src/cpp/util/status.cc \
src/cpp/util/string_ref.cc \ src/cpp/util/string_ref.cc \
src/cpp/util/time_cc.cc \ src/cpp/util/time_cc.cc \
@ -5698,6 +5681,8 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/support/byte_buffer.h \ include/grpcpp/support/byte_buffer.h \
include/grpcpp/support/channel_arguments.h \ include/grpcpp/support/channel_arguments.h \
include/grpcpp/support/config.h \ include/grpcpp/support/config.h \
include/grpcpp/support/proto_buffer_reader.h \
include/grpcpp/support/proto_buffer_writer.h \
include/grpcpp/support/slice.h \ include/grpcpp/support/slice.h \
include/grpcpp/support/status.h \ include/grpcpp/support/status.h \
include/grpcpp/support/status_code_enum.h \ include/grpcpp/support/status_code_enum.h \
@ -6226,6 +6211,8 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_windows.h \ include/grpc/impl/codegen/sync_windows.h \
include/grpc++/impl/codegen/proto_utils.h \ include/grpc++/impl/codegen/proto_utils.h \
include/grpcpp/impl/codegen/proto_buffer_reader.h \
include/grpcpp/impl/codegen/proto_buffer_writer.h \
include/grpcpp/impl/codegen/proto_utils.h \ include/grpcpp/impl/codegen/proto_utils.h \
include/grpc++/impl/codegen/config_protobuf.h \ include/grpc++/impl/codegen/config_protobuf.h \
include/grpcpp/impl/codegen/config_protobuf.h \ include/grpcpp/impl/codegen/config_protobuf.h \
@ -6376,6 +6363,8 @@ PUBLIC_HEADERS_CXX += \
include/grpc/impl/codegen/sync_posix.h \ include/grpc/impl/codegen/sync_posix.h \
include/grpc/impl/codegen/sync_windows.h \ include/grpc/impl/codegen/sync_windows.h \
include/grpc++/impl/codegen/proto_utils.h \ include/grpc++/impl/codegen/proto_utils.h \
include/grpcpp/impl/codegen/proto_buffer_reader.h \
include/grpcpp/impl/codegen/proto_buffer_writer.h \
include/grpcpp/impl/codegen/proto_utils.h \ include/grpcpp/impl/codegen/proto_utils.h \
include/grpc++/impl/codegen/config_protobuf.h \ include/grpc++/impl/codegen/config_protobuf.h \
include/grpcpp/impl/codegen/config_protobuf.h \ include/grpcpp/impl/codegen/config_protobuf.h \
@ -6463,7 +6452,6 @@ LIBGRPC++_UNSECURE_SRC = \
src/cpp/server/server_posix.cc \ src/cpp/server/server_posix.cc \
src/cpp/thread_manager/thread_manager.cc \ src/cpp/thread_manager/thread_manager.cc \
src/cpp/util/byte_buffer_cc.cc \ src/cpp/util/byte_buffer_cc.cc \
src/cpp/util/slice_cc.cc \
src/cpp/util/status.cc \ src/cpp/util/status.cc \
src/cpp/util/string_ref.cc \ src/cpp/util/string_ref.cc \
src/cpp/util/time_cc.cc \ src/cpp/util/time_cc.cc \
@ -6553,6 +6541,8 @@ PUBLIC_HEADERS_CXX += \
include/grpcpp/support/byte_buffer.h \ include/grpcpp/support/byte_buffer.h \
include/grpcpp/support/channel_arguments.h \ include/grpcpp/support/channel_arguments.h \
include/grpcpp/support/config.h \ include/grpcpp/support/config.h \
include/grpcpp/support/proto_buffer_reader.h \
include/grpcpp/support/proto_buffer_writer.h \
include/grpcpp/support/slice.h \ include/grpcpp/support/slice.h \
include/grpcpp/support/status.h \ include/grpcpp/support/status.h \
include/grpcpp/support/status_code_enum.h \ include/grpcpp/support/status_code_enum.h \

@ -4,10 +4,11 @@ graft src/python/grpcio/grpcio.egg-info
graft src/core graft src/core
graft src/boringssl graft src/boringssl
graft include/grpc graft include/grpc
graft third_party/address_sorting
graft third_party/boringssl graft third_party/boringssl
graft third_party/cares
graft third_party/nanopb graft third_party/nanopb
graft third_party/zlib graft third_party/zlib
graft third_party/cares
include src/python/grpcio/_spawn_patch.py include src/python/grpcio/_spawn_patch.py
include src/python/grpcio/commands.py include src/python/grpcio/commands.py
include src/python/grpcio/grpc_version.py include src/python/grpcio/grpc_version.py

@ -130,12 +130,12 @@ def grpc_deps():
if "com_github_bazelbuild_bazeltoolchains" not in native.existing_rules(): if "com_github_bazelbuild_bazeltoolchains" not in native.existing_rules():
native.http_archive( native.http_archive(
name = "com_github_bazelbuild_bazeltoolchains", name = "com_github_bazelbuild_bazeltoolchains",
strip_prefix = "bazel-toolchains-b850ccdf53fed1ccab7670f52d6b297d74348d1b", strip_prefix = "bazel-toolchains-44200e0c026d86c53470d107b3697a3e46469c43",
urls = [ urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/b850ccdf53fed1ccab7670f52d6b297d74348d1b.tar.gz", "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/44200e0c026d86c53470d107b3697a3e46469c43.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/archive/b850ccdf53fed1ccab7670f52d6b297d74348d1b.tar.gz", "https://github.com/bazelbuild/bazel-toolchains/archive/44200e0c026d86c53470d107b3697a3e46469c43.tar.gz",
], ],
sha256 = "d84d6b2fe88ef99963febf91ddce33503eed14c155ace922e2122271b483be64", sha256 = "699b55a6916c687f4b7dc092dbbf5f64672cde0dc965f79717735ec4e5416556",
) )
# TODO: move some dependencies from "grpc_deps" here? # TODO: move some dependencies from "grpc_deps" here?

@ -13,8 +13,8 @@ settings:
'#09': Per-language overrides are possible with (eg) ruby_version tag here '#09': Per-language overrides are possible with (eg) ruby_version tag here
'#10': See the expand_version.py for all the quirks here '#10': See the expand_version.py for all the quirks here
core_version: 6.0.0-dev core_version: 6.0.0-dev
g_stands_for: gorgeous g_stands_for: glorious
version: 1.11.0-dev version: 1.12.0-dev
filegroups: filegroups:
- name: alts_proto - name: alts_proto
headers: headers:
@ -70,6 +70,8 @@ filegroups:
- tsi_interface - tsi_interface
- tsi - tsi
- name: alts_util - name: alts_util
public_headers:
- include/grpc/grpc_security.h
headers: headers:
- src/core/lib/security/credentials/alts/check_gcp_environment.h - src/core/lib/security/credentials/alts/check_gcp_environment.h
- src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h - src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h
@ -1164,6 +1166,8 @@ filegroups:
language: c++ language: c++
public_headers: public_headers:
- include/grpc++/impl/codegen/proto_utils.h - include/grpc++/impl/codegen/proto_utils.h
- include/grpcpp/impl/codegen/proto_buffer_reader.h
- include/grpcpp/impl/codegen/proto_buffer_writer.h
- include/grpcpp/impl/codegen/proto_utils.h - include/grpcpp/impl/codegen/proto_utils.h
uses: uses:
- grpc++_codegen_base - grpc++_codegen_base
@ -1254,6 +1258,8 @@ filegroups:
- include/grpcpp/support/byte_buffer.h - include/grpcpp/support/byte_buffer.h
- include/grpcpp/support/channel_arguments.h - include/grpcpp/support/channel_arguments.h
- include/grpcpp/support/config.h - include/grpcpp/support/config.h
- include/grpcpp/support/proto_buffer_reader.h
- include/grpcpp/support/proto_buffer_writer.h
- include/grpcpp/support/slice.h - include/grpcpp/support/slice.h
- include/grpcpp/support/status.h - include/grpcpp/support/status.h
- include/grpcpp/support/status_code_enum.h - include/grpcpp/support/status_code_enum.h
@ -1300,7 +1306,6 @@ filegroups:
- src/cpp/server/server_posix.cc - src/cpp/server/server_posix.cc
- src/cpp/thread_manager/thread_manager.cc - src/cpp/thread_manager/thread_manager.cc
- src/cpp/util/byte_buffer_cc.cc - src/cpp/util/byte_buffer_cc.cc
- src/cpp/util/slice_cc.cc
- src/cpp/util/status.cc - src/cpp/util/status.cc
- src/cpp/util/string_ref.cc - src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc - src/cpp/util/time_cc.cc
@ -1418,17 +1423,9 @@ libs:
dll: true dll: true
filegroups: filegroups:
- grpc_base - grpc_base
- grpc_base_headers
- grpc_deadline_filter
- grpc_lb_policy_pick_first
- grpc_max_age_filter
- grpc_message_size_filter
- grpc_resolver_dns_native
- grpc_resolver_sockaddr
- grpc_server_load_reporting
- grpc_transport_cronet_client_secure - grpc_transport_cronet_client_secure
- grpc_transport_chttp2_client_secure - grpc_transport_chttp2_client_secure
- grpc_transport_chttp2_server_secure - grpc_server_load_reporting
generate_plugin_registry: true generate_plugin_registry: true
platforms: platforms:
- linux - linux

@ -637,11 +637,13 @@ if (PHP_GRPC != "no") {
EXTENSION("grpc", grpc_source, null, EXTENSION("grpc", grpc_source, null,
"/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+ "/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+
"/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+ "/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+
"/DPB_FIELD_16BIT "+
"/I"+configure_module_dirname+" "+ "/I"+configure_module_dirname+" "+
"/I"+configure_module_dirname+"\\include "+ "/I"+configure_module_dirname+"\\include "+
"/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+ "/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+
"/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+ "/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+
"/I"+configure_module_dirname+"\\third_party\\zlib"); "/I"+configure_module_dirname+"\\third_party\\zlib "+
"/I"+configure_module_dirname+"\\third_party\\address_sorting\\include");
base_dir = get_define('BUILD_DIR'); base_dir = get_define('BUILD_DIR');
FSO.CreateFolder(base_dir+"\\ext"); FSO.CreateFolder(base_dir+"\\ext");

@ -15,3 +15,4 @@ future), and the corresponding version numbers that used them:
- 1.9 'g' stands for 'glossy' - 1.9 'g' stands for 'glossy'
- 1.10 'g' stands for 'glamorous' - 1.10 'g' stands for 'glamorous'
- 1.11 'g' stands for 'gorgeous' - 1.11 'g' stands for 'gorgeous'
- 1.12 'g' stands for 'glorious'

@ -12,40 +12,6 @@ file(MAKE_DIRECTORY ${GRPC_BUILD_DIR})
add_subdirectory(${GRPC_SRC_DIR} ${GRPC_BUILD_DIR}) add_subdirectory(${GRPC_SRC_DIR} ${GRPC_BUILD_DIR})
include_directories(${GRPC_SRC_DIR}/include)
add_library(libgrpc STATIC IMPORTED)
set_target_properties(libgrpc PROPERTIES IMPORTED_LOCATION
${GRPC_BUILD_DIR}/libgrpc.a)
add_library(libgrpc++ STATIC IMPORTED)
set_target_properties(libgrpc++ PROPERTIES IMPORTED_LOCATION
${GRPC_BUILD_DIR}/libgrpc++.a)
add_library(libgpr STATIC IMPORTED)
set_target_properties(libgpr PROPERTIES IMPORTED_LOCATION
${GRPC_BUILD_DIR}/libgpr.a)
add_library(libaddress_sorting STATIC IMPORTED)
set_target_properties(libaddress_sorting PROPERTIES IMPORTED_LOCATION
${GRPC_BUILD_DIR}/libaddress_sorting.a)
add_library(libcares STATIC IMPORTED)
set_target_properties(libcares PROPERTIES IMPORTED_LOCATION
${GRPC_BUILD_DIR}/third_party/cares/cares/lib/libcares.a)
add_library(libzlib STATIC IMPORTED)
set_target_properties(libzlib PROPERTIES IMPORTED_LOCATION
${GRPC_BUILD_DIR}/third_party/zlib/libz.a)
add_library(libcrypto STATIC IMPORTED)
set_target_properties(libcrypto PROPERTIES IMPORTED_LOCATION
${GRPC_BUILD_DIR}/third_party/boringssl/crypto/libcrypto.a)
add_library(libssl STATIC IMPORTED)
set_target_properties(libssl PROPERTIES IMPORTED_LOCATION
${GRPC_BUILD_DIR}/third_party/boringssl/ssl/libssl.a)
set(GRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens) set(GRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens)
file(MAKE_DIRECTORY ${GRPC_PROTO_GENS_DIR}) file(MAKE_DIRECTORY ${GRPC_PROTO_GENS_DIR})
include_directories(${GRPC_PROTO_GENS_DIR}) include_directories(${GRPC_PROTO_GENS_DIR})
@ -100,8 +66,8 @@ add_library(helloworld_proto_lib
SHARED ${HELLOWORLD_PROTO_HDRS} ${HELLOWORLD_PROTO_SRCS}) SHARED ${HELLOWORLD_PROTO_HDRS} ${HELLOWORLD_PROTO_SRCS})
target_link_libraries(helloworld_proto_lib target_link_libraries(helloworld_proto_lib
grpc++
libprotobuf libprotobuf
libgrpc++
android android
log) log)
@ -115,14 +81,6 @@ target_include_directories(grpc-helloworld
PRIVATE ${HELLOWORLD_PROTO_HEADERS}) PRIVATE ${HELLOWORLD_PROTO_HEADERS})
target_link_libraries(grpc-helloworld target_link_libraries(grpc-helloworld
libgrpc++
libgrpc
libaddress_sorting
libzlib
libcares
libssl
libcrypto
helloworld_proto_lib helloworld_proto_lib
libgpr
android android
${log-lib}) ${log-lib})

@ -27,22 +27,55 @@ else()
add_definitions(-D_WIN32_WINNT=0x600) add_definitions(-D_WIN32_WINNT=0x600)
endif() endif()
# Find Protobuf installation if(GRPC_AS_SUBMODULE)
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation. # One way to build a projects that uses gRPC is to just include the
set(protobuf_MODULE_COMPATIBLE TRUE) # entire gRPC project tree via "add_subdirectory".
find_package(Protobuf CONFIG REQUIRED) # This approach is very simple to use, but the are some potential
message(STATUS "Using protobuf ${protobuf_VERSION}") # disadvantages:
# * it includes gRPC's CMakeLists.txt directly into your build script
# without and that can make gRPC's internal setting interfere with your
# own build.
# * depending on what's installed on your system, the contents of submodules
# in gRPC's third_party/* might need to be available (and there might be
# additional prerequisites required to build them). Consider using
# the gRPC_*_PROVIDER options to fine-tune the expected behavior.
#
# A more robust approach to add dependency on gRPC is using
# cmake's ExternalProject_Add (see cmake_externalproject/CMakeLists.txt).
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) # Include the gRPC's cmake build (normally grpc source code would live
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>) # in a git submodule called "third_party/grpc", but this example lives in
# the same repository as gRPC sources, so we just look a few directories up)
add_subdirectory(../../.. ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL)
message(STATUS "Using gRPC via add_subdirectory.")
# Find gRPC installation # After using add_subdirectory, we can now use the grpc targets directly from
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. # this build.
find_package(gRPC CONFIG REQUIRED) set(_PROTOBUF_LIBPROTOBUF libprotobuf)
message(STATUS "Using gRPC ${gRPC_VERSION}") set(_PROTOBUF_PROTOC $<TARGET_FILE:protoc>)
set(_GRPC_GRPCPP_UNSECURE grpc++_unsecure)
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>)
else()
# This branch assumes that gRPC and all its dependencies are already installed
# on this system, so they can be located by find_package().
# Find Protobuf installation
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
set(protobuf_MODULE_COMPATIBLE TRUE)
find_package(Protobuf CONFIG REQUIRED)
message(STATUS "Using protobuf ${protobuf_VERSION}")
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
# gRPC C++ plugin # Find gRPC installation
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>) # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
find_package(gRPC CONFIG REQUIRED)
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(_GRPC_GRPCPP_UNSECURE gRPC::grpc++_unsecure)
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
endif()
# Proto file # Proto file
get_filename_component(hw_proto "../../protos/helloworld.proto" ABSOLUTE) get_filename_component(hw_proto "../../protos/helloworld.proto" ABSOLUTE)
@ -74,6 +107,6 @@ foreach(_target
${hw_proto_srcs} ${hw_proto_srcs}
${hw_grpc_srcs}) ${hw_grpc_srcs})
target_link_libraries(${_target} target_link_libraries(${_target}
${_PROTOBUF_LIBPROTOBUF} ${_GRPC_GRPCPP_UNSECURE}
gRPC::grpc++_unsecure) ${_PROTOBUF_LIBPROTOBUF})
endforeach() endforeach()

@ -23,7 +23,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'gRPC-C++' s.name = 'gRPC-C++'
# TODO (mxyan): use version that match gRPC version when pod is stabilized # TODO (mxyan): use version that match gRPC version when pod is stabilized
# version = '1.11.0-dev' # version = '1.12.0-dev'
version = '0.0.2' version = '0.0.2'
s.version = version s.version = version
s.summary = 'gRPC C++ library' s.summary = 'gRPC C++ library'
@ -31,7 +31,7 @@ Pod::Spec.new do |s|
s.license = 'Apache License, Version 2.0' s.license = 'Apache License, Version 2.0'
s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' }
grpc_version = '1.11.0-dev' grpc_version = '1.12.0-dev'
s.source = { s.source = {
:git => 'https://github.com/grpc/grpc.git', :git => 'https://github.com/grpc/grpc.git',
@ -112,6 +112,8 @@ Pod::Spec.new do |s|
'include/grpcpp/support/byte_buffer.h', 'include/grpcpp/support/byte_buffer.h',
'include/grpcpp/support/channel_arguments.h', 'include/grpcpp/support/channel_arguments.h',
'include/grpcpp/support/config.h', 'include/grpcpp/support/config.h',
'include/grpcpp/support/proto_buffer_reader.h',
'include/grpcpp/support/proto_buffer_writer.h',
'include/grpcpp/support/slice.h', 'include/grpcpp/support/slice.h',
'include/grpcpp/support/status.h', 'include/grpcpp/support/status.h',
'include/grpcpp/support/status_code_enum.h', 'include/grpcpp/support/status_code_enum.h',
@ -206,7 +208,6 @@ Pod::Spec.new do |s|
'src/cpp/server/server_posix.cc', 'src/cpp/server/server_posix.cc',
'src/cpp/thread_manager/thread_manager.cc', 'src/cpp/thread_manager/thread_manager.cc',
'src/cpp/util/byte_buffer_cc.cc', 'src/cpp/util/byte_buffer_cc.cc',
'src/cpp/util/slice_cc.cc',
'src/cpp/util/status.cc', 'src/cpp/util/status.cc',
'src/cpp/util/string_ref.cc', 'src/cpp/util/string_ref.cc',
'src/cpp/util/time_cc.cc', 'src/cpp/util/time_cc.cc',

@ -22,7 +22,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'gRPC-Core' s.name = 'gRPC-Core'
version = '1.11.0-dev' version = '1.12.0-dev'
s.version = version s.version = version
s.summary = 'Core cross-platform gRPC library, written in C' s.summary = 'Core cross-platform gRPC library, written in C'
s.homepage = 'https://grpc.io' s.homepage = 'https://grpc.io'
@ -182,6 +182,7 @@ Pod::Spec.new do |s|
ss.dependency 'BoringSSL', '~> 10.0' ss.dependency 'BoringSSL', '~> 10.0'
ss.dependency 'nanopb', '~> 0.3' ss.dependency 'nanopb', '~> 0.3'
# To save you from scrolling, this is the last part of the podspec.
ss.source_files = 'src/core/lib/gpr/arena.h', ss.source_files = 'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h', 'src/core/lib/gpr/env.h',
'src/core/lib/gpr/fork.h', 'src/core/lib/gpr/fork.h',
@ -1083,957 +1084,34 @@ Pod::Spec.new do |s|
s.subspec 'Cronet-Interface' do |ss| s.subspec 'Cronet-Interface' do |ss|
ss.header_mappings_dir = 'include/grpc' ss.header_mappings_dir = 'include/grpc'
ss.source_files = 'include/grpc/support/alloc.h', ss.source_files = 'include/grpc/grpc_cronet.h'
'include/grpc/support/atm.h', end
'include/grpc/support/atm_gcc_atomic.h',
'include/grpc/support/atm_gcc_sync.h', s.subspec 'Cronet-Implementation' do |ss|
'include/grpc/support/atm_windows.h', ss.header_mappings_dir = '.'
'include/grpc/support/cpu.h',
'include/grpc/support/log.h', ss.dependency "#{s.name}/Interface", version
'include/grpc/support/log_windows.h', ss.dependency "#{s.name}/Implementation", version
'include/grpc/support/port_platform.h', ss.dependency "#{s.name}/Cronet-Interface", version
'include/grpc/support/string_util.h',
'include/grpc/support/sync.h', ss.source_files = 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc',
'include/grpc/support/sync_custom.h', 'src/core/ext/transport/cronet/transport/cronet_transport.cc',
'include/grpc/support/sync_generic.h', 'third_party/nanopb/pb_common.c',
'include/grpc/support/sync_posix.h', 'third_party/nanopb/pb_decode.c',
'include/grpc/support/sync_windows.h', 'third_party/nanopb/pb_encode.c',
'include/grpc/support/thd_id.h',
'include/grpc/support/time.h',
'include/grpc/impl/codegen/atm.h',
'include/grpc/impl/codegen/atm_gcc_atomic.h',
'include/grpc/impl/codegen/atm_gcc_sync.h',
'include/grpc/impl/codegen/atm_windows.h',
'include/grpc/impl/codegen/fork.h',
'include/grpc/impl/codegen/gpr_slice.h',
'include/grpc/impl/codegen/gpr_types.h',
'include/grpc/impl/codegen/port_platform.h',
'include/grpc/impl/codegen/sync.h',
'include/grpc/impl/codegen/sync_custom.h',
'include/grpc/impl/codegen/sync_generic.h',
'include/grpc/impl/codegen/sync_posix.h',
'include/grpc/impl/codegen/sync_windows.h',
'include/grpc/impl/codegen/byte_buffer.h',
'include/grpc/impl/codegen/byte_buffer_reader.h',
'include/grpc/impl/codegen/compression_types.h',
'include/grpc/impl/codegen/connectivity_state.h',
'include/grpc/impl/codegen/grpc_types.h',
'include/grpc/impl/codegen/propagation_bits.h',
'include/grpc/impl/codegen/slice.h',
'include/grpc/impl/codegen/status.h',
'include/grpc/impl/codegen/atm.h',
'include/grpc/impl/codegen/atm_gcc_atomic.h',
'include/grpc/impl/codegen/atm_gcc_sync.h',
'include/grpc/impl/codegen/atm_windows.h',
'include/grpc/impl/codegen/fork.h',
'include/grpc/impl/codegen/gpr_slice.h',
'include/grpc/impl/codegen/gpr_types.h',
'include/grpc/impl/codegen/port_platform.h',
'include/grpc/impl/codegen/sync.h',
'include/grpc/impl/codegen/sync_custom.h',
'include/grpc/impl/codegen/sync_generic.h',
'include/grpc/impl/codegen/sync_posix.h',
'include/grpc/impl/codegen/sync_windows.h',
'include/grpc/byte_buffer.h',
'include/grpc/byte_buffer_reader.h',
'include/grpc/compression.h',
'include/grpc/fork.h',
'include/grpc/grpc.h',
'include/grpc/grpc_posix.h',
'include/grpc/grpc_security_constants.h',
'include/grpc/load_reporting.h',
'include/grpc/slice.h',
'include/grpc/slice_buffer.h',
'include/grpc/status.h',
'include/grpc/support/workaround_list.h',
'include/grpc/grpc_cronet.h',
'include/grpc/grpc_security.h'
end
s.subspec 'Cronet-Implementation' do |ss|
ss.header_mappings_dir = '.'
ss.libraries = 'z'
ss.dependency "#{s.name}/Cronet-Interface", version
ss.dependency 'BoringSSL', '~> 10.0'
ss.dependency 'nanopb', '~> 0.3'
ss.source_files = 'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/fork.h',
'src/core/lib/gpr/host_port.h',
'src/core/lib/gpr/mpscq.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
'src/core/lib/gprpp/atomic_with_atm.h',
'src/core/lib/gprpp/atomic_with_std.h',
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/gprpp/thd.h',
'src/core/lib/profiling/timers.h',
'src/core/lib/gpr/alloc.cc',
'src/core/lib/gpr/arena.cc',
'src/core/lib/gpr/atm.cc',
'src/core/lib/gpr/cpu_iphone.cc',
'src/core/lib/gpr/cpu_linux.cc',
'src/core/lib/gpr/cpu_posix.cc',
'src/core/lib/gpr/cpu_windows.cc',
'src/core/lib/gpr/env_linux.cc',
'src/core/lib/gpr/env_posix.cc',
'src/core/lib/gpr/env_windows.cc',
'src/core/lib/gpr/fork.cc',
'src/core/lib/gpr/host_port.cc',
'src/core/lib/gpr/log.cc',
'src/core/lib/gpr/log_android.cc',
'src/core/lib/gpr/log_linux.cc',
'src/core/lib/gpr/log_posix.cc',
'src/core/lib/gpr/log_windows.cc',
'src/core/lib/gpr/mpscq.cc',
'src/core/lib/gpr/murmur_hash.cc',
'src/core/lib/gpr/string.cc',
'src/core/lib/gpr/string_posix.cc',
'src/core/lib/gpr/string_util_windows.cc',
'src/core/lib/gpr/string_windows.cc',
'src/core/lib/gpr/sync.cc',
'src/core/lib/gpr/sync_posix.cc',
'src/core/lib/gpr/sync_windows.cc',
'src/core/lib/gpr/time.cc',
'src/core/lib/gpr/time_posix.cc',
'src/core/lib/gpr/time_precise.cc',
'src/core/lib/gpr/time_windows.cc',
'src/core/lib/gpr/tls_pthread.cc',
'src/core/lib/gpr/tmpfile_msys.cc',
'src/core/lib/gpr/tmpfile_posix.cc',
'src/core/lib/gpr/tmpfile_windows.cc',
'src/core/lib/gpr/wrap_memcpy.cc',
'src/core/lib/gprpp/thd_posix.cc',
'src/core/lib/gprpp/thd_windows.cc',
'src/core/lib/profiling/basic_timers.cc',
'src/core/lib/profiling/stap_timers.cc',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_trace.h',
'src/core/lib/channel/channel_trace_registry.h',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/context.h',
'src/core/lib/channel/handshaker.h',
'src/core/lib/channel/handshaker_factory.h',
'src/core/lib/channel/handshaker_registry.h',
'src/core/lib/channel/status_util.h',
'src/core/lib/compression/algorithm_metadata.h',
'src/core/lib/compression/compression_internal.h',
'src/core/lib/compression/message_compress.h',
'src/core/lib/compression/stream_compression.h',
'src/core/lib/compression/stream_compression_gzip.h',
'src/core/lib/compression/stream_compression_identity.h',
'src/core/lib/debug/stats.h',
'src/core/lib/debug/stats_data.h',
'src/core/lib/gprpp/debug_location.h',
'src/core/lib/gprpp/inlined_vector.h',
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',
'src/core/lib/http/format_request.h',
'src/core/lib/http/httpcli.h',
'src/core/lib/http/parser.h',
'src/core/lib/iomgr/block_annotate.h',
'src/core/lib/iomgr/call_combiner.h',
'src/core/lib/iomgr/closure.h',
'src/core/lib/iomgr/combiner.h',
'src/core/lib/iomgr/endpoint.h',
'src/core/lib/iomgr/endpoint_pair.h',
'src/core/lib/iomgr/error.h',
'src/core/lib/iomgr/error_internal.h',
'src/core/lib/iomgr/ev_epoll1_linux.h',
'src/core/lib/iomgr/ev_epollex_linux.h',
'src/core/lib/iomgr/ev_epollsig_linux.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
'src/core/lib/iomgr/exec_ctx.h',
'src/core/lib/iomgr/executor.h',
'src/core/lib/iomgr/gethostname.h',
'src/core/lib/iomgr/iocp_windows.h',
'src/core/lib/iomgr/iomgr.h',
'src/core/lib/iomgr/iomgr_custom.h',
'src/core/lib/iomgr/iomgr_internal.h',
'src/core/lib/iomgr/iomgr_posix.h',
'src/core/lib/iomgr/is_epollexclusive_available.h',
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/network_status_tracker.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
'src/core/lib/iomgr/pollset_custom.h',
'src/core/lib/iomgr/pollset_set.h',
'src/core/lib/iomgr/pollset_set_custom.h',
'src/core/lib/iomgr/pollset_set_windows.h',
'src/core/lib/iomgr/pollset_windows.h',
'src/core/lib/iomgr/port.h',
'src/core/lib/iomgr/resolve_address.h',
'src/core/lib/iomgr/resolve_address_custom.h',
'src/core/lib/iomgr/resource_quota.h',
'src/core/lib/iomgr/sockaddr.h',
'src/core/lib/iomgr/sockaddr_custom.h',
'src/core/lib/iomgr/sockaddr_posix.h',
'src/core/lib/iomgr/sockaddr_utils.h',
'src/core/lib/iomgr/sockaddr_windows.h',
'src/core/lib/iomgr/socket_factory_posix.h',
'src/core/lib/iomgr/socket_mutator.h',
'src/core/lib/iomgr/socket_utils.h',
'src/core/lib/iomgr/socket_utils_posix.h',
'src/core/lib/iomgr/socket_windows.h',
'src/core/lib/iomgr/sys_epoll_wrapper.h',
'src/core/lib/iomgr/tcp_client.h',
'src/core/lib/iomgr/tcp_client_posix.h',
'src/core/lib/iomgr/tcp_custom.h',
'src/core/lib/iomgr/tcp_posix.h',
'src/core/lib/iomgr/tcp_server.h',
'src/core/lib/iomgr/tcp_server_utils_posix.h',
'src/core/lib/iomgr/tcp_windows.h',
'src/core/lib/iomgr/time_averaged_stats.h',
'src/core/lib/iomgr/timer.h',
'src/core/lib/iomgr/timer_custom.h',
'src/core/lib/iomgr/timer_heap.h',
'src/core/lib/iomgr/timer_manager.h',
'src/core/lib/iomgr/udp_server.h',
'src/core/lib/iomgr/unix_sockets_posix.h',
'src/core/lib/iomgr/wakeup_fd_cv.h',
'src/core/lib/iomgr/wakeup_fd_pipe.h',
'src/core/lib/iomgr/wakeup_fd_posix.h',
'src/core/lib/json/json.h',
'src/core/lib/json/json_common.h',
'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h',
'src/core/lib/slice/b64.h',
'src/core/lib/slice/percent_encoding.h',
'src/core/lib/slice/slice_hash_table.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/slice/slice_weak_hash_table.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
'src/core/lib/surface/call_test_only.h',
'src/core/lib/surface/channel.h',
'src/core/lib/surface/channel_init.h',
'src/core/lib/surface/channel_stack_type.h',
'src/core/lib/surface/completion_queue.h',
'src/core/lib/surface/completion_queue_factory.h',
'src/core/lib/surface/event_string.h',
'src/core/lib/surface/init.h',
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/error_utils.h',
'src/core/lib/transport/http2_errors.h',
'src/core/lib/transport/metadata.h',
'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/pid_controller.h',
'src/core/lib/transport/service_config.h',
'src/core/lib/transport/static_metadata.h',
'src/core/lib/transport/status_conversion.h',
'src/core/lib/transport/status_metadata.h',
'src/core/lib/transport/timeout_encoding.h',
'src/core/lib/transport/transport.h',
'src/core/lib/transport/transport_impl.h',
'src/core/lib/debug/trace.h',
'src/core/ext/filters/deadline/deadline_filter.h',
'src/core/ext/filters/client_channel/backup_poller.h',
'src/core/ext/filters/client_channel/client_channel.h',
'src/core/ext/filters/client_channel/client_channel_factory.h',
'src/core/ext/filters/client_channel/connector.h',
'src/core/ext/filters/client_channel/http_connect_handshaker.h',
'src/core/ext/filters/client_channel/http_proxy.h',
'src/core/ext/filters/client_channel/lb_policy.h',
'src/core/ext/filters/client_channel/lb_policy_factory.h',
'src/core/ext/filters/client_channel/lb_policy_registry.h',
'src/core/ext/filters/client_channel/method_params.h',
'src/core/ext/filters/client_channel/parse_address.h',
'src/core/ext/filters/client_channel/proxy_mapper.h',
'src/core/ext/filters/client_channel/proxy_mapper_registry.h',
'src/core/ext/filters/client_channel/resolver.h',
'src/core/ext/filters/client_channel/resolver_factory.h',
'src/core/ext/filters/client_channel/resolver_registry.h',
'src/core/ext/filters/client_channel/retry_throttle.h',
'src/core/ext/filters/client_channel/subchannel.h',
'src/core/ext/filters/client_channel/subchannel_index.h',
'src/core/ext/filters/client_channel/uri_parser.h',
'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/load_reporting/server_load_reporting_filter.h',
'src/core/ext/filters/load_reporting/server_load_reporting_plugin.h',
'src/core/ext/transport/cronet/transport/cronet_transport.h',
'third_party/objective_c/Cronet/bidirectional_stream_c.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/flow_control.h',
'src/core/ext/transport/chttp2/transport/frame.h',
'src/core/ext/transport/chttp2/transport/frame_data.h',
'src/core/ext/transport/chttp2/transport/frame_goaway.h',
'src/core/ext/transport/chttp2/transport/frame_ping.h',
'src/core/ext/transport/chttp2/transport/frame_rst_stream.h',
'src/core/ext/transport/chttp2/transport/frame_settings.h',
'src/core/ext/transport/chttp2/transport/frame_window_update.h',
'src/core/ext/transport/chttp2/transport/hpack_encoder.h',
'src/core/ext/transport/chttp2/transport/hpack_parser.h',
'src/core/ext/transport/chttp2/transport/hpack_table.h',
'src/core/ext/transport/chttp2/transport/http2_settings.h',
'src/core/ext/transport/chttp2/transport/huffsyms.h',
'src/core/ext/transport/chttp2/transport/incoming_metadata.h',
'src/core/ext/transport/chttp2/transport/internal.h',
'src/core/ext/transport/chttp2/transport/stream_map.h',
'src/core/ext/transport/chttp2/transport/varint.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/filters/http/client/http_client_filter.h',
'src/core/ext/filters/http/message_compress/message_compress_filter.h',
'src/core/ext/filters/http/server/http_server_filter.h',
'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/composite/composite_credentials.h',
'src/core/lib/security/credentials/credentials.h',
'src/core/lib/security/credentials/fake/fake_credentials.h',
'src/core/lib/security/credentials/google_default/google_default_credentials.h',
'src/core/lib/security/credentials/iam/iam_credentials.h',
'src/core/lib/security/credentials/jwt/json_token.h',
'src/core/lib/security/credentials/jwt/jwt_credentials.h',
'src/core/lib/security/credentials/jwt/jwt_verifier.h',
'src/core/lib/security/credentials/oauth2/oauth2_credentials.h',
'src/core/lib/security/credentials/plugin/plugin_credentials.h',
'src/core/lib/security/credentials/ssl/ssl_credentials.h',
'src/core/lib/security/security_connector/alts_security_connector.h',
'src/core/lib/security/security_connector/security_connector.h',
'src/core/lib/security/transport/auth_filters.h',
'src/core/lib/security/transport/secure_endpoint.h',
'src/core/lib/security/transport/security_handshaker.h',
'src/core/lib/security/transport/target_authority_table.h',
'src/core/lib/security/transport/tsi_error.h',
'src/core/lib/security/util/json_util.h',
'src/core/tsi/alts/crypt/gsec.h',
'src/core/tsi/alts/frame_protector/alts_counter.h',
'src/core/tsi/alts/frame_protector/alts_crypter.h',
'src/core/tsi/alts/frame_protector/alts_frame_protector.h',
'src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h',
'src/core/tsi/alts/frame_protector/frame_handler.h',
'src/core/tsi/alts/handshaker/alts_handshaker_client.h',
'src/core/tsi/alts/handshaker/alts_tsi_event.h',
'src/core/tsi/alts/handshaker/alts_tsi_handshaker.h',
'src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h',
'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h',
'src/core/tsi/alts/handshaker/alts_handshaker_service_api.h',
'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h',
'src/core/tsi/alts/handshaker/alts_tsi_utils.h',
'src/core/tsi/alts/handshaker/transport_security_common_api.h',
'src/core/tsi/alts/handshaker/altscontext.pb.h',
'src/core/tsi/alts/handshaker/handshaker.pb.h',
'src/core/tsi/alts/handshaker/transport_security_common.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/tsi/transport_security.h',
'src/core/tsi/transport_security_adapter.h',
'src/core/tsi/transport_security_interface.h',
'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/tsi/alts_transport_security.h',
'src/core/tsi/fake_transport_security.h',
'src/core/tsi/ssl/session_cache/ssl_session.h',
'src/core/tsi/ssl/session_cache/ssl_session_cache.h',
'src/core/tsi/ssl_transport_security.h',
'src/core/tsi/ssl_types.h',
'src/core/tsi/transport_security_grpc.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
'src/core/lib/surface/init.cc',
'src/core/lib/avl/avl.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
'src/core/lib/channel/channel_stack.cc',
'src/core/lib/channel/channel_stack_builder.cc',
'src/core/lib/channel/channel_trace.cc',
'src/core/lib/channel/channel_trace_registry.cc',
'src/core/lib/channel/connected_channel.cc',
'src/core/lib/channel/handshaker.cc',
'src/core/lib/channel/handshaker_factory.cc',
'src/core/lib/channel/handshaker_registry.cc',
'src/core/lib/channel/status_util.cc',
'src/core/lib/compression/compression.cc',
'src/core/lib/compression/compression_internal.cc',
'src/core/lib/compression/message_compress.cc',
'src/core/lib/compression/stream_compression.cc',
'src/core/lib/compression/stream_compression_gzip.cc',
'src/core/lib/compression/stream_compression_identity.cc',
'src/core/lib/debug/stats.cc',
'src/core/lib/debug/stats_data.cc',
'src/core/lib/http/format_request.cc',
'src/core/lib/http/httpcli.cc',
'src/core/lib/http/parser.cc',
'src/core/lib/iomgr/call_combiner.cc',
'src/core/lib/iomgr/combiner.cc',
'src/core/lib/iomgr/endpoint.cc',
'src/core/lib/iomgr/endpoint_pair_posix.cc',
'src/core/lib/iomgr/endpoint_pair_uv.cc',
'src/core/lib/iomgr/endpoint_pair_windows.cc',
'src/core/lib/iomgr/error.cc',
'src/core/lib/iomgr/ev_epoll1_linux.cc',
'src/core/lib/iomgr/ev_epollex_linux.cc',
'src/core/lib/iomgr/ev_epollsig_linux.cc',
'src/core/lib/iomgr/ev_poll_posix.cc',
'src/core/lib/iomgr/ev_posix.cc',
'src/core/lib/iomgr/ev_windows.cc',
'src/core/lib/iomgr/exec_ctx.cc',
'src/core/lib/iomgr/executor.cc',
'src/core/lib/iomgr/fork_posix.cc',
'src/core/lib/iomgr/fork_windows.cc',
'src/core/lib/iomgr/gethostname_fallback.cc',
'src/core/lib/iomgr/gethostname_host_name_max.cc',
'src/core/lib/iomgr/gethostname_sysconf.cc',
'src/core/lib/iomgr/iocp_windows.cc',
'src/core/lib/iomgr/iomgr.cc',
'src/core/lib/iomgr/iomgr_custom.cc',
'src/core/lib/iomgr/iomgr_internal.cc',
'src/core/lib/iomgr/iomgr_posix.cc',
'src/core/lib/iomgr/iomgr_uv.cc',
'src/core/lib/iomgr/iomgr_windows.cc',
'src/core/lib/iomgr/is_epollexclusive_available.cc',
'src/core/lib/iomgr/load_file.cc',
'src/core/lib/iomgr/lockfree_event.cc',
'src/core/lib/iomgr/network_status_tracker.cc',
'src/core/lib/iomgr/polling_entity.cc',
'src/core/lib/iomgr/pollset.cc',
'src/core/lib/iomgr/pollset_custom.cc',
'src/core/lib/iomgr/pollset_set.cc',
'src/core/lib/iomgr/pollset_set_custom.cc',
'src/core/lib/iomgr/pollset_set_windows.cc',
'src/core/lib/iomgr/pollset_uv.cc',
'src/core/lib/iomgr/pollset_windows.cc',
'src/core/lib/iomgr/resolve_address.cc',
'src/core/lib/iomgr/resolve_address_custom.cc',
'src/core/lib/iomgr/resolve_address_posix.cc',
'src/core/lib/iomgr/resolve_address_windows.cc',
'src/core/lib/iomgr/resource_quota.cc',
'src/core/lib/iomgr/sockaddr_utils.cc',
'src/core/lib/iomgr/socket_factory_posix.cc',
'src/core/lib/iomgr/socket_mutator.cc',
'src/core/lib/iomgr/socket_utils_common_posix.cc',
'src/core/lib/iomgr/socket_utils_linux.cc',
'src/core/lib/iomgr/socket_utils_posix.cc',
'src/core/lib/iomgr/socket_utils_uv.cc',
'src/core/lib/iomgr/socket_utils_windows.cc',
'src/core/lib/iomgr/socket_windows.cc',
'src/core/lib/iomgr/tcp_client.cc',
'src/core/lib/iomgr/tcp_client_custom.cc',
'src/core/lib/iomgr/tcp_client_posix.cc',
'src/core/lib/iomgr/tcp_client_windows.cc',
'src/core/lib/iomgr/tcp_custom.cc',
'src/core/lib/iomgr/tcp_posix.cc',
'src/core/lib/iomgr/tcp_server.cc',
'src/core/lib/iomgr/tcp_server_custom.cc',
'src/core/lib/iomgr/tcp_server_posix.cc',
'src/core/lib/iomgr/tcp_server_utils_posix_common.cc',
'src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc',
'src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.cc',
'src/core/lib/iomgr/tcp_server_windows.cc',
'src/core/lib/iomgr/tcp_uv.cc',
'src/core/lib/iomgr/tcp_windows.cc',
'src/core/lib/iomgr/time_averaged_stats.cc',
'src/core/lib/iomgr/timer.cc',
'src/core/lib/iomgr/timer_custom.cc',
'src/core/lib/iomgr/timer_generic.cc',
'src/core/lib/iomgr/timer_heap.cc',
'src/core/lib/iomgr/timer_manager.cc',
'src/core/lib/iomgr/timer_uv.cc',
'src/core/lib/iomgr/udp_server.cc',
'src/core/lib/iomgr/unix_sockets_posix.cc',
'src/core/lib/iomgr/unix_sockets_posix_noop.cc',
'src/core/lib/iomgr/wakeup_fd_cv.cc',
'src/core/lib/iomgr/wakeup_fd_eventfd.cc',
'src/core/lib/iomgr/wakeup_fd_nospecial.cc',
'src/core/lib/iomgr/wakeup_fd_pipe.cc',
'src/core/lib/iomgr/wakeup_fd_posix.cc',
'src/core/lib/json/json.cc',
'src/core/lib/json/json_reader.cc',
'src/core/lib/json/json_string.cc',
'src/core/lib/json/json_writer.cc',
'src/core/lib/slice/b64.cc',
'src/core/lib/slice/percent_encoding.cc',
'src/core/lib/slice/slice.cc',
'src/core/lib/slice/slice_buffer.cc',
'src/core/lib/slice/slice_intern.cc',
'src/core/lib/slice/slice_string_helpers.cc',
'src/core/lib/surface/api_trace.cc',
'src/core/lib/surface/byte_buffer.cc',
'src/core/lib/surface/byte_buffer_reader.cc',
'src/core/lib/surface/call.cc',
'src/core/lib/surface/call_details.cc',
'src/core/lib/surface/call_log_batch.cc',
'src/core/lib/surface/channel.cc',
'src/core/lib/surface/channel_init.cc',
'src/core/lib/surface/channel_ping.cc',
'src/core/lib/surface/channel_stack_type.cc',
'src/core/lib/surface/completion_queue.cc',
'src/core/lib/surface/completion_queue_factory.cc',
'src/core/lib/surface/event_string.cc',
'src/core/lib/surface/lame_client.cc',
'src/core/lib/surface/metadata_array.cc',
'src/core/lib/surface/server.cc',
'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/version.cc',
'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/byte_stream.cc',
'src/core/lib/transport/connectivity_state.cc',
'src/core/lib/transport/error_utils.cc',
'src/core/lib/transport/metadata.cc',
'src/core/lib/transport/metadata_batch.cc',
'src/core/lib/transport/pid_controller.cc',
'src/core/lib/transport/service_config.cc',
'src/core/lib/transport/static_metadata.cc',
'src/core/lib/transport/status_conversion.cc',
'src/core/lib/transport/status_metadata.cc',
'src/core/lib/transport/timeout_encoding.cc',
'src/core/lib/transport/transport.cc',
'src/core/lib/transport/transport_op_string.cc',
'src/core/lib/debug/trace.cc',
'src/core/ext/filters/deadline/deadline_filter.cc',
'src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc',
'src/core/ext/filters/client_channel/backup_poller.cc',
'src/core/ext/filters/client_channel/channel_connectivity.cc',
'src/core/ext/filters/client_channel/client_channel.cc',
'src/core/ext/filters/client_channel/client_channel_factory.cc',
'src/core/ext/filters/client_channel/client_channel_plugin.cc',
'src/core/ext/filters/client_channel/connector.cc',
'src/core/ext/filters/client_channel/http_connect_handshaker.cc',
'src/core/ext/filters/client_channel/http_proxy.cc',
'src/core/ext/filters/client_channel/lb_policy.cc',
'src/core/ext/filters/client_channel/lb_policy_factory.cc',
'src/core/ext/filters/client_channel/lb_policy_registry.cc',
'src/core/ext/filters/client_channel/method_params.cc',
'src/core/ext/filters/client_channel/parse_address.cc',
'src/core/ext/filters/client_channel/proxy_mapper.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/resolver.cc',
'src/core/ext/filters/client_channel/resolver_registry.cc',
'src/core/ext/filters/client_channel/retry_throttle.cc',
'src/core/ext/filters/client_channel/subchannel.cc',
'src/core/ext/filters/client_channel/subchannel_index.cc',
'src/core/ext/filters/client_channel/uri_parser.cc',
'src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc',
'src/core/ext/filters/max_age/max_age_filter.cc',
'src/core/ext/filters/message_size/message_size_filter.cc',
'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/ext/filters/load_reporting/server_load_reporting_filter.cc',
'src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc',
'src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc',
'src/core/ext/transport/cronet/transport/cronet_transport.cc',
'src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc',
'src/core/ext/transport/chttp2/transport/bin_decoder.cc',
'src/core/ext/transport/chttp2/transport/bin_encoder.cc',
'src/core/ext/transport/chttp2/transport/chttp2_plugin.cc',
'src/core/ext/transport/chttp2/transport/chttp2_transport.cc',
'src/core/ext/transport/chttp2/transport/flow_control.cc',
'src/core/ext/transport/chttp2/transport/frame_data.cc',
'src/core/ext/transport/chttp2/transport/frame_goaway.cc',
'src/core/ext/transport/chttp2/transport/frame_ping.cc',
'src/core/ext/transport/chttp2/transport/frame_rst_stream.cc',
'src/core/ext/transport/chttp2/transport/frame_settings.cc',
'src/core/ext/transport/chttp2/transport/frame_window_update.cc',
'src/core/ext/transport/chttp2/transport/hpack_encoder.cc',
'src/core/ext/transport/chttp2/transport/hpack_parser.cc',
'src/core/ext/transport/chttp2/transport/hpack_table.cc',
'src/core/ext/transport/chttp2/transport/http2_settings.cc',
'src/core/ext/transport/chttp2/transport/huffsyms.cc',
'src/core/ext/transport/chttp2/transport/incoming_metadata.cc',
'src/core/ext/transport/chttp2/transport/parsing.cc',
'src/core/ext/transport/chttp2/transport/stream_lists.cc',
'src/core/ext/transport/chttp2/transport/stream_map.cc',
'src/core/ext/transport/chttp2/transport/varint.cc',
'src/core/ext/transport/chttp2/transport/writing.cc',
'src/core/ext/transport/chttp2/alpn/alpn.cc',
'src/core/ext/filters/http/client/http_client_filter.cc',
'src/core/ext/filters/http/http_filters_plugin.cc',
'src/core/ext/filters/http/message_compress/message_compress_filter.cc',
'src/core/ext/filters/http/server/http_server_filter.cc',
'src/core/lib/http/httpcli_security_connector.cc',
'src/core/lib/security/context/security_context.cc',
'src/core/lib/security/credentials/alts/alts_credentials.cc',
'src/core/lib/security/credentials/composite/composite_credentials.cc',
'src/core/lib/security/credentials/credentials.cc',
'src/core/lib/security/credentials/credentials_metadata.cc',
'src/core/lib/security/credentials/fake/fake_credentials.cc',
'src/core/lib/security/credentials/google_default/credentials_generic.cc',
'src/core/lib/security/credentials/google_default/google_default_credentials.cc',
'src/core/lib/security/credentials/iam/iam_credentials.cc',
'src/core/lib/security/credentials/jwt/json_token.cc',
'src/core/lib/security/credentials/jwt/jwt_credentials.cc',
'src/core/lib/security/credentials/jwt/jwt_verifier.cc',
'src/core/lib/security/credentials/oauth2/oauth2_credentials.cc',
'src/core/lib/security/credentials/plugin/plugin_credentials.cc',
'src/core/lib/security/credentials/ssl/ssl_credentials.cc',
'src/core/lib/security/security_connector/alts_security_connector.cc',
'src/core/lib/security/security_connector/security_connector.cc',
'src/core/lib/security/transport/client_auth_filter.cc',
'src/core/lib/security/transport/secure_endpoint.cc',
'src/core/lib/security/transport/security_handshaker.cc',
'src/core/lib/security/transport/server_auth_filter.cc',
'src/core/lib/security/transport/target_authority_table.cc',
'src/core/lib/security/transport/tsi_error.cc',
'src/core/lib/security/util/json_util.cc',
'src/core/lib/surface/init_secure.cc',
'src/core/tsi/alts/crypt/aes_gcm.cc',
'src/core/tsi/alts/crypt/gsec.cc',
'src/core/tsi/alts/frame_protector/alts_counter.cc',
'src/core/tsi/alts/frame_protector/alts_crypter.cc',
'src/core/tsi/alts/frame_protector/alts_frame_protector.cc',
'src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.cc',
'src/core/tsi/alts/frame_protector/alts_seal_privacy_integrity_crypter.cc',
'src/core/tsi/alts/frame_protector/alts_unseal_privacy_integrity_crypter.cc',
'src/core/tsi/alts/frame_protector/frame_handler.cc',
'src/core/tsi/alts/handshaker/alts_handshaker_client.cc',
'src/core/tsi/alts/handshaker/alts_tsi_event.cc',
'src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.cc',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc',
'src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc',
'src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc',
'src/core/lib/security/credentials/alts/check_gcp_environment.cc',
'src/core/lib/security/credentials/alts/check_gcp_environment_linux.cc',
'src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc',
'src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc',
'src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc',
'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.cc',
'src/core/lib/security/credentials/alts/grpc_alts_credentials_server_options.cc',
'src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc',
'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc',
'src/core/tsi/alts/handshaker/alts_tsi_utils.cc',
'src/core/tsi/alts/handshaker/transport_security_common_api.cc',
'src/core/tsi/alts/handshaker/altscontext.pb.c',
'src/core/tsi/alts/handshaker/handshaker.pb.c',
'src/core/tsi/alts/handshaker/transport_security_common.pb.c',
'third_party/nanopb/pb_common.c',
'third_party/nanopb/pb_decode.c',
'third_party/nanopb/pb_encode.c',
'src/core/tsi/transport_security.cc',
'src/core/tsi/transport_security_adapter.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create.cc',
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc',
'src/core/ext/transport/chttp2/client/authority.cc',
'src/core/ext/transport/chttp2/client/chttp2_connector.cc',
'src/core/tsi/alts_transport_security.cc',
'src/core/tsi/fake_transport_security.cc',
'src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc',
'src/core/tsi/ssl/session_cache/ssl_session_cache.cc',
'src/core/tsi/ssl/session_cache/ssl_session_openssl.cc',
'src/core/tsi/ssl_transport_security.cc',
'src/core/tsi/transport_security_grpc.cc',
'src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc',
'src/core/ext/transport/chttp2/server/chttp2_server.cc',
'src/core/plugin_registry/grpc_cronet_plugin_registry.cc'
ss.private_header_files = 'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/fork.h',
'src/core/lib/gpr/host_port.h',
'src/core/lib/gpr/mpscq.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/atomic.h',
'src/core/lib/gprpp/atomic_with_atm.h',
'src/core/lib/gprpp/atomic_with_std.h',
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/gprpp/thd.h',
'src/core/lib/profiling/timers.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_trace.h',
'src/core/lib/channel/channel_trace_registry.h',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/context.h',
'src/core/lib/channel/handshaker.h',
'src/core/lib/channel/handshaker_factory.h',
'src/core/lib/channel/handshaker_registry.h',
'src/core/lib/channel/status_util.h',
'src/core/lib/compression/algorithm_metadata.h',
'src/core/lib/compression/compression_internal.h',
'src/core/lib/compression/message_compress.h',
'src/core/lib/compression/stream_compression.h',
'src/core/lib/compression/stream_compression_gzip.h',
'src/core/lib/compression/stream_compression_identity.h',
'src/core/lib/debug/stats.h',
'src/core/lib/debug/stats_data.h',
'src/core/lib/gprpp/debug_location.h',
'src/core/lib/gprpp/inlined_vector.h',
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',
'src/core/lib/http/format_request.h',
'src/core/lib/http/httpcli.h',
'src/core/lib/http/parser.h',
'src/core/lib/iomgr/block_annotate.h',
'src/core/lib/iomgr/call_combiner.h',
'src/core/lib/iomgr/closure.h',
'src/core/lib/iomgr/combiner.h',
'src/core/lib/iomgr/endpoint.h',
'src/core/lib/iomgr/endpoint_pair.h',
'src/core/lib/iomgr/error.h',
'src/core/lib/iomgr/error_internal.h',
'src/core/lib/iomgr/ev_epoll1_linux.h',
'src/core/lib/iomgr/ev_epollex_linux.h',
'src/core/lib/iomgr/ev_epollsig_linux.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
'src/core/lib/iomgr/exec_ctx.h',
'src/core/lib/iomgr/executor.h',
'src/core/lib/iomgr/gethostname.h',
'src/core/lib/iomgr/iocp_windows.h',
'src/core/lib/iomgr/iomgr.h',
'src/core/lib/iomgr/iomgr_custom.h',
'src/core/lib/iomgr/iomgr_internal.h',
'src/core/lib/iomgr/iomgr_posix.h',
'src/core/lib/iomgr/is_epollexclusive_available.h',
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/network_status_tracker.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
'src/core/lib/iomgr/pollset_custom.h',
'src/core/lib/iomgr/pollset_set.h',
'src/core/lib/iomgr/pollset_set_custom.h',
'src/core/lib/iomgr/pollset_set_windows.h',
'src/core/lib/iomgr/pollset_windows.h',
'src/core/lib/iomgr/port.h',
'src/core/lib/iomgr/resolve_address.h',
'src/core/lib/iomgr/resolve_address_custom.h',
'src/core/lib/iomgr/resource_quota.h',
'src/core/lib/iomgr/sockaddr.h',
'src/core/lib/iomgr/sockaddr_custom.h',
'src/core/lib/iomgr/sockaddr_posix.h',
'src/core/lib/iomgr/sockaddr_utils.h',
'src/core/lib/iomgr/sockaddr_windows.h',
'src/core/lib/iomgr/socket_factory_posix.h',
'src/core/lib/iomgr/socket_mutator.h',
'src/core/lib/iomgr/socket_utils.h',
'src/core/lib/iomgr/socket_utils_posix.h',
'src/core/lib/iomgr/socket_windows.h',
'src/core/lib/iomgr/sys_epoll_wrapper.h',
'src/core/lib/iomgr/tcp_client.h',
'src/core/lib/iomgr/tcp_client_posix.h',
'src/core/lib/iomgr/tcp_custom.h',
'src/core/lib/iomgr/tcp_posix.h',
'src/core/lib/iomgr/tcp_server.h',
'src/core/lib/iomgr/tcp_server_utils_posix.h',
'src/core/lib/iomgr/tcp_windows.h',
'src/core/lib/iomgr/time_averaged_stats.h',
'src/core/lib/iomgr/timer.h',
'src/core/lib/iomgr/timer_custom.h',
'src/core/lib/iomgr/timer_heap.h',
'src/core/lib/iomgr/timer_manager.h',
'src/core/lib/iomgr/udp_server.h',
'src/core/lib/iomgr/unix_sockets_posix.h',
'src/core/lib/iomgr/wakeup_fd_cv.h',
'src/core/lib/iomgr/wakeup_fd_pipe.h',
'src/core/lib/iomgr/wakeup_fd_posix.h',
'src/core/lib/json/json.h',
'src/core/lib/json/json_common.h',
'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h',
'src/core/lib/slice/b64.h',
'src/core/lib/slice/percent_encoding.h',
'src/core/lib/slice/slice_hash_table.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/slice/slice_weak_hash_table.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
'src/core/lib/surface/call_test_only.h',
'src/core/lib/surface/channel.h',
'src/core/lib/surface/channel_init.h',
'src/core/lib/surface/channel_stack_type.h',
'src/core/lib/surface/completion_queue.h',
'src/core/lib/surface/completion_queue_factory.h',
'src/core/lib/surface/event_string.h',
'src/core/lib/surface/init.h',
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/error_utils.h',
'src/core/lib/transport/http2_errors.h',
'src/core/lib/transport/metadata.h',
'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/pid_controller.h',
'src/core/lib/transport/service_config.h',
'src/core/lib/transport/static_metadata.h',
'src/core/lib/transport/status_conversion.h',
'src/core/lib/transport/status_metadata.h',
'src/core/lib/transport/timeout_encoding.h',
'src/core/lib/transport/transport.h',
'src/core/lib/transport/transport_impl.h',
'src/core/lib/debug/trace.h',
'src/core/ext/filters/deadline/deadline_filter.h',
'src/core/ext/filters/client_channel/backup_poller.h',
'src/core/ext/filters/client_channel/client_channel.h',
'src/core/ext/filters/client_channel/client_channel_factory.h',
'src/core/ext/filters/client_channel/connector.h',
'src/core/ext/filters/client_channel/http_connect_handshaker.h',
'src/core/ext/filters/client_channel/http_proxy.h',
'src/core/ext/filters/client_channel/lb_policy.h',
'src/core/ext/filters/client_channel/lb_policy_factory.h',
'src/core/ext/filters/client_channel/lb_policy_registry.h',
'src/core/ext/filters/client_channel/method_params.h',
'src/core/ext/filters/client_channel/parse_address.h',
'src/core/ext/filters/client_channel/proxy_mapper.h',
'src/core/ext/filters/client_channel/proxy_mapper_registry.h',
'src/core/ext/filters/client_channel/resolver.h',
'src/core/ext/filters/client_channel/resolver_factory.h',
'src/core/ext/filters/client_channel/resolver_registry.h',
'src/core/ext/filters/client_channel/retry_throttle.h',
'src/core/ext/filters/client_channel/subchannel.h',
'src/core/ext/filters/client_channel/subchannel_index.h',
'src/core/ext/filters/client_channel/uri_parser.h',
'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/load_reporting/server_load_reporting_filter.h',
'src/core/ext/filters/load_reporting/server_load_reporting_plugin.h',
'src/core/ext/transport/cronet/transport/cronet_transport.h', 'src/core/ext/transport/cronet/transport/cronet_transport.h',
'third_party/objective_c/Cronet/bidirectional_stream_c.h', 'third_party/objective_c/Cronet/bidirectional_stream_c.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/flow_control.h',
'src/core/ext/transport/chttp2/transport/frame.h',
'src/core/ext/transport/chttp2/transport/frame_data.h',
'src/core/ext/transport/chttp2/transport/frame_goaway.h',
'src/core/ext/transport/chttp2/transport/frame_ping.h',
'src/core/ext/transport/chttp2/transport/frame_rst_stream.h',
'src/core/ext/transport/chttp2/transport/frame_settings.h',
'src/core/ext/transport/chttp2/transport/frame_window_update.h',
'src/core/ext/transport/chttp2/transport/hpack_encoder.h',
'src/core/ext/transport/chttp2/transport/hpack_parser.h',
'src/core/ext/transport/chttp2/transport/hpack_table.h',
'src/core/ext/transport/chttp2/transport/http2_settings.h',
'src/core/ext/transport/chttp2/transport/huffsyms.h',
'src/core/ext/transport/chttp2/transport/incoming_metadata.h',
'src/core/ext/transport/chttp2/transport/internal.h',
'src/core/ext/transport/chttp2/transport/stream_map.h',
'src/core/ext/transport/chttp2/transport/varint.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/filters/http/client/http_client_filter.h',
'src/core/ext/filters/http/message_compress/message_compress_filter.h',
'src/core/ext/filters/http/server/http_server_filter.h',
'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/composite/composite_credentials.h',
'src/core/lib/security/credentials/credentials.h',
'src/core/lib/security/credentials/fake/fake_credentials.h',
'src/core/lib/security/credentials/google_default/google_default_credentials.h',
'src/core/lib/security/credentials/iam/iam_credentials.h',
'src/core/lib/security/credentials/jwt/json_token.h',
'src/core/lib/security/credentials/jwt/jwt_credentials.h',
'src/core/lib/security/credentials/jwt/jwt_verifier.h',
'src/core/lib/security/credentials/oauth2/oauth2_credentials.h',
'src/core/lib/security/credentials/plugin/plugin_credentials.h',
'src/core/lib/security/credentials/ssl/ssl_credentials.h',
'src/core/lib/security/security_connector/alts_security_connector.h',
'src/core/lib/security/security_connector/security_connector.h',
'src/core/lib/security/transport/auth_filters.h',
'src/core/lib/security/transport/secure_endpoint.h',
'src/core/lib/security/transport/security_handshaker.h',
'src/core/lib/security/transport/target_authority_table.h',
'src/core/lib/security/transport/tsi_error.h',
'src/core/lib/security/util/json_util.h',
'src/core/tsi/alts/crypt/gsec.h',
'src/core/tsi/alts/frame_protector/alts_counter.h',
'src/core/tsi/alts/frame_protector/alts_crypter.h',
'src/core/tsi/alts/frame_protector/alts_frame_protector.h',
'src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h',
'src/core/tsi/alts/frame_protector/frame_handler.h',
'src/core/tsi/alts/handshaker/alts_handshaker_client.h',
'src/core/tsi/alts/handshaker/alts_tsi_event.h',
'src/core/tsi/alts/handshaker/alts_tsi_handshaker.h',
'src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h',
'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h',
'src/core/tsi/alts/handshaker/alts_handshaker_service_api.h',
'src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h',
'src/core/tsi/alts/handshaker/alts_tsi_utils.h',
'src/core/tsi/alts/handshaker/transport_security_common_api.h',
'src/core/tsi/alts/handshaker/altscontext.pb.h',
'src/core/tsi/alts/handshaker/handshaker.pb.h',
'src/core/tsi/alts/handshaker/transport_security_common.pb.h',
'third_party/nanopb/pb.h', 'third_party/nanopb/pb.h',
'third_party/nanopb/pb_common.h', 'third_party/nanopb/pb_common.h',
'third_party/nanopb/pb_decode.h', 'third_party/nanopb/pb_decode.h',
'third_party/nanopb/pb_encode.h', 'third_party/nanopb/pb_encode.h'
'src/core/tsi/transport_security.h',
'src/core/tsi/transport_security_adapter.h',
'src/core/tsi/transport_security_interface.h',
'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/tsi/alts_transport_security.h',
'src/core/tsi/fake_transport_security.h',
'src/core/tsi/ssl/session_cache/ssl_session.h',
'src/core/tsi/ssl/session_cache/ssl_session_cache.h',
'src/core/tsi/ssl_transport_security.h',
'src/core/tsi/ssl_types.h',
'src/core/tsi/transport_security_grpc.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h'
end end
s.subspec 'Cronet-Tests' do |ss| s.subspec 'Tests' do |ss|
ss.header_mappings_dir = '.' ss.header_mappings_dir = '.'
ss.dependency "#{s.name}/Cronet-Interface", version ss.dependency "#{s.name}/Interface", version
ss.dependency "#{s.name}/Cronet-Implementation", version ss.dependency "#{s.name}/Implementation", version
ss.source_files = 'test/core/util/test_config.cc', ss.source_files = 'test/core/util/test_config.cc',
'test/core/util/test_config.h', 'test/core/util/test_config.h',

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

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

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

@ -115,6 +115,12 @@ EXPORTS
grpc_server_add_secure_http2_port grpc_server_add_secure_http2_port
grpc_call_set_credentials grpc_call_set_credentials
grpc_server_credentials_set_auth_metadata_processor grpc_server_credentials_set_auth_metadata_processor
grpc_alts_credentials_client_options_create
grpc_alts_credentials_server_options_create
grpc_alts_credentials_client_options_add_target_service_account
grpc_alts_credentials_options_destroy
grpc_alts_credentials_create
grpc_alts_server_credentials_create
grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create
grpc_raw_compressed_byte_buffer_create grpc_raw_compressed_byte_buffer_create
grpc_byte_buffer_copy grpc_byte_buffer_copy
@ -185,6 +191,7 @@ EXPORTS
gpr_cpu_current_cpu gpr_cpu_current_cpu
gpr_log_severity_string gpr_log_severity_string
gpr_log gpr_log
gpr_should_log
gpr_log_message gpr_log_message
gpr_set_log_verbosity gpr_set_log_verbosity
gpr_log_verbosity_init gpr_log_verbosity_init

@ -1342,7 +1342,6 @@
'src/cpp/server/server_posix.cc', 'src/cpp/server/server_posix.cc',
'src/cpp/thread_manager/thread_manager.cc', 'src/cpp/thread_manager/thread_manager.cc',
'src/cpp/util/byte_buffer_cc.cc', 'src/cpp/util/byte_buffer_cc.cc',
'src/cpp/util/slice_cc.cc',
'src/cpp/util/status.cc', 'src/cpp/util/status.cc',
'src/cpp/util/string_ref.cc', 'src/cpp/util/string_ref.cc',
'src/cpp/util/time_cc.cc', 'src/cpp/util/time_cc.cc',
@ -1490,7 +1489,6 @@
'src/cpp/server/server_posix.cc', 'src/cpp/server/server_posix.cc',
'src/cpp/thread_manager/thread_manager.cc', 'src/cpp/thread_manager/thread_manager.cc',
'src/cpp/util/byte_buffer_cc.cc', 'src/cpp/util/byte_buffer_cc.cc',
'src/cpp/util/slice_cc.cc',
'src/cpp/util/status.cc', 'src/cpp/util/status.cc',
'src/cpp/util/string_ref.cc', 'src/cpp/util/string_ref.cc',
'src/cpp/util/time_cc.cc', 'src/cpp/util/time_cc.cc',

@ -488,6 +488,76 @@ typedef struct {
GRPCAPI void grpc_server_credentials_set_auth_metadata_processor( GRPCAPI void grpc_server_credentials_set_auth_metadata_processor(
grpc_server_credentials* creds, grpc_auth_metadata_processor processor); grpc_server_credentials* creds, grpc_auth_metadata_processor processor);
/** --- ALTS channel/server credentials --- **/
/**
* Main interface for ALTS credentials options. The options will contain
* information that will be passed from grpc to TSI layer such as RPC protocol
* versions. ALTS client (channel) and server credentials will have their own
* implementation of this interface. The APIs listed in this header are
* thread-compatible. It is used for experimental purpose for now and subject
* to change.
*/
typedef struct grpc_alts_credentials_options grpc_alts_credentials_options;
/**
* This method creates a grpc ALTS credentials client options instance.
* It is used for experimental purpose for now and subject to change.
*/
GRPCAPI grpc_alts_credentials_options*
grpc_alts_credentials_client_options_create();
/**
* This method creates a grpc ALTS credentials server options instance.
* It is used for experimental purpose for now and subject to change.
*/
GRPCAPI grpc_alts_credentials_options*
grpc_alts_credentials_server_options_create();
/**
* This method adds a target service account to grpc client's ALTS credentials
* options instance. It is used for experimental purpose for now and subject
* to change.
*
* - options: grpc ALTS credentials options instance.
* - service_account: service account of target endpoint.
*/
GRPCAPI void grpc_alts_credentials_client_options_add_target_service_account(
grpc_alts_credentials_options* options, const char* service_account);
/**
* This method destroys a grpc_alts_credentials_options instance by
* de-allocating all of its occupied memory. It is used for experimental purpose
* for now and subject to change.
*
* - options: a grpc_alts_credentials_options instance that needs to be
* destroyed.
*/
GRPCAPI void grpc_alts_credentials_options_destroy(
grpc_alts_credentials_options* options);
/**
* This method creates an ALTS channel credential object. It is used for
* experimental purpose for now and subject to change.
*
* - options: grpc ALTS credentials options instance for client.
*
* It returns the created ALTS channel credential object.
*/
GRPCAPI grpc_channel_credentials* grpc_alts_credentials_create(
const grpc_alts_credentials_options* options);
/**
* This method creates an ALTS server credential object. It is used for
* experimental purpose for now and subject to change.
*
* - options: grpc ALTS credentials options instance for server.
*
* It returns the created ALTS server credential object.
*/
GRPCAPI grpc_server_credentials* grpc_alts_server_credentials_create(
const grpc_alts_credentials_options* options);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -333,6 +333,9 @@ typedef struct {
/** Channel arg that carries the bridged objective c object for custom metrics /** Channel arg that carries the bridged objective c object for custom metrics
* logging filter. */ * logging filter. */
#define GRPC_ARG_MOBILE_LOG_CONFIG "grpc.mobile_log_config" #define GRPC_ARG_MOBILE_LOG_CONFIG "grpc.mobile_log_config"
/** If non-zero, client authority filter is disabled for the channel */
#define GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER \
"grpc.disable_client_authority_filter"
/** \} */ /** \} */
/** Result of a grpc call. If the caller satisfies the prerequisites of a /** Result of a grpc call. If the caller satisfies the prerequisites of a

@ -500,6 +500,17 @@ typedef unsigned __int64 uint64_t;
#endif /* __GPR_WINDOWS */ #endif /* __GPR_WINDOWS */
#endif /* GRPC_ALLOW_EXCEPTIONS */ #endif /* GRPC_ALLOW_EXCEPTIONS */
/* Use GPR_LIKELY only in cases where you are sure that a certain outcome is the
* most likely. Ideally, also collect performance numbers to justify the claim.
*/
#ifdef __GNUC__
#define GPR_LIKELY(x) __builtin_expect((x), 1)
#define GPR_UNLIKELY(x) __builtin_expect((x), 0)
#else /* __GNUC__ */
#define GPR_LIKELY(x) (x)
#define GPR_UNLIKELY(x) (x)
#endif /* __GNUC__ */
#ifndef __STDC_FORMAT_MACROS #ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif #endif

@ -61,6 +61,8 @@ GPRAPI const char* gpr_log_severity_string(gpr_log_severity severity);
GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity, GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5); const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
GPRAPI int gpr_should_log(gpr_log_severity severity);
GPRAPI void gpr_log_message(const char* file, int line, GPRAPI void gpr_log_message(const char* file, int line,
gpr_log_severity severity, const char* message); gpr_log_severity severity, const char* message);
@ -91,7 +93,7 @@ GPRAPI void gpr_set_log_function(gpr_log_func func);
an exception in a higher-level language, consider returning error code. */ an exception in a higher-level language, consider returning error code. */
#define GPR_ASSERT(x) \ #define GPR_ASSERT(x) \
do { \ do { \
if (!(x)) { \ if (GPR_UNLIKELY(!(x))) { \
gpr_log(GPR_ERROR, "assertion failed: %s", #x); \ gpr_log(GPR_ERROR, "assertion failed: %s", #x); \
abort(); \ abort(); \
} \ } \

@ -26,7 +26,7 @@
/// ///
/// Context settings are only relevant to the call they are invoked with, that /// Context settings are only relevant to the call they are invoked with, that
/// is to say, they aren't sticky. Some of these settings, such as the /// is to say, they aren't sticky. Some of these settings, such as the
/// compression options, can be made persistant at channel construction time /// compression options, can be made persistent at channel construction time
/// (see \a grpc::CreateCustomChannel). /// (see \a grpc::CreateCustomChannel).
/// ///
/// \warning ClientContext instances should \em not be reused across rpcs. /// \warning ClientContext instances should \em not be reused across rpcs.

@ -31,6 +31,10 @@
namespace grpc { namespace grpc {
class ServerInterface;
class ByteBuffer;
class ServerInterface;
namespace internal { namespace internal {
class CallOpSendMessage; class CallOpSendMessage;
template <class R> template <class R>
@ -43,6 +47,7 @@ template <class ServiceType, class RequestType, class ResponseType>
class ServerStreamingHandler; class ServerStreamingHandler;
template <class R> template <class R>
class DeserializeFuncType; class DeserializeFuncType;
class GrpcByteBufferPeer;
} // namespace internal } // namespace internal
/// A sequence of bytes. /// A sequence of bytes.
class ByteBuffer final { class ByteBuffer final {
@ -51,7 +56,30 @@ class ByteBuffer final {
ByteBuffer() : buffer_(nullptr) {} ByteBuffer() : buffer_(nullptr) {}
/// Construct buffer from \a slices, of which there are \a nslices. /// Construct buffer from \a slices, of which there are \a nslices.
ByteBuffer(const Slice* slices, size_t nslices); ByteBuffer(const Slice* slices, size_t nslices) {
// The following assertions check that the representation of a grpc::Slice
// is identical to that of a grpc_slice: it has a grpc_slice field, and
// nothing else.
static_assert(std::is_same<decltype(slices[0].slice_), grpc_slice>::value,
"Slice must have same representation as grpc_slice");
static_assert(sizeof(Slice) == sizeof(grpc_slice),
"Slice must have same representation as grpc_slice");
// The following assertions check that the representation of a ByteBuffer is
// identical to grpc_byte_buffer*: it has a grpc_byte_buffer* field,
// and nothing else.
static_assert(std::is_same<decltype(buffer_), grpc_byte_buffer*>::value,
"ByteBuffer must have same representation as "
"grpc_byte_buffer*");
static_assert(sizeof(ByteBuffer) == sizeof(grpc_byte_buffer*),
"ByteBuffer must have same representation as "
"grpc_byte_buffer*");
// The const_cast is legal if grpc_raw_byte_buffer_create() does no more
// than its advertised side effect of increasing the reference count of the
// slices it processes, and such an increase does not affect the semantics
// seen by the caller of this constructor.
buffer_ = g_core_codegen_interface->grpc_raw_byte_buffer_create(
reinterpret_cast<grpc_slice*>(const_cast<Slice*>(slices)), nslices);
}
/// Constuct a byte buffer by referencing elements of existing buffer /// Constuct a byte buffer by referencing elements of existing buffer
/// \a buf. Wrapper of core function grpc_byte_buffer_copy /// \a buf. Wrapper of core function grpc_byte_buffer_copy
@ -88,16 +116,25 @@ class ByteBuffer final {
void Release() { buffer_ = nullptr; } void Release() { buffer_ = nullptr; }
/// Buffer size in bytes. /// Buffer size in bytes.
size_t Length() const; size_t Length() const {
return buffer_ == nullptr
? 0
: g_core_codegen_interface->grpc_byte_buffer_length(buffer_);
}
/// Swap the state of *this and *other. /// Swap the state of *this and *other.
void Swap(ByteBuffer* other); void Swap(ByteBuffer* other) {
grpc_byte_buffer* tmp = other->buffer_;
other->buffer_ = buffer_;
buffer_ = tmp;
}
/// Is this ByteBuffer valid? /// Is this ByteBuffer valid?
bool Valid() const { return (buffer_ != nullptr); } bool Valid() const { return (buffer_ != nullptr); }
private: private:
friend class SerializationTraits<ByteBuffer, void>; friend class SerializationTraits<ByteBuffer, void>;
friend class ServerInterface;
friend class internal::CallOpSendMessage; friend class internal::CallOpSendMessage;
template <class R> template <class R>
friend class internal::CallOpRecvMessage; friend class internal::CallOpRecvMessage;
@ -109,6 +146,9 @@ class ByteBuffer final {
friend class internal::ServerStreamingHandler; friend class internal::ServerStreamingHandler;
template <class R> template <class R>
friend class internal::DeserializeFuncType; friend class internal::DeserializeFuncType;
friend class ProtoBufferReader;
friend class ProtoBufferWriter;
friend class internal::GrpcByteBufferPeer;
grpc_byte_buffer* buffer_; grpc_byte_buffer* buffer_;

@ -73,6 +73,7 @@ class CoreCodegen final : public CoreCodegenInterface {
grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) override; grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) override;
void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override; void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override;
size_t grpc_byte_buffer_length(grpc_byte_buffer* bb) override;
int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
grpc_byte_buffer* buffer) override; grpc_byte_buffer* buffer) override;
@ -86,6 +87,8 @@ class CoreCodegen final : public CoreCodegenInterface {
grpc_slice grpc_slice_new_with_user_data(void* p, size_t len, grpc_slice grpc_slice_new_with_user_data(void* p, size_t len,
void (*destroy)(void*), void (*destroy)(void*),
void* user_data) override; void* user_data) override;
grpc_slice grpc_slice_new_with_len(void* p, size_t len,
void (*destroy)(void*, size_t)) override;
grpc_slice grpc_empty_slice() override; grpc_slice grpc_empty_slice() override;
grpc_slice grpc_slice_malloc(size_t length) override; grpc_slice grpc_slice_malloc(size_t length) override;
void grpc_slice_unref(grpc_slice slice) override; void grpc_slice_unref(grpc_slice slice) override;

@ -81,6 +81,8 @@ class CoreCodegenInterface {
virtual grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) = 0; virtual grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) = 0;
virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0; virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0;
virtual size_t grpc_byte_buffer_length(grpc_byte_buffer* bb)
GRPC_MUST_USE_RESULT = 0;
virtual int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, virtual int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
grpc_byte_buffer* buffer) grpc_byte_buffer* buffer)
@ -95,6 +97,9 @@ class CoreCodegenInterface {
virtual grpc_slice grpc_slice_new_with_user_data(void* p, size_t len, virtual grpc_slice grpc_slice_new_with_user_data(void* p, size_t len,
void (*destroy)(void*), void (*destroy)(void*),
void* user_data) = 0; void* user_data) = 0;
virtual grpc_slice grpc_slice_new_with_len(void* p, size_t len,
void (*destroy)(void*,
size_t)) = 0;
virtual grpc_call_error grpc_call_cancel_with_status(grpc_call* call, virtual grpc_call_error grpc_call_cancel_with_status(grpc_call* call,
grpc_status_code status, grpc_status_code status,
const char* description, const char* description,

@ -0,0 +1,151 @@
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H
#define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H
#include <type_traits>
#include <grpc/impl/codegen/byte_buffer_reader.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/slice.h>
#include <grpcpp/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/config_protobuf.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/serialization_traits.h>
#include <grpcpp/impl/codegen/status.h>
/// This header provides an object that reads bytes directly from a
/// grpc::ByteBuffer, via the ZeroCopyInputStream interface
namespace grpc {
extern CoreCodegenInterface* g_core_codegen_interface;
/// This is a specialization of the protobuf class ZeroCopyInputStream
/// The principle is to get one chunk of data at a time from the proto layer,
/// with options to backup (re-see some bytes) or skip (forward past some bytes)
///
/// Read more about ZeroCopyInputStream interface here:
/// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyInputStream
class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream {
public:
/// Constructs buffer reader from \a buffer. Will set \a status() to non ok
/// if \a buffer is invalid (the internal buffer has not been initialized).
explicit ProtoBufferReader(ByteBuffer* buffer)
: byte_count_(0), backup_count_(0), status_() {
/// Implemented through a grpc_byte_buffer_reader which iterates
/// over the slices that make up a byte buffer
if (!buffer->Valid() ||
!g_core_codegen_interface->grpc_byte_buffer_reader_init(
&reader_, buffer->c_buffer())) {
status_ = Status(StatusCode::INTERNAL,
"Couldn't initialize byte buffer reader");
}
}
~ProtoBufferReader() {
if (status_.ok()) {
g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_);
}
}
/// Give the proto library a chunk of data from the stream. The caller
/// may safely read from data[0, size - 1].
bool Next(const void** data, int* size) override {
if (!status_.ok()) {
return false;
}
/// If we have backed up previously, we need to return the backed-up slice
if (backup_count_ > 0) {
*data = GRPC_SLICE_START_PTR(slice_) + GRPC_SLICE_LENGTH(slice_) -
backup_count_;
GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX);
*size = (int)backup_count_;
backup_count_ = 0;
return true;
}
/// Otherwise get the next slice from the byte buffer reader
if (!g_core_codegen_interface->grpc_byte_buffer_reader_next(&reader_,
&slice_)) {
return false;
}
g_core_codegen_interface->grpc_slice_unref(slice_);
*data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX);
byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_);
return true;
}
/// Returns the status of the buffer reader.
Status status() const { return status_; }
/// The proto library calls this to indicate that we should back up \a count
/// bytes that have already been returned by the last call of Next.
/// So do the backup and have that ready for a later Next.
void BackUp(int count) override {
GPR_CODEGEN_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(slice_)));
backup_count_ = count;
}
/// The proto library calls this to skip over \a count bytes. Implement this
/// using Next and BackUp combined.
bool Skip(int count) override {
const void* data;
int size;
while (Next(&data, &size)) {
if (size >= count) {
BackUp(size - count);
return true;
}
// size < count;
count -= size;
}
// error or we have too large count;
return false;
}
/// Returns the total number of bytes read since this object was created.
grpc::protobuf::int64 ByteCount() const override {
return byte_count_ - backup_count_;
}
// These protected members are needed to support internal optimizations.
// they expose internal bits of grpc core that are NOT stable. If you have
// a use case needs to use one of these functions, please send an email to
// https://groups.google.com/forum/#!forum/grpc-io.
protected:
void set_byte_count(int64_t byte_count) { byte_count_ = byte_count; }
int64_t backup_count() { return backup_count_; }
void set_backup_count(int64_t backup_count) { backup_count_ = backup_count; }
grpc_byte_buffer_reader* reader() { return &reader_; }
grpc_slice* slice() { return &slice_; }
private:
int64_t byte_count_; ///< total bytes read since object creation
int64_t backup_count_; ///< how far backed up in the stream we are
grpc_byte_buffer_reader reader_; ///< internal object to read \a grpc_slice
///< from the \a grpc_byte_buffer
grpc_slice slice_; ///< current slice passed back to the caller
Status status_; ///< status of the entire object
};
} // namespace grpc
#endif // GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_READER_H

@ -0,0 +1,167 @@
/*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H
#define GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H
#include <type_traits>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/slice.h>
#include <grpcpp/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/config_protobuf.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/serialization_traits.h>
#include <grpcpp/impl/codegen/status.h>
/// This header provides an object that writes bytes directly into a
/// grpc::ByteBuffer, via the ZeroCopyOutputStream interface
namespace grpc {
extern CoreCodegenInterface* g_core_codegen_interface;
// Forward declaration for testing use only
namespace internal {
class ProtoBufferWriterPeer;
} // namespace internal
const int kProtoBufferWriterMaxBufferLength = 1024 * 1024;
/// This is a specialization of the protobuf class ZeroCopyOutputStream.
/// The principle is to give the proto layer one buffer of bytes at a time
/// that it can use to serialize the next portion of the message, with the
/// option to "backup" if more buffer is given than required at the last buffer.
///
/// Read more about ZeroCopyOutputStream interface here:
/// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyOutputStream
class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
public:
/// Constructor for this derived class
///
/// \param[out] byte_buffer A pointer to the grpc::ByteBuffer created
/// \param block_size How big are the chunks to allocate at a time
/// \param total_size How many total bytes are required for this proto
ProtoBufferWriter(ByteBuffer* byte_buffer, int block_size, int total_size)
: block_size_(block_size),
total_size_(total_size),
byte_count_(0),
have_backup_(false) {
GPR_CODEGEN_ASSERT(!byte_buffer->Valid());
/// Create an empty raw byte buffer and look at its underlying slice buffer
grpc_byte_buffer* bp =
g_core_codegen_interface->grpc_raw_byte_buffer_create(NULL, 0);
byte_buffer->set_buffer(bp);
slice_buffer_ = &bp->data.raw.slice_buffer;
}
~ProtoBufferWriter() {
if (have_backup_) {
g_core_codegen_interface->grpc_slice_unref(backup_slice_);
}
}
/// Give the proto library the next buffer of bytes and its size. It is
/// safe for the caller to write from data[0, size - 1].
bool Next(void** data, int* size) override {
// Protobuf should not ask for more memory than total_size_.
GPR_CODEGEN_ASSERT(byte_count_ < total_size_);
// 1. Use the remaining backup slice if we have one
// 2. Otherwise allocate a slice, up to the remaining length needed
// or our maximum allocation size
// 3. Provide the slice start and size available
// 4. Add the slice being returned to the slice buffer
size_t remain = total_size_ - byte_count_;
if (have_backup_) {
/// If we have a backup slice, we should use it first
slice_ = backup_slice_;
have_backup_ = false;
if (GRPC_SLICE_LENGTH(slice_) > remain) {
GRPC_SLICE_SET_LENGTH(slice_, remain);
}
} else {
// When less than a whole block is needed, only allocate that much.
// But make sure the allocated slice is not inlined.
size_t allocate_length =
remain > static_cast<size_t>(block_size_) ? block_size_ : remain;
slice_ = g_core_codegen_interface->grpc_slice_malloc(
allocate_length > GRPC_SLICE_INLINED_SIZE
? allocate_length
: GRPC_SLICE_INLINED_SIZE + 1);
}
*data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX);
byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_);
g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_);
return true;
}
/// Backup by \a count bytes because Next returned more bytes than needed
/// (only used in the last buffer). \a count must be less than or equal too
/// the last buffer returned from next.
void BackUp(int count) override {
/// 1. Remove the partially-used last slice from the slice buffer
/// 2. Split it into the needed (if any) and unneeded part
/// 3. Add the needed part back to the slice buffer
/// 4. Mark that we still have the remaining part (for later use/unref)
GPR_CODEGEN_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(slice_)));
g_core_codegen_interface->grpc_slice_buffer_pop(slice_buffer_);
if ((size_t)count == GRPC_SLICE_LENGTH(slice_)) {
backup_slice_ = slice_;
} else {
backup_slice_ = g_core_codegen_interface->grpc_slice_split_tail(
&slice_, GRPC_SLICE_LENGTH(slice_) - count);
g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_);
}
// It's dangerous to keep an inlined grpc_slice as the backup slice, since
// on a following Next() call, a reference will be returned to this slice
// via GRPC_SLICE_START_PTR, which will not be an address held by
// slice_buffer_.
have_backup_ = backup_slice_.refcount != NULL;
byte_count_ -= count;
}
/// Returns the total number of bytes written since this object was created.
grpc::protobuf::int64 ByteCount() const override { return byte_count_; }
// These protected members are needed to support internal optimizations.
// they expose internal bits of grpc core that are NOT stable. If you have
// a use case needs to use one of these functions, please send an email to
// https://groups.google.com/forum/#!forum/grpc-io.
protected:
grpc_slice_buffer* slice_buffer() { return slice_buffer_; }
void set_byte_count(int64_t byte_count) { byte_count_ = byte_count; }
private:
// friend for testing purposes only
friend class internal::ProtoBufferWriterPeer;
const int block_size_; ///< size to alloc for each new \a grpc_slice needed
const int total_size_; ///< byte size of proto being serialized
int64_t byte_count_; ///< bytes written since this object was created
grpc_slice_buffer*
slice_buffer_; ///< internal buffer of slices holding the serialized data
bool have_backup_; ///< if we are holding a backup slice or not
grpc_slice backup_slice_; ///< holds space we can still write to, if the
///< caller has called BackUp
grpc_slice slice_; ///< current slice passed back to the caller
};
} // namespace grpc
#endif // GRPCPP_IMPL_CODEGEN_PROTO_BUFFER_WRITER_H

@ -24,203 +24,61 @@
#include <grpc/impl/codegen/byte_buffer_reader.h> #include <grpc/impl/codegen/byte_buffer_reader.h>
#include <grpc/impl/codegen/grpc_types.h> #include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/slice.h> #include <grpc/impl/codegen/slice.h>
#include <grpcpp/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/config_protobuf.h> #include <grpcpp/impl/codegen/config_protobuf.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h> #include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/proto_buffer_reader.h>
#include <grpcpp/impl/codegen/proto_buffer_writer.h>
#include <grpcpp/impl/codegen/serialization_traits.h> #include <grpcpp/impl/codegen/serialization_traits.h>
#include <grpcpp/impl/codegen/slice.h>
#include <grpcpp/impl/codegen/status.h> #include <grpcpp/impl/codegen/status.h>
/// This header provides serialization and deserialization between gRPC
/// messages serialized using protobuf and the C++ objects they represent.
namespace grpc { namespace grpc {
extern CoreCodegenInterface* g_core_codegen_interface; extern CoreCodegenInterface* g_core_codegen_interface;
namespace internal { // ProtoBufferWriter must be a subclass of ::protobuf::io::ZeroCopyOutputStream.
template <class ProtoBufferWriter, class T>
class GrpcBufferWriterPeer; Status GenericSerialize(const grpc::protobuf::Message& msg, ByteBuffer* bb,
bool* own_buffer) {
const int kGrpcBufferWriterMaxBufferLength = 1024 * 1024; static_assert(std::is_base_of<protobuf::io::ZeroCopyOutputStream,
ProtoBufferWriter>::value,
class GrpcBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream { "ProtoBufferWriter must be a subclass of "
public: "::protobuf::io::ZeroCopyOutputStream");
GrpcBufferWriter(grpc_byte_buffer** bp, int block_size, int total_size)
: block_size_(block_size),
total_size_(total_size),
byte_count_(0),
have_backup_(false) {
*bp = g_core_codegen_interface->grpc_raw_byte_buffer_create(NULL, 0);
slice_buffer_ = &(*bp)->data.raw.slice_buffer;
}
~GrpcBufferWriter() override {
if (have_backup_) {
g_core_codegen_interface->grpc_slice_unref(backup_slice_);
}
}
bool Next(void** data, int* size) override {
// Protobuf should not ask for more memory than total_size_.
GPR_CODEGEN_ASSERT(byte_count_ < total_size_);
size_t remain = total_size_ - byte_count_;
if (have_backup_) {
slice_ = backup_slice_;
have_backup_ = false;
if (GRPC_SLICE_LENGTH(slice_) > remain) {
GRPC_SLICE_SET_LENGTH(slice_, remain);
}
} else {
// When less than a whole block is needed, only allocate that much.
// But make sure the allocated slice is not inlined.
size_t allocate_length =
remain > static_cast<size_t>(block_size_) ? block_size_ : remain;
slice_ = g_core_codegen_interface->grpc_slice_malloc(
allocate_length > GRPC_SLICE_INLINED_SIZE
? allocate_length
: GRPC_SLICE_INLINED_SIZE + 1);
}
*data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX);
byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_);
g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_);
return true;
}
void BackUp(int count) override {
g_core_codegen_interface->grpc_slice_buffer_pop(slice_buffer_);
if ((size_t)count == GRPC_SLICE_LENGTH(slice_)) {
backup_slice_ = slice_;
} else {
backup_slice_ = g_core_codegen_interface->grpc_slice_split_tail(
&slice_, GRPC_SLICE_LENGTH(slice_) - count);
g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_);
}
// It's dangerous to keep an inlined grpc_slice as the backup slice, since
// on a following Next() call, a reference will be returned to this slice
// via GRPC_SLICE_START_PTR, which will not be an adddress held by
// slice_buffer_.
have_backup_ = backup_slice_.refcount != NULL;
byte_count_ -= count;
}
grpc::protobuf::int64 ByteCount() const override { return byte_count_; }
protected:
friend class GrpcBufferWriterPeer;
const int block_size_;
const int total_size_;
int64_t byte_count_;
grpc_slice_buffer* slice_buffer_;
bool have_backup_;
grpc_slice backup_slice_;
grpc_slice slice_;
};
class GrpcBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream {
public:
explicit GrpcBufferReader(grpc_byte_buffer* buffer)
: byte_count_(0), backup_count_(0), status_() {
if (!g_core_codegen_interface->grpc_byte_buffer_reader_init(&reader_,
buffer)) {
status_ = Status(StatusCode::INTERNAL,
"Couldn't initialize byte buffer reader");
}
}
~GrpcBufferReader() override {
g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_);
}
bool Next(const void** data, int* size) override {
if (!status_.ok()) {
return false;
}
if (backup_count_ > 0) {
*data = GRPC_SLICE_START_PTR(slice_) + GRPC_SLICE_LENGTH(slice_) -
backup_count_;
GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX);
*size = (int)backup_count_;
backup_count_ = 0;
return true;
}
if (!g_core_codegen_interface->grpc_byte_buffer_reader_next(&reader_,
&slice_)) {
return false;
}
g_core_codegen_interface->grpc_slice_unref(slice_);
*data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX);
byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_);
return true;
}
Status status() const { return status_; }
void BackUp(int count) override { backup_count_ = count; }
bool Skip(int count) override {
const void* data;
int size;
while (Next(&data, &size)) {
if (size >= count) {
BackUp(size - count);
return true;
}
// size < count;
count -= size;
}
// error or we have too large count;
return false;
}
grpc::protobuf::int64 ByteCount() const override {
return byte_count_ - backup_count_;
}
protected:
int64_t byte_count_;
int64_t backup_count_;
grpc_byte_buffer_reader reader_;
grpc_slice slice_;
Status status_;
};
// BufferWriter must be a subclass of io::ZeroCopyOutputStream.
template <class BufferWriter, class T>
Status GenericSerialize(const grpc::protobuf::Message& msg,
grpc_byte_buffer** bp, bool* own_buffer) {
static_assert(
std::is_base_of<protobuf::io::ZeroCopyOutputStream, BufferWriter>::value,
"BufferWriter must be a subclass of io::ZeroCopyOutputStream");
*own_buffer = true; *own_buffer = true;
int byte_size = msg.ByteSize(); int byte_size = msg.ByteSize();
if ((size_t)byte_size <= GRPC_SLICE_INLINED_SIZE) { if ((size_t)byte_size <= GRPC_SLICE_INLINED_SIZE) {
grpc_slice slice = g_core_codegen_interface->grpc_slice_malloc(byte_size); Slice slice(byte_size);
GPR_CODEGEN_ASSERT( // We serialize directly into the allocated slices memory
GRPC_SLICE_END_PTR(slice) == GPR_CODEGEN_ASSERT(slice.end() == msg.SerializeWithCachedSizesToArray(
msg.SerializeWithCachedSizesToArray(GRPC_SLICE_START_PTR(slice))); const_cast<uint8_t*>(slice.begin())));
*bp = g_core_codegen_interface->grpc_raw_byte_buffer_create(&slice, 1); ByteBuffer tmp(&slice, 1);
g_core_codegen_interface->grpc_slice_unref(slice); bb->Swap(&tmp);
return g_core_codegen_interface->ok(); return g_core_codegen_interface->ok();
} }
BufferWriter writer(bp, kGrpcBufferWriterMaxBufferLength, byte_size); ProtoBufferWriter writer(bb, kProtoBufferWriterMaxBufferLength, byte_size);
return msg.SerializeToZeroCopyStream(&writer) return msg.SerializeToZeroCopyStream(&writer)
? g_core_codegen_interface->ok() ? g_core_codegen_interface->ok()
: Status(StatusCode::INTERNAL, "Failed to serialize message"); : Status(StatusCode::INTERNAL, "Failed to serialize message");
} }
// BufferReader must be a subclass of io::ZeroCopyInputStream. // BufferReader must be a subclass of ::protobuf::io::ZeroCopyInputStream.
template <class BufferReader, class T> template <class ProtoBufferReader, class T>
Status GenericDeserialize(grpc_byte_buffer* buffer, Status GenericDeserialize(ByteBuffer* buffer, grpc::protobuf::Message* msg) {
grpc::protobuf::Message* msg) { static_assert(std::is_base_of<protobuf::io::ZeroCopyInputStream,
static_assert( ProtoBufferReader>::value,
std::is_base_of<protobuf::io::ZeroCopyInputStream, BufferReader>::value, "ProtoBufferReader must be a subclass of "
"BufferReader must be a subclass of io::ZeroCopyInputStream"); "::protobuf::io::ZeroCopyInputStream");
if (buffer == nullptr) { if (buffer == nullptr) {
return Status(StatusCode::INTERNAL, "No payload"); return Status(StatusCode::INTERNAL, "No payload");
} }
Status result = g_core_codegen_interface->ok(); Status result = g_core_codegen_interface->ok();
{ {
BufferReader reader(buffer); ProtoBufferReader reader(buffer);
if (!reader.status().ok()) { if (!reader.status().ok()) {
return reader.status(); return reader.status();
} }
@ -233,12 +91,10 @@ Status GenericDeserialize(grpc_byte_buffer* buffer,
result = Status(StatusCode::INTERNAL, "Did not read entire message"); result = Status(StatusCode::INTERNAL, "Did not read entire message");
} }
} }
g_core_codegen_interface->grpc_byte_buffer_destroy(buffer); buffer->Clear();
return result; return result;
} }
} // namespace internal
// this is needed so the following class does not conflict with protobuf // this is needed so the following class does not conflict with protobuf
// serializers that utilize internal-only tools. // serializers that utilize internal-only tools.
#ifdef GRPC_OPEN_SOURCE_PROTO #ifdef GRPC_OPEN_SOURCE_PROTO
@ -249,16 +105,13 @@ template <class T>
class SerializationTraits<T, typename std::enable_if<std::is_base_of< class SerializationTraits<T, typename std::enable_if<std::is_base_of<
grpc::protobuf::Message, T>::value>::type> { grpc::protobuf::Message, T>::value>::type> {
public: public:
static Status Serialize(const grpc::protobuf::Message& msg, static Status Serialize(const grpc::protobuf::Message& msg, ByteBuffer* bb,
grpc_byte_buffer** bp, bool* own_buffer) { bool* own_buffer) {
return internal::GenericSerialize<internal::GrpcBufferWriter, T>( return GenericSerialize<ProtoBufferWriter, T>(msg, bb, own_buffer);
msg, bp, own_buffer);
} }
static Status Deserialize(grpc_byte_buffer* buffer, static Status Deserialize(ByteBuffer* buffer, grpc::protobuf::Message* msg) {
grpc::protobuf::Message* msg) { return GenericDeserialize<ProtoBufferReader, T>(buffer, msg);
return internal::GenericDeserialize<internal::GrpcBufferReader, T>(buffer,
msg);
} }
}; };
#endif #endif

@ -88,8 +88,8 @@ class ServerContextTestSpouse;
/// ///
/// Context settings are only relevant to the call handler they are supplied to, /// Context settings are only relevant to the call handler they are supplied to,
/// that is to say, they aren't sticky across multiple calls. Some of these /// that is to say, they aren't sticky across multiple calls. Some of these
/// settings, such as the compression options, can be made persistant at server /// settings, such as the compression options, can be made persistent at server
/// construction time by specifying the approriate \a ChannelArguments /// construction time by specifying the appropriate \a ChannelArguments
/// to a \a grpc::ServerBuilder, via \a ServerBuilder::AddChannelArgument. /// to a \a grpc::ServerBuilder, via \a ServerBuilder::AddChannelArgument.
/// ///
/// \warning ServerContext instances should \em not be reused across rpcs. /// \warning ServerContext instances should \em not be reused across rpcs.

@ -20,6 +20,7 @@
#define GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H #define GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H
#include <grpc/impl/codegen/grpc_types.h> #include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/impl/codegen/byte_buffer.h>
#include <grpcpp/impl/codegen/call_hook.h> #include <grpcpp/impl/codegen/call_hook.h>
#include <grpcpp/impl/codegen/completion_queue_tag.h> #include <grpcpp/impl/codegen/completion_queue_tag.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h> #include <grpcpp/impl/codegen/core_codegen_interface.h>
@ -185,13 +186,17 @@ class ServerInterface : public internal::CallHook {
notification_cq_(notification_cq), notification_cq_(notification_cq),
tag_(tag), tag_(tag),
request_(request) { request_(request) {
IssueRequest(registered_method, &payload_, notification_cq); IssueRequest(registered_method, payload_.bbuf_ptr(), notification_cq);
}
~PayloadAsyncRequest() {
payload_.Release(); // We do not own the payload_
} }
bool FinalizeResult(void** tag, bool* status) override { bool FinalizeResult(void** tag, bool* status) override {
if (*status) { if (*status) {
if (payload_ == nullptr || if (!payload_.Valid() || !SerializationTraits<Message>::Deserialize(
!SerializationTraits<Message>::Deserialize(payload_, request_) payload_.bbuf_ptr(), request_)
.ok()) { .ok()) {
// If deserialization fails, we cancel the call and instantiate // If deserialization fails, we cancel the call and instantiate
// a new instance of ourselves to request another call. We then // a new instance of ourselves to request another call. We then
@ -219,7 +224,7 @@ class ServerInterface : public internal::CallHook {
ServerCompletionQueue* const notification_cq_; ServerCompletionQueue* const notification_cq_;
void* const tag_; void* const tag_;
Message* const request_; Message* const request_;
grpc_byte_buffer* payload_; ByteBuffer payload_;
}; };
class GenericAsyncRequest : public BaseAsyncRequest { class GenericAsyncRequest : public BaseAsyncRequest {

@ -35,34 +35,43 @@ namespace grpc {
class Slice final { class Slice final {
public: public:
/// Construct an empty slice. /// Construct an empty slice.
Slice(); Slice() : slice_(g_core_codegen_interface->grpc_empty_slice()) {}
/// Destructor - drops one reference. /// Destructor - drops one reference.
~Slice(); ~Slice() { g_core_codegen_interface->grpc_slice_unref(slice_); }
enum AddRef { ADD_REF }; enum AddRef { ADD_REF };
/// Construct a slice from \a slice, adding a reference. /// Construct a slice from \a slice, adding a reference.
Slice(grpc_slice slice, AddRef); Slice(grpc_slice slice, AddRef)
: slice_(g_core_codegen_interface->grpc_slice_ref(slice)) {}
enum StealRef { STEAL_REF }; enum StealRef { STEAL_REF };
/// Construct a slice from \a slice, stealing a reference. /// Construct a slice from \a slice, stealing a reference.
Slice(grpc_slice slice, StealRef); Slice(grpc_slice slice, StealRef) : slice_(slice) {}
/// Allocate a slice of specified size /// Allocate a slice of specified size
Slice(size_t len); Slice(size_t len)
: slice_(g_core_codegen_interface->grpc_slice_malloc(len)) {}
/// Construct a slice from a copied buffer /// Construct a slice from a copied buffer
Slice(const void* buf, size_t len); Slice(const void* buf, size_t len)
: slice_(g_core_codegen_interface->grpc_slice_from_copied_buffer(
reinterpret_cast<const char*>(buf), len)) {}
/// Construct a slice from a copied string /// Construct a slice from a copied string
Slice(const grpc::string& str); Slice(const grpc::string& str)
: slice_(g_core_codegen_interface->grpc_slice_from_copied_buffer(
str.c_str(), str.length())) {}
enum StaticSlice { STATIC_SLICE }; enum StaticSlice { STATIC_SLICE };
/// Construct a slice from a static buffer /// Construct a slice from a static buffer
Slice(const void* buf, size_t len, StaticSlice); Slice(const void* buf, size_t len, StaticSlice)
: slice_(g_core_codegen_interface->grpc_slice_from_static_buffer(
reinterpret_cast<const char*>(buf), len)) {}
/// Copy constructor, adds a reference. /// Copy constructor, adds a reference.
Slice(const Slice& other); Slice(const Slice& other)
: slice_(g_core_codegen_interface->grpc_slice_ref(other.slice_)) {}
/// Assignment, reference count is unchanged. /// Assignment, reference count is unchanged.
Slice& operator=(Slice other) { Slice& operator=(Slice other) {
@ -75,14 +84,18 @@ class Slice final {
/// user data pointer passed in at destruction. Can be the same as buf or /// user data pointer passed in at destruction. Can be the same as buf or
/// different (e.g., if data is part of a larger structure that must be /// different (e.g., if data is part of a larger structure that must be
/// destroyed when the data is no longer needed) /// destroyed when the data is no longer needed)
Slice(void* buf, size_t len, void (*destroy)(void*), void* user_data); Slice(void* buf, size_t len, void (*destroy)(void*), void* user_data)
: slice_(g_core_codegen_interface->grpc_slice_new_with_user_data(
buf, len, destroy, user_data)) {}
/// Specialization of above for common case where buf == user_data /// Specialization of above for common case where buf == user_data
Slice(void* buf, size_t len, void (*destroy)(void*)) Slice(void* buf, size_t len, void (*destroy)(void*))
: Slice(buf, len, destroy, buf) {} : Slice(buf, len, destroy, buf) {}
/// Similar to the above but has a destroy that also takes slice length /// Similar to the above but has a destroy that also takes slice length
Slice(void* buf, size_t len, void (*destroy)(void*, size_t)); Slice(void* buf, size_t len, void (*destroy)(void*, size_t))
: slice_(g_core_codegen_interface->grpc_slice_new_with_len(buf, len,
destroy)) {}
/// Byte size. /// Byte size.
size_t size() const { return GRPC_SLICE_LENGTH(slice_); } size_t size() const { return GRPC_SLICE_LENGTH(slice_); }
@ -94,7 +107,9 @@ class Slice final {
const uint8_t* end() const { return GRPC_SLICE_END_PTR(slice_); } const uint8_t* end() const { return GRPC_SLICE_END_PTR(slice_); }
/// Raw C slice. Caller needs to call grpc_slice_unref when done. /// Raw C slice. Caller needs to call grpc_slice_unref when done.
grpc_slice c_slice() const; grpc_slice c_slice() const {
return g_core_codegen_interface->grpc_slice_ref(slice_);
}
private: private:
friend class ByteBuffer; friend class ByteBuffer;

@ -21,6 +21,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <vector>
#include <grpcpp/impl/codegen/grpc_library.h> #include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/security/auth_context.h> #include <grpcpp/security/auth_context.h>
@ -219,6 +220,21 @@ class MetadataCredentialsPlugin {
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin( std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin); std::unique_ptr<MetadataCredentialsPlugin> plugin);
namespace experimental {
/// Options used to build AltsCredentials.
struct AltsCredentialsOptions {
/// service accounts of target endpoint that will be acceptable
/// by the client. If service accounts are provided and none of them matches
/// that of the server, authentication will fail.
std::vector<grpc::string> target_service_accounts;
};
/// Builds ALTS Credentials given ALTS specific options
std::shared_ptr<ChannelCredentials> AltsCredentials(
const AltsCredentialsOptions& options);
} // namespace experimental
} // namespace grpc } // namespace grpc
#endif // GRPCPP_SECURITY_CREDENTIALS_H #endif // GRPCPP_SECURITY_CREDENTIALS_H

@ -86,6 +86,18 @@ std::shared_ptr<ServerCredentials> SslServerCredentials(
/// Builds insecure server credentials. /// Builds insecure server credentials.
std::shared_ptr<ServerCredentials> InsecureServerCredentials(); std::shared_ptr<ServerCredentials> InsecureServerCredentials();
namespace experimental {
/// Options to create ServerCredentials with ALTS
struct AltsServerCredentialsOptions {
/// Add fields if needed.
};
/// Builds ALTS ServerCredentials given ALTS specific options
std::shared_ptr<ServerCredentials> AltsServerCredentials(
const AltsServerCredentialsOptions& options);
} // namespace experimental
} // namespace grpc } // namespace grpc
#endif // GRPCPP_SECURITY_SERVER_CREDENTIALS_H #endif // GRPCPP_SECURITY_SERVER_CREDENTIALS_H

@ -0,0 +1,24 @@
/*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_READER_H
#define GRPCPP_SUPPORT_PROTO_BUFFER_READER_H
#include <grpcpp/impl/codegen/proto_buffer_reader.h>
#endif // GRPCPP_SUPPORT_PROTO_BUFFER_READER_H

@ -0,0 +1,24 @@
/*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H
#define GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H
#include <grpcpp/impl/codegen/proto_buffer_writer.h>
#endif // GRPCPP_SUPPORT_PROTO_BUFFER_WRITER_H

@ -13,8 +13,8 @@
<date>2018-01-19</date> <date>2018-01-19</date>
<time>16:06:07</time> <time>16:06:07</time>
<version> <version>
<release>1.11.0dev</release> <release>1.12.0dev</release>
<api>1.11.0dev</api> <api>1.12.0dev</api>
</version> </version>
<stability> <stability>
<release>beta</release> <release>beta</release>

@ -239,9 +239,6 @@ PACKAGE_DIRECTORIES = {
INSTALL_REQUIRES = ( INSTALL_REQUIRES = (
'six>=1.5.2', 'six>=1.5.2',
# TODO(atash): eventually split the grpcio package into a metapackage
# depending on protobuf and the runtime component (independent of protobuf)
'protobuf>=3.5.0.post1',
) )
if not PY3: if not PY3:

@ -0,0 +1,9 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild

@ -0,0 +1,37 @@
gRPC on Android
==============
Note: Building the protobuf dependency for Android requires
https://github.com/google/protobuf/pull/3878. This fix will be in the next
protobuf release, but until then must be manually patched in to
`third_party/protobuf` to build gRPC for Android.
PREREQUISITES
-------------
- Android SDK
- Android NDK
- `protoc` and `grpc_cpp_plugin` binaries on the host system
INSTALL
-------
The example application can be built via Android Studio or on the command line
using `gradle`:
```sh
$ ./gradlew installDebug
```
INSTRUMENTATION TESTS
---------------------
The instrumentation tests can be run via the following `gradle` command. This
requires an emulator already running on your computer.
```
$ ./gradlew connectedAndroidTest \
-Pandroid.testInstrumentationRunnerArguments.server_host=grpc-test.sandbox.googleapis.com \
-Pandroid.testInstrumentationRunnerArguments.server_port=443 \
-Pandroid.testInstrumentationRunnerArguments.use_tls=true
```

@ -0,0 +1,119 @@
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(PROTOBUF_PROTOC_EXECUTABLE "/usr/local/bin/protoc" CACHE STRING "Protoc binary on host")
set(gRPC_CPP_PLUGIN_EXECUTABLE "/usr/local/bin/grpc_cpp_plugin" CACHE STRING "gRPC CPP plugin binary on host")
set(GRPC_SRC_DIR ../../../../../)
set(GRPC_BUILD_DIR ../grpc/outputs/${ANDROID_ABI})
file(MAKE_DIRECTORY ${GRPC_BUILD_DIR})
add_subdirectory(${GRPC_SRC_DIR} ${GRPC_BUILD_DIR})
#include_directories(${GRPC_SRC_DIR}/include)
include_directories(${GRPC_SRC_DIR})
set(GRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens)
file(MAKE_DIRECTORY ${GRPC_PROTO_GENS_DIR})
include_directories(${GRPC_PROTO_GENS_DIR})
function(android_protobuf_grpc_generate_cpp SRC_FILES HDR_FILES INCLUDE_ROOT)
if(NOT ARGN)
message(SEND_ERROR "Error: android_protobuf_grpc_generate_cpp() called without any proto files")
return()
endif()
set(${SRC_FILES})
set(${HDR_FILES})
set(PROTOBUF_INCLUDE_PATH -I ${INCLUDE_ROOT})
foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)
file(RELATIVE_PATH REL_FIL ${CMAKE_CURRENT_SOURCE_DIR}/${INCLUDE_ROOT} ${ABS_FIL})
get_filename_component(REL_DIR ${REL_FIL} DIRECTORY)
set(RELFIL_WE "${REL_DIR}/${FIL_WE}")
list(APPEND ${SRC_FILES} "${GRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc")
list(APPEND ${HDR_FILES} "${GRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h")
list(APPEND ${SRC_FILES} "${GRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc")
list(APPEND ${HDR_FILES} "${GRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h")
add_custom_command(
OUTPUT "${GRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc"
"${GRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h"
"${GRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc"
"${GRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h"
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
ARGS --grpc_out=${GRPC_PROTO_GENS_DIR}
--cpp_out=${GRPC_PROTO_GENS_DIR}
--plugin=protoc-gen-grpc=${gRPC_CPP_PLUGIN_EXECUTABLE}
${PROTOBUF_INCLUDE_PATH}
${REL_FIL}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${PROTOBUF_PROTOC_EXECUTABLE} ${gRPC_CPP_PLUGIN_EXECUTABLE} ${ABS_FIL} )
endforeach()
set_source_files_properties(${${SRC_FILES}} ${${HDR_FILES}} PROPERTIES GENERATED TRUE)
set(${SRC_FILES} ${${SRC_FILES}} PARENT_SCOPE)
set(${HDR_FILES} ${${HDR_FILES}} PARENT_SCOPE)
endfunction()
set(PROTO_BASE_DIR ${GRPC_SRC_DIR}/examples/protos)
android_protobuf_grpc_generate_cpp(
MESSAGES_PROTO_SRCS MESSAGES_PROTO_HDRS
${GRPC_SRC_DIR} ${GRPC_SRC_DIR}/src/proto/grpc/testing/messages.proto)
add_library(messages_proto_lib
SHARED ${MESSAGES_PROTO_SRCS} ${MESSAGES_PROTO_HDRS})
target_link_libraries(messages_proto_lib
libprotobuf
grpc++
android
log)
android_protobuf_grpc_generate_cpp(
EMPTY_PROTO_SRCS EMPTY_PROTO_HDRS
${GRPC_SRC_DIR} ${GRPC_SRC_DIR}/src/proto/grpc/testing/empty.proto)
add_library(empty_proto_lib
SHARED ${EMPTY_PROTO_SRCS} ${EMPTY_PROTO_HDRS})
target_link_libraries(empty_proto_lib
libprotobuf
grpc++
android
log)
android_protobuf_grpc_generate_cpp(
TEST_PROTO_SRCS TEST_PROTO_HDRS ${GRPC_SRC_DIR} ${GRPC_SRC_DIR}/src/proto/grpc/testing/test.proto)
add_library(test_proto_lib
SHARED ${TEST_PROTO_SRCS} ${TEST_PROTO_HDRS})
target_link_libraries(test_proto_lib
libprotobuf
grpc++
empty_proto_lib
messages_proto_lib
android
log)
find_library(log-lib
log)
add_library(grpc-interop
SHARED
src/main/cpp/grpc-interop.cc
${GRPC_SRC_DIR}/test/cpp/interop/interop_client.h
${GRPC_SRC_DIR}/test/cpp/interop/interop_client.cc)
target_link_libraries(grpc-interop
messages_proto_lib
empty_proto_lib
test_proto_lib
android
${log-lib})

@ -0,0 +1,56 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "io.grpc.android.interop.cpp"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
// The paths to the protoc and grpc_cpp_plugin binaries on the host system (codegen
// is not cross-compiled to Android)
def protoc = project.hasProperty('protoc') ?
project.property('protoc') : '/usr/local/bin/protoc'
def grpc_cpp_plugin = project.hasProperty('grpc_cpp_plugin') ?
project.property('grpc_cpp_plugin') : '/usr/local/bin/grpc_cpp_plugin'
cppFlags "-std=c++14 -frtti -fexceptions"
arguments '-DANDROID_STL=c++_shared'
arguments '-DRUN_HAVE_POSIX_REGEX=0'
arguments '-DRUN_HAVE_STD_REGEX=0'
arguments '-DRUN_HAVE_STEADY_CLOCK=0'
arguments '-Dprotobuf_BUILD_PROTOC_BINARIES=off'
arguments '-DgRPC_BUILD_CODEGEN=off'
arguments '-DPROTOBUF_PROTOC_EXECUTABLE=' + protoc
arguments '-DgRPC_CPP_PLUGIN_EXECUTABLE=' + grpc_cpp_plugin
}
}
ndk.abiFilters 'x86'
}
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -0,0 +1,93 @@
/*
* Copyright 2018, gRPC Authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.grpc.interop.cpp;
import static junit.framework.Assert.assertTrue;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class InteropTest {
private String host;
private int port;
private boolean useTls;
@Before
public void setUp() throws Exception {
host =
InstrumentationRegistry.getArguments()
.getString("server_host", "grpc-test.sandbox.googleapis.com");
port = Integer.parseInt(InstrumentationRegistry.getArguments().getString("server_port", "443"));
useTls =
Boolean.parseBoolean(InstrumentationRegistry.getArguments().getString("use_tls", "true"));
if (useTls) {
Context ctx = InstrumentationRegistry.getTargetContext();
String sslRootsFile = "roots.pem";
InputStream in = ctx.getAssets().open(sslRootsFile);
File outFile = new File(ctx.getExternalFilesDir(null), sslRootsFile);
OutputStream out = new FileOutputStream(outFile);
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
in.close();
out.close();
InteropActivity.configureSslRoots(outFile.getCanonicalPath());
}
}
@Test
public void emptyUnary() {
assertTrue(InteropActivity.doEmpty(host, port, useTls));
}
@Test
public void largeUnary() {
assertTrue(InteropActivity.doLargeUnary(host, port, useTls));
}
@Test
public void emptyStream() {
assertTrue(InteropActivity.doEmptyStream(host, port, useTls));
}
@Test
public void requestStreaming() {
assertTrue(InteropActivity.doRequestStreaming(host, port, useTls));
}
@Test
public void responseStreaming() {
assertTrue(InteropActivity.doResponseStreaming(host, port, useTls));
}
@Test
public void pingPong() {
assertTrue(InteropActivity.doPingPong(host, port, useTls));
}
}

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.grpc.interop.cpp" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Base.V7.Theme.AppCompat.Light" >
<activity
android:name=".InteropActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,124 @@
/*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpcpp/grpcpp.h>
#include <jni.h>
#include <src/core/lib/gpr/env.h>
#include "test/cpp/interop/interop_client.h"
extern "C" JNIEXPORT void JNICALL
Java_io_grpc_interop_cpp_InteropActivity_configureSslRoots(JNIEnv* env,
jobject obj_this,
jstring path_raw) {
const char* path = env->GetStringUTFChars(path_raw, (jboolean*)0);
gpr_setenv("GRPC_DEFAULT_SSL_ROOTS_FILE_PATH", path);
}
std::shared_ptr<grpc::testing::InteropClient> GetClient(const char* host,
int port,
bool use_tls) {
const int host_port_buf_size = 1024;
char host_port[host_port_buf_size];
snprintf(host_port, host_port_buf_size, "%s:%d", host, port);
std::shared_ptr<grpc::ChannelCredentials> credentials;
if (use_tls) {
credentials = grpc::SslCredentials(grpc::SslCredentialsOptions());
} else {
credentials = grpc::InsecureChannelCredentials();
}
return std::shared_ptr<grpc::testing::InteropClient>(
new grpc::testing::InteropClient(
grpc::CreateChannel(host_port, credentials), true, false));
}
extern "C" JNIEXPORT jboolean JNICALL
Java_io_grpc_interop_cpp_InteropActivity_doEmpty(JNIEnv* env, jobject obj_this,
jstring host_raw,
jint port_raw,
jboolean use_tls_raw) {
const char* host = env->GetStringUTFChars(host_raw, (jboolean*)0);
int port = static_cast<int>(port_raw);
bool use_tls = static_cast<bool>(use_tls_raw);
return GetClient(host, port, use_tls)->DoEmpty();
}
extern "C" JNIEXPORT jboolean JNICALL
Java_io_grpc_interop_cpp_InteropActivity_doLargeUnary(JNIEnv* env,
jobject obj_this,
jstring host_raw,
jint port_raw,
jboolean use_tls_raw) {
const char* host = env->GetStringUTFChars(host_raw, (jboolean*)0);
int port = static_cast<int>(port_raw);
bool use_tls = static_cast<bool>(use_tls_raw);
return GetClient(host, port, use_tls)->DoLargeUnary();
}
extern "C" JNIEXPORT jboolean JNICALL
Java_io_grpc_interop_cpp_InteropActivity_doEmptyStream(JNIEnv* env,
jobject obj_this,
jstring host_raw,
jint port_raw,
jboolean use_tls_raw) {
const char* host = env->GetStringUTFChars(host_raw, (jboolean*)0);
int port = static_cast<int>(port_raw);
bool use_tls = static_cast<bool>(use_tls_raw);
return GetClient(host, port, use_tls)->DoEmptyStream();
}
extern "C" JNIEXPORT jboolean JNICALL
Java_io_grpc_interop_cpp_InteropActivity_doRequestStreaming(
JNIEnv* env, jobject obj_this, jstring host_raw, jint port_raw,
jboolean use_tls_raw) {
const char* host = env->GetStringUTFChars(host_raw, (jboolean*)0);
int port = static_cast<int>(port_raw);
bool use_tls = static_cast<bool>(use_tls_raw);
return GetClient(host, port, use_tls)->DoRequestStreaming();
}
extern "C" JNIEXPORT jboolean JNICALL
Java_io_grpc_interop_cpp_InteropActivity_doResponseStreaming(
JNIEnv* env, jobject obj_this, jstring host_raw, jint port_raw,
jboolean use_tls_raw) {
const char* host = env->GetStringUTFChars(host_raw, (jboolean*)0);
int port = static_cast<int>(port_raw);
bool use_tls = static_cast<bool>(use_tls_raw);
return GetClient(host, port, use_tls)->DoResponseStreaming();
}
extern "C" JNIEXPORT jboolean JNICALL
Java_io_grpc_interop_cpp_InteropActivity_doPingPong(JNIEnv* env,
jobject obj_this,
jstring host_raw,
jint port_raw,
jboolean use_tls_raw) {
const char* host = env->GetStringUTFChars(host_raw, (jboolean*)0);
int port = static_cast<int>(port_raw);
bool use_tls = static_cast<bool>(use_tls_raw);
return GetClient(host, port, use_tls)->DoPingPong();
}

@ -0,0 +1,122 @@
/*
* Copyright 2018, gRPC Authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.grpc.interop.cpp;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.lang.ref.WeakReference;
public class InteropActivity extends AppCompatActivity {
static {
System.loadLibrary("grpc-interop");
}
private Button sendButton;
private EditText hostEdit;
private EditText portEdit;
private TextView resultText;
private GrpcTask grpcTask;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_interop);
sendButton = (Button) findViewById(R.id.ping_pong_button);
hostEdit = (EditText) findViewById(R.id.host_edit_text);
portEdit = (EditText) findViewById(R.id.port_edit_text);
resultText = (TextView) findViewById(R.id.grpc_result_text);
resultText.setMovementMethod(new ScrollingMovementMethod());
}
@Override
protected void onPause() {
super.onPause();
if (grpcTask != null) {
grpcTask.cancel(true);
grpcTask = null;
}
}
public void doPingPong(View view) {
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(hostEdit.getWindowToken(), 0);
sendButton.setEnabled(false);
resultText.setText("");
grpcTask = new GrpcTask(this);
grpcTask.executeOnExecutor(
AsyncTask.THREAD_POOL_EXECUTOR,
hostEdit.getText().toString(),
portEdit.getText().toString());
}
private static class GrpcTask extends AsyncTask<String, Void, String> {
private final WeakReference<InteropActivity> activityReference;
private GrpcTask(InteropActivity activity) {
this.activityReference = new WeakReference<InteropActivity>(activity);
}
@Override
protected String doInBackground(String... params) {
String host = params[0];
String portStr = params[1];
int port = TextUtils.isEmpty(portStr) ? 50051 : Integer.valueOf(portStr);
// TODO(ericgribkoff) Support other test cases in the app UI
if (doPingPong(host, port, false)) {
return "Success";
} else {
return "Failure";
}
}
@Override
protected void onPostExecute(String result) {
InteropActivity activity = activityReference.get();
if (activity == null || isCancelled()) {
return;
}
TextView resultText = (TextView) activity.findViewById(R.id.grpc_result_text);
Button sendButton = (Button) activity.findViewById(R.id.ping_pong_button);
resultText.setText(result);
sendButton.setEnabled(true);
}
}
public static native void configureSslRoots(String path);
public static native boolean doEmpty(String host, int port, boolean useTls);
public static native boolean doLargeUnary(String host, int port, boolean useTls);
public static native boolean doEmptyStream(String host, int port, boolean useTls);
public static native boolean doRequestStreaming(String host, int port, boolean useTls);
public static native boolean doResponseStreaming(String host, int port, boolean useTls);
public static native boolean doPingPong(String host, int port, boolean useTls);
}

@ -0,0 +1,48 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".InteropActivity"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="@+id/host_edit_text"
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="Enter Host" />
<EditText
android:id="@+id/port_edit_text"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:hint="Enter Port" />
</LinearLayout>
<Button
android:id="@+id/ping_pong_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="doPingPong"
android:text="Ping Pong" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:textSize="16sp"
android:text="Result:" />
<TextView
android:id="@+id/grpc_result_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars = "vertical"
android:textSize="16sp" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

@ -0,0 +1,3 @@
<resources>
<string name="app_name">gRPC C++ Interop App</string>
</resources>

@ -0,0 +1,24 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

@ -0,0 +1,17 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

@ -0,0 +1,6 @@
#Thu Jan 25 11:45:30 PST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -206,7 +206,7 @@ void PrintMethodImplementations(Printer* printer,
} }
} }
for (auto one_class : classes) { for (auto one_class : classes) {
output += " @class " + one_class + ";\n"; output += "@class " + one_class + ";\n";
} }
return output; return output;

@ -118,11 +118,11 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
Write(context, file_name + ".pbrpc.h", Write(context, file_name + ".pbrpc.h",
PreprocIfNot(kForwardDeclare, imports) + "\n" + PreprocIfNot(kForwardDeclare, imports) + "\n" +
PreprocIfNot(kProtocolOnly, system_imports) + "\n" + PreprocIfNot(kProtocolOnly, system_imports) + "\n" +
PreprocIfElse(kForwardDeclare, class_declarations, class_declarations + "\n" +
class_imports) + PreprocIfNot(kForwardDeclare, class_imports) + "\n" +
"\n" + forward_declarations + "\n" + kNonNullBegin + "\n" + forward_declarations + "\n" + kNonNullBegin + "\n" + protocols +
protocols + "\n" + PreprocIfNot(kProtocolOnly, interfaces) + "\n" + PreprocIfNot(kProtocolOnly, interfaces) + "\n" +
"\n" + kNonNullEnd + "\n"); kNonNullEnd + "\n");
} }
{ {

@ -924,7 +924,9 @@ typedef struct client_channel_call_data {
// Note: We inline the cache for the first 3 send_message ops and use // Note: We inline the cache for the first 3 send_message ops and use
// dynamic allocation after that. This number was essentially picked // dynamic allocation after that. This number was essentially picked
// at random; it could be changed in the future to tune performance. // at random; it could be changed in the future to tune performance.
grpc_core::InlinedVector<grpc_core::ByteStreamCache*, 3> send_messages; grpc_core::ManualConstructor<
grpc_core::InlinedVector<grpc_core::ByteStreamCache*, 3>>
send_messages;
// send_trailing_metadata // send_trailing_metadata
bool seen_send_trailing_metadata; bool seen_send_trailing_metadata;
grpc_linked_mdelem* send_trailing_metadata_storage; grpc_linked_mdelem* send_trailing_metadata_storage;
@ -974,7 +976,7 @@ static void maybe_cache_send_ops_for_batch(call_data* calld,
gpr_arena_alloc(calld->arena, sizeof(grpc_core::ByteStreamCache))); gpr_arena_alloc(calld->arena, sizeof(grpc_core::ByteStreamCache)));
new (cache) grpc_core::ByteStreamCache( new (cache) grpc_core::ByteStreamCache(
std::move(batch->payload->send_message.send_message)); std::move(batch->payload->send_message.send_message));
calld->send_messages.push_back(cache); calld->send_messages->push_back(cache);
} }
// Save metadata batch for send_trailing_metadata ops. // Save metadata batch for send_trailing_metadata ops.
if (batch->send_trailing_metadata) { if (batch->send_trailing_metadata) {
@ -1008,7 +1010,7 @@ static void free_cached_send_op_data_after_commit(
"]", "]",
chand, calld, i); chand, calld, i);
} }
calld->send_messages[i]->Destroy(); (*calld->send_messages)[i]->Destroy();
} }
if (retry_state->completed_send_trailing_metadata) { if (retry_state->completed_send_trailing_metadata) {
grpc_metadata_batch_destroy(&calld->send_trailing_metadata); grpc_metadata_batch_destroy(&calld->send_trailing_metadata);
@ -1032,7 +1034,7 @@ static void free_cached_send_op_data_for_completed_batch(
"]", "]",
chand, calld, retry_state->completed_send_message_count - 1); chand, calld, retry_state->completed_send_message_count - 1);
} }
calld->send_messages[retry_state->completed_send_message_count - 1] (*calld->send_messages)[retry_state->completed_send_message_count - 1]
->Destroy(); ->Destroy();
} }
if (batch_data->batch.send_trailing_metadata) { if (batch_data->batch.send_trailing_metadata) {
@ -1280,7 +1282,8 @@ static bool pending_batch_is_completed(
return false; return false;
} }
if (pending->batch->send_message && if (pending->batch->send_message &&
retry_state->completed_send_message_count < calld->send_messages.size()) { retry_state->completed_send_message_count <
calld->send_messages->size()) {
return false; return false;
} }
if (pending->batch->send_trailing_metadata && if (pending->batch->send_trailing_metadata &&
@ -1315,7 +1318,7 @@ static bool pending_batch_is_unstarted(
return true; return true;
} }
if (pending->batch->send_message && if (pending->batch->send_message &&
retry_state->started_send_message_count < calld->send_messages.size()) { retry_state->started_send_message_count < calld->send_messages->size()) {
return true; return true;
} }
if (pending->batch->send_trailing_metadata && if (pending->batch->send_trailing_metadata &&
@ -1817,7 +1820,7 @@ static void add_closures_for_replay_or_pending_send_ops(
channel_data* chand = static_cast<channel_data*>(elem->channel_data); channel_data* chand = static_cast<channel_data*>(elem->channel_data);
call_data* calld = static_cast<call_data*>(elem->call_data); call_data* calld = static_cast<call_data*>(elem->call_data);
bool have_pending_send_message_ops = bool have_pending_send_message_ops =
retry_state->started_send_message_count < calld->send_messages.size(); retry_state->started_send_message_count < calld->send_messages->size();
bool have_pending_send_trailing_metadata_op = bool have_pending_send_trailing_metadata_op =
calld->seen_send_trailing_metadata && calld->seen_send_trailing_metadata &&
!retry_state->started_send_trailing_metadata; !retry_state->started_send_trailing_metadata;
@ -2133,7 +2136,7 @@ static void add_retriable_send_message_op(
chand, calld, retry_state->started_send_message_count); chand, calld, retry_state->started_send_message_count);
} }
grpc_core::ByteStreamCache* cache = grpc_core::ByteStreamCache* cache =
calld->send_messages[retry_state->started_send_message_count]; (*calld->send_messages)[retry_state->started_send_message_count];
++retry_state->started_send_message_count; ++retry_state->started_send_message_count;
batch_data->send_message.Init(cache); batch_data->send_message.Init(cache);
batch_data->batch.send_message = true; batch_data->batch.send_message = true;
@ -2254,7 +2257,7 @@ static subchannel_batch_data* maybe_create_subchannel_batch_for_replay(
} }
// send_message. // send_message.
// Note that we can only have one send_message op in flight at a time. // Note that we can only have one send_message op in flight at a time.
if (retry_state->started_send_message_count < calld->send_messages.size() && if (retry_state->started_send_message_count < calld->send_messages->size() &&
retry_state->started_send_message_count == retry_state->started_send_message_count ==
retry_state->completed_send_message_count && retry_state->completed_send_message_count &&
!calld->pending_send_message) { !calld->pending_send_message) {
@ -2274,7 +2277,7 @@ static subchannel_batch_data* maybe_create_subchannel_batch_for_replay(
// to start, since we can't send down any more send_message ops after // to start, since we can't send down any more send_message ops after
// send_trailing_metadata. // send_trailing_metadata.
if (calld->seen_send_trailing_metadata && if (calld->seen_send_trailing_metadata &&
retry_state->started_send_message_count == calld->send_messages.size() && retry_state->started_send_message_count == calld->send_messages->size() &&
!retry_state->started_send_trailing_metadata && !retry_state->started_send_trailing_metadata &&
!calld->pending_send_trailing_metadata) { !calld->pending_send_trailing_metadata) {
if (grpc_client_channel_trace.enabled()) { if (grpc_client_channel_trace.enabled()) {
@ -2325,7 +2328,7 @@ static void add_subchannel_batches_for_pending_batches(
// send_message ops after send_trailing_metadata. // send_message ops after send_trailing_metadata.
if (batch->send_trailing_metadata && if (batch->send_trailing_metadata &&
(retry_state->started_send_message_count + batch->send_message < (retry_state->started_send_message_count + batch->send_message <
calld->send_messages.size() || calld->send_messages->size() ||
retry_state->started_send_trailing_metadata)) { retry_state->started_send_trailing_metadata)) {
continue; continue;
} }
@ -2976,6 +2979,7 @@ static grpc_error* cc_init_call_elem(grpc_call_element* elem,
calld->deadline); calld->deadline);
} }
calld->enable_retries = chand->enable_retries; calld->enable_retries = chand->enable_retries;
calld->send_messages.Init();
return GRPC_ERROR_NONE; return GRPC_ERROR_NONE;
} }
@ -3011,6 +3015,7 @@ static void cc_destroy_call_elem(grpc_call_element* elem,
calld->pick.subchannel_call_context[i].value); calld->pick.subchannel_call_context[i].value);
} }
} }
calld->send_messages.Destroy();
GRPC_CLOSURE_SCHED(then_schedule_closure, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(then_schedule_closure, GRPC_ERROR_NONE);
} }

@ -135,6 +135,7 @@ AresDnsResolver::AresDnsResolver(const ResolverArgs& args)
if (path[0] == '/') ++path; if (path[0] == '/') ++path;
name_to_resolve_ = gpr_strdup(path); name_to_resolve_ = gpr_strdup(path);
// Get DNS server from URI authority. // Get DNS server from URI authority.
dns_server_ = nullptr;
if (0 != strcmp(args.uri->authority, "")) { if (0 != strcmp(args.uri->authority, "")) {
dns_server_ = gpr_strdup(args.uri->authority); dns_server_ = gpr_strdup(args.uri->authority);
} }

@ -129,6 +129,17 @@ const grpc_channel_filter grpc_client_authority_filter = {
static bool add_client_authority_filter(grpc_channel_stack_builder* builder, static bool add_client_authority_filter(grpc_channel_stack_builder* builder,
void* arg) { void* arg) {
const grpc_channel_args* channel_args =
grpc_channel_stack_builder_get_channel_arguments(builder);
const grpc_arg* disable_client_authority_filter_arg = grpc_channel_args_find(
channel_args, GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER);
if (disable_client_authority_filter_arg != nullptr) {
const bool is_client_authority_filter_disabled =
grpc_channel_arg_get_bool(disable_client_authority_filter_arg, false);
if (is_client_authority_filter_disabled) {
return true;
}
}
return grpc_channel_stack_builder_prepend_filter( return grpc_channel_stack_builder_prepend_filter(
builder, static_cast<const grpc_channel_filter*>(arg), nullptr, nullptr); builder, static_cast<const grpc_channel_filter*>(arg), nullptr, nullptr);
} }

@ -1676,6 +1676,33 @@ static void send_ping_locked(grpc_chttp2_transport* t,
GRPC_ERROR_NONE); GRPC_ERROR_NONE);
} }
/*
* Specialized form of send_ping_locked for keepalive ping. If there is already
* a ping in progress, the keepalive ping would piggyback onto that ping,
* instead of waiting for that ping to complete and then starting a new ping.
*/
static void send_keepalive_ping_locked(grpc_chttp2_transport* t) {
if (t->closed_with_error != GRPC_ERROR_NONE) {
GRPC_CLOSURE_SCHED(&t->start_keepalive_ping_locked,
GRPC_ERROR_REF(t->closed_with_error));
GRPC_CLOSURE_SCHED(&t->finish_keepalive_ping_locked,
GRPC_ERROR_REF(t->closed_with_error));
return;
}
grpc_chttp2_ping_queue* pq = &t->ping_queue;
if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_INFLIGHT])) {
/* There is a ping in flight. Add yourself to the inflight closure list. */
GRPC_CLOSURE_SCHED(&t->start_keepalive_ping_locked, GRPC_ERROR_NONE);
grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_INFLIGHT],
&t->finish_keepalive_ping_locked, GRPC_ERROR_NONE);
return;
}
grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_INITIATE],
&t->start_keepalive_ping_locked, GRPC_ERROR_NONE);
grpc_closure_list_append(&pq->lists[GRPC_CHTTP2_PCL_NEXT],
&t->finish_keepalive_ping_locked, GRPC_ERROR_NONE);
}
static void retry_initiate_ping_locked(void* tp, grpc_error* error) { static void retry_initiate_ping_locked(void* tp, grpc_error* error) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp); grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(tp);
t->ping_state.is_delayed_ping_timer_set = false; t->ping_state.is_delayed_ping_timer_set = false;
@ -2619,8 +2646,7 @@ static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
grpc_chttp2_stream_map_size(&t->stream_map) > 0) { grpc_chttp2_stream_map_size(&t->stream_map) > 0) {
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING; t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING;
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive ping end"); GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive ping end");
send_ping_locked(t, &t->start_keepalive_ping_locked, send_keepalive_ping_locked(t);
&t->finish_keepalive_ping_locked);
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING); grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING);
} else { } else {
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping"); GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");

@ -55,7 +55,8 @@ bool TraceFlagList::Set(const char* name, bool enabled) {
found = true; found = true;
} }
} }
if (!found) { // check for unknowns, but ignore "", to allow to GRPC_TRACE=
if (!found && 0 != strcmp(name, "")) {
gpr_log(GPR_ERROR, "Unknown trace var: '%s'", name); gpr_log(GPR_ERROR, "Unknown trace var: '%s'", name);
return false; /* early return */ return false; /* early return */
} }

@ -44,10 +44,16 @@ const char* gpr_log_severity_string(gpr_log_severity severity) {
GPR_UNREACHABLE_CODE(return "UNKNOWN"); GPR_UNREACHABLE_CODE(return "UNKNOWN");
} }
int gpr_should_log(gpr_log_severity severity) {
return static_cast<gpr_atm>(severity) >=
gpr_atm_no_barrier_load(&g_min_severity_to_print)
? 1
: 0;
}
void gpr_log_message(const char* file, int line, gpr_log_severity severity, void gpr_log_message(const char* file, int line, gpr_log_severity severity,
const char* message) { const char* message) {
if (static_cast<gpr_atm>(severity) < if (gpr_should_log(severity) == 0) {
gpr_atm_no_barrier_load(&g_min_severity_to_print)) {
return; return;
} }

@ -41,6 +41,10 @@ static android_LogPriority severity_to_log_priority(gpr_log_severity severity) {
void gpr_log(const char* file, int line, gpr_log_severity severity, void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) { const char* format, ...) {
/* Avoid message construction if gpr_log_message won't log */
if (gpr_should_log(severity) == 0) {
return;
}
char* message = NULL; char* message = NULL;
va_list args; va_list args;
va_start(args, format); va_start(args, format);

@ -44,6 +44,10 @@ static long gettid(void) { return syscall(__NR_gettid); }
void gpr_log(const char* file, int line, gpr_log_severity severity, void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) { const char* format, ...) {
/* Avoid message construction if gpr_log_message won't log */
if (gpr_should_log(severity) == 0) {
return;
}
char* message = nullptr; char* message = nullptr;
va_list args; va_list args;
va_start(args, format); va_start(args, format);

@ -34,6 +34,10 @@ static intptr_t gettid(void) { return (intptr_t)pthread_self(); }
void gpr_log(const char* file, int line, gpr_log_severity severity, void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) { const char* format, ...) {
/* Avoid message construction if gpr_log_message won't log */
if (gpr_should_log(severity) == 0) {
return;
}
char buf[64]; char buf[64];
char* allocated = nullptr; char* allocated = nullptr;
char* message = nullptr; char* message = nullptr;

@ -34,6 +34,11 @@
void gpr_log(const char* file, int line, gpr_log_severity severity, void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) { const char* format, ...) {
/* Avoid message construction if gpr_log_message won't log */
if (gpr_should_log(severity) == 0) {
return;
}
char* message = NULL; char* message = NULL;
va_list args; va_list args;
int ret; int ret;

@ -54,43 +54,43 @@ class InlinedVector {
InlinedVector(const InlinedVector&) = delete; InlinedVector(const InlinedVector&) = delete;
InlinedVector& operator=(const InlinedVector&) = delete; InlinedVector& operator=(const InlinedVector&) = delete;
T* data() {
return dynamic_ != nullptr ? dynamic_ : reinterpret_cast<T*>(inline_);
}
const T* data() const {
return dynamic_ != nullptr ? dynamic_ : reinterpret_cast<const T*>(inline_);
}
T& operator[](size_t offset) { T& operator[](size_t offset) {
assert(offset < size_); assert(offset < size_);
if (offset < N) { return data()[offset];
return *reinterpret_cast<T*>(inline_ + offset);
} else {
return dynamic_[offset - N];
}
} }
const T& operator[](size_t offset) const { const T& operator[](size_t offset) const {
assert(offset < size_); assert(offset < size_);
if (offset < N) { return data()[offset];
return *reinterpret_cast<const T*>(inline_ + offset);
} else {
return dynamic_[offset - N];
}
} }
template <typename... Args> void reserve(size_t capacity) {
void emplace_back(Args&&... args) { if (capacity > capacity_) {
if (size_ < N) { T* new_dynamic = static_cast<T*>(gpr_malloc(sizeof(T) * capacity));
new (&inline_[size_]) T(std::forward<Args>(args)...); for (size_t i = 0; i < size_; ++i) {
} else { new (&new_dynamic[i]) T(std::move(data()[i]));
if (size_ - N == dynamic_capacity_) { data()[i].~T();
size_t new_capacity =
dynamic_capacity_ == 0 ? 2 : dynamic_capacity_ * 2;
T* new_dynamic = static_cast<T*>(gpr_malloc(sizeof(T) * new_capacity));
for (size_t i = 0; i < dynamic_capacity_; ++i) {
new (&new_dynamic[i]) T(std::move(dynamic_[i]));
dynamic_[i].~T();
} }
gpr_free(dynamic_); gpr_free(dynamic_);
dynamic_ = new_dynamic; dynamic_ = new_dynamic;
dynamic_capacity_ = new_capacity; capacity_ = capacity;
} }
new (&dynamic_[size_ - N]) T(std::forward<Args>(args)...);
} }
template <typename... Args>
void emplace_back(Args&&... args) {
if (size_ == capacity_) {
reserve(capacity_ * 2);
}
new (&(data()[size_])) T(std::forward<Args>(args)...);
++size_; ++size_;
} }
@ -99,6 +99,7 @@ class InlinedVector {
void push_back(T&& value) { emplace_back(std::move(value)); } void push_back(T&& value) { emplace_back(std::move(value)); }
size_t size() const { return size_; } size_t size() const { return size_; }
size_t capacity() const { return capacity_; }
void clear() { void clear() {
destroy_elements(); destroy_elements();
@ -109,26 +110,21 @@ class InlinedVector {
void init_data() { void init_data() {
dynamic_ = nullptr; dynamic_ = nullptr;
size_ = 0; size_ = 0;
dynamic_capacity_ = 0; capacity_ = N;
} }
void destroy_elements() { void destroy_elements() {
for (size_t i = 0; i < size_ && i < N; ++i) { for (size_t i = 0; i < size_; ++i) {
T& value = *reinterpret_cast<T*>(inline_ + i); T& value = data()[i];
value.~T(); value.~T();
} }
if (size_ > N) { // Avoid subtracting two signed values.
for (size_t i = 0; i < size_ - N; ++i) {
dynamic_[i].~T();
}
}
gpr_free(dynamic_); gpr_free(dynamic_);
} }
typename std::aligned_storage<sizeof(T)>::type inline_[N]; typename std::aligned_storage<sizeof(T)>::type inline_[N];
T* dynamic_; T* dynamic_;
size_t size_; size_t size_;
size_t dynamic_capacity_; size_t capacity_;
}; };
} // namespace grpc_core } // namespace grpc_core

@ -59,7 +59,10 @@
//#define GRPC_EPOLLEX_CREATE_WORKERS_ON_HEAP 1 //#define GRPC_EPOLLEX_CREATE_WORKERS_ON_HEAP 1
#define MAX_EPOLL_EVENTS 100 #define MAX_EPOLL_EVENTS 100
#define MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL 1 // TODO(juanlishen): We use a greater-than-one value here as a workaround fix to
// a keepalive ping timeout issue. We may want to revert https://github
// .com/grpc/grpc/pull/14943 once we figure out the root cause.
#define MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL 16
grpc_core::DebugOnlyTraceFlag grpc_trace_pollable_refcount(false, grpc_core::DebugOnlyTraceFlag grpc_trace_pollable_refcount(false,
"pollable_refcount"); "pollable_refcount");
@ -198,6 +201,7 @@ struct grpc_pollset_worker {
struct grpc_pollset { struct grpc_pollset {
gpr_mu mu; gpr_mu mu;
gpr_atm worker_count;
pollable* active_pollable; pollable* active_pollable;
bool kicked_without_poller; bool kicked_without_poller;
grpc_closure* shutdown_closure; grpc_closure* shutdown_closure;
@ -685,6 +689,7 @@ static grpc_error* pollset_kick_all(grpc_pollset* pollset) {
static void pollset_init(grpc_pollset* pollset, gpr_mu** mu) { static void pollset_init(grpc_pollset* pollset, gpr_mu** mu) {
gpr_mu_init(&pollset->mu); gpr_mu_init(&pollset->mu);
gpr_atm_no_barrier_store(&pollset->worker_count, 0);
pollset->active_pollable = POLLABLE_REF(g_empty_pollable, "pollset"); pollset->active_pollable = POLLABLE_REF(g_empty_pollable, "pollset");
pollset->kicked_without_poller = false; pollset->kicked_without_poller = false;
pollset->shutdown_closure = nullptr; pollset->shutdown_closure = nullptr;
@ -758,8 +763,20 @@ static grpc_error* pollable_process_events(grpc_pollset* pollset,
pollable* pollable_obj, bool drain) { pollable* pollable_obj, bool drain) {
GPR_TIMER_SCOPE("pollable_process_events", 0); GPR_TIMER_SCOPE("pollable_process_events", 0);
static const char* err_desc = "pollset_process_events"; static const char* err_desc = "pollset_process_events";
// Use a simple heuristic to determine how many fd events to process
// per loop iteration. (events/workers)
int handle_count = 1;
int worker_count = gpr_atm_no_barrier_load(&pollset->worker_count);
GPR_ASSERT(worker_count > 0);
handle_count =
(pollable_obj->event_count - pollable_obj->event_cursor) / worker_count;
if (handle_count == 0) {
handle_count = 1;
} else if (handle_count > MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL) {
handle_count = MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL;
}
grpc_error* error = GRPC_ERROR_NONE; grpc_error* error = GRPC_ERROR_NONE;
for (int i = 0; (drain || i < MAX_EPOLL_EVENTS_HANDLED_EACH_POLL_CALL) && for (int i = 0; (drain || i < handle_count) &&
pollable_obj->event_cursor != pollable_obj->event_count; pollable_obj->event_cursor != pollable_obj->event_count;
i++) { i++) {
int n = pollable_obj->event_cursor++; int n = pollable_obj->event_cursor++;
@ -884,6 +901,7 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
GPR_TIMER_SCOPE("begin_worker", 0); GPR_TIMER_SCOPE("begin_worker", 0);
bool do_poll = bool do_poll =
(pollset->shutdown_closure == nullptr && !pollset->already_shutdown); (pollset->shutdown_closure == nullptr && !pollset->already_shutdown);
gpr_atm_no_barrier_fetch_add(&pollset->worker_count, 1);
if (worker_hdl != nullptr) *worker_hdl = worker; if (worker_hdl != nullptr) *worker_hdl = worker;
worker->initialized_cv = false; worker->initialized_cv = false;
worker->kicked = false; worker->kicked = false;
@ -964,6 +982,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
if (worker->initialized_cv) { if (worker->initialized_cv) {
gpr_cv_destroy(&worker->cv); gpr_cv_destroy(&worker->cv);
} }
gpr_atm_no_barrier_fetch_add(&pollset->worker_count, -1);
} }
#ifndef NDEBUG #ifndef NDEBUG

@ -1530,6 +1530,12 @@ static void run_poll(void* args) {
// This function overrides poll() to handle condition variable wakeup fds // This function overrides poll() to handle condition variable wakeup fds
static int cvfd_poll(struct pollfd* fds, nfds_t nfds, int timeout) { static int cvfd_poll(struct pollfd* fds, nfds_t nfds, int timeout) {
if (timeout == 0) {
// Don't bother using background threads for polling if timeout is 0,
// poll-cv might not wait for a poll to return otherwise.
// https://github.com/grpc/grpc/issues/13298
return poll(fds, nfds, 0);
}
unsigned int i; unsigned int i;
int res, idx; int res, idx;
grpc_cv_node* pollcv; grpc_cv_node* pollcv;

@ -42,12 +42,23 @@ class LockfreeEvent {
void InitEvent(); void InitEvent();
void DestroyEvent(); void DestroyEvent();
// Returns true if fd has been shutdown, false otherwise.
bool IsShutdown() const { bool IsShutdown() const {
return (gpr_atm_no_barrier_load(&state_) & kShutdownBit) != 0; return (gpr_atm_no_barrier_load(&state_) & kShutdownBit) != 0;
} }
// Schedules \a closure when the event is received (see SetReady()) or the
// shutdown state has been set. Note that the event may have already been
// received, in which case the closure would be scheduled immediately.
// If the shutdown state has already been set, then \a closure is scheduled
// with the shutdown error.
void NotifyOn(grpc_closure* closure); void NotifyOn(grpc_closure* closure);
// Sets the shutdown state. If a closure had been provided by NotifyOn and has
// not yet been scheduled, it will be scheduled with \a error.
bool SetShutdown(grpc_error* error); bool SetShutdown(grpc_error* error);
// Signals that the event has been received.
void SetReady(); void SetReady();
private: private:

@ -181,6 +181,30 @@ grpc_error* grpc_set_socket_reuse_port(int fd, int reuse) {
#endif #endif
} }
static gpr_once g_probe_so_reuesport_once = GPR_ONCE_INIT;
static int g_support_so_reuseport = false;
void probe_so_reuseport_once(void) {
#ifndef GPR_MANYLINUX1
int s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0) {
/* This might be an ipv6-only environment in which case 'socket(AF_INET,..)'
call would fail. Try creating IPv6 socket in that case */
s = socket(AF_INET6, SOCK_STREAM, 0);
}
if (s >= 0) {
g_support_so_reuseport = GRPC_LOG_IF_ERROR(
"check for SO_REUSEPORT", grpc_set_socket_reuse_port(s, 1));
close(s);
}
#endif
}
bool grpc_is_socket_reuse_port_supported() {
gpr_once_init(&g_probe_so_reuesport_once, probe_so_reuseport_once);
return g_support_so_reuseport;
}
/* disable nagle */ /* disable nagle */
grpc_error* grpc_set_socket_low_latency(int fd, int low_latency) { grpc_error* grpc_set_socket_low_latency(int fd, int low_latency) {
int val = (low_latency != 0); int val = (low_latency != 0);

@ -33,8 +33,6 @@
int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock, int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock,
int cloexec) { int cloexec) {
int flags = 0; int flags = 0;
GPR_ASSERT(sizeof(socklen_t) <= sizeof(size_t));
GPR_ASSERT(resolved_addr->len <= (socklen_t)-1);
flags |= nonblock ? SOCK_NONBLOCK : 0; flags |= nonblock ? SOCK_NONBLOCK : 0;
flags |= cloexec ? SOCK_CLOEXEC : 0; flags |= cloexec ? SOCK_CLOEXEC : 0;
return accept4(sockfd, reinterpret_cast<grpc_sockaddr*>(resolved_addr->addr), return accept4(sockfd, reinterpret_cast<grpc_sockaddr*>(resolved_addr->addr),

@ -34,10 +34,8 @@
int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock, int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock,
int cloexec) { int cloexec) {
int fd, flags; int fd, flags;
GPR_ASSERT(sizeof(socklen_t) <= sizeof(size_t)); fd = accept(sockfd, reinterpret_cast<grpc_sockaddr*>(resolved_addr->addr),
GPR_ASSERT(resolved_addr->len <= (socklen_t)-1); &resolved_addr->len);
fd = accept(sockfd, (grpc_sockaddr*)resolved_addr->addr,
(socklen_t*)&resolved_addr->len);
if (fd >= 0) { if (fd >= 0) {
if (nonblock) { if (nonblock) {
flags = fcntl(fd, F_GETFL, 0); flags = fcntl(fd, F_GETFL, 0);

@ -44,6 +44,9 @@ grpc_error* grpc_set_socket_cloexec(int fd, int close_on_exec);
/* set a socket to reuse old addresses */ /* set a socket to reuse old addresses */
grpc_error* grpc_set_socket_reuse_addr(int fd, int reuse); grpc_error* grpc_set_socket_reuse_addr(int fd, int reuse);
/* return true if SO_REUSEPORT is supported */
bool grpc_is_socket_reuse_port_supported();
/* disable nagle */ /* disable nagle */
grpc_error* grpc_set_socket_low_latency(int fd, int low_latency); grpc_error* grpc_set_socket_low_latency(int fd, int low_latency);

@ -38,8 +38,8 @@ int grpc_inet_pton(int af, const char* src, void* dst) {
} }
const char* grpc_inet_ntop(int af, const void* src, char* dst, size_t size) { const char* grpc_inet_ntop(int af, const void* src, char* dst, size_t size) {
/* Windows InetNtopA wants a mutable ip pointer */ uv_inet_ntop(af, src, dst, size);
return inet_ntop(af, src, dst, (socklen_t)size); return dst;
} }
#endif /* GRPC_UV */ #endif /* GRPC_UV */

@ -62,8 +62,6 @@ typedef struct grpc_socket_vtable {
const grpc_sockaddr* addr, int* len); const grpc_sockaddr* addr, int* len);
grpc_error* (*getsockname)(grpc_custom_socket* socket, grpc_error* (*getsockname)(grpc_custom_socket* socket,
const grpc_sockaddr* addr, int* len); const grpc_sockaddr* addr, int* len);
grpc_error* (*setsockopt)(grpc_custom_socket* socket, int level, int optname,
const void* optval, uint32_t optlen);
grpc_error* (*bind)(grpc_custom_socket* socket, const grpc_sockaddr* addr, grpc_error* (*bind)(grpc_custom_socket* socket, const grpc_sockaddr* addr,
size_t len, int flags); size_t len, int flags);
grpc_error* (*listen)(grpc_custom_socket* socket); grpc_error* (*listen)(grpc_custom_socket* socket);

@ -393,13 +393,6 @@ static grpc_error* tcp_server_add_port(grpc_tcp_server* s,
grpc_custom_socket_vtable->init(socket, family); grpc_custom_socket_vtable->init(socket, family);
if (error == GRPC_ERROR_NONE) { if (error == GRPC_ERROR_NONE) {
#if defined(GPR_LINUX) && defined(SO_REUSEPORT)
if (family == AF_INET || family == AF_INET6) {
int enable = 1;
grpc_custom_socket_vtable->setsockopt(socket, SOL_SOCKET, SO_REUSEPORT,
&enable, sizeof(enable));
}
#endif /* GPR_LINUX && SO_REUSEPORT */
error = add_socket_to_server(s, socket, addr, port_index, &sp); error = add_socket_to_server(s, socket, addr, port_index, &sp);
} }
gpr_free(allocated_addr); gpr_free(allocated_addr);

@ -55,39 +55,18 @@
#include "src/core/lib/iomgr/tcp_server_utils_posix.h" #include "src/core/lib/iomgr/tcp_server_utils_posix.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h" #include "src/core/lib/iomgr/unix_sockets_posix.h"
static gpr_once check_init = GPR_ONCE_INIT;
static bool has_so_reuseport = false;
static void init(void) {
#ifndef GPR_MANYLINUX1
int s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0) {
/* This might be an ipv6-only environment in which case 'socket(AF_INET,..)'
call would fail. Try creating IPv6 socket in that case */
s = socket(AF_INET6, SOCK_STREAM, 0);
}
if (s >= 0) {
has_so_reuseport = GRPC_LOG_IF_ERROR("check for SO_REUSEPORT",
grpc_set_socket_reuse_port(s, 1));
close(s);
}
#endif
}
static grpc_error* tcp_server_create(grpc_closure* shutdown_complete, static grpc_error* tcp_server_create(grpc_closure* shutdown_complete,
const grpc_channel_args* args, const grpc_channel_args* args,
grpc_tcp_server** server) { grpc_tcp_server** server) {
gpr_once_init(&check_init, init);
grpc_tcp_server* s = grpc_tcp_server* s =
static_cast<grpc_tcp_server*>(gpr_zalloc(sizeof(grpc_tcp_server))); static_cast<grpc_tcp_server*>(gpr_zalloc(sizeof(grpc_tcp_server)));
s->so_reuseport = has_so_reuseport; s->so_reuseport = grpc_is_socket_reuse_port_supported();
s->expand_wildcard_addrs = false; s->expand_wildcard_addrs = false;
for (size_t i = 0; i < (args == nullptr ? 0 : args->num_args); i++) { for (size_t i = 0; i < (args == nullptr ? 0 : args->num_args); i++) {
if (0 == strcmp(GRPC_ARG_ALLOW_REUSEPORT, args->args[i].key)) { if (0 == strcmp(GRPC_ARG_ALLOW_REUSEPORT, args->args[i].key)) {
if (args->args[i].type == GRPC_ARG_INTEGER) { if (args->args[i].type == GRPC_ARG_INTEGER) {
s->so_reuseport = s->so_reuseport = grpc_is_socket_reuse_port_supported() &&
has_so_reuseport && (args->args[i].value.integer != 0); (args->args[i].value.integer != 0);
} else { } else {
gpr_free(s); gpr_free(s);
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(GRPC_ARG_ALLOW_REUSEPORT return GRPC_ERROR_CREATE_FROM_STATIC_STRING(GRPC_ARG_ALLOW_REUSEPORT

@ -170,7 +170,6 @@ grpc_error* grpc_tcp_server_prepare_socket(int fd,
err = grpc_set_socket_no_sigpipe_if_possible(fd); err = grpc_set_socket_no_sigpipe_if_possible(fd);
if (err != GRPC_ERROR_NONE) goto error; if (err != GRPC_ERROR_NONE) goto error;
GPR_ASSERT(addr->len < ~(socklen_t)0);
if (bind(fd, reinterpret_cast<grpc_sockaddr*>(const_cast<char*>(addr->addr)), if (bind(fd, reinterpret_cast<grpc_sockaddr*>(const_cast<char*>(addr->addr)),
addr->len) < 0) { addr->len) < 0) {
err = GRPC_OS_ERROR(errno, "bind"); err = GRPC_OS_ERROR(errno, "bind");

@ -129,6 +129,7 @@ static void destroy_server(void* arg, grpc_error* error) {
gpr_free(sp); gpr_free(sp);
} }
grpc_channel_args_destroy(s->channel_args); grpc_channel_args_destroy(s->channel_args);
gpr_mu_destroy(&s->mu);
gpr_free(s); gpr_free(s);
} }

@ -192,6 +192,15 @@ static grpc_error* uv_socket_init_helper(uv_socket_t* uv_socket, int domain) {
if (status != 0) { if (status != 0) {
return tcp_error_create("Failed to initialize UV tcp handle", status); return tcp_error_create("Failed to initialize UV tcp handle", status);
} }
#if defined(GPR_LINUX) && defined(SO_REUSEPORT)
if (domain == AF_INET || domain == AF_INET6) {
int enable = 1;
int fd;
uv_fileno((uv_handle_t*)tcp, &fd);
// TODO Handle error here.
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &enable, sizeof(enable));
}
#endif
uv_socket->write_buffers = nullptr; uv_socket->write_buffers = nullptr;
uv_socket->read_len = 0; uv_socket->read_len = 0;
uv_tcp_nodelay(uv_socket->handle, 1); uv_tcp_nodelay(uv_socket->handle, 1);
@ -299,17 +308,6 @@ static grpc_error* uv_socket_listen(grpc_custom_socket* socket) {
return tcp_error_create("Failed to listen to port", status); return tcp_error_create("Failed to listen to port", status);
} }
static grpc_error* uv_socket_setsockopt(grpc_custom_socket* socket, int level,
int option_name, const void* optval,
socklen_t option_len) {
int fd;
uv_socket_t* uv_socket = (uv_socket_t*)socket->impl;
uv_fileno((uv_handle_t*)uv_socket->handle, &fd);
// TODO Handle error here. Also, does this work on windows??
setsockopt(fd, level, option_name, &optval, (socklen_t)option_len);
return GRPC_ERROR_NONE;
}
static void uv_tc_on_connect(uv_connect_t* req, int status) { static void uv_tc_on_connect(uv_connect_t* req, int status) {
grpc_custom_socket* socket = (grpc_custom_socket*)req->data; grpc_custom_socket* socket = (grpc_custom_socket*)req->data;
uv_socket_t* uv_socket = (uv_socket_t*)socket->impl; uv_socket_t* uv_socket = (uv_socket_t*)socket->impl;
@ -340,7 +338,6 @@ static void uv_socket_connect(grpc_custom_socket* socket,
static grpc_resolved_addresses* handle_addrinfo_result( static grpc_resolved_addresses* handle_addrinfo_result(
struct addrinfo* result) { struct addrinfo* result) {
struct addrinfo* resp; struct addrinfo* resp;
struct addrinfo* prev;
size_t i; size_t i;
grpc_resolved_addresses* addresses = grpc_resolved_addresses* addresses =
(grpc_resolved_addresses*)gpr_malloc(sizeof(grpc_resolved_addresses)); (grpc_resolved_addresses*)gpr_malloc(sizeof(grpc_resolved_addresses));
@ -350,16 +347,13 @@ static grpc_resolved_addresses* handle_addrinfo_result(
} }
addresses->addrs = (grpc_resolved_address*)gpr_malloc( addresses->addrs = (grpc_resolved_address*)gpr_malloc(
sizeof(grpc_resolved_address) * addresses->naddrs); sizeof(grpc_resolved_address) * addresses->naddrs);
i = 0; for (resp = result, i = 0; resp != nullptr; resp = resp->ai_next, i++) {
resp = result;
while (resp != nullptr) {
memcpy(&addresses->addrs[i].addr, resp->ai_addr, resp->ai_addrlen); memcpy(&addresses->addrs[i].addr, resp->ai_addr, resp->ai_addrlen);
addresses->addrs[i].len = resp->ai_addrlen; addresses->addrs[i].len = resp->ai_addrlen;
i++;
prev = resp;
resp = resp->ai_next;
gpr_free(prev);
} }
// addrinfo objects are allocated by libuv (e.g. in uv_getaddrinfo)
// and not by gpr_malloc
uv_freeaddrinfo(result);
return addresses; return addresses;
} }
@ -418,7 +412,6 @@ grpc_socket_vtable grpc_uv_socket_vtable = {
uv_socket_init, uv_socket_connect, uv_socket_destroy, uv_socket_init, uv_socket_connect, uv_socket_destroy,
uv_socket_shutdown, uv_socket_close, uv_socket_write, uv_socket_shutdown, uv_socket_close, uv_socket_write,
uv_socket_read, uv_socket_getpeername, uv_socket_getsockname, uv_socket_read, uv_socket_getpeername, uv_socket_getsockname,
uv_socket_setsockopt, uv_socket_bind, uv_socket_listen, uv_socket_bind, uv_socket_listen, uv_socket_accept};
uv_socket_accept};
#endif #endif

@ -97,6 +97,12 @@ static void init_timer_ht() {
} }
} }
static void destroy_timer_ht() {
for (int i = 0; i < NUM_HASH_BUCKETS; i++) {
gpr_mu_destroy(&g_hash_mu[i]);
}
}
static bool is_in_ht(grpc_timer* t) { static bool is_in_ht(grpc_timer* t) {
size_t i = GPR_HASH_POINTER(t, NUM_HASH_BUCKETS); size_t i = GPR_HASH_POINTER(t, NUM_HASH_BUCKETS);
@ -188,6 +194,7 @@ static void validate_non_pending_timer(grpc_timer* t) {
} }
#define INIT_TIMER_HASH_TABLE() init_timer_ht() #define INIT_TIMER_HASH_TABLE() init_timer_ht()
#define DESTROY_TIMER_HASH_TABLE() destroy_timer_ht()
#define ADD_TO_HASH_TABLE(t) add_to_ht((t)) #define ADD_TO_HASH_TABLE(t) add_to_ht((t))
#define REMOVE_FROM_HASH_TABLE(t) remove_from_ht((t)) #define REMOVE_FROM_HASH_TABLE(t) remove_from_ht((t))
#define VALIDATE_NON_PENDING_TIMER(t) validate_non_pending_timer((t)) #define VALIDATE_NON_PENDING_TIMER(t) validate_non_pending_timer((t))
@ -195,6 +202,7 @@ static void validate_non_pending_timer(grpc_timer* t) {
#else #else
#define INIT_TIMER_HASH_TABLE() #define INIT_TIMER_HASH_TABLE()
#define DESTROY_TIMER_HASH_TABLE()
#define ADD_TO_HASH_TABLE(t) #define ADD_TO_HASH_TABLE(t)
#define REMOVE_FROM_HASH_TABLE(t) #define REMOVE_FROM_HASH_TABLE(t)
#define VALIDATE_NON_PENDING_TIMER(t) #define VALIDATE_NON_PENDING_TIMER(t)
@ -283,6 +291,8 @@ static void timer_list_shutdown() {
gpr_free(g_shards); gpr_free(g_shards);
gpr_free(g_shard_queue); gpr_free(g_shard_queue);
g_shared_mutables.initialized = false; g_shared_mutables.initialized = false;
DESTROY_TIMER_HASH_TABLE();
} }
/* returns true if the first element in the list */ /* returns true if the first element in the list */

@ -191,6 +191,9 @@ struct grpc_udp_server {
size_t pollset_count; size_t pollset_count;
/* opaque object to pass to callbacks */ /* opaque object to pass to callbacks */
void* user_data; void* user_data;
/* latch has_so_reuseport during server creation */
bool so_reuseport;
}; };
static grpc_socket_factory* get_socket_factory(const grpc_channel_args* args) { static grpc_socket_factory* get_socket_factory(const grpc_channel_args* args) {
@ -214,6 +217,7 @@ grpc_udp_server* grpc_udp_server_create(const grpc_channel_args* args) {
s->active_ports = 0; s->active_ports = 0;
s->destroyed_ports = 0; s->destroyed_ports = 0;
s->shutdown = 0; s->shutdown = 0;
s->so_reuseport = grpc_is_socket_reuse_port_supported();
return s; return s;
} }
@ -353,7 +357,7 @@ static int bind_socket(grpc_socket_factory* socket_factory, int sockfd,
/* Prepare a recently-created socket for listening. */ /* Prepare a recently-created socket for listening. */
static int prepare_socket(grpc_socket_factory* socket_factory, int fd, static int prepare_socket(grpc_socket_factory* socket_factory, int fd,
const grpc_resolved_address* addr, int rcv_buf_size, const grpc_resolved_address* addr, int rcv_buf_size,
int snd_buf_size) { int snd_buf_size, bool so_reuseport) {
grpc_resolved_address sockname_temp; grpc_resolved_address sockname_temp;
grpc_sockaddr* addr_ptr = grpc_sockaddr* addr_ptr =
reinterpret_cast<grpc_sockaddr*>(const_cast<char*>(addr->addr)); reinterpret_cast<grpc_sockaddr*>(const_cast<char*>(addr->addr));
@ -381,22 +385,6 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd,
} }
} }
GPR_ASSERT(addr->len < ~(socklen_t)0);
if (bind_socket(socket_factory, fd, addr) < 0) {
char* addr_str;
grpc_sockaddr_to_string(&addr_str, addr, 0);
gpr_log(GPR_ERROR, "bind addr=%s: %s", addr_str, strerror(errno));
gpr_free(addr_str);
goto error;
}
sockname_temp.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage));
if (getsockname(fd, reinterpret_cast<grpc_sockaddr*>(sockname_temp.addr),
&sockname_temp.len) < 0) {
goto error;
}
if (grpc_set_socket_sndbuf(fd, snd_buf_size) != GRPC_ERROR_NONE) { if (grpc_set_socket_sndbuf(fd, snd_buf_size) != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Failed to set send buffer size to %d bytes", gpr_log(GPR_ERROR, "Failed to set send buffer size to %d bytes",
snd_buf_size); snd_buf_size);
@ -416,6 +404,30 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd,
gpr_log(GPR_INFO, "Failed to set socket overflow support"); gpr_log(GPR_INFO, "Failed to set socket overflow support");
} }
} }
if (so_reuseport && !grpc_is_unix_socket(addr) &&
grpc_set_socket_reuse_port(fd, 1) != GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "Failed to set SO_REUSEPORT for fd %d", fd);
goto error;
}
if (bind_socket(socket_factory, fd, addr) < 0) {
char* addr_str;
grpc_sockaddr_to_string(&addr_str, addr, 0);
gpr_log(GPR_ERROR, "bind addr=%s: %s", addr_str, strerror(errno));
gpr_free(addr_str);
goto error;
}
sockname_temp.len = static_cast<socklen_t>(sizeof(struct sockaddr_storage));
if (getsockname(fd, reinterpret_cast<grpc_sockaddr*>(sockname_temp.addr),
&sockname_temp.len) < 0) {
gpr_log(GPR_ERROR, "Unable to get the address socket %d is bound to: %s",
fd, strerror(errno));
goto error;
}
return grpc_sockaddr_get_port(&sockname_temp); return grpc_sockaddr_get_port(&sockname_temp);
error: error:
@ -542,8 +554,8 @@ static int add_socket_to_server(grpc_udp_server* s, int fd,
int rcv_buf_size, int snd_buf_size) { int rcv_buf_size, int snd_buf_size) {
gpr_log(GPR_DEBUG, "add socket %d to server", fd); gpr_log(GPR_DEBUG, "add socket %d to server", fd);
int port = int port = prepare_socket(s->socket_factory, fd, addr, rcv_buf_size,
prepare_socket(s->socket_factory, fd, addr, rcv_buf_size, snd_buf_size); snd_buf_size, s->so_reuseport);
if (port >= 0) { if (port >= 0) {
gpr_mu_lock(&s->mu); gpr_mu_lock(&s->mu);
s->listeners.emplace_back(s, fd, addr); s->listeners.emplace_back(s, fd, addr);
@ -558,7 +570,18 @@ static int add_socket_to_server(grpc_udp_server* s, int fd,
int grpc_udp_server_add_port(grpc_udp_server* s, int grpc_udp_server_add_port(grpc_udp_server* s,
const grpc_resolved_address* addr, const grpc_resolved_address* addr,
int rcv_buf_size, int snd_buf_size, int rcv_buf_size, int snd_buf_size,
GrpcUdpHandlerFactory* handler_factory) { GrpcUdpHandlerFactory* handler_factory,
size_t num_listeners) {
if (num_listeners > 1 && !s->so_reuseport) {
gpr_log(GPR_ERROR,
"Try to have multiple listeners on same port, but SO_REUSEPORT is "
"not supported. Only create 1 listener.");
}
char* addr_str;
grpc_sockaddr_to_string(&addr_str, addr, 1);
gpr_log(GPR_DEBUG, "add address: %s to server", addr_str);
gpr_free(addr_str);
int allocated_port1 = -1; int allocated_port1 = -1;
int allocated_port2 = -1; int allocated_port2 = -1;
int fd; int fd;
@ -569,11 +592,12 @@ int grpc_udp_server_add_port(grpc_udp_server* s,
grpc_resolved_address addr4_copy; grpc_resolved_address addr4_copy;
grpc_resolved_address* allocated_addr = nullptr; grpc_resolved_address* allocated_addr = nullptr;
grpc_resolved_address sockname_temp; grpc_resolved_address sockname_temp;
int port; int port = 0;
/* Check if this is a wildcard port, and if so, try to keep the port the same /* Check if this is a wildcard port, and if so, try to keep the port the same
as some previously created listener. */ as some previously created listener. */
if (grpc_sockaddr_get_port(addr) == 0) { if (grpc_sockaddr_get_port(addr) == 0) {
/* Loop through existing listeners to find the port in use. */
for (size_t i = 0; i < s->listeners.size(); ++i) { for (size_t i = 0; i < s->listeners.size(); ++i) {
sockname_temp.len = sockname_temp.len =
static_cast<socklen_t>(sizeof(struct sockaddr_storage)); static_cast<socklen_t>(sizeof(struct sockaddr_storage));
@ -582,6 +606,7 @@ int grpc_udp_server_add_port(grpc_udp_server* s,
&sockname_temp.len)) { &sockname_temp.len)) {
port = grpc_sockaddr_get_port(&sockname_temp); port = grpc_sockaddr_get_port(&sockname_temp);
if (port > 0) { if (port > 0) {
/* Found such a port, update |addr| to reflects this port. */
allocated_addr = static_cast<grpc_resolved_address*>( allocated_addr = static_cast<grpc_resolved_address*>(
gpr_malloc(sizeof(grpc_resolved_address))); gpr_malloc(sizeof(grpc_resolved_address)));
memcpy(allocated_addr, addr, sizeof(grpc_resolved_address)); memcpy(allocated_addr, addr, sizeof(grpc_resolved_address));
@ -598,6 +623,7 @@ int grpc_udp_server_add_port(grpc_udp_server* s,
} }
s->handler_factory = handler_factory; s->handler_factory = handler_factory;
for (size_t i = 0; i < num_listeners; ++i) {
/* Treat :: or 0.0.0.0 as a family-agnostic wildcard. */ /* Treat :: or 0.0.0.0 as a family-agnostic wildcard. */
if (grpc_sockaddr_is_wildcard(addr, &port)) { if (grpc_sockaddr_is_wildcard(addr, &port)) {
grpc_sockaddr_make_wildcards(port, &wild4, &wild6); grpc_sockaddr_make_wildcards(port, &wild4, &wild6);
@ -610,13 +636,33 @@ int grpc_udp_server_add_port(grpc_udp_server* s,
allocated_port1 = allocated_port1 =
add_socket_to_server(s, fd, addr, rcv_buf_size, snd_buf_size); add_socket_to_server(s, fd, addr, rcv_buf_size, snd_buf_size);
if (fd >= 0 && dsmode == GRPC_DSMODE_DUALSTACK) { if (fd >= 0 && dsmode == GRPC_DSMODE_DUALSTACK) {
goto done; if (port == 0) {
/* This is the first time to bind to |addr|. If its port is still
* wildcard port, update |addr| with the ephermeral port returned by
* kernel. Thus |addr| can have a specific port in following
* iterations. */
grpc_sockaddr_set_port(addr, allocated_port1);
port = allocated_port1;
} else if (allocated_port1 >= 0) {
/* The following sucessfully created socket should have same port as
* the first one. */
GPR_ASSERT(port == allocated_port1);
}
/* A dualstack socket is created, no need to create corresponding IPV4
* socket. */
continue;
} }
/* If we didn't get a dualstack socket, also listen on 0.0.0.0. */ /* If we didn't get a dualstack socket, also listen on 0.0.0.0. */
if (port == 0 && allocated_port1 > 0) { if (port == 0 && allocated_port1 > 0) {
/* |port| hasn't been assigned to an emphemeral port yet, |wild4| must
* have a wildcard port. Update it with the emphemeral port created
* during binding.*/
grpc_sockaddr_set_port(&wild4, allocated_port1); grpc_sockaddr_set_port(&wild4, allocated_port1);
port = allocated_port1;
} }
/* |wild4| should have been updated with an emphemeral port by now. Use
* this IPV4 address to create a IPV4 socket. */
addr = &wild4; addr = &wild4;
} }
@ -632,10 +678,18 @@ int grpc_udp_server_add_port(grpc_udp_server* s,
} }
allocated_port2 = allocated_port2 =
add_socket_to_server(s, fd, addr, rcv_buf_size, snd_buf_size); add_socket_to_server(s, fd, addr, rcv_buf_size, snd_buf_size);
if (port == 0) {
/* Update |addr| with the ephermeral port returned by kernel. So |addr|
* can have a specific port in following iterations. */
grpc_sockaddr_set_port(addr, allocated_port2);
port = allocated_port2;
} else if (allocated_port2 >= 0) {
GPR_ASSERT(port == allocated_port2);
}
}
done:
gpr_free(allocated_addr); gpr_free(allocated_addr);
return allocated_port1 >= 0 ? allocated_port1 : allocated_port2; return port;
} }
int grpc_udp_server_get_fd(grpc_udp_server* s, unsigned port_index) { int grpc_udp_server_get_fd(grpc_udp_server* s, unsigned port_index) {

@ -86,17 +86,21 @@ int grpc_udp_server_get_fd(grpc_udp_server* s, unsigned port_index);
/* Add a port to the server, returning port number on success, or negative /* Add a port to the server, returning port number on success, or negative
on failure. on failure.
Create |num_listeners| sockets for given address to listen on using
SO_REUSEPORT if supported.
The :: and 0.0.0.0 wildcard addresses are treated identically, accepting The :: and 0.0.0.0 wildcard addresses are treated identically, accepting
both IPv4 and IPv6 connections, but :: is the preferred style. This usually both IPv4 and IPv6 connections, but :: is the preferred style. This usually
creates one socket, but possibly two on systems which support IPv6, creates |num_listeners| sockets, but possibly 2 * |num_listeners| on systems
but not dualstack sockets. */ which support IPv6, but not dualstack sockets. */
/* TODO(ctiller): deprecate this, and make grpc_udp_server_add_ports to handle /* TODO(ctiller): deprecate this, and make grpc_udp_server_add_ports to handle
all of the multiple socket port matching logic in one place */ all of the multiple socket port matching logic in one place */
int grpc_udp_server_add_port(grpc_udp_server* s, int grpc_udp_server_add_port(grpc_udp_server* s,
const grpc_resolved_address* addr, const grpc_resolved_address* addr,
int rcv_buf_size, int snd_buf_size, int rcv_buf_size, int snd_buf_size,
GrpcUdpHandlerFactory* handler_factory); GrpcUdpHandlerFactory* handler_factory,
size_t num_listeners);
void grpc_udp_server_destroy(grpc_udp_server* server, grpc_closure* on_done); void grpc_udp_server_destroy(grpc_udp_server* server, grpc_closure* on_done);

@ -40,26 +40,6 @@ typedef struct grpc_alts_server_credentials {
char* handshaker_service_url; char* handshaker_service_url;
} grpc_alts_server_credentials; } grpc_alts_server_credentials;
/**
* This method creates an ALTS channel credential object.
*
* - options: grpc ALTS credentials options instance for client.
*
* It returns the created ALTS channel credential object.
*/
grpc_channel_credentials* grpc_alts_credentials_create(
const grpc_alts_credentials_options* options);
/**
* This method creates an ALTS server credential object.
*
* - options: grpc ALTS credentials options instance for server.
*
* It returns the created ALTS server credential object.
*/
grpc_server_credentials* grpc_alts_server_credentials_create(
const grpc_alts_credentials_options* options);
/** /**
* This method creates an ALTS channel credential object with customized * This method creates an ALTS channel credential object with customized
* information provided by caller. * information provided by caller.

@ -44,20 +44,20 @@ static target_service_account* target_service_account_create(
return sa; return sa;
} }
bool grpc_alts_credentials_client_options_add_target_service_account( void grpc_alts_credentials_client_options_add_target_service_account(
grpc_alts_credentials_client_options* options, grpc_alts_credentials_options* options, const char* service_account) {
const char* service_account) {
if (options == nullptr || service_account == nullptr) { if (options == nullptr || service_account == nullptr) {
gpr_log( gpr_log(
GPR_ERROR, GPR_ERROR,
"Invalid nullptr arguments to " "Invalid nullptr arguments to "
"grpc_alts_credentials_client_options_add_target_service_account()"); "grpc_alts_credentials_client_options_add_target_service_account()");
return false; return;
} }
auto client_options =
reinterpret_cast<grpc_alts_credentials_client_options*>(options);
target_service_account* node = target_service_account_create(service_account); target_service_account* node = target_service_account_create(service_account);
node->next = options->target_account_list_head; node->next = client_options->target_account_list_head;
options->target_account_list_head = node; client_options->target_account_list_head = node;
return true;
} }
static void target_service_account_destroy( static void target_service_account_destroy(

@ -21,19 +21,10 @@
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include <stdbool.h> #include <grpc/grpc_security.h>
#include "src/core/tsi/alts/handshaker/transport_security_common_api.h" #include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
/**
* Main interface for ALTS credentials options. The options will contain
* information that will be passed from grpc to TSI layer such as RPC protocol
* versions. ALTS client (channel) and server credentials will have their own
* implementation of this interface. The APIs listed in this header are
* thread-compatible.
*/
typedef struct grpc_alts_credentials_options grpc_alts_credentials_options;
/* V-table for grpc_alts_credentials_options */ /* V-table for grpc_alts_credentials_options */
typedef struct grpc_alts_credentials_options_vtable { typedef struct grpc_alts_credentials_options_vtable {
grpc_alts_credentials_options* (*copy)( grpc_alts_credentials_options* (*copy)(
@ -80,33 +71,5 @@ typedef struct grpc_alts_credentials_server_options {
grpc_alts_credentials_options* grpc_alts_credentials_options_copy( grpc_alts_credentials_options* grpc_alts_credentials_options_copy(
const grpc_alts_credentials_options* options); const grpc_alts_credentials_options* options);
/**
* This method destroys a grpc_alts_credentials_options instance by
* de-allocating all of its occupied memory.
*
* - options: a grpc_alts_credentials_options instance that needs to be
* destroyed.
*/
void grpc_alts_credentials_options_destroy(
grpc_alts_credentials_options* options);
/* This method creates a grpc ALTS credentials client options instance. */
grpc_alts_credentials_options* grpc_alts_credentials_client_options_create();
/* This method creates a grpc ALTS credentials server options instance. */
grpc_alts_credentials_options* grpc_alts_credentials_server_options_create();
/**
* This method adds a target service account to grpc ALTS credentials client
* options instance.
*
* - options: grpc ALTS credentials client options instance.
* - service_account: service account of target endpoint.
*
* It returns true on success and false on failure.
*/
bool grpc_alts_credentials_client_options_add_target_service_account(
grpc_alts_credentials_client_options* options, const char* service_account);
#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_ALTS_GRPC_ALTS_CREDENTIALS_OPTIONS_H \ #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_ALTS_GRPC_ALTS_CREDENTIALS_OPTIONS_H \
*/ */

@ -69,8 +69,12 @@ grpc_slice grpc_slice_ref(grpc_slice slice) {
/* Public API */ /* Public API */
void grpc_slice_unref(grpc_slice slice) { void grpc_slice_unref(grpc_slice slice) {
if (grpc_core::ExecCtx::Get() == nullptr) {
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
grpc_slice_unref_internal(slice); grpc_slice_unref_internal(slice);
} else {
grpc_slice_unref_internal(slice);
}
} }
/* grpc_slice_from_static_string support structure - a refcount that does /* grpc_slice_from_static_string support structure - a refcount that does

@ -75,8 +75,12 @@ void grpc_slice_buffer_destroy_internal(grpc_slice_buffer* sb) {
} }
void grpc_slice_buffer_destroy(grpc_slice_buffer* sb) { void grpc_slice_buffer_destroy(grpc_slice_buffer* sb) {
if (grpc_core::ExecCtx::Get() == nullptr) {
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
grpc_slice_buffer_destroy_internal(sb); grpc_slice_buffer_destroy_internal(sb);
} else {
grpc_slice_buffer_destroy_internal(sb);
}
} }
uint8_t* grpc_slice_buffer_tiny_add(grpc_slice_buffer* sb, size_t n) { uint8_t* grpc_slice_buffer_tiny_add(grpc_slice_buffer* sb, size_t n) {
@ -176,8 +180,12 @@ void grpc_slice_buffer_reset_and_unref_internal(grpc_slice_buffer* sb) {
} }
void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer* sb) { void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer* sb) {
if (grpc_core::ExecCtx::Get() == nullptr) {
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
grpc_slice_buffer_reset_and_unref_internal(sb); grpc_slice_buffer_reset_and_unref_internal(sb);
} else {
grpc_slice_buffer_reset_and_unref_internal(sb);
}
} }
void grpc_slice_buffer_swap(grpc_slice_buffer* a, grpc_slice_buffer* b) { void grpc_slice_buffer_swap(grpc_slice_buffer* a, grpc_slice_buffer* b) {

@ -878,8 +878,8 @@ static void set_encodings_accepted_by_peer(grpc_call* call, grpc_mdelem mdel,
} else { } else {
char* accept_encoding_entry_str = char* accept_encoding_entry_str =
grpc_slice_to_c_string(accept_encoding_entry_slice); grpc_slice_to_c_string(accept_encoding_entry_slice);
gpr_log(GPR_ERROR, gpr_log(GPR_DEBUG,
"Invalid entry in accept encoding metadata: '%s'. Ignoring.", "Unknown entry in accept encoding metadata: '%s'. Ignoring.",
accept_encoding_entry_str); accept_encoding_entry_str);
gpr_free(accept_encoding_entry_str); gpr_free(accept_encoding_entry_str);
} }

@ -25,4 +25,4 @@
const char* grpc_version_string(void) { return "6.0.0-dev"; } const char* grpc_version_string(void) { return "6.0.0-dev"; }
const char* grpc_g_stands_for(void) { return "gorgeous"; } const char* grpc_g_stands_for(void) { return "glorious"; }

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

Loading…
Cancel
Save