Merge branch 'master' into jwt

pull/1011/head
Yang Gao 10 years ago
commit f859510340
  1. 31
      .travis.yml
  2. 711
      Makefile
  3. 2
      README.md
  4. 188
      build.json
  5. 39
      examples/pubsub/main.cc
  6. 6
      examples/pubsub/publisher.h
  7. 6
      examples/pubsub/publisher_test.cc
  8. 6
      examples/pubsub/subscriber.h
  9. 6
      examples/pubsub/subscriber_test.cc
  10. 11
      include/grpc++/async_unary_call.h
  11. 14
      include/grpc++/channel_arguments.h
  12. 12
      include/grpc++/channel_interface.h
  13. 12
      include/grpc++/client_context.h
  14. 10
      include/grpc++/completion_queue.h
  15. 24
      include/grpc++/config.h
  16. 11
      include/grpc++/create_channel.h
  17. 121
      include/grpc++/credentials.h
  18. 20
      include/grpc++/impl/call.h
  19. 16
      include/grpc++/impl/client_unary_call.h
  20. 6
      include/grpc++/impl/internal_stub.h
  21. 12
      include/grpc++/impl/rpc_method.h
  22. 28
      include/grpc++/impl/rpc_service_method.h
  23. 18
      include/grpc++/impl/service_type.h
  24. 27
      include/grpc++/server.h
  25. 22
      include/grpc++/server_builder.h
  26. 8
      include/grpc++/server_context.h
  27. 35
      include/grpc++/server_credentials.h
  28. 6
      include/grpc++/status.h
  29. 79
      include/grpc++/status_code_enum.h
  30. 18
      include/grpc++/stream.h
  31. 6
      include/grpc++/thread_pool_interface.h
  32. 6
      include/grpc/byte_buffer.h
  33. 6
      include/grpc/byte_buffer_reader.h
  34. 9
      include/grpc/grpc.h
  35. 6
      include/grpc/grpc_http.h
  36. 18
      include/grpc/grpc_security.h
  37. 79
      include/grpc/status.h
  38. 6
      include/grpc/support/alloc.h
  39. 6
      include/grpc/support/atm.h
  40. 6
      include/grpc/support/atm_gcc_atomic.h
  41. 6
      include/grpc/support/atm_gcc_sync.h
  42. 6
      include/grpc/support/atm_win32.h
  43. 6
      include/grpc/support/cancellable_platform.h
  44. 6
      include/grpc/support/cmdline.h
  45. 6
      include/grpc/support/cpu.h
  46. 16
      include/grpc/support/histogram.h
  47. 6
      include/grpc/support/host_port.h
  48. 6
      include/grpc/support/log.h
  49. 6
      include/grpc/support/log_win32.h
  50. 6
      include/grpc/support/port_platform.h
  51. 6
      include/grpc/support/slice.h
  52. 8
      include/grpc/support/slice_buffer.h
  53. 6
      include/grpc/support/sync.h
  54. 6
      include/grpc/support/sync_generic.h
  55. 6
      include/grpc/support/sync_posix.h
  56. 6
      include/grpc/support/sync_win32.h
  57. 6
      include/grpc/support/thd.h
  58. 6
      include/grpc/support/time.h
  59. 6
      include/grpc/support/useful.h
  60. 16
      src/compiler/cpp_generator.cc
  61. 6
      src/compiler/cpp_generator.h
  62. 6
      src/compiler/cpp_generator_helpers.h
  63. 6
      src/compiler/generator_helpers.h
  64. 204
      src/compiler/python_generator.cc
  65. 6
      src/compiler/python_generator.h
  66. 1
      src/compiler/python_plugin.cc
  67. 6
      src/compiler/ruby_generator.h
  68. 6
      src/compiler/ruby_generator_helpers-inl.h
  69. 6
      src/compiler/ruby_generator_map-inl.h
  70. 6
      src/compiler/ruby_generator_string-inl.h
  71. 6
      src/core/channel/census_filter.h
  72. 6
      src/core/channel/channel_args.h
  73. 2
      src/core/channel/channel_stack.c
  74. 10
      src/core/channel/channel_stack.h
  75. 6
      src/core/channel/child_channel.h
  76. 6
      src/core/channel/client_channel.h
  77. 6
      src/core/channel/client_setup.h
  78. 4
      src/core/channel/connected_channel.c
  79. 6
      src/core/channel/connected_channel.h
  80. 6
      src/core/channel/http_client_filter.h
  81. 6
      src/core/channel/http_filter.h
  82. 6
      src/core/channel/http_server_filter.h
  83. 6
      src/core/channel/metadata_buffer.h
  84. 6
      src/core/channel/noop_filter.h
  85. 6
      src/core/compression/algorithm.h
  86. 6
      src/core/compression/message_compress.h
  87. 65
      src/core/debug/trace.c
  88. 29
      src/core/debug/trace.h
  89. 6
      src/core/httpcli/format_request.h
  90. 6
      src/core/httpcli/httpcli.h
  91. 6
      src/core/httpcli/httpcli_security_context.h
  92. 6
      src/core/httpcli/parser.h
  93. 6
      src/core/iomgr/alarm.h
  94. 6
      src/core/iomgr/alarm_heap.h
  95. 6
      src/core/iomgr/alarm_internal.h
  96. 6
      src/core/iomgr/endpoint.h
  97. 6
      src/core/iomgr/endpoint_pair.h
  98. 6
      src/core/iomgr/fd_posix.h
  99. 6
      src/core/iomgr/iocp_windows.h
  100. 6
      src/core/iomgr/iomgr.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,14 +1,31 @@
language: cpp
before_install:
- sudo add-apt-repository ppa:yjwong/gflags -y
- sudo add-apt-repository ppa:h-rayflood/llvm -y
- sudo apt-get update -qq
- sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv
- sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv clang-3.5
- sudo pip install cpp-coveralls
env:
global:
- RUBY_VERSION=2.1
- COVERALLS_PARALLEL=true
matrix:
- CONFIG=dbg TEST=c
- CONFIG=dbg TEST=c++
- CONFIG=opt TEST=c
- CONFIG=opt TEST=c++
- CONFIG=opt TEST=node
- CONFIG=opt TEST=ruby
- CONFIG=opt TEST=python
- CONFIG=gcov TEST=c
- CONFIG=gcov TEST=c++
script:
- ./tools/run_tests/run_tests.py -l c -t -j 16 -c dbg -s 2.0
- ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c dbg -s 2.0
- make clean
- ./tools/run_tests/run_tests.py -l c -t -j 16 -c opt -s 2.0
- ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c opt -s 2.0
- ./tools/run_tests/run_tests.py -l node -t -j 16 -c opt
- rvm use $RUBY_VERSION
- gem install bundler
- ./tools/run_tests/run_tests.py -l $TEST -t -j 16 -c $CONFIG -s 4.0
after_success:
- if [ "$CONFIG" = "gcov" ] ; then coveralls --exclude third_party --exclude gens -b. --gcov-options '\-p' ; fi
notifications:
email: false
webhooks:
- https://coveralls.io/webhook?repo_token=54IxAHPjJNdQJzJAhPU0MFpCtg7KvcydQ

File diff suppressed because one or more lines are too long

