GRPC C++  1.19.0-dev
interceptor_common.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPCPP_IMPL_CODEGEN_INTERCEPTOR_COMMON_H
20 #define GRPCPP_IMPL_CODEGEN_INTERCEPTOR_COMMON_H
21 
22 #include <array>
23 #include <functional>
24 
30 
32 
33 namespace grpc {
34 namespace internal {
35 
38  public:
40  for (auto i = static_cast<experimental::InterceptionHookPoints>(0);
42  i = static_cast<experimental::InterceptionHookPoints>(
43  static_cast<size_t>(i) + 1)) {
44  hooks_[static_cast<size_t>(i)] = false;
45  }
46  }
47 
49 
52  return hooks_[static_cast<size_t>(type)];
53  }
54 
55  void Proceed() override {
56  if (call_->client_rpc_info() != nullptr) {
57  return ProceedClient();
58  }
59  GPR_CODEGEN_ASSERT(call_->server_rpc_info() != nullptr);
60  ProceedServer();
61  }
62 
63  void Hijack() override {
64  // Only the client can hijack when sending down initial metadata
65  GPR_CODEGEN_ASSERT(!reverse_ && ops_ != nullptr &&
66  call_->client_rpc_info() != nullptr);
67  // It is illegal to call Hijack twice
68  GPR_CODEGEN_ASSERT(!ran_hijacking_interceptor_);
69  auto* rpc_info = call_->client_rpc_info();
70  rpc_info->hijacked_ = true;
71  rpc_info->hijacked_interceptor_ = current_interceptor_index_;
72  ClearHookPoints();
73  ops_->SetHijackingState();
74  ran_hijacking_interceptor_ = true;
75  rpc_info->RunInterceptor(this, current_interceptor_index_);
76  }
77 
79  hooks_[static_cast<size_t>(type)] = true;
80  }
81 
83  GPR_CODEGEN_ASSERT(orig_send_message_ != nullptr);
84  if (*orig_send_message_ != nullptr) {
85  GPR_CODEGEN_ASSERT(serializer_(*orig_send_message_).ok());
86  *orig_send_message_ = nullptr;
87  }
88  return send_message_;
89  }
90 
91  const void* GetSendMessage() override {
92  GPR_CODEGEN_ASSERT(orig_send_message_ != nullptr);
93  return *orig_send_message_;
94  }
95 
96  void ModifySendMessage(const void* message) override {
97  GPR_CODEGEN_ASSERT(orig_send_message_ != nullptr);
98  *orig_send_message_ = message;
99  }
100 
101  bool GetSendMessageStatus() override { return !*fail_send_message_; }
102 
103  std::multimap<grpc::string, grpc::string>* GetSendInitialMetadata() override {
104  return send_initial_metadata_;
105  }
106 
107  Status GetSendStatus() override {
108  return Status(static_cast<StatusCode>(*code_), *error_message_,
109  *error_details_);
110  }
111 
112  void ModifySendStatus(const Status& status) override {
113  *code_ = static_cast<grpc_status_code>(status.error_code());
114  *error_details_ = status.error_details();
115  *error_message_ = status.error_message();
116  }
117 
118  std::multimap<grpc::string, grpc::string>* GetSendTrailingMetadata()
119  override {
120  return send_trailing_metadata_;
121  }
122 
123  void* GetRecvMessage() override { return recv_message_; }
124 
125  std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvInitialMetadata()
126  override {
127  return recv_initial_metadata_->map();
128  }
129 
130  Status* GetRecvStatus() override { return recv_status_; }
131 
132  void FailHijackedSendMessage() override {
133  GPR_CODEGEN_ASSERT(hooks_[static_cast<size_t>(
135  *fail_send_message_ = true;
136  }
137 
138  std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvTrailingMetadata()
139  override {
140  return recv_trailing_metadata_->map();
141  }
142 
143  void SetSendMessage(ByteBuffer* buf, const void** msg,
144  bool* fail_send_message,
145  std::function<Status(const void*)> serializer) {
146  send_message_ = buf;
147  orig_send_message_ = msg;
148  fail_send_message_ = fail_send_message;
149  serializer_ = serializer;
150  }
151 
153  std::multimap<grpc::string, grpc::string>* metadata) {
154  send_initial_metadata_ = metadata;
155  }
156 
157  void SetSendStatus(grpc_status_code* code, grpc::string* error_details,
158  grpc::string* error_message) {
159  code_ = code;
160  error_details_ = error_details;
161  error_message_ = error_message;
162  }
163 
165  std::multimap<grpc::string, grpc::string>* metadata) {
166  send_trailing_metadata_ = metadata;
167  }
168 
169  void SetRecvMessage(void* message, bool* got_message) {
170  recv_message_ = message;
171  got_message_ = got_message;
172  }
173 
175  recv_initial_metadata_ = map;
176  }
177 
178  void SetRecvStatus(Status* status) { recv_status_ = status; }
179 
181  recv_trailing_metadata_ = map;
182  }
183 
184  std::unique_ptr<ChannelInterface> GetInterceptedChannel() override {
185  auto* info = call_->client_rpc_info();
186  if (info == nullptr) {
187  return std::unique_ptr<ChannelInterface>(nullptr);
188  }
189  // The intercepted channel starts from the interceptor just after the
190  // current interceptor
191  return std::unique_ptr<ChannelInterface>(new InterceptedChannel(
192  info->channel(), current_interceptor_index_ + 1));
193  }
194 
195  void FailHijackedRecvMessage() override {
196  GPR_CODEGEN_ASSERT(hooks_[static_cast<size_t>(
198  *got_message_ = false;
199  }
200 
201  // Clears all state
202  void ClearState() {
203  reverse_ = false;
204  ran_hijacking_interceptor_ = false;
205  ClearHookPoints();
206  }
207 
208  // Prepares for Post_recv operations
209  void SetReverse() {
210  reverse_ = true;
211  ran_hijacking_interceptor_ = false;
212  ClearHookPoints();
213  }
214 
215  // This needs to be set before interceptors are run
216  void SetCall(Call* call) { call_ = call; }
217 
218  // This needs to be set before interceptors are run using RunInterceptors().
219  // Alternatively, RunInterceptors(std::function<void(void)> f) can be used.
220  void SetCallOpSetInterface(CallOpSetInterface* ops) { ops_ = ops; }
221 
222  // Returns true if no interceptors are run. This should be used only by
223  // subclasses of CallOpSetInterface. SetCall and SetCallOpSetInterface should
224  // have been called before this. After all the interceptors are done running,
225  // either ContinueFillOpsAfterInterception or
226  // ContinueFinalizeOpsAfterInterception will be called. Note that neither of
227  // them is invoked if there were no interceptors registered.
229  GPR_CODEGEN_ASSERT(ops_);
230  auto* client_rpc_info = call_->client_rpc_info();
231  if (client_rpc_info != nullptr) {
232  if (client_rpc_info->interceptors_.size() == 0) {
233  return true;
234  } else {
235  RunClientInterceptors();
236  return false;
237  }
238  }
239 
240  auto* server_rpc_info = call_->server_rpc_info();
241  if (server_rpc_info == nullptr ||
242  server_rpc_info->interceptors_.size() == 0) {
243  return true;
244  }
245  RunServerInterceptors();
246  return false;
247  }
248 
249  // Returns true if no interceptors are run. Returns false otherwise if there
250  // are interceptors registered. After the interceptors are done running \a f
251  // will be invoked. This is to be used only by BaseAsyncRequest and
252  // SyncRequest.
253  bool RunInterceptors(std::function<void(void)> f) {
254  // This is used only by the server for initial call request
255  GPR_CODEGEN_ASSERT(reverse_ == true);
256  GPR_CODEGEN_ASSERT(call_->client_rpc_info() == nullptr);
257  auto* server_rpc_info = call_->server_rpc_info();
258  if (server_rpc_info == nullptr ||
259  server_rpc_info->interceptors_.size() == 0) {
260  return true;
261  }
262  callback_ = std::move(f);
263  RunServerInterceptors();
264  return false;
265  }
266 
267  private:
268  void RunClientInterceptors() {
269  auto* rpc_info = call_->client_rpc_info();
270  if (!reverse_) {
271  current_interceptor_index_ = 0;
272  } else {
273  if (rpc_info->hijacked_) {
274  current_interceptor_index_ = rpc_info->hijacked_interceptor_;
275  } else {
276  current_interceptor_index_ = rpc_info->interceptors_.size() - 1;
277  }
278  }
279  rpc_info->RunInterceptor(this, current_interceptor_index_);
280  }
281 
282  void RunServerInterceptors() {
283  auto* rpc_info = call_->server_rpc_info();
284  if (!reverse_) {
285  current_interceptor_index_ = 0;
286  } else {
287  current_interceptor_index_ = rpc_info->interceptors_.size() - 1;
288  }
289  rpc_info->RunInterceptor(this, current_interceptor_index_);
290  }
291 
292  void ProceedClient() {
293  auto* rpc_info = call_->client_rpc_info();
294  if (rpc_info->hijacked_ && !reverse_ &&
295  current_interceptor_index_ == rpc_info->hijacked_interceptor_ &&
296  !ran_hijacking_interceptor_) {
297  // We now need to provide hijacked recv ops to this interceptor
298  ClearHookPoints();
299  ops_->SetHijackingState();
300  ran_hijacking_interceptor_ = true;
301  rpc_info->RunInterceptor(this, current_interceptor_index_);
302  return;
303  }
304  if (!reverse_) {
305  current_interceptor_index_++;
306  // We are going down the stack of interceptors
307  if (current_interceptor_index_ < rpc_info->interceptors_.size()) {
308  if (rpc_info->hijacked_ &&
309  current_interceptor_index_ > rpc_info->hijacked_interceptor_) {
310  // This is a hijacked RPC and we are done with hijacking
312  } else {
313  rpc_info->RunInterceptor(this, current_interceptor_index_);
314  }
315  } else {
316  // we are done running all the interceptors without any hijacking
318  }
319  } else {
320  // We are going up the stack of interceptors
321  if (current_interceptor_index_ > 0) {
322  // Continue running interceptors
323  current_interceptor_index_--;
324  rpc_info->RunInterceptor(this, current_interceptor_index_);
325  } else {
326  // we are done running all the interceptors without any hijacking
328  }
329  }
330  }
331 
332  void ProceedServer() {
333  auto* rpc_info = call_->server_rpc_info();
334  if (!reverse_) {
335  current_interceptor_index_++;
336  if (current_interceptor_index_ < rpc_info->interceptors_.size()) {
337  return rpc_info->RunInterceptor(this, current_interceptor_index_);
338  } else if (ops_) {
339  return ops_->ContinueFillOpsAfterInterception();
340  }
341  } else {
342  // We are going up the stack of interceptors
343  if (current_interceptor_index_ > 0) {
344  // Continue running interceptors
345  current_interceptor_index_--;
346  return rpc_info->RunInterceptor(this, current_interceptor_index_);
347  } else if (ops_) {
349  }
350  }
351  GPR_CODEGEN_ASSERT(callback_);
352  callback_();
353  }
354 
355  void ClearHookPoints() {
356  for (auto i = static_cast<experimental::InterceptionHookPoints>(0);
358  i = static_cast<experimental::InterceptionHookPoints>(
359  static_cast<size_t>(i) + 1)) {
360  hooks_[static_cast<size_t>(i)] = false;
361  }
362  }
363 
364  std::array<bool,
365  static_cast<size_t>(
367  hooks_;
368 
369  size_t current_interceptor_index_ = 0; // Current iterator
370  bool reverse_ = false;
371  bool ran_hijacking_interceptor_ = false;
372  Call* call_ = nullptr; // The Call object is present along with CallOpSet
373  // object/callback
374  CallOpSetInterface* ops_ = nullptr;
375  std::function<void(void)> callback_;
376 
377  ByteBuffer* send_message_ = nullptr;
378  bool* fail_send_message_ = nullptr;
379  const void** orig_send_message_ = nullptr;
380  std::function<Status(const void*)> serializer_;
381 
382  std::multimap<grpc::string, grpc::string>* send_initial_metadata_;
383 
384  grpc_status_code* code_ = nullptr;
385  grpc::string* error_details_ = nullptr;
386  grpc::string* error_message_ = nullptr;
387  Status send_status_;
388 
389  std::multimap<grpc::string, grpc::string>* send_trailing_metadata_ = nullptr;
390 
391  void* recv_message_ = nullptr;
392  bool* got_message_ = nullptr;
393 
394  MetadataMap* recv_initial_metadata_ = nullptr;
395 
396  Status* recv_status_ = nullptr;
397 
398  MetadataMap* recv_trailing_metadata_ = nullptr;
399 };
400 
401 // A special implementation of InterceptorBatchMethods to send a Cancel
402 // notification down the interceptor stack
405  public:
407  experimental::InterceptionHookPoints type) override {
409  return true;
410  } else {
411  return false;
412  }
413  }
414 
415  void Proceed() override {
416  // This is a no-op. For actual continuation of the RPC simply needs to
417  // return from the Intercept method
418  }
419 
420  void Hijack() override {
421  // Only the client can hijack when sending down initial metadata
422  GPR_CODEGEN_ASSERT(false &&
423  "It is illegal to call Hijack on a method which has a "
424  "Cancel notification");
425  }
426 
428  GPR_CODEGEN_ASSERT(false &&
429  "It is illegal to call GetSendMessage on a method which "
430  "has a Cancel notification");
431  return nullptr;
432  }
433 
434  bool GetSendMessageStatus() override {
436  false &&
437  "It is illegal to call GetSendMessageStatus on a method which "
438  "has a Cancel notification");
439  return false;
440  }
441 
442  const void* GetSendMessage() override {
444  false &&
445  "It is illegal to call GetOriginalSendMessage on a method which "
446  "has a Cancel notification");
447  return nullptr;
448  }
449 
450  void ModifySendMessage(const void* message) override {
452  false &&
453  "It is illegal to call ModifySendMessage on a method which "
454  "has a Cancel notification");
455  }
456 
457  std::multimap<grpc::string, grpc::string>* GetSendInitialMetadata() override {
458  GPR_CODEGEN_ASSERT(false &&
459  "It is illegal to call GetSendInitialMetadata on a "
460  "method which has a Cancel notification");
461  return nullptr;
462  }
463 
464  Status GetSendStatus() override {
465  GPR_CODEGEN_ASSERT(false &&
466  "It is illegal to call GetSendStatus on a method which "
467  "has a Cancel notification");
468  return Status();
469  }
470 
471  void ModifySendStatus(const Status& status) override {
472  GPR_CODEGEN_ASSERT(false &&
473  "It is illegal to call ModifySendStatus on a method "
474  "which has a Cancel notification");
475  return;
476  }
477 
478  std::multimap<grpc::string, grpc::string>* GetSendTrailingMetadata()
479  override {
480  GPR_CODEGEN_ASSERT(false &&
481  "It is illegal to call GetSendTrailingMetadata on a "
482  "method which has a Cancel notification");
483  return nullptr;
484  }
485 
486  void* GetRecvMessage() override {
487  GPR_CODEGEN_ASSERT(false &&
488  "It is illegal to call GetRecvMessage on a method which "
489  "has a Cancel notification");
490  return nullptr;
491  }
492 
493  std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvInitialMetadata()
494  override {
495  GPR_CODEGEN_ASSERT(false &&
496  "It is illegal to call GetRecvInitialMetadata on a "
497  "method which has a Cancel notification");
498  return nullptr;
499  }
500 
501  Status* GetRecvStatus() override {
502  GPR_CODEGEN_ASSERT(false &&
503  "It is illegal to call GetRecvStatus on a method which "
504  "has a Cancel notification");
505  return nullptr;
506  }
507 
508  std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvTrailingMetadata()
509  override {
510  GPR_CODEGEN_ASSERT(false &&
511  "It is illegal to call GetRecvTrailingMetadata on a "
512  "method which has a Cancel notification");
513  return nullptr;
514  }
515 
516  std::unique_ptr<ChannelInterface> GetInterceptedChannel() override {
517  GPR_CODEGEN_ASSERT(false &&
518  "It is illegal to call GetInterceptedChannel on a "
519  "method which has a Cancel notification");
520  return std::unique_ptr<ChannelInterface>(nullptr);
521  }
522 
523  void FailHijackedRecvMessage() override {
524  GPR_CODEGEN_ASSERT(false &&
525  "It is illegal to call FailHijackedRecvMessage on a "
526  "method which has a Cancel notification");
527  }
528 
529  void FailHijackedSendMessage() override {
530  GPR_CODEGEN_ASSERT(false &&
531  "It is illegal to call FailHijackedSendMessage on a "
532  "method which has a Cancel notification");
533  }
534 };
535 } // namespace internal
536 } // namespace grpc
537 
538 #endif // GRPCPP_IMPL_CODEGEN_INTERCEPTOR_COMMON_H
bool RunInterceptors(std::function< void(void)> f)
Definition: interceptor_common.h:253
ByteBuffer * GetSerializedSendMessage() override
Returns a modifable ByteBuffer holding the serialized form of the message that is going to be sent...
Definition: interceptor_common.h:427
std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvInitialMetadata() override
Returns a modifiable multimap of the received initial metadata.
Definition: interceptor_common.h:493
void SetCall(Call *call)
Definition: interceptor_common.h:216
grpc_status_code
Definition: status.h:26
void ModifySendStatus(const Status &status) override
Overwrites the status with status.
Definition: interceptor_common.h:112
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:141
Definition: interceptor_common.h:403
void ModifySendMessage(const void *message) override
Overwrites the message to be sent with message.
Definition: interceptor_common.h:96
std::string string
Definition: config.h:35
Status * GetRecvStatus() override
Returns a modifiable view of the received status on POST_RECV_STATUS interceptions; nullptr if not va...
Definition: interceptor_common.h:130
std::multimap< grpc::string, grpc::string > * GetSendInitialMetadata() override
Returns a modifiable multimap of the initial metadata to be sent.
Definition: interceptor_common.h:457
Class that is passed as an argument to the Intercept method of the application&#39;s Interceptor interfac...
Definition: interceptor.h:87
void FailHijackedRecvMessage() override
On a hijacked RPC, an interceptor can decide to fail a PRE_RECV_MESSAGE op.
Definition: interceptor_common.h:195
Definition: metadata_map.h:33
std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvTrailingMetadata() override
Returns a modifiable multimap of the received trailing metadata on POST_RECV_STATUS interceptions; nu...
Definition: interceptor_common.h:508
void * GetRecvMessage() override
Returns a pointer to the modifiable received message.
Definition: interceptor_common.h:486
std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvInitialMetadata() override
Returns a modifiable multimap of the received initial metadata.
Definition: interceptor_common.h:125
void SetRecvMessage(void *message, bool *got_message)
Definition: interceptor_common.h:169
void SetReverse()
Definition: interceptor_common.h:209
void SetRecvStatus(Status *status)
Definition: interceptor_common.h:178
InterceptorBatchMethodsImpl()
Definition: interceptor_common.h:39
std::unique_ptr< ChannelInterface > GetInterceptedChannel() override
Gets an intercepted channel.
Definition: interceptor_common.h:516
std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvTrailingMetadata() override
Returns a modifiable multimap of the received trailing metadata on POST_RECV_STATUS interceptions; nu...
Definition: interceptor_common.h:138
void ModifySendStatus(const Status &status) override
Overwrites the status with status.
Definition: interceptor_common.h:471
bool GetSendMessageStatus() override
Checks whether the SEND MESSAGE op succeeded.
Definition: interceptor_common.h:434
bool QueryInterceptionHookPoint(experimental::InterceptionHookPoints type) override
Determine whether the current batch has an interception hook point of type type.
Definition: interceptor_common.h:50
virtual void ContinueFillOpsAfterInterception()=0
void ModifySendMessage(const void *message) override
Overwrites the message to be sent with message.
Definition: interceptor_common.h:450
void Hijack() override
Indicate that the interceptor has hijacked the RPC (only valid if the batch contains send_initial_met...
Definition: interceptor_common.h:63
void FailHijackedSendMessage() override
On a hijacked RPC/ to-be hijacked RPC, this can be called to fail a SEND MESSAGE op.
Definition: interceptor_common.h:529
bool RunInterceptors()
Definition: interceptor_common.h:228
Status GetSendStatus() override
Returns the status to be sent. Valid for PRE_SEND_STATUS interceptions.
Definition: interceptor_common.h:464
::google::protobuf::util::Status Status
Definition: config_protobuf.h:93
InterceptionHookPoints
An enumeration of different possible points at which the Intercept method of the Interceptor interfac...
Definition: interceptor.h:48
Status * GetRecvStatus() override
Returns a modifiable view of the received status on POST_RECV_STATUS interceptions; nullptr if not va...
Definition: interceptor_common.h:501
grpc::string error_message() const
Return the instance&#39;s error message.
Definition: status.h:112
StatusCode error_code() const
Return the instance&#39;s error code.
Definition: status.h:110
void Proceed() override
Signal that the interceptor is done intercepting the current batch of the RPC.
Definition: interceptor_common.h:415
An InterceptedChannel is available to client Interceptors.
Definition: intercepted_channel.h:34
virtual void ContinueFinalizeResultAfterInterception()=0
const void * GetSendMessage() override
Returns a non-modifiable pointer to the non-serialized form of the message to be sent.
Definition: interceptor_common.h:442
void FailHijackedSendMessage() override
On a hijacked RPC/ to-be hijacked RPC, this can be called to fail a SEND MESSAGE op.
Definition: interceptor_common.h:132
std::multimap< grpc::string_ref, grpc::string_ref > * map()
Definition: metadata_map.h:66
void * GetRecvMessage() override
Returns a pointer to the modifiable received message.
Definition: interceptor_common.h:123
experimental::ServerRpcInfo * server_rpc_info() const
Definition: call.h:79
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
bool GetSendMessageStatus() override
Checks whether the SEND MESSAGE op succeeded.
Definition: interceptor_common.h:101
std::multimap< grpc::string, grpc::string > * GetSendTrailingMetadata() override
Returns a modifiable multimap of the trailing metadata to be sent.
Definition: interceptor_common.h:118
Definition: interceptor_common.h:36
Status GetSendStatus() override
Returns the status to be sent. Valid for PRE_SEND_STATUS interceptions.
Definition: interceptor_common.h:107
experimental::ClientRpcInfo * client_rpc_info() const
Definition: call.h:75
std::multimap< grpc::string, grpc::string > * GetSendInitialMetadata() override
Returns a modifiable multimap of the initial metadata to be sent.
Definition: interceptor_common.h:103
~InterceptorBatchMethodsImpl()
Definition: interceptor_common.h:48
bool QueryInterceptionHookPoint(experimental::InterceptionHookPoints type) override
Determine whether the current batch has an interception hook point of type type.
Definition: interceptor_common.h:406
This is a special hook point available to both clients and servers when TryCancel() is performed...
An abstract collection of call ops, used to generate the grpc_call_op structure to pass down to the l...
Definition: call_op_set_interface.h:34
void SetSendStatus(grpc_status_code *code, grpc::string *error_details, grpc::string *error_message)
Definition: interceptor_common.h:157
void SetSendTrailingMetadata(std::multimap< grpc::string, grpc::string > *metadata)
Definition: interceptor_common.h:164
void SetRecvInitialMetadata(MetadataMap *map)
Definition: interceptor_common.h:174
void ClearState()
Definition: interceptor_common.h:202
void Hijack() override
Indicate that the interceptor has hijacked the RPC (only valid if the batch contains send_initial_met...
Definition: interceptor_common.h:420
std::multimap< grpc::string, grpc::string > * GetSendTrailingMetadata() override
Returns a modifiable multimap of the trailing metadata to be sent.
Definition: interceptor_common.h:478
void SetSendInitialMetadata(std::multimap< grpc::string, grpc::string > *metadata)
Definition: interceptor_common.h:152
void FailHijackedRecvMessage() override
On a hijacked RPC, an interceptor can decide to fail a PRE_RECV_MESSAGE op.
Definition: interceptor_common.h:523
const void * GetSendMessage() override
Returns a non-modifiable pointer to the non-serialized form of the message to be sent.
Definition: interceptor_common.h:91
Did it work? If it didn&#39;t, why?
Definition: status.h:31
void Proceed() override
Signal that the interceptor is done intercepting the current batch of the RPC.
Definition: interceptor_common.h:55
void AddInterceptionHookPoint(experimental::InterceptionHookPoints type)
Definition: interceptor_common.h:78
std::unique_ptr< ChannelInterface > GetInterceptedChannel() override
Gets an intercepted channel.
Definition: interceptor_common.h:184
void SetRecvTrailingMetadata(MetadataMap *map)
Definition: interceptor_common.h:180
ByteBuffer * GetSerializedSendMessage() override
Returns a modifable ByteBuffer holding the serialized form of the message that is going to be sent...
Definition: interceptor_common.h:82
void SetCallOpSetInterface(CallOpSetInterface *ops)
Definition: interceptor_common.h:220
void SetSendMessage(ByteBuffer *buf, const void **msg, bool *fail_send_message, std::function< Status(const void *)> serializer)
Definition: interceptor_common.h:143
A sequence of bytes.
Definition: byte_buffer.h:64
grpc::string error_details() const
Return the (binary) error details.
Definition: status.h:115
Straightforward wrapping of the C call object.
Definition: call.h:36