Merge remote-tracking branch 'upstream/master' into deserialize_logging

pull/26159/head
Alisha Nanda 4 years ago
commit 89fd647237
  1. 2
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 2
      .github/ISSUE_TEMPLATE/cleanup_request.md
  3. 2
      .github/ISSUE_TEMPLATE/feature_request.md
  4. 2
      .github/ISSUE_TEMPLATE/question.md
  5. 2
      .github/pull_request_template.md
  6. 8
      BUILD
  7. 8
      BUILD.gn
  8. 14
      CMakeLists.txt
  9. 8
      Makefile
  10. 8
      bazel/grpc_deps.bzl
  11. 22
      build_autogenerated.yaml
  12. 2
      build_handwritten.yaml
  13. 5
      config.m4
  14. 5
      config.w32
  15. BIN
      examples/php/GPBMetadata/Helloworld.php
  16. 50
      examples/php/Helloworld/GreeterClient.php
  17. 58
      examples/php/Helloworld/GreeterStub.php
  18. 60
      examples/php/Helloworld/HelloReply.php
  19. 60
      examples/php/Helloworld/HelloRequest.php
  20. 4
      examples/php/composer.json
  21. 4
      examples/php/echo/composer.json
  22. 47
      examples/php/greeter_and_routeguide_multi_server.php
  23. 14
      examples/php/greeter_proto_gen.sh
  24. 44
      examples/php/greeter_server.php
  25. BIN
      examples/php/route_guide/GPBMetadata/RouteGuide.php
  26. 182
      examples/php/route_guide/RouteGuideService.php
  27. 112
      examples/php/route_guide/Routeguide/Feature.php
  28. 90
      examples/php/route_guide/Routeguide/Point.php
  29. 122
      examples/php/route_guide/Routeguide/Rectangle.php
  30. 105
      examples/php/route_guide/Routeguide/RouteGuideClient.php
  31. 139
      examples/php/route_guide/Routeguide/RouteGuideStub.php
  32. 111
      examples/php/route_guide/Routeguide/RouteNote.php
  33. 172
      examples/php/route_guide/Routeguide/RouteSummary.php
  34. 601
      examples/php/route_guide/route_guide_db.json
  35. 14
      examples/php/route_guide/route_guide_proto_gen.sh
  36. 34
      examples/php/route_guide/route_guide_server.php
  37. 8
      gRPC-C++.podspec
  38. 12
      gRPC-Core.podspec
  39. 8
      grpc.gemspec
  40. 8
      grpc.gyp
  41. 12
      include/grpcpp/impl/codegen/method_handler.h
  42. 8
      package.xml
  43. 183
      src/compiler/php_generator.cc
  44. 3
      src/compiler/php_generator.h
  45. 12
      src/compiler/php_generator_helpers.h
  46. 35
      src/compiler/php_plugin.cc
  47. 4
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  48. 2
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
  49. 2
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  50. 2
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  51. 2
      src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
  52. 21
      src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
  53. 51
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc
  54. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
  55. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc
  56. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  57. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc
  58. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc
  59. 2
      src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
  60. 2
      src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
  61. 2
      src/core/ext/filters/client_channel/server_address.cc
  62. 4
      src/core/ext/filters/client_channel/subchannel.cc
  63. 2
      src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
  64. 2
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
  65. 2
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  66. 2
      src/core/ext/xds/xds_api.cc
  67. 2
      src/core/ext/xds/xds_client.cc
  68. 2
      src/core/ext/xds/xds_server_config_fetcher.cc
  69. 2
      src/core/lib/address_utils/parse_address.cc
  70. 6
      src/core/lib/address_utils/parse_address.h
  71. 2
      src/core/lib/address_utils/sockaddr_utils.cc
  72. 6
      src/core/lib/address_utils/sockaddr_utils.h
  73. 11
      src/core/lib/channel/channelz.cc
  74. 153
      src/core/lib/gprpp/status_helper.cc
  75. 23
      src/core/lib/gprpp/status_helper.h
  76. 2
      src/core/lib/http/httpcli.cc
  77. 2
      src/core/lib/iomgr/endpoint_cfstream.cc
  78. 2
      src/core/lib/iomgr/endpoint_pair_windows.cc
  79. 2
      src/core/lib/iomgr/resolve_address_custom.cc
  80. 2
      src/core/lib/iomgr/resolve_address_windows.cc
  81. 2
      src/core/lib/iomgr/socket_utils_common_posix.cc
  82. 2
      src/core/lib/iomgr/tcp_client_cfstream.cc
  83. 2
      src/core/lib/iomgr/tcp_client_custom.cc
  84. 2
      src/core/lib/iomgr/tcp_client_posix.cc
  85. 2
      src/core/lib/iomgr/tcp_client_windows.cc
  86. 2
      src/core/lib/iomgr/tcp_custom.cc
  87. 2
      src/core/lib/iomgr/tcp_posix.cc
  88. 2
      src/core/lib/iomgr/tcp_server_custom.cc
  89. 2
      src/core/lib/iomgr/tcp_server_posix.cc
  90. 2
      src/core/lib/iomgr/tcp_server_utils_posix_common.cc
  91. 2
      src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc
  92. 2
      src/core/lib/iomgr/tcp_server_windows.cc
  93. 2
      src/core/lib/iomgr/tcp_windows.cc
  94. 3
      src/core/lib/iomgr/udp_server.cc
  95. 2
      src/core/lib/iomgr/unix_sockets_posix.cc
  96. 2
      src/core/lib/security/authorization/evaluate_args.cc
  97. 2
      src/core/lib/security/security_connector/local/local_security_connector.cc
  98. 2
      src/cpp/Protobuf-C++.podspec
  99. 19
      src/cpp/server/server_cc.cc
  100. 5
      src/csharp/Grpc.Core.NativeDebug/Grpc.Core.NativeDebug.csproj
  101. Some files were not shown because too many files have changed in this diff Show More

@ -2,7 +2,7 @@
name: Report a bug
about: Create a report to help us improve
labels: kind/bug, priority/P2
assignees: drfloob
assignees: nicolasnoble
---

@ -2,7 +2,7 @@
name: Request a cleanup
about: Suggest a cleanup in our repository
labels: kind/internal cleanup, priority/P2
assignees: drfloob
assignees: nicolasnoble
---

@ -2,7 +2,7 @@
name: Request a feature
about: Suggest an idea for this project
labels: kind/enhancement, priority/P2
assignees: drfloob
assignees: nicolasnoble
---

@ -2,7 +2,7 @@
name: Ask a question
about: Ask a question
labels: kind/question, priority/P3
assignees: drfloob
assignees: nicolasnoble
---

@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be
-->
@drfloob
@nicolasnoble

