diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-01-27 01:07:58 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-01-27 01:07:58 +0100 |
commit | 3db0825fdc964032a7c6ee17ccb7dedbbcfb208b (patch) | |
tree | 0fe0221028f6f127a0135f15898c38efe6257b51 /src | |
parent | 65b339b7ce68fcbaec9df6f66e8ed45e60b39ce1 (diff) | |
download | gnunet-3db0825fdc964032a7c6ee17ccb7dedbbcfb208b.tar.gz gnunet-3db0825fdc964032a7c6ee17ccb7dedbbcfb208b.zip |
more work on #5385
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/Makefile.am | 1 | ||||
-rw-r--r-- | src/cadet/cadet_api_get_channel.c | 16 | ||||
-rw-r--r-- | src/cadet/cadet_api_get_peer.c | 2 | ||||
-rw-r--r-- | src/cadet/cadet_api_list_peers.c | 5 | ||||
-rw-r--r-- | src/include/gnunet_cadet_service.h | 40 |
5 files changed, 40 insertions, 24 deletions
diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am index 62eaad38c..57a716f29 100644 --- a/src/cadet/Makefile.am +++ b/src/cadet/Makefile.am | |||
@@ -35,6 +35,7 @@ lib_LTLIBRARIES = \ | |||
35 | libgnunetcadet_la_SOURCES = \ | 35 | libgnunetcadet_la_SOURCES = \ |
36 | cadet_api.c \ | 36 | cadet_api.c \ |
37 | cadet_api_get_peer.c \ | 37 | cadet_api_get_peer.c \ |
38 | cadet_api_get_tunnel.c \ | ||
38 | cadet_api_list_peers.c \ | 39 | cadet_api_list_peers.c \ |
39 | cadet_api_helper.c | 40 | cadet_api_helper.c |
40 | libgnunetcadet_la_LIBADD = \ | 41 | libgnunetcadet_la_LIBADD = \ |
diff --git a/src/cadet/cadet_api_get_channel.c b/src/cadet/cadet_api_get_channel.c index d41337522..1249777c2 100644 --- a/src/cadet/cadet_api_get_channel.c +++ b/src/cadet/cadet_api_get_channel.c | |||
@@ -121,17 +121,20 @@ reconnect (void *cls) | |||
121 | { | 121 | { |
122 | struct GNUNET_CADET_ChannelMonitor *cm = cls; | 122 | struct GNUNET_CADET_ChannelMonitor *cm = cls; |
123 | struct GNUNET_MQ_MessageHandler *handlers[] = { | 123 | struct GNUNET_MQ_MessageHandler *handlers[] = { |
124 | FIXME | 124 | FIXME, |
125 | } | 125 | GNUNET_MQ_handler_end () |
126 | }; | ||
126 | struct GNUNET_MessageHeader *msg; | 127 | struct GNUNET_MessageHeader *msg; |
127 | struct GNUNET_MQ_Envelope *env; | 128 | struct GNUNET_MQ_Envelope *env; |
128 | 129 | ||
130 | cm->reconnect_task = NULL; | ||
129 | cm->mq = GNUNET_CLIENT_connect (cm->cfg, | 131 | cm->mq = GNUNET_CLIENT_connect (cm->cfg, |
130 | "cadet", | 132 | "cadet", |
131 | handlers, | 133 | handlers, |
132 | &error_handler, | 134 | &error_handler, |
133 | cm); | 135 | cm); |
134 | 136 | if (NULL == cm->mq) | |
137 | return; | ||
135 | env = GNUNET_MQ_msg (msg, | 138 | env = GNUNET_MQ_msg (msg, |
136 | type); | 139 | type); |
137 | GNUNET_MQ_send (cm->mq, | 140 | GNUNET_MQ_send (cm->mq, |
@@ -142,13 +145,12 @@ reconnect (void *cls) | |||
142 | /** | 145 | /** |
143 | * Request information about a specific channel of the running cadet peer. | 146 | * Request information about a specific channel of the running cadet peer. |
144 | * | 147 | * |
145 | * WARNING: unstable API, likely to change in the future! | 148 | * @param cfg configuration to use |
146 | * | ||
147 | * @param h Handle to the cadet peer. | ||
148 | * @param peer ID of the other end of the channel. | 149 | * @param peer ID of the other end of the channel. |
149 | * @param channel_number Channel number. | 150 | * @param channel_number Channel number. |
150 | * @param callback Function to call with the requested data. | 151 | * @param callback Function to call with the requested data. |
151 | * @param callback_cls Closure for @c callback. | 152 | * @param callback_cls Closure for @c callback. |
153 | * @return NULL on error | ||
152 | */ | 154 | */ |
153 | struct GNUNET_CADET_ChannelMonitor * | 155 | struct GNUNET_CADET_ChannelMonitor * |
154 | GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg, | 156 | GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg, |
diff --git a/src/cadet/cadet_api_get_peer.c b/src/cadet/cadet_api_get_peer.c index e86c1567c..bfac8d583 100644 --- a/src/cadet/cadet_api_get_peer.c +++ b/src/cadet/cadet_api_get_peer.c | |||
@@ -227,7 +227,7 @@ reconnect (void *cls) | |||
227 | * Request information about a peer known to the running cadet peer. | 227 | * Request information about a peer known to the running cadet peer. |
228 | * The callback will be called for the tunnel once. | 228 | * The callback will be called for the tunnel once. |
229 | * | 229 | * |
230 | * @param h Handle to the cadet peer. | 230 | * @param cfg configuration to use |
231 | * @param id Peer whose tunnel to examine. | 231 | * @param id Peer whose tunnel to examine. |
232 | * @param callback Function to call with the requested data. | 232 | * @param callback Function to call with the requested data. |
233 | * @param callback_cls Closure for @c callback. | 233 | * @param callback_cls Closure for @c callback. |
diff --git a/src/cadet/cadet_api_list_peers.c b/src/cadet/cadet_api_list_peers.c index d53bcf65d..cc6948a36 100644 --- a/src/cadet/cadet_api_list_peers.c +++ b/src/cadet/cadet_api_list_peers.c | |||
@@ -177,11 +177,14 @@ reconnect (void *cls) | |||
177 | struct GNUNET_MessageHeader *msg; | 177 | struct GNUNET_MessageHeader *msg; |
178 | struct GNUNET_MQ_Envelope *env; | 178 | struct GNUNET_MQ_Envelope *env; |
179 | 179 | ||
180 | pl->reconnect_task = NULL; | ||
180 | pl->mq = GNUNET_CLIENT_connect (pl->cfg, | 181 | pl->mq = GNUNET_CLIENT_connect (pl->cfg, |
181 | "cadet", | 182 | "cadet", |
182 | handlers, | 183 | handlers, |
183 | &error_handler, | 184 | &error_handler, |
184 | pl); | 185 | pl); |
186 | if (NULL == pl->mq) | ||
187 | return; | ||
185 | env = GNUNET_MQ_msg (msg, | 188 | env = GNUNET_MQ_msg (msg, |
186 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); | 189 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); |
187 | GNUNET_MQ_send (pl->mq, | 190 | GNUNET_MQ_send (pl->mq, |
@@ -194,7 +197,7 @@ reconnect (void *cls) | |||
194 | * The callback will be called for every peer known to the service. | 197 | * The callback will be called for every peer known to the service. |
195 | * Only one info request (of any kind) can be active at once. | 198 | * Only one info request (of any kind) can be active at once. |
196 | * | 199 | * |
197 | * @param h Handle to the cadet peer. | 200 | * @param cfg configuration to use |
198 | * @param callback Function to call with the requested data. | 201 | * @param callback Function to call with the requested data. |
199 | * @param callback_cls Closure for @c callback. | 202 | * @param callback_cls Closure for @c callback. |
200 | * @return NULL on error | 203 | * @return NULL on error |
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h index 2ac98e621..3ff8cf59c 100644 --- a/src/include/gnunet_cadet_service.h +++ b/src/include/gnunet_cadet_service.h | |||
@@ -389,15 +389,16 @@ typedef void | |||
389 | uint32_t /* ugh */ public_channel_number); | 389 | uint32_t /* ugh */ public_channel_number); |
390 | 390 | ||
391 | 391 | ||
392 | /** | ||
393 | * Operation handle. | ||
394 | */ | ||
392 | struct GNUNET_CADET_ChannelMonitor; | 395 | struct GNUNET_CADET_ChannelMonitor; |
393 | 396 | ||
394 | 397 | ||
395 | /** | 398 | /** |
396 | * Request information about a specific channel of the running cadet peer. | 399 | * Request information about a specific channel of the running cadet peer. |
397 | * | 400 | * |
398 | * WARNING: unstable API, likely to change in the future! | 401 | * @param cfg configuration to use |
399 | * | ||
400 | * @param h Handle to the cadet peer. | ||
401 | * @param peer ID of the other end of the channel. | 402 | * @param peer ID of the other end of the channel. |
402 | * @param channel_number Channel number. | 403 | * @param channel_number Channel number. |
403 | * @param callback Function to call with the requested data. | 404 | * @param callback Function to call with the requested data. |
@@ -442,6 +443,9 @@ typedef void | |||
442 | unsigned int best_path); | 443 | unsigned int best_path); |
443 | 444 | ||
444 | 445 | ||
446 | /** | ||
447 | * Operation handle. | ||
448 | */ | ||
445 | struct GNUNET_CADET_PeersLister; | 449 | struct GNUNET_CADET_PeersLister; |
446 | 450 | ||
447 | 451 | ||
@@ -450,7 +454,7 @@ struct GNUNET_CADET_PeersLister; | |||
450 | * The callback will be called for every peer known to the service. | 454 | * The callback will be called for every peer known to the service. |
451 | * Only one info request (of any kind) can be active at once. | 455 | * Only one info request (of any kind) can be active at once. |
452 | * | 456 | * |
453 | * @param h Handle to the cadet peer. | 457 | * @param cfg configuration to use |
454 | * @param callback Function to call with the requested data. | 458 | * @param callback Function to call with the requested data. |
455 | * @param callback_cls Closure for @c callback. | 459 | * @param callback_cls Closure for @c callback. |
456 | * @return NULL on error | 460 | * @return NULL on error |
@@ -500,12 +504,13 @@ typedef void | |||
500 | */ | 504 | */ |
501 | struct GNUNET_CADET_GetPeer; | 505 | struct GNUNET_CADET_GetPeer; |
502 | 506 | ||
507 | |||
503 | /** | 508 | /** |
504 | * Request information about a peer known to the running cadet peer. | 509 | * Request information about a peer known to the running cadet peer. |
505 | * The callback will be called for the tunnel once. | 510 | * The callback will be called for the tunnel once. |
506 | * Only one info request (of any kind) can be active at once. | 511 | * Only one info request (of any kind) can be active at once. |
507 | * | 512 | * |
508 | * @param h Handle to the cadet peer. | 513 | * @param cfg configuration to use |
509 | * @param id Peer whose tunnel to examine. | 514 | * @param id Peer whose tunnel to examine. |
510 | * @param callback Function to call with the requested data. | 515 | * @param callback Function to call with the requested data. |
511 | * @param callback_cls Closure for @c callback. | 516 | * @param callback_cls Closure for @c callback. |
@@ -550,6 +555,9 @@ typedef void | |||
550 | uint16_t cstate); | 555 | uint16_t cstate); |
551 | 556 | ||
552 | 557 | ||
558 | /** | ||
559 | * Operation handle. | ||
560 | */ | ||
553 | struct GNUNET_CADET_ListTunnels; | 561 | struct GNUNET_CADET_ListTunnels; |
554 | 562 | ||
555 | 563 | ||
@@ -558,12 +566,9 @@ struct GNUNET_CADET_ListTunnels; | |||
558 | * The callback will be called for every tunnel of the service. | 566 | * The callback will be called for every tunnel of the service. |
559 | * Only one info request (of any kind) can be active at once. | 567 | * Only one info request (of any kind) can be active at once. |
560 | * | 568 | * |
561 | * WARNING: unstable API, likely to change in the future! | 569 | * @param cfg configuration to use |
562 | * | ||
563 | * @param h Handle to the cadet peer. | ||
564 | * @param callback Function to call with the requested data. | 570 | * @param callback Function to call with the requested data. |
565 | * @param callback_cls Closure for @c callback. | 571 | * @param callback_cls Closure for @c callback. |
566 | * | ||
567 | * @return #GNUNET_OK / #GNUNET_SYSERR | 572 | * @return #GNUNET_OK / #GNUNET_SYSERR |
568 | */ | 573 | */ |
569 | struct GNUNET_CADET_ListTunnels * | 574 | struct GNUNET_CADET_ListTunnels * |
@@ -575,8 +580,7 @@ GNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
575 | /** | 580 | /** |
576 | * Cancel a monitor request. The monitor callback will not be called. | 581 | * Cancel a monitor request. The monitor callback will not be called. |
577 | * | 582 | * |
578 | * @param h Cadet handle. | 583 | * @param lt operation handle |
579 | * | ||
580 | * @return Closure given to #GNUNET_CADET_list_tunnels(), if any. | 584 | * @return Closure given to #GNUNET_CADET_list_tunnels(), if any. |
581 | */ | 585 | */ |
582 | void * | 586 | void * |
@@ -608,6 +612,9 @@ typedef void | |||
608 | unsigned int cstate); | 612 | unsigned int cstate); |
609 | 613 | ||
610 | 614 | ||
615 | /** | ||
616 | * Operation handle. | ||
617 | */ | ||
611 | struct GNUNET_CADET_GetTunnel; | 618 | struct GNUNET_CADET_GetTunnel; |
612 | 619 | ||
613 | 620 | ||
@@ -616,13 +623,10 @@ struct GNUNET_CADET_GetTunnel; | |||
616 | * The callback will be called for the tunnel once. | 623 | * The callback will be called for the tunnel once. |
617 | * Only one info request (of any kind) can be active at once. | 624 | * Only one info request (of any kind) can be active at once. |
618 | * | 625 | * |
619 | * WARNING: unstable API, likely to change in the future! | 626 | * @param cfg configuration to use |
620 | * | ||
621 | * @param h Handle to the cadet peer. | ||
622 | * @param id Peer whose tunnel to examine. | 627 | * @param id Peer whose tunnel to examine. |
623 | * @param callback Function to call with the requested data. | 628 | * @param callback Function to call with the requested data. |
624 | * @param callback_cls Closure for @c callback. | 629 | * @param callback_cls Closure for @c callback. |
625 | * | ||
626 | * @return #GNUNET_OK / #GNUNET_SYSERR | 630 | * @return #GNUNET_OK / #GNUNET_SYSERR |
627 | */ | 631 | */ |
628 | struct GNUNET_CADET_GetTunnel * | 632 | struct GNUNET_CADET_GetTunnel * |
@@ -632,6 +636,12 @@ GNUNET_CADET_get_tunnel (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
632 | void *callback_cls); | 636 | void *callback_cls); |
633 | 637 | ||
634 | 638 | ||
639 | /** | ||
640 | * Cancel a monitor request. The monitor callback will not be called. | ||
641 | * | ||
642 | * @param lt operation handle | ||
643 | * @return Closure given to #GNUNET_CADET_get_tunnel(), if any. | ||
644 | */ | ||
635 | void * | 645 | void * |
636 | GNUNET_CADET_get_tunnel_cancel (struct GNUNET_CADET_GetTunnel *gt); | 646 | GNUNET_CADET_get_tunnel_cancel (struct GNUNET_CADET_GetTunnel *gt); |
637 | 647 | ||