aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_cadet_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_cadet_service.h')
-rw-r--r--src/include/gnunet_cadet_service.h112
1 files changed, 51 insertions, 61 deletions
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index 819e39353..dccc51464 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -16,7 +16,7 @@
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20/** 20/**
21 * @author Christian Grothoff 21 * @author Christian Grothoff
22 * @author Bart Polot 22 * @author Bart Polot
@@ -70,8 +70,7 @@ struct GNUNET_CADET_Port;
70/** 70/**
71 * Hash uniquely identifying a connection below a tunnel. 71 * Hash uniquely identifying a connection below a tunnel.
72 */ 72 */
73struct GNUNET_CADET_ConnectionTunnelIdentifier 73struct GNUNET_CADET_ConnectionTunnelIdentifier {
74{
75 struct GNUNET_ShortHashCode connection_of_tunnel; 74 struct GNUNET_ShortHashCode connection_of_tunnel;
76}; 75};
77 76
@@ -79,8 +78,7 @@ struct GNUNET_CADET_ConnectionTunnelIdentifier
79/** 78/**
80 * Number identifying a CADET channel within a tunnel. 79 * Number identifying a CADET channel within a tunnel.
81 */ 80 */
82struct GNUNET_CADET_ChannelTunnelNumber 81struct GNUNET_CADET_ChannelTunnelNumber {
83{
84 /** 82 /**
85 * Which number does this channel have that uniquely identfies 83 * Which number does this channel have that uniquely identfies
86 * it within its tunnel, in network byte order. 84 * it within its tunnel, in network byte order.
@@ -154,7 +152,7 @@ typedef void (*GNUNET_CADET_WindowSizeEventHandler) (
154 * @return Handle to the cadet service NULL on error. 152 * @return Handle to the cadet service NULL on error.
155 */ 153 */
156struct GNUNET_CADET_Handle * 154struct GNUNET_CADET_Handle *
157GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); 155GNUNET_CADET_connect(const struct GNUNET_CONFIGURATION_Handle *cfg);
158 156
159 157
160/** 158/**
@@ -166,7 +164,7 @@ GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
166 * @param handle connection to cadet to disconnect 164 * @param handle connection to cadet to disconnect
167 */ 165 */
168void 166void
169GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle); 167GNUNET_CADET_disconnect(struct GNUNET_CADET_Handle *handle);
170 168
171 169
172/** 170/**
@@ -183,13 +181,13 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle);
183 * @return Port handle, NULL if port is in use 181 * @return Port handle, NULL if port is in use
184 */ 182 */
185struct GNUNET_CADET_Port * 183struct GNUNET_CADET_Port *
186GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, 184GNUNET_CADET_open_port(struct GNUNET_CADET_Handle *h,
187 const struct GNUNET_HashCode *port, 185 const struct GNUNET_HashCode *port,
188 GNUNET_CADET_ConnectEventHandler connects, 186 GNUNET_CADET_ConnectEventHandler connects,
189 void *connects_cls, 187 void *connects_cls,
190 GNUNET_CADET_WindowSizeEventHandler window_changes, 188 GNUNET_CADET_WindowSizeEventHandler window_changes,
191 GNUNET_CADET_DisconnectEventHandler disconnects, 189 GNUNET_CADET_DisconnectEventHandler disconnects,
192 const struct GNUNET_MQ_MessageHandler *handlers); 190 const struct GNUNET_MQ_MessageHandler *handlers);
193 191
194 192
195/** 193/**
@@ -199,7 +197,7 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h,
199 * @param p Port handle. 197 * @param p Port handle.
200 */ 198 */
201void 199void
202GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p); 200GNUNET_CADET_close_port(struct GNUNET_CADET_Port *p);
203 201
204 202
205/** 203/**
@@ -223,13 +221,13 @@ GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p);
223 * @return Handle to the channel. 221 * @return Handle to the channel.
224 */ 222 */
225struct GNUNET_CADET_Channel * 223struct GNUNET_CADET_Channel *
226GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, 224GNUNET_CADET_channel_create(struct GNUNET_CADET_Handle *h,
227 void *channel_cls, 225 void *channel_cls,
228 const struct GNUNET_PeerIdentity *destination, 226 const struct GNUNET_PeerIdentity *destination,
229 const struct GNUNET_HashCode *port, 227 const struct GNUNET_HashCode *port,
230 GNUNET_CADET_WindowSizeEventHandler window_changes, 228 GNUNET_CADET_WindowSizeEventHandler window_changes,
231 GNUNET_CADET_DisconnectEventHandler disconnects, 229 GNUNET_CADET_DisconnectEventHandler disconnects,
232 const struct GNUNET_MQ_MessageHandler *handlers); 230 const struct GNUNET_MQ_MessageHandler *handlers);
233 231
234 232
235/** 233/**
@@ -242,7 +240,7 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h,
242 * @param channel Channel handle, becomes invalid after this call. 240 * @param channel Channel handle, becomes invalid after this call.
243 */ 241 */
244void 242void
245GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel); 243GNUNET_CADET_channel_destroy(struct GNUNET_CADET_Channel *channel);
246 244
247 245
248/** 246/**
@@ -252,7 +250,7 @@ GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel);
252 * @return The message queue of the channel. 250 * @return The message queue of the channel.
253 */ 251 */
254struct GNUNET_MQ_Handle * 252struct GNUNET_MQ_Handle *
255GNUNET_CADET_get_mq (const struct GNUNET_CADET_Channel *channel); 253GNUNET_CADET_get_mq(const struct GNUNET_CADET_Channel *channel);
256 254
257 255
258/** 256/**
@@ -263,7 +261,7 @@ GNUNET_CADET_get_mq (const struct GNUNET_CADET_Channel *channel);
263 * @param channel Channel that will be allowed to call another handler. 261 * @param channel Channel that will be allowed to call another handler.
264 */ 262 */
265void 263void
266GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel); 264GNUNET_CADET_receive_done(struct GNUNET_CADET_Channel *channel);
267 265
268 266
269/** 267/**
@@ -276,25 +274,21 @@ GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel);
276 * @return A GNUNET_HashCode usable for the new CADET API. 274 * @return A GNUNET_HashCode usable for the new CADET API.
277 */ 275 */
278const struct GNUNET_HashCode * 276const struct GNUNET_HashCode *
279GC_u2h (uint32_t port); 277GC_u2h(uint32_t port);
280 278
281enum GNUNET_CADET_ChannelInfoOption 279enum GNUNET_CADET_ChannelInfoOption {
282{
283 /** 280 /**
284 * Who is the peer at the other end of the channel. 281 * Who is the peer at the other end of the channel.
285 * Only for use in @c GNUNET_CADET_channel_get_info 282 * Only for use in @c GNUNET_CADET_channel_get_info
286 * struct GNUNET_PeerIdentity *peer 283 * struct GNUNET_PeerIdentity *peer
287 */ 284 */
288 GNUNET_CADET_OPTION_PEER = 0x0 285 GNUNET_CADET_OPTION_PEER = 0x0
289
290}; 286};
291 287
292/** 288/**
293 * Union to retrieve info about a channel. 289 * Union to retrieve info about a channel.
294 */ 290 */
295union GNUNET_CADET_ChannelInfo 291union GNUNET_CADET_ChannelInfo {
296{
297
298 /** 292 /**
299 * #GNUNET_YES / #GNUNET_NO, for binary flags. 293 * #GNUNET_YES / #GNUNET_NO, for binary flags.
300 */ 294 */
@@ -315,9 +309,9 @@ union GNUNET_CADET_ChannelInfo
315 * @return Union with an answer to the query. 309 * @return Union with an answer to the query.
316 */ 310 */
317const union GNUNET_CADET_ChannelInfo * 311const union GNUNET_CADET_ChannelInfo *
318GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, 312GNUNET_CADET_channel_get_info(struct GNUNET_CADET_Channel *channel,
319 enum GNUNET_CADET_ChannelInfoOption option, 313 enum GNUNET_CADET_ChannelInfoOption option,
320 ...); 314 ...);
321 315
322 316
323/******************************************************************************/ 317/******************************************************************************/
@@ -334,8 +328,7 @@ GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel,
334/** 328/**
335 * Internal details about a channel. 329 * Internal details about a channel.
336 */ 330 */
337struct GNUNET_CADET_ChannelInternals 331struct GNUNET_CADET_ChannelInternals {
338{
339 /** 332 /**
340 * Root of the channel 333 * Root of the channel
341 */ 334 */
@@ -377,10 +370,10 @@ struct GNUNET_CADET_ChannelMonitor;
377 * @param callback_cls Closure for @c callback. 370 * @param callback_cls Closure for @c callback.
378 */ 371 */
379struct GNUNET_CADET_ChannelMonitor * 372struct GNUNET_CADET_ChannelMonitor *
380GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg, 373GNUNET_CADET_get_channel(const struct GNUNET_CONFIGURATION_Handle *cfg,
381 struct GNUNET_PeerIdentity *peer, 374 struct GNUNET_PeerIdentity *peer,
382 GNUNET_CADET_ChannelCB callback, 375 GNUNET_CADET_ChannelCB callback,
383 void *callback_cls); 376 void *callback_cls);
384 377
385 378
386/** 379/**
@@ -390,14 +383,13 @@ GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg,
390 * @return Closure that was given to #GNUNET_CADET_get_channel(). 383 * @return Closure that was given to #GNUNET_CADET_get_channel().
391 */ 384 */
392void * 385void *
393GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm); 386GNUNET_CADET_get_channel_cancel(struct GNUNET_CADET_ChannelMonitor *cm);
394 387
395 388
396/** 389/**
397 * Information we return per peer. 390 * Information we return per peer.
398 */ 391 */
399struct GNUNET_CADET_PeerListEntry 392struct GNUNET_CADET_PeerListEntry {
400{
401 /** 393 /**
402 * Which peer is the information about? 394 * Which peer is the information about?
403 */ 395 */
@@ -451,9 +443,9 @@ struct GNUNET_CADET_PeersLister;
451 * @return NULL on error 443 * @return NULL on error
452 */ 444 */
453struct GNUNET_CADET_PeersLister * 445struct GNUNET_CADET_PeersLister *
454GNUNET_CADET_list_peers (const struct GNUNET_CONFIGURATION_Handle *cfg, 446GNUNET_CADET_list_peers(const struct GNUNET_CONFIGURATION_Handle *cfg,
455 GNUNET_CADET_PeersCB callback, 447 GNUNET_CADET_PeersCB callback,
456 void *callback_cls); 448 void *callback_cls);
457 449
458 450
459/** 451/**
@@ -463,14 +455,13 @@ GNUNET_CADET_list_peers (const struct GNUNET_CONFIGURATION_Handle *cfg,
463 * @return Closure that was given to #GNUNET_CADET_list_peers(). 455 * @return Closure that was given to #GNUNET_CADET_list_peers().
464 */ 456 */
465void * 457void *
466GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_PeersLister *pl); 458GNUNET_CADET_list_peers_cancel(struct GNUNET_CADET_PeersLister *pl);
467 459
468 460
469/** 461/**
470 * Detailed information we return per peer. 462 * Detailed information we return per peer.
471 */ 463 */
472struct GNUNET_CADET_PeerPathDetail 464struct GNUNET_CADET_PeerPathDetail {
473{
474 /** 465 /**
475 * Peer this is about. 466 * Peer this is about.
476 */ 467 */
@@ -523,10 +514,10 @@ struct GNUNET_CADET_GetPath;
523 * @return NULL on error 514 * @return NULL on error
524 */ 515 */
525struct GNUNET_CADET_GetPath * 516struct GNUNET_CADET_GetPath *
526GNUNET_CADET_get_path (const struct GNUNET_CONFIGURATION_Handle *cfg, 517GNUNET_CADET_get_path(const struct GNUNET_CONFIGURATION_Handle *cfg,
527 const struct GNUNET_PeerIdentity *id, 518 const struct GNUNET_PeerIdentity *id,
528 GNUNET_CADET_PathCB callback, 519 GNUNET_CADET_PathCB callback,
529 void *callback_cls); 520 void *callback_cls);
530 521
531 522
532/** 523/**
@@ -536,14 +527,13 @@ GNUNET_CADET_get_path (const struct GNUNET_CONFIGURATION_Handle *cfg,
536 * @return closure from #GNUNET_CADET_get_path(). 527 * @return closure from #GNUNET_CADET_get_path().
537 */ 528 */
538void * 529void *
539GNUNET_CADET_get_path_cancel (struct GNUNET_CADET_GetPath *gp); 530GNUNET_CADET_get_path_cancel(struct GNUNET_CADET_GetPath *gp);
540 531
541 532
542/** 533/**
543 * Details about a tunnel managed by CADET. 534 * Details about a tunnel managed by CADET.
544 */ 535 */
545struct GNUNET_CADET_TunnelDetails 536struct GNUNET_CADET_TunnelDetails {
546{
547 /** 537 /**
548 * Target of the tunnel. 538 * Target of the tunnel.
549 */ 539 */
@@ -602,9 +592,9 @@ struct GNUNET_CADET_ListTunnels;
602 * @return NULL on error 592 * @return NULL on error
603 */ 593 */
604struct GNUNET_CADET_ListTunnels * 594struct GNUNET_CADET_ListTunnels *
605GNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg, 595GNUNET_CADET_list_tunnels(const struct GNUNET_CONFIGURATION_Handle *cfg,
606 GNUNET_CADET_TunnelsCB callback, 596 GNUNET_CADET_TunnelsCB callback,
607 void *callback_cls); 597 void *callback_cls);
608 598
609 599
610/** 600/**
@@ -614,7 +604,7 @@ GNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg,
614 * @return Closure given to #GNUNET_CADET_list_tunnels(), if any. 604 * @return Closure given to #GNUNET_CADET_list_tunnels(), if any.
615 */ 605 */
616void * 606void *
617GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt); 607GNUNET_CADET_list_tunnels_cancel(struct GNUNET_CADET_ListTunnels *lt);
618 608
619 609
620#if 0 /* keep Emacsens' auto-indent happy */ 610#if 0 /* keep Emacsens' auto-indent happy */