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
286 template <
typename ChannelDataType,
typename CallDataType>
333 call_data->Destroy(elem, final_info, then_call_closure);
341 call_data->StartTransportStreamOpBatch(elem, &op_wrapper);
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}};
struct census_context census_context
A Census Context is a handle used by Census to represent the current tracing and stats collection inf...
Definition: census.h:34
grpc_channel_stack_type
Definition: channel_stack_type.h:26
Represents call data.
Definition: channel_filter.h:254
virtual grpc_error_handle Init(grpc_call_element *, const grpc_call_element_args *)
Initializes the call data.
Definition: channel_filter.h:262
virtual void SetPollsetOrPollsetSet(grpc_call_element *elem, grpc_polling_entity *pollent)
Sets a pollset or pollset set.
Definition: channel_filter.cc:59
virtual void Destroy(grpc_call_element *, const grpc_call_final_info *, grpc_closure *)
Definition: channel_filter.h:268
virtual void StartTransportStreamOpBatch(grpc_call_element *elem, TransportStreamOpBatch *op)
Starts a new stream operation.
Definition: channel_filter.cc:54
CallData()
Definition: channel_filter.h:256
virtual ~CallData()
Definition: channel_filter.h:257
Represents channel data.
Definition: channel_filter.h:231
ChannelData()
Definition: channel_filter.h:233
virtual grpc_error_handle Init(grpc_channel_element *, grpc_channel_element_args *)
Initializes the channel data.
Definition: channel_filter.h:239
virtual void GetInfo(grpc_channel_element *elem, const grpc_channel_info *channel_info)
Definition: channel_filter.cc:47
virtual void StartTransportOp(grpc_channel_element *elem, TransportOp *op)
Definition: channel_filter.cc:42
virtual void Destroy(grpc_channel_element *)
Definition: channel_filter.h:245
virtual ~ChannelData()
Definition: channel_filter.h:234
A C++ wrapper for the grpc_transport_op struct.
Definition: channel_filter.h:106
TransportOp(grpc_transport_op *op)
Borrows a pointer to op, but does NOT take ownership.
Definition: channel_filter.h:111
grpc_error_handle disconnect_with_error() const
Definition: channel_filter.h:116
grpc_transport_op * op() const
Definition: channel_filter.h:113
bool send_goaway() const
Definition: channel_filter.h:119
A C++ wrapper for the grpc_transport_stream_op_batch struct.
Definition: channel_filter.h:128
TransportStreamOpBatch(grpc_transport_stream_op_batch *op)
Borrows a pointer to op, but does NOT take ownership.
Definition: channel_filter.h:133
grpc_transport_stream_op_batch * op() const
Definition: channel_filter.h:152
void set_recv_message(grpc_core::OrphanablePtr< grpc_core::ByteStream > *recv_message)
Definition: channel_filter.h:199
grpc_core::OrphanablePtr< grpc_core::ByteStream > * send_message() const
Definition: channel_filter.h:185
uint32_t * send_initial_metadata_flags() const
Definition: channel_filter.h:170
grpc_core::OrphanablePtr< grpc_core::ByteStream > * recv_message() const
Definition: channel_filter.h:195
MetadataBatch * recv_initial_metadata()
Definition: channel_filter.h:163
void set_recv_initial_metadata_ready(grpc_closure *closure)
Definition: channel_filter.h:181
void set_on_complete(grpc_closure *closure)
Definition: channel_filter.h:155
census_context * get_census_context() const
Definition: channel_filter.h:205
void set_send_message(grpc_core::OrphanablePtr< grpc_core::ByteStream > send_message)
Definition: channel_filter.h:189
MetadataBatch * send_trailing_metadata()
Definition: channel_filter.h:160
const gpr_atm * get_peer_string() const
Definition: channel_filter.h:210
MetadataBatch * recv_trailing_metadata()
Definition: channel_filter.h:166
grpc_closure * on_complete() const
Definition: channel_filter.h:154
MetadataBatch * send_initial_metadata()
Definition: channel_filter.h:157
grpc_closure * recv_initial_metadata_ready() const
Definition: channel_filter.h:176
Definition: channel_filter.h:287
static void DestroyChannelElement(grpc_channel_element *elem)
Definition: channel_filter.h:298
static void StartTransportOp(grpc_channel_element *elem, grpc_transport_op *op)
Definition: channel_filter.h:305
static grpc_error_handle InitChannelElement(grpc_channel_element *elem, grpc_channel_element_args *args)
Definition: channel_filter.h:291
static grpc_error_handle InitCallElement(grpc_call_element *elem, const grpc_call_element_args *args)
Definition: channel_filter.h:322
static const size_t call_data_size
Definition: channel_filter.h:320
static void DestroyCallElement(grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_call_closure)
Definition: channel_filter.h:329
static void StartTransportStreamOpBatch(grpc_call_element *elem, grpc_transport_stream_op_batch *op)
Definition: channel_filter.h:337
static const size_t channel_data_size
Definition: channel_filter.h:289
static void SetPollsetOrPollsetSet(grpc_call_element *elem, grpc_polling_entity *pollent)
Definition: channel_filter.h:344
static void GetChannelInfo(grpc_channel_element *elem, const grpc_channel_info *channel_info)
Definition: channel_filter.h:313
struct connected_channel_channel_data channel_data
struct connected_channel_call_data call_data
@ GRPC_CONTEXT_TRACING
Value is a census_context.
Definition: context.h:33
#define GRPC_ERROR_NONE
The following "special" errors can be propagated without allocating memory.
Definition: error.h:228
GRPCAPI void grpc_register_plugin(void(*init)(void), void(*destroy)(void))
Registers a plugin to be initialized and destroyed with the library.
Definition: init.cc:119
intptr_t gpr_atm
Definition: atm_gcc_atomic.h:30
std::vector< FilterRecord > * channel_filters
Definition: channel_filter.cc:69
void ChannelFilterPluginShutdown()
Definition: channel_filter.cc:94
void ChannelFilterPluginInit()
Definition: channel_filter.cc:86
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:67
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
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
grpc_closure closure
Definition: server.cc:460
Definition: channel_filter.h:351
grpc_channel_filter filter
Definition: channel_filter.h:355
int priority
Definition: channel_filter.h:353
std::function< bool(const grpc_channel_args &)> include_filter
Definition: channel_filter.h:354
grpc_channel_stack_type stack_type
Definition: channel_filter.h:352
void * value
Definition: context.h:45
Definition: channel_stack.h:76
Definition: channel_stack.h:174
void * call_data
Definition: channel_stack.h:177
Information about the call upon completion.
Definition: channel_stack.h:91
An array of arguments that can be passed around.
Definition: grpc_types.h:132
Definition: channel_stack.h:68
Definition: channel_stack.h:166
void * channel_data
Definition: channel_stack.h:168
Definition: channel_stack.h:107
Information requested from the channel.
Definition: grpc_types.h:704
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
Definition: error_internal.h:41
Definition: metadata_batch.h:36
struct grpc_linked_mdelem * prev
Definition: metadata_batch.h:41
grpc_mdelem md
Definition: metadata_batch.h:39
struct grpc_linked_mdelem * next
Definition: metadata_batch.h:40
grpc_linked_mdelem * head
Definition: metadata_batch.h:48
Definition: metadata.h:98
Definition: polling_entity.h:37
Transport op: a set of operations to perform on a transport as a whole.
Definition: transport.h:332
grpc_error_handle disconnect_with_error
should the transport be disconnected Error contract: the transport that gets this op must cause disco...
Definition: transport.h:344
grpc_error_handle goaway_error
what should the goaway contain? Error contract: the transport that gets this op must cause goaway_err...
Definition: transport.h:348
grpc_metadata_batch * recv_initial_metadata
Definition: transport.h:274
grpc_core::OrphanablePtr< grpc_core::ByteStream > send_message
Definition: transport.h:258
grpc_core::OrphanablePtr< grpc_core::ByteStream > * recv_message
Definition: transport.h:297
grpc_metadata_batch * send_initial_metadata
Definition: transport.h:231
grpc_call_context_element * context
Definition: transport.h:328
Definition: transport.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
bool recv_message
Receive message data from the stream, into provided byte stream.
Definition: transport.h:201
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
bool send_trailing_metadata
Send trailing metadata to the peer, from the provided metadata batch.
Definition: transport.h:192
bool send_message
Send message data to the peer, from the provided byte stream.
Definition: transport.h:195
bool send_initial_metadata
Send initial metadata to the peer, from the provided metadata batch.
Definition: transport.h:189
bool recv_initial_metadata
Receive initial metadata from the stream, into provided metadata batch.
Definition: transport.h:198