@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/grpc/grpc.svg?branch=master)](https://travis-ci.org/grpc/grpc)
[gRPC - An RPC library and framework](http://github.com/grpc/grpc)
===================================

@ -9,6 +9,61 @@
}
},
"filegroups": [
{
"name": "grpc++_base",
"public_headers": [
"include/grpc++/async_unary_call.h",
"include/grpc++/channel_arguments.h",
"include/grpc++/channel_interface.h",
"include/grpc++/client_context.h",
"include/grpc++/completion_queue.h",
"include/grpc++/config.h",
"include/grpc++/create_channel.h",
"include/grpc++/credentials.h",
"include/grpc++/impl/call.h",
"include/grpc++/impl/client_unary_call.h",
"include/grpc++/impl/internal_stub.h",
"include/grpc++/impl/rpc_method.h",
"include/grpc++/impl/rpc_service_method.h",
"include/grpc++/impl/service_type.h",
"include/grpc++/server.h",
"include/grpc++/server_builder.h",
"include/grpc++/server_context.h",
"include/grpc++/server_credentials.h",
"include/grpc++/status.h",
"include/grpc++/status_code_enum.h",
"include/grpc++/stream.h",
"include/grpc++/thread_pool_interface.h"
],
"headers": [
"src/cpp/client/channel.h",
"src/cpp/proto/proto_utils.h",
"src/cpp/server/thread_pool.h",
"src/cpp/util/time.h"
],
"src": [
"src/cpp/client/channel.cc",
"src/cpp/client/channel_arguments.cc",
"src/cpp/client/client_context.cc",
"src/cpp/client/client_unary_call.cc",
"src/cpp/client/create_channel.cc",
"src/cpp/client/credentials.cc",
"src/cpp/client/insecure_credentials.cc",
"src/cpp/client/internal_stub.cc",
"src/cpp/common/call.cc",
"src/cpp/common/completion_queue.cc",
"src/cpp/common/rpc_method.cc",
"src/cpp/proto/proto_utils.cc",
"src/cpp/server/insecure_server_credentials.cc",
"src/cpp/server/server.cc",
"src/cpp/server/server_builder.cc",
"src/cpp/server/server_context.cc",
"src/cpp/server/server_credentials.cc",
"src/cpp/server/thread_pool.cc",
"src/cpp/util/status.cc",
"src/cpp/util/time.cc"
]
},
{
"name": "grpc_base",
"public_headers": [
@ -79,7 +134,7 @@
"src/core/surface/client.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
"src/core/surface/lame_client.h",
"src/core/surface/init.h",
"src/core/surface/server.h",
"src/core/surface/surface_trace.h",
"src/core/transport/chttp2/bin_encoder.h",
@ -180,6 +235,7 @@
"src/core/surface/server.c",
"src/core/surface/server_chttp2.c",
"src/core/surface/server_create.c",
"src/core/surface/surface_trace.c",
"src/core/transport/chttp2/alpn.c",
"src/core/transport/chttp2/bin_encoder.c",
"src/core/transport/chttp2/frame_data.c",
@ -274,7 +330,7 @@
"src/core/support/time_posix.c",
"src/core/support/time_win32.c"
],
"secure": false,
"secure": "no",
"vs_project_guid": "{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}"
},
{
@ -329,8 +385,8 @@
"src/core/security/secure_transport_setup.c",
"src/core/security/security_context.c",
"src/core/security/server_secure_chttp2.c",
"src/core/surface/init_secure.c",
"src/core/surface/secure_channel_create.c",
"src/core/surface/secure_server_create.c",
"src/core/tsi/fake_transport_security.c",
"src/core/tsi/ssl_transport_security.c",
"src/core/tsi/transport_security.c"
@ -342,7 +398,7 @@
"filegroups": [
"grpc_base"
],
"secure": true,
"secure": "yes",
"vs_project_guid": "{29D16885-7228-4C31-81ED-5F9187C7F2A9}"
},
{
@ -372,6 +428,9 @@
"name": "grpc_unsecure",
"build": "all",
"language": "c",
"src": [
"src/core/surface/init_unsecure.c"
],
"deps": [
"gpr"
],
@ -379,68 +438,26 @@
"filegroups": [
"grpc_base"
],
"secure": false,
"secure": "no",
"vs_project_guid": "{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}"
},
{
"name": "grpc++",
"build": "all",
"language": "c++",
"public_headers": [
"include/grpc++/async_unary_call.h",
"include/grpc++/channel_arguments.h",
"include/grpc++/channel_interface.h",
"include/grpc++/client_context.h",
"include/grpc++/completion_queue.h",
"include/grpc++/config.h",
"include/grpc++/create_channel.h",
"include/grpc++/credentials.h",
"include/grpc++/impl/call.h",
"include/grpc++/impl/client_unary_call.h",
"include/grpc++/impl/internal_stub.h",
"include/grpc++/impl/rpc_method.h",
"include/grpc++/impl/rpc_service_method.h",
"include/grpc++/impl/service_type.h",
"include/grpc++/server.h",
"include/grpc++/server_builder.h",
"include/grpc++/server_context.h",
"include/grpc++/server_credentials.h",
"include/grpc++/status.h",
"include/grpc++/status_code_enum.h",
"include/grpc++/stream.h",
"include/grpc++/thread_pool_interface.h"
],
"headers": [
"src/cpp/client/channel.h",
"src/cpp/proto/proto_utils.h",
"src/cpp/server/thread_pool.h",
"src/cpp/util/time.h"
],
"src": [
"src/cpp/client/channel.cc",
"src/cpp/client/channel_arguments.cc",
"src/cpp/client/client_context.cc",
"src/cpp/client/client_unary_call.cc",
"src/cpp/client/create_channel.cc",
"src/cpp/client/credentials.cc",
"src/cpp/client/internal_stub.cc",
"src/cpp/common/call.cc",
"src/cpp/common/completion_queue.cc",
"src/cpp/common/rpc_method.cc",
"src/cpp/proto/proto_utils.cc",
"src/cpp/server/server.cc",
"src/cpp/server/server_builder.cc",
"src/cpp/server/server_context.cc",
"src/cpp/server/server_credentials.cc",
"src/cpp/server/thread_pool.cc",
"src/cpp/util/status.cc",
"src/cpp/util/time.cc"
"src/cpp/client/secure_credentials.cc",
"src/cpp/server/secure_server_credentials.cc"
],
"deps": [
"gpr",
"grpc"
],
"secure": true,
"baselib": true,
"filegroups": [
"grpc++_base"
],
"secure": "check",
"vs_project_guid": "{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}"
},
{
@ -454,6 +471,20 @@
"test/cpp/util/create_test_channel.cc"
]
},
{
"name": "grpc++_unsecure",
"build": "all",
"language": "c++",
"deps": [
"gpr",
"grpc_unsecure"
],
"baselib": true,
"filegroups": [
"grpc++_base"
],
"secure": "no"
},
{
"name": "pubsub_client_lib",
"build": "private",
@ -471,6 +502,20 @@
"gpr"
]
},
{
"name": "qps",
"build": "private",
"language": "c++",
"headers": [
"test/cpp/qps/driver.h",
"test/cpp/qps/timer.h"
],
"src": [
"test/cpp/qps/qpstest.proto",
"test/cpp/qps/driver.cc",
"test/cpp/qps/timer.cc"
]
},
{
"name": "grpc_csharp_ext",
"build": "all",
@ -572,6 +617,7 @@
},
{
"name": "census_statistics_multiple_writers_circular_buffer_test",
"flaky": true,
"build": "test",
"language": "c",
"src": [
@ -628,6 +674,7 @@
},
{
"name": "census_statistics_small_log_test",
"flaky": true,
"build": "test",
"language": "c",
"src": [
@ -866,8 +913,7 @@
"grpc",
"gpr_test_util",
"gpr"
],
"flaky": true
]
},
{
"name": "fling_test",
@ -881,8 +927,7 @@
"grpc",
"gpr_test_util",
"gpr"
],
"flaky": true
]
},
{
"name": "gen_hpack_tables",
@ -1666,7 +1711,7 @@
"src/compiler/cpp_plugin.cc"
],
"deps": [],
"secure": false
"secure": "no"
},
{
"name": "grpc_python_plugin",
@ -1680,7 +1725,7 @@
"src/compiler/python_plugin.cc"
],
"deps": [],
"secure": false
"secure": "no"
},
{
"name": "grpc_ruby_plugin",
@ -1691,7 +1736,7 @@
"src/compiler/ruby_plugin.cc"
],
"deps": [],
"secure": false
"secure": "no"
},
{
"name": "interop_client",
@ -1757,7 +1802,6 @@
],
"deps": [
"pubsub_client_lib",
"grpc++_test_util",
"grpc_test_util",
"grpc++",
"grpc",
@ -1800,15 +1844,15 @@
]
},
{
"name": "qps_client",
"name": "qps_driver",
"build": "test",
"run": false,
"language": "c++",
"src": [
"test/cpp/qps/qpstest.proto",
"test/cpp/qps/client.cc"
"test/cpp/qps/qps_driver.cc"
],
"deps": [
"qps",
"grpc++_test_util",
"grpc_test_util",
"grpc++",
@ -1818,15 +1862,23 @@
]
},
{
"name": "qps_server",
"name": "qps_worker",
"build": "test",
"run": false,
"language": "c++",
"headers": [
"test/cpp/qps/client.h",
"test/cpp/qps/server.h"
],
"src": [
"test/cpp/qps/qpstest.proto",
"test/cpp/qps/server.cc"
"test/cpp/qps/client_async.cc",
"test/cpp/qps/client_sync.cc",
"test/cpp/qps/server_async.cc",
"test/cpp/qps/server_sync.cc",
"test/cpp/qps/worker.cc"
],
"deps": [
"qps",
"grpc++_test_util",
"grpc_test_util",
"grpc++",

@ -41,6 +41,7 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <gflags/gflags.h>
#include <grpc++/channel_arguments.h>
#include <grpc++/channel_interface.h>
#include <grpc++/create_channel.h>
#include <grpc++/credentials.h>
@ -48,17 +49,11 @@
#include "examples/pubsub/publisher.h"
#include "examples/pubsub/subscriber.h"
#include "test/cpp/util/create_test_channel.h"
DEFINE_int32(server_port, 443, "Server port.");
DEFINE_string(server_host,
"pubsub-staging.googleapis.com", "Server host to connect to");
DEFINE_string(project_id, "", "GCE project id such as stoked-keyword-656");
DEFINE_string(service_account_key_file, "",
"Path to service account json key file.");
DEFINE_string(oauth_scope,
"https://www.googleapis.com/auth/cloud-platform",
"Scope for OAuth tokens.");
// In some distros, gflags is in the namespace google, and in some others,
// in gflags. This hack is enabling us to find both.
@ -75,17 +70,6 @@ const char kMessageData[] = "Test Data";
} // namespace
grpc::string GetServiceAccountJsonKey() {
grpc::string json_key;
if (json_key.empty()) {
std::ifstream json_key_file(FLAGS_service_account_key_file);
std::stringstream key_stream;
key_stream << json_key_file.rdbuf();
json_key = key_stream.str();
}
return json_key;
}
int main(int argc, char** argv) {
grpc_init();
ParseCommandLineFlags(&argc, &argv, true);
@ -93,23 +77,11 @@ int main(int argc, char** argv) {
std::ostringstream ss;
std::unique_ptr<grpc::Credentials> creds;
if (FLAGS_service_account_key_file != "") {
grpc::string json_key = GetServiceAccountJsonKey();
creds = grpc::CredentialsFactory::ServiceAccountCredentials(
json_key, FLAGS_oauth_scope, std::chrono::hours(1));
} else {
creds = grpc::CredentialsFactory::ComputeEngineCredentials();
}
ss << FLAGS_server_host << ":" << FLAGS_server_port;
std::shared_ptr<grpc::ChannelInterface> channel(
grpc::CreateTestChannel(
ss.str(),
FLAGS_server_host,
true, // enable SSL
true, // use prod roots
creds));
std::unique_ptr<grpc::Credentials> creds = grpc::GoogleDefaultCredentials();
std::shared_ptr<grpc::ChannelInterface> channel =
grpc::CreateChannel(ss.str(), creds, grpc::ChannelArguments());
grpc::examples::pubsub::Publisher publisher(channel);
grpc::examples::pubsub::Subscriber subscriber(channel);
@ -129,6 +101,7 @@ int main(int argc, char** argv) {
subscription_name, &subscription_topic).IsOk()) {
subscriber.DeleteSubscription(subscription_name);
}
if (publisher.GetTopic(topic).IsOk()) publisher.DeleteTopic(topic);
grpc::Status s = publisher.CreateTopic(topic);

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_
#define __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_
#ifndef GRPC_EXAMPLES_PUBSUB_PUBLISHER_H
#define GRPC_EXAMPLES_PUBSUB_PUBLISHER_H
#include <grpc++/channel_interface.h>
#include <grpc++/status.h>
@ -64,4 +64,4 @@ class Publisher {
} // namespace examples
} // namespace grpc
#endif // __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_
#endif // GRPC_EXAMPLES_PUBSUB_PUBLISHER_H

@ -40,6 +40,7 @@
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
#include <grpc++/status.h>
#include <gtest/gtest.h>
@ -106,12 +107,11 @@ class PublisherTest : public ::testing::Test {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
ServerBuilder builder;
builder.AddPort(server_address_.str());
builder.AddPort(server_address_.str(), grpc::InsecureServerCredentials());
builder.RegisterService(&service_);
server_ = builder.BuildAndStart();
channel_ =
CreateChannelDeprecated(server_address_.str(), ChannelArguments());
channel_ = CreateChannel(server_address_.str(), grpc::InsecureCredentials(), ChannelArguments());
publisher_.reset(new grpc::examples::pubsub::Publisher(channel_));
}

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_
#define __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_
#ifndef GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H
#define GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H
#include <grpc++/channel_interface.h>
#include <grpc++/status.h>
@ -65,4 +65,4 @@ class Subscriber {
} // namespace examples
} // namespace grpc
#endif // __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_
#endif // GRPC_EXAMPLES_PUBSUB_SUBSCRIBER_H

@ -40,6 +40,7 @@
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
#include <grpc++/status.h>
#include <gtest/gtest.h>
@ -104,12 +105,11 @@ class SubscriberTest : public ::testing::Test {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
ServerBuilder builder;
builder.AddPort(server_address_.str());
builder.AddPort(server_address_.str(), grpc::InsecureServerCredentials());
builder.RegisterService(&service_);
server_ = builder.BuildAndStart();
channel_ =
CreateChannelDeprecated(server_address_.str(), ChannelArguments());
channel_ = CreateChannel(server_address_.str(), grpc::InsecureCredentials(), ChannelArguments());
subscriber_.reset(new grpc::examples::pubsub::Subscriber(channel_));
}

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_ASYNC_UNARY_CALL_H__
#define __GRPCPP_ASYNC_UNARY_CALL_H__
#ifndef GRPCXX_ASYNC_UNARY_CALL_H
#define GRPCXX_ASYNC_UNARY_CALL_H
#include <grpc++/channel_interface.h>
#include <grpc++/client_context.h>
@ -49,7 +49,7 @@ class ClientAsyncResponseReader GRPC_FINAL {
public:
ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
const google::protobuf::Message& request, void* tag)
const grpc::protobuf::Message& request, void* tag)
: context_(context),
call_(channel->CreateCall(method, context, cq)) {
init_buf_.Reset(tag);
@ -77,7 +77,6 @@ class ClientAsyncResponseReader GRPC_FINAL {
call_.PerformOps(&finish_buf_);
}
private:
ClientContext* context_;
Call call_;
@ -93,7 +92,7 @@ class ServerAsyncResponseWriter GRPC_FINAL
explicit ServerAsyncResponseWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) {
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.Reset(tag);
@ -138,4 +137,4 @@ class ServerAsyncResponseWriter GRPC_FINAL
} // namespace grpc
#endif // __GRPCPP_ASYNC_UNARY_CALL_H__
#endif // GRPCXX_ASYNC_UNARY_CALL_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_CHANNEL_ARGUMENTS_H_
#define __GRPCPP_CHANNEL_ARGUMENTS_H_
#ifndef GRPCXX_CHANNEL_ARGUMENTS_H
#define GRPCXX_CHANNEL_ARGUMENTS_H
#include <vector>
#include <list>
@ -62,8 +62,11 @@ class ChannelArguments {
void SetInt(const grpc::string& key, int value);
void SetString(const grpc::string& key, const grpc::string& value);
// Populates given channel_args with args_, does not take ownership.
void SetChannelArgs(grpc_channel_args* channel_args) const;
private:
friend class Channel;
friend class SecureCredentials;
friend class testing::ChannelArgumentsTest;
// TODO(yangg) implement copy and assign
@ -73,13 +76,10 @@ class ChannelArguments {
// Returns empty string when it is not set.
grpc::string GetSslTargetNameOverride() const;
// Populates given channel_args with args_, does not take ownership.
void SetChannelArgs(grpc_channel_args* channel_args) const;
std::vector<grpc_arg> args_;
std::list<grpc::string> strings_;
};
} // namespace grpc
#endif // __GRPCPP_CHANNEL_ARGUMENTS_H_
#endif // GRPCXX_CHANNEL_ARGUMENTS_H

