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 Definition: channel_stack.h:99
bool send_initial_metadata
Send initial metadata to the peer, from the provided metadata batch.
Definition: transport.h:189
TransportStreamOpBatch(grpc_transport_stream_op_batch *op)
Borrows a pointer to op, but does NOT take ownership.
Definition: channel_filter.h:133
An array of arguments that can be passed around.
Definition: grpc_types.h:132
grpc_channel_filter filter
Definition: channel_filter.h:355
void set_on_complete(grpc_closure *closure)
Definition: channel_filter.h:155
void ChannelFilterPluginInit()
Definition: channel_filter.cc:86
grpc_metadata_batch * recv_initial_metadata
Definition: transport.h:268
void ChannelFilterPluginShutdown()
Definition: channel_filter.cc:94
grpc_closure * recv_initial_metadata_ready() const
Definition: channel_filter.h:176
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
Represents channel data.
Definition: channel_filter.h:231
Definition: channel_filter.h:287
Definition: channel_stack.h:57
grpc_core::OrphanablePtr< grpc_core::ByteStream > * recv_message() const
Definition: channel_filter.h:195
MetadataBatch * send_trailing_metadata()
Definition: channel_filter.h:160
const gpr_atm * get_peer_string() const
Definition: channel_filter.h:210
MetadataBatch * recv_initial_metadata()
Definition: channel_filter.h:163
Definition: error_internal.h:39
grpc_core::OrphanablePtr< grpc_core::ByteStream > send_message
Definition: transport.h:252
MetadataBatch * send_initial_metadata()
Definition: channel_filter.h:157
virtual ~ChannelData()
Definition: channel_filter.h:234
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:68
grpc_channel_stack_type
Definition: channel_stack_type.h:26
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
std::function< bool(const grpc_channel_args &)> include_filter
Definition: channel_filter.h:354
A C++ wrapper for the grpc_transport_op struct.
Definition: channel_filter.h:106
grpc_mdelem md
Definition: metadata_batch.h:36
void * channel_data
Definition: channel_stack.h:161
struct grpc_linked_mdelem * prev
Definition: metadata_batch.h:38
grpc_error * disconnect_with_error() const
Definition: channel_filter.h:116
bool recv_message
Receive message data from the stream, into provided byte stream.
Definition: transport.h:201
MetadataBatch * recv_trailing_metadata()
Definition: channel_filter.h:166
Represents call data.
Definition: channel_filter.h:254
uint32_t * send_initial_metadata_flags() const
Definition: channel_filter.h:170
Definition: polling_entity.h:37
Definition: transport.h:163
bool send_message
Send message data to the peer, from the provided byte stream.
Definition: transport.h:195
static void DestroyChannelElement(grpc_channel_element *elem)
Definition: channel_filter.h:298
grpc_channel_stack_type stack_type
Definition: channel_filter.h:352
grpc_linked_mdelem * head
Definition: metadata_batch.h:45
static grpc_error * InitChannelElement(grpc_channel_element *elem, grpc_channel_element_args *args)
Definition: channel_filter.h:291
Definition: metadata.h:98
Definition: channel_filter.h:351
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
void set_recv_initial_metadata_ready(grpc_closure *closure)
Definition: channel_filter.h:181
static void DestroyCallElement(grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_call_closure)
Definition: channel_filter.h:329
A C++ wrapper for the grpc_transport_stream_op_batch struct.
Definition: channel_filter.h:128
static const size_t call_data_size
Definition: channel_filter.h:320
virtual void StartTransportStreamOpBatch(grpc_call_element *elem, TransportStreamOpBatch *op)
Starts a new stream operation.
Definition: channel_filter.cc:54
void * value
Definition: context.h:45
static void GetChannelInfo(grpc_channel_element *elem, const grpc_channel_info *channel_info)
Definition: channel_filter.h:313
grpc_call_context_element * context
Definition: transport.h:320
intptr_t gpr_atm
Definition: atm_gcc_atomic.h:30
CallData()
Definition: channel_filter.h:256
static void StartTransportOp(grpc_channel_element *elem, grpc_transport_op *op)
Definition: channel_filter.h:305
virtual void StartTransportOp(grpc_channel_element *elem, TransportOp *op)
Definition: channel_filter.cc:42
Definition: metadata_batch.h:33
static void SetPollsetOrPollsetSet(grpc_call_element *elem, grpc_polling_entity *pollent)
Definition: channel_filter.h:344
virtual void SetPollsetOrPollsetSet(grpc_call_element *elem, grpc_polling_entity *pollent)
Sets a pollset or pollset set.
Definition: channel_filter.cc:59
virtual grpc_error * Init(grpc_channel_element *, grpc_channel_element_args *)
Initializes the channel data.
Definition: channel_filter.h:239
void * call_data
Definition: channel_stack.h:170
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
std::vector< FilterRecord > * channel_filters
Definition: channel_filter.cc:69
bool send_goaway() const
Definition: channel_filter.h:119
#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
grpc_closure * on_complete() const
Definition: channel_filter.h:154
Value is a census_context.
Definition: context.h:33
Information requested from the channel.
Definition: grpc_types.h:668
grpc_transport_stream_op_batch_payload * payload
Values for the stream op (fields set are determined by flags above)
Definition: transport.h:186
virtual grpc_error * Init(grpc_call_element *, const grpc_call_element_args *)
Initializes the call data.
Definition: channel_filter.h:262
virtual ~CallData()
Definition: channel_filter.h:257
bool recv_initial_metadata
Receive initial metadata from the stream, into provided metadata batch.
Definition: transport.h:198
Definition: channel_stack.h:159
grpc_metadata_batch * send_initial_metadata
Definition: transport.h:231
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
Definition: channel_stack.h:167
int priority
Definition: channel_filter.h:353
grpc_transport_stream_op_batch * op() const
Definition: channel_filter.h:152
virtual void GetInfo(grpc_channel_element *elem, const grpc_channel_info *channel_info)
Definition: channel_filter.cc:47
grpc_core::OrphanablePtr< grpc_core::ByteStream > * recv_message
Definition: transport.h:291
void set_send_message(grpc_core::OrphanablePtr< grpc_core::ByteStream > send_message)
Definition: channel_filter.h:189
Definition: channel_stack.h:66
ChannelData()
Definition: channel_filter.h:233
struct grpc_linked_mdelem * next
Definition: metadata_batch.h:37
virtual void Destroy(grpc_call_element *, const grpc_call_final_info *, grpc_closure *)
Definition: channel_filter.h:268
void set_recv_message(grpc_core::OrphanablePtr< grpc_core::ByteStream > *recv_message)
Definition: channel_filter.h:199
virtual void Destroy(grpc_channel_element *)
Definition: channel_filter.h:245
static grpc_error * InitCallElement(grpc_call_element *elem, const grpc_call_element_args *args)
Definition: channel_filter.h:322
bool send_trailing_metadata
Send trailing metadata to the peer, from the provided metadata batch.
Definition: transport.h:192
static void StartTransportStreamOpBatch(grpc_call_element *elem, grpc_transport_stream_op_batch *op)
Definition: channel_filter.h:337
GRPCAPI void grpc_register_plugin(void(*init)(void), void(*destroy)(void))
Registers a plugin to be initialized and destroyed with the library.
Information about the call upon completion.
Definition: channel_stack.h:83
Transport op: a set of operations to perform on a transport as a whole.
Definition: transport.h:324
census_context * get_census_context() const
Definition: channel_filter.h:205
TransportOp(grpc_transport_op *op)
Borrows a pointer to op, but does NOT take ownership.
Definition: channel_filter.h:111
static const size_t channel_data_size
Definition: channel_filter.h:289
grpc_transport_op * op() const
Definition: channel_filter.h:113
bool recv_trailing_metadata
Receive trailing metadata from the stream, into provided metadata batch.
Definition: transport.h:205
grpc_closure * on_complete
Should be scheduled when all of the non-recv operations in the batch are complete.
Definition: transport.h:183