aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-07 22:05:39 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-07 22:05:39 +0000
commit8cd02da71a542322a98429e9b071da8b1c013fc5 (patch)
treea8c8adef78eb0d667e00930bc00535ffec4193fe /src
parentc2285a823c199a7dd8c95b5441cfd681aac4f7e6 (diff)
downloadgnunet-8cd02da71a542322a98429e9b071da8b1c013fc5.tar.gz
gnunet-8cd02da71a542322a98429e9b071da8b1c013fc5.zip
-indentation, doxygen
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_cadet_service.h172
1 files changed, 90 insertions, 82 deletions
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index 14826c40b..015a59ebf 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009 - 2013 Christian Grothoff (and other contributing authors) 3 (C) 2009-2014 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -17,13 +17,12 @@
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20
21/** 20/**
22 * @file include/gnunet_cadet_service.h 21 * @file include/gnunet_cadet_service.h
23 * @brief cadet service; establish channels to distant peers 22 * @brief cadet service; establish channels to distant peers
24 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * @author Bart Polot
25 */ 25 */
26
27#ifndef GNUNET_CADET_SERVICE_H 26#ifndef GNUNET_CADET_SERVICE_H
28#define GNUNET_CADET_SERVICE_H 27#define GNUNET_CADET_SERVICE_H
29 28
@@ -56,17 +55,17 @@ struct GNUNET_CADET_Channel;
56 55
57/** 56/**
58 * Hash to be used in Cadet communication. Only 256 bits needed, 57 * Hash to be used in Cadet communication. Only 256 bits needed,
59 * instead of the 512 from @c GNUNET_HashCode. 58 * instead of the 512 from `struct GNUNET_HashCode`.
60 *
61 */ 59 */
62struct GNUNET_CADET_Hash 60struct GNUNET_CADET_Hash
63{ 61{
64 unsigned char bits[256 / 8]; 62 unsigned char bits[256 / 8];
65}; 63};
66 64
65
67/** 66/**
68 * Channel options. 67 * Channel options. Second line indicates filed in the
69 * Second line indicates filed in the CadetChannelInfo union carrying the answer. 68 * CadetChannelInfo union carrying the answer.
70 */ 69 */
71enum GNUNET_CADET_ChannelOption 70enum GNUNET_CADET_ChannelOption
72{ 71{
@@ -118,10 +117,11 @@ enum GNUNET_CADET_ChannelOption
118 * @return #GNUNET_OK to keep the channel open, 117 * @return #GNUNET_OK to keep the channel open,
119 * #GNUNET_SYSERR to close it (signal serious error). 118 * #GNUNET_SYSERR to close it (signal serious error).
120 */ 119 */
121typedef int (*GNUNET_CADET_MessageCallback) (void *cls, 120typedef int
122 struct GNUNET_CADET_Channel *channel, 121(*GNUNET_CADET_MessageCallback) (void *cls,
123 void **channel_ctx, 122 struct GNUNET_CADET_Channel *channel,
124 const struct GNUNET_MessageHeader *message); 123 void **channel_ctx,
124 const struct GNUNET_MessageHeader *message);
125 125
126 126
127/** 127/**
@@ -131,7 +131,7 @@ typedef int (*GNUNET_CADET_MessageCallback) (void *cls,
131struct GNUNET_CADET_MessageHandler 131struct GNUNET_CADET_MessageHandler
132{ 132{
133 /** 133 /**
134 * Function to call for messages of "type". 134 * Function to call for messages of type @e type.
135 */ 135 */
136 GNUNET_CADET_MessageCallback callback; 136 GNUNET_CADET_MessageCallback callback;
137 137
@@ -167,16 +167,12 @@ struct GNUNET_CADET_MessageHandler
167 * @return initial channel context for the channel 167 * @return initial channel context for the channel
168 * (can be NULL -- that's not an error) 168 * (can be NULL -- that's not an error)
169 */ 169 */
170typedef void *(GNUNET_CADET_InboundChannelNotificationHandler) (void *cls, 170typedef void *
171 struct 171(GNUNET_CADET_InboundChannelNotificationHandler) (void *cls,
172 GNUNET_CADET_Channel 172 struct GNUNET_CADET_Channel *channel,
173 * channel, 173 const struct GNUNET_PeerIdentity *initiator,
174 const struct 174 uint32_t port,
175 GNUNET_PeerIdentity 175 enum GNUNET_CADET_ChannelOption options);
176 * initiator,
177 uint32_t port,
178 enum GNUNET_CADET_ChannelOption
179 options);
180 176
181 177
182/** 178/**
@@ -190,10 +186,10 @@ typedef void *(GNUNET_CADET_InboundChannelNotificationHandler) (void *cls,
190 * @param channel_ctx place where local state associated 186 * @param channel_ctx place where local state associated
191 * with the channel is stored 187 * with the channel is stored
192 */ 188 */
193typedef void (GNUNET_CADET_ChannelEndHandler) (void *cls, 189typedef void
194 const struct GNUNET_CADET_Channel * 190(GNUNET_CADET_ChannelEndHandler) (void *cls,
195 channel, 191 const struct GNUNET_CADET_Channel *channel,
196 void *channel_ctx); 192 void *channel_ctx);
197 193
198 194
199/** 195/**
@@ -219,11 +215,12 @@ typedef void (GNUNET_CADET_ChannelEndHandler) (void *cls,
219 * (in this case, init is never called) 215 * (in this case, init is never called)
220 */ 216 */
221struct GNUNET_CADET_Handle * 217struct GNUNET_CADET_Handle *
222GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, 218GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
223 GNUNET_CADET_InboundChannelNotificationHandler new_channel, 219 void *cls,
224 GNUNET_CADET_ChannelEndHandler cleaner, 220 GNUNET_CADET_InboundChannelNotificationHandler new_channel,
225 const struct GNUNET_CADET_MessageHandler *handlers, 221 GNUNET_CADET_ChannelEndHandler cleaner,
226 const uint32_t *ports); 222 const struct GNUNET_CADET_MessageHandler *handlers,
223 const uint32_t *ports);
227 224
228 225
229/** 226/**
@@ -255,10 +252,10 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle);
255 */ 252 */
256struct GNUNET_CADET_Channel * 253struct GNUNET_CADET_Channel *
257GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, 254GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h,
258 void *channel_ctx, 255 void *channel_ctx,
259 const struct GNUNET_PeerIdentity *peer, 256 const struct GNUNET_PeerIdentity *peer,
260 uint32_t port, 257 uint32_t port,
261 enum GNUNET_CADET_ChannelOption options); 258 enum GNUNET_CADET_ChannelOption options);
262 259
263 260
264/** 261/**
@@ -345,8 +342,7 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel,
345 * @param th handle that was returned by "notify_transmit_ready". 342 * @param th handle that was returned by "notify_transmit_ready".
346 */ 343 */
347void 344void
348GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle 345GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle *th);
349 *th);
350 346
351 347
352/** 348/**
@@ -384,13 +380,14 @@ GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel);
384 * @param dest_channel_number Local number for dest, if known. 380 * @param dest_channel_number Local number for dest, if known.
385 * @param public_channel_numbe Number for P2P, always known. 381 * @param public_channel_numbe Number for P2P, always known.
386 */ 382 */
387typedef void (*GNUNET_CADET_ChannelCB) (void *cls, 383typedef void
388 const struct GNUNET_PeerIdentity *root, 384(*GNUNET_CADET_ChannelCB) (void *cls,
389 const struct GNUNET_PeerIdentity *dest, 385 const struct GNUNET_PeerIdentity *root,
390 uint32_t port, 386 const struct GNUNET_PeerIdentity *dest,
391 uint32_t root_channel_number, 387 uint32_t port,
392 uint32_t dest_channel_number, 388 uint32_t root_channel_number,
393 uint32_t public_channel_number); 389 uint32_t dest_channel_number,
390 uint32_t public_channel_number);
394 391
395/** 392/**
396 * Method called to retrieve information about all peers in CADET, called 393 * Method called to retrieve information about all peers in CADET, called
@@ -405,10 +402,12 @@ typedef void (*GNUNET_CADET_ChannelCB) (void *cls,
405 * @param best_path How long is the best path? 402 * @param best_path How long is the best path?
406 * (0 = unknown, 1 = ourselves, 2 = neighbor) 403 * (0 = unknown, 1 = ourselves, 2 = neighbor)
407 */ 404 */
408typedef void (*GNUNET_CADET_PeersCB) (void *cls, 405typedef void
409 const struct GNUNET_PeerIdentity *peer, 406(*GNUNET_CADET_PeersCB) (void *cls,
410 int tunnel, unsigned int n_paths, 407 const struct GNUNET_PeerIdentity *peer,
411 unsigned int best_path); 408 int tunnel,
409 unsigned int n_paths,
410 unsigned int best_path);
412 411
413/** 412/**
414 * Method called to retrieve information about a specific peer 413 * Method called to retrieve information about a specific peer
@@ -423,12 +422,13 @@ typedef void (*GNUNET_CADET_PeersCB) (void *cls,
423 * Each path starts with the local peer. 422 * Each path starts with the local peer.
424 * Each path ends with the destination peer (given in @c peer). 423 * Each path ends with the destination peer (given in @c peer).
425 */ 424 */
426typedef void (*GNUNET_CADET_PeerCB) (void *cls, 425typedef void
427 const struct GNUNET_PeerIdentity *peer, 426(*GNUNET_CADET_PeerCB) (void *cls,
428 int tunnel, 427 const struct GNUNET_PeerIdentity *peer,
429 int neighbor, 428 int tunnel,
430 unsigned int n_paths, 429 int neighbor,
431 struct GNUNET_PeerIdentity *paths); 430 unsigned int n_paths,
431 struct GNUNET_PeerIdentity *paths);
432 432
433 433
434/** 434/**
@@ -444,13 +444,13 @@ typedef void (*GNUNET_CADET_PeerCB) (void *cls,
444 * @param estate Encryption state. 444 * @param estate Encryption state.
445 * @param cstate Connectivity state. 445 * @param cstate Connectivity state.
446 */ 446 */
447typedef void (*GNUNET_CADET_TunnelsCB) (void *cls, 447typedef void
448 const struct GNUNET_PeerIdentity *peer, 448(*GNUNET_CADET_TunnelsCB) (void *cls,
449 unsigned int channels, 449 const struct GNUNET_PeerIdentity *peer,
450 unsigned int connections, 450 unsigned int channels,
451 uint16_t estate, 451 unsigned int connections,
452 uint16_t cstate); 452 uint16_t estate,
453 453 uint16_t cstate);
454 454
455 455
456/** 456/**
@@ -466,14 +466,16 @@ typedef void (*GNUNET_CADET_TunnelsCB) (void *cls,
466 * @param estate Encryption state. 466 * @param estate Encryption state.
467 * @param cstate Connectivity state. 467 * @param cstate Connectivity state.
468 */ 468 */
469typedef void (*GNUNET_CADET_TunnelCB) (void *cls, 469typedef void
470 const struct GNUNET_PeerIdentity *peer, 470(*GNUNET_CADET_TunnelCB) (void *cls,
471 unsigned int n_channels, 471 const struct GNUNET_PeerIdentity *peer,
472 unsigned int n_connections, 472 unsigned int n_channels,
473 uint32_t *channels, 473 unsigned int n_connections,
474 struct GNUNET_CADET_Hash *connections, 474 uint32_t *channels,
475 unsigned int estate, 475 struct GNUNET_CADET_Hash *connections,
476 unsigned int cstate); 476 unsigned int estate,
477 unsigned int cstate);
478
477 479
478/** 480/**
479 * Request information about a specific channel of the running cadet peer. 481 * Request information about a specific channel of the running cadet peer.
@@ -488,10 +490,11 @@ typedef void (*GNUNET_CADET_TunnelCB) (void *cls,
488 */ 490 */
489void 491void
490GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h, 492GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h,
491 struct GNUNET_PeerIdentity *peer, 493 struct GNUNET_PeerIdentity *peer,
492 uint32_t channel_number, 494 uint32_t channel_number,
493 GNUNET_CADET_ChannelCB callback, 495 GNUNET_CADET_ChannelCB callback,
494 void *callback_cls); 496 void *callback_cls);
497
495 498
496/** 499/**
497 * Request a debug dump on the service's STDERR. 500 * Request a debug dump on the service's STDERR.
@@ -503,6 +506,7 @@ GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h,
503void 506void
504GNUNET_CADET_request_dump (struct GNUNET_CADET_Handle *h); 507GNUNET_CADET_request_dump (struct GNUNET_CADET_Handle *h);
505 508
509
506/** 510/**
507 * Request information about peers known to the running cadet service. 511 * Request information about peers known to the running cadet service.
508 * The callback will be called for every peer known to the service. 512 * The callback will be called for every peer known to the service.
@@ -519,8 +523,9 @@ GNUNET_CADET_request_dump (struct GNUNET_CADET_Handle *h);
519 */ 523 */
520int 524int
521GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h, 525GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h,
522 GNUNET_CADET_PeersCB callback, 526 GNUNET_CADET_PeersCB callback,
523 void *callback_cls); 527 void *callback_cls);
528
524 529
525/** 530/**
526 * Cancel a peer info request. The callback will not be called (anymore). 531 * Cancel a peer info request. The callback will not be called (anymore).
@@ -529,7 +534,7 @@ GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h,
529 * 534 *
530 * @param h Cadet handle. 535 * @param h Cadet handle.
531 * 536 *
532 * @return Closure given to GNUNET_CADET_get_peers. 537 * @return Closure that was given to #GNUNET_CADET_get_peers().
533 */ 538 */
534void * 539void *
535GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h); 540GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h);
@@ -555,6 +560,7 @@ GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h,
555 GNUNET_CADET_PeerCB callback, 560 GNUNET_CADET_PeerCB callback,
556 void *callback_cls); 561 void *callback_cls);
557 562
563
558/** 564/**
559 * Request information about tunnels of the running cadet peer. 565 * Request information about tunnels of the running cadet peer.
560 * The callback will be called for every tunnel of the service. 566 * The callback will be called for every tunnel of the service.
@@ -570,15 +576,16 @@ GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h,
570 */ 576 */
571int 577int
572GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h, 578GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h,
573 GNUNET_CADET_TunnelsCB callback, 579 GNUNET_CADET_TunnelsCB callback,
574 void *callback_cls); 580 void *callback_cls);
581
575 582
576/** 583/**
577 * Cancel a monitor request. The monitor callback will not be called. 584 * Cancel a monitor request. The monitor callback will not be called.
578 * 585 *
579 * @param h Cadet handle. 586 * @param h Cadet handle.
580 * 587 *
581 * @return Closure given to GNUNET_CADET_monitor, if any. 588 * @return Closure given to #GNUNET_CADET_get_tunnels(), if any.
582 */ 589 */
583void * 590void *
584GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h); 591GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h);
@@ -600,9 +607,10 @@ GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h);
600 */ 607 */
601int 608int
602GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h, 609GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h,
603 const struct GNUNET_PeerIdentity *id, 610 const struct GNUNET_PeerIdentity *id,
604 GNUNET_CADET_TunnelCB callback, 611 GNUNET_CADET_TunnelCB callback,
605 void *callback_cls); 612 void *callback_cls);
613
606 614
607/** 615/**
608 * Create a message queue for a cadet channel. 616 * Create a message queue for a cadet channel.