diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_tunnels.h')
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnels.h | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnels.h b/src/cadet/gnunet-service-cadet_tunnels.h index 0df35cd23..ef07badea 100644 --- a/src/cadet/gnunet-service-cadet_tunnels.h +++ b/src/cadet/gnunet-service-cadet_tunnels.h | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
4 | Copyright (C) 2001-2017 GNUnet e.V. | 3 | Copyright (C) 2001-2017 GNUnet e.V. |
@@ -41,7 +40,8 @@ | |||
41 | /** | 40 | /** |
42 | * All the encryption states a tunnel can be in. | 41 | * All the encryption states a tunnel can be in. |
43 | */ | 42 | */ |
44 | enum CadetTunnelEState { | 43 | enum CadetTunnelEState |
44 | { | ||
45 | /** | 45 | /** |
46 | * Uninitialized status, we need to send KX. We will stay | 46 | * Uninitialized status, we need to send KX. We will stay |
47 | * in this state until the first connection is up. | 47 | * in this state until the first connection is up. |
@@ -89,7 +89,7 @@ enum CadetTunnelEState { | |||
89 | * @return Static string the destination peer's ID. | 89 | * @return Static string the destination peer's ID. |
90 | */ | 90 | */ |
91 | const char * | 91 | const char * |
92 | GCT_2s(const struct CadetTunnel *t); | 92 | GCT_2s (const struct CadetTunnel *t); |
93 | 93 | ||
94 | 94 | ||
95 | /** | 95 | /** |
@@ -100,7 +100,7 @@ GCT_2s(const struct CadetTunnel *t); | |||
100 | * @return new tunnel to @a destination | 100 | * @return new tunnel to @a destination |
101 | */ | 101 | */ |
102 | struct CadetTunnel * | 102 | struct CadetTunnel * |
103 | GCT_create_tunnel(struct CadetPeer *destination); | 103 | GCT_create_tunnel (struct CadetPeer *destination); |
104 | 104 | ||
105 | 105 | ||
106 | /** | 106 | /** |
@@ -109,7 +109,7 @@ GCT_create_tunnel(struct CadetPeer *destination); | |||
109 | * @param t tunnel to destroy | 109 | * @param t tunnel to destroy |
110 | */ | 110 | */ |
111 | void | 111 | void |
112 | GCT_destroy_tunnel_now(struct CadetTunnel *t); | 112 | GCT_destroy_tunnel_now (struct CadetTunnel *t); |
113 | 113 | ||
114 | 114 | ||
115 | /** | 115 | /** |
@@ -122,9 +122,10 @@ GCT_destroy_tunnel_now(struct CadetTunnel *t); | |||
122 | * #GNUNET_SYSERR on failure (duplicate connection) | 122 | * #GNUNET_SYSERR on failure (duplicate connection) |
123 | */ | 123 | */ |
124 | int | 124 | int |
125 | GCT_add_inbound_connection(struct CadetTunnel *t, | 125 | GCT_add_inbound_connection (struct CadetTunnel *t, |
126 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | 126 | const struct |
127 | struct CadetPeerPath *path); | 127 | GNUNET_CADET_ConnectionTunnelIdentifier *cid, |
128 | struct CadetPeerPath *path); | ||
128 | 129 | ||
129 | 130 | ||
130 | /** | 131 | /** |
@@ -134,7 +135,7 @@ GCT_add_inbound_connection(struct CadetTunnel *t, | |||
134 | * @param ct binding of connection to tunnel of the connection that was lost. | 135 | * @param ct binding of connection to tunnel of the connection that was lost. |
135 | */ | 136 | */ |
136 | void | 137 | void |
137 | GCT_connection_lost(struct CadetTConnection *ct); | 138 | GCT_connection_lost (struct CadetTConnection *ct); |
138 | 139 | ||
139 | 140 | ||
140 | /** | 141 | /** |
@@ -144,7 +145,7 @@ GCT_connection_lost(struct CadetTConnection *ct); | |||
144 | * @return the destination of the tunnel | 145 | * @return the destination of the tunnel |
145 | */ | 146 | */ |
146 | struct CadetPeer * | 147 | struct CadetPeer * |
147 | GCT_get_destination(struct CadetTunnel *t); | 148 | GCT_get_destination (struct CadetTunnel *t); |
148 | 149 | ||
149 | 150 | ||
150 | /** | 151 | /** |
@@ -156,9 +157,9 @@ GCT_get_destination(struct CadetTunnel *t); | |||
156 | * @param off offset of the destination on path @a path | 157 | * @param off offset of the destination on path @a path |
157 | */ | 158 | */ |
158 | void | 159 | void |
159 | GCT_consider_path(struct CadetTunnel *t, | 160 | GCT_consider_path (struct CadetTunnel *t, |
160 | struct CadetPeerPath *p, | 161 | struct CadetPeerPath *p, |
161 | unsigned int off); | 162 | unsigned int off); |
162 | 163 | ||
163 | 164 | ||
164 | /** | 165 | /** |
@@ -169,8 +170,8 @@ GCT_consider_path(struct CadetTunnel *t, | |||
169 | * @return unique number identifying @a ch within @a t | 170 | * @return unique number identifying @a ch within @a t |
170 | */ | 171 | */ |
171 | struct GNUNET_CADET_ChannelTunnelNumber | 172 | struct GNUNET_CADET_ChannelTunnelNumber |
172 | GCT_add_channel(struct CadetTunnel *t, | 173 | GCT_add_channel (struct CadetTunnel *t, |
173 | struct CadetChannel *ch); | 174 | struct CadetChannel *ch); |
174 | 175 | ||
175 | 176 | ||
176 | /** | 177 | /** |
@@ -181,9 +182,9 @@ GCT_add_channel(struct CadetTunnel *t, | |||
181 | * @param ctn unique number identifying @a ch within @a t | 182 | * @param ctn unique number identifying @a ch within @a t |
182 | */ | 183 | */ |
183 | void | 184 | void |
184 | GCT_remove_channel(struct CadetTunnel *t, | 185 | GCT_remove_channel (struct CadetTunnel *t, |
185 | struct CadetChannel *ch, | 186 | struct CadetChannel *ch, |
186 | struct GNUNET_CADET_ChannelTunnelNumber ctn); | 187 | struct GNUNET_CADET_ChannelTunnelNumber ctn); |
187 | 188 | ||
188 | 189 | ||
189 | /** | 190 | /** |
@@ -193,8 +194,8 @@ GCT_remove_channel(struct CadetTunnel *t, | |||
193 | * @param ctn ID of the channel to destroy | 194 | * @param ctn ID of the channel to destroy |
194 | */ | 195 | */ |
195 | void | 196 | void |
196 | GCT_send_channel_destroy(struct CadetTunnel *t, | 197 | GCT_send_channel_destroy (struct CadetTunnel *t, |
197 | struct GNUNET_CADET_ChannelTunnelNumber ctn); | 198 | struct GNUNET_CADET_ChannelTunnelNumber ctn); |
198 | 199 | ||
199 | 200 | ||
200 | /** | 201 | /** |
@@ -207,7 +208,8 @@ GCT_send_channel_destroy(struct CadetTunnel *t, | |||
207 | */ | 208 | */ |
208 | typedef void | 209 | typedef void |
209 | (*GCT_SendContinuation)(void *cls, | 210 | (*GCT_SendContinuation)(void *cls, |
210 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid); | 211 | const struct |
212 | GNUNET_CADET_ConnectionTunnelIdentifier *cid); | ||
211 | 213 | ||
212 | 214 | ||
213 | /** | 215 | /** |
@@ -221,10 +223,10 @@ typedef void | |||
221 | * @return Handle to cancel message. | 223 | * @return Handle to cancel message. |
222 | */ | 224 | */ |
223 | struct CadetTunnelQueueEntry * | 225 | struct CadetTunnelQueueEntry * |
224 | GCT_send(struct CadetTunnel *t, | 226 | GCT_send (struct CadetTunnel *t, |
225 | const struct GNUNET_MessageHeader *message, | 227 | const struct GNUNET_MessageHeader *message, |
226 | GCT_SendContinuation cont, | 228 | GCT_SendContinuation cont, |
227 | void *cont_cls); | 229 | void *cont_cls); |
228 | 230 | ||
229 | 231 | ||
230 | /** | 232 | /** |
@@ -237,7 +239,7 @@ GCT_send(struct CadetTunnel *t, | |||
237 | * @param q Handle to the queue entry to cancel. | 239 | * @param q Handle to the queue entry to cancel. |
238 | */ | 240 | */ |
239 | void | 241 | void |
240 | GCT_send_cancel(struct CadetTunnelQueueEntry *q); | 242 | GCT_send_cancel (struct CadetTunnelQueueEntry *q); |
241 | 243 | ||
242 | 244 | ||
243 | /** | 245 | /** |
@@ -247,7 +249,7 @@ GCT_send_cancel(struct CadetTunnelQueueEntry *q); | |||
247 | * @return number of channels using the tunnel | 249 | * @return number of channels using the tunnel |
248 | */ | 250 | */ |
249 | unsigned int | 251 | unsigned int |
250 | GCT_count_channels(struct CadetTunnel *t); | 252 | GCT_count_channels (struct CadetTunnel *t); |
251 | 253 | ||
252 | 254 | ||
253 | /** | 255 | /** |
@@ -257,7 +259,7 @@ GCT_count_channels(struct CadetTunnel *t); | |||
257 | * @return number of connections available for the tunnel | 259 | * @return number of connections available for the tunnel |
258 | */ | 260 | */ |
259 | unsigned int | 261 | unsigned int |
260 | GCT_count_any_connections(const struct CadetTunnel *t); | 262 | GCT_count_any_connections (const struct CadetTunnel *t); |
261 | 263 | ||
262 | 264 | ||
263 | /** | 265 | /** |
@@ -279,9 +281,9 @@ typedef void | |||
279 | * @param iter_cls Closure for @c iter. | 281 | * @param iter_cls Closure for @c iter. |
280 | */ | 282 | */ |
281 | void | 283 | void |
282 | GCT_iterate_connections(struct CadetTunnel *t, | 284 | GCT_iterate_connections (struct CadetTunnel *t, |
283 | GCT_ConnectionIterator iter, | 285 | GCT_ConnectionIterator iter, |
284 | void *iter_cls); | 286 | void *iter_cls); |
285 | 287 | ||
286 | 288 | ||
287 | /** | 289 | /** |
@@ -303,9 +305,9 @@ typedef void | |||
303 | * @param iter_cls Closure for @c iter. | 305 | * @param iter_cls Closure for @c iter. |
304 | */ | 306 | */ |
305 | void | 307 | void |
306 | GCT_iterate_channels(struct CadetTunnel *t, | 308 | GCT_iterate_channels (struct CadetTunnel *t, |
307 | GCT_ChannelIterator iter, | 309 | GCT_ChannelIterator iter, |
308 | void *iter_cls); | 310 | void *iter_cls); |
309 | 311 | ||
310 | 312 | ||
311 | /** | 313 | /** |
@@ -316,7 +318,7 @@ GCT_iterate_channels(struct CadetTunnel *t, | |||
316 | * @return Tunnel's encryption state. | 318 | * @return Tunnel's encryption state. |
317 | */ | 319 | */ |
318 | enum CadetTunnelEState | 320 | enum CadetTunnelEState |
319 | GCT_get_estate(struct CadetTunnel *t); | 321 | GCT_get_estate (struct CadetTunnel *t); |
320 | 322 | ||
321 | 323 | ||
322 | /** | 324 | /** |
@@ -326,8 +328,8 @@ GCT_get_estate(struct CadetTunnel *t); | |||
326 | * @param msg the key exchange message | 328 | * @param msg the key exchange message |
327 | */ | 329 | */ |
328 | void | 330 | void |
329 | GCT_handle_kx(struct CadetTConnection *ct, | 331 | GCT_handle_kx (struct CadetTConnection *ct, |
330 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); | 332 | const struct GNUNET_CADET_TunnelKeyExchangeMessage *msg); |
331 | 333 | ||
332 | 334 | ||
333 | /** | 335 | /** |
@@ -337,8 +339,9 @@ GCT_handle_kx(struct CadetTConnection *ct, | |||
337 | * @param msg the key exchange message | 339 | * @param msg the key exchange message |
338 | */ | 340 | */ |
339 | void | 341 | void |
340 | GCT_handle_kx_auth(struct CadetTConnection *ct, | 342 | GCT_handle_kx_auth (struct CadetTConnection *ct, |
341 | const struct GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg); | 343 | const struct |
344 | GNUNET_CADET_TunnelKeyExchangeAuthMessage *msg); | ||
342 | 345 | ||
343 | 346 | ||
344 | /** | 347 | /** |
@@ -348,8 +351,8 @@ GCT_handle_kx_auth(struct CadetTConnection *ct, | |||
348 | * @param msg the encrypted message to decrypt | 351 | * @param msg the encrypted message to decrypt |
349 | */ | 352 | */ |
350 | void | 353 | void |
351 | GCT_handle_encrypted(struct CadetTConnection *ct, | 354 | GCT_handle_encrypted (struct CadetTConnection *ct, |
352 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg); | 355 | const struct GNUNET_CADET_TunnelEncryptedMessage *msg); |
353 | 356 | ||
354 | 357 | ||
355 | /** | 358 | /** |
@@ -359,8 +362,8 @@ GCT_handle_encrypted(struct CadetTConnection *ct, | |||
359 | * @param level Debug level to use. | 362 | * @param level Debug level to use. |
360 | */ | 363 | */ |
361 | void | 364 | void |
362 | GCT_debug(const struct CadetTunnel *t, | 365 | GCT_debug (const struct CadetTunnel *t, |
363 | enum GNUNET_ErrorType level); | 366 | enum GNUNET_ErrorType level); |
364 | 367 | ||
365 | 368 | ||
366 | #endif | 369 | #endif |