@ -31,18 +31,12 @@
*
*/
#ifndef __GRPCPP_CHANNEL_INTERFACE_H__
#define __GRPCPP_CHANNEL_INTERFACE_H__
#ifndef GRPCXX_CHANNEL_INTERFACE_H
#define GRPCXX_CHANNEL_INTERFACE_H
#include <grpc++/status.h>
#include <grpc++/impl/call.h>
namespace google {
namespace protobuf {
class Message;
} // namespace protobuf
} // namespace google
struct grpc_call;
namespace grpc {
@ -63,4 +57,4 @@ class ChannelInterface : public CallHook {
} // namespace grpc
#endif // __GRPCPP_CHANNEL_INTERFACE_H__
#endif // GRPCXX_CHANNEL_INTERFACE_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_CLIENT_CONTEXT_H__
#define __GRPCPP_CLIENT_CONTEXT_H__
#ifndef GRPCXX_CLIENT_CONTEXT_H
#define GRPCXX_CLIENT_CONTEXT_H
#include <chrono>
#include <map>
@ -47,12 +47,6 @@ using std::chrono::system_clock;
struct grpc_call;
struct grpc_completion_queue;
namespace google {
namespace protobuf {
class Message;
} // namespace protobuf
} // namespace google
namespace grpc {
class CallOpBuffer;
@ -151,4 +145,4 @@ class ClientContext {
} // namespace grpc
#endif // __GRPCPP_CLIENT_CONTEXT_H__
#endif // GRPCXX_CLIENT_CONTEXT_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_COMPLETION_QUEUE_H__
#define __GRPCPP_COMPLETION_QUEUE_H__
#ifndef GRPCXX_COMPLETION_QUEUE_H
#define GRPCXX_COMPLETION_QUEUE_H
#include <grpc++/impl/client_unary_call.h>
@ -106,8 +106,8 @@ class CompletionQueue {
friend Status BlockingUnaryCall(ChannelInterface *channel,
const RpcMethod &method,
ClientContext *context,
const google::protobuf::Message &request,
google::protobuf::Message *result);
const grpc::protobuf::Message &request,
grpc::protobuf::Message *result);
// Wraps grpc_completion_queue_pluck.
// Cannot be mixed with calls to Next().
@ -121,4 +121,4 @@ class CompletionQueue {
} // namespace grpc
#endif // __GRPCPP_COMPLETION_QUEUE_H__
#endif // GRPCXX_COMPLETION_QUEUE_H

@ -31,10 +31,8 @@
*
*/
#ifndef __GRPCPP_CONFIG_H__
#define __GRPCPP_CONFIG_H__
#include <string>
#ifndef GRPCXX_CONFIG_H
#define GRPCXX_CONFIG_H
#ifdef GRPC_OLD_CXX
#define GRPC_FINAL
@ -44,10 +42,24 @@
#define GRPC_OVERRIDE override
#endif
#ifndef GRPC_CUSTOM_STRING
#include <string>
#define GRPC_CUSTOM_STRING std::string
#endif
#ifndef GRPC_CUSTOM_MESSAGE
#include <google/protobuf/message.h>
#define GRPC_CUSTOM_MESSAGE ::google::protobuf::Message
#endif
namespace grpc {
typedef std::string string;
typedef GRPC_CUSTOM_STRING string;
namespace protobuf {
typedef GRPC_CUSTOM_MESSAGE Message;
} // namespace protobuf
} // namespace grpc
#endif // __GRPCPP_CONFIG_H__
#endif // GRPCXX_CONFIG_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_CREATE_CHANNEL_H__
#define __GRPCPP_CREATE_CHANNEL_H__
#ifndef GRPCXX_CREATE_CHANNEL_H
#define GRPCXX_CREATE_CHANNEL_H
#include <memory>
@ -43,11 +43,6 @@ namespace grpc {
class ChannelArguments;
class ChannelInterface;
// Deprecation warning: This function will soon be deleted
// (See pull request #711)
std::shared_ptr<ChannelInterface> CreateChannelDeprecated(
const grpc::string& target, const ChannelArguments& args);
// If creds does not hold an object or is invalid, a lame channel is returned.
std::shared_ptr<ChannelInterface> CreateChannel(
const grpc::string& target, const std::unique_ptr<Credentials>& creds,
@ -55,4 +50,4 @@ std::shared_ptr<ChannelInterface> CreateChannel(
} // namespace grpc
#endif // __GRPCPP_CREATE_CHANNEL_H__
#endif // GRPCXX_CREATE_CHANNEL_H

@ -31,37 +31,37 @@
*
*/
#ifndef __GRPCPP_CREDENTIALS_H_
#define __GRPCPP_CREDENTIALS_H_
#ifndef GRPCXX_CREDENTIALS_H
#define GRPCXX_CREDENTIALS_H
#include <chrono>
#include <memory>
#include <grpc++/config.h>
struct grpc_credentials;
namespace grpc {
class ChannelArguments;
class ChannelInterface;
class SecureCredentials;
// grpc_credentials wrapper class. Typical use in C++ applications is limited
// to creating an instance using CredentialsFactory, and passing it down
// during channel construction.
class Credentials GRPC_FINAL {
class Credentials {
public:
~Credentials();
virtual ~Credentials();
// TODO(abhikumar): Specify a plugin API here to be implemented by
// credentials that do not have a corresponding implementation in C.
protected:
friend std::unique_ptr<Credentials> CompositeCredentials(
const std::unique_ptr<Credentials>& creds1,
const std::unique_ptr<Credentials>& creds2);
private:
explicit Credentials(grpc_credentials*);
grpc_credentials* GetRawCreds();
virtual SecureCredentials* AsSecureCredentials() = 0;
friend class Channel;
friend class CredentialsFactory;
private:
friend std::shared_ptr<ChannelInterface> CreateChannel(
const grpc::string& target, const std::unique_ptr<Credentials>& creds,
const ChannelArguments& args);
grpc_credentials* creds_;
virtual std::shared_ptr<ChannelInterface> CreateChannel(
const grpc::string& target, const ChannelArguments& args) = 0;
};
// Options used to build SslCredentials
@ -79,58 +79,45 @@ struct SslCredentialsOptions {
grpc::string pem_cert_chain;
};
// Factory for building different types of Credentials
// The methods may return empty unique_ptr when credentials cannot be created.
// Factories for building different types of Credentials
// The functions may return empty unique_ptr when credentials cannot be created.
// If a Credentials pointer is returned, it can still be invalid when used to
// create a channel. A lame channel will be created then and all rpcs will
// fail on it.
class CredentialsFactory {
public:
// Builds google credentials with reasonable defaults.
// WARNING: Do NOT use this credentials to connect to a non-google service as
// this could result in an oauth2 token leak.
static std::unique_ptr<Credentials> GoogleDefaultCredentials();
// Builds SSL Credentials given SSL specific options
static std::unique_ptr<Credentials> SslCredentials(
const SslCredentialsOptions& options);
// Builds credentials for use when running in GCE
// WARNING: Do NOT use this credentials to connect to a non-google service as
// this could result in an oauth2 token leak.
static std::unique_ptr<Credentials> ComputeEngineCredentials();
// Builds service account credentials.
// WARNING: Do NOT use this credentials to connect to a non-google service as
// this could result in an oauth2 token leak.
// json_key is the JSON key string containing the client's private key.
// scope is a space-delimited list of the requested permissions.
// token_lifetime is the lifetime of each token acquired through this service
// account credentials. It should be positive and should not exceed
// grpc_max_auth_token_lifetime or will be cropped to this value.
static std::unique_ptr<Credentials> ServiceAccountCredentials(
const grpc::string& json_key, const grpc::string& scope,
std::chrono::seconds token_lifetime);
// Builds JWT credentials.
// json_key is the JSON key string containing the client's private key.
// token_lifetime is the lifetime of each Json Web Token (JWT) created with
// this credentials. It should not exceed grpc_max_auth_token_lifetime or
// will be cropped to this value.
static std::unique_ptr<Credentials> JWTCredentials(
const grpc::string& json_key, std::chrono::seconds token_lifetime);
// Builds IAM credentials.
static std::unique_ptr<Credentials> IAMCredentials(
const grpc::string& authorization_token,
const grpc::string& authority_selector);
// Combines two credentials objects into a composite credentials
static std::unique_ptr<Credentials> CompositeCredentials(
const std::unique_ptr<Credentials>& creds1,
const std::unique_ptr<Credentials>& creds2);
};
// Builds credentials with reasonable defaults.
std::unique_ptr<Credentials> GoogleDefaultCredentials();
// Builds SSL Credentials given SSL specific options
std::unique_ptr<Credentials> SslCredentials(
const SslCredentialsOptions& options);
// Builds credentials for use when running in GCE
std::unique_ptr<Credentials> ComputeEngineCredentials();
// Builds service account credentials.
// json_key is the JSON key string containing the client's private key.
// scope is a space-delimited list of the requested permissions.
// token_lifetime is the lifetime of each token acquired through this service
// account credentials. It should be positive and should not exceed
// grpc_max_auth_token_lifetime or will be cropped to this value.
std::unique_ptr<Credentials> ServiceAccountCredentials(
const grpc::string& json_key, const grpc::string& scope,
std::chrono::seconds token_lifetime);
// Builds IAM credentials.
std::unique_ptr<Credentials> IAMCredentials(
const grpc::string& authorization_token,
const grpc::string& authority_selector);
// Combines two credentials objects into a composite credentials
std::unique_ptr<Credentials> CompositeCredentials(
const std::unique_ptr<Credentials>& creds1,
const std::unique_ptr<Credentials>& creds2);
// Credentials for an unencrypted, unauthenticated channel
std::unique_ptr<Credentials> InsecureCredentials();
} // namespace grpc
#endif // __GRPCPP_CREDENTIALS_H_
#endif // GRPCXX_CREDENTIALS_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_CALL_H__
#define __GRPCPP_CALL_H__
#ifndef GRPCXX_IMPL_CALL_H
#define GRPCXX_IMPL_CALL_H
#include <grpc/grpc.h>
#include <grpc++/config.h>
@ -42,12 +42,6 @@
#include <memory>
#include <map>
namespace google {
namespace protobuf {
class Message;
} // namespace protobuf
} // namespace google
struct grpc_call;
struct grpc_op;
@ -67,8 +61,8 @@ class CallOpBuffer : public CompletionQueueTag {
std::multimap<grpc::string, grpc::string> *metadata);
void AddSendInitialMetadata(ClientContext *ctx);
void AddRecvInitialMetadata(ClientContext *ctx);
void AddSendMessage(const google::protobuf::Message &message);
void AddRecvMessage(google::protobuf::Message *message);
void AddSendMessage(const grpc::protobuf::Message &message);
void AddRecvMessage(grpc::protobuf::Message *message);
void AddClientSendClose();
void AddClientRecvStatus(ClientContext *ctx, Status *status);
void AddServerSendStatus(std::multimap<grpc::string, grpc::string> *metadata,
@ -95,10 +89,10 @@ class CallOpBuffer : public CompletionQueueTag {
std::multimap<grpc::string, grpc::string> *recv_initial_metadata_;
grpc_metadata_array recv_initial_metadata_arr_;
// Send message
const google::protobuf::Message *send_message_;
const grpc::protobuf::Message *send_message_;
grpc_byte_buffer *send_message_buf_;
// Recv message
google::protobuf::Message *recv_message_;
grpc::protobuf::Message *recv_message_;
grpc_byte_buffer *recv_message_buf_;
// Client send close
bool client_send_close_;
@ -143,4 +137,4 @@ class Call GRPC_FINAL {
} // namespace grpc
#endif // __GRPCPP_CALL_INTERFACE_H__
#endif // GRPCXX_IMPL_CALL_H

@ -31,14 +31,10 @@
*
*/
#ifndef __GRPCPP_CLIENT_UNARY_CALL_H__
#define __GRPCPP_CLIENT_UNARY_CALL_H__
#ifndef GRPCXX_IMPL_CLIENT_UNARY_CALL_H
#define GRPCXX_IMPL_CLIENT_UNARY_CALL_H
namespace google {
namespace protobuf {
class Message;
} // namespace protobuf
} // namespace google
#include <grpc++/config.h>
namespace grpc {
@ -51,9 +47,9 @@ class Status;
// Wrapper that performs a blocking unary call
Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method,
ClientContext *context,
const google::protobuf::Message &request,
google::protobuf::Message *result);
const grpc::protobuf::Message &request,
grpc::protobuf::Message *result);
} // namespace grpc
#endif
#endif // GRPCXX_IMPL_CLIENT_UNARY_CALL_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_IMPL_INTERNAL_STUB_H__
#define __GRPCPP_IMPL_INTERNAL_STUB_H__
#ifndef GRPCXX_IMPL_INTERNAL_STUB_H
#define GRPCXX_IMPL_INTERNAL_STUB_H
#include <memory>
@ -57,4 +57,4 @@ class InternalStub {
} // namespace grpc
#endif // __GRPCPP_IMPL_INTERNAL_STUB_H__
#endif // GRPCXX_IMPL_INTERNAL_STUB_H

@ -31,14 +31,8 @@
*
*/
#ifndef __GRPCPP_IMPL_RPC_METHOD_H__
#define __GRPCPP_IMPL_RPC_METHOD_H__
namespace google {
namespace protobuf {
class Message;
} // namespace protobuf
} // namespace google
#ifndef GRPCXX_IMPL_RPC_METHOD_H
#define GRPCXX_IMPL_RPC_METHOD_H
namespace grpc {
@ -66,4 +60,4 @@ class RpcMethod {
} // namespace grpc
#endif // __GRPCPP_IMPL_RPC_METHOD_H__
#endif // GRPCXX_IMPL_RPC_METHOD_H

@ -31,18 +31,18 @@
*
*/
#ifndef __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__
#define __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__
#ifndef GRPCXX_IMPL_RPC_SERVICE_METHOD_H
#define GRPCXX_IMPL_RPC_SERVICE_METHOD_H
#include <functional>
#include <map>
#include <memory>
#include <vector>
#include <grpc++/config.h>
#include <grpc++/impl/rpc_method.h>
#include <grpc++/status.h>
#include <grpc++/stream.h>
#include <google/protobuf/message.h>
namespace grpc {
class ServerContext;
@ -56,13 +56,13 @@ class MethodHandler {
virtual ~MethodHandler() {}
struct HandlerParameter {
HandlerParameter(Call* c, ServerContext* context,
const google::protobuf::Message* req,
google::protobuf::Message* resp)
const grpc::protobuf::Message* req,
grpc::protobuf::Message* resp)
: call(c), server_context(context), request(req), response(resp) {}
Call* call;
ServerContext* server_context;
const google::protobuf::Message* request;
google::protobuf::Message* response;
const grpc::protobuf::Message* request;
grpc::protobuf::Message* response;
};
virtual Status RunHandler(const HandlerParameter& param) = 0;
};
@ -165,8 +165,8 @@ class RpcServiceMethod : public RpcMethod {
// Takes ownership of the handler and two prototype objects.
RpcServiceMethod(const char* name, RpcMethod::RpcType type,
MethodHandler* handler,
google::protobuf::Message* request_prototype,
google::protobuf::Message* response_prototype)
grpc::protobuf::Message* request_prototype,
grpc::protobuf::Message* response_prototype)
: RpcMethod(name, type),
handler_(handler),
request_prototype_(request_prototype),
@ -174,17 +174,17 @@ class RpcServiceMethod : public RpcMethod {
MethodHandler* handler() { return handler_.get(); }
google::protobuf::Message* AllocateRequestProto() {
grpc::protobuf::Message* AllocateRequestProto() {
return request_prototype_->New();
}
google::protobuf::Message* AllocateResponseProto() {
grpc::protobuf::Message* AllocateResponseProto() {
return response_prototype_->New();
}
private:
std::unique_ptr<MethodHandler> handler_;
std::unique_ptr<google::protobuf::Message> request_prototype_;
std::unique_ptr<google::protobuf::Message> response_prototype_;
std::unique_ptr<grpc::protobuf::Message> request_prototype_;
std::unique_ptr<grpc::protobuf::Message> response_prototype_;
};
// This class contains all the method information for an rpc service. It is
@ -203,4 +203,4 @@ class RpcService {
} // namespace grpc
#endif // __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__
#endif // GRPCXX_IMPL_RPC_SERVICE_METHOD_H

@ -31,14 +31,10 @@
*
*/
#ifndef __GRPCPP_IMPL_SERVICE_TYPE_H__
#define __GRPCPP_IMPL_SERVICE_TYPE_H__
#ifndef GRPCXX_IMPL_SERVICE_TYPE_H
#define GRPCXX_IMPL_SERVICE_TYPE_H
namespace google {
namespace protobuf {
class Message;
} // namespace protobuf
} // namespace google
#include <grpc++/config.h>
namespace grpc {
@ -72,7 +68,7 @@ class AsynchronousService {
public:
virtual void RequestAsyncCall(void* registered_method,
ServerContext* context,
::google::protobuf::Message* request,
::grpc::protobuf::Message* request,
ServerAsyncStreamingInterface* stream,
CompletionQueue* cq, void* tag) = 0;
};
@ -91,7 +87,7 @@ class AsynchronousService {
protected:
void RequestAsyncUnary(int index, ServerContext* context,
::google::protobuf::Message* request,
grpc::protobuf::Message* request,
ServerAsyncStreamingInterface* stream,
CompletionQueue* cq, void* tag) {
dispatch_impl_->RequestAsyncCall(request_args_[index], context, request,
@ -104,7 +100,7 @@ class AsynchronousService {
stream, cq, tag);
}
void RequestServerStreaming(int index, ServerContext* context,
::google::protobuf::Message* request,
grpc::protobuf::Message* request,
ServerAsyncStreamingInterface* stream,
CompletionQueue* cq, void* tag) {
dispatch_impl_->RequestAsyncCall(request_args_[index], context, request,
@ -128,4 +124,4 @@ class AsynchronousService {
} // namespace grpc
#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__
#endif // GRPCXX_IMPL_SERVICE_TYPE_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_SERVER_H__
#define __GRPCPP_SERVER_H__
#ifndef GRPCXX_SERVER_H
#define GRPCXX_SERVER_H
#include <condition_variable>
#include <list>
@ -47,12 +47,6 @@
struct grpc_server;
namespace google {
namespace protobuf {
class Message;
} // namespace protobuf
} // namespace google
namespace grpc {
class AsynchronousService;
class RpcService;
@ -81,15 +75,14 @@ class Server GRPC_FINAL : private CallHook,
class AsyncRequest;
// ServerBuilder use only
Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned,
ServerCredentials* creds);
Server();
Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned);
Server() = delete;
// Register a service. This call does not take ownership of the service.
// The service must exist for the lifetime of the Server instance.
bool RegisterService(RpcService* service);
bool RegisterAsyncService(AsynchronousService* service);
// Add a listening port. Can be called multiple times.
int AddPort(const grpc::string& addr);
int AddPort(const grpc::string& addr, ServerCredentials* creds);
// Start the server.
bool Start();
@ -101,9 +94,9 @@ class Server GRPC_FINAL : private CallHook,
// DispatchImpl
void RequestAsyncCall(void* registered_method, ServerContext* context,
::google::protobuf::Message* request,
grpc::protobuf::Message* request,
ServerAsyncStreamingInterface* stream,
CompletionQueue* cq, void* tag);
CompletionQueue* cq, void* tag) GRPC_OVERRIDE;
// Completion queue.
CompletionQueue cq_;
@ -119,15 +112,13 @@ class Server GRPC_FINAL : private CallHook,
std::list<SyncRequest> sync_methods_;
// Pointer to the c grpc server.
grpc_server* server_;
grpc_server* const server_;
ThreadPoolInterface* thread_pool_;
// Whether the thread pool is created and owned by the server.
bool thread_pool_owned_;
// Whether the server is created with credentials.
bool secure_;
};
} // namespace grpc
#endif // __GRPCPP_SERVER_H__
#endif // GRPCXX_SERVER_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_SERVER_BUILDER_H__
#define __GRPCPP_SERVER_BUILDER_H__
#ifndef GRPCXX_SERVER_BUILDER_H
#define GRPCXX_SERVER_BUILDER_H
#include <memory>
#include <vector>
@ -65,11 +65,9 @@ class ServerBuilder {
void RegisterAsyncService(AsynchronousService* service);
// Add a listening port. Can be called multiple times.
void AddPort(const grpc::string& addr);
// Set a ServerCredentials. Can only be called once.
// TODO(yangg) move this to be part of AddPort
void SetCredentials(const std::shared_ptr<ServerCredentials>& creds);
void AddPort(const grpc::string& addr,
std::shared_ptr<ServerCredentials> creds,
int* selected_port = nullptr);
// Set the thread pool used for running appliation rpc handlers.
// Does not take ownership.
@ -79,13 +77,19 @@ class ServerBuilder {
std::unique_ptr<Server> BuildAndStart();
private:
struct Port {
grpc::string addr;
std::shared_ptr<ServerCredentials> creds;
int* selected_port;
};
std::vector<RpcService*> services_;
std::vector<AsynchronousService*> async_services_;
std::vector<grpc::string> ports_;
std::vector<Port> ports_;
std::shared_ptr<ServerCredentials> creds_;
ThreadPoolInterface* thread_pool_;
};
} // namespace grpc
#endif // __GRPCPP_SERVER_BUILDER_H__
#endif // GRPCXX_SERVER_BUILDER_H

@ -31,13 +31,13 @@
*
*/
#ifndef __GRPCPP_SERVER_CONTEXT_H_
#define __GRPCPP_SERVER_CONTEXT_H_
#ifndef GRPCXX_SERVER_CONTEXT_H
#define GRPCXX_SERVER_CONTEXT_H
#include <chrono>
#include <map>
#include "config.h"
#include <grpc++/config.h>
struct gpr_timespec;
struct grpc_metadata;
@ -121,4 +121,4 @@ class ServerContext GRPC_FINAL {
} // namespace grpc
#endif // __GRPCPP_SERVER_CONTEXT_H_
#endif // GRPCXX_SERVER_CONTEXT_H

@ -31,32 +31,29 @@
*
*/
#ifndef __GRPCPP_SERVER_CREDENTIALS_H_
#define __GRPCPP_SERVER_CREDENTIALS_H_
#ifndef GRPCXX_SERVER_CREDENTIALS_H
#define GRPCXX_SERVER_CREDENTIALS_H
#include <memory>
#include <vector>
#include <grpc++/config.h>
struct grpc_server_credentials;
struct grpc_server;
namespace grpc {
class Server;
// grpc_server_credentials wrapper class.
class ServerCredentials GRPC_FINAL {
class ServerCredentials {
public:
~ServerCredentials();
virtual ~ServerCredentials();
private:
explicit ServerCredentials(grpc_server_credentials* c_creds);
friend class ::grpc::Server;
grpc_server_credentials* GetRawCreds();
friend class ServerCredentialsFactory;
friend class Server;
grpc_server_credentials* creds_;
virtual int AddPortToServer(const grpc::string& addr,
grpc_server* server) = 0;
};
// Options to create ServerCredentials with SSL
@ -69,14 +66,12 @@ struct SslServerCredentialsOptions {
std::vector<PemKeyCertPair> pem_key_cert_pairs;
};
// Factory for building different types of ServerCredentials
class ServerCredentialsFactory {
public:
// Builds SSL ServerCredentials given SSL specific options
static std::shared_ptr<ServerCredentials> SslCredentials(
const SslServerCredentialsOptions& options);
};
// Builds SSL ServerCredentials given SSL specific options
std::shared_ptr<ServerCredentials> SslServerCredentials(
const SslServerCredentialsOptions& options);
std::shared_ptr<ServerCredentials> InsecureServerCredentials();
} // namespace grpc
#endif // __GRPCPP_SERVER_CREDENTIALS_H_
#endif // GRPCXX_SERVER_CREDENTIALS_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_STATUS_H__
#define __GRPCPP_STATUS_H__
#ifndef GRPCXX_STATUS_H
#define GRPCXX_STATUS_H
#include <grpc++/status_code_enum.h>
#include <grpc++/config.h>
@ -62,4 +62,4 @@ class Status {
} // namespace grpc
#endif // __GRPCPP_STATUS_H__
#endif // GRPCXX_STATUS_H

@ -31,57 +31,43 @@
*
*/
#ifndef __GRPCPP_STATUS_CODE_ENUM_H__
#define __GRPCPP_STATUS_CODE_ENUM_H__
#ifndef GRPCXX_STATUS_CODE_ENUM_H
#define GRPCXX_STATUS_CODE_ENUM_H
namespace grpc {
enum StatusCode {
/* Not an error; returned on success
HTTP Mapping: 200 OK */
/* Not an error; returned on success */
OK = 0,
/* The operation was cancelled (typically by the caller).
HTTP Mapping: 499 Client Closed Request */
/* The operation was cancelled (typically by the caller). */
CANCELLED = 1,
/* Unknown error. An example of where this error may be returned is
if a Status value received from another address space belongs to
an error-space that is not known in this address space. Also
errors raised by APIs that do not return enough error information
may be converted to this error.
HTTP Mapping: 500 Internal Server Error */
may be converted to this error. */
UNKNOWN = 2,
/* Client specified an invalid argument. Note that this differs
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
that are problematic regardless of the state of the system
(e.g., a malformed file name).
HTTP Mapping: 400 Bad Request */
(e.g., a malformed file name). */
INVALID_ARGUMENT = 3,
/* Deadline expired before operation could complete. For operations
that change the state of the system, this error may be returned
even if the operation has completed successfully. For example, a
successful response from a server could have been delayed long
enough for the deadline to expire.
HTTP Mapping: 504 Gateway Timeout */
enough for the deadline to expire. */
DEADLINE_EXCEEDED = 4,
/* Some requested entity (e.g., file or directory) was not found.
HTTP Mapping: 404 Not Found */
/* Some requested entity (e.g., file or directory) was not found. */
NOT_FOUND = 5,
/* Some entity that we attempted to create (e.g., file or directory)
already exists.
HTTP Mapping: 409 Conflict */
already exists. */
ALREADY_EXISTS = 6,
/* The caller does not have permission to execute the specified
@ -89,21 +75,15 @@ enum StatusCode {
caused by exhausting some resource (use RESOURCE_EXHAUSTED
instead for those errors). PERMISSION_DENIED must not be
used if the caller can not be identified (use UNAUTHENTICATED
instead for those errors).
HTTP Mapping: 403 Forbidden */
instead for those errors). */
PERMISSION_DENIED = 7,
/* The request does not have valid authentication credentials for the
operation.
HTTP Mapping: 401 Unauthorized */
operation. */
UNAUTHENTICATED = 16,
/* Some resource has been exhausted, perhaps a per-user quota, or
perhaps the entire file system is out of space.
HTTP Mapping: 429 Too Many Requests */
perhaps the entire file system is out of space. */
RESOURCE_EXHAUSTED = 8,
/* Operation was rejected because the system is not in a state
@ -124,23 +104,14 @@ enum StatusCode {
(d) Use FAILED_PRECONDITION if the client performs conditional
REST Get/Update/Delete on a resource and the resource on the
server does not match the condition. E.g., conflicting
read-modify-write on the same resource.
HTTP Mapping: 400 Bad Request
NOTE: HTTP spec says 412 Precondition Failed should only be used if
the request contains Etag related headers. So if the server does see
Etag related headers in the request, it may choose to return 412
instead of 400 for this error code. */
read-modify-write on the same resource. */
FAILED_PRECONDITION = 9,
/* The operation was aborted, typically due to a concurrency issue
like sequencer check failures, transaction aborts, etc.
See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE.
HTTP Mapping: 409 Conflict */
ABORTED, and UNAVAILABLE. */
ABORTED = 10,
/* Operation was attempted past the valid range. E.g., seeking or
@ -157,21 +128,15 @@ enum StatusCode {
OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
error) when it applies so that callers who are iterating through
a space can easily look for an OUT_OF_RANGE error to detect when
they are done.
HTTP Mapping: 400 Bad Request */
they are done. */
OUT_OF_RANGE = 11,
/* Operation is not implemented or not supported/enabled in this service.
HTTP Mapping: 501 Not Implemented */
/* Operation is not implemented or not supported/enabled in this service. */
UNIMPLEMENTED = 12,
/* Internal errors. Means some invariants expected by underlying
system has been broken. If you see one of these errors,
something is very broken.
HTTP Mapping: 500 Internal Server Error */
something is very broken. */
INTERNAL = 13,
/* The service is currently unavailable. This is a most likely a
@ -179,14 +144,10 @@ enum StatusCode {
a backoff.
See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE.
HTTP Mapping: 503 Service Unavailable */
ABORTED, and UNAVAILABLE. */
UNAVAILABLE = 14,
/* Unrecoverable data loss or corruption.
HTTP Mapping: 500 Internal Server Error */
/* Unrecoverable data loss or corruption. */
DATA_LOSS = 15,
/* Force users to include a default branch: */
@ -195,4 +156,4 @@ enum StatusCode {
} // namespace grpc
#endif // __GRPCPP_STATUS_CODE_ENUM_H_
#endif // GRPCXX_STATUS_CODE_ENUM_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_STREAM_H__
#define __GRPCPP_STREAM_H__
#ifndef GRPCXX_STREAM_H
#define GRPCXX_STREAM_H
#include <grpc++/channel_interface.h>
#include <grpc++/client_context.h>
@ -88,7 +88,7 @@ class ClientReader GRPC_FINAL : public ClientStreamingInterface,
public:
// Blocking create a stream and write the first request out.
ClientReader(ChannelInterface* channel, const RpcMethod& method,
ClientContext* context, const google::protobuf::Message& request)
ClientContext* context, const grpc::protobuf::Message& request)
: context_(context), call_(channel->CreateCall(method, context, &cq_)) {
CallOpBuffer buf;
buf.AddSendInitialMetadata(&context->send_initial_metadata_);
@ -142,7 +142,7 @@ class ClientWriter GRPC_FINAL : public ClientStreamingInterface,
public:
// Blocking create a stream.
ClientWriter(ChannelInterface* channel, const RpcMethod& method,
ClientContext* context, google::protobuf::Message* response)
ClientContext* context, grpc::protobuf::Message* response)
: context_(context),
response_(response),
call_(channel->CreateCall(method, context, &cq_)) {
@ -179,7 +179,7 @@ class ClientWriter GRPC_FINAL : public ClientStreamingInterface,
private:
ClientContext* context_;
google::protobuf::Message* const response_;
grpc::protobuf::Message* const response_;
CompletionQueue cq_;
Call call_;
};
@ -386,7 +386,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncStreamingInterface,
// Create a stream and write the first request out.
ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
const google::protobuf::Message& request, void* tag)
const grpc::protobuf::Message& request, void* tag)
: context_(context), call_(channel->CreateCall(method, context, cq)) {
init_buf_.Reset(tag);
init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_);
@ -436,7 +436,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface,
public:
ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
google::protobuf::Message* response, void* tag)
grpc::protobuf::Message* response, void* tag)
: context_(context),
response_(response),
call_(channel->CreateCall(method, context, cq)) {
@ -477,7 +477,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface,
private:
ClientContext* context_;
google::protobuf::Message* const response_;
grpc::protobuf::Message* const response_;
Call call_;
CallOpBuffer init_buf_;
CallOpBuffer meta_buf_;
@ -710,4 +710,4 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
} // namespace grpc
#endif // __GRPCPP_STREAM_H__
#endif // GRPCXX_STREAM_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_THREAD_POOL_INTERFACE_H__
#define __GRPCPP_THREAD_POOL_INTERFACE_H__
#ifndef GRPCXX_THREAD_POOL_INTERFACE_H
#define GRPCXX_THREAD_POOL_INTERFACE_H
#include <functional>
@ -49,4 +49,4 @@ class ThreadPoolInterface {
} // namespace grpc
#endif // __GRPCPP_THREAD_POOL_INTERFACE_H__
#endif // GRPCXX_THREAD_POOL_INTERFACE_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_BYTE_BUFFER_H__
#define __GRPC_BYTE_BUFFER_H__
#ifndef GRPC_BYTE_BUFFER_H
#define GRPC_BYTE_BUFFER_H
#include <grpc/grpc.h>
#include <grpc/support/slice_buffer.h>
@ -47,4 +47,4 @@ struct grpc_byte_buffer {
} data;
};
#endif /* __GRPC_BYTE_BUFFER_H__ */
#endif /* GRPC_BYTE_BUFFER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_BYTE_BUFFER_READER_H__
#define __GRPC_BYTE_BUFFER_READER_H__
#ifndef GRPC_BYTE_BUFFER_READER_H
#define GRPC_BYTE_BUFFER_READER_H
#include <grpc/grpc.h>
#include <grpc/byte_buffer.h>
@ -46,4 +46,4 @@ struct grpc_byte_buffer_reader {
} current;
};
#endif /* __GRPC_BYTE_BUFFER_READER_H__ */
#endif /* GRPC_BYTE_BUFFER_READER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_GRPC_H__
#define __GRPC_GRPC_H__
#ifndef GRPC_GRPC_H
#define GRPC_GRPC_H
#include <grpc/status.h>
@ -436,6 +436,9 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
grpc_channel *grpc_channel_create(const char *target,
const grpc_channel_args *args);
/* Create a lame client: this client fails every operation attempted on it. */
grpc_channel *grpc_lame_client_channel_create(void);
/* Close and destroy a grpc channel */
void grpc_channel_destroy(grpc_channel *channel);
@ -632,4 +635,4 @@ void grpc_server_destroy(grpc_server *server);
}
#endif
#endif /* __GRPC_GRPC_H__ */
#endif /* GRPC_GRPC_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_GRPC_HTTP_H__
#define __GRPC_GRPC_HTTP_H__
#ifndef GRPC_GRPC_HTTP_H
#define GRPC_GRPC_HTTP_H
#ifdef __cplusplus
extern "C" {
@ -64,4 +64,4 @@ typedef struct {
}
#endif
#endif /* __GRPC_GRPC_HTTP_H__ */
#endif /* GRPC_GRPC_HTTP_H */

@ -31,8 +31,8 @@
*
*/
#ifndef GRPC_SECURITY_H_
#define GRPC_SECURITY_H_
#ifndef GRPC_GRPC_SECURITY_H
#define GRPC_GRPC_SECURITY_H
#include "grpc.h"
#include "status.h"
@ -167,22 +167,16 @@ grpc_server_credentials *grpc_ssl_server_credentials_create(
grpc_server_credentials *grpc_fake_transport_security_server_credentials_create(
void);
/* --- Secure server creation. --- */
/* Creates a secure server using the passed-in server credentials. */
grpc_server *grpc_secure_server_create(grpc_server_credentials *creds,
grpc_completion_queue *cq,
const grpc_channel_args *args);
/* --- Server-side secure ports. --- */
/* Add a HTTP2 over an encrypted link over tcp listener.
Server must have been created with grpc_secure_server_create.
Returns bound port number on success, 0 on failure.
REQUIRES: server not started */
int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr);
int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
grpc_server_credentials *creds);
#ifdef __cplusplus
}
#endif
#endif /* GRPC_SECURITY_H_ */
#endif /* GRPC_GRPC_SECURITY_H */

@ -31,59 +31,45 @@
*
*/
#ifndef __GRPC_STATUS_H__
#define __GRPC_STATUS_H__
#ifndef GRPC_STATUS_H
#define GRPC_STATUS_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
/* Not an error; returned on success
HTTP Mapping: 200 OK */
/* Not an error; returned on success */
GRPC_STATUS_OK = 0,
/* The operation was cancelled (typically by the caller).
HTTP Mapping: 499 Client Closed Request */
/* The operation was cancelled (typically by the caller). */
GRPC_STATUS_CANCELLED = 1,
/* Unknown error. An example of where this error may be returned is
if a Status value received from another address space belongs to
an error-space that is not known in this address space. Also
errors raised by APIs that do not return enough error information
may be converted to this error.
HTTP Mapping: 500 Internal Server Error */
may be converted to this error. */
GRPC_STATUS_UNKNOWN = 2,
/* Client specified an invalid argument. Note that this differs
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
that are problematic regardless of the state of the system
(e.g., a malformed file name).
HTTP Mapping: 400 Bad Request */
(e.g., a malformed file name). */
GRPC_STATUS_INVALID_ARGUMENT = 3,
/* Deadline expired before operation could complete. For operations
that change the state of the system, this error may be returned
even if the operation has completed successfully. For example, a
successful response from a server could have been delayed long
enough for the deadline to expire.
HTTP Mapping: 504 Gateway Timeout */
enough for the deadline to expire. */
GRPC_STATUS_DEADLINE_EXCEEDED = 4,
/* Some requested entity (e.g., file or directory) was not found.
HTTP Mapping: 404 Not Found */
/* Some requested entity (e.g., file or directory) was not found. */
GRPC_STATUS_NOT_FOUND = 5,
/* Some entity that we attempted to create (e.g., file or directory)
already exists.
HTTP Mapping: 409 Conflict */
already exists. */
GRPC_STATUS_ALREADY_EXISTS = 6,
/* The caller does not have permission to execute the specified
@ -91,21 +77,15 @@ typedef enum {
caused by exhausting some resource (use RESOURCE_EXHAUSTED
instead for those errors). PERMISSION_DENIED must not be
used if the caller can not be identified (use UNAUTHENTICATED
instead for those errors).
HTTP Mapping: 403 Forbidden */
instead for those errors). */
GRPC_STATUS_PERMISSION_DENIED = 7,
/* The request does not have valid authentication credentials for the
operation.
HTTP Mapping: 401 Unauthorized */
operation. */
GRPC_STATUS_UNAUTHENTICATED = 16,
/* Some resource has been exhausted, perhaps a per-user quota, or
perhaps the entire file system is out of space.
HTTP Mapping: 429 Too Many Requests */
perhaps the entire file system is out of space. */
GRPC_STATUS_RESOURCE_EXHAUSTED = 8,
/* Operation was rejected because the system is not in a state
@ -126,23 +106,14 @@ typedef enum {
(d) Use FAILED_PRECONDITION if the client performs conditional
REST Get/Update/Delete on a resource and the resource on the
server does not match the condition. E.g., conflicting
read-modify-write on the same resource.
HTTP Mapping: 400 Bad Request
NOTE: HTTP spec says 412 Precondition Failed should only be used if
the request contains Etag related headers. So if the server does see
Etag related headers in the request, it may choose to return 412
instead of 400 for this error code. */
read-modify-write on the same resource. */
GRPC_STATUS_FAILED_PRECONDITION = 9,
/* The operation was aborted, typically due to a concurrency issue
like sequencer check failures, transaction aborts, etc.
See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE.
HTTP Mapping: 409 Conflict */
ABORTED, and UNAVAILABLE. */
GRPC_STATUS_ABORTED = 10,
/* Operation was attempted past the valid range. E.g., seeking or
@ -159,21 +130,15 @@ typedef enum {
OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
error) when it applies so that callers who are iterating through
a space can easily look for an OUT_OF_RANGE error to detect when
they are done.
HTTP Mapping: 400 Bad Request */
they are done. */
GRPC_STATUS_OUT_OF_RANGE = 11,
/* Operation is not implemented or not supported/enabled in this service.
HTTP Mapping: 501 Not Implemented */
/* Operation is not implemented or not supported/enabled in this service. */
GRPC_STATUS_UNIMPLEMENTED = 12,
/* Internal errors. Means some invariants expected by underlying
system has been broken. If you see one of these errors,
something is very broken.
HTTP Mapping: 500 Internal Server Error */
something is very broken. */
GRPC_STATUS_INTERNAL = 13,
/* The service is currently unavailable. This is a most likely a
@ -181,14 +146,10 @@ typedef enum {
a backoff.
See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE.
HTTP Mapping: 503 Service Unavailable */
ABORTED, and UNAVAILABLE. */
GRPC_STATUS_UNAVAILABLE = 14,
/* Unrecoverable data loss or corruption.
HTTP Mapping: 500 Internal Server Error */
/* Unrecoverable data loss or corruption. */
GRPC_STATUS_DATA_LOSS = 15,
/* Force users to include a default branch: */
@ -199,4 +160,4 @@ typedef enum {
}
#endif
#endif /* __GRPC_STATUS_H__ */
#endif /* GRPC_STATUS_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_ALLOC_H__
#define __GRPC_SUPPORT_ALLOC_H__
#ifndef GRPC_SUPPORT_ALLOC_H
#define GRPC_SUPPORT_ALLOC_H
#include <stddef.h>
@ -55,4 +55,4 @@ void gpr_free_aligned(void *ptr);
}
#endif
#endif /* __GRPC_SUPPORT_ALLOC_H__ */
#endif /* GRPC_SUPPORT_ALLOC_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_ATM_H__
#define __GRPC_SUPPORT_ATM_H__
#ifndef GRPC_SUPPORT_ATM_H
#define GRPC_SUPPORT_ATM_H
/* This interface provides atomic operations and barriers.
It is internal to gpr support code and should not be used outside it.
@ -89,4 +89,4 @@
#error could not determine platform for atm
#endif
#endif /* __GRPC_SUPPORT_ATM_H__ */
#endif /* GRPC_SUPPORT_ATM_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__
#define __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__
#ifndef GRPC_SUPPORT_ATM_GCC_ATOMIC_H
#define GRPC_SUPPORT_ATM_GCC_ATOMIC_H
/* atm_platform.h for gcc and gcc-like compilers with the
__atomic_* interface. */
@ -66,4 +66,4 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) {
__ATOMIC_RELAXED);
}
#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */
#endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_ATM_GCC_SYNC_H__
#define __GRPC_SUPPORT_ATM_GCC_SYNC_H__
#ifndef GRPC_SUPPORT_ATM_GCC_SYNC_H
#define GRPC_SUPPORT_ATM_GCC_SYNC_H
/* variant of atm_platform.h for gcc and gcc-like compiers with __sync_*
interface */
@ -70,4 +70,4 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) {
#define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n)))
#define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */
#endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */

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

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__
#define __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__
#ifndef GRPC_SUPPORT_CANCELLABLE_PLATFORM_H
#define GRPC_SUPPORT_CANCELLABLE_PLATFORM_H
#include <grpc/support/atm.h>
#include <grpc/support/sync.h>
@ -53,4 +53,4 @@ typedef struct {
struct gpr_cancellable_list_ waiters;
} gpr_cancellable;
#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */
#endif /* GRPC_SUPPORT_CANCELLABLE_PLATFORM_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_CMDLINE_H__
#define __GRPC_SUPPORT_CMDLINE_H__
#ifndef GRPC_SUPPORT_CMDLINE_H
#define GRPC_SUPPORT_CMDLINE_H
#ifdef __cplusplus
extern "C" {
@ -92,4 +92,4 @@ void gpr_cmdline_destroy(gpr_cmdline *cl);
}
#endif
#endif /* __GRPC_SUPPORT_CMDLINE_H__ */
#endif /* GRPC_SUPPORT_CMDLINE_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_SUPPORT_CPU_H__
#define __GRPC_INTERNAL_SUPPORT_CPU_H__
#ifndef GRPC_SUPPORT_CPU_H
#define GRPC_SUPPORT_CPU_H
#ifdef __cplusplus
extern "C" {
@ -54,4 +54,4 @@ unsigned gpr_cpu_current_cpu(void);
} // extern "C"
#endif
#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */
#endif /* GRPC_SUPPORT_CPU_H */

@ -31,8 +31,11 @@
*
*/
#ifndef __GRPC_SUPPORT_HISTOGRAM_H__
#define __GRPC_SUPPORT_HISTOGRAM_H__
#ifndef GRPC_SUPPORT_HISTOGRAM_H
#define GRPC_SUPPORT_HISTOGRAM_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
@ -59,8 +62,15 @@ double gpr_histogram_count(gpr_histogram *histogram);
double gpr_histogram_sum(gpr_histogram *histogram);
double gpr_histogram_sum_of_squares(gpr_histogram *histogram);
const gpr_uint32 *gpr_histogram_get_contents(gpr_histogram *histogram,
size_t *count);
void gpr_histogram_merge_contents(gpr_histogram *histogram,
const gpr_uint32 *data, size_t data_count,
double min_seen, double max_seen, double sum,
double sum_of_squares, double count);
#ifdef __cplusplus
}
#endif
#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */
#endif /* GRPC_SUPPORT_HISTOGRAM_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_HOST_PORT_H__
#define __GRPC_SUPPORT_HOST_PORT_H__
#ifndef GRPC_SUPPORT_HOST_PORT_H
#define GRPC_SUPPORT_HOST_PORT_H
#ifdef __cplusplus
extern "C" {
@ -59,4 +59,4 @@ void gpr_split_host_port(const char *name, char **host, char **port);
}
#endif
#endif /* __GRPC_SUPPORT_HOST_PORT_H__ */
#endif /* GRPC_SUPPORT_HOST_PORT_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_LOG_H__
#define __GRPC_SUPPORT_LOG_H__
#ifndef GRPC_SUPPORT_LOG_H
#define GRPC_SUPPORT_LOG_H
#include <stdlib.h> /* for abort() */
#include <stdarg.h>
@ -105,4 +105,4 @@ void gpr_set_log_function(gpr_log_func func);
}
#endif
#endif /* __GRPC_SUPPORT_LOG_H__ */
#endif /* GRPC_SUPPORT_LOG_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_LOG_WIN32_H__
#define __GRPC_SUPPORT_LOG_WIN32_H__
#ifndef GRPC_SUPPORT_LOG_WIN32_H
#define GRPC_SUPPORT_LOG_WIN32_H
#include <windows.h>
@ -50,4 +50,4 @@ char *gpr_format_message(DWORD messageid);
}
#endif
#endif /* __GRPC_SUPPORT_LOG_H__ */
#endif /* GRPC_SUPPORT_LOG_WIN32_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_PORT_PLATFORM_H__
#define __GRPC_SUPPORT_PORT_PLATFORM_H__
#ifndef GRPC_SUPPORT_PORT_PLATFORM_H
#define GRPC_SUPPORT_PORT_PLATFORM_H
/* Override this file with one for your platform if you need to redefine
things. */
@ -206,4 +206,4 @@ typedef uintptr_t gpr_uintptr;
power of two */
#define GPR_MAX_ALIGNMENT 16
#endif /* __GRPC_SUPPORT_PORT_PLATFORM_H__ */
#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_SLICE_H__
#define __GRPC_SUPPORT_SLICE_H__
#ifndef GRPC_SUPPORT_SLICE_H
#define GRPC_SUPPORT_SLICE_H
#include <grpc/support/sync.h>
@ -175,4 +175,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b);
}
#endif
#endif /* __GRPC_SUPPORT_SLICE_H__ */
#endif /* GRPC_SUPPORT_SLICE_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_SLICE_BUFFER_H__
#define __GRPC_SUPPORT_SLICE_BUFFER_H__
#ifndef GRPC_SUPPORT_SLICE_BUFFER_H
#define GRPC_SUPPORT_SLICE_BUFFER_H
#include <grpc/support/slice.h>
@ -74,6 +74,8 @@ void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices, size_t n);
/* add a very small (less than 8 bytes) amount of data to the end of a slice
buffer: returns a pointer into which to add the data */
gpr_uint8 *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, unsigned len);
/* pop the last buffer, but don't unref it */
void gpr_slice_buffer_pop(gpr_slice_buffer *sb);
/* clear a slice buffer, unref all elements */
void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
@ -81,4 +83,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
}
#endif
#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */
#endif /* GRPC_SUPPORT_SLICE_BUFFER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_SYNC_H__
#define __GRPC_SUPPORT_SYNC_H__
#ifndef GRPC_SUPPORT_SYNC_H
#define GRPC_SUPPORT_SYNC_H
/* Synchronization primitives for GPR.
The type gpr_mu provides a non-reentrant mutex (lock).
@ -345,4 +345,4 @@ gpr_intptr gpr_stats_read(const gpr_stats_counter *c);
}
#endif
#endif /* __GRPC_SUPPORT_SYNC_H__ */
#endif /* GRPC_SUPPORT_SYNC_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_SYNC_GENERIC_H__
#define __GRPC_SUPPORT_SYNC_GENERIC_H__
#ifndef GRPC_SUPPORT_SYNC_GENERIC_H
#define GRPC_SUPPORT_SYNC_GENERIC_H
/* Generic type defintions for gpr_sync. */
#include <grpc/support/atm.h>
@ -58,4 +58,4 @@ typedef struct {
#define GPR_STATS_INIT \
{ 0 }
#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */
#endif /* GRPC_SUPPORT_SYNC_GENERIC_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_SYNC_POSIX_H__
#define __GRPC_SUPPORT_SYNC_POSIX_H__
#ifndef GRPC_SUPPORT_SYNC_POSIX_H
#define GRPC_SUPPORT_SYNC_POSIX_H
#include <grpc/support/sync_generic.h>
@ -44,4 +44,4 @@ typedef pthread_once_t gpr_once;
#define GPR_ONCE_INIT PTHREAD_ONCE_INIT
#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */
#endif /* GRPC_SUPPORT_SYNC_POSIX_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_SYNC_WIN32_H__
#define __GRPC_SUPPORT_SYNC_WIN32_H__
#ifndef GRPC_SUPPORT_SYNC_WIN32_H
#define GRPC_SUPPORT_SYNC_WIN32_H
#include <grpc/support/sync_generic.h>
@ -48,4 +48,4 @@ typedef CONDITION_VARIABLE gpr_cv;
typedef INIT_ONCE gpr_once;
#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT
#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */
#endif /* GRPC_SUPPORT_SYNC_WIN32_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_THD_H__
#define __GRPC_SUPPORT_THD_H__
#ifndef GRPC_SUPPORT_THD_H
#define GRPC_SUPPORT_THD_H
/* Thread interface for GPR.
Types
@ -73,4 +73,4 @@ gpr_thd_id gpr_thd_currentid(void);
}
#endif
#endif /* __GRPC_SUPPORT_THD_H__ */
#endif /* GRPC_SUPPORT_THD_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_TIME_H__
#define __GRPC_SUPPORT_TIME_H__
#ifndef GRPC_SUPPORT_TIME_H
#define GRPC_SUPPORT_TIME_H
/* Time support.
We use gpr_timespec, which is analogous to struct timespec. On some
machines, absolute times may be in local time. */
@ -100,4 +100,4 @@ double gpr_timespec_to_micros(gpr_timespec t);
}
#endif
#endif /* __GRPC_SUPPORT_TIME_H__ */
#endif /* GRPC_SUPPORT_TIME_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_SUPPORT_USEFUL_H__
#define __GRPC_SUPPORT_USEFUL_H__
#ifndef GRPC_SUPPORT_USEFUL_H
#define GRPC_SUPPORT_USEFUL_H
/* useful macros that don't belong anywhere else */
@ -45,4 +45,4 @@
#define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))
#endif /* __GRPC_SUPPORT_USEFUL_H__ */
#endif /* GRPC_SUPPORT_USEFUL_H */

