GRPC C++  1.18.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 
52  PRE_SEND_STATUS, // server only
53  PRE_SEND_CLOSE, // client only: WritesDone for stream; after write in unary
62  POST_RECV_STATUS, // client only
63  POST_RECV_CLOSE, // server only
72 };
73 
87  public:
91  virtual bool QueryInterceptionHookPoint(InterceptionHookPoints type) = 0;
101  virtual void Proceed() = 0;
107  virtual void Hijack() = 0;
108 
112  virtual ByteBuffer* GetSendMessage() = 0;
113 
117  virtual std::multimap<grpc::string, grpc::string>*
118  GetSendInitialMetadata() = 0;
119 
121  virtual Status GetSendStatus() = 0;
122 
125  virtual void ModifySendStatus(const Status& status) = 0;
126 
130  virtual std::multimap<grpc::string, grpc::string>*
131  GetSendTrailingMetadata() = 0;
132 
137  virtual void* GetRecvMessage() = 0;
138 
141  virtual std::multimap<grpc::string_ref, grpc::string_ref>*
142  GetRecvInitialMetadata() = 0;
143 
146  virtual Status* GetRecvStatus() = 0;
147 
150  virtual std::multimap<grpc::string_ref, grpc::string_ref>*
151  GetRecvTrailingMetadata() = 0;
152 
158  virtual std::unique_ptr<ChannelInterface> GetInterceptedChannel() = 0;
159 };
160 
163 class Interceptor {
164  public:
165  virtual ~Interceptor() {}
166 
169  virtual void Intercept(InterceptorBatchMethods* methods) = 0;
170 };
171 
172 } // namespace experimental
173 } // namespace grpc
174 
175 #endif // GRPCPP_IMPL_CODEGEN_INTERCEPTOR_H
virtual ~InterceptorBatchMethods()
Definition: interceptor.h:88
Class that is passed as an argument to the Intercept method of the application&#39;s Interceptor interfac...
Definition: interceptor.h:86
The first two in this list are for clients and servers.
::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
The following three are for hijacked clients only and can only be registered by the global intercepto...
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:163
virtual ~Interceptor()
Definition: interceptor.h:165
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:64
The following two are for all clients and servers.