@ -756,6 +756,8 @@ grpc_cc_library(
grpc_cc_library(
name = "grpc_base_c",
srcs = [
"src/core/lib/address_utils/parse_address.cc",
"src/core/lib/address_utils/sockaddr_utils.cc",
"src/core/lib/avl/avl.cc",
"src/core/lib/backoff/backoff.cc",
"src/core/lib/channel/channel_args.cc",
@ -823,7 +825,6 @@ grpc_cc_library(
"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/parse_address.cc",
"src/core/lib/iomgr/polling_entity.cc",
"src/core/lib/iomgr/pollset.cc",
"src/core/lib/iomgr/pollset_custom.cc",
@ -837,7 +838,6 @@ grpc_cc_library(
"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",
@ -920,6 +920,8 @@ grpc_cc_library(
"src/core/lib/uri/uri_parser.cc",
],
hdrs = [
"src/core/lib/address_utils/parse_address.h",
"src/core/lib/address_utils/sockaddr_utils.h",
"src/core/lib/avl/avl.h",
"src/core/lib/backoff/backoff.h",
"src/core/lib/channel/channel_args.h",
@ -979,7 +981,6 @@ grpc_cc_library(
"src/core/lib/iomgr/load_file.h",
"src/core/lib/iomgr/lockfree_event.h",
"src/core/lib/iomgr/nameser.h",
"src/core/lib/iomgr/parse_address.h",
"src/core/lib/iomgr/polling_entity.h",
"src/core/lib/iomgr/pollset.h",
"src/core/lib/iomgr/pollset_custom.h",
@ -996,7 +997,6 @@ grpc_cc_library(
"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",

@ -811,6 +811,10 @@ config("grpc_config") {
"src/core/ext/xds/xds_http_filters.cc",
"src/core/ext/xds/xds_http_filters.h",
"src/core/ext/xds/xds_server_config_fetcher.cc",
"src/core/lib/address_utils/parse_address.cc",
"src/core/lib/address_utils/parse_address.h",
"src/core/lib/address_utils/sockaddr_utils.cc",
"src/core/lib/address_utils/sockaddr_utils.h",
"src/core/lib/avl/avl.cc",
"src/core/lib/avl/avl.h",
"src/core/lib/backoff/backoff.cc",
@ -945,8 +949,6 @@ config("grpc_config") {
"src/core/lib/iomgr/lockfree_event.cc",
"src/core/lib/iomgr/lockfree_event.h",
"src/core/lib/iomgr/nameser.h",
"src/core/lib/iomgr/parse_address.cc",
"src/core/lib/iomgr/parse_address.h",
"src/core/lib/iomgr/polling_entity.cc",
"src/core/lib/iomgr/polling_entity.h",
"src/core/lib/iomgr/pollset.cc",
@ -976,8 +978,6 @@ config("grpc_config") {
"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.cc",
"src/core/lib/iomgr/sockaddr_utils.h",
"src/core/lib/iomgr/sockaddr_windows.h",
"src/core/lib/iomgr/socket_factory_posix.cc",
"src/core/lib/iomgr/socket_factory_posix.h",

@ -1785,6 +1785,8 @@ add_library(grpc
src/core/ext/xds/xds_http_fault_filter.cc
src/core/ext/xds/xds_http_filters.cc
src/core/ext/xds/xds_server_config_fetcher.cc
src/core/lib/address_utils/parse_address.cc
src/core/lib/address_utils/sockaddr_utils.cc
src/core/lib/avl/avl.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
@ -1854,7 +1856,6 @@ add_library(grpc
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/parse_address.cc
src/core/lib/iomgr/polling_entity.cc
src/core/lib/iomgr/pollset.cc
src/core/lib/iomgr/pollset_custom.cc
@ -1868,7 +1869,6 @@ add_library(grpc
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
@ -2406,6 +2406,8 @@ add_library(grpc_unsecure
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c
src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c
src/core/ext/upb-generated/validate/validate.upb.c
src/core/lib/address_utils/parse_address.cc
src/core/lib/address_utils/sockaddr_utils.cc
src/core/lib/avl/avl.cc
src/core/lib/backoff/backoff.cc
src/core/lib/channel/channel_args.cc
@ -2474,7 +2476,6 @@ add_library(grpc_unsecure
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/parse_address.cc
src/core/lib/iomgr/polling_entity.cc
src/core/lib/iomgr/pollset.cc
src/core/lib/iomgr/pollset_custom.cc
@ -2488,7 +2489,6 @@ add_library(grpc_unsecure
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
@ -6371,7 +6371,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(parse_address_test
test/core/iomgr/parse_address_test.cc
test/core/address_utils/parse_address_test.cc
)
target_include_directories(parse_address_test
@ -6399,7 +6399,7 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(parse_address_with_named_scope_id_test
test/core/iomgr/parse_address_with_named_scope_id_test.cc
test/core/address_utils/parse_address_with_named_scope_id_test.cc
)
target_include_directories(parse_address_with_named_scope_id_test
@ -13630,7 +13630,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(sockaddr_utils_test
test/core/iomgr/sockaddr_utils_test.cc
test/core/address_utils/sockaddr_utils_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)

@ -1343,6 +1343,8 @@ LIBGRPC_SRC = \
src/core/ext/xds/xds_http_fault_filter.cc \
src/core/ext/xds/xds_http_filters.cc \
src/core/ext/xds/xds_server_config_fetcher.cc \
src/core/lib/address_utils/parse_address.cc \
src/core/lib/address_utils/sockaddr_utils.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
@ -1412,7 +1414,6 @@ LIBGRPC_SRC = \
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/parse_address.cc \
src/core/lib/iomgr/polling_entity.cc \
src/core/lib/iomgr/pollset.cc \
src/core/lib/iomgr/pollset_custom.cc \
@ -1426,7 +1427,6 @@ LIBGRPC_SRC = \
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 \
@ -1815,6 +1815,8 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \
src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c \
src/core/ext/upb-generated/validate/validate.upb.c \
src/core/lib/address_utils/parse_address.cc \
src/core/lib/address_utils/sockaddr_utils.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
@ -1883,7 +1885,6 @@ LIBGRPC_UNSECURE_SRC = \
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/parse_address.cc \
src/core/lib/iomgr/polling_entity.cc \
src/core/lib/iomgr/pollset.cc \
src/core/lib/iomgr/pollset_custom.cc \
@ -1897,7 +1898,6 @@ LIBGRPC_UNSECURE_SRC = \
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 \

@ -179,11 +179,11 @@ def grpc_deps():
if "com_google_protobuf" not in native.existing_rules():
http_archive(
name = "com_google_protobuf",
sha256 = "09709ea1a25dc2f02e281e11f559dd979139ba2a1ddb24c489ea6bea9e3ad8bc",
strip_prefix = "protobuf-d7e943b8d2bc444a8c770644e73d090b486f8b37",
sha256 = "cf63d46ef743f4c30b0e36a562caf83cabed3f10e6ca49eb476913c4655394d5",
strip_prefix = "protobuf-436bd7880e458532901c58f4d9d1ea23fa7edd52",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/protobuf/archive/d7e943b8d2bc444a8c770644e73d090b486f8b37.tar.gz",
"https://github.com/google/protobuf/archive/d7e943b8d2bc444a8c770644e73d090b486f8b37.tar.gz",
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/protobuf/archive/436bd7880e458532901c58f4d9d1ea23fa7edd52.tar.gz",
"https://github.com/google/protobuf/archive/436bd7880e458532901c58f4d9d1ea23fa7edd52.tar.gz",
],
patches = ["@com_github_grpc_grpc//third_party:protobuf.patch"],
patch_args = ["-p1"],

@ -686,6 +686,8 @@ libs:
- src/core/ext/xds/xds_client_stats.h
- src/core/ext/xds/xds_http_fault_filter.h
- src/core/ext/xds/xds_http_filters.h
- src/core/lib/address_utils/parse_address.h
- src/core/lib/address_utils/sockaddr_utils.h
- src/core/lib/avl/avl.h
- src/core/lib/backoff/backoff.h
- src/core/lib/channel/channel_args.h
@ -751,7 +753,6 @@ libs:
- src/core/lib/iomgr/load_file.h
- src/core/lib/iomgr/lockfree_event.h
- src/core/lib/iomgr/nameser.h
- src/core/lib/iomgr/parse_address.h
- src/core/lib/iomgr/polling_entity.h
- src/core/lib/iomgr/pollset.h
- src/core/lib/iomgr/pollset_custom.h
@ -768,7 +769,6 @@ libs:
- 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
@ -1200,6 +1200,8 @@ libs:
- src/core/ext/xds/xds_http_fault_filter.cc
- src/core/ext/xds/xds_http_filters.cc
- src/core/ext/xds/xds_server_config_fetcher.cc
- src/core/lib/address_utils/parse_address.cc
- src/core/lib/address_utils/sockaddr_utils.cc
- src/core/lib/avl/avl.cc
- src/core/lib/backoff/backoff.cc
- src/core/lib/channel/channel_args.cc
@ -1269,7 +1271,6 @@ libs:
- 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/parse_address.cc
- src/core/lib/iomgr/polling_entity.cc
- src/core/lib/iomgr/pollset.cc
- src/core/lib/iomgr/pollset_custom.cc
@ -1283,7 +1284,6 @@ libs:
- 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
@ -1684,6 +1684,8 @@ libs:
- src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h
- src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h
- src/core/ext/upb-generated/validate/validate.upb.h
- src/core/lib/address_utils/parse_address.h
- src/core/lib/address_utils/sockaddr_utils.h
- src/core/lib/avl/avl.h
- src/core/lib/backoff/backoff.h
- src/core/lib/channel/channel_args.h
@ -1749,7 +1751,6 @@ libs:
- src/core/lib/iomgr/load_file.h
- src/core/lib/iomgr/lockfree_event.h
- src/core/lib/iomgr/nameser.h
- src/core/lib/iomgr/parse_address.h
- src/core/lib/iomgr/polling_entity.h
- src/core/lib/iomgr/pollset.h
- src/core/lib/iomgr/pollset_custom.h
@ -1766,7 +1767,6 @@ libs:
- 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
@ -1934,6 +1934,8 @@ libs:
- src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c
- src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c
- src/core/ext/upb-generated/validate/validate.upb.c
- src/core/lib/address_utils/parse_address.cc
- src/core/lib/address_utils/sockaddr_utils.cc
- src/core/lib/avl/avl.cc
- src/core/lib/backoff/backoff.cc
- src/core/lib/channel/channel_args.cc
@ -2002,7 +2004,6 @@ libs:
- 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/parse_address.cc
- src/core/lib/iomgr/polling_entity.cc
- src/core/lib/iomgr/pollset.cc
- src/core/lib/iomgr/pollset_custom.cc
@ -2016,7 +2017,6 @@ libs:
- 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
@ -3636,7 +3636,7 @@ targets:
language: c
headers: []
src:
- test/core/iomgr/parse_address_test.cc
- test/core/address_utils/parse_address_test.cc
deps:
- grpc_test_util
- name: parse_address_with_named_scope_id_test
@ -3644,7 +3644,7 @@ targets:
language: c
headers: []
src:
- test/core/iomgr/parse_address_with_named_scope_id_test.cc
- test/core/address_utils/parse_address_with_named_scope_id_test.cc
deps:
- grpc_test_util
platforms:
@ -6230,7 +6230,7 @@ targets:
language: c++
headers: []
src:
- test/core/iomgr/sockaddr_utils_test.cc
- test/core/address_utils/sockaddr_utils_test.cc
deps:
- grpc_test_util
- name: ssl_server_fuzzer

@ -15,7 +15,7 @@ settings:
core_version: 16.0.0
csharp_major_version: 2
g_stands_for: guadalupe_river_park_conservancy
protobuf_version: 3.15.2
protobuf_version: 3.15.8
version: 1.38.0-dev
targets:
- name: check_epollexclusive

@ -350,6 +350,8 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/xds/xds_http_fault_filter.cc \
src/core/ext/xds/xds_http_filters.cc \
src/core/ext/xds/xds_server_config_fetcher.cc \
src/core/lib/address_utils/parse_address.cc \
src/core/lib/address_utils/sockaddr_utils.cc \
src/core/lib/avl/avl.cc \
src/core/lib/backoff/backoff.cc \
src/core/lib/channel/channel_args.cc \
@ -463,7 +465,6 @@ if test "$PHP_GRPC" != "no"; then
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/parse_address.cc \
src/core/lib/iomgr/polling_entity.cc \
src/core/lib/iomgr/pollset.cc \
src/core/lib/iomgr/pollset_custom.cc \
@ -477,7 +478,6 @@ if test "$PHP_GRPC" != "no"; then
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 \
@ -1154,6 +1154,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upbdefs-generated/validate)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/upbdefs-generated/xds/core/v3)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/xds)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/address_utils)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/avl)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/backoff)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel)

@ -316,6 +316,8 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\xds\\xds_http_fault_filter.cc " +
"src\\core\\ext\\xds\\xds_http_filters.cc " +
"src\\core\\ext\\xds\\xds_server_config_fetcher.cc " +
"src\\core\\lib\\address_utils\\parse_address.cc " +
"src\\core\\lib\\address_utils\\sockaddr_utils.cc " +
"src\\core\\lib\\avl\\avl.cc " +
"src\\core\\lib\\backoff\\backoff.cc " +
"src\\core\\lib\\channel\\channel_args.cc " +
@ -429,7 +431,6 @@ if (PHP_GRPC != "no") {
"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\\parse_address.cc " +
"src\\core\\lib\\iomgr\\polling_entity.cc " +
"src\\core\\lib\\iomgr\\pollset.cc " +
"src\\core\\lib\\iomgr\\pollset_custom.cc " +
@ -443,7 +444,6 @@ if (PHP_GRPC != "no") {
"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 " +
@ -1255,6 +1255,7 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\upbdefs-generated\\xds\\core\\v3");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\xds");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\address_utils");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\avl");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\backoff");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\channel");

@ -0,0 +1,50 @@
<?php
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// 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.
//
namespace Helloworld;
/**
* The greeting service definition.
*/
class GreeterClient extends \Grpc\BaseStub {
/**
* @param string $hostname hostname
* @param array $opts channel options
* @param \Grpc\Channel $channel (optional) re-use channel object
*/
public function __construct($hostname, $opts, $channel = null) {
parent::__construct($hostname, $opts, $channel);
}
/**
* Sends a greeting
* @param \Helloworld\HelloRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\UnaryCall
*/
public function SayHello(\Helloworld\HelloRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/helloworld.Greeter/SayHello',
$argument,
['\Helloworld\HelloReply', 'decode'],
$metadata, $options);
}
}

@ -0,0 +1,58 @@
<?php
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// 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.
//
namespace Helloworld;
/**
* The greeting service definition.
*/
class GreeterStub {
/**
* Sends a greeting
* @param \Helloworld\HelloRequest $request client request
* @param \Grpc\ServerContext $context server request context
* @return \Helloworld\HelloReply for response data, null if if error occured
* initial metadata (if any) and status (if not ok) should be set to $context
*/
public function SayHello(
\Helloworld\HelloRequest $request,
\Grpc\ServerContext $context
): ?\Helloworld\HelloReply {
$context->setStatus(\Grpc\Status::unimplemented());
return null;
}
/**
* Get the method descriptors of the service for server registration
*
* @return array of \Grpc\MethodDescriptor for the service methods
*/
public final function getMethodDescriptors(): array
{
return [
'/helloworld.Greeter/SayHello' => new \Grpc\MethodDescriptor(
$this,
'SayHello',
'\Helloworld\HelloRequest',
\Grpc\MethodDescriptor::UNARY_CALL
),
];
}
}

@ -0,0 +1,60 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: helloworld.proto
namespace Helloworld;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* The response message containing the greetings
*
* Generated from protobuf message <code>helloworld.HelloReply</code>
*/
class HelloReply extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>string message = 1;</code>
*/
protected $message = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $message
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Helloworld::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>string message = 1;</code>
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* Generated from protobuf field <code>string message = 1;</code>
* @param string $var
* @return $this
*/
public function setMessage($var)
{
GPBUtil::checkString($var, True);
$this->message = $var;
return $this;
}
}

@ -0,0 +1,60 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: helloworld.proto
namespace Helloworld;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* The request message containing the user's name.
*
* Generated from protobuf message <code>helloworld.HelloRequest</code>
*/
class HelloRequest extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>string name = 1;</code>
*/
protected $name = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Helloworld::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>string name = 1;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Generated from protobuf field <code>string name = 1;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
}

@ -2,8 +2,8 @@
"name": "grpc/grpc-demo",
"description": "gRPC example for PHP",
"require": {
"grpc/grpc": "^v1.3.0",
"google/protobuf": "^v3.3.0"
"grpc/grpc": "^v1.30.0",
"google/protobuf": "^v3.12.2"
},
"autoload": {
"psr-4": {

@ -1,8 +1,8 @@
{
"name": "grpc-php/echo-example",
"require": {
"grpc/grpc": "^v1.22.0",
"google/protobuf": "^3.7.0"
"grpc/grpc": "^v1.30.0",
"google/protobuf": "^3.12.2"
},
"autoload": {
"psr-4": {

@ -0,0 +1,47 @@
<?php
/*
*
* Copyright 2020 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
require dirname(__FILE__) . '/../../src/php/lib/Grpc/MethodDescriptor.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/Status.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/ServerCallReader.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/ServerCallWriter.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/ServerContext.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/RpcServer.php';
require dirname(__FILE__) . '/vendor/autoload.php';
require dirname(__FILE__) . '/route_guide/RouteGuideService.php';
class Greeter extends \Helloworld\GreeterStub
{
public function SayHello(
\Helloworld\HelloRequest $request,
\Grpc\ServerContext $serverContext
): ?\Helloworld\HelloReply {
$name = $request->getName();
$response = new \Helloworld\HelloReply();
$response->setMessage("Hello " . $name);
return $response;
}
}
$server = new \Grpc\RpcServer();
$server->addHttp2Port('0.0.0.0:50051');
$server->handle(new RouteGuideService(null));
$server->handle(new Greeter());
$server->run();

@ -13,4 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
protoc --proto_path=../protos --php_out=. --grpc_out=. --plugin=protoc-gen-grpc=../../bins/opt/grpc_php_plugin ../protos/helloworld.proto
set -e
cd $(dirname $0)/../..
# protoc and grpc_*_plugin binaries can be obtained by running
# $ bazel build @com_google_protobuf//:protoc //src/compiler:all
PROTOC=bazel-bin/external/com_google_protobuf/protoc
PLUGIN=protoc-gen-grpc=bazel-bin/src/compiler/grpc_php_plugin
$PROTOC --proto_path=examples/protos \
--php_out=examples/php \
--grpc_out=generate_server:examples/php \
--plugin=$PLUGIN examples/protos/helloworld.proto

@ -0,0 +1,44 @@
<?php
/*
*
* Copyright 2020 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
require dirname(__FILE__) . '/../../src/php/lib/Grpc/MethodDescriptor.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/Status.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/ServerCallReader.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/ServerCallWriter.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/ServerContext.php';
require dirname(__FILE__) . '/../../src/php/lib/Grpc/RpcServer.php';
require dirname(__FILE__) . '/vendor/autoload.php';
class Greeter extends Helloworld\GreeterStub
{
public function SayHello(
\Helloworld\HelloRequest $request,
\Grpc\ServerContext $serverContext
): ?\Helloworld\HelloReply {
$name = $request->getName();
$response = new \Helloworld\HelloReply();
$response->setMessage("Hello " . $name);
return $response;
}
}
$server = new \Grpc\RpcServer();
$server->addHttp2Port('0.0.0.0:50051');
$server->handle(new Greeter());
$server->run();

@ -0,0 +1,182 @@
<?php
/*
*
* Copyright 2020 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
class RouteGuideService extends \Routeguide\RouteGuideStub
{
public function __construct($dbFilePath)
{
$dbFilePath = $dbFilePath ?? dirname(__FILE__) . '/route_guide_db.json';
$dbData = file_get_contents($dbFilePath);
if (!$dbData) {
throw new InvalidArgumentException(
"Error reading route db file: " . $dbFilePath
);
}
$featureList = json_decode($dbData);
if (!$featureList) {
throw new InvalidArgumentException(
"Error decoding route db file: " . $dbFilePath
);
}
foreach ($featureList as $feature) {
array_push($this->featureList, new Routeguide\Feature([
'name' => $feature->name,
'location' => new Routeguide\Point([
'latitude' => $feature->location->latitude,
'longitude' => $feature->location->longitude,
]),
]));
}
}
private function findFeature(\Routeguide\Point $point)
{
foreach ($this->featureList as $feature) {
$location = $feature->getLocation();
if (
$location->getLatitude() === $point->getLatitude()
&& $location->getLongitude() === $point->getLongitude()
) {
return $feature;
}
}
return null;
}
// The formula is based on http://mathforum.org/library/drmath/view/51879.html
private function calculateDistance(
\Routeguide\Point $start,
\Routeguide\Point $end
) {
$toRadians = function (float $num) {
return $num * 3.1415926 / 180;
};
$coordFactor = 10000000.0;
$R = 6371000; // metres
$lat_1 = $start->getLatitude() / $coordFactor;
$lat_2 = $end->getLatitude() / $coordFactor;
$lon_1 = $start->getLongitude() / $coordFactor;
$lon_2 = $end->getLongitude() / $coordFactor;
$lat_rad_1 = $toRadians($lat_1);
$lat_rad_2 = $toRadians($lat_2);
$delta_lat_rad = $toRadians($lat_2 - $lat_1);
$delta_lon_rad = $toRadians($lon_2 - $lon_1);
$a = pow(sin($delta_lat_rad / 2), 2) +
cos($lat_rad_1) * cos($lat_rad_2) * pow(sin($delta_lon_rad / 2), 2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
return $R * $c;
}
public function GetFeature(
\Routeguide\Point $request,
\Grpc\ServerContext $serverContext
): ?\Routeguide\Feature {
$feature = $this->findFeature($request);
$notFoundFeature = new Routeguide\Feature([
'name' => '',
'location' => $request,
]);
return $feature ?? $notFoundFeature;
}
public function ListFeatures(
\Routeguide\Rectangle $request,
\Grpc\ServerCallWriter $writer,
\Grpc\ServerContext $serverContext
): void {
$lo = $request->getLo();
$hi = $request->getHi();
$left = min($lo->getLongitude(), $hi->getLongitude());
$right = max($lo->getLongitude(), $hi->getLongitude());
$top = max($lo->getLatitude(), $hi->getLatitude());
$bottom = min($lo->getLatitude(), $hi->getLatitude());
foreach ($this->featureList as $feature) {
$longitude = $feature->getLocation()->getLongitude();
$latitude = $feature->getLocation()->getLatitude();
if (
$longitude >= $left && $longitude <= $right
&& $latitude >= $bottom && $latitude <= $top
) {
$writer->write($feature);
}
}
$writer->finish();
}
public function RecordRoute(
\Grpc\ServerCallReader $reader,
\Grpc\ServerContext $serverContext
): ?\Routeguide\RouteSummary {
$point_count = 0;
$feature_count = 0;
$distance = 0;
$previous = null;
$start_time = time();
while ($point = $reader->read()) {
$point_count++;
$feature = $this->findFeature($point);
if ($feature) {
$feature_count++;
if ($previous) {
$distance += $this->calculateDistance($previous, $point);
}
$previous = $point;
}
}
$summary = new \Routeguide\RouteSummary();
$summary->setPointCount($point_count);
$summary->setFeatureCount($feature_count);
$summary->setDistance($distance);
$summary->setElapsedTime(time() - $start_time);
return $summary;
}
public function RouteChat(
\Grpc\ServerCallReader $reader,
\Grpc\ServerCallWriter $writer,
\Grpc\ServerContext $serverContext
): void {
while ($note = $reader->read()) {
foreach ($this->received_notes as $n) {
if (
$n->getLocation()->getLatitude() ===
$note->getLocation()->getLatitude()
&& $n->getLocation()->getLongitude() ===
$note->getLocation()->getLongitude()
) {
$writer->write($n);
}
}
array_push($this->received_notes, $note);
}
$writer->finish();
}
private $received_notes = [];
private $featureList = [];
}

@ -0,0 +1,112 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: route_guide.proto
namespace Routeguide;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A feature names something at a given point.
* If a feature could not be named, the name is empty.
*
* Generated from protobuf message <code>routeguide.Feature</code>
*/
class Feature extends \Google\Protobuf\Internal\Message
{
/**
* The name of the feature.
*
* Generated from protobuf field <code>string name = 1;</code>
*/
protected $name = '';
/**
* The point where the feature is detected.
*
* Generated from protobuf field <code>.routeguide.Point location = 2;</code>
*/
protected $location = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $name
* The name of the feature.
* @type \Routeguide\Point $location
* The point where the feature is detected.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\RouteGuide::initOnce();
parent::__construct($data);
}
/**
* The name of the feature.
*
* Generated from protobuf field <code>string name = 1;</code>
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* The name of the feature.
*
* Generated from protobuf field <code>string name = 1;</code>
* @param string $var
* @return $this
*/
public function setName($var)
{
GPBUtil::checkString($var, True);
$this->name = $var;
return $this;
}
/**
* The point where the feature is detected.
*
* Generated from protobuf field <code>.routeguide.Point location = 2;</code>
* @return \Routeguide\Point|null
*/
public function getLocation()
{
return isset($this->location) ? $this->location : null;
}
public function hasLocation()
{
return isset($this->location);
}
public function clearLocation()
{
unset($this->location);
}
/**
* The point where the feature is detected.
*
* Generated from protobuf field <code>.routeguide.Point location = 2;</code>
* @param \Routeguide\Point $var
* @return $this
*/
public function setLocation($var)
{
GPBUtil::checkMessage($var, \Routeguide\Point::class);
$this->location = $var;
return $this;
}
}

@ -0,0 +1,90 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: route_guide.proto
namespace Routeguide;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Points are represented as latitude-longitude pairs in the E7 representation
* (degrees multiplied by 10**7 and rounded to the nearest integer).
* Latitudes should be in the range +/- 90 degrees and longitude should be in
* the range +/- 180 degrees (inclusive).
*
* Generated from protobuf message <code>routeguide.Point</code>
*/
class Point extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>int32 latitude = 1;</code>
*/
protected $latitude = 0;
/**
* Generated from protobuf field <code>int32 longitude = 2;</code>
*/
protected $longitude = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $latitude
* @type int $longitude
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\RouteGuide::initOnce();
parent::__construct($data);
}
/**
* Generated from protobuf field <code>int32 latitude = 1;</code>
* @return int
*/
public function getLatitude()
{
return $this->latitude;
}
/**
* Generated from protobuf field <code>int32 latitude = 1;</code>
* @param int $var
* @return $this
*/
public function setLatitude($var)
{
GPBUtil::checkInt32($var);
$this->latitude = $var;
return $this;
}
/**
* Generated from protobuf field <code>int32 longitude = 2;</code>
* @return int
*/
public function getLongitude()
{
return $this->longitude;
}
/**
* Generated from protobuf field <code>int32 longitude = 2;</code>
* @param int $var
* @return $this
*/
public function setLongitude($var)
{
GPBUtil::checkInt32($var);
$this->longitude = $var;
return $this;
}
}

@ -0,0 +1,122 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: route_guide.proto
namespace Routeguide;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A latitude-longitude rectangle, represented as two diagonally opposite
* points "lo" and "hi".
*
* Generated from protobuf message <code>routeguide.Rectangle</code>
*/
class Rectangle extends \Google\Protobuf\Internal\Message
{
/**
* One corner of the rectangle.
*
* Generated from protobuf field <code>.routeguide.Point lo = 1;</code>
*/
protected $lo = null;
/**
* The other corner of the rectangle.
*
* Generated from protobuf field <code>.routeguide.Point hi = 2;</code>
*/
protected $hi = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Routeguide\Point $lo
* One corner of the rectangle.
* @type \Routeguide\Point $hi
* The other corner of the rectangle.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\RouteGuide::initOnce();
parent::__construct($data);
}
/**
* One corner of the rectangle.
*
* Generated from protobuf field <code>.routeguide.Point lo = 1;</code>
* @return \Routeguide\Point|null
*/
public function getLo()
{
return isset($this->lo) ? $this->lo : null;
}
public function hasLo()
{
return isset($this->lo);
}
public function clearLo()
{
unset($this->lo);
}
/**
* One corner of the rectangle.
*
* Generated from protobuf field <code>.routeguide.Point lo = 1;</code>
* @param \Routeguide\Point $var
* @return $this
*/
public function setLo($var)
{
GPBUtil::checkMessage($var, \Routeguide\Point::class);
$this->lo = $var;
return $this;
}
/**
* The other corner of the rectangle.
*
* Generated from protobuf field <code>.routeguide.Point hi = 2;</code>
* @return \Routeguide\Point|null
*/
public function getHi()
{
return isset($this->hi) ? $this->hi : null;
}
public function hasHi()
{
return isset($this->hi);
}
public function clearHi()
{
unset($this->hi);
}
/**
* The other corner of the rectangle.
*
* Generated from protobuf field <code>.routeguide.Point hi = 2;</code>
* @param \Routeguide\Point $var
* @return $this
*/
public function setHi($var)
{
GPBUtil::checkMessage($var, \Routeguide\Point::class);
$this->hi = $var;
return $this;
}
}

@ -0,0 +1,105 @@
<?php
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// 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.
//
namespace Routeguide;
/**
* Interface exported by the server.
*/
class RouteGuideClient extends \Grpc\BaseStub {
/**
* @param string $hostname hostname
* @param array $opts channel options
* @param \Grpc\Channel $channel (optional) re-use channel object
*/
public function __construct($hostname, $opts, $channel = null) {
parent::__construct($hostname, $opts, $channel);
}
/**
* A simple RPC.
*
* Obtains the feature at a given position.
*
* A feature with an empty name is returned if there's no feature at the given
* position.
* @param \Routeguide\Point $argument input argument
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\UnaryCall
*/
public function GetFeature(\Routeguide\Point $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/routeguide.RouteGuide/GetFeature',
$argument,
['\Routeguide\Feature', 'decode'],
$metadata, $options);
}
/**
* A server-to-client streaming RPC.
*
* Obtains the Features available within the given Rectangle. Results are
* streamed rather than returned at once (e.g. in a response message with a
* repeated field), as the rectangle may cover a large area and contain a
* huge number of features.
* @param \Routeguide\Rectangle $argument input argument
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\ServerStreamingCall
*/
public function ListFeatures(\Routeguide\Rectangle $argument,
$metadata = [], $options = []) {
return $this->_serverStreamRequest('/routeguide.RouteGuide/ListFeatures',
$argument,
['\Routeguide\Feature', 'decode'],
$metadata, $options);
}
/**
* A client-to-server streaming RPC.
*
* Accepts a stream of Points on a route being traversed, returning a
* RouteSummary when traversal is completed.
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\ClientStreamingCall
*/
public function RecordRoute($metadata = [], $options = []) {
return $this->_clientStreamRequest('/routeguide.RouteGuide/RecordRoute',
['\Routeguide\RouteSummary','decode'],
$metadata, $options);
}
/**
* A Bidirectional streaming RPC.
*
* Accepts a stream of RouteNotes sent while a route is being traversed,
* while receiving other RouteNotes (e.g. from other users).
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\BidiStreamingCall
*/
public function RouteChat($metadata = [], $options = []) {
return $this->_bidiRequest('/routeguide.RouteGuide/RouteChat',
['\Routeguide\RouteNote','decode'],
$metadata, $options);
}
}

@ -0,0 +1,139 @@
<?php
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
// 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.
//
namespace Routeguide;
/**
* Interface exported by the server.
*/
class RouteGuideStub {
/**
* A simple RPC.
*
* Obtains the feature at a given position.
*
* A feature with an empty name is returned if there's no feature at the given
* position.
* @param \Routeguide\Point $request client request
* @param \Grpc\ServerContext $context server request context
* @return \Routeguide\Feature for response data, null if if error occured
* initial metadata (if any) and status (if not ok) should be set to $context
*/
public function GetFeature(
\Routeguide\Point $request,
\Grpc\ServerContext $context
): ?\Routeguide\Feature {
$context->setStatus(\Grpc\Status::unimplemented());
return null;
}
/**
* A server-to-client streaming RPC.
*
* Obtains the Features available within the given Rectangle. Results are
* streamed rather than returned at once (e.g. in a response message with a
* repeated field), as the rectangle may cover a large area and contain a
* huge number of features.
* @param \Routeguide\Rectangle $request client request
* @param \Grpc\ServerCallWriter $writer write response data of \Routeguide\Feature
* @param \Grpc\ServerContext $context server request context
* @return void
*/
public function ListFeatures(
\Routeguide\Rectangle $request,
\Grpc\ServerCallWriter $writer,
\Grpc\ServerContext $context
): void {
$context->setStatus(\Grpc\Status::unimplemented());
$writer->finish();
}
/**
* A client-to-server streaming RPC.
*
* Accepts a stream of Points on a route being traversed, returning a
* RouteSummary when traversal is completed.
* @param \Grpc\ServerCallReader $reader read client request data of \Routeguide\Point
* @param \Grpc\ServerContext $context server request context
* @return \Routeguide\RouteSummary for response data, null if if error occured
* initial metadata (if any) and status (if not ok) should be set to $context
*/
public function RecordRoute(
\Grpc\ServerCallReader $reader,
\Grpc\ServerContext $context
): ?\Routeguide\RouteSummary {
$context->setStatus(\Grpc\Status::unimplemented());
return null;
}
/**
* A Bidirectional streaming RPC.
*
* Accepts a stream of RouteNotes sent while a route is being traversed,
* while receiving other RouteNotes (e.g. from other users).
* @param \Grpc\ServerCallReader $reader read client request data of \Routeguide\RouteNote
* @param \Grpc\ServerCallWriter $writer write response data of \Routeguide\RouteNote
* @param \Grpc\ServerContext $context server request context
* @return void
*/
public function RouteChat(
\Grpc\ServerCallReader $reader,
\Grpc\ServerCallWriter $writer,
\Grpc\ServerContext $context
): void {
$context->setStatus(\Grpc\Status::unimplemented());
$writer->finish();
}
/**
* Get the method descriptors of the service for server registration
*
* @return array of \Grpc\MethodDescriptor for the service methods
*/
public final function getMethodDescriptors(): array
{
return [
'/routeguide.RouteGuide/GetFeature' => new \Grpc\MethodDescriptor(
$this,
'GetFeature',
'\Routeguide\Point',
\Grpc\MethodDescriptor::UNARY_CALL
),
'/routeguide.RouteGuide/ListFeatures' => new \Grpc\MethodDescriptor(
$this,
'ListFeatures',
'\Routeguide\Rectangle',
\Grpc\MethodDescriptor::SERVER_STREAMING_CALL
),
'/routeguide.RouteGuide/RecordRoute' => new \Grpc\MethodDescriptor(
$this,
'RecordRoute',
'\Routeguide\Point',
\Grpc\MethodDescriptor::CLIENT_STREAMING_CALL
),
'/routeguide.RouteGuide/RouteChat' => new \Grpc\MethodDescriptor(
$this,
'RouteChat',
'\Routeguide\RouteNote',
\Grpc\MethodDescriptor::BIDI_STREAMING_CALL
),
];
}
}

@ -0,0 +1,111 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: route_guide.proto
namespace Routeguide;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A RouteNote is a message sent while at a given point.
*
* Generated from protobuf message <code>routeguide.RouteNote</code>
*/
class RouteNote extends \Google\Protobuf\Internal\Message
{
/**
* The location from which the message is sent.
*
* Generated from protobuf field <code>.routeguide.Point location = 1;</code>
*/
protected $location = null;
/**
* The message to be sent.
*
* Generated from protobuf field <code>string message = 2;</code>
*/
protected $message = '';
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Routeguide\Point $location
* The location from which the message is sent.
* @type string $message
* The message to be sent.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\RouteGuide::initOnce();
parent::__construct($data);
}
/**
* The location from which the message is sent.
*
* Generated from protobuf field <code>.routeguide.Point location = 1;</code>
* @return \Routeguide\Point|null
*/
public function getLocation()
{
return isset($this->location) ? $this->location : null;
}
public function hasLocation()
{
return isset($this->location);
}
public function clearLocation()
{
unset($this->location);
}
/**
* The location from which the message is sent.
*
* Generated from protobuf field <code>.routeguide.Point location = 1;</code>
* @param \Routeguide\Point $var
* @return $this
*/
public function setLocation($var)
{
GPBUtil::checkMessage($var, \Routeguide\Point::class);
$this->location = $var;
return $this;
}
/**
* The message to be sent.
*
* Generated from protobuf field <code>string message = 2;</code>
* @return string
*/
public function getMessage()
{
return $this->message;
}
/**
* The message to be sent.
*
* Generated from protobuf field <code>string message = 2;</code>
* @param string $var
* @return $this
*/
public function setMessage($var)
{
GPBUtil::checkString($var, True);
$this->message = $var;
return $this;
}
}

@ -0,0 +1,172 @@
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: route_guide.proto
namespace Routeguide;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* A RouteSummary is received in response to a RecordRoute rpc.
* It contains the number of individual points received, the number of
* detected features, and the total distance covered as the cumulative sum of
* the distance between each point.
*
* Generated from protobuf message <code>routeguide.RouteSummary</code>
*/
class RouteSummary extends \Google\Protobuf\Internal\Message
{
/**
* The number of points received.
*
* Generated from protobuf field <code>int32 point_count = 1;</code>
*/
protected $point_count = 0;
/**
* The number of known features passed while traversing the route.
*
* Generated from protobuf field <code>int32 feature_count = 2;</code>
*/
protected $feature_count = 0;
/**
* The distance covered in metres.
*
* Generated from protobuf field <code>int32 distance = 3;</code>
*/
protected $distance = 0;
/**
* The duration of the traversal in seconds.
*
* Generated from protobuf field <code>int32 elapsed_time = 4;</code>
*/
protected $elapsed_time = 0;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int $point_count
* The number of points received.
* @type int $feature_count
* The number of known features passed while traversing the route.
* @type int $distance
* The distance covered in metres.
* @type int $elapsed_time
* The duration of the traversal in seconds.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\RouteGuide::initOnce();
parent::__construct($data);
}
/**
* The number of points received.
*
* Generated from protobuf field <code>int32 point_count = 1;</code>
* @return int
*/
public function getPointCount()
{
return $this->point_count;
}
/**
* The number of points received.
*
* Generated from protobuf field <code>int32 point_count = 1;</code>
* @param int $var
* @return $this
*/
public function setPointCount($var)
{
GPBUtil::checkInt32($var);
$this->point_count = $var;
return $this;
}
/**
* The number of known features passed while traversing the route.
*
* Generated from protobuf field <code>int32 feature_count = 2;</code>
* @return int
*/
public function getFeatureCount()
{
return $this->feature_count;
}
/**
* The number of known features passed while traversing the route.
*
* Generated from protobuf field <code>int32 feature_count = 2;</code>
* @param int $var
* @return $this
*/
public function setFeatureCount($var)
{
GPBUtil::checkInt32($var);
$this->feature_count = $var;
return $this;
}
/**
* The distance covered in metres.
*
* Generated from protobuf field <code>int32 distance = 3;</code>
* @return int
*/
public function getDistance()
{
return $this->distance;
}
/**
* The distance covered in metres.
*
* Generated from protobuf field <code>int32 distance = 3;</code>
* @param int $var
* @return $this
*/
public function setDistance($var)
{
GPBUtil::checkInt32($var);
$this->distance = $var;
return $this;
}
/**
* The duration of the traversal in seconds.
*
* Generated from protobuf field <code>int32 elapsed_time = 4;</code>
* @return int
*/
public function getElapsedTime()
{
return $this->elapsed_time;
}
/**
* The duration of the traversal in seconds.
*
* Generated from protobuf field <code>int32 elapsed_time = 4;</code>
* @param int $var
* @return $this
*/
public function setElapsedTime($var)
{
GPBUtil::checkInt32($var);
$this->elapsed_time = $var;
return $this;
}
}

@ -0,0 +1,601 @@
[{
"location": {
"latitude": 407838351,
"longitude": -746143763
},
"name": "Patriots Path, Mendham, NJ 07945, USA"
}, {
"location": {
"latitude": 408122808,
"longitude": -743999179
},
"name": "101 New Jersey 10, Whippany, NJ 07981, USA"
}, {
"location": {
"latitude": 413628156,
"longitude": -749015468
},
"name": "U.S. 6, Shohola, PA 18458, USA"
}, {
"location": {
"latitude": 419999544,
"longitude": -740371136
},
"name": "5 Conners Road, Kingston, NY 12401, USA"
}, {
"location": {
"latitude": 414008389,
"longitude": -743951297
},
"name": "Mid Hudson Psychiatric Center, New Hampton, NY 10958, USA"
}, {
"location": {
"latitude": 419611318,
"longitude": -746524769
},
"name": "287 Flugertown Road, Livingston Manor, NY 12758, USA"
}, {
"location": {
"latitude": 406109563,
"longitude": -742186778
},
"name": "4001 Tremley Point Road, Linden, NJ 07036, USA"
}, {
"location": {
"latitude": 416802456,
"longitude": -742370183
},
"name": "352 South Mountain Road, Wallkill, NY 12589, USA"
}, {
"location": {
"latitude": 412950425,
"longitude": -741077389
},
"name": "Bailey Turn Road, Harriman, NY 10926, USA"
}, {
"location": {
"latitude": 412144655,
"longitude": -743949739
},
"name": "193-199 Wawayanda Road, Hewitt, NJ 07421, USA"
}, {
"location": {
"latitude": 415736605,
"longitude": -742847522
},
"name": "406-496 Ward Avenue, Pine Bush, NY 12566, USA"
}, {
"location": {
"latitude": 413843930,
"longitude": -740501726
},
"name": "162 Merrill Road, Highland Mills, NY 10930, USA"
}, {
"location": {
"latitude": 410873075,
"longitude": -744459023
},
"name": "Clinton Road, West Milford, NJ 07480, USA"
}, {
"location": {
"latitude": 412346009,
"longitude": -744026814
},
"name": "16 Old Brook Lane, Warwick, NY 10990, USA"
}, {
"location": {
"latitude": 402948455,
"longitude": -747903913
},
"name": "3 Drake Lane, Pennington, NJ 08534, USA"
}, {
"location": {
"latitude": 406337092,
"longitude": -740122226
},
"name": "6324 8th Avenue, Brooklyn, NY 11220, USA"
}, {
"location": {
"latitude": 406421967,
"longitude": -747727624
},
"name": "1 Merck Access Road, Whitehouse Station, NJ 08889, USA"
}, {
"location": {
"latitude": 416318082,
"longitude": -749677716
},
"name": "78-98 Schalck Road, Narrowsburg, NY 12764, USA"
}, {
"location": {
"latitude": 415301720,
"longitude": -748416257
},
"name": "282 Lakeview Drive Road, Highland Lake, NY 12743, USA"
}, {
"location": {
"latitude": 402647019,
"longitude": -747071791
},
"name": "330 Evelyn Avenue, Hamilton Township, NJ 08619, USA"
}, {
"location": {
"latitude": 412567807,
"longitude": -741058078
},
"name": "New York State Reference Route 987E, Southfields, NY 10975, USA"
}, {
"location": {
"latitude": 416855156,
"longitude": -744420597
},
"name": "103-271 Tempaloni Road, Ellenville, NY 12428, USA"
}, {
"location": {
"latitude": 404663628,
"longitude": -744820157
},
"name": "1300 Airport Road, North Brunswick Township, NJ 08902, USA"
}, {
"location": {
"latitude": 407113723,
"longitude": -749746483
},
"name": ""
}, {
"location": {
"latitude": 402133926,
"longitude": -743613249
},
"name": ""
}, {
"location": {
"latitude": 400273442,
"longitude": -741220915
},
"name": ""
}, {
"location": {
"latitude": 411236786,
"longitude": -744070769
},
"name": ""
}, {
"location": {
"latitude": 411633782,
"longitude": -746784970
},
"name": "211-225 Plains Road, Augusta, NJ 07822, USA"
}, {
"location": {
"latitude": 415830701,
"longitude": -742952812
},
"name": ""
}, {
"location": {
"latitude": 413447164,
"longitude": -748712898
},
"name": "165 Pedersen Ridge Road, Milford, PA 18337, USA"
}, {
"location": {
"latitude": 405047245,
"longitude": -749800722
},
"name": "100-122 Locktown Road, Frenchtown, NJ 08825, USA"
}, {
"location": {
"latitude": 418858923,
"longitude": -746156790
},
"name": ""
}, {
"location": {
"latitude": 417951888,
"longitude": -748484944
},
"name": "650-652 Willi Hill Road, Swan Lake, NY 12783, USA"
}, {
"location": {
"latitude": 407033786,
"longitude": -743977337
},
"name": "26 East 3rd Street, New Providence, NJ 07974, USA"
}, {
"location": {
"latitude": 417548014,
"longitude": -740075041
},
"name": ""
}, {
"location": {
"latitude": 410395868,
"longitude": -744972325
},
"name": ""
}, {
"location": {
"latitude": 404615353,
"longitude": -745129803
},
"name": ""
}, {
"location": {
"latitude": 406589790,
"longitude": -743560121
},
"name": "611 Lawrence Avenue, Westfield, NJ 07090, USA"
}, {
"location": {
"latitude": 414653148,
"longitude": -740477477
},
"name": "18 Lannis Avenue, New Windsor, NY 12553, USA"
}, {
"location": {
"latitude": 405957808,
"longitude": -743255336
},
"name": "82-104 Amherst Avenue, Colonia, NJ 07067, USA"
}, {
"location": {
"latitude": 411733589,
"longitude": -741648093
},
"name": "170 Seven Lakes Drive, Sloatsburg, NY 10974, USA"
}, {
"location": {
"latitude": 412676291,
"longitude": -742606606
},
"name": "1270 Lakes Road, Monroe, NY 10950, USA"
}, {
"location": {
"latitude": 409224445,
"longitude": -748286738
},
"name": "509-535 Alphano Road, Great Meadows, NJ 07838, USA"
}, {
"location": {
"latitude": 406523420,
"longitude": -742135517
},
"name": "652 Garden Street, Elizabeth, NJ 07202, USA"
}, {
"location": {
"latitude": 401827388,
"longitude": -740294537
},
"name": "349 Sea Spray Court, Neptune City, NJ 07753, USA"
}, {
"location": {
"latitude": 410564152,
"longitude": -743685054
},
"name": "13-17 Stanley Street, West Milford, NJ 07480, USA"
}, {
"location": {
"latitude": 408472324,
"longitude": -740726046
},
"name": "47 Industrial Avenue, Teterboro, NJ 07608, USA"
}, {
"location": {
"latitude": 412452168,
"longitude": -740214052
},
"name": "5 White Oak Lane, Stony Point, NY 10980, USA"
}, {
"location": {
"latitude": 409146138,
"longitude": -746188906
},
"name": "Berkshire Valley Management Area Trail, Jefferson, NJ, USA"
}, {
"location": {
"latitude": 404701380,
"longitude": -744781745
},
"name": "1007 Jersey Avenue, New Brunswick, NJ 08901, USA"
}, {
"location": {
"latitude": 409642566,
"longitude": -746017679
},
"name": "6 East Emerald Isle Drive, Lake Hopatcong, NJ 07849, USA"
}, {
"location": {
"latitude": 408031728,
"longitude": -748645385
},
"name": "1358-1474 New Jersey 57, Port Murray, NJ 07865, USA"
}, {
"location": {
"latitude": 413700272,
"longitude": -742135189
},
"name": "367 Prospect Road, Chester, NY 10918, USA"
}, {
"location": {
"latitude": 404310607,
"longitude": -740282632
},
"name": "10 Simon Lake Drive, Atlantic Highlands, NJ 07716, USA"
}, {
"location": {
"latitude": 409319800,
"longitude": -746201391
},
"name": "11 Ward Street, Mount Arlington, NJ 07856, USA"
}, {
"location": {
"latitude": 406685311,
"longitude": -742108603
},
"name": "300-398 Jefferson Avenue, Elizabeth, NJ 07201, USA"
}, {
"location": {
"latitude": 419018117,
"longitude": -749142781
},
"name": "43 Dreher Road, Roscoe, NY 12776, USA"
}, {
"location": {
"latitude": 412856162,
"longitude": -745148837
},
"name": "Swan Street, Pine Island, NY 10969, USA"
}, {
"location": {
"latitude": 416560744,
"longitude": -746721964
},
"name": "66 Pleasantview Avenue, Monticello, NY 12701, USA"
}, {
"location": {
"latitude": 405314270,
"longitude": -749836354
},
"name": ""
}, {
"location": {
"latitude": 414219548,
"longitude": -743327440
},
"name": ""
}, {
"location": {
"latitude": 415534177,
"longitude": -742900616
},
"name": "565 Winding Hills Road, Montgomery, NY 12549, USA"
}, {
"location": {
"latitude": 406898530,
"longitude": -749127080
},
"name": "231 Rocky Run Road, Glen Gardner, NJ 08826, USA"
}, {
"location": {
"latitude": 407586880,
"longitude": -741670168
},
"name": "100 Mount Pleasant Avenue, Newark, NJ 07104, USA"
}, {
"location": {
"latitude": 400106455,
"longitude": -742870190
},
"name": "517-521 Huntington Drive, Manchester Township, NJ 08759, USA"
}, {
"location": {
"latitude": 400066188,
"longitude": -746793294
},
"name": ""
}, {
"location": {
"latitude": 418803880,
"longitude": -744102673
},
"name": "40 Mountain Road, Napanoch, NY 12458, USA"
}, {
"location": {
"latitude": 414204288,
"longitude": -747895140
},
"name": ""
}, {
"location": {
"latitude": 414777405,
"longitude": -740615601
},
"name": ""
}, {
"location": {
"latitude": 415464475,
"longitude": -747175374
},
"name": "48 North Road, Forestburgh, NY 12777, USA"
}, {
"location": {
"latitude": 404062378,
"longitude": -746376177
},
"name": ""
}, {
"location": {
"latitude": 405688272,
"longitude": -749285130
},
"name": ""
}, {
"location": {
"latitude": 400342070,
"longitude": -748788996
},
"name": ""
}, {
"location": {
"latitude": 401809022,
"longitude": -744157964
},
"name": ""
}, {
"location": {
"latitude": 404226644,
"longitude": -740517141
},
"name": "9 Thompson Avenue, Leonardo, NJ 07737, USA"
}, {
"location": {
"latitude": 410322033,
"longitude": -747871659
},
"name": ""
}, {
"location": {
"latitude": 407100674,
"longitude": -747742727
},
"name": ""
}, {
"location": {
"latitude": 418811433,
"longitude": -741718005
},
"name": "213 Bush Road, Stone Ridge, NY 12484, USA"
}, {
"location": {
"latitude": 415034302,
"longitude": -743850945
},
"name": ""
}, {
"location": {
"latitude": 411349992,
"longitude": -743694161
},
"name": ""
}, {
"location": {
"latitude": 404839914,
"longitude": -744759616
},
"name": "1-17 Bergen Court, New Brunswick, NJ 08901, USA"
}, {
"location": {
"latitude": 414638017,
"longitude": -745957854
},
"name": "35 Oakland Valley Road, Cuddebackville, NY 12729, USA"
}, {
"location": {
"latitude": 412127800,
"longitude": -740173578
},
"name": ""
}, {
"location": {
"latitude": 401263460,
"longitude": -747964303
},
"name": ""
}, {
"location": {
"latitude": 412843391,
"longitude": -749086026
},
"name": ""
}, {
"location": {
"latitude": 418512773,
"longitude": -743067823
},
"name": ""
}, {
"location": {
"latitude": 404318328,
"longitude": -740835638
},
"name": "42-102 Main Street, Belford, NJ 07718, USA"
}, {
"location": {
"latitude": 419020746,
"longitude": -741172328
},
"name": ""
}, {
"location": {
"latitude": 404080723,
"longitude": -746119569
},
"name": ""
}, {
"location": {
"latitude": 401012643,
"longitude": -744035134
},
"name": ""
}, {
"location": {
"latitude": 404306372,
"longitude": -741079661
},
"name": ""
}, {
"location": {
"latitude": 403966326,
"longitude": -748519297
},
"name": ""
}, {
"location": {
"latitude": 405002031,
"longitude": -748407866
},
"name": ""
}, {
"location": {
"latitude": 409532885,
"longitude": -742200683
},
"name": ""
}, {
"location": {
"latitude": 416851321,
"longitude": -742674555
},
"name": ""
}, {
"location": {
"latitude": 406411633,
"longitude": -741722051
},
"name": "3387 Richmond Terrace, Staten Island, NY 10303, USA"
}, {
"location": {
"latitude": 413069058,
"longitude": -744597778
},
"name": "261 Van Sickle Road, Goshen, NY 10924, USA"
}, {
"location": {
"latitude": 418465462,
"longitude": -746859398
},
"name": ""
}, {
"location": {
"latitude": 411733222,
"longitude": -744228360
},
"name": ""
}, {
"location": {
"latitude": 410248224,
"longitude": -747127767
},
"name": "3 Hasta Way, Newton, NJ 07860, USA"
}]

@ -13,4 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
protoc --proto_path=./../../protos --php_out=./ --grpc_out=./ --plugin=protoc-gen-grpc=./../../../bins/opt/grpc_php_plugin ./../../protos/route_guide.proto
set -e
cd $(dirname $0)/../../..
# protoc and grpc_*_plugin binaries can be obtained by running
# $ bazel build @com_google_protobuf//:protoc //src/compiler:all
PROTOC=bazel-bin/external/com_google_protobuf/protoc
PLUGIN=protoc-gen-grpc=bazel-bin/src/compiler/grpc_php_plugin
$PROTOC --proto_path=examples/protos \
--php_out=examples/php/route_guide \
--grpc_out=generate_server:examples/php/route_guide \
--plugin=$PLUGIN examples/protos/route_guide.proto

@ -0,0 +1,34 @@
<?php
/*
*
* Copyright 2020 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
require dirname(__FILE__) . '/../../../src/php/lib/Grpc/MethodDescriptor.php';
require dirname(__FILE__) . '/../../../src/php/lib/Grpc/Status.php';
require dirname(__FILE__) . '/../../../src/php/lib/Grpc/ServerCallReader.php';
require dirname(__FILE__) . '/../../../src/php/lib/Grpc/ServerCallWriter.php';
require dirname(__FILE__) . '/../../../src/php/lib/Grpc/ServerContext.php';
require dirname(__FILE__) . '/../../../src/php/lib/Grpc/RpcServer.php';
require dirname(__FILE__) . '/../vendor/autoload.php';
require dirname(__FILE__) . '/RouteGuideService.php';
$routeDbFile = $argv[1];
$server = new \Grpc\RpcServer();
$server->addHttp2Port('0.0.0.0:50051');
$server->handle(new RouteGuideService($routeDbFile));
$server->run();

@ -488,6 +488,8 @@ Pod::Spec.new do |s|
'src/core/ext/xds/xds_client_stats.h',
'src/core/ext/xds/xds_http_fault_filter.h',
'src/core/ext/xds/xds_http_filters.h',
'src/core/lib/address_utils/parse_address.h',
'src/core/lib/address_utils/sockaddr_utils.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
@ -585,7 +587,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/parse_address.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
'src/core/lib/iomgr/pollset_custom.h',
@ -602,7 +603,6 @@ Pod::Spec.new do |s|
'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',
@ -1129,6 +1129,8 @@ Pod::Spec.new do |s|
'src/core/ext/xds/xds_client_stats.h',
'src/core/ext/xds/xds_http_fault_filter.h',
'src/core/ext/xds/xds_http_filters.h',
'src/core/lib/address_utils/parse_address.h',
'src/core/lib/address_utils/sockaddr_utils.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
@ -1226,7 +1228,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/parse_address.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
'src/core/lib/iomgr/pollset_custom.h',
@ -1243,7 +1244,6 @@ Pod::Spec.new do |s|
'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',

@ -786,6 +786,10 @@ Pod::Spec.new do |s|
'src/core/ext/xds/xds_http_filters.cc',
'src/core/ext/xds/xds_http_filters.h',
'src/core/ext/xds/xds_server_config_fetcher.cc',
'src/core/lib/address_utils/parse_address.cc',
'src/core/lib/address_utils/parse_address.h',
'src/core/lib/address_utils/sockaddr_utils.cc',
'src/core/lib/address_utils/sockaddr_utils.h',
'src/core/lib/avl/avl.cc',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.cc',
@ -994,8 +998,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/lockfree_event.cc',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/parse_address.cc',
'src/core/lib/iomgr/parse_address.h',
'src/core/lib/iomgr/polling_entity.cc',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.cc',
@ -1025,8 +1027,6 @@ Pod::Spec.new do |s|
'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.cc',
'src/core/lib/iomgr/sockaddr_utils.h',
'src/core/lib/iomgr/sockaddr_windows.h',
'src/core/lib/iomgr/socket_factory_posix.cc',
'src/core/lib/iomgr/socket_factory_posix.h',
@ -1689,6 +1689,8 @@ Pod::Spec.new do |s|
'src/core/ext/xds/xds_client_stats.h',
'src/core/ext/xds/xds_http_fault_filter.h',
'src/core/ext/xds/xds_http_filters.h',
'src/core/lib/address_utils/parse_address.h',
'src/core/lib/address_utils/sockaddr_utils.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
@ -1786,7 +1788,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/parse_address.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
'src/core/lib/iomgr/pollset_custom.h',
@ -1803,7 +1804,6 @@ Pod::Spec.new do |s|
'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',

@ -706,6 +706,10 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/xds/xds_http_filters.cc )
s.files += %w( src/core/ext/xds/xds_http_filters.h )
s.files += %w( src/core/ext/xds/xds_server_config_fetcher.cc )
s.files += %w( src/core/lib/address_utils/parse_address.cc )
s.files += %w( src/core/lib/address_utils/parse_address.h )
s.files += %w( src/core/lib/address_utils/sockaddr_utils.cc )
s.files += %w( src/core/lib/address_utils/sockaddr_utils.h )
s.files += %w( src/core/lib/avl/avl.cc )
s.files += %w( src/core/lib/avl/avl.h )
s.files += %w( src/core/lib/backoff/backoff.cc )
@ -916,8 +920,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/lockfree_event.cc )
s.files += %w( src/core/lib/iomgr/lockfree_event.h )
s.files += %w( src/core/lib/iomgr/nameser.h )
s.files += %w( src/core/lib/iomgr/parse_address.cc )
s.files += %w( src/core/lib/iomgr/parse_address.h )
s.files += %w( src/core/lib/iomgr/polling_entity.cc )
s.files += %w( src/core/lib/iomgr/polling_entity.h )
s.files += %w( src/core/lib/iomgr/pollset.cc )
@ -947,8 +949,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/sockaddr.h )
s.files += %w( src/core/lib/iomgr/sockaddr_custom.h )
s.files += %w( src/core/lib/iomgr/sockaddr_posix.h )
s.files += %w( src/core/lib/iomgr/sockaddr_utils.cc )
s.files += %w( src/core/lib/iomgr/sockaddr_utils.h )
s.files += %w( src/core/lib/iomgr/sockaddr_windows.h )
s.files += %w( src/core/lib/iomgr/socket_factory_posix.cc )
s.files += %w( src/core/lib/iomgr/socket_factory_posix.h )

@ -759,6 +759,8 @@
'src/core/ext/xds/xds_http_fault_filter.cc',
'src/core/ext/xds/xds_http_filters.cc',
'src/core/ext/xds/xds_server_config_fetcher.cc',
'src/core/lib/address_utils/parse_address.cc',
'src/core/lib/address_utils/sockaddr_utils.cc',
'src/core/lib/avl/avl.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
@ -828,7 +830,6 @@
'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/parse_address.cc',
'src/core/lib/iomgr/polling_entity.cc',
'src/core/lib/iomgr/pollset.cc',
'src/core/lib/iomgr/pollset_custom.cc',
@ -842,7 +843,6 @@
'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',
@ -1202,6 +1202,8 @@
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c',
'src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c',
'src/core/ext/upb-generated/validate/validate.upb.c',
'src/core/lib/address_utils/parse_address.cc',
'src/core/lib/address_utils/sockaddr_utils.cc',
'src/core/lib/avl/avl.cc',
'src/core/lib/backoff/backoff.cc',
'src/core/lib/channel/channel_args.cc',
@ -1270,7 +1272,6 @@
'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/parse_address.cc',
'src/core/lib/iomgr/polling_entity.cc',
'src/core/lib/iomgr/pollset.cc',
'src/core/lib/iomgr/pollset_custom.cc',
@ -1284,7 +1285,6 @@
'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',

@ -357,9 +357,12 @@ class SplitServerStreamingHandler
template <::grpc::StatusCode code>
class ErrorMethodHandler : public ::grpc::internal::MethodHandler {
public:
explicit ErrorMethodHandler(const std::string& message) : message_(message) {}
template <class T>
static void FillOps(::grpc::ServerContextBase* context, T* ops) {
::grpc::Status status(code, "");
static void FillOps(::grpc::ServerContextBase* context,
const std::string& message, T* ops) {
::grpc::Status status(code, message);
if (!context->sent_initial_metadata_) {
ops->SendInitialMetadata(&context->initial_metadata_,
context->initial_metadata_flags());
@ -375,7 +378,7 @@ class ErrorMethodHandler : public ::grpc::internal::MethodHandler {
::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
::grpc::internal::CallOpServerSendStatus>
ops;
FillOps(param.server_context, &ops);
FillOps(param.server_context, message_, &ops);
param.call->PerformOps(&ops);
param.call->cq()->Pluck(&ops);
}
@ -388,6 +391,9 @@ class ErrorMethodHandler : public ::grpc::internal::MethodHandler {
}
return nullptr;
}
private:
const std::string message_;
};
typedef ErrorMethodHandler<::grpc::StatusCode::UNIMPLEMENTED>

@ -686,6 +686,10 @@
<file baseinstalldir="/" name="src/core/ext/xds/xds_http_filters.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/xds/xds_http_filters.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/xds/xds_server_config_fetcher.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/address_utils/parse_address.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/address_utils/parse_address.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/address_utils/sockaddr_utils.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/address_utils/sockaddr_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/avl/avl.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/avl/avl.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/backoff/backoff.cc" role="src" />
@ -896,8 +900,6 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/lockfree_event.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/lockfree_event.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/nameser.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/parse_address.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/parse_address.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/polling_entity.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/polling_entity.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset.cc" role="src" />
@ -927,8 +929,6 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_custom.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_utils.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/socket_factory_posix.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/socket_factory_posix.h" role="src" />

@ -131,34 +131,177 @@ void PrintMethod(const MethodDescriptor* method, Printer* out) {
out->Print("}\n\n");
}
// Prints out the service descriptor object
void PrintService(const ServiceDescriptor* service,
const std::string& class_suffix, Printer* out) {
void PrintServerMethod(const MethodDescriptor* method, Printer* out) {
map<std::string, std::string> vars;
const Descriptor* input_type = method->input_type();
const Descriptor* output_type = method->output_type();
vars["service_name"] = method->service()->full_name();
vars["method_name"] = method->name();
vars["input_type_id"] =
MessageIdentifierName(GeneratedClassName(input_type), input_type->file());
vars["output_type_id"] = MessageIdentifierName(
GeneratedClassName(output_type), output_type->file());
out->Print("/**\n");
out->Print(GetPHPComments(service, " *").c_str());
out->Print(" */\n");
vars["name"] = GetPHPServiceClassname(service, class_suffix);
out->Print(vars, "class $name$ extends \\Grpc\\BaseStub {\n\n");
out->Print(GetPHPComments(method, " *").c_str());
const char* method_template;
if (method->client_streaming() && method->server_streaming()) {
method_template =
" * @param \\Grpc\\ServerCallReader $$reader read client request data "
"of \\$input_type_id$\n"
" * @param \\Grpc\\ServerCallWriter $$writer write response data of "
"\\$output_type_id$\n"
" * @param \\Grpc\\ServerContext $$context server request context\n"
" * @return void\n"
" */\n"
"public function $method_name$(\n"
" \\Grpc\\ServerCallReader $$reader,\n"
" \\Grpc\\ServerCallWriter $$writer,\n"
" \\Grpc\\ServerContext $$context\n"
"): void {\n"
" $$context->setStatus(\\Grpc\\Status::unimplemented());\n"
" $$writer->finish();\n"
"}\n\n";
} else if (method->client_streaming()) {
method_template =
" * @param \\Grpc\\ServerCallReader $$reader read client request data "
"of \\$input_type_id$\n"
" * @param \\Grpc\\ServerContext $$context server request context\n"
" * @return \\$output_type_id$ for response data, null if if error "
"occured\n"
" * initial metadata (if any) and status (if not ok) should be set "
"to $$context\n"
" */\n"
"public function $method_name$(\n"
" \\Grpc\\ServerCallReader $$reader,\n"
" \\Grpc\\ServerContext $$context\n"
"): ?\\$output_type_id$ {\n"
" $$context->setStatus(\\Grpc\\Status::unimplemented());\n"
" return null;\n"
"}\n\n";
} else if (method->server_streaming()) {
method_template =
" * @param \\$input_type_id$ $$request client request\n"
" * @param \\Grpc\\ServerCallWriter $$writer write response data of "
"\\$output_type_id$\n"
" * @param \\Grpc\\ServerContext $$context server request context\n"
" * @return void\n"
" */\n"
"public function $method_name$(\n"
" \\$input_type_id$ $$request,\n"
" \\Grpc\\ServerCallWriter $$writer,\n"
" \\Grpc\\ServerContext $$context\n"
"): void {\n"
" $$context->setStatus(\\Grpc\\Status::unimplemented());\n"
" $$writer->finish();\n"
"}\n\n";
} else {
method_template =
" * @param \\$input_type_id$ $$request client request\n"
" * @param \\Grpc\\ServerContext $$context server request context\n"
" * @return \\$output_type_id$ for response data, null if if error "
"occured\n"
" * initial metadata (if any) and status (if not ok) should be set "
"to $$context\n"
" */\n"
"public function $method_name$(\n"
" \\$input_type_id$ $$request,\n"
" \\Grpc\\ServerContext $$context\n"
"): ?\\$output_type_id$ {\n"
" $$context->setStatus(\\Grpc\\Status::unimplemented());\n"
" return null;\n"
"}\n\n";
}
out->Print(vars, method_template);
}
void PrintServerMethodDescriptors(const ServiceDescriptor* service,
Printer* out) {
map<std::string, std::string> vars;
vars["service_name"] = service->full_name();
out->Print(
"/**\n"
" * Get the method descriptors of the service for server registration\n"
" *\n"
" * @return array of \\Grpc\\MethodDescriptor for the service methods\n"
" */\n"
"public final function getMethodDescriptors(): array\n{\n");
out->Indent();
out->Indent();
out->Print(
"/**\n * @param string $$hostname hostname\n"
" * @param array $$opts channel options\n"
" * @param \\Grpc\\Channel $$channel (optional) re-use channel "
"object\n */\n"
"public function __construct($$hostname, $$opts, "
"$$channel = null) {\n");
out->Print("return [\n");
out->Indent();
out->Indent();
out->Print("parent::__construct($$hostname, $$opts, $$channel);\n");
for (int i = 0; i < service->method_count(); i++) {
auto method = service->method(i);
auto input_type = method->input_type();
vars["method_name"] = method->name();
vars["input_type_id"] = MessageIdentifierName(
GeneratedClassName(input_type), input_type->file());
if (method->client_streaming() && method->server_streaming()) {
vars["call_type"] = "BIDI_STREAMING_CALL";
} else if (method->client_streaming()) {
vars["call_type"] = "CLIENT_STREAMING_CALL";
} else if (method->server_streaming()) {
vars["call_type"] = "SERVER_STREAMING_CALL";
} else {
vars["call_type"] = "UNARY_CALL";
}
out->Print(
vars,
"'/$service_name$/$method_name$' => new \\Grpc\\MethodDescriptor(\n"
" $$this,\n"
" '$method_name$',\n"
" '\\$input_type_id$',\n"
" \\Grpc\\MethodDescriptor::$call_type$\n"
"),\n");
}
out->Outdent();
out->Outdent();
out->Print("];\n");
out->Outdent();
out->Outdent();
out->Print("}\n\n");
}
// Prints out the service descriptor object
void PrintService(const ServiceDescriptor* service,
const std::string& class_suffix, bool is_server,
Printer* out) {
map<std::string, std::string> vars;
out->Print("/**\n");
out->Print(GetPHPComments(service, " *").c_str());
out->Print(" */\n");
vars["name"] = GetPHPServiceClassname(service, class_suffix, is_server);
vars["extends"] = is_server ? "" : "extends \\Grpc\\BaseStub ";
out->Print(vars, "class $name$ $extends${\n\n");
out->Indent();
out->Indent();
if (!is_server) {
out->Print(
"/**\n * @param string $$hostname hostname\n"
" * @param array $$opts channel options\n"
" * @param \\Grpc\\Channel $$channel (optional) re-use channel object\n"
" */\n"
"public function __construct($$hostname, $$opts, "
"$$channel = null) {\n");
out->Indent();
out->Indent();
out->Print("parent::__construct($$hostname, $$opts, $$channel);\n");
out->Outdent();
out->Outdent();
out->Print("}\n\n");
}
for (int i = 0; i < service->method_count(); i++) {
std::string method_name =
grpc_generator::LowercaseFirstLetter(service->method(i)->name());
PrintMethod(service->method(i), out);
if (is_server) {
PrintServerMethod(service->method(i), out);
} else {
PrintMethod(service->method(i), out);
}
}
if (is_server) {
PrintServerMethodDescriptors(service, out);
}
out->Outdent();
out->Outdent();
@ -168,7 +311,7 @@ void PrintService(const ServiceDescriptor* service,
std::string GenerateFile(const FileDescriptor* file,
const ServiceDescriptor* service,
const std::string& class_suffix) {
const std::string& class_suffix, bool is_server) {
std::string output;
{
StringOutputStream output_stream(&output);
@ -188,7 +331,7 @@ std::string GenerateFile(const FileDescriptor* file,
vars["package"] = php_namespace;
out.Print(vars, "namespace $package$;\n\n");
PrintService(service, class_suffix, &out);
PrintService(service, class_suffix, is_server, &out);
}
return output;
}

@ -25,7 +25,8 @@ namespace grpc_php_generator {
std::string GenerateFile(const grpc::protobuf::FileDescriptor* file,
const grpc::protobuf::ServiceDescriptor* service,
const std::string& class_suffix);
const std::string& class_suffix,
bool is_server = false);
} // namespace grpc_php_generator

@ -28,8 +28,10 @@ namespace grpc_php_generator {
inline std::string GetPHPServiceClassname(
const grpc::protobuf::ServiceDescriptor* service,
const std::string& class_suffix) {
return service->name() + (class_suffix == "" ? "Client" : class_suffix);
const std::string& class_suffix, bool is_server) {
return service->name() +
(class_suffix == "" ? (is_server ? "" : "Client") : class_suffix) +
(is_server ? "Stub" : "");
}
// ReplaceAll replaces all instances of search with replace in s.
@ -46,7 +48,7 @@ inline std::string ReplaceAll(std::string s, const std::string& search,
inline std::string GetPHPServiceFilename(
const grpc::protobuf::FileDescriptor* file,
const grpc::protobuf::ServiceDescriptor* service,
const std::string& class_suffix) {
const std::string& class_suffix, bool is_server) {
std::ostringstream oss;
if (file->options().has_php_namespace()) {
oss << ReplaceAll(file->options().php_namespace(), "\\", "/");
@ -58,8 +60,8 @@ inline std::string GetPHPServiceFilename(
<< grpc_generator::CapitalizeFirstLetter(tokens[i]);
}
}
return oss.str() + "/" + GetPHPServiceClassname(service, class_suffix) +
".php";
return oss.str() + "/" +
GetPHPServiceClassname(service, class_suffix, is_server) + ".php";
}
// Get leading or trailing comments in a string. Comment lines start with "// ".

@ -48,10 +48,13 @@ class PHPGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
std::vector<std::pair<std::string, std::string> > options;
ParseGeneratorParameter(parameter, &options);
bool generate_server = false;
std::string class_suffix;
for (size_t i = 0; i < options.size(); ++i) {
if (options[i].first == "class_suffix") {
class_suffix = options[i].second;
} else if (options[i].first == "generate_server") {
generate_server = true;
} else {
*error = "unsupported options: " + options[i].first;
return false;
@ -59,20 +62,32 @@ class PHPGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
}
for (int i = 0; i < file->service_count(); i++) {
std::string code = GenerateFile(file, file->service(i), class_suffix);
// Get output file name
std::string file_name =
GetPHPServiceFilename(file, file->service(i), class_suffix);
std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> output(
context->Open(file_name));
grpc::protobuf::io::CodedOutputStream coded_out(output.get());
coded_out.WriteRaw(code.data(), code.size());
GenerateService(file, file->service(i), class_suffix, false, context);
if (generate_server) {
GenerateService(file, file->service(i), class_suffix, true, context);
}
}
return true;
}
private:
void GenerateService(
const grpc::protobuf::FileDescriptor* file,
const grpc::protobuf::ServiceDescriptor* service,
const std::string& class_suffix, bool is_server,
grpc::protobuf::compiler::GeneratorContext* context) const {
std::string code = GenerateFile(file, service, class_suffix, is_server);
// Get output file name
std::string file_name =
GetPHPServiceFilename(file, service, class_suffix, is_server);
std::unique_ptr<grpc::protobuf::io::ZeroCopyOutputStream> output(
context->Open(file_name));
grpc::protobuf::io::CodedOutputStream coded_out(output.get());
coded_out.WriteRaw(code.data(), code.size());
}
};
int main(int argc, char* argv[]) {

@ -90,6 +90,8 @@
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
@ -98,9 +100,7 @@
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"

@ -31,9 +31,9 @@
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/slice/slice_internal.h"

@ -26,9 +26,9 @@
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/ext/filters/client_channel/subchannel.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/error_utils.h"

@ -34,11 +34,11 @@
#include "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h"
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
#include "src/core/ext/filters/client_channel/subchannel.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/error_utils.h"
#include "src/core/lib/transport/static_metadata.h"

@ -33,13 +33,13 @@
// that implementation should be hidden from the LB policy API.
#include "src/core/ext/filters/client_channel/subchannel.h"
#include "src/core/ext/filters/client_channel/subchannel_interface.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/transport/connectivity_state.h"
// Code for maintaining a list of subchannels within an LB policy.

@ -601,10 +601,12 @@ grpc_error_handle CdsLb::UpdateXdsCertificateProvider(
xds_client_->certificate_provider_store()
.CreateOrGetCertificateProvider(root_provider_instance_name);
if (new_root_provider == nullptr) {
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
absl::StrCat("Certificate provider instance name: \"",
root_provider_instance_name, "\" not recognized.")
.c_str());
return grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
absl::StrCat("Certificate provider instance name: \"",
root_provider_instance_name, "\" not recognized.")
.c_str()),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
}
}
if (root_certificate_provider_ != new_root_provider) {
@ -639,10 +641,13 @@ grpc_error_handle CdsLb::UpdateXdsCertificateProvider(
xds_client_->certificate_provider_store()
.CreateOrGetCertificateProvider(identity_provider_instance_name);
if (new_identity_provider == nullptr) {
return GRPC_ERROR_CREATE_FROM_COPIED_STRING(
absl::StrCat("Certificate provider instance name: \"",
identity_provider_instance_name, "\" not recognized.")
.c_str());
return grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_COPIED_STRING(
absl::StrCat("Certificate provider instance name: \"",
identity_provider_instance_name,
"\" not recognized.")
.c_str()),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
}
}
if (identity_certificate_provider_ != new_identity_provider) {

@ -337,44 +337,29 @@ void XdsClusterManagerLb::UpdateStateLocked() {
gpr_log(GPR_INFO, "[xds_cluster_manager_lb %p] connectivity changed to %s",
this, ConnectivityStateName(connectivity_state));
}
std::unique_ptr<SubchannelPicker> picker;
absl::Status status;
switch (connectivity_state) {
case GRPC_CHANNEL_READY: {
ClusterPicker::ClusterMap cluster_map;
for (const auto& p : config_->cluster_map()) {
const std::string& cluster_name = p.first;
RefCountedPtr<ChildPickerWrapper>& child_picker =
cluster_map[cluster_name];
child_picker = children_[cluster_name]->picker_wrapper();
if (child_picker == nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_cluster_manager_lb_trace)) {
gpr_log(
GPR_INFO,
ClusterPicker::ClusterMap cluster_map;
for (const auto& p : config_->cluster_map()) {
const std::string& cluster_name = p.first;
RefCountedPtr<ChildPickerWrapper>& child_picker = cluster_map[cluster_name];
child_picker = children_[cluster_name]->picker_wrapper();
if (child_picker == nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_cluster_manager_lb_trace)) {
gpr_log(GPR_INFO,
"[xds_cluster_manager_lb %p] child %s has not yet returned a "
"picker; creating a QueuePicker.",
this, cluster_name.c_str());
}
child_picker = MakeRefCounted<ChildPickerWrapper>(
cluster_name, absl::make_unique<QueuePicker>(
Ref(DEBUG_LOCATION, "QueuePicker")));
}
}
picker = absl::make_unique<ClusterPicker>(std::move(cluster_map));
break;
child_picker = MakeRefCounted<ChildPickerWrapper>(
cluster_name,
absl::make_unique<QueuePicker>(Ref(DEBUG_LOCATION, "QueuePicker")));
}
case GRPC_CHANNEL_CONNECTING:
case GRPC_CHANNEL_IDLE:
picker =
absl::make_unique<QueuePicker>(Ref(DEBUG_LOCATION, "QueuePicker"));
break;
default:
grpc_error_handle error = grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"TRANSIENT_FAILURE from XdsClusterManagerLb"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
status = grpc_error_to_absl_status(error);
picker = absl::make_unique<TransientFailurePicker>(error);
}
std::unique_ptr<SubchannelPicker> picker =
absl::make_unique<ClusterPicker>(std::move(cluster_map));
absl::Status status;
if (connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
status = absl::Status(absl::StatusCode::kUnavailable,
"TRANSIENT_FAILURE from XdsClusterManagerLb");
}
channel_control_helper()->UpdateState(connectivity_state, status,
std::move(picker));

@ -33,10 +33,10 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
namespace grpc_core {

@ -30,10 +30,10 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include <string.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/iocp_windows.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/sockaddr_windows.h"
#include "src/core/lib/iomgr/socket_windows.h"
#include "src/core/lib/iomgr/tcp_windows.h"

@ -38,14 +38,14 @@
#include <address_sorting/address_sorting.h>
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/nameser.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/transport/authority_override.h"

@ -25,8 +25,8 @@
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/parse_address.h"
bool grpc_ares_query_ipv6() {
/* The libuv grpc code currently does not have the code to probe for this,

@ -25,8 +25,8 @@
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/socket_windows.h"
bool grpc_ares_query_ipv6() { return grpc_ipv6_loopback_available(); }

@ -30,11 +30,11 @@
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "src/core/lib/iomgr/work_serializer.h"

@ -30,9 +30,9 @@
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "src/core/lib/slice/slice_internal.h"

@ -27,7 +27,7 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
namespace grpc_core {

@ -36,6 +36,8 @@
#include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
#include "src/core/ext/filters/client_channel/service_config.h"
#include "src/core/ext/filters/client_channel/subchannel_pool_interface.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/connected_channel.h"
@ -45,8 +47,6 @@
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/channel.h"

@ -32,9 +32,9 @@
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h"
#include "src/core/ext/filters/load_reporting/registered_opencensus_objects.h"
#include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"

@ -28,9 +28,9 @@
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/transport/chttp2/client/chttp2_connector.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/security/security_connector/security_connector.h"
#include "src/core/lib/slice/slice_internal.h"

@ -38,6 +38,7 @@
#include "src/core/ext/filters/http/server/http_server_filter.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/handshaker.h"
#include "src/core/lib/channel/handshaker_registry.h"
@ -46,7 +47,6 @@
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/resource_quota.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/tcp_server.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "src/core/lib/slice/slice_internal.h"

@ -90,13 +90,13 @@
#include <grpc/support/string_util.h>
#include "src/core/ext/xds/xds_api.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gpr/env.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_utils.h"
#include "src/core/lib/slice/slice_utils.h"

@ -38,6 +38,7 @@
#include "src/core/ext/xds/xds_client.h"
#include "src/core/ext/xds/xds_client_stats.h"
#include "src/core/ext/xds/xds_http_filters.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_stack.h"
@ -48,7 +49,6 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"

@ -22,10 +22,10 @@
#include "src/core/ext/xds/xds_certificate_provider.h"
#include "src/core/ext/xds/xds_client.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_utils.h"
#include "src/core/lib/security/credentials/xds/xds_credentials.h"
#include "src/core/lib/surface/api_trace.h"

@ -18,7 +18,7 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/address_utils/parse_address.h"
#include <stdio.h>
#include <string.h>

@ -16,8 +16,8 @@
*
*/
#ifndef GRPC_CORE_LIB_IOMGR_PARSE_ADDRESS_H
#define GRPC_CORE_LIB_IOMGR_PARSE_ADDRESS_H
#ifndef GRPC_CORE_LIB_ADDRESS_UTILS_PARSE_ADDRESS_H
#define GRPC_CORE_LIB_ADDRESS_UTILS_PARSE_ADDRESS_H
#include <grpc/support/port_platform.h>
@ -74,4 +74,4 @@ grpc_error_handle UnixAbstractSockaddrPopulate(
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_IOMGR_PARSE_ADDRESS_H */
#endif /* GRPC_CORE_LIB_ADDRESS_UTILS_PARSE_ADDRESS_H */

@ -18,7 +18,7 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include <errno.h>
#include <inttypes.h>

@ -16,8 +16,8 @@
*
*/
#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H
#define GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H
#ifndef GRPC_CORE_LIB_ADDRESS_UTILS_SOCKADDR_UTILS_H
#define GRPC_CORE_LIB_ADDRESS_UTILS_SOCKADDR_UTILS_H
#include <grpc/support/port_platform.h>
@ -97,4 +97,4 @@ bool grpc_sockaddr_match_subnet(const grpc_resolved_address* address,
const grpc_resolved_address* subnet_address,
uint32_t mask_bits);
#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */
#endif /* GRPC_CORE_LIB_ADDRESS_UTILS_SOCKADDR_UTILS_H */

@ -19,8 +19,10 @@
#include <grpc/impl/codegen/port_platform.h>
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "absl/strings/escaping.h"
#include "absl/strings/strip.h"
@ -29,10 +31,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channelz_registry.h"
#include "src/core/lib/channel/status_util.h"
#include "src/core/lib/gpr/string.h"
@ -42,6 +42,7 @@
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/slice/b64.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/channel.h"

@ -25,8 +25,10 @@
#include "absl/strings/cord.h"
#include "absl/strings/escaping.h"
#include "absl/strings/match.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "absl/time/clock.h"
#include "google/protobuf/any.upb.h"
#include "google/rpc/status.upb.h"
@ -37,42 +39,50 @@ namespace grpc_core {
namespace {
#define TYPE_URL_PREFIX "type.googleapis.com/grpc.status."
#define TYPE_INT_TAG "int."
#define TYPE_STR_TAG "str."
#define TYPE_TIME_TAG "time."
#define TYPE_CHILDREN_TAG "children"
#define TYPE_URL(name) (TYPE_URL_PREFIX name)
const absl::string_view kTypeUrlPrefix = TYPE_URL_PREFIX;
const absl::string_view kChildrenPropertyUrl = TYPE_URL("children");
const absl::string_view kTypeIntTag = TYPE_INT_TAG;
const absl::string_view kTypeStrTag = TYPE_STR_TAG;
const absl::string_view kTypeTimeTag = TYPE_TIME_TAG;
const absl::string_view kTypeChildrenTag = TYPE_CHILDREN_TAG;
const absl::string_view kChildrenPropertyUrl = TYPE_URL(TYPE_CHILDREN_TAG);
const char* GetStatusIntPropertyUrl(StatusIntProperty key) {
switch (key) {
case StatusIntProperty::kErrorNo:
return TYPE_URL("errno");
return TYPE_URL(TYPE_INT_TAG "errno");
case StatusIntProperty::kFileLine:
return TYPE_URL("file_line");
return TYPE_URL(TYPE_INT_TAG "file_line");
case StatusIntProperty::kStreamId:
return TYPE_URL("stream_id");
return TYPE_URL(TYPE_INT_TAG "stream_id");
case StatusIntProperty::kRpcStatus:
return TYPE_URL("grpc_status");
return TYPE_URL(TYPE_INT_TAG "grpc_status");
case StatusIntProperty::kOffset:
return TYPE_URL("offset");
return TYPE_URL(TYPE_INT_TAG "offset");
case StatusIntProperty::kIndex:
return TYPE_URL("index");
return TYPE_URL(TYPE_INT_TAG "index");
case StatusIntProperty::kSize:
return TYPE_URL("size");
return TYPE_URL(TYPE_INT_TAG "size");
case StatusIntProperty::kHttp2Error:
return TYPE_URL("http2_error");
return TYPE_URL(TYPE_INT_TAG "http2_error");
case StatusIntProperty::kTsiCode:
return TYPE_URL("tsi_code");
return TYPE_URL(TYPE_INT_TAG "tsi_code");
case StatusIntProperty::kWsaError:
return TYPE_URL("wsa_error");
return TYPE_URL(TYPE_INT_TAG "wsa_error");
case StatusIntProperty::kFd:
return TYPE_URL("fd");
return TYPE_URL(TYPE_INT_TAG "fd");
case StatusIntProperty::kHttpStatus:
return TYPE_URL("http_status");
return TYPE_URL(TYPE_INT_TAG "http_status");
case StatusIntProperty::kOccurredDuringWrite:
return TYPE_URL("occurred_during_write");
return TYPE_URL(TYPE_INT_TAG "occurred_during_write");
case StatusIntProperty::ChannelConnectivityState:
return TYPE_URL("channel_connectivity_state");
return TYPE_URL(TYPE_INT_TAG "channel_connectivity_state");
case StatusIntProperty::kLbPolicyDrop:
return TYPE_URL("lb_policy_drop");
return TYPE_URL(TYPE_INT_TAG "lb_policy_drop");
}
GPR_UNREACHABLE_CODE(return "unknown");
}
@ -80,29 +90,35 @@ const char* GetStatusIntPropertyUrl(StatusIntProperty key) {
const char* GetStatusStrPropertyUrl(StatusStrProperty key) {
switch (key) {
case StatusStrProperty::kDescription:
return TYPE_URL("description");
return TYPE_URL(TYPE_STR_TAG "description");
case StatusStrProperty::kFile:
return TYPE_URL("file");
return TYPE_URL(TYPE_STR_TAG "file");
case StatusStrProperty::kOsError:
return TYPE_URL("os_error");
return TYPE_URL(TYPE_STR_TAG "os_error");
case StatusStrProperty::kSyscall:
return TYPE_URL("syscall");
return TYPE_URL(TYPE_STR_TAG "syscall");
case StatusStrProperty::kTargetAddress:
return TYPE_URL("target_address");
return TYPE_URL(TYPE_STR_TAG "target_address");
case StatusStrProperty::kGrpcMessage:
return TYPE_URL("grpc_message");
return TYPE_URL(TYPE_STR_TAG "grpc_message");
case StatusStrProperty::kRawBytes:
return TYPE_URL("raw_bytes");
return TYPE_URL(TYPE_STR_TAG "raw_bytes");
case StatusStrProperty::kTsiError:
return TYPE_URL("tsi_error");
return TYPE_URL(TYPE_STR_TAG "tsi_error");
case StatusStrProperty::kFilename:
return TYPE_URL("filename");
return TYPE_URL(TYPE_STR_TAG "filename");
case StatusStrProperty::kKey:
return TYPE_URL("key");
return TYPE_URL(TYPE_STR_TAG "key");
case StatusStrProperty::kValue:
return TYPE_URL("value");
case StatusStrProperty::kCreatedTime:
return TYPE_URL("created_time");
return TYPE_URL(TYPE_STR_TAG "value");
}
GPR_UNREACHABLE_CODE(return "unknown");
}
const char* GetStatusTimePropertyUrl(StatusTimeProperty key) {
switch (key) {
case StatusTimeProperty::kCreated:
return TYPE_URL(TYPE_TIME_TAG "created_time");
}
GPR_UNREACHABLE_CODE(return "unknown");
}
@ -150,8 +166,7 @@ absl::Status StatusCreate(absl::StatusCode code, absl::string_view msg,
if (location.line() != -1) {
StatusSetInt(&s, StatusIntProperty::kFileLine, location.line());
}
absl::Time now = grpc_core::ToAbslTime(gpr_now(GPR_CLOCK_REALTIME));
StatusSetStr(&s, StatusStrProperty::kCreatedTime, absl::FormatTime(now));
StatusSetTime(&s, StatusTimeProperty::kCreated, absl::Now());
for (const absl::Status& child : children) {
if (!child.ok()) {
StatusAddChild(&s, child);
@ -200,6 +215,29 @@ absl::optional<std::string> StatusGetStr(const absl::Status& status,
return {};
}
void StatusSetTime(absl::Status* status, StatusTimeProperty key,
absl::Time time) {
status->SetPayload(GetStatusTimePropertyUrl(key),
absl::Cord(absl::string_view(
reinterpret_cast<const char*>(&time), sizeof(time))));
}
absl::optional<absl::Time> StatusGetTime(const absl::Status& status,
StatusTimeProperty key) {
absl::optional<absl::Cord> p =
status.GetPayload(GetStatusTimePropertyUrl(key));
if (p.has_value()) {
absl::optional<absl::string_view> sv = p->TryFlat();
if (sv.has_value()) {
return *reinterpret_cast<const absl::Time*>(sv->data());
} else {
std::string s = std::string(*p);
return *reinterpret_cast<const absl::Time*>(s.c_str());
}
}
return {};
}
void StatusAddChild(absl::Status* status, absl::Status child) {
upb::Arena arena;
// Serialize msg to buf
@ -237,20 +275,45 @@ std::string StatusToString(const absl::Status& status) {
}
std::vector<std::string> kvs;
absl::optional<absl::Cord> children;
status.ForEachPayload(
[&](absl::string_view type_url, const absl::Cord& payload) {
if (type_url.substr(0, kTypeUrlPrefix.size()) == kTypeUrlPrefix) {
type_url.remove_prefix(kTypeUrlPrefix.size());
}
if (type_url == kChildrenPropertyUrl.substr(kTypeUrlPrefix.size())) {
children = payload;
} else {
absl::optional<absl::string_view> payload_view = payload.TryFlat();
std::string payload_str = absl::CHexEscape(
payload_view.has_value() ? *payload_view : std::string(payload));
kvs.push_back(absl::StrCat(type_url, ":\"", payload_str, "\""));
}
});
status.ForEachPayload([&](absl::string_view type_url,
const absl::Cord& payload) {
if (absl::StartsWith(type_url, kTypeUrlPrefix)) {
type_url.remove_prefix(kTypeUrlPrefix.size());
if (type_url == kTypeChildrenTag) {
children = payload;
return;
}
absl::string_view payload_view;
std::string payload_storage;
if (payload.TryFlat().has_value()) {
payload_view = payload.TryFlat().value();
} else {
payload_storage = std::string(payload);
payload_view = payload_storage;
}
if (absl::StartsWith(type_url, kTypeIntTag)) {
type_url.remove_prefix(kTypeIntTag.size());
kvs.push_back(absl::StrCat(type_url, ":", payload_view));
} else if (absl::StartsWith(type_url, kTypeStrTag)) {
type_url.remove_prefix(kTypeStrTag.size());
kvs.push_back(absl::StrCat(type_url, ":\"",
absl::CHexEscape(payload_view), "\""));
} else if (absl::StartsWith(type_url, kTypeTimeTag)) {
type_url.remove_prefix(kTypeTimeTag.size());
absl::Time t =
*reinterpret_cast<const absl::Time*>(payload_view.data());
kvs.push_back(absl::StrCat(type_url, ":\"", absl::FormatTime(t), "\""));
} else {
kvs.push_back(absl::StrCat(type_url, ":\"",
absl::CHexEscape(payload_view), "\""));
}
} else {
absl::optional<absl::string_view> payload_view = payload.TryFlat();
std::string payload_str = absl::CHexEscape(
payload_view.has_value() ? *payload_view : std::string(payload));
kvs.push_back(absl::StrCat(type_url, ":\"", payload_str, "\""));
}
});
if (children.has_value()) {
std::vector<absl::Status> children_status = ParseChildren(*children);
std::vector<std::string> children_text;

@ -22,10 +22,15 @@
#include <grpc/support/port_platform.h>
#include "absl/status/status.h"
#include "google/rpc/status.upb.h"
#include "absl/time/time.h"
#include "src/core/lib/gprpp/debug_location.h"
extern "C" {
struct google_rpc_Status;
struct upb_arena;
}
namespace grpc_core {
/// This enum should have the same value of grpc_error_ints
@ -91,8 +96,12 @@ enum class StatusStrProperty {
kKey,
/// value associated with the error
kValue,
/// time string to create the error
kCreatedTime,
};
/// This enum should have the same value of grpc_error_times
enum class StatusTimeProperty {
/// timestamp of error creation
kCreated,
};
/// Creates a status with given additional information
@ -115,6 +124,14 @@ void StatusSetStr(absl::Status* status, StatusStrProperty key,
absl::optional<std::string> StatusGetStr(
const absl::Status& status, StatusStrProperty key) GRPC_MUST_USE_RESULT;
/// Sets the time property to the status
void StatusSetTime(absl::Status* status, StatusTimeProperty key,
absl::Time time);
/// Gets the time property from the status
absl::optional<absl::Time> StatusGetTime(
const absl::Status& status, StatusTimeProperty key) GRPC_MUST_USE_RESULT;
/// Adds a child status to status
void StatusAddChild(absl::Status* status, absl::Status child);

@ -30,6 +30,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/memory.h"
@ -38,7 +39,6 @@
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/slice/slice_internal.h"

@ -29,13 +29,13 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/cfstream_handle.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/error_cfstream.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_string_helpers.h"

@ -21,9 +21,9 @@
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/iomgr/endpoint_pair.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include <errno.h>
#include <fcntl.h>

@ -29,12 +29,12 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/iomgr/iomgr_custom.h"
#include "src/core/lib/iomgr/port.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
struct grpc_custom_resolver {
grpc_closure* on_done = nullptr;

@ -39,13 +39,13 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/block_annotate.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
struct request {
char* name;

@ -47,10 +47,10 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
/* set a socket to use zerocopy */
grpc_error_handle grpc_set_socket_zerocopy(int fd) {

@ -33,6 +33,7 @@
#include <netinet/in.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/iomgr/cfstream_handle.h"
@ -40,7 +41,6 @@
#include "src/core/lib/iomgr/endpoint_cfstream.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/error_cfstream.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/iomgr/timer.h"

@ -25,9 +25,9 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/iomgr_custom.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/iomgr/tcp_custom.h"
#include "src/core/lib/iomgr/timer.h"

@ -35,12 +35,12 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_mutator.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "src/core/lib/iomgr/tcp_posix.h"

@ -31,10 +31,10 @@
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/iocp_windows.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_windows.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/iomgr/tcp_windows.h"

@ -29,10 +29,10 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/iomgr_custom.h"
#include "src/core/lib/iomgr/resource_quota.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/iomgr/tcp_custom.h"
#include "src/core/lib/iomgr/tcp_server.h"

@ -45,6 +45,7 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/debug/trace.h"
@ -54,7 +55,6 @@
#include "src/core/lib/iomgr/buffer_list.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"

@ -28,12 +28,12 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/iomgr_custom.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/tcp_custom.h"
#include "src/core/lib/iomgr/tcp_server.h"

@ -47,13 +47,13 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "src/core/lib/iomgr/tcp_posix.h"
#include "src/core/lib/iomgr/tcp_server.h"

@ -37,9 +37,9 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#define MIN_SAFE_ACCEPT_QUEUE_SIZE 100

@ -36,9 +36,9 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
/* Return the listener in s with address addr or NULL. */
static grpc_tcp_listener* find_listener_with_addr(grpc_tcp_server* s,

@ -38,11 +38,11 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/iocp_windows.h"
#include "src/core/lib/iomgr/pollset_windows.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_windows.h"
#include "src/core/lib/iomgr/tcp_server.h"
#include "src/core/lib/iomgr/tcp_windows.h"

@ -32,10 +32,10 @@
#include <grpc/support/log_windows.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/iocp_windows.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_windows.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/iomgr/tcp_windows.h"

@ -56,6 +56,8 @@
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/memory.h"
@ -64,7 +66,6 @@
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_factory_posix.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"

@ -30,7 +30,7 @@
#include "absl/strings/str_cat.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include <grpc/support/alloc.h>

@ -16,8 +16,8 @@
#include "src/core/lib/security/authorization/evaluate_args.h"
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/slice/slice_utils.h"
namespace grpc_core {

@ -29,12 +29,12 @@
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/socket_utils.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "src/core/lib/security/credentials/local/local_credentials.h"

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
s.version = '3.15.2'
s.version = '3.15.8'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = '3-Clause BSD License'

@ -67,6 +67,15 @@ namespace {
// max-threads set) to the server builder.
#define DEFAULT_MAX_SYNC_SERVER_THREADS INT_MAX
// Give a useful status error message if the resource is exhausted specifically
// because the server threadpool is full.
const char* kServerThreadpoolExhausted = "Server Threadpool Exhausted";
// Although we might like to give a useful status error message on unimplemented
// RPCs, it's not always possible since that also would need to be added across
// languages and isn't actually required by the spec.
const char* kUnknownRpcMethod = "";
class DefaultGlobalCallbacks final : public Server::GlobalCallbacks {
public:
~DefaultGlobalCallbacks() override {}
@ -802,7 +811,7 @@ class Server::SyncRequestThreadManager : public grpc::ThreadManager {
if (has_sync_method_) {
unknown_method_ = absl::make_unique<grpc::internal::RpcServiceMethod>(
"unknown", grpc::internal::RpcMethod::BIDI_STREAMING,
new grpc::internal::UnknownMethodHandler);
new grpc::internal::UnknownMethodHandler(kUnknownRpcMethod));
server_->server()->core_server->SetBatchMethodAllocator(
server_cq_->cq(), [this] {
grpc_core::Server::BatchCallAllocation result;
@ -1194,7 +1203,8 @@ void Server::Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) {
// to deal with the case of thread exhaustion
if (sync_server_cqs_ != nullptr && !sync_server_cqs_->empty()) {
resource_exhausted_handler_ =
absl::make_unique<grpc::internal::ResourceExhaustedHandler>();
absl::make_unique<grpc::internal::ResourceExhaustedHandler>(
kServerThreadpoolExhausted);
}
for (const auto& value : sync_req_mgrs_) {
@ -1321,8 +1331,9 @@ bool Server::UnimplementedAsyncRequest::FinalizeResult(void** tag,
Server::UnimplementedAsyncResponse::UnimplementedAsyncResponse(
UnimplementedAsyncRequest* request)
: request_(request) {
grpc::Status status(grpc::StatusCode::UNIMPLEMENTED, "");
grpc::internal::UnknownMethodHandler::FillOps(request_->context(), this);
grpc::Status status(grpc::StatusCode::UNIMPLEMENTED, kUnknownRpcMethod);
grpc::internal::UnknownMethodHandler::FillOps(request_->context(),
kUnknownRpcMethod, this);
request_->stream()->call_.PerformOps(this);
}

@ -2,7 +2,10 @@
<PropertyGroup>
<Authors>The gRPC Authors</Authors>
<Copyright>Copyright 2015 The gRPC Authors</Copyright>
<Description>Debug symbols for the grpc_csharp_ext native library contained in Grpc.Core</Description>
<Description>Debug symbols for the grpc_csharp_ext native library contained in Grpc.Core
Note that the Grpc.Core implementation of gRPC for C# is in maintenance mode and will be replaced by grpc-dotnet in the future.
See https://grpc.io/blog/grpc-csharp-future/ for details.</Description>
<PackageIconUrl>https://github.com/grpc/grpc.github.io/raw/master/img/grpc_square_reverse_4x.png</PackageIconUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/grpc/grpc</PackageProjectUrl>

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

Loading…
Cancel
Save