aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/channel/channel_stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/channel/channel_stack.h')
-rw-r--r--src/core/channel/channel_stack.h88
1 files changed, 54 insertions, 34 deletions
diff --git a/src/core/channel/channel_stack.h b/src/core/channel/channel_stack.h
index 0bfe326976..6732cc3018 100644
--- a/src/core/channel/channel_stack.h
+++ b/src/core/channel/channel_stack.h
@@ -61,15 +61,17 @@ typedef struct grpc_call_element grpc_call_element;
4. a name, which is useful when debugging
Members are laid out in approximate frequency of use order. */
-typedef struct
-{
+typedef struct {
/* Called to eg. send/receive data on a call.
See grpc_call_next_op on how to call the next element in the stack */
- void (*start_transport_stream_op) (grpc_exec_ctx * exec_ctx, grpc_call_element * elem, grpc_transport_stream_op * op);
+ void (*start_transport_stream_op)(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *elem,
+ grpc_transport_stream_op *op);
/* Called to handle channel level operations - e.g. new calls, or transport
closure.
See grpc_channel_next_op on how to call the next element in the stack */
- void (*start_transport_op) (grpc_exec_ctx * exec_ctx, grpc_channel_element * elem, grpc_transport_op * op);
+ void (*start_transport_op)(grpc_exec_ctx *exec_ctx,
+ grpc_channel_element *elem, grpc_transport_op *op);
/* sizeof(per call data) */
size_t sizeof_call_data;
@@ -81,10 +83,12 @@ typedef struct
on a client; if it is non-NULL, then it points to memory owned by the
transport and is on the server. Most filters want to ignore this
argument. */
- void (*init_call_elem) (grpc_exec_ctx * exec_ctx, grpc_call_element * elem, const void *server_transport_data, grpc_transport_stream_op * initial_op);
+ void (*init_call_elem)(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
+ const void *server_transport_data,
+ grpc_transport_stream_op *initial_op);
/* Destroy per call data.
The filter does not need to do any chaining */
- void (*destroy_call_elem) (grpc_exec_ctx * exec_ctx, grpc_call_element * elem);
+ void (*destroy_call_elem)(grpc_exec_ctx *exec_ctx, grpc_call_element *elem);
/* sizeof(per channel data) */
size_t sizeof_channel_data;
@@ -94,13 +98,17 @@ typedef struct
is_first, is_last designate this elements position in the stack, and are
useful for asserting correct configuration by upper layer code.
The filter does not need to do any chaining */
- void (*init_channel_elem) (grpc_exec_ctx * exec_ctx, grpc_channel_element * elem, grpc_channel * master, const grpc_channel_args * args, grpc_mdctx * metadata_context, int is_first, int is_last);
+ void (*init_channel_elem)(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
+ grpc_channel *master, const grpc_channel_args *args,
+ grpc_mdctx *metadata_context, int is_first,
+ int is_last);
/* Destroy per channel data.
The filter does not need to do any chaining */
- void (*destroy_channel_elem) (grpc_exec_ctx * exec_ctx, grpc_channel_element * elem);
+ void (*destroy_channel_elem)(grpc_exec_ctx *exec_ctx,
+ grpc_channel_element *elem);
/* Implement grpc_call_get_peer() */
- char *(*get_peer) (grpc_exec_ctx * exec_ctx, grpc_call_element * elem);
+ char *(*get_peer)(grpc_exec_ctx *exec_ctx, grpc_call_element *elem);
/* The name of this filter */
const char *name;
@@ -108,8 +116,7 @@ typedef struct
/* A channel_element tracks its filter and the filter requested memory within
a channel allocation */
-struct grpc_channel_element
-{
+struct grpc_channel_element {
const grpc_channel_filter *filter;
void *channel_data;
};
@@ -117,8 +124,7 @@ struct grpc_channel_element
/* A call_element tracks its filter, the filter requested memory within
a channel allocation, and the filter requested memory within a call
allocation */
-struct grpc_call_element
-{
+struct grpc_call_element {
const grpc_channel_filter *filter;
void *channel_data;
void *call_data;
@@ -126,8 +132,7 @@ struct grpc_call_element
/* A channel stack tracks a set of related filters for one channel, and
guarantees they live within a single malloc() allocation */
-typedef struct
-{
+typedef struct {
size_t count;
/* Memory required for a call stack (computed at channel stack
initialization) */
@@ -136,48 +141,63 @@ typedef struct
/* A call stack tracks a set of related filters for one call, and guarantees
they live within a single malloc() allocation */
-typedef struct
-{
- size_t count;
-} grpc_call_stack;
+typedef struct { size_t count; } grpc_call_stack;
/* Get a channel element given a channel stack and its index */
-grpc_channel_element *grpc_channel_stack_element (grpc_channel_stack * stack, size_t i);
+grpc_channel_element *grpc_channel_stack_element(grpc_channel_stack *stack,
+ size_t i);
/* Get the last channel element in a channel stack */
-grpc_channel_element *grpc_channel_stack_last_element (grpc_channel_stack * stack);
+grpc_channel_element *grpc_channel_stack_last_element(
+ grpc_channel_stack *stack);
/* Get a call stack element given a call stack and an index */
-grpc_call_element *grpc_call_stack_element (grpc_call_stack * stack, size_t i);
+grpc_call_element *grpc_call_stack_element(grpc_call_stack *stack, size_t i);
/* Determine memory required for a channel stack containing a set of filters */
-size_t grpc_channel_stack_size (const grpc_channel_filter ** filters, size_t filter_count);
+size_t grpc_channel_stack_size(const grpc_channel_filter **filters,
+ size_t filter_count);
/* Initialize a channel stack given some filters */
-void grpc_channel_stack_init (grpc_exec_ctx * exec_ctx, const grpc_channel_filter ** filters, size_t filter_count, grpc_channel * master, const grpc_channel_args * args, grpc_mdctx * metadata_context, grpc_channel_stack * stack);
+void grpc_channel_stack_init(grpc_exec_ctx *exec_ctx,
+ const grpc_channel_filter **filters,
+ size_t filter_count, grpc_channel *master,
+ const grpc_channel_args *args,
+ grpc_mdctx *metadata_context,
+ grpc_channel_stack *stack);
/* Destroy a channel stack */
-void grpc_channel_stack_destroy (grpc_exec_ctx * exec_ctx, grpc_channel_stack * stack);
+void grpc_channel_stack_destroy(grpc_exec_ctx *exec_ctx,
+ grpc_channel_stack *stack);
/* Initialize a call stack given a channel stack. transport_server_data is
expected to be NULL on a client, or an opaque transport owned pointer on the
server. */
-void grpc_call_stack_init (grpc_exec_ctx * exec_ctx, grpc_channel_stack * channel_stack, const void *transport_server_data, grpc_transport_stream_op * initial_op, grpc_call_stack * call_stack);
+void grpc_call_stack_init(grpc_exec_ctx *exec_ctx,
+ grpc_channel_stack *channel_stack,
+ const void *transport_server_data,
+ grpc_transport_stream_op *initial_op,
+ grpc_call_stack *call_stack);
/* Destroy a call stack */
-void grpc_call_stack_destroy (grpc_exec_ctx * exec_ctx, grpc_call_stack * stack);
+void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack);
/* Call the next operation in a call stack */
-void grpc_call_next_op (grpc_exec_ctx * exec_ctx, grpc_call_element * elem, grpc_transport_stream_op * op);
+void grpc_call_next_op(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
+ grpc_transport_stream_op *op);
/* Call the next operation (depending on call directionality) in a channel
stack */
-void grpc_channel_next_op (grpc_exec_ctx * exec_ctx, grpc_channel_element * elem, grpc_transport_op * op);
+void grpc_channel_next_op(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem,
+ grpc_transport_op *op);
/* Pass through a request to get_peer to the next child element */
-char *grpc_call_next_get_peer (grpc_exec_ctx * exec_ctx, grpc_call_element * elem);
+char *grpc_call_next_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem);
/* Given the top element of a channel stack, get the channel stack itself */
-grpc_channel_stack *grpc_channel_stack_from_top_element (grpc_channel_element * elem);
+grpc_channel_stack *grpc_channel_stack_from_top_element(
+ grpc_channel_element *elem);
/* Given the top element of a call stack, get the call stack itself */
-grpc_call_stack *grpc_call_stack_from_top_element (grpc_call_element * elem);
+grpc_call_stack *grpc_call_stack_from_top_element(grpc_call_element *elem);
-void grpc_call_log_op (char *file, int line, gpr_log_severity severity, grpc_call_element * elem, grpc_transport_stream_op * op);
+void grpc_call_log_op(char *file, int line, gpr_log_severity severity,
+ grpc_call_element *elem, grpc_transport_stream_op *op);
-void grpc_call_element_send_cancel (grpc_exec_ctx * exec_ctx, grpc_call_element * cur_elem);
+void grpc_call_element_send_cancel(grpc_exec_ctx *exec_ctx,
+ grpc_call_element *cur_elem);
extern int grpc_trace_channel;