GRPC C++  1.26.0
interceptor.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_H
20 #define GRPCPP_IMPL_CODEGEN_INTERCEPTOR_H
21 
27 
28 namespace grpc {
29 
30 class ChannelInterface;
31 class Status;
32 
33 namespace experimental {
34 
57  PRE_SEND_STATUS, // server only
58  PRE_SEND_CLOSE, // client only: WritesDone for stream; after write in unary
67  POST_RECV_STATUS, // client only
68  POST_RECV_CLOSE, // server only
77 };
78 
92  public:
96  virtual bool QueryInterceptionHookPoint(InterceptionHookPoints type) = 0;
106  virtual void Proceed() = 0;
112  virtual void Hijack() = 0;
113 
131 
135  virtual ByteBuffer* GetSerializedSendMessage() = 0;
136 
140  virtual const void* GetSendMessage() = 0;
141 
149  virtual void ModifySendMessage(const void* message) = 0;
150 
153  virtual bool GetSendMessageStatus() = 0;
154 
158  virtual std::multimap<grpc::string, grpc::string>*
159  GetSendInitialMetadata() = 0;
160 
162  virtual Status GetSendStatus() = 0;
163 
166  virtual void ModifySendStatus(const Status& status) = 0;
167 
171  virtual std::multimap<grpc::string, grpc::string>*
172  GetSendTrailingMetadata() = 0;
173 
179  virtual void* GetRecvMessage() = 0;
180 
184  virtual std::multimap<grpc::string_ref, grpc::string_ref>*
185  GetRecvInitialMetadata() = 0;
186 
189  virtual Status* GetRecvStatus() = 0;
190 
193  virtual std::multimap<grpc::string_ref, grpc::string_ref>*
194  GetRecvTrailingMetadata() = 0;
195 
201  virtual std::unique_ptr<ChannelInterface> GetInterceptedChannel() = 0;
202 
206  virtual void FailHijackedRecvMessage() = 0;
207 
210  virtual void FailHijackedSendMessage() = 0;
211 };
212 
215 class Interceptor {
216  public:
217  virtual ~Interceptor() {}
218 
221  virtual void Intercept(InterceptorBatchMethods* methods) = 0;
222 };
223 
224 } // namespace experimental
225 } // namespace grpc
226 
227 #endif // GRPCPP_IMPL_CODEGEN_INTERCEPTOR_H
virtual ~InterceptorBatchMethods()
Definition: interceptor.h:93
Class that is passed as an argument to the Intercept method of the application&#39;s Interceptor interfac...
Definition: interceptor.h:91
The first three in this list are for clients and servers.
::google::protobuf::util::Status Status
Definition: config_protobuf.h:90
InterceptionHookPoints
An enumeration of different possible points at which the Intercept method of the Interceptor interfac...
Definition: interceptor.h:52
The following three are for hijacked clients only.
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
Interface for an interceptor.
Definition: interceptor.h:215
virtual ~Interceptor()
Definition: interceptor.h:217
This is a special hook point available to both clients and servers when TryCancel() is performed...
Did it work? If it didn&#39;t, why?
Definition: status.h:31
A sequence of bytes.
Definition: byte_buffer.h:67
The following two are for all clients and servers.