aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-10-30 02:09:11 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2018-10-30 02:43:01 -0700
commit0390b29e15e79acd1e84c511d5c20d8e20ee2eb6 (patch)
tree78b32178894fbac5f6aeb92eaffe59b4091e9adb /src/cpp
parent01313976e1a44b5c9625d3a349fffa55471beff4 (diff)
Register global interceptors functionality
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/client/channel_cc.cc2
-rw-r--r--src/cpp/codegen/client_interceptor.cc34
2 files changed, 35 insertions, 1 deletions
diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc
index 15e3ccb3c9..d1dab5d115 100644
--- a/src/cpp/client/channel_cc.cc
+++ b/src/cpp/client/channel_cc.cc
@@ -115,7 +115,7 @@ void ChannelResetConnectionBackoff(Channel* channel) {
internal::Call Channel::CreateCallInternal(const internal::RpcMethod& method,
ClientContext* context,
CompletionQueue* cq,
- int interceptor_pos) {
+ size_t interceptor_pos) {
const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = nullptr;
if (kRegistered) {
diff --git a/src/cpp/codegen/client_interceptor.cc b/src/cpp/codegen/client_interceptor.cc
new file mode 100644
index 0000000000..3a5cac9830
--- /dev/null
+++ b/src/cpp/codegen/client_interceptor.cc
@@ -0,0 +1,34 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <grpcpp/impl/codegen/client_interceptor.h>
+
+namespace grpc {
+
+namespace internal {
+experimental::ClientInterceptorFactoryInterface*
+ g_global_client_interceptor_factory = nullptr;
+}
+
+namespace experimental {
+void RegisterGlobalClientInterceptorFactory(
+ ClientInterceptorFactoryInterface* factory) {
+ internal::g_global_client_interceptor_factory = factory;
+}
+} // namespace experimental
+} // namespace grpc