Go to the documentation of this file.
19 #ifndef GRPCXX_CHANNEL_FILTER_H
20 #define GRPCXX_CHANNEL_FILTER_H
85 return elem_ == other.elem_;
88 return elem_ != other.elem_;
135 send_initial_metadata_(
139 send_trailing_metadata_(
143 recv_initial_metadata_(
147 recv_trailing_metadata_(
172 .send_initial_metadata_flags
206 return static_cast<census_context*
>(
286 template <
typename ChannelDataType,
typename CallDataType>
294 ChannelDataType* channel_data =
new (elem->
channel_data) ChannelDataType();
295 return channel_data->Init(elem, args);
299 ChannelDataType* channel_data =
301 channel_data->Destroy(elem);
302 channel_data->~ChannelDataType();
307 ChannelDataType* channel_data =
310 channel_data->StartTransportOp(elem, &op_wrapper);
315 ChannelDataType* channel_data =
317 channel_data->GetInfo(elem, channel_info);
325 CallDataType* call_data =
new (elem->
call_data) CallDataType();
326 return call_data->Init(elem, args);
332 CallDataType* call_data =
static_cast<CallDataType*
>(elem->
call_data);
333 call_data->Destroy(elem, final_info, then_call_closure);
334 call_data->~CallDataType();
339 CallDataType* call_data =
static_cast<CallDataType*
>(elem->
call_data);
341 call_data->StartTransportStreamOpBatch(elem, &op_wrapper);
346 CallDataType* call_data =
static_cast<CallDataType*
>(elem->
call_data);
347 call_data->SetPollsetOrPollsetSet(elem, pollent);
374 template <
typename ChannelDataType,
typename CallDataType>
392 {FilterType::StartTransportStreamOpBatch, FilterType::StartTransportOp,
393 FilterType::call_data_size, FilterType::InitCallElement,
394 FilterType::SetPollsetOrPollsetSet, FilterType::DestroyCallElement,
395 FilterType::channel_data_size, FilterType::InitChannelElement,
396 FilterType::DestroyChannelElement, FilterType::GetChannelInfo, name}};
402 #endif // GRPCXX_CHANNEL_FILTER_H
virtual grpc_error * Init(grpc_channel_element *, grpc_channel_element_args *)
Initializes the channel data.
Definition: channel_filter.h:239
grpc_error * goaway_error
what should the goaway contain? Error contract: the transport that gets this op must cause goaway_err...
Definition: transport.h:340
#define GRPC_ERROR_NONE
The following "special" errors can be propagated without allocating memory.
Definition: error.h:125
grpc_core::OrphanablePtr< grpc_core::ByteStream > * send_message() const
Definition: channel_filter.h:185
bool send_goaway() const
Definition: channel_filter.h:119
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
MetadataBatch * recv_trailing_metadata()
Definition: channel_filter.h:166
bool recv_message
Receive message data from the stream, into provided byte stream.
Definition: transport.h:201
static void SetPollsetOrPollsetSet(grpc_call_element *elem, grpc_polling_entity *pollent)
Definition: channel_filter.h:344
grpc_error * disconnect_with_error
should the transport be disconnected Error contract: the transport that gets this op must cause disco...
Definition: transport.h:336
std::vector< FilterRecord > * channel_filters
Definition: channel_filter.cc:69
grpc_closure * on_complete
Should be scheduled when all of the non-recv operations in the batch are complete.
Definition: transport.h:183
static grpc_error * InitChannelElement(grpc_channel_element *elem, grpc_channel_element_args *args)
Definition: channel_filter.h:291
grpc_error * disconnect_with_error() const
Definition: channel_filter.h:116
grpc_core::OrphanablePtr< grpc_core::ByteStream > send_message
Definition: transport.h:252
Definition: channel_stack.h:159
struct grpc_linked_mdelem * next
Definition: metadata_batch.h:37
TransportOp(grpc_transport_op *op)
Borrows a pointer to op, but does NOT take ownership.
Definition: channel_filter.h:111
struct grpc_linked_mdelem * prev
Definition: metadata_batch.h:38
ChannelData()
Definition: channel_filter.h:233
Definition: metadata_batch.h:33
grpc_metadata_batch * send_initial_metadata
Definition: transport.h:231
Definition: channel_filter.h:351
void * call_data
Definition: channel_stack.h:170
Definition: channel_stack.h:167
grpc_channel_stack_type stack_type
Definition: channel_filter.h:352
An array of arguments that can be passed around.
Definition: grpc_types.h:132
void ChannelFilterPluginShutdown()
Definition: channel_filter.cc:94
grpc_core::OrphanablePtr< grpc_core::ByteStream > * recv_message
Definition: transport.h:291
grpc_channel_filter filter
Definition: channel_filter.h:355
grpc_transport_op * op() const
Definition: channel_filter.h:113
Transport op: a set of operations to perform on a transport as a whole.
Definition: transport.h:324
virtual grpc_error * Init(grpc_call_element *, const grpc_call_element_args *)
Initializes the call data.
Definition: channel_filter.h:262
static const size_t channel_data_size
Definition: channel_filter.h:289
TransportStreamOpBatch(grpc_transport_stream_op_batch *op)
Borrows a pointer to op, but does NOT take ownership.
Definition: channel_filter.h:133
CallData()
Definition: channel_filter.h:256
void * channel_data
Definition: channel_stack.h:161
void ChannelFilterPluginInit()
Definition: channel_filter.cc:86
grpc_transport_stream_op_batch * op() const
Definition: channel_filter.h:152
grpc_closure * on_complete() const
Definition: channel_filter.h:154
virtual void StartTransportOp(grpc_channel_element *elem, TransportOp *op)
Definition: channel_filter.cc:42
const gpr_atm * get_peer_string() const
Definition: channel_filter.h:210
static void StartTransportStreamOpBatch(grpc_call_element *elem, grpc_transport_stream_op_batch *op)
Definition: channel_filter.h:337
MetadataBatch * recv_initial_metadata()
Definition: channel_filter.h:163
grpc_transport_stream_op_batch_payload * payload
Values for the stream op (fields set are determined by flags above)
Definition: transport.h:186
virtual void SetPollsetOrPollsetSet(grpc_call_element *elem, grpc_polling_entity *pollent)
Sets a pollset or pollset set.
Definition: channel_filter.cc:59
MetadataBatch * send_initial_metadata()
Definition: channel_filter.h:157
virtual void GetInfo(grpc_channel_element *elem, const grpc_channel_info *channel_info)
Definition: channel_filter.cc:47
void set_send_message(grpc_core::OrphanablePtr< grpc_core::ByteStream > send_message)
Definition: channel_filter.h:189
Definition: polling_entity.h:37
Definition: channel_stack.h:66
GRPCAPI void grpc_register_plugin(void(*init)(void), void(*destroy)(void))
Registers a plugin to be initialized and destroyed with the library.
static void StartTransportOp(grpc_channel_element *elem, grpc_transport_op *op)
Definition: channel_filter.h:305
census_context * get_census_context() const
Definition: channel_filter.h:205
Definition: channel_stack.h:99
void * value
Definition: context.h:45
static void GetChannelInfo(grpc_channel_element *elem, const grpc_channel_info *channel_info)
Definition: channel_filter.h:313
uint32_t * send_initial_metadata_flags() const
Definition: channel_filter.h:170
void set_recv_message(grpc_core::OrphanablePtr< grpc_core::ByteStream > *recv_message)
Definition: channel_filter.h:199
bool recv_initial_metadata
Receive initial metadata from the stream, into provided metadata batch.
Definition: transport.h:198
int priority
Definition: channel_filter.h:353
Definition: channel_filter.h:287
intptr_t gpr_atm
Definition: atm_gcc_atomic.h:30
Definition: metadata.h:98
bool send_trailing_metadata
Send trailing metadata to the peer, from the provided metadata batch.
Definition: transport.h:192
grpc_linked_mdelem * head
Definition: metadata_batch.h:45
Represents call data.
Definition: channel_filter.h:254
bool send_message
Send message data to the peer, from the provided byte stream.
Definition: transport.h:195
virtual ~CallData()
Definition: channel_filter.h:257
static void DestroyCallElement(grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_call_closure)
Definition: channel_filter.h:329
std::function< bool(const grpc_channel_args &)> include_filter
Definition: channel_filter.h:354
@ GRPC_CONTEXT_TRACING
Value is a census_context.
Definition: context.h:33
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:68
grpc_metadata_batch * recv_initial_metadata
Definition: transport.h:268
A C++ wrapper for the grpc_transport_op struct.
Definition: channel_filter.h:106
grpc_channel_stack_type
Definition: channel_stack_type.h:26
virtual void Destroy(grpc_call_element *, const grpc_call_final_info *, grpc_closure *)
Definition: channel_filter.h:268
bool send_initial_metadata
Send initial metadata to the peer, from the provided metadata batch.
Definition: transport.h:189
grpc_call_context_element * context
Definition: transport.h:320
void RegisterChannelFilter(const char *name, grpc_channel_stack_type stack_type, int priority, std::function< bool(const grpc_channel_args &)> include_filter)
Registers a new filter.
Definition: channel_filter.h:375
virtual ~ChannelData()
Definition: channel_filter.h:234
grpc_core::OrphanablePtr< grpc_core::ByteStream > * recv_message() const
Definition: channel_filter.h:195
bool recv_trailing_metadata
Receive trailing metadata from the stream, into provided metadata batch.
Definition: transport.h:205
MetadataBatch * send_trailing_metadata()
Definition: channel_filter.h:160
void set_on_complete(grpc_closure *closure)
Definition: channel_filter.h:155
Definition: channel_stack.h:57
static grpc_error * InitCallElement(grpc_call_element *elem, const grpc_call_element_args *args)
Definition: channel_filter.h:322
Information about the call upon completion.
Definition: channel_stack.h:83
A C++ wrapper for the grpc_transport_stream_op_batch struct.
Definition: channel_filter.h:128
grpc_closure * recv_initial_metadata_ready() const
Definition: channel_filter.h:176
static void DestroyChannelElement(grpc_channel_element *elem)
Definition: channel_filter.h:298
Definition: error_internal.h:39
virtual void Destroy(grpc_channel_element *)
Definition: channel_filter.h:245
virtual void StartTransportStreamOpBatch(grpc_call_element *elem, TransportStreamOpBatch *op)
Starts a new stream operation.
Definition: channel_filter.cc:54
void set_recv_initial_metadata_ready(grpc_closure *closure)
Definition: channel_filter.h:181
Information requested from the channel.
Definition: grpc_types.h:668
Definition: transport.h:163
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
Represents channel data.
Definition: channel_filter.h:231
static const size_t call_data_size
Definition: channel_filter.h:320
grpc_mdelem md
Definition: metadata_batch.h:36