diff options
Diffstat (limited to 'src/include/gnunet_mesh_service.h')
-rw-r--r-- | src/include/gnunet_mesh_service.h | 173 |
1 files changed, 70 insertions, 103 deletions
diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h index 507b766d1..bea706478 100644 --- a/src/include/gnunet_mesh_service.h +++ b/src/include/gnunet_mesh_service.h | |||
@@ -138,17 +138,11 @@ typedef uint32_t GNUNET_MESH_ApplicationType; | |||
138 | * @return handle to the mesh service | 138 | * @return handle to the mesh service |
139 | * NULL on error (in this case, init is never called) | 139 | * NULL on error (in this case, init is never called) |
140 | */ | 140 | */ |
141 | struct GNUNET_MESH_Handle *GNUNET_MESH_connect (const struct | 141 | struct GNUNET_MESH_Handle * |
142 | GNUNET_CONFIGURATION_Handle | 142 | GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, |
143 | *cfg, void *cls, | 143 | GNUNET_MESH_TunnelEndHandler cleaner, |
144 | GNUNET_MESH_TunnelEndHandler | 144 | const struct GNUNET_MESH_MessageHandler *handlers, |
145 | cleaner, | 145 | const GNUNET_MESH_ApplicationType *stypes); |
146 | const struct | ||
147 | GNUNET_MESH_MessageHandler | ||
148 | *handlers, | ||
149 | const | ||
150 | GNUNET_MESH_ApplicationType | ||
151 | *stypes); | ||
152 | 146 | ||
153 | /** | 147 | /** |
154 | * Get the peer on the other side of this tunnel if it is just one. Return NULL otherwise | 148 | * Get the peer on the other side of this tunnel if it is just one. Return NULL otherwise |
@@ -156,9 +150,8 @@ struct GNUNET_MESH_Handle *GNUNET_MESH_connect (const struct | |||
156 | * @param tunnel the tunnel | 150 | * @param tunnel the tunnel |
157 | * @return the peer or NULL | 151 | * @return the peer or NULL |
158 | */ | 152 | */ |
159 | const struct GNUNET_PeerIdentity *GNUNET_MESH_get_peer (const struct | 153 | const struct GNUNET_PeerIdentity * |
160 | GNUNET_MESH_Tunnel | 154 | GNUNET_MESH_get_peer (const struct GNUNET_MESH_Tunnel *tunnel); |
161 | *tunnel); | ||
162 | 155 | ||
163 | 156 | ||
164 | /** | 157 | /** |
@@ -166,7 +159,8 @@ const struct GNUNET_PeerIdentity *GNUNET_MESH_get_peer (const struct | |||
166 | * | 159 | * |
167 | * @param handle connection to mesh to disconnect | 160 | * @param handle connection to mesh to disconnect |
168 | */ | 161 | */ |
169 | void GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); | 162 | void |
163 | GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); | ||
170 | 164 | ||
171 | 165 | ||
172 | 166 | ||
@@ -220,23 +214,15 @@ struct GNUNET_MESH_PeerRequestHandle; | |||
220 | * @param handler_cls closure for handler | 214 | * @param handler_cls closure for handler |
221 | * @return NULL on error (handler will not be called), otherwise handle for cancellation | 215 | * @return NULL on error (handler will not be called), otherwise handle for cancellation |
222 | */ | 216 | */ |
223 | struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_any (struct | 217 | struct GNUNET_MESH_Tunnel * |
224 | GNUNET_MESH_Handle | 218 | GNUNET_MESH_peer_request_connect_any (struct GNUNET_MESH_Handle *h, |
225 | *h, | 219 | struct GNUNET_TIME_Relative timeout, |
226 | struct | 220 | unsigned int num_peers, |
227 | GNUNET_TIME_Relative | 221 | const struct GNUNET_PeerIdentity *peers, |
228 | timeout, | 222 | GNUNET_MESH_TunnelConnectHandler |
229 | unsigned int | 223 | connect_handler, |
230 | num_peers, | 224 | GNUNET_MESH_TunnelDisconnectHandler |
231 | const struct | 225 | disconnect_handler, void *handler_cls); |
232 | GNUNET_PeerIdentity | ||
233 | *peers, | ||
234 | GNUNET_MESH_TunnelConnectHandler | ||
235 | connect_handler, | ||
236 | GNUNET_MESH_TunnelDisconnectHandler | ||
237 | disconnect_handler, | ||
238 | void | ||
239 | *handler_cls); | ||
240 | 226 | ||
241 | 227 | ||
242 | /** | 228 | /** |
@@ -256,23 +242,15 @@ struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_any (struct | |||
256 | * @param handler_cls closure for handler | 242 | * @param handler_cls closure for handler |
257 | * @return NULL on error (handler will not be called), otherwise handle for cancellation | 243 | * @return NULL on error (handler will not be called), otherwise handle for cancellation |
258 | */ | 244 | */ |
259 | struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_all (struct | 245 | struct GNUNET_MESH_Tunnel * |
260 | GNUNET_MESH_Handle | 246 | GNUNET_MESH_peer_request_connect_all (struct GNUNET_MESH_Handle *h, |
261 | *h, | 247 | struct GNUNET_TIME_Relative timeout, |
262 | struct | 248 | unsigned int num_peers, |
263 | GNUNET_TIME_Relative | 249 | const struct GNUNET_PeerIdentity *peers, |
264 | timeout, | 250 | GNUNET_MESH_TunnelConnectHandler |
265 | unsigned int | 251 | connect_handler, |
266 | num_peers, | 252 | GNUNET_MESH_TunnelDisconnectHandler |
267 | const struct | 253 | disconnect_handler, void *handler_cls); |
268 | GNUNET_PeerIdentity | ||
269 | *peers, | ||
270 | GNUNET_MESH_TunnelConnectHandler | ||
271 | connect_handler, | ||
272 | GNUNET_MESH_TunnelDisconnectHandler | ||
273 | disconnect_handler, | ||
274 | void | ||
275 | *handler_cls); | ||
276 | 254 | ||
277 | 255 | ||
278 | /** | 256 | /** |
@@ -283,10 +261,10 @@ struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_all (struct | |||
283 | * @param timeout how long to try to establish a connection | 261 | * @param timeout how long to try to establish a connection |
284 | * @param peer peer to add | 262 | * @param peer peer to add |
285 | */ | 263 | */ |
286 | void GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, | 264 | void |
287 | struct GNUNET_TIME_Relative timeout, | 265 | GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, |
288 | const struct GNUNET_PeerIdentity | 266 | struct GNUNET_TIME_Relative timeout, |
289 | *peer); | 267 | const struct GNUNET_PeerIdentity *peer); |
290 | 268 | ||
291 | 269 | ||
292 | /** | 270 | /** |
@@ -296,9 +274,9 @@ void GNUNET_MESH_peer_request_connect_add (struct GNUNET_MESH_Tunnel *tunnel, | |||
296 | * @param tunnel handle to existing tunnel | 274 | * @param tunnel handle to existing tunnel |
297 | * @param peer peer to remove | 275 | * @param peer peer to remove |
298 | */ | 276 | */ |
299 | void GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, | 277 | void |
300 | const struct GNUNET_PeerIdentity | 278 | GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, |
301 | *peer); | 279 | const struct GNUNET_PeerIdentity *peer); |
302 | 280 | ||
303 | 281 | ||
304 | /** | 282 | /** |
@@ -318,20 +296,15 @@ void GNUNET_MESH_peer_request_connect_del (struct GNUNET_MESH_Tunnel *tunnel, | |||
318 | * @param handler_cls closure for handler | 296 | * @param handler_cls closure for handler |
319 | * @return NULL on error (handler will not be called), otherwise handle for cancellation | 297 | * @return NULL on error (handler will not be called), otherwise handle for cancellation |
320 | */ | 298 | */ |
321 | struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_by_type (struct | 299 | struct GNUNET_MESH_Tunnel * |
322 | GNUNET_MESH_Handle | 300 | GNUNET_MESH_peer_request_connect_by_type (struct GNUNET_MESH_Handle *h, |
323 | *h, | 301 | struct GNUNET_TIME_Relative timeout, |
324 | struct | 302 | GNUNET_MESH_ApplicationType app_type, |
325 | GNUNET_TIME_Relative | 303 | GNUNET_MESH_TunnelConnectHandler |
326 | timeout, | 304 | connect_handler, |
327 | GNUNET_MESH_ApplicationType | 305 | GNUNET_MESH_TunnelDisconnectHandler |
328 | app_type, | 306 | disconnect_handler, |
329 | GNUNET_MESH_TunnelConnectHandler | 307 | void *handler_cls); |
330 | connect_handler, | ||
331 | GNUNET_MESH_TunnelDisconnectHandler | ||
332 | disconnect_handler, | ||
333 | void | ||
334 | *handler_cls); | ||
335 | 308 | ||
336 | 309 | ||
337 | /** | 310 | /** |
@@ -340,7 +313,8 @@ struct GNUNET_MESH_Tunnel *GNUNET_MESH_peer_request_connect_by_type (struct | |||
340 | * | 313 | * |
341 | * @param req request handle that was returned for the original request | 314 | * @param req request handle that was returned for the original request |
342 | */ | 315 | */ |
343 | void GNUNET_MESH_peer_request_connect_cancel (struct GNUNET_MESH_Tunnel *req); | 316 | void |
317 | GNUNET_MESH_peer_request_connect_cancel (struct GNUNET_MESH_Tunnel *req); | ||
344 | 318 | ||
345 | 319 | ||
346 | /** | 320 | /** |
@@ -370,25 +344,14 @@ struct GNUNET_MESH_TransmitHandle; | |||
370 | * NULL if we can not even queue the request (insufficient | 344 | * NULL if we can not even queue the request (insufficient |
371 | * memory); if NULL is returned, "notify" will NOT be called. | 345 | * memory); if NULL is returned, "notify" will NOT be called. |
372 | */ | 346 | */ |
373 | struct GNUNET_MESH_TransmitHandle *GNUNET_MESH_notify_transmit_ready (struct | 347 | struct GNUNET_MESH_TransmitHandle * |
374 | GNUNET_MESH_Tunnel | 348 | GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Tunnel *tunnel, int cork, |
375 | *tunnel, | 349 | uint32_t priority, |
376 | int cork, | 350 | struct GNUNET_TIME_Relative maxdelay, |
377 | uint32_t | 351 | const struct GNUNET_PeerIdentity *target, |
378 | priority, | 352 | size_t notify_size, |
379 | struct | 353 | GNUNET_CONNECTION_TransmitReadyNotify notify, |
380 | GNUNET_TIME_Relative | 354 | void *notify_cls); |
381 | maxdelay, | ||
382 | const | ||
383 | struct | ||
384 | GNUNET_PeerIdentity | ||
385 | *target, | ||
386 | size_t | ||
387 | notify_size, | ||
388 | GNUNET_CONNECTION_TransmitReadyNotify | ||
389 | notify, | ||
390 | void | ||
391 | *notify_cls); | ||
392 | 355 | ||
393 | 356 | ||
394 | /** | 357 | /** |
@@ -396,19 +359,23 @@ struct GNUNET_MESH_TransmitHandle *GNUNET_MESH_notify_transmit_ready (struct | |||
396 | * | 359 | * |
397 | * @param th handle that was returned by "notify_transmit_ready". | 360 | * @param th handle that was returned by "notify_transmit_ready". |
398 | */ | 361 | */ |
399 | void GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle | 362 | void |
400 | *th); | 363 | GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle |
401 | 364 | *th); | |
402 | void GNUNET_MESH_tunnel_set_head (struct GNUNET_MESH_Tunnel *tunnel, | 365 | |
403 | void *head); | 366 | void |
404 | void GNUNET_MESH_tunnel_set_tail (struct GNUNET_MESH_Tunnel *tunnel, | 367 | GNUNET_MESH_tunnel_set_head (struct GNUNET_MESH_Tunnel *tunnel, void *head); |
405 | void *tail); | 368 | void |
406 | void *GNUNET_MESH_tunnel_get_head (struct GNUNET_MESH_Tunnel *tunnel); | 369 | GNUNET_MESH_tunnel_set_tail (struct GNUNET_MESH_Tunnel *tunnel, void *tail); |
407 | void *GNUNET_MESH_tunnel_get_tail (struct GNUNET_MESH_Tunnel *tunnel); | 370 | void * |
408 | 371 | GNUNET_MESH_tunnel_get_head (struct GNUNET_MESH_Tunnel *tunnel); | |
409 | void GNUNET_MESH_tunnel_set_data (struct GNUNET_MESH_Tunnel *tunnel, | 372 | void * |
410 | void *data); | 373 | GNUNET_MESH_tunnel_get_tail (struct GNUNET_MESH_Tunnel *tunnel); |
411 | void *GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel); | 374 | |
375 | void | ||
376 | GNUNET_MESH_tunnel_set_data (struct GNUNET_MESH_Tunnel *tunnel, void *data); | ||
377 | void * | ||
378 | GNUNET_MESH_tunnel_get_data (struct GNUNET_MESH_Tunnel *tunnel); | ||
412 | 379 | ||
413 | #if 0 /* keep Emacsens' auto-indent happy */ | 380 | #if 0 /* keep Emacsens' auto-indent happy */ |
414 | { | 381 | { |