diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-20 19:53:24 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-20 19:53:24 +0000 |
commit | 03f0ae4bb10cf55bb9bab601d45fd96c2eb13603 (patch) | |
tree | 9089fc11319e7de97c43d2e0bf8e6d9b67836b92 /src/transport/gnunet-service-transport.h | |
parent | 450982bb56fde81bd512cb21360b809482caf19b (diff) | |
download | gnunet-03f0ae4bb10cf55bb9bab601d45fd96c2eb13603.tar.gz gnunet-03f0ae4bb10cf55bb9bab601d45fd96c2eb13603.zip |
migrating transport service to new MQ API
Diffstat (limited to 'src/transport/gnunet-service-transport.h')
-rw-r--r-- | src/transport/gnunet-service-transport.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index 981996a00..2807afd79 100644 --- a/src/transport/gnunet-service-transport.h +++ b/src/transport/gnunet-service-transport.h | |||
@@ -92,6 +92,83 @@ typedef void | |||
92 | 92 | ||
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Continuation called from a blacklist test. | ||
96 | * | ||
97 | * @param cls closure | ||
98 | * @param peer identity of peer that was tested | ||
99 | * @param address address associated with the request | ||
100 | * @param session session associated with the request | ||
101 | * @param result #GNUNET_OK if the connection is allowed, | ||
102 | * #GNUNET_NO if not, | ||
103 | * #GNUNET_SYSERR if operation was aborted | ||
104 | */ | ||
105 | typedef void | ||
106 | (*GST_BlacklistTestContinuation) (void *cls, | ||
107 | const struct GNUNET_PeerIdentity *peer, | ||
108 | const struct GNUNET_HELLO_Address *address, | ||
109 | struct GNUNET_ATS_Session *session, | ||
110 | int result); | ||
111 | |||
112 | |||
113 | /** | ||
114 | * Add the given peer to the blacklist (for the given transport). | ||
115 | * | ||
116 | * @param peer peer to blacklist | ||
117 | * @param transport_name transport to blacklist for this peer, NULL for all | ||
118 | */ | ||
119 | void | ||
120 | GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, | ||
121 | const char *transport_name); | ||
122 | |||
123 | |||
124 | /** | ||
125 | * Handle to an active blacklist check. | ||
126 | */ | ||
127 | struct GST_BlacklistCheck; | ||
128 | |||
129 | |||
130 | |||
131 | /** | ||
132 | * Test if a peer/transport combination is blacklisted. | ||
133 | * | ||
134 | * @param peer the identity of the peer to test | ||
135 | * @param transport_name name of the transport to test, never NULL | ||
136 | * @param cont function to call with result | ||
137 | * @param cont_cls closure for @a cont | ||
138 | * @param address address to pass back to @a cont, can be NULL | ||
139 | * @param session session to pass back to @a cont, can be NULL | ||
140 | * @return handle to the blacklist check, NULL if the decision | ||
141 | * was made instantly and @a cont was already called | ||
142 | */ | ||
143 | struct GST_BlacklistCheck * | ||
144 | GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer, | ||
145 | const char *transport_name, | ||
146 | GST_BlacklistTestContinuation cont, | ||
147 | void *cont_cls, | ||
148 | const struct GNUNET_HELLO_Address *address, | ||
149 | struct GNUNET_ATS_Session *session); | ||
150 | |||
151 | |||
152 | /** | ||
153 | * Abort blacklist if @a address and @a session match. | ||
154 | * | ||
155 | * @param address address used to abort matching checks | ||
156 | * @param session session used to abort matching checks | ||
157 | */ | ||
158 | void | ||
159 | GST_blacklist_abort_matching (const struct GNUNET_HELLO_Address *address, | ||
160 | struct GNUNET_ATS_Session *session); | ||
161 | |||
162 | /** | ||
163 | * Cancel a blacklist check. | ||
164 | * | ||
165 | * @param bc check to cancel | ||
166 | */ | ||
167 | void | ||
168 | GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc); | ||
169 | |||
170 | |||
171 | /** | ||
95 | * Function called by the transport for each received message. | 172 | * Function called by the transport for each received message. |
96 | * | 173 | * |
97 | * @param cls closure, const char* with the name of the plugin we received the message from | 174 | * @param cls closure, const char* with the name of the plugin we received the message from |
@@ -110,6 +187,41 @@ GST_receive_callback (void *cls, | |||
110 | struct GNUNET_ATS_Session *session, | 187 | struct GNUNET_ATS_Session *session, |
111 | const struct GNUNET_MessageHeader *message); | 188 | const struct GNUNET_MessageHeader *message); |
112 | 189 | ||
190 | /** | ||
191 | * Broadcast the given message to all of our clients. | ||
192 | * | ||
193 | * @param msg message to broadcast | ||
194 | * @param may_drop #GNUNET_YES if the message can be dropped / is payload | ||
195 | */ | ||
196 | void | ||
197 | GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, | ||
198 | int may_drop); | ||
199 | |||
200 | |||
201 | /** | ||
202 | * Broadcast the new active address to all clients monitoring the peer. | ||
203 | * | ||
204 | * @param peer peer this update is about (never NULL) | ||
205 | * @param address address, NULL on disconnect | ||
206 | * @param state the current state of the peer | ||
207 | * @param state_timeout the time out for the state | ||
208 | */ | ||
209 | void | ||
210 | GST_clients_broadcast_peer_notification (const struct GNUNET_PeerIdentity *peer, | ||
211 | const struct GNUNET_HELLO_Address *address, | ||
212 | enum GNUNET_TRANSPORT_PeerState state, | ||
213 | struct GNUNET_TIME_Absolute state_timeout); | ||
214 | |||
215 | |||
216 | /** | ||
217 | * Notify all clients about a disconnect, and cancel | ||
218 | * pending SEND_OK messages for this peer. | ||
219 | * | ||
220 | * @param peer peer that disconnected | ||
221 | */ | ||
222 | void | ||
223 | GST_clients_broadcast_disconnect (const struct GNUNET_PeerIdentity *peer); | ||
224 | |||
113 | 225 | ||
114 | 226 | ||
115 | 227 | ||