@ -186,7 +186,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
"$Method$(::grpc::ClientContext* context, "
"Async$Method$(::grpc::ClientContext* context, "
"const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag);\n");
} else if (ClientOnlyStreaming(method)) {
@ -196,7 +196,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
"::grpc::ClientContext* context, $Response$* response);\n");
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> $Method$("
"std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> Async$Method$("
"::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag);\n");
} else if (ServerOnlyStreaming(method)) {
@ -206,7 +206,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
"::grpc::ClientContext* context, const $Request$& request);\n");
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> $Method$("
"std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> Async$Method$("
"::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag);\n");
} else if (BidiStreaming(method)) {
@ -217,7 +217,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer,
printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
"$Request$, $Response$>> "
"$Method$(::grpc::ClientContext* context, "
"Async$Method$(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq, void* tag);\n");
}
}
@ -390,7 +390,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
printer->Print(
*vars,
"std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
"$Service$::Stub::$Method$(::grpc::ClientContext* context, "
"$Service$::Stub::Async$Method$(::grpc::ClientContext* context, "
"const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars,
@ -416,7 +416,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
"}\n\n");
printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>> "
"$Service$::Stub::$Method$("
"$Service$::Stub::Async$Method$("
"::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars,
@ -443,7 +443,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
"}\n\n");
printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientAsyncReader< $Response$>> "
"$Service$::Stub::$Method$("
"$Service$::Stub::Async$Method$("
"::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars,
@ -471,7 +471,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer,
printer->Print(*vars,
"std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "
"$Request$, $Response$>> "
"$Service$::Stub::$Method$(::grpc::ClientContext* context, "
"$Service$::Stub::Async$Method$(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq, void* tag) {\n");
printer->Print(*vars,
" return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< "

@ -31,8 +31,8 @@
*
*/
#ifndef NET_GRPC_COMPILER_CPP_GENERATOR_H_
#define NET_GRPC_COMPILER_CPP_GENERATOR_H_
#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H
#include <string>
@ -58,4 +58,4 @@ std::string GetSourceServices(const google::protobuf::FileDescriptor *file);
} // namespace grpc_cpp_generator
#endif // NET_GRPC_COMPILER_CPP_GENERATOR_H_
#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_H

