GRPC C++  1.20.0
call.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 #ifndef GRPCPP_IMPL_CODEGEN_CALL_H
19 #define GRPCPP_IMPL_CODEGEN_CALL_H
20 
23 
24 namespace grpc {
25 class CompletionQueue;
26 
27 namespace experimental {
28 class ClientRpcInfo;
29 class ServerRpcInfo;
30 } // namespace experimental
31 namespace internal {
32 class CallHook;
33 class CallOpSetInterface;
34 
36 class Call final {
37  public:
38  Call()
39  : call_hook_(nullptr),
40  cq_(nullptr),
41  call_(nullptr),
42  max_receive_message_size_(-1) {}
44  Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq)
45  : call_hook_(call_hook),
46  cq_(cq),
47  call_(call),
48  max_receive_message_size_(-1) {}
49 
50  Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
52  : call_hook_(call_hook),
53  cq_(cq),
54  call_(call),
55  max_receive_message_size_(-1),
56  client_rpc_info_(rpc_info) {}
57 
58  Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
59  int max_receive_message_size, experimental::ServerRpcInfo* rpc_info)
60  : call_hook_(call_hook),
61  cq_(cq),
62  call_(call),
63  max_receive_message_size_(max_receive_message_size),
64  server_rpc_info_(rpc_info) {}
65 
67  call_hook_->PerformOpsOnCall(ops, this);
68  }
69 
70  grpc_call* call() const { return call_; }
71  CompletionQueue* cq() const { return cq_; }
72 
73  int max_receive_message_size() const { return max_receive_message_size_; }
74 
76  return client_rpc_info_;
77  }
78 
80  return server_rpc_info_;
81  }
82 
83  private:
84  CallHook* call_hook_;
85  CompletionQueue* cq_;
86  grpc_call* call_;
87  int max_receive_message_size_;
88  experimental::ClientRpcInfo* client_rpc_info_ = nullptr;
89  experimental::ServerRpcInfo* server_rpc_info_ = nullptr;
90 };
91 } // namespace internal
92 } // namespace grpc
93 
94 #endif // GRPCPP_IMPL_CODEGEN_CALL_H
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
Call(grpc_call *call, CallHook *call_hook, CompletionQueue *cq, int max_receive_message_size, experimental::ServerRpcInfo *rpc_info)
Definition: call.h:58
Call(grpc_call *call, CallHook *call_hook, CompletionQueue *cq)
call is owned by the caller
Definition: call.h:44
CompletionQueue * cq() const
Definition: call.h:71
Call(grpc_call *call, CallHook *call_hook, CompletionQueue *cq, experimental::ClientRpcInfo *rpc_info)
Definition: call.h:50
grpc_call * call() const
Definition: call.h:70
ServerRpcInfo represents the state of a particular RPC as it appears to an interceptor.
Definition: server_interceptor.h:58
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
experimental::ClientRpcInfo * client_rpc_info() const
Definition: call.h:75
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:97
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
int max_receive_message_size() const
Definition: call.h:73
void PerformOps(CallOpSetInterface *ops)
Definition: call.h:66
This is an interface that Channel and Server implement to allow them to hook performing ops...
Definition: call_hook.h:30
Definition: client_interceptor.h:66
Straightforward wrapping of the C call object.
Definition: call.h:36
Call()
Definition: call.h:38