GRPC Core 0.10.0.0

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
subchannel.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright 2015, Google Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34 #ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H
35 #define GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H
36
37 #include "src/core/channel/channel_stack.h"
38 #include "src/core/client_config/connector.h"
39
42 typedef struct grpc_subchannel grpc_subchannel;
43 typedef struct grpc_subchannel_call grpc_subchannel_call;
44 typedef struct grpc_subchannel_args grpc_subchannel_args;
45
46 #ifdef GRPC_SUBCHANNEL_REFCOUNT_DEBUG
47 #define GRPC_SUBCHANNEL_REF(p, r) \
48 grpc_subchannel_ref((p), __FILE__, __LINE__, (r))
49 #define GRPC_SUBCHANNEL_UNREF(p, r) \
50 grpc_subchannel_unref((p), __FILE__, __LINE__, (r))
51 #define GRPC_SUBCHANNEL_CALL_REF(p, r) \
52 grpc_subchannel_call_ref((p), __FILE__, __LINE__, (r))
53 #define GRPC_SUBCHANNEL_CALL_UNREF(p, r) \
54 grpc_subchannel_call_unref((p), __FILE__, __LINE__, (r))
55 #define GRPC_SUBCHANNEL_REF_EXTRA_ARGS \
56 , const char *file, int line, const char *reason
57 #else
58 #define GRPC_SUBCHANNEL_REF(p, r) grpc_subchannel_ref((p))
59 #define GRPC_SUBCHANNEL_UNREF(p, r) grpc_subchannel_unref((p))
60 #define GRPC_SUBCHANNEL_CALL_REF(p, r) grpc_subchannel_call_ref((p))
61 #define GRPC_SUBCHANNEL_CALL_UNREF(p, r) grpc_subchannel_call_unref((p))
62 #define GRPC_SUBCHANNEL_REF_EXTRA_ARGS
63 #endif
64
65 void grpc_subchannel_ref(
66 grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
67 void grpc_subchannel_unref(
68 grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
69 void grpc_subchannel_call_ref(
70 grpc_subchannel_call *call GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
71 void grpc_subchannel_call_unref(
72 grpc_subchannel_call *call GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
73
75 void grpc_subchannel_create_call(grpc_subchannel *subchannel,
76 grpc_pollset *pollset,
77 grpc_subchannel_call **target,
78 grpc_iomgr_closure *notify);
79
81 void grpc_subchannel_process_transport_op(grpc_subchannel *subchannel,
82 grpc_transport_op *op);
83
85 grpc_connectivity_state grpc_subchannel_check_connectivity(
86 grpc_subchannel *channel);
87
90 void grpc_subchannel_notify_on_state_change(grpc_subchannel *channel,
91 grpc_connectivity_state *state,
92 grpc_iomgr_closure *notify);
93
94 void grpc_subchannel_add_interested_party(grpc_subchannel *channel,
95 grpc_pollset *pollset);
96 void grpc_subchannel_del_interested_party(grpc_subchannel *channel,
97 grpc_pollset *pollset);
98
100 void grpc_subchannel_call_process_op(grpc_subchannel_call *subchannel_call,
101 grpc_transport_stream_op *op);
102
104 char *grpc_subchannel_call_get_peer(grpc_subchannel_call *subchannel_call);
105
106 struct grpc_subchannel_args {
109 const grpc_channel_filter **filters;
111 size_t filter_count;
113 const grpc_channel_args *args;
115 struct sockaddr *addr;
116 size_t addr_len;
118 grpc_mdctx *mdctx;
120 grpc_channel *master;
121 };
122
124 grpc_subchannel *grpc_subchannel_create(grpc_connector *connector,
125 grpc_subchannel_args *args);
126
127 #endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_SUBCHANNEL_H */
grpc_channel_filter
Definition: channel_stack.h:64
grpc_connectivity_state
grpc_connectivity_state
Connectivity state of a channel.
Definition: grpc.h:139
grpc_subchannel_process_transport_op
void grpc_subchannel_process_transport_op(grpc_subchannel *subchannel, grpc_transport_op *op)
process a transport level op
Definition: subchannel.c:406
grpc_subchannel_args::args
const grpc_channel_args * args
Channel arguments to be supplied to the newly created channel.
Definition: subchannel.h:113
grpc_subchannel_args::master
grpc_channel * master
master channel
Definition: subchannel.h:120
grpc_subchannel_args::filter_count
size_t filter_count
The number of filters in the above array.
Definition: subchannel.h:111
grpc_subchannel_unref
void grpc_subchannel_unref(grpc_subchannel *channel)
grpc_subchannel_args::filters
const grpc_channel_filter ** filters
Channel filters for this channel - wrapped factories will likely want to mutate this.
Definition: subchannel.h:109
grpc_channel
Definition: channel.c:61
grpc_channel_args
An array of arguments that can be passed around.
Definition: grpc.h:113
GRPC_SUBCHANNEL_REF_EXTRA_ARGS
#define GRPC_SUBCHANNEL_REF_EXTRA_ARGS
Definition: subchannel.h:62
grpc_subchannel_args
Definition: subchannel.h:106
grpc_subchannel_del_interested_party
void grpc_subchannel_del_interested_party(grpc_subchannel *channel, grpc_pollset *pollset)
Definition: subchannel.c:270
grpc_transport_stream_op
Definition: transport.h:66
grpc_subchannel_add_interested_party
void grpc_subchannel_add_interested_party(grpc_subchannel *channel, grpc_pollset *pollset)
Definition: subchannel.c:265
channel_stack.h
connector
Definition: secure_channel_create.c:54
grpc_pollset
Definition: pollset_posix.h:48
grpc_subchannel
Definition: subchannel.c:77
grpc_subchannel_notify_on_state_change
void grpc_subchannel_notify_on_state_change(grpc_subchannel *channel, grpc_connectivity_state *state, grpc_iomgr_closure *notify)
call notify when the connectivity state of a channel changes from *state.
Definition: subchannel.c:386
grpc_subchannel_check_connectivity
grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel *channel)
poll the current connectivity state of a channel
Definition: subchannel.c:378
grpc_mdctx
Definition: metadata.c:98
grpc_connector
Definition: connector.h:44
grpc_subchannel_args::addr_len
size_t addr_len
Definition: subchannel.h:116
grpc_iomgr_closure
A closure over a grpc_iomgr_cb_func.
Definition: iomgr.h:45
grpc_subchannel_call_ref
void grpc_subchannel_call_ref(grpc_subchannel_call *call)
grpc_subchannel_args::addr
struct sockaddr * addr
Address to connect to.
Definition: subchannel.h:115
grpc_subchannel_call_get_peer
char * grpc_subchannel_call_get_peer(grpc_subchannel_call *subchannel_call)
continue querying for peer
Definition: subchannel.c:712
grpc_subchannel_ref
void grpc_subchannel_ref(grpc_subchannel *channel)
grpc_subchannel_create
grpc_subchannel * grpc_subchannel_create(grpc_connector *connector, grpc_subchannel_args *args)
create a subchannel given a connector
Definition: subchannel.c:279
grpc_subchannel_args::mdctx
grpc_mdctx * mdctx
metadata context to use
Definition: subchannel.h:118
grpc_subchannel_call_unref
void grpc_subchannel_call_unref(grpc_subchannel_call *call)
grpc_subchannel_create_call
void grpc_subchannel_create_call(grpc_subchannel *subchannel, grpc_pollset *pollset, grpc_subchannel_call **target, grpc_iomgr_closure *notify)
construct a call (possibly asynchronously)
Definition: subchannel.c:339
connector.h
grpc_subchannel_call_process_op
void grpc_subchannel_call_process_op(grpc_subchannel_call *subchannel_call, grpc_transport_stream_op *op)
continue processing a transport op
Definition: subchannel.c:718
grpc_transport_op
Transport op: a set of operations to perform on a transport as a whole.
Definition: transport.h:90
grpc_subchannel_call
Definition: subchannel.c:138