@ -31,8 +31,8 @@
*
*/
#ifndef NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__
#define NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__
#ifndef GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
#define GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H
#include <map>
#include <string>
@ -69,4 +69,4 @@ inline std::string ClassName(const google::protobuf::Descriptor *descriptor,
} // namespace grpc_cpp_generator
#endif // NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__
#endif // GRPC_INTERNAL_COMPILER_CPP_GENERATOR_HELPERS_H

@ -31,8 +31,8 @@
*
*/
#ifndef NET_GRPC_COMPILER_GENERATOR_HELPERS_H__
#define NET_GRPC_COMPILER_GENERATOR_HELPERS_H__
#ifndef GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
#define GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
#include <map>
#include <string>
@ -76,4 +76,4 @@ inline std::string StringReplace(std::string str, const std::string &from,
} // namespace grpc_generator
#endif // NET_GRPC_COMPILER_GENERATOR_HELPERS_H__
#endif // GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H

@ -237,54 +237,70 @@ bool PrintServerFactory(const ServiceDescriptor* service, Printer* out) {
"Service", service->name());
{
IndentScope raii_create_server_indent(out);
map<string, pair<string, string>> method_to_module_and_message;
out->Print("method_implementations = {\n");
map<string, string> method_description_constructors;
map<string, pair<string, string>> input_message_modules_and_classes;
map<string, pair<string, string>> output_message_modules_and_classes;
for (int i = 0; i < service->method_count(); ++i) {
IndentScope raii_implementations_indent(out);
const MethodDescriptor* meth = service->method(i);
string meth_type =
string(meth->client_streaming() ? "stream" : "unary") +
string(meth->server_streaming() ? "_stream" : "_unary") + "_inline";
out->Print("\"$Method$\": utilities.$Type$(servicer.$Method$),\n",
"Method", meth->name(),
"Type", meth_type);
// Maintain information on the input type of the service method for later
// use in constructing the service assembly's activated fore link.
const Descriptor* input_type = meth->input_type();
pair<string, string> module_and_message;
if (!GetModuleAndMessagePath(input_type, &module_and_message)) {
const MethodDescriptor* method = service->method(i);
const string method_description_constructor =
string(method->client_streaming() ? "stream_" : "unary_") +
string(method->server_streaming() ? "stream_" : "unary_") +
"service_description";
pair<string, string> input_message_module_and_class;
if (!GetModuleAndMessagePath(method->input_type(),
&input_message_module_and_class)) {
return false;
}
method_to_module_and_message.insert(
make_pair(meth->name(), module_and_message));
}
out->Print("}\n");
// Ensure that we've imported all of the relevant messages.
for (auto& meth_vals : method_to_module_and_message) {
out->Print("import $Module$\n",
"Module", meth_vals.second.first);
}
out->Print("request_deserializers = {\n");
for (auto& meth_vals : method_to_module_and_message) {
IndentScope raii_serializers_indent(out);
string full_input_type_path = meth_vals.second.first + "." +
meth_vals.second.second;
out->Print("\"$Method$\": $Type$.FromString,\n",
"Method", meth_vals.first,
"Type", full_input_type_path);
pair<string, string> output_message_module_and_class;
if (!GetModuleAndMessagePath(method->output_type(),
&output_message_module_and_class)) {
return false;
}
// Import the modules that define the messages used in RPCs.
out->Print("import $Module$\n", "Module",
input_message_module_and_class.first);
out->Print("import $Module$\n", "Module",
output_message_module_and_class.first);
method_description_constructors.insert(
make_pair(method->name(), method_description_constructor));
input_message_modules_and_classes.insert(
make_pair(method->name(), input_message_module_and_class));
output_message_modules_and_classes.insert(
make_pair(method->name(), output_message_module_and_class));
}
out->Print("}\n");
out->Print("response_serializers = {\n");
for (auto& meth_vals : method_to_module_and_message) {
IndentScope raii_serializers_indent(out);
out->Print("\"$Method$\": lambda x: x.SerializeToString(),\n",
"Method", meth_vals.first);
out->Print("method_service_descriptions = {\n");
for (auto& name_and_description_constructor :
method_description_constructors) {
IndentScope raii_descriptions_indent(out);
const string method_name = name_and_description_constructor.first;
auto input_message_module_and_class =
input_message_modules_and_classes.find(method_name);
auto output_message_module_and_class =
output_message_modules_and_classes.find(method_name);
out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method",
method_name, "Constructor",
name_and_description_constructor.second);
{
IndentScope raii_description_arguments_indent(out);
out->Print("servicer.$Method$,\n", "Method", method_name);
out->Print(
"$InputTypeModule$.$InputTypeClass$.FromString,\n",
"InputTypeModule", input_message_module_and_class->second.first,
"InputTypeClass", input_message_module_and_class->second.second);
out->Print(
"$OutputTypeModule$.$OutputTypeClass$.SerializeToString,\n",
"OutputTypeModule", output_message_module_and_class->second.first,
"OutputTypeClass", output_message_module_and_class->second.second);
}
out->Print("),\n");
}
out->Print("}\n");
out->Print("link = fore.activated_fore_link(port, request_deserializers, "
"response_serializers, root_certificates, key_chain_pairs)\n");
out->Print("return implementations.assemble_service("
"method_implementations, link)\n");
// out->Print("return implementations.insecure_server("
// "method_service_descriptions, port)\n");
out->Print(
"return implementations.secure_server("
"method_service_descriptions, port, root_certificates,"
" key_chain_pairs)\n");
}
return true;
}
@ -296,66 +312,74 @@ bool PrintStubFactory(const ServiceDescriptor* service, Printer* out) {
out->Print(dict, "def early_adopter_create_$Service$_stub(host, port):\n");
{
IndentScope raii_create_server_indent(out);
map<string, pair<string, string>> method_to_module_and_message;
out->Print("method_implementations = {\n");
map<string, string> method_description_constructors;
map<string, pair<string, string>> input_message_modules_and_classes;
map<string, pair<string, string>> output_message_modules_and_classes;
for (int i = 0; i < service->method_count(); ++i) {
IndentScope raii_implementations_indent(out);
const MethodDescriptor* meth = service->method(i);
string meth_type =
string(meth->client_streaming() ? "stream" : "unary") +
string(meth->server_streaming() ? "_stream" : "_unary") + "_inline";
// TODO(atash): once the expected input to assemble_dynamic_inline_stub is
// cleaned up, change this to the expected argument's dictionary values.
out->Print("\"$Method$\": utilities.$Type$(None),\n",
"Method", meth->name(),
"Type", meth_type);
// Maintain information on the input type of the service method for later
// use in constructing the service assembly's activated fore link.
const Descriptor* output_type = meth->output_type();
pair<string, string> module_and_message;
if (!GetModuleAndMessagePath(output_type, &module_and_message)) {
const MethodDescriptor* method = service->method(i);
const string method_description_constructor =
string(method->client_streaming() ? "stream_" : "unary_") +
string(method->server_streaming() ? "stream_" : "unary_") +
"invocation_description";
pair<string, string> input_message_module_and_class;
if (!GetModuleAndMessagePath(method->input_type(),
&input_message_module_and_class)) {
return false;
}
method_to_module_and_message.insert(
make_pair(meth->name(), module_and_message));
}
out->Print("}\n");
// Ensure that we've imported all of the relevant messages.
for (auto& meth_vals : method_to_module_and_message) {
out->Print("import $Module$\n",
"Module", meth_vals.second.first);
}
out->Print("response_deserializers = {\n");
for (auto& meth_vals : method_to_module_and_message) {
IndentScope raii_serializers_indent(out);
string full_output_type_path = meth_vals.second.first + "." +
meth_vals.second.second;
out->Print("\"$Method$\": $Type$.FromString,\n",
"Method", meth_vals.first,
"Type", full_output_type_path);
pair<string, string> output_message_module_and_class;
if (!GetModuleAndMessagePath(method->output_type(),
&output_message_module_and_class)) {
return false;
}
// Import the modules that define the messages used in RPCs.
out->Print("import $Module$\n", "Module",
input_message_module_and_class.first);
out->Print("import $Module$\n", "Module",
output_message_module_and_class.first);
method_description_constructors.insert(
make_pair(method->name(), method_description_constructor));
input_message_modules_and_classes.insert(
make_pair(method->name(), input_message_module_and_class));
output_message_modules_and_classes.insert(
make_pair(method->name(), output_message_module_and_class));
}
out->Print("}\n");
out->Print("request_serializers = {\n");
for (auto& meth_vals : method_to_module_and_message) {
IndentScope raii_serializers_indent(out);
out->Print("\"$Method$\": lambda x: x.SerializeToString(),\n",
"Method", meth_vals.first);
out->Print("method_invocation_descriptions = {\n");
for (auto& name_and_description_constructor :
method_description_constructors) {
IndentScope raii_descriptions_indent(out);
const string method_name = name_and_description_constructor.first;
auto input_message_module_and_class =
input_message_modules_and_classes.find(method_name);
auto output_message_module_and_class =
output_message_modules_and_classes.find(method_name);
out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method",
method_name, "Constructor",
name_and_description_constructor.second);
{
IndentScope raii_description_arguments_indent(out);
out->Print(
"$InputTypeModule$.$InputTypeClass$.SerializeToString,\n",
"InputTypeModule", input_message_module_and_class->second.first,
"InputTypeClass", input_message_module_and_class->second.second);
out->Print(
"$OutputTypeModule$.$OutputTypeClass$.FromString,\n",
"OutputTypeModule", output_message_module_and_class->second.first,
"OutputTypeClass", output_message_module_and_class->second.second);
}
out->Print("),\n");
}
out->Print("}\n");
out->Print("link = rear.activated_rear_link("
"host, port, request_serializers, response_deserializers)\n");
out->Print("return implementations.assemble_dynamic_inline_stub("
"method_implementations, link)\n");
out->Print(
"return implementations.insecure_stub("
"method_invocation_descriptions, host, port)\n");
}
return true;
}
bool PrintPreamble(const FileDescriptor* file, Printer* out) {
out->Print("import abc\n");
out->Print("from grpc._adapter import fore\n");
out->Print("from grpc._adapter import rear\n");
out->Print("from grpc.framework.assembly import implementations\n");
out->Print("from grpc.framework.assembly import utilities\n");
out->Print("from grpc.early_adopter import implementations\n");
out->Print("from grpc.early_adopter import utilities\n");
return true;
}

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_COMPILER_PYTHON_GENERATOR_H__
#define __GRPC_COMPILER_PYTHON_GENERATOR_H__
#ifndef GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
#define GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H
#include <string>
#include <utility>
@ -49,4 +49,4 @@ std::pair<bool, std::string> GetServices(const google::protobuf::FileDescriptor*
} // namespace grpc_python_generator
#endif // __GRPC_COMPILER_PYTHON_GENERATOR_H__
#endif // GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H

@ -36,6 +36,7 @@
#include <cstring>
#include <memory>
#include <string>
#include <tuple>
#include "src/compiler/python_generator.h"
#include <google/protobuf/compiler/code_generator.h>

@ -31,8 +31,8 @@
*
*/
#ifndef NET_GRPC_COMPILER_RUBY_GENERATOR_H_
#define NET_GRPC_COMPILER_RUBY_GENERATOR_H_
#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H
#include <string>
@ -48,4 +48,4 @@ std::string GetServices(const google::protobuf::FileDescriptor *file);
} // namespace grpc_ruby_generator
#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_H_
#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_H

@ -31,8 +31,8 @@
*
*/
#ifndef NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_
#define NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_
#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H
#include <string>
@ -64,4 +64,4 @@ inline std::string MessagesRequireName(
} // namespace grpc_ruby_generator
#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_
#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_HELPERS_INL_H

@ -31,8 +31,8 @@
*
*/
#ifndef NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_
#define NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_
#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H
#include <iostream>
#include <initializer_list>
@ -69,4 +69,4 @@ inline std::map<std::string, std::string> ListToDict(
} // namespace grpc_ruby_generator
#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_
#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_MAP_INL_H

@ -31,8 +31,8 @@
*
*/
#ifndef NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_
#define NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_
#ifndef GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
#define GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H
#include <algorithm>
#include <string>
@ -130,4 +130,4 @@ inline std::string RubyTypeOf(const std::string &a_type,
} // namespace grpc_ruby_generator
#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_
#endif // GRPC_INTERNAL_COMPILER_RUBY_GENERATOR_STRING_INL_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__
#define __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CENSUS_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_CENSUS_FILTER_H
#include "src/core/channel/channel_stack.h"
@ -41,4 +41,4 @@
extern const grpc_channel_filter grpc_client_census_filter;
extern const grpc_channel_filter grpc_server_census_filter;
#endif /* __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CENSUS_FILTER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__
#define __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H
#define GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H
#include <grpc/grpc.h>
@ -51,4 +51,4 @@ void grpc_channel_args_destroy(grpc_channel_args *a);
is specified in channel args, otherwise returns 0. */
int grpc_channel_args_is_census_enabled(const grpc_channel_args *a);
#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_ARGS_H */

@ -36,6 +36,8 @@
#include <stdlib.h>
int grpc_trace_channel = 0;
/* Memory layouts.
Channel stack is laid out as: {

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__
#define __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H
#define GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H
/* A channel filter defines how operations on a channel are implemented.
Channel filters are chained together to create full channels, and if those
@ -298,7 +298,9 @@ void grpc_call_element_recv_metadata(grpc_call_element *cur_elem,
void grpc_call_element_send_cancel(grpc_call_element *cur_elem);
void grpc_call_element_send_finish(grpc_call_element *cur_elem);
extern int grpc_trace_channel;
#define GRPC_CALL_LOG_OP(sev, elem, op) \
if (grpc_trace_bits & GRPC_TRACE_CHANNEL) grpc_call_log_op(sev, elem, op)
if (grpc_trace_channel) grpc_call_log_op(sev, elem, op)
#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_
#define __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CHILD_CHANNEL_H
#define GRPC_INTERNAL_CORE_CHANNEL_CHILD_CHANNEL_H
#include "src/core/channel/channel_stack.h"
@ -61,4 +61,4 @@ grpc_child_call *grpc_child_channel_create_call(grpc_child_channel *channel,
grpc_call_element *grpc_child_call_get_top_element(grpc_child_call *call);
void grpc_child_call_destroy(grpc_child_call *call);
#endif /* __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CHILD_CHANNEL_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__
#define __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H
#define GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H
#include "src/core/channel/channel_stack.h"
@ -59,4 +59,4 @@ grpc_transport_setup_result grpc_client_channel_transport_setup_complete(
grpc_channel_filter const **channel_filters, size_t num_channel_filters,
grpc_mdctx *mdctx);
#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_CHANNEL_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__
#define __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CLIENT_SETUP_H
#define GRPC_INTERNAL_CORE_CHANNEL_CLIENT_SETUP_H
#include "src/core/channel/client_channel.h"
#include "src/core/transport/metadata.h"
@ -70,4 +70,4 @@ gpr_timespec grpc_client_setup_request_deadline(grpc_client_setup_request *r);
grpc_mdctx *grpc_client_setup_get_mdctx(grpc_client_setup_request *r);
#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CLIENT_SETUP_H */

@ -48,12 +48,12 @@
/* the protobuf library will (by default) start warning at 100megs */
#define DEFAULT_MAX_MESSAGE_LENGTH (100 * 1024 * 1024)
typedef struct {
typedef struct connected_channel_channel_data {
grpc_transport *transport;
gpr_uint32 max_message_length;
} channel_data;
typedef struct {
typedef struct connected_channel_call_data {
grpc_call_element *elem;
grpc_stream_op_buffer outgoing_sopb;

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__
#define __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H
#define GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H
#include "src/core/channel/channel_stack.h"
@ -46,4 +46,4 @@ extern const grpc_channel_filter grpc_connected_channel_filter;
grpc_transport_setup_result grpc_connected_channel_bind_transport(
grpc_channel_stack *channel_stack, grpc_transport *transport);
#endif /* __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CONNECTED_CHANNEL_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__
#define __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
#include "src/core/channel/channel_stack.h"
@ -41,4 +41,4 @@ extern const grpc_channel_filter grpc_http_client_filter;
#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_HTTP_CLIENT_FILTER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__
#define __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_HTTP_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_HTTP_FILTER_H
#include "src/core/channel/channel_stack.h"
@ -40,4 +40,4 @@
transports. */
extern const grpc_channel_filter grpc_http_filter;
#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_HTTP_FILTER_H */

@ -31,12 +31,12 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__
#define __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H
#include "src/core/channel/channel_stack.h"
/* Processes metadata on the client side for HTTP2 transports */
extern const grpc_channel_filter grpc_http_server_filter;
#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_HTTP_SERVER_FILTER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__
#define __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_METADATA_BUFFER_H
#define GRPC_INTERNAL_CORE_CHANNEL_METADATA_BUFFER_H
#include "src/core/channel/channel_stack.h"
@ -67,4 +67,4 @@ grpc_metadata *grpc_metadata_buffer_extract_elements(
grpc_metadata_buffer *buffer);
void grpc_metadata_buffer_cleanup_elements(void *elements, grpc_op_error error);
#endif /* __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_METADATA_BUFFER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__
#define __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__
#ifndef GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H
#define GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H
#include "src/core/channel/channel_stack.h"
@ -41,4 +41,4 @@
customize for their own filters */
extern const grpc_channel_filter grpc_no_op_filter;
#endif /* __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ */
#endif /* GRPC_INTERNAL_CORE_CHANNEL_NOOP_FILTER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__
#define __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__
#ifndef GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H
#define GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H
/* The various compression algorithms supported by GRPC */
typedef enum {
@ -46,4 +46,4 @@ typedef enum {
const char *grpc_compression_algorithm_name(
grpc_compression_algorithm algorithm);
#endif /* __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ */
#endif /* GRPC_INTERNAL_CORE_COMPRESSION_ALGORITHM_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__
#define __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__
#ifndef GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H
#define GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H
#include "src/core/compression/algorithm.h"
#include <grpc/support/slice_buffer.h>
@ -49,4 +49,4 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm,
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
gpr_slice_buffer *input, gpr_slice_buffer *output);
#endif /* __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ */
#endif /* GRPC_INTERNAL_CORE_COMPRESSION_MESSAGE_COMPRESS_H */

@ -39,8 +39,21 @@
#include <grpc/support/log.h>
#include "src/core/support/env.h"
#if GRPC_ENABLE_TRACING
gpr_uint32 grpc_trace_bits = 0;
typedef struct tracer {
const char *name;
int *flag;
struct tracer *next;
} tracer;
static tracer *tracers;
void grpc_register_tracer(const char *name, int *flag) {
tracer *t = gpr_malloc(sizeof(*t));
t->name = name;
t->flag = flag;
t->next = tracers;
*flag = 0;
tracers = t;
}
static void add(const char *beg, const char *end, char ***ss, size_t *ns) {
size_t n = *ns;
@ -67,26 +80,26 @@ static void parse(const char *s) {
char **strings = NULL;
size_t nstrings = 0;
size_t i;
tracer *t;
split(s, &strings, &nstrings);
grpc_trace_bits = 0;
for (i = 0; i < nstrings; i++) {
const char *s = strings[i];
if (0 == strcmp(s, "surface")) {
grpc_trace_bits |= GRPC_TRACE_SURFACE;
} else if (0 == strcmp(s, "channel")) {
grpc_trace_bits |= GRPC_TRACE_CHANNEL;
} else if (0 == strcmp(s, "tcp")) {
grpc_trace_bits |= GRPC_TRACE_TCP;
} else if (0 == strcmp(s, "secure_endpoint")) {
grpc_trace_bits |= GRPC_TRACE_SECURE_ENDPOINT;
} else if (0 == strcmp(s, "http")) {
grpc_trace_bits |= GRPC_TRACE_HTTP;
} else if (0 == strcmp(s, "all")) {
grpc_trace_bits = -1;
if (0 == strcmp(s, "all")) {
for (t = tracers; t; t = t->next) {
*t->flag = 1;
}
} else {
gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s);
int found = 0;
for (t = tracers; t; t = t->next) {
if (0 == strcmp(s, t->name)) {
*t->flag = 1;
found = 1;
}
}
if (!found) {
gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s);
}
}
}
@ -96,17 +109,15 @@ static void parse(const char *s) {
gpr_free(strings);
}
void grpc_init_trace_bits() {
char *e = gpr_getenv("GRPC_TRACE");
if (e == NULL) {
grpc_trace_bits = 0;
} else {
void grpc_tracer_init(const char *env_var) {
char *e = gpr_getenv(env_var);
if (e != NULL) {
parse(e);
gpr_free(e);
}
while (tracers) {
tracer *t = tracers;
tracers = t->next;
gpr_free(t);
}
}
#else
void grpc_init_trace_bits() {
}
#endif

@ -31,31 +31,12 @@
*
*/
#ifndef GRPC_CORE_DEBUG_TRACE_H
#define GRPC_CORE_DEBUG_TRACE_H
#ifndef GRPC_INTERNAL_CORE_DEBUG_TRACE_H
#define GRPC_INTERNAL_CORE_DEBUG_TRACE_H
#include <grpc/support/port_platform.h>
/* set to zero to remove all debug trace code */
#ifndef GRPC_ENABLE_TRACING
# define GRPC_ENABLE_TRACING 1
#endif
typedef enum {
GRPC_TRACE_SURFACE = 1 << 0,
GRPC_TRACE_CHANNEL = 1 << 1,
GRPC_TRACE_TCP = 1 << 2,
GRPC_TRACE_SECURE_ENDPOINT = 1 << 3,
GRPC_TRACE_HTTP = 1 << 4
} grpc_trace_bit_value;
#if GRPC_ENABLE_TRACING
extern gpr_uint32 grpc_trace_bits;
#else
# define grpc_trace_bits 0
#endif
void grpc_init_trace_bits();
#endif
void grpc_register_tracer(const char *name, int *flag);
void grpc_tracer_init(const char *env_var_name);
#endif /* GRPC_INTERNAL_CORE_DEBUG_TRACE_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__
#define __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__
#ifndef GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H
#define GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H
#include "src/core/httpcli/httpcli.h"
#include <grpc/support/slice.h>
@ -42,4 +42,4 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
const char *body_bytes,
size_t body_size);
#endif /* __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ */
#endif /* GRPC_INTERNAL_CORE_HTTPCLI_FORMAT_REQUEST_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__
#define __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__
#ifndef GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_H
#define GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_H
#include <stddef.h>
@ -115,4 +115,4 @@ typedef int (*grpc_httpcli_post_override)(const grpc_httpcli_request *request,
void grpc_httpcli_set_override(grpc_httpcli_get_override get,
grpc_httpcli_post_override post);
#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ */
#endif /* GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__
#define __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__
#ifndef GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H
#define GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H
#include "src/core/security/security_context.h"
@ -40,4 +40,4 @@ grpc_security_status grpc_httpcli_ssl_channel_security_context_create(
const unsigned char *pem_root_certs, size_t pem_root_certs_size,
const char *secure_peer_name, grpc_channel_security_context **ctx);
#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ */
#endif /* GRPC_INTERNAL_CORE_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_HTTPCLI_PARSER_H__
#define __GRPC_INTERNAL_HTTPCLI_PARSER_H__
#ifndef GRPC_INTERNAL_CORE_HTTPCLI_PARSER_H
#define GRPC_INTERNAL_CORE_HTTPCLI_PARSER_H
#include "src/core/httpcli/httpcli.h"
#include <grpc/support/port_platform.h>
@ -61,4 +61,4 @@ void grpc_httpcli_parser_destroy(grpc_httpcli_parser *parser);
int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice);
int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser);
#endif /* __GRPC_INTERNAL_HTTPCLI_PARSER_H__ */
#endif /* GRPC_INTERNAL_CORE_HTTPCLI_PARSER_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_IOMGR_ALARM_H__
#define __GRPC_INTERNAL_IOMGR_ALARM_H__
#ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_H
#define GRPC_INTERNAL_CORE_IOMGR_ALARM_H
#include "src/core/iomgr/iomgr.h"
#include <grpc/support/port_platform.h>
@ -86,4 +86,4 @@ void grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline,
Requires: cancel() must happen after add() on a given alarm */
void grpc_alarm_cancel(grpc_alarm *alarm);
#endif /* __GRPC_INTERNAL_IOMGR_ALARM_H__ */
#endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_
#define __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_
#ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H
#define GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H
#include "src/core/iomgr/alarm.h"
@ -54,4 +54,4 @@ void grpc_alarm_heap_pop(grpc_alarm_heap *heap);
int grpc_alarm_heap_is_empty(grpc_alarm_heap *heap);
#endif /* __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_ */
#endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_HEAP_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_
#define __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_
#ifndef GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H
#define GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
@ -59,4 +59,4 @@ gpr_timespec grpc_alarm_list_next_timeout(void);
void grpc_kick_poller(void);
#endif /* __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ */
#endif /* GRPC_INTERNAL_CORE_IOMGR_ALARM_INTERNAL_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_IOMGR_ENDPOINT_H__
#define __GRPC_INTERNAL_IOMGR_ENDPOINT_H__
#ifndef GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_H
#define GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_H
#include "src/core/iomgr/pollset.h"
#include <grpc/support/slice.h>
@ -103,4 +103,4 @@ struct grpc_endpoint {
const grpc_endpoint_vtable *vtable;
};
#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ */
#endif /* GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_
#define __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_
#ifndef GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_PAIR_H
#define GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_PAIR_H
#include "src/core/iomgr/endpoint.h"
@ -43,4 +43,4 @@ typedef struct {
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size);
#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ */
#endif /* GRPC_INTERNAL_CORE_IOMGR_ENDPOINT_PAIR_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_IOMGR_FD_POSIX_H_
#define __GRPC_INTERNAL_IOMGR_FD_POSIX_H_
#ifndef GRPC_INTERNAL_CORE_IOMGR_FD_POSIX_H
#define GRPC_INTERNAL_CORE_IOMGR_FD_POSIX_H
#include "src/core/iomgr/iomgr.h"
#include "src/core/iomgr/pollset.h"
@ -143,4 +143,4 @@ void grpc_fd_unref(grpc_fd *fd);
void grpc_fd_global_init(void);
void grpc_fd_global_shutdown(void);
#endif /* __GRPC_INTERNAL_IOMGR_FD_POSIX_H_ */
#endif /* GRPC_INTERNAL_CORE_IOMGR_FD_POSIX_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_
#define __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_
#ifndef GRPC_INTERNAL_CORE_IOMGR_IOCP_WINDOWS_H
#define GRPC_INTERNAL_CORE_IOMGR_IOCP_WINDOWS_H
#include <windows.h>
#include <grpc/support/sync.h>
@ -49,4 +49,4 @@ void grpc_socket_notify_on_write(grpc_winsocket *, void(*cb)(void *, int success
void grpc_socket_notify_on_read(grpc_winsocket *, void(*cb)(void *, int success),
void *opaque);
#endif /* __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_ */
#endif /* GRPC_INTERNAL_CORE_IOMGR_IOCP_WINDOWS_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_INTERNAL_IOMGR_IOMGR_H__
#define __GRPC_INTERNAL_IOMGR_IOMGR_H__
#ifndef GRPC_INTERNAL_CORE_IOMGR_IOMGR_H
#define GRPC_INTERNAL_CORE_IOMGR_IOMGR_H
/* gRPC Callback definition */
typedef void (*grpc_iomgr_cb_func)(void *arg, int success);
@ -44,4 +44,4 @@ void grpc_iomgr_shutdown(void);
and causes the invocation of a callback at some point in the future */
void grpc_iomgr_add_callback(grpc_iomgr_cb_func cb, void *cb_arg);
#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_H__ */
#endif /* GRPC_INTERNAL_CORE_IOMGR_IOMGR_H */

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

Loading…
Cancel
Save