GRPC C++  1.19.0
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  // SetCall should have been called before this.
223  // Returns true if the interceptors list is empty
225  auto* client_rpc_info = call_->client_rpc_info();
226  if (client_rpc_info != nullptr) {
227  if (client_rpc_info->interceptors_.size() == 0) {
228  return true;
229  } else {
230  return false;
231  }
232  }
233 
234  auto* server_rpc_info = call_->server_rpc_info();
235  if (server_rpc_info == nullptr ||
236  server_rpc_info->interceptors_.size() == 0) {
237  return true;
238  }
239  return false;
240  }
241 
242  // This should be used only by subclasses of CallOpSetInterface. SetCall and
243  // SetCallOpSetInterface should have been called before this. After all the
244  // interceptors are done running, either ContinueFillOpsAfterInterception or
245  // ContinueFinalizeOpsAfterInterception will be called. Note that neither of
246  // them is invoked if there were no interceptors registered.
248  GPR_CODEGEN_ASSERT(ops_);
249  auto* client_rpc_info = call_->client_rpc_info();
250  if (client_rpc_info != nullptr) {
251  if (client_rpc_info->interceptors_.size() == 0) {
252  return true;
253  } else {
254  RunClientInterceptors();
255  return false;
256  }
257  }
258 
259  auto* server_rpc_info = call_->server_rpc_info();
260  if (server_rpc_info == nullptr ||
261  server_rpc_info->interceptors_.size() == 0) {
262  return true;
263  }
264  RunServerInterceptors();
265  return false;
266  }
267 
268  // Returns true if no interceptors are run. Returns false otherwise if there
269  // are interceptors registered. After the interceptors are done running \a f
270  // will be invoked. This is to be used only by BaseAsyncRequest and
271  // SyncRequest.
272  bool RunInterceptors(std::function<void(void)> f) {
273  // This is used only by the server for initial call request
274  GPR_CODEGEN_ASSERT(reverse_ == true);
275  GPR_CODEGEN_ASSERT(call_->client_rpc_info() == nullptr);
276  auto* server_rpc_info = call_->server_rpc_info();
277  if (server_rpc_info == nullptr ||
278  server_rpc_info->interceptors_.size() == 0) {
279  return true;
280  }
281  callback_ = std::move(f);
282  RunServerInterceptors();
283  return false;
284  }
285 
286  private:
287  void RunClientInterceptors() {
288  auto* rpc_info = call_->client_rpc_info();
289  if (!reverse_) {
290  current_interceptor_index_ = 0;
291  } else {
292  if (rpc_info->hijacked_) {
293  current_interceptor_index_ = rpc_info->hijacked_interceptor_;
294  } else {
295  current_interceptor_index_ = rpc_info->interceptors_.size() - 1;
296  }
297  }
298  rpc_info->RunInterceptor(this, current_interceptor_index_);
299  }
300 
301  void RunServerInterceptors() {
302  auto* rpc_info = call_->server_rpc_info();
303  if (!reverse_) {
304  current_interceptor_index_ = 0;
305  } else {
306  current_interceptor_index_ = rpc_info->interceptors_.size() - 1;
307  }
308  rpc_info->RunInterceptor(this, current_interceptor_index_);
309  }
310 
311  void ProceedClient() {
312  auto* rpc_info = call_->client_rpc_info();
313  if (rpc_info->hijacked_ && !reverse_ &&
314  current_interceptor_index_ == rpc_info->hijacked_interceptor_ &&
315  !ran_hijacking_interceptor_) {
316  // We now need to provide hijacked recv ops to this interceptor
317  ClearHookPoints();
318  ops_->SetHijackingState();
319  ran_hijacking_interceptor_ = true;
320  rpc_info->RunInterceptor(this, current_interceptor_index_);
321  return;
322  }
323  if (!reverse_) {
324  current_interceptor_index_++;
325  // We are going down the stack of interceptors
326  if (current_interceptor_index_ < rpc_info->interceptors_.size()) {
327  if (rpc_info->hijacked_ &&
328  current_interceptor_index_ > rpc_info->hijacked_interceptor_) {
329  // This is a hijacked RPC and we are done with hijacking
331  } else {
332  rpc_info->RunInterceptor(this, current_interceptor_index_);
333  }
334  } else {
335  // we are done running all the interceptors without any hijacking
337  }
338  } else {
339  // We are going up the stack of interceptors
340  if (current_interceptor_index_ > 0) {
341  // Continue running interceptors
342  current_interceptor_index_--;
343  rpc_info->RunInterceptor(this, current_interceptor_index_);
344  } else {
345  // we are done running all the interceptors without any hijacking
347  }
348  }
349  }
350 
351  void ProceedServer() {
352  auto* rpc_info = call_->server_rpc_info();
353  if (!reverse_) {
354  current_interceptor_index_++;
355  if (current_interceptor_index_ < rpc_info->interceptors_.size()) {
356  return rpc_info->RunInterceptor(this, current_interceptor_index_);
357  } else if (ops_) {
358  return ops_->ContinueFillOpsAfterInterception();
359  }
360  } else {
361  // We are going up the stack of interceptors
362  if (current_interceptor_index_ > 0) {
363  // Continue running interceptors
364  current_interceptor_index_--;
365  return rpc_info->RunInterceptor(this, current_interceptor_index_);
366  } else if (ops_) {
368  }
369  }
370  GPR_CODEGEN_ASSERT(callback_);
371  callback_();
372  }
373 
374  void ClearHookPoints() {
375  for (auto i = static_cast<experimental::InterceptionHookPoints>(0);
377  i = static_cast<experimental::InterceptionHookPoints>(
378  static_cast<size_t>(i) + 1)) {
379  hooks_[static_cast<size_t>(i)] = false;
380  }
381  }
382 
383  std::array<bool,
384  static_cast<size_t>(
386  hooks_;
387 
388  size_t current_interceptor_index_ = 0; // Current iterator
389  bool reverse_ = false;
390  bool ran_hijacking_interceptor_ = false;
391  Call* call_ = nullptr; // The Call object is present along with CallOpSet
392  // object/callback
393  CallOpSetInterface* ops_ = nullptr;
394  std::function<void(void)> callback_;
395 
396  ByteBuffer* send_message_ = nullptr;
397  bool* fail_send_message_ = nullptr;
398  const void** orig_send_message_ = nullptr;
399  std::function<Status(const void*)> serializer_;
400 
401  std::multimap<grpc::string, grpc::string>* send_initial_metadata_;
402 
403  grpc_status_code* code_ = nullptr;
404  grpc::string* error_details_ = nullptr;
405  grpc::string* error_message_ = nullptr;
406  Status send_status_;
407 
408  std::multimap<grpc::string, grpc::string>* send_trailing_metadata_ = nullptr;
409 
410  void* recv_message_ = nullptr;
411  bool* got_message_ = nullptr;
412 
413  MetadataMap* recv_initial_metadata_ = nullptr;
414 
415  Status* recv_status_ = nullptr;
416 
417  MetadataMap* recv_trailing_metadata_ = nullptr;
418 };
419 
420 // A special implementation of InterceptorBatchMethods to send a Cancel
421 // notification down the interceptor stack
424  public:
426  experimental::InterceptionHookPoints type) override {
428  return true;
429  } else {
430  return false;
431  }
432  }
433 
434  void Proceed() override {
435  // This is a no-op. For actual continuation of the RPC simply needs to
436  // return from the Intercept method
437  }
438 
439  void Hijack() override {
440  // Only the client can hijack when sending down initial metadata
441  GPR_CODEGEN_ASSERT(false &&
442  "It is illegal to call Hijack on a method which has a "
443  "Cancel notification");
444  }
445 
447  GPR_CODEGEN_ASSERT(false &&
448  "It is illegal to call GetSendMessage on a method which "
449  "has a Cancel notification");
450  return nullptr;
451  }
452 
453  bool GetSendMessageStatus() override {
455  false &&
456  "It is illegal to call GetSendMessageStatus on a method which "
457  "has a Cancel notification");
458  return false;
459  }
460 
461  const void* GetSendMessage() override {
463  false &&
464  "It is illegal to call GetOriginalSendMessage on a method which "
465  "has a Cancel notification");
466  return nullptr;
467  }
468 
469  void ModifySendMessage(const void* message) override {
471  false &&
472  "It is illegal to call ModifySendMessage on a method which "
473  "has a Cancel notification");
474  }
475 
476  std::multimap<grpc::string, grpc::string>* GetSendInitialMetadata() override {
477  GPR_CODEGEN_ASSERT(false &&
478  "It is illegal to call GetSendInitialMetadata on a "
479  "method which has a Cancel notification");
480  return nullptr;
481  }
482 
483  Status GetSendStatus() override {
484  GPR_CODEGEN_ASSERT(false &&
485  "It is illegal to call GetSendStatus on a method which "
486  "has a Cancel notification");
487  return Status();
488  }
489 
490  void ModifySendStatus(const Status& status) override {
491  GPR_CODEGEN_ASSERT(false &&
492  "It is illegal to call ModifySendStatus on a method "
493  "which has a Cancel notification");
494  return;
495  }
496 
497  std::multimap<grpc::string, grpc::string>* GetSendTrailingMetadata()
498  override {
499  GPR_CODEGEN_ASSERT(false &&
500  "It is illegal to call GetSendTrailingMetadata on a "
501  "method which has a Cancel notification");
502  return nullptr;
503  }
504 
505  void* GetRecvMessage() override {
506  GPR_CODEGEN_ASSERT(false &&
507  "It is illegal to call GetRecvMessage on a method which "
508  "has a Cancel notification");
509  return nullptr;
510  }
511 
512  std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvInitialMetadata()
513  override {
514  GPR_CODEGEN_ASSERT(false &&
515  "It is illegal to call GetRecvInitialMetadata on a "
516  "method which has a Cancel notification");
517  return nullptr;
518  }
519 
520  Status* GetRecvStatus() override {
521  GPR_CODEGEN_ASSERT(false &&
522  "It is illegal to call GetRecvStatus on a method which "
523  "has a Cancel notification");
524  return nullptr;
525  }
526 
527  std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvTrailingMetadata()
528  override {
529  GPR_CODEGEN_ASSERT(false &&
530  "It is illegal to call GetRecvTrailingMetadata on a "
531  "method which has a Cancel notification");
532  return nullptr;
533  }
534 
535  std::unique_ptr<ChannelInterface> GetInterceptedChannel() override {
536  GPR_CODEGEN_ASSERT(false &&
537  "It is illegal to call GetInterceptedChannel on a "
538  "method which has a Cancel notification");
539  return std::unique_ptr<ChannelInterface>(nullptr);
540  }
541 
542  void FailHijackedRecvMessage() override {
543  GPR_CODEGEN_ASSERT(false &&
544  "It is illegal to call FailHijackedRecvMessage on a "
545  "method which has a Cancel notification");
546  }
547 
548  void FailHijackedSendMessage() override {
549  GPR_CODEGEN_ASSERT(false &&
550  "It is illegal to call FailHijackedSendMessage on a "
551  "method which has a Cancel notification");
552  }
553 };
554 } // namespace internal
555 } // namespace grpc
556 
557 #endif // GRPCPP_IMPL_CODEGEN_INTERCEPTOR_COMMON_H
bool RunInterceptors(std::function< void(void)> f)
Definition: interceptor_common.h:272
ByteBuffer * GetSerializedSendMessage() override
Send Message Methods GetSerializedSendMessage and GetSendMessage/ModifySendMessage are the available ...
Definition: interceptor_common.h:446
std::multimap< grpc::string_ref, grpc::string_ref > * GetRecvInitialMetadata() override
Returns a modifiable multimap of the received initial metadata.
Definition: interceptor_common.h:512
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:142
Definition: interceptor_common.h:422
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:476
Class that is passed as an argument to the Intercept method of the application&#39;s Interceptor interfac...
Definition: interceptor.h:91
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:527
void * GetRecvMessage() override
Returns a pointer to the modifiable received message.
Definition: interceptor_common.h:505
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:535
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:490
bool GetSendMessageStatus() override
Checks whether the SEND MESSAGE op succeeded.
Definition: interceptor_common.h:453
bool InterceptorsListEmpty()
Definition: interceptor_common.h:224
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:469
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:548
bool RunInterceptors()
Definition: interceptor_common.h:247
Status GetSendStatus() override
Returns the status to be sent. Valid for PRE_SEND_STATUS interceptions.
Definition: interceptor_common.h:483
::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:52
Status * GetRecvStatus() override
Returns a modifiable view of the received status on POST_RECV_STATUS interceptions; nullptr if not va...
Definition: interceptor_common.h:520
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:434
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:461
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:425
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:439
std::multimap< grpc::string, grpc::string > * GetSendTrailingMetadata() override
Returns a modifiable multimap of the trailing metadata to be sent.
Definition: interceptor_common.h:497
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:542
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
Send Message Methods GetSerializedSendMessage and GetSendMessage/ModifySendMessage are the available ...
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