Merge github.com:grpc/grpc into ssl

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

@ -0,0 +1,22 @@
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 clang-3.5
env:
global:
- RUBY_VERSION=2.1
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
script:
- rvm use $RUBY_VERSION
- gem install bundler
- ./tools/run_tests/run_tests.py -l $TEST -t -j 16 -c $CONFIG -s 4.0
notifications:
email: false

@ -24,27 +24,27 @@ properly run all the tests.
If you are planning to work on any of the languages other than C and C++, you
will also need their appropriate development environments.
If you want to work under Windows, we recommend you to use Visual Studio 2013.
If you want to work under Windows, we recommend the use of Visual Studio 2013.
The [Community or Express editions](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx)
are free and suitable for developing with grpc. Note however that our test
environment and tools are available for Unix environments only at the moment.
## Testing your changes
We provide a tool to help you run our suite of tests in various environments.
We provide a tool to help run the suite of tests in various environments.
In order to run most of the available tests, one would need to run:
`./tools/run_tests/run_tests.py`
If you want to run all the possible tests for all possible languages, do this:
If you want to run all the possible tests for any of the languages {c, c++, node, php, python}, do this:
`./tools/run_tests/run_tests.py -lall -call`
`./tools/run_tests/run_tests.py -l <lang> -c all`
## Adding or removing source code
Each language uses its own build system to work. Currently, the root's Makefile
and the Visual Studio project files are building the C and C++ source code only
at the moment. In order to ease the maintenance of these files, we have a
and the Visual Studio project files are building only the C and C++ source code.
In order to ease the maintenance of these files, we have a
template system. Please do not contribute manual changes to any of the generated
files. Instead, modify the template files, or the build.json file, and
re-generate the project files using the following command:

@ -9,15 +9,16 @@ wiki pages:
* If you are in a hurry *
*************************
A typical unix installation won't require any more steps than running:
$ make
# make install
$ git clone https://github.com/grpc/grpc.git
$ cd grpc
$ git submodule update --init
$ make
$ sudo make install
You don't need anything else than GNU Make, gcc and autotools. Under a Debian
or Ubuntu system, this should boil down to the following packages:
# apt-get install build-essential autoconf libtool
$ apt-get install build-essential autoconf libtool
Building the python wrapper requires the following:

File diff suppressed because one or more lines are too long

@ -0,0 +1,22 @@
Additional IP Rights Grant (Patents)
"This implementation" means the copyrightable works distributed by
Google as part of the GRPC project.
Google hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import,
transfer and otherwise run, modify and propagate the contents of this
implementation of GRPC, where such license applies only to those patent
claims, both currently owned or controlled by Google and acquired in
the future, licensable by Google that are necessarily infringed by this
implementation of GRPC. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute or
order or agree to the institution of patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging
that this implementation of GRPC or any code incorporated within this
implementation of GRPC constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any patent
rights granted to you under this License for this implementation of GRPC
shall terminate as of the date such litigation is filed.

@ -9,13 +9,13 @@ See grpc/INSTALL for installation instructions for various platforms.
#Repository Structure
This repository contains source code for gRPC libraries for multiple lanugages written on top
This repository contains source code for gRPC libraries for multiple languages written on top
of shared C core library [src/core] (src/core).
* C++ source code: [src/cpp] (src/cpp)
* Python source code: [src/python] (src/python)
* Ruby source code: [src/ruby] (src/ruby)
* NodeJS source code: [src/node] (src/node)
* Python source code: [src/python] (src/python)
* PHP source code: [src/php] (src/php)
* C# source code: [src/csharp] (src/csharp)
* Objective-C source code: [src/objective-c] (src/objective-c)
@ -33,9 +33,9 @@ Libraries in different languages are in different state of development. We are s
* shared C core library [src/core] (src/core) : Early adopter ready - Alpha.
* C++ Library: [src/cpp] (src/cpp) : Early adopter ready - Alpha.
* Python Library: [src/python] (src/python) : Early adopter ready - Alpha.
* Ruby Library: [src/ruby] (src/ruby) : Early adopter ready - Alpha.
* NodeJS Library: [src/node] (src/node) : Early adopter ready - Alpha.
* Python Library: [src/python] (src/python) : Usable with limitations - Pre-Alpha.
* PHP Library: [src/php] (src/php) : Pre-Alpha.
* C# Library: [src/csharp] (src/csharp) : Pre-Alpha.
* Objective-C Library: [src/objective-c] (src/objective-c): Pre-Alpha.

@ -3,7 +3,7 @@
"#": "The public version number of the library.",
"version": {
"major": 0,
"minor": 8,
"minor": 5,
"micro": 0,
"build": 0
}
@ -582,7 +582,8 @@
"grpc",
"gpr_test_util",
"gpr"
]
],
"flaky": true
},
{
"name": "census_statistics_multiple_writers_test",
@ -638,7 +639,8 @@
"grpc",
"gpr_test_util",
"gpr"
]
],
"flaky": true
},
{
"name": "census_stats_store_test",
@ -866,7 +868,8 @@
"grpc",
"gpr_test_util",
"gpr"
]
],
"flaky": true
},
{
"name": "fling_test",
@ -880,7 +883,8 @@
"grpc",
"gpr_test_util",
"gpr"
]
],
"flaky": true
},
{
"name": "gen_hpack_tables",
@ -1815,6 +1819,24 @@
"gpr"
]
},
{
"name": "qps_client_async",
"build": "test",
"run": false,
"language": "c++",
"src": [
"test/cpp/qps/qpstest.proto",
"test/cpp/qps/client_async.cc"
],
"deps": [
"grpc++_test_util",
"grpc_test_util",
"grpc++",
"grpc",
"gpr_test_util",
"gpr"
]
},
{
"name": "qps_server",
"build": "test",
@ -1833,6 +1855,24 @@
"gpr"
]
},
{
"name": "qps_server_async",
"build": "test",
"run": false,
"language": "c++",
"src": [
"test/cpp/qps/qpstest.proto",
"test/cpp/qps/server_async.cc"
],
"deps": [
"grpc++_test_util",
"grpc_test_util",
"grpc++",
"grpc",
"gpr_test_util",
"gpr"
]
},
{
"name": "status_test",
"build": "test",

@ -1,3 +1,6 @@
Experimental example code, likely to change.
Users should not attempt to run this code till this warning is removed.
C++ Client implementation for Cloud Pub/Sub service
(https://developers.google.com/apis-explorer/#p/pubsub/v1beta1/).
@ -12,19 +15,7 @@ be created with scope "https://www.googleapis.com/auth/cloud-platform" as below:
gcloud compute instances create instance-name
--image debian-7 --scopes https://www.googleapis.com/auth/cloud-platform
Google TLS cert is required to run the client, which can be downloaded from
Chrome browser.
To run the client from GCE:
make pubsub_client
GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="Google TLS cert" bins/opt/pubsub_client
--project_id="your project id"
A service account credential is required to run the client from other
environments, which can be generated as a JSON key file from
https://console.developers.google.com/project/. To run the client with a service
account credential:
GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="Google TLS cert" bins/opt/pubsub_client
--project_id="your project id"
--service_account_key_file="absolute path to the JSON key file"
To run the client:
make pubsub_client
bins/opt/pubsub_client --project_id="your project id"

@ -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

@ -61,28 +61,28 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {
public:
Status CreateTopic(::grpc::ServerContext* context,
const ::tech::pubsub::Topic* request,
::tech::pubsub::Topic* response) override {
::tech::pubsub::Topic* response) GRPC_OVERRIDE {
EXPECT_EQ(request->name(), kTopic);
return Status::OK;
}
Status Publish(ServerContext* context,
const ::tech::pubsub::PublishRequest* request,
::proto2::Empty* response) override {
::proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->message().data(), kMessageData);
return Status::OK;
}
Status GetTopic(ServerContext* context,
const ::tech::pubsub::GetTopicRequest* request,
::tech::pubsub::Topic* response) override {
::tech::pubsub::Topic* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
return Status::OK;
}
Status ListTopics(ServerContext* context,
const ::tech::pubsub::ListTopicsRequest* request,
::tech::pubsub::ListTopicsResponse* response) override {
Status ListTopics(
ServerContext* context, const ::tech::pubsub::ListTopicsRequest* request,
::tech::pubsub::ListTopicsResponse* response) GRPC_OVERRIDE {
std::ostringstream ss;
ss << "cloud.googleapis.com/project in (/projects/" << kProjectId << ")";
EXPECT_EQ(request->query(), ss.str());
@ -92,7 +92,7 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {
Status DeleteTopic(ServerContext* context,
const ::tech::pubsub::DeleteTopicRequest* request,
::proto2::Empty* response) override {
::proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
return Status::OK;
}
@ -102,7 +102,7 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {
class PublisherTest : public ::testing::Test {
protected:
// Setup a server and a client for PublisherService.
void SetUp() override {
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
ServerBuilder builder;
@ -116,7 +116,7 @@ class PublisherTest : public ::testing::Test {
publisher_.reset(new grpc::examples::pubsub::Publisher(channel_));
}
void TearDown() override {
void TearDown() GRPC_OVERRIDE {
server_->Shutdown();
publisher_->Shutdown();
}

@ -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

@ -57,9 +57,9 @@ const char kData[] = "Message data";
class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
public:
Status CreateSubscription(ServerContext* context,
const tech::pubsub::Subscription* request,
tech::pubsub::Subscription* response) override {
Status CreateSubscription(
ServerContext* context, const tech::pubsub::Subscription* request,
tech::pubsub::Subscription* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
EXPECT_EQ(request->name(), kSubscriptionName);
return Status::OK;
@ -67,7 +67,7 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
Status GetSubscription(ServerContext* context,
const tech::pubsub::GetSubscriptionRequest* request,
tech::pubsub::Subscription* response) override {
tech::pubsub::Subscription* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
response->set_topic(kTopic);
return Status::OK;
@ -76,14 +76,13 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
Status DeleteSubscription(
ServerContext* context,
const tech::pubsub::DeleteSubscriptionRequest* request,
proto2::Empty* response) override {
proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
return Status::OK;
}
Status Pull(ServerContext* context,
const tech::pubsub::PullRequest* request,
tech::pubsub::PullResponse* response) override {
Status Pull(ServerContext* context, const tech::pubsub::PullRequest* request,
tech::pubsub::PullResponse* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
response->set_ack_id("1");
response->mutable_pubsub_event()->mutable_message()->set_data(kData);
@ -92,7 +91,7 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
Status Acknowledge(ServerContext* context,
const tech::pubsub::AcknowledgeRequest* request,
proto2::Empty* response) override {
proto2::Empty* response) GRPC_OVERRIDE {
return Status::OK;
}
@ -101,7 +100,7 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
class SubscriberTest : public ::testing::Test {
protected:
// Setup a server and a client for SubscriberService.
void SetUp() override {
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
ServerBuilder builder;
@ -115,7 +114,7 @@ class SubscriberTest : public ::testing::Test {
subscriber_.reset(new grpc::examples::pubsub::Subscriber(channel_));
}
void TearDown() override {
void TearDown() GRPC_OVERRIDE {
server_->Shutdown();
subscriber_->Shutdown();
}

@ -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>
@ -45,7 +45,7 @@
namespace grpc {
template <class R>
class ClientAsyncResponseReader final {
class ClientAsyncResponseReader GRPC_FINAL {
public:
ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
@ -79,7 +79,7 @@ class ClientAsyncResponseReader final {
private:
ClientContext* context_ = nullptr;
ClientContext* context_;
Call call_;
CallOpBuffer init_buf_;
CallOpBuffer meta_buf_;
@ -87,7 +87,8 @@ class ClientAsyncResponseReader final {
};
template <class W>
class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface {
class ServerAsyncResponseWriter GRPC_FINAL
: public ServerAsyncStreamingInterface {
public:
explicit ServerAsyncResponseWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
@ -127,7 +128,7 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface {
}
private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
@ -137,4 +138,4 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface {
} // 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>
@ -82,4 +82,4 @@ class ChannelArguments {
} // namespace grpc
#endif // __GRPCPP_CHANNEL_ARGUMENTS_H_
#endif // GRPCXX_CHANNEL_ARGUMENTS_H

@ -31,8 +31,8 @@
*
*/
#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>
@ -63,4 +63,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>
@ -139,7 +139,7 @@ class ClientContext {
return authority_;
}
bool initial_metadata_received_ = false;
bool initial_metadata_received_;
grpc_call *call_;
grpc_completion_queue *cq_;
gpr_timespec absolute_deadline_;
@ -151,4 +151,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>
@ -121,4 +121,4 @@ class CompletionQueue {
} // namespace grpc
#endif // __GRPCPP_COMPLETION_QUEUE_H__
#endif // GRPCXX_COMPLETION_QUEUE_H

@ -31,15 +31,23 @@
*
*/
#ifndef __GRPCPP_CONFIG_H__
#define __GRPCPP_CONFIG_H__
#ifndef GRPCXX_CONFIG_H
#define GRPCXX_CONFIG_H
#include <string>
#ifdef GRPC_OLD_CXX
#define GRPC_FINAL
#define GRPC_OVERRIDE
#else
#define GRPC_FINAL final
#define GRPC_OVERRIDE override
#endif
namespace grpc {
typedef std::string string;
} // 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>
@ -55,4 +55,4 @@ std::shared_ptr<ChannelInterface> CreateChannel(
} // namespace grpc
#endif // __GRPCPP_CREATE_CHANNEL_H__
#endif // GRPCXX_CREATE_CHANNEL_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_CREDENTIALS_H_
#define __GRPCPP_CREDENTIALS_H_
#ifndef GRPCXX_CREDENTIALS_H
#define GRPCXX_CREDENTIALS_H
#include <chrono>
#include <memory>
@ -47,7 +47,7 @@ namespace grpc {
// to creating an instance using CredentialsFactory, and passing it down
// during channel construction.
class Credentials final {
class Credentials GRPC_FINAL {
public:
~Credentials();
@ -133,4 +133,4 @@ class CredentialsFactory {
} // namespace grpc
#endif // __GRPCPP_CREDENTIALS_H_
#endif // GRPCXX_CREDENTIALS_H

@ -31,10 +31,11 @@
*
*/
#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>
#include <grpc++/status.h>
#include <grpc++/completion_queue.h>
@ -56,7 +57,7 @@ class Call;
class CallOpBuffer : public CompletionQueueTag {
public:
CallOpBuffer() : return_tag_(this) {}
CallOpBuffer();
~CallOpBuffer();
void Reset(void *next_return_tag);
@ -80,40 +81,40 @@ class CallOpBuffer : public CompletionQueueTag {
void FillOps(grpc_op *ops, size_t *nops);
// Called by completion queue just prior to returning from Next() or Pluck()
bool FinalizeResult(void **tag, bool *status) override;
bool FinalizeResult(void **tag, bool *status) GRPC_OVERRIDE;
bool got_message = false;
bool got_message;
private:
void *return_tag_ = nullptr;
void *return_tag_;
// Send initial metadata
bool send_initial_metadata_ = false;
size_t initial_metadata_count_ = 0;
grpc_metadata *initial_metadata_ = nullptr;
bool send_initial_metadata_;
size_t initial_metadata_count_;
grpc_metadata *initial_metadata_;
// Recv initial metadta
std::multimap<grpc::string, grpc::string> *recv_initial_metadata_ = nullptr;
grpc_metadata_array recv_initial_metadata_arr_ = {0, 0, nullptr};
std::multimap<grpc::string, grpc::string> *recv_initial_metadata_;
grpc_metadata_array recv_initial_metadata_arr_;
// Send message
const google::protobuf::Message *send_message_ = nullptr;
grpc_byte_buffer *send_message_buf_ = nullptr;
const google::protobuf::Message *send_message_;
grpc_byte_buffer *send_message_buf_;
// Recv message
google::protobuf::Message *recv_message_ = nullptr;
grpc_byte_buffer *recv_message_buf_ = nullptr;
google::protobuf::Message *recv_message_;
grpc_byte_buffer *recv_message_buf_;
// Client send close
bool client_send_close_ = false;
bool client_send_close_;
// Client recv status
std::multimap<grpc::string, grpc::string> *recv_trailing_metadata_ = nullptr;
Status *recv_status_ = nullptr;
grpc_metadata_array recv_trailing_metadata_arr_ = {0, 0, nullptr};
grpc_status_code status_code_ = GRPC_STATUS_OK;
char *status_details_ = nullptr;
size_t status_details_capacity_ = 0;
std::multimap<grpc::string, grpc::string> *recv_trailing_metadata_;
Status *recv_status_;
grpc_metadata_array recv_trailing_metadata_arr_;
grpc_status_code status_code_;
char *status_details_;
size_t status_details_capacity_;
// Server send status
const Status *send_status_ = nullptr;
size_t trailing_metadata_count_ = 0;
grpc_metadata *trailing_metadata_ = nullptr;
const Status *send_status_;
size_t trailing_metadata_count_;
grpc_metadata *trailing_metadata_;
int cancelled_buf_;
bool *recv_closed_ = nullptr;
bool *recv_closed_;
};
// Channel and Server implement this to allow them to hook performing ops
@ -124,7 +125,7 @@ class CallHook {
};
// Straightforward wrapping of the C call object
class Call final {
class Call GRPC_FINAL {
public:
/* call is owned by the caller */
Call(grpc_call *call, CallHook *call_hook_, CompletionQueue *cq);
@ -142,4 +143,4 @@ class Call final {
} // namespace grpc
#endif // __GRPCPP_CALL_INTERFACE_H__
#endif // GRPCXX_IMPL_CALL_H

@ -31,8 +31,8 @@
*
*/
#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 {
@ -56,4 +56,4 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method,
} // 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,8 +31,8 @@
*
*/
#ifndef __GRPCPP_IMPL_RPC_METHOD_H__
#define __GRPCPP_IMPL_RPC_METHOD_H__
#ifndef GRPCXX_IMPL_RPC_METHOD_H
#define GRPCXX_IMPL_RPC_METHOD_H
namespace google {
namespace protobuf {
@ -66,4 +66,4 @@ class RpcMethod {
} // namespace grpc
#endif // __GRPCPP_IMPL_RPC_METHOD_H__
#endif // GRPCXX_IMPL_RPC_METHOD_H

@ -31,8 +31,8 @@
*
*/
#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>
@ -77,7 +77,7 @@ class RpcMethodHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
// Invoke application function, cast proto messages to their actual types.
return func_(service_, param.server_context,
dynamic_cast<const RequestType*>(param.request),
@ -102,7 +102,7 @@ class ClientStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerReader<RequestType> reader(param.call, param.server_context);
return func_(service_, param.server_context, &reader,
dynamic_cast<ResponseType*>(param.response));
@ -124,7 +124,7 @@ class ServerStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerWriter<ResponseType> writer(param.call, param.server_context);
return func_(service_, param.server_context,
dynamic_cast<const RequestType*>(param.request), &writer);
@ -147,7 +147,7 @@ class BidiStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}
Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerReaderWriter<ResponseType, RequestType> stream(param.call,
param.server_context);
return func_(service_, param.server_context, &stream);
@ -203,4 +203,4 @@ class RpcService {
} // namespace grpc
#endif // __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__
#endif // GRPCXX_IMPL_RPC_SERVICE_METHOD_H

@ -31,8 +31,8 @@
*
*/
#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 {
@ -79,7 +79,11 @@ class AsynchronousService {
AsynchronousService(CompletionQueue* cq, const char** method_names,
size_t method_count)
: cq_(cq), method_names_(method_names), method_count_(method_count) {}
: cq_(cq),
dispatch_impl_(nullptr),
method_names_(method_names),
method_count_(method_count),
request_args_(nullptr) {}
~AsynchronousService() { delete[] request_args_; }
@ -116,12 +120,12 @@ class AsynchronousService {
private:
friend class Server;
CompletionQueue* const cq_;
DispatchImpl* dispatch_impl_ = nullptr;
DispatchImpl* dispatch_impl_;
const char** const method_names_;
size_t method_count_;
void** request_args_ = nullptr;
void** request_args_;
};
} // 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>
@ -61,8 +61,8 @@ class ServerCredentials;
class ThreadPoolInterface;
// Currently it only supports handling rpcs in a single thread.
class Server final : private CallHook,
private AsynchronousService::DispatchImpl {
class Server GRPC_FINAL : private CallHook,
private AsynchronousService::DispatchImpl {
public:
~Server();
@ -97,7 +97,7 @@ class Server final : private CallHook,
void RunRpc();
void ScheduleCallback();
void PerformOpsOnCall(CallOpBuffer* ops, Call* call) override;
void PerformOpsOnCall(CallOpBuffer* ops, Call* call) GRPC_OVERRIDE;
// DispatchImpl
void RequestAsyncCall(void* registered_method, ServerContext* context,
@ -130,4 +130,4 @@ class Server final : private CallHook,
} // 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>
@ -83,9 +83,9 @@ class ServerBuilder {
std::vector<AsynchronousService*> async_services_;
std::vector<grpc::string> ports_;
std::shared_ptr<ServerCredentials> creds_;
ThreadPoolInterface* thread_pool_ = nullptr;
ThreadPoolInterface* thread_pool_;
};
} // namespace grpc
#endif // __GRPCPP_SERVER_BUILDER_H__
#endif // GRPCXX_SERVER_BUILDER_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_SERVER_CONTEXT_H_
#define __GRPCPP_SERVER_CONTEXT_H_
#ifndef GRPCXX_SERVER_CONTEXT_H
#define GRPCXX_SERVER_CONTEXT_H
#include <chrono>
#include <map>
@ -66,7 +66,7 @@ class CompletionQueue;
class Server;
// Interface of server side rpc context.
class ServerContext final {
class ServerContext GRPC_FINAL {
public:
ServerContext(); // for async calls
~ServerContext();
@ -108,12 +108,12 @@ class ServerContext final {
ServerContext(gpr_timespec deadline, grpc_metadata* metadata,
size_t metadata_count);
CompletionOp* completion_op_ = nullptr;
CompletionOp* completion_op_;
std::chrono::system_clock::time_point deadline_;
grpc_call* call_ = nullptr;
CompletionQueue* cq_ = nullptr;
bool sent_initial_metadata_ = false;
grpc_call* call_;
CompletionQueue* cq_;
bool sent_initial_metadata_;
std::multimap<grpc::string, grpc::string> client_metadata_;
std::multimap<grpc::string, grpc::string> initial_metadata_;
std::multimap<grpc::string, grpc::string> trailing_metadata_;
@ -121,4 +121,4 @@ class ServerContext final {
} // namespace grpc
#endif // __GRPCPP_SERVER_CONTEXT_H_
#endif // GRPCXX_SERVER_CONTEXT_H

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPCPP_SERVER_CREDENTIALS_H_
#define __GRPCPP_SERVER_CREDENTIALS_H_
#ifndef GRPCXX_SERVER_CREDENTIALS_H
#define GRPCXX_SERVER_CREDENTIALS_H
#include <memory>
#include <vector>
@ -44,7 +44,7 @@ struct grpc_server_credentials;
namespace grpc {
// grpc_server_credentials wrapper class.
class ServerCredentials final {
class ServerCredentials GRPC_FINAL {
public:
~ServerCredentials();
@ -79,4 +79,4 @@ class ServerCredentialsFactory {
} // 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,8 +31,8 @@
*
*/
#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 {
@ -195,4 +195,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>
@ -83,8 +83,8 @@ class WriterInterface {
};
template <class R>
class ClientReader final : public ClientStreamingInterface,
public ReaderInterface<R> {
class ClientReader GRPC_FINAL : public ClientStreamingInterface,
public ReaderInterface<R> {
public:
// Blocking create a stream and write the first request out.
ClientReader(ChannelInterface* channel, const RpcMethod& method,
@ -111,7 +111,7 @@ class ClientReader final : public ClientStreamingInterface,
GPR_ASSERT(cq_.Pluck(&buf));
}
virtual bool Read(R* msg) override {
virtual bool Read(R* msg) GRPC_OVERRIDE {
CallOpBuffer buf;
if (!context_->initial_metadata_received_) {
buf.AddRecvInitialMetadata(context_);
@ -121,7 +121,7 @@ class ClientReader final : public ClientStreamingInterface,
return cq_.Pluck(&buf) && buf.got_message;
}
virtual Status Finish() override {
virtual Status Finish() GRPC_OVERRIDE {
CallOpBuffer buf;
Status status;
buf.AddClientRecvStatus(context_, &status);
@ -137,8 +137,8 @@ class ClientReader final : public ClientStreamingInterface,
};
template <class W>
class ClientWriter final : public ClientStreamingInterface,
public WriterInterface<W> {
class ClientWriter GRPC_FINAL : public ClientStreamingInterface,
public WriterInterface<W> {
public:
// Blocking create a stream.
ClientWriter(ChannelInterface* channel, const RpcMethod& method,
@ -152,7 +152,7 @@ class ClientWriter final : public ClientStreamingInterface,
cq_.Pluck(&buf);
}
virtual bool Write(const W& msg) override {
virtual bool Write(const W& msg) GRPC_OVERRIDE {
CallOpBuffer buf;
buf.AddSendMessage(msg);
call_.PerformOps(&buf);
@ -167,7 +167,7 @@ class ClientWriter final : public ClientStreamingInterface,
}
// Read the final response and wait for the final status.
virtual Status Finish() override {
virtual Status Finish() GRPC_OVERRIDE {
CallOpBuffer buf;
Status status;
buf.AddRecvMessage(response_);
@ -186,9 +186,9 @@ class ClientWriter final : public ClientStreamingInterface,
// Client-side interface for bi-directional streaming.
template <class W, class R>
class ClientReaderWriter final : public ClientStreamingInterface,
public WriterInterface<W>,
public ReaderInterface<R> {
class ClientReaderWriter GRPC_FINAL : public ClientStreamingInterface,
public WriterInterface<W>,
public ReaderInterface<R> {
public:
// Blocking create a stream.
ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method,
@ -213,7 +213,7 @@ class ClientReaderWriter final : public ClientStreamingInterface,
GPR_ASSERT(cq_.Pluck(&buf));
}
virtual bool Read(R* msg) override {
virtual bool Read(R* msg) GRPC_OVERRIDE {
CallOpBuffer buf;
if (!context_->initial_metadata_received_) {
buf.AddRecvInitialMetadata(context_);
@ -223,7 +223,7 @@ class ClientReaderWriter final : public ClientStreamingInterface,
return cq_.Pluck(&buf) && buf.got_message;
}
virtual bool Write(const W& msg) override {
virtual bool Write(const W& msg) GRPC_OVERRIDE {
CallOpBuffer buf;
buf.AddSendMessage(msg);
call_.PerformOps(&buf);
@ -237,7 +237,7 @@ class ClientReaderWriter final : public ClientStreamingInterface,
return cq_.Pluck(&buf);
}
virtual Status Finish() override {
virtual Status Finish() GRPC_OVERRIDE {
CallOpBuffer buf;
Status status;
buf.AddClientRecvStatus(context_, &status);
@ -253,7 +253,7 @@ class ClientReaderWriter final : public ClientStreamingInterface,
};
template <class R>
class ServerReader final : public ReaderInterface<R> {
class ServerReader GRPC_FINAL : public ReaderInterface<R> {
public:
ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
@ -267,7 +267,7 @@ class ServerReader final : public ReaderInterface<R> {
call_->cq()->Pluck(&buf);
}
virtual bool Read(R* msg) override {
virtual bool Read(R* msg) GRPC_OVERRIDE {
CallOpBuffer buf;
buf.AddRecvMessage(msg);
call_->PerformOps(&buf);
@ -280,7 +280,7 @@ class ServerReader final : public ReaderInterface<R> {
};
template <class W>
class ServerWriter final : public WriterInterface<W> {
class ServerWriter GRPC_FINAL : public WriterInterface<W> {
public:
ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
@ -294,7 +294,7 @@ class ServerWriter final : public WriterInterface<W> {
call_->cq()->Pluck(&buf);
}
virtual bool Write(const W& msg) override {
virtual bool Write(const W& msg) GRPC_OVERRIDE {
CallOpBuffer buf;
if (!ctx_->sent_initial_metadata_) {
buf.AddSendInitialMetadata(&ctx_->initial_metadata_);
@ -312,8 +312,8 @@ class ServerWriter final : public WriterInterface<W> {
// Server-side interface for bi-directional streaming.
template <class W, class R>
class ServerReaderWriter final : public WriterInterface<W>,
public ReaderInterface<R> {
class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
public ReaderInterface<R> {
public:
ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
@ -327,14 +327,14 @@ class ServerReaderWriter final : public WriterInterface<W>,
call_->cq()->Pluck(&buf);
}
virtual bool Read(R* msg) override {
virtual bool Read(R* msg) GRPC_OVERRIDE {
CallOpBuffer buf;
buf.AddRecvMessage(msg);
call_->PerformOps(&buf);
return call_->cq()->Pluck(&buf) && buf.got_message;
}
virtual bool Write(const W& msg) override {
virtual bool Write(const W& msg) GRPC_OVERRIDE {
CallOpBuffer buf;
if (!ctx_->sent_initial_metadata_) {
buf.AddSendInitialMetadata(&ctx_->initial_metadata_);
@ -380,8 +380,8 @@ class AsyncWriterInterface {
};
template <class R>
class ClientAsyncReader final : public ClientAsyncStreamingInterface,
public AsyncReaderInterface<R> {
class ClientAsyncReader GRPC_FINAL : public ClientAsyncStreamingInterface,
public AsyncReaderInterface<R> {
public:
// Create a stream and write the first request out.
ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq,
@ -395,7 +395,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
call_.PerformOps(&init_buf_);
}
void ReadInitialMetadata(void* tag) override {
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
meta_buf_.Reset(tag);
@ -403,7 +403,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Read(R* msg, void* tag) override {
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
read_buf_.AddRecvInitialMetadata(context_);
@ -412,7 +412,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
call_.PerformOps(&read_buf_);
}
void Finish(Status* status, void* tag) override {
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
finish_buf_.AddRecvInitialMetadata(context_);
@ -422,7 +422,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
}
private:
ClientContext* context_ = nullptr;
ClientContext* context_;
Call call_;
CallOpBuffer init_buf_;
CallOpBuffer meta_buf_;
@ -431,8 +431,8 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface,
};
template <class W>
class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W> {
class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W> {
public:
ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
@ -445,7 +445,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&init_buf_);
}
void ReadInitialMetadata(void* tag) override {
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
meta_buf_.Reset(tag);
@ -453,7 +453,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Write(const W& msg, void* tag) override {
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_buf_.Reset(tag);
write_buf_.AddSendMessage(msg);
call_.PerformOps(&write_buf_);
@ -465,7 +465,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&writes_done_buf_);
}
void Finish(Status* status, void* tag) override {
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
finish_buf_.AddRecvInitialMetadata(context_);
@ -476,7 +476,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
}
private:
ClientContext* context_ = nullptr;
ClientContext* context_;
google::protobuf::Message* const response_;
Call call_;
CallOpBuffer init_buf_;
@ -488,9 +488,9 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface,
// Client-side interface for bi-directional streaming.
template <class W, class R>
class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
class ClientAsyncReaderWriter GRPC_FINAL : public ClientAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
public:
ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
@ -501,7 +501,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&init_buf_);
}
void ReadInitialMetadata(void* tag) override {
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);
meta_buf_.Reset(tag);
@ -509,7 +509,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Read(R* msg, void* tag) override {
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
read_buf_.AddRecvInitialMetadata(context_);
@ -518,7 +518,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&read_buf_);
}
void Write(const W& msg, void* tag) override {
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_buf_.Reset(tag);
write_buf_.AddSendMessage(msg);
call_.PerformOps(&write_buf_);
@ -530,7 +530,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
call_.PerformOps(&writes_done_buf_);
}
void Finish(Status* status, void* tag) override {
void Finish(Status* status, void* tag) GRPC_OVERRIDE {
finish_buf_.Reset(tag);
if (!context_->initial_metadata_received_) {
finish_buf_.AddRecvInitialMetadata(context_);
@ -540,7 +540,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
}
private:
ClientContext* context_ = nullptr;
ClientContext* context_;
Call call_;
CallOpBuffer init_buf_;
CallOpBuffer meta_buf_;
@ -551,13 +551,13 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface,
};
template <class W, class R>
class ServerAsyncReader : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncReaderInterface<R> {
public:
explicit ServerAsyncReader(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) override {
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.Reset(tag);
@ -566,7 +566,7 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Read(R* msg, void* tag) override {
void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_buf_.Reset(tag);
read_buf_.AddRecvMessage(msg);
call_.PerformOps(&read_buf_);
@ -598,7 +598,7 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface,
}
private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
@ -608,13 +608,13 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface,
};
template <class W>
class ServerAsyncWriter : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W> {
public:
explicit ServerAsyncWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) override {
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.Reset(tag);
@ -623,7 +623,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
void Write(const W& msg, void* tag) override {
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_buf_.Reset(tag);
if (!ctx_->sent_initial_metadata_) {
write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_);
@ -644,7 +644,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface,
}
private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
@ -655,14 +655,14 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface,
// Server-side interface for bi-directional streaming.
template <class W, class R>
class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
public AsyncWriterInterface<W>,
public AsyncReaderInterface<R> {
public:
explicit ServerAsyncReaderWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) override {
void SendInitialMetadata(void* tag) GRPC_OVERRIDE {
GPR_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.Reset(tag);
@ -671,13 +671,13 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface,
call_.PerformOps(&meta_buf_);
}
virtual void Read(R* msg, void* tag) override {
virtual void Read(R* msg, void* tag) GRPC_OVERRIDE {
read_buf_.Reset(tag);
read_buf_.AddRecvMessage(msg);
call_.PerformOps(&read_buf_);
}
virtual void Write(const W& msg, void* tag) override {
virtual void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_buf_.Reset(tag);
if (!ctx_->sent_initial_metadata_) {
write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_);
@ -698,7 +698,7 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface,
}
private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }
Call call_;
ServerContext* ctx_;
@ -710,4 +710,4 @@ class ServerAsyncReaderWriter : 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>
@ -632,4 +632,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"
@ -185,4 +185,4 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr);
}
#endif
#endif /* GRPC_SECURITY_H_ */
#endif /* GRPC_GRPC_SECURITY_H */

@ -31,8 +31,8 @@
*
*/
#ifndef __GRPC_STATUS_H__
#define __GRPC_STATUS_H__
#ifndef GRPC_STATUS_H
#define GRPC_STATUS_H
#ifdef __cplusplus
extern "C" {
@ -199,4 +199,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,8 @@
*
*/
#ifndef __GRPC_SUPPORT_HISTOGRAM_H__
#define __GRPC_SUPPORT_HISTOGRAM_H__
#ifndef GRPC_SUPPORT_HISTOGRAM_H
#define GRPC_SUPPORT_HISTOGRAM_H
#ifdef __cplusplus
extern "C" {
@ -63,4 +63,4 @@ double gpr_histogram_sum_of_squares(gpr_histogram *histogram);
}
#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>
@ -81,4 +81,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");
}
}
@ -300,13 +300,13 @@ void PrintHeaderService(google::protobuf::io::Printer *printer,
(*vars)["Service"] = service->name();
printer->Print(*vars,
"class $Service$ final {\n"
"class $Service$ GRPC_FINAL {\n"
" public:\n");
printer->Indent();
// Client side
printer->Print(
"class Stub final : public ::grpc::InternalStub {\n"
"class Stub GRPC_FINAL : public ::grpc::InternalStub {\n"
" public:\n");
printer->Indent();
for (int i = 0; i < service->method_count(); ++i) {
@ -331,7 +331,7 @@ void PrintHeaderService(google::protobuf::io::Printer *printer,
for (int i = 0; i < service->method_count(); ++i) {
PrintHeaderServerMethodSync(printer, service->method(i), vars);
}
printer->Print("::grpc::RpcService* service() override final;\n");
printer->Print("::grpc::RpcService* service() GRPC_OVERRIDE GRPC_FINAL;\n");
printer->Outdent();
printer->Print(
" private:\n"
@ -340,7 +340,7 @@ void PrintHeaderService(google::protobuf::io::Printer *printer,
// Server side - Asynchronous
printer->Print(
"class AsyncService final : public ::grpc::AsynchronousService {\n"
"class AsyncService GRPC_FINAL : public ::grpc::AsynchronousService {\n"
" public:\n");
printer->Indent();
(*vars)["MethodCount"] = as_string(service->method_count());
@ -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< "
@ -609,7 +609,7 @@ void PrintSourceService(google::protobuf::io::Printer *printer,
" std::unique_ptr< $Service$::Stub> stub(new $Service$::Stub());\n"
" stub->set_channel(channel);\n"
" return stub;\n"
"};\n\n");
"}\n\n");
for (int i = 0; i < service->method_count(); ++i) {
(*vars)["Idx"] = as_string(i);
PrintSourceClientMethod(printer, service->method(i), vars);

@ -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,57 +31,23 @@
*
*/
#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>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor.pb.h>
#include "src/compiler/generator_helpers.h"
namespace grpc_cpp_generator {
inline bool StripSuffix(std::string *filename, const std::string &suffix) {
if (filename->length() >= suffix.length()) {
size_t suffix_pos = filename->length() - suffix.length();
if (filename->compare(suffix_pos, std::string::npos, suffix) == 0) {
filename->resize(filename->size() - suffix.size());
return true;
}
}
return false;
}
inline std::string StripProto(std::string filename) {
if (!StripSuffix(&filename, ".protodevel")) {
StripSuffix(&filename, ".proto");
}
return filename;
}
inline std::string StringReplace(std::string str, const std::string &from,
const std::string &to) {
size_t pos = 0;
for (;;) {
pos = str.find(from, pos);
if (pos == std::string::npos) {
break;
}
str.replace(pos, from.length(), to);
pos += to.length();
}
return str;
}
inline std::string DotsToColons(const std::string &name) {
return StringReplace(name, ".", "::");
return grpc_generator::StringReplace(name, ".", "::");
}
inline std::string DotsToUnderscores(const std::string &name) {
return StringReplace(name, ".", "_");
return grpc_generator::StringReplace(name, ".", "_");
}
inline std::string ClassName(const google::protobuf::Descriptor *descriptor,
@ -103,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

@ -63,7 +63,7 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
return false;
}
std::string file_name = grpc_cpp_generator::StripProto(file->name());
std::string file_name = grpc_generator::StripProto(file->name());
// Generate .pb.h
Insert(context, file_name + ".pb.h", "includes",

@ -0,0 +1,79 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
#define GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H
#include <map>
#include <string>
namespace grpc_generator {
inline bool StripSuffix(std::string *filename, const std::string &suffix) {
if (filename->length() >= suffix.length()) {
size_t suffix_pos = filename->length() - suffix.length();
if (filename->compare(suffix_pos, std::string::npos, suffix) == 0) {
filename->resize(filename->size() - suffix.size());
return true;
}
}
return false;
}
inline std::string StripProto(std::string filename) {
if (!StripSuffix(&filename, ".protodevel")) {
StripSuffix(&filename, ".proto");
}
return filename;
}
inline std::string StringReplace(std::string str, const std::string &from,
const std::string &to) {
size_t pos = 0;
for (;;) {
pos = str.find(from, pos);
if (pos == std::string::npos) {
break;
}
str.replace(pos, from.length(), to);
pos += to.length();
}
return str;
}
} // namespace grpc_generator
#endif // GRPC_INTERNAL_COMPILER_GENERATOR_HELPERS_H

@ -31,26 +31,38 @@
*
*/
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstring>
#include <map>
#include <ostream>
#include <sstream>
#include <vector>
#include "src/compiler/generator_helpers.h"
#include "src/compiler/python_generator.h"
#include <google/protobuf/io/printer.h>
#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/descriptor.h>
using grpc_generator::StringReplace;
using grpc_generator::StripProto;
using google::protobuf::Descriptor;
using google::protobuf::FileDescriptor;
using google::protobuf::ServiceDescriptor;
using google::protobuf::MethodDescriptor;
using google::protobuf::ServiceDescriptor;
using google::protobuf::io::Printer;
using google::protobuf::io::StringOutputStream;
using std::initializer_list;
using std::make_pair;
using std::map;
using std::pair;
using std::replace;
using std::string;
using std::strlen;
using std::vector;
namespace grpc_python_generator {
namespace {
@ -99,62 +111,81 @@ class IndentScope {
// END FORMATTING BOILERPLATE //
////////////////////////////////
void PrintService(const ServiceDescriptor* service,
Printer* out) {
bool PrintServicer(const ServiceDescriptor* service,
Printer* out) {
string doc = "<fill me in later!>";
map<string, string> dict = ListToDict({
"Service", service->name(),
"Documentation", doc,
});
out->Print(dict, "class $Service$Service(object):\n");
out->Print(dict, "class EarlyAdopter$Service$Servicer(object):\n");
{
IndentScope raii_class_indent(out);
out->Print(dict, "\"\"\"$Documentation$\"\"\"\n");
out->Print("def __init__(self):\n");
{
IndentScope raii_method_indent(out);
out->Print("pass\n");
out->Print("__metaclass__ = abc.ABCMeta\n");
for (int i = 0; i < service->method_count(); ++i) {
auto meth = service->method(i);
string arg_name = meth->client_streaming() ?
"request_iterator" : "request";
out->Print("@abc.abstractmethod\n");
out->Print("def $Method$(self, $ArgName$, context):\n",
"Method", meth->name(), "ArgName", arg_name);
{
IndentScope raii_method_indent(out);
out->Print("raise NotImplementedError()\n");
}
}
}
return true;
}
void PrintServicer(const ServiceDescriptor* service,
Printer* out) {
bool PrintServer(const ServiceDescriptor* service, Printer* out) {
string doc = "<fill me in later!>";
map<string, string> dict = ListToDict({
"Service", service->name(),
"Documentation", doc,
});
out->Print(dict, "class $Service$Servicer(object):\n");
out->Print(dict, "class EarlyAdopter$Service$Server(object):\n");
{
IndentScope raii_class_indent(out);
out->Print(dict, "\"\"\"$Documentation$\"\"\"\n");
for (int i = 0; i < service->method_count(); ++i) {
auto meth = service->method(i);
out->Print("def $Method$(self, arg):\n", "Method", meth->name());
{
IndentScope raii_method_indent(out);
out->Print("raise NotImplementedError()\n");
}
out->Print("__metaclass__ = abc.ABCMeta\n");
out->Print("@abc.abstractmethod\n");
out->Print("def start(self):\n");
{
IndentScope raii_method_indent(out);
out->Print("raise NotImplementedError()\n");
}
out->Print("@abc.abstractmethod\n");
out->Print("def stop(self):\n");
{
IndentScope raii_method_indent(out);
out->Print("raise NotImplementedError()\n");
}
}
return true;
}
void PrintStub(const ServiceDescriptor* service,
bool PrintStub(const ServiceDescriptor* service,
Printer* out) {
string doc = "<fill me in later!>";
map<string, string> dict = ListToDict({
"Service", service->name(),
"Documentation", doc,
});
out->Print(dict, "class $Service$Stub(object):\n");
out->Print(dict, "class EarlyAdopter$Service$Stub(object):\n");
{
IndentScope raii_class_indent(out);
out->Print(dict, "\"\"\"$Documentation$\"\"\"\n");
out->Print("__metaclass__ = abc.ABCMeta\n");
for (int i = 0; i < service->method_count(); ++i) {
const MethodDescriptor* meth = service->method(i);
auto methdict = ListToDict({"Method", meth->name()});
out->Print(methdict, "def $Method$(self, arg):\n");
string arg_name = meth->client_streaming() ?
"request_iterator" : "request";
auto methdict = ListToDict({"Method", meth->name(), "ArgName", arg_name});
out->Print("@abc.abstractmethod\n");
out->Print(methdict, "def $Method$(self, $ArgName$):\n");
{
IndentScope raii_method_indent(out);
out->Print("raise NotImplementedError()\n");
@ -162,169 +193,195 @@ void PrintStub(const ServiceDescriptor* service,
out->Print(methdict, "$Method$.async = None\n");
}
}
return true;
}
void PrintStubImpl(const ServiceDescriptor* service,
Printer* out) {
map<string, string> dict = ListToDict({
"Service", service->name(),
});
out->Print(dict, "class _$Service$Stub($Service$Stub):\n");
{
IndentScope raii_class_indent(out);
out->Print("def __init__(self, face_stub, default_timeout):\n");
{
IndentScope raii_method_indent(out);
out->Print("self._face_stub = face_stub\n"
"self._default_timeout = default_timeout\n"
"stub_self = self\n");
// TODO(protobuf team): Export `ModuleName` from protobuf's
// `src/google/protobuf/compiler/python/python_generator.cc` file.
string ModuleName(const string& filename) {
string basename = StripProto(filename);
basename = StringReplace(basename, "-", "_");
basename = StringReplace(basename, "/", ".");
return basename + "_pb2";
}
bool GetModuleAndMessagePath(const Descriptor* type,
pair<string, string>* out) {
const Descriptor* path_elem_type = type;
vector<const Descriptor*> message_path;
do {
message_path.push_back(path_elem_type);
path_elem_type = path_elem_type->containing_type();
} while (path_elem_type != nullptr);
string file_name = type->file()->name();
static const int proto_suffix_length = strlen(".proto");
if (!(file_name.size() > static_cast<size_t>(proto_suffix_length) &&
file_name.find_last_of(".proto") == file_name.size() - 1)) {
return false;
}
string module = ModuleName(file_name);
string message_type;
for (auto path_iter = message_path.rbegin();
path_iter != message_path.rend(); ++path_iter) {
message_type += (*path_iter)->name() + ".";
}
// no pop_back prior to C++11
message_type.resize(message_type.size() - 1);
*out = make_pair(module, message_type);
return true;
}
for (int i = 0; i < service->method_count(); ++i) {
const MethodDescriptor* meth = service->method(i);
bool server_streaming = meth->server_streaming();
bool client_streaming = meth->client_streaming();
std::string blocking_call, future_call;
if (server_streaming) {
if (client_streaming) {
blocking_call = "stub_self._face_stub.inline_stream_in_stream_out";
future_call = blocking_call;
} else {
blocking_call = "stub_self._face_stub.inline_value_in_stream_out";
future_call = blocking_call;
}
} else {
if (client_streaming) {
blocking_call = "stub_self._face_stub.blocking_stream_in_value_out";
future_call = "stub_self._face_stub.future_stream_in_value_out";
} else {
blocking_call = "stub_self._face_stub.blocking_value_in_value_out";
future_call = "stub_self._face_stub.future_value_in_value_out";
}
}
// TODO(atash): use the solution described at
// http://stackoverflow.com/a/2982 to bind 'async' attribute
// functions to def'd functions instead of using callable attributes.
auto methdict = ListToDict({
"Method", meth->name(),
"BlockingCall", blocking_call,
"FutureCall", future_call
});
out->Print(methdict, "class $Method$(object):\n");
{
IndentScope raii_callable_indent(out);
out->Print("def __call__(self, arg):\n");
{
IndentScope raii_callable_call_indent(out);
out->Print(methdict,
"return $BlockingCall$(\"$Method$\", arg, "
"stub_self._default_timeout)\n");
}
out->Print("def async(self, arg):\n");
{
IndentScope raii_callable_async_indent(out);
out->Print(methdict,
"return $FutureCall$(\"$Method$\", arg, "
"stub_self._default_timeout)\n");
}
}
out->Print(methdict, "self.$Method$ = $Method$()\n");
bool PrintServerFactory(const ServiceDescriptor* service, Printer* out) {
out->Print("def early_adopter_create_$Service$_server(servicer, port, "
"root_certificates, key_chain_pairs):\n",
"Service", service->name());
{
IndentScope raii_create_server_indent(out);
map<string, pair<string, string>> method_to_module_and_message;
out->Print("method_implementations = {\n");
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)) {
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);
}
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("}\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");
}
return true;
}
void PrintStubGenerators(const ServiceDescriptor* service, Printer* out) {
bool PrintStubFactory(const ServiceDescriptor* service, Printer* out) {
map<string, string> dict = ListToDict({
"Service", service->name(),
});
// Write out a generator of linked pairs of Server/Stub
out->Print(dict, "def mock_$Service$(servicer, default_timeout):\n");
out->Print(dict, "def early_adopter_create_$Service$_stub(host, port):\n");
{
IndentScope raii_mock_indent(out);
out->Print("value_in_value_out = {}\n"
"value_in_stream_out = {}\n"
"stream_in_value_out = {}\n"
"stream_in_stream_out = {}\n");
IndentScope raii_create_server_indent(out);
map<string, pair<string, string>> method_to_module_and_message;
out->Print("method_implementations = {\n");
for (int i = 0; i < service->method_count(); ++i) {
IndentScope raii_implementations_indent(out);
const MethodDescriptor* meth = service->method(i);
std::string super_interface, meth_dict;
bool server_streaming = meth->server_streaming();
bool client_streaming = meth->client_streaming();
if (server_streaming) {
if (client_streaming) {
super_interface = "InlineStreamInStreamOutMethod";
meth_dict = "stream_in_stream_out";
} else {
super_interface = "InlineValueInStreamOutMethod";
meth_dict = "value_in_stream_out";
}
} else {
if (client_streaming) {
super_interface = "InlineStreamInValueOutMethod";
meth_dict = "stream_in_value_out";
} else {
super_interface = "InlineValueInValueOutMethod";
meth_dict = "value_in_value_out";
}
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)) {
return false;
}
map<string, string> methdict = ListToDict({
"Method", meth->name(),
"SuperInterface", super_interface,
"MethodDict", meth_dict
});
out->Print(
methdict, "class $Method$(_face_interfaces.$SuperInterface$):\n");
{
IndentScope raii_inline_class_indent(out);
out->Print("def service(self, request, context):\n");
{
IndentScope raii_inline_class_fn_indent(out);
out->Print(methdict, "return servicer.$Method$(request)\n");
}
}
out->Print(methdict, "$MethodDict$['$Method$'] = $Method$()\n");
method_to_module_and_message.insert(
make_pair(meth->name(), module_and_message));
}
out->Print(
"face_linked_pair = _face_testing.server_and_stub(default_timeout,"
"inline_value_in_value_out_methods=value_in_value_out,"
"inline_value_in_stream_out_methods=value_in_stream_out,"
"inline_stream_in_value_out_methods=stream_in_value_out,"
"inline_stream_in_stream_out_methods=stream_in_stream_out)\n");
out->Print("class LinkedPair(object):\n");
{
IndentScope raii_linked_pair(out);
out->Print("def __init__(self, server, stub):\n");
{
IndentScope raii_linked_pair_init(out);
out->Print("self.server = server\n"
"self.stub = stub\n");
}
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);
}
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(
dict,
"stub = _$Service$Stub(face_linked_pair.stub, default_timeout)\n");
out->Print("return LinkedPair(None, stub)\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");
}
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");
return true;
}
} // namespace
string GetServices(const FileDescriptor* file) {
pair<bool, string> GetServices(const FileDescriptor* file) {
string output;
StringOutputStream output_stream(&output);
Printer out(&output_stream, '$');
out.Print("from grpc.framework.face import demonstration as _face_testing\n");
out.Print("from grpc.framework.face import interfaces as _face_interfaces\n");
for (int i = 0; i < file->service_count(); ++i) {
auto service = file->service(i);
PrintService(service, &out);
PrintServicer(service, &out);
PrintStub(service, &out);
PrintStubImpl(service, &out);
PrintStubGenerators(service, &out);
{
// Scope the output stream so it closes and finalizes output to the string.
StringOutputStream output_stream(&output);
Printer out(&output_stream, '$');
if (!PrintPreamble(file, &out)) {
return make_pair(false, "");
}
for (int i = 0; i < file->service_count(); ++i) {
auto service = file->service(i);
if (!(PrintServicer(service, &out) &&
PrintServer(service, &out) &&
PrintStub(service, &out) &&
PrintServerFactory(service, &out) &&
PrintStubFactory(service, &out))) {
return make_pair(false, "");
}
}
}
return output;
return make_pair(true, std::move(output));
}
} // namespace grpc_python_generator

@ -31,10 +31,11 @@
*
*/
#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>
namespace google {
namespace protobuf {
@ -44,8 +45,8 @@ class FileDescriptor;
namespace grpc_python_generator {
std::string GetServices(const google::protobuf::FileDescriptor* file);
std::pair<bool, std::string> GetServices(const google::protobuf::FileDescriptor* file);
} // namespace grpc_python_generator
#endif // __GRPC_COMPILER_PYTHON_GENERATOR_H__
#endif // GRPC_INTERNAL_COMPILER_PYTHON_GENERATOR_H

@ -33,6 +33,7 @@
// Generates a Python gRPC service interface out of Protobuf IDL.
#include <cstring>
#include <memory>
#include <string>
@ -50,19 +51,18 @@ using google::protobuf::compiler::PluginMain;
using google::protobuf::io::CodedOutputStream;
using google::protobuf::io::ZeroCopyOutputStream;
using std::string;
using std::strlen;
class PythonGrpcGenerator : public CodeGenerator {
public:
PythonGrpcGenerator() {}
~PythonGrpcGenerator() override {}
~PythonGrpcGenerator() {}
bool Generate(const FileDescriptor* file,
const string& parameter,
GeneratorContext* context,
string* error) const override {
bool Generate(const FileDescriptor* file, const string& parameter,
GeneratorContext* context, string* error) const {
// Get output file name.
string file_name;
static const int proto_suffix_length = 6; // length of ".proto"
static const int proto_suffix_length = strlen(".proto");
if (file->name().size() > static_cast<size_t>(proto_suffix_length) &&
file->name().find_last_of(".proto") == file->name().size() - 1) {
file_name = file->name().substr(
@ -75,9 +75,15 @@ class PythonGrpcGenerator : public CodeGenerator {
std::unique_ptr<ZeroCopyOutputStream> output(
context->OpenForInsert(file_name, "module_scope"));
CodedOutputStream coded_out(output.get());
string code = grpc_python_generator::GetServices(file);
coded_out.WriteRaw(code.data(), code.size());
return true;
bool success = false;
string code = "";
tie(success, code) = grpc_python_generator::GetServices(file);
if (success) {
coded_out.WriteRaw(code.data(), code.size());
return true;
} else {
return false;
}
}
};

@ -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

@ -50,12 +50,12 @@
class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
public:
RubyGrpcGenerator() {}
~RubyGrpcGenerator() override {}
~RubyGrpcGenerator() {}
bool Generate(const google::protobuf::FileDescriptor *file,
const std::string &parameter,
google::protobuf::compiler::GeneratorContext *context,
std::string *error) const override {
std::string *error) const {
std::string code = grpc_ruby_generator::GetServices(file);
if (code.size() == 0) {
return true; // don't generate a file if there are no services

@ -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 */

@ -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
@ -301,4 +301,4 @@ void grpc_call_element_send_finish(grpc_call_element *cur_elem);
#define GRPC_CALL_LOG_OP(sev, elem, op) \
if (grpc_trace_bits & 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 */

@ -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 */

@ -31,8 +31,8 @@
*
*/
#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>
@ -58,5 +58,4 @@ extern gpr_uint32 grpc_trace_bits;
void grpc_init_trace_bits();
#endif
#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 */

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

Loading…
Cancel
Save