aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-01-27 04:29:52 +0100
committerChristian Grothoff <christian@grothoff.org>2019-01-27 04:29:52 +0100
commit1c9f269ea5cadb20bb5f7fc209274ba5d6af4749 (patch)
treece241e18c8db4876be1fd7ed4d7b7460994fd815
parentf0b35049f6d9e743d2bc5fcf11664633d130d6fc (diff)
downloadgnunet-1c9f269ea5cadb20bb5f7fc209274ba5d6af4749.tar.gz
gnunet-1c9f269ea5cadb20bb5f7fc209274ba5d6af4749.zip
in principle finished with #5385, could use some testing...
-rw-r--r--doc/man/gnunet-cadet.15
-rw-r--r--src/cadet/Makefile.am1
-rw-r--r--src/cadet/cadet_api_get_tunnel.c279
-rw-r--r--src/cadet/gnunet-cadet.c90
-rw-r--r--src/cadet/gnunet-service-cadet.c107
-rw-r--r--src/include/gnunet_cadet_service.h59
-rw-r--r--src/include/gnunet_protocols.h48
7 files changed, 18 insertions, 571 deletions
diff --git a/doc/man/gnunet-cadet.1 b/doc/man/gnunet-cadet.1
index 3551a335d..9c84066bc 100644
--- a/doc/man/gnunet-cadet.1
+++ b/doc/man/gnunet-cadet.1
@@ -17,7 +17,7 @@ and using "\fBgnunet\-cadet\fP \fIPEER_ID SHARED_SECRET\fR" to
17establish one circuit to that peer from any other peer. The receiving 17establish one circuit to that peer from any other peer. The receiving
18process will only accept one incoming circuit, but several commands 18process will only accept one incoming circuit, but several commands
19using the same \fI-o\fR can be issued to satisfy multiple requests. 19using the same \fI-o\fR can be issued to satisfy multiple requests.
20For one-to-many communication \fBgnunet\-social\fP may be better 20For one\-to\-many communication \fBgnunet\-social\fP may be better
21suited, however. 21suited, however.
22 22
23.SH SPECIFIC OPTIONS 23.SH SPECIFIC OPTIONS
@@ -40,9 +40,6 @@ Provide information about a patricular peer.
40.IP "\-P, \-\-peers" 40.IP "\-P, \-\-peers"
41Provide information about all peers. 41Provide information about all peers.
42.B 42.B
43.IP "\-t TUNNEL_ID, \-\-tunnel=TUNNEL_ID"
44Provide information about a patricular tunnel.
45.B
46.IP "\-T, \-\-tunnels" 43.IP "\-T, \-\-tunnels"
47Provide information about all tunnels. 44Provide information about all tunnels.
48 45
diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am
index 80ad76737..e7d42f60f 100644
--- a/src/cadet/Makefile.am
+++ b/src/cadet/Makefile.am
@@ -36,7 +36,6 @@ libgnunetcadet_la_SOURCES = \
36 cadet_api.c \ 36 cadet_api.c \
37 cadet_api_get_channel.c \ 37 cadet_api_get_channel.c \
38 cadet_api_get_path.c \ 38 cadet_api_get_path.c \
39 cadet_api_get_tunnel.c \
40 cadet_api_list_peers.c \ 39 cadet_api_list_peers.c \
41 cadet_api_list_tunnels.c \ 40 cadet_api_list_tunnels.c \
42 cadet_api_helper.c 41 cadet_api_helper.c
diff --git a/src/cadet/cadet_api_get_tunnel.c b/src/cadet/cadet_api_get_tunnel.c
deleted file mode 100644
index 1d2776352..000000000
--- a/src/cadet/cadet_api_get_tunnel.c
+++ /dev/null
@@ -1,279 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2011, 2017 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19*/
20/**
21 * @file cadet/cadet_api_get_tunnel.c
22 * @brief cadet api: client implementation of cadet service
23 * @author Bartlomiej Polot
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_constants.h"
29#include "gnunet_cadet_service.h"
30#include "cadet.h"
31#include "cadet_protocol.h"
32
33
34/**
35 * Operation handle.
36 */
37struct GNUNET_CADET_GetTunnel
38{
39
40 /**
41 * Monitor callback
42 */
43 GNUNET_CADET_TunnelCB callback;
44
45 /**
46 * Closure for @e callback.
47 */
48 void *callback_cls;
49
50 /**
51 * Message queue to talk to CADET service.
52 */
53 struct GNUNET_MQ_Handle *mq;
54
55 /**
56 * Configuration we use.
57 */
58 const struct GNUNET_CONFIGURATION_Handle *cfg;
59
60 /**
61 * Task to reconnect.
62 */
63 struct GNUNET_SCHEDULER_Task *reconnect_task;
64
65 /**
66 * Backoff for reconnect attempts.
67 */
68 struct GNUNET_TIME_Relative backoff;
69
70 /**
71 * Peer we want information about.
72 */
73 struct GNUNET_PeerIdentity id;
74};
75
76
77
78/**
79 * Check that message received from CADET service is well-formed.
80 *
81 * @param cls the `struct GNUNET_CADET_Handle`
82 * @param msg the message we got
83 * @return #GNUNET_OK if the message is well-formed,
84 * #GNUNET_SYSERR otherwise
85 */
86static int
87check_get_tunnel (void *cls,
88 const struct GNUNET_CADET_LocalInfoTunnel *msg)
89{
90 unsigned int ch_n;
91 unsigned int c_n;
92 size_t esize;
93 size_t msize;
94
95 (void) cls;
96 /* Verify message sanity */
97 msize = ntohs (msg->header.size);
98 esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel);
99 if (esize > msize)
100 {
101 GNUNET_break (0);
102 return GNUNET_SYSERR;
103 }
104 ch_n = ntohl (msg->channels);
105 c_n = ntohl (msg->connections);
106 esize += ch_n * sizeof (struct GNUNET_CADET_ChannelTunnelNumber);
107 esize += c_n * sizeof (struct GNUNET_CADET_ConnectionTunnelIdentifier);
108 if (msize != esize)
109 {
110 GNUNET_break_op (0);
111 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
112 "m:%u, e: %u (%u ch, %u conn)\n",
113 (unsigned int) msize,
114 (unsigned int) esize,
115 ch_n,
116 c_n);
117 return GNUNET_SYSERR;
118 }
119 return GNUNET_OK;
120}
121
122
123/**
124 * Process a local tunnel info reply, pass info to the user.
125 *
126 * @param cls a `struct GNUNET_CADET_GetTunnel *`
127 * @param msg Message itself.
128 */
129static void
130handle_get_tunnel (void *cls,
131 const struct GNUNET_CADET_LocalInfoTunnel *msg)
132{
133 struct GNUNET_CADET_GetTunnel *gt = cls;
134 unsigned int ch_n;
135 unsigned int c_n;
136 const struct GNUNET_CADET_ConnectionTunnelIdentifier *conns;
137 const struct GNUNET_CADET_ChannelTunnelNumber *chns;
138
139 ch_n = ntohl (msg->channels);
140 c_n = ntohl (msg->connections);
141
142 /* Call Callback with tunnel info. */
143 conns = (const struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1];
144 chns = (const struct GNUNET_CADET_ChannelTunnelNumber *) &conns[c_n];
145 gt->callback (gt->callback_cls,
146 &msg->destination,
147 ch_n,
148 c_n,
149 chns,
150 conns,
151 ntohs (msg->estate),
152 ntohs (msg->cstate));
153 GNUNET_CADET_get_tunnel_cancel (gt);
154}
155
156
157/**
158 * Reconnect to the service and try again.
159 *
160 * @param cls a `struct GNUNET_CADET_GetTunnel` operation
161 */
162static void
163reconnect (void *cls);
164
165
166/**
167 * Function called on connection trouble. Reconnects.
168 *
169 * @param cls a `struct GNUNET_CADET_GetTunnel`
170 * @param error error code from MQ
171 */
172static void
173error_handler (void *cls,
174 enum GNUNET_MQ_Error error)
175{
176 struct GNUNET_CADET_GetTunnel *gt = cls;
177
178 GNUNET_MQ_destroy (gt->mq);
179 gt->mq = NULL;
180 gt->backoff = GNUNET_TIME_randomized_backoff (gt->backoff,
181 GNUNET_TIME_UNIT_MINUTES);
182 gt->reconnect_task = GNUNET_SCHEDULER_add_delayed (gt->backoff,
183 &reconnect,
184 gt);
185}
186
187
188/**
189 * Reconnect to the service and try again.
190 *
191 * @param cls a `struct GNUNET_CADET_GetTunnel` operation
192 */
193static void
194reconnect (void *cls)
195{
196 struct GNUNET_CADET_GetTunnel *gt = cls;
197 struct GNUNET_MQ_MessageHandler handlers[] = {
198 GNUNET_MQ_hd_var_size (get_tunnel,
199 GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL,
200 struct GNUNET_CADET_LocalInfoTunnel,
201 gt),
202 GNUNET_MQ_handler_end ()
203 };
204 struct GNUNET_MQ_Envelope *env;
205 struct GNUNET_CADET_LocalInfo *msg;
206
207 gt->reconnect_task = NULL;
208 gt->mq = GNUNET_CLIENT_connect (gt->cfg,
209 "cadet",
210 handlers,
211 &error_handler,
212 gt);
213 if (NULL == gt->mq)
214 return;
215 env = GNUNET_MQ_msg (msg,
216 GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
217 msg->peer = gt->id;
218 GNUNET_MQ_send (gt->mq,
219 env);
220}
221
222/**
223 * Request information about a tunnel of the running cadet peer.
224 * The callback will be called for the tunnel once.
225 *
226 * @param cfg configuration to use
227 * @param id Peer whose tunnel to examine.
228 * @param callback Function to call with the requested data.
229 * @param callback_cls Closure for @c callback.
230 * @return NULL on error
231 */
232struct GNUNET_CADET_GetTunnel *
233GNUNET_CADET_get_tunnel (const struct GNUNET_CONFIGURATION_Handle *cfg,
234 const struct GNUNET_PeerIdentity *id,
235 GNUNET_CADET_TunnelCB callback,
236 void *callback_cls)
237{
238 struct GNUNET_CADET_GetTunnel *gt;
239
240 if (NULL == callback)
241 {
242 GNUNET_break (0);
243 return NULL;
244 }
245 gt = GNUNET_new (struct GNUNET_CADET_GetTunnel);
246 gt->callback = callback;
247 gt->callback_cls = callback_cls;
248 gt->cfg = cfg;
249 gt->id = *id;
250 reconnect (gt);
251 if (NULL == gt->mq)
252 {
253 GNUNET_free (gt);
254 return NULL;
255 }
256 return gt;
257}
258
259
260/**
261 * Cancel a monitor request. The monitor callback will not be called.
262 *
263 * @param lt operation handle
264 * @return Closure given to #GNUNET_CADET_get_tunnel(), if any.
265 */
266void *
267GNUNET_CADET_get_tunnel_cancel (struct GNUNET_CADET_GetTunnel *gt)
268{
269 void *ret = gt->callback_cls;
270
271 if (NULL != gt->mq)
272 GNUNET_MQ_destroy (gt->mq);
273 if (NULL != gt->reconnect_task)
274 GNUNET_SCHEDULER_cancel (gt->reconnect_task);
275 GNUNET_free (gt);
276 return ret;
277}
278
279/* end of cadet_api_get_tunnel.c */
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index 9e2d105b3..dba517a7b 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -47,11 +47,6 @@ static char *peer_id;
47static int request_tunnels; 47static int request_tunnels;
48 48
49/** 49/**
50 * Option --tunnel
51 */
52static char *tunnel_id;
53
54/**
55 * Option --connection 50 * Option --connection
56 */ 51 */
57static char *conn_id; 52static char *conn_id;
@@ -602,47 +597,6 @@ tunnels_callback (void *cls,
602 597
603 598
604/** 599/**
605 * Method called to retrieve information about a specific tunnel the cadet peer
606 * has established, o`r is trying to establish.
607 *
608 * @param cls Closure.
609 * @param peer Peer towards whom the tunnel is directed.
610 * @param n_channels Number of channels.
611 * @param n_connections Number of connections.
612 * @param channels Channels.
613 * @param connections Connections.
614 * @param estate Encryption status.
615 * @param cstate Connectivity status.
616 */
617static void
618tunnel_callback (void *cls,
619 const struct GNUNET_PeerIdentity *peer,
620 unsigned int n_channels,
621 unsigned int n_connections,
622 const struct GNUNET_CADET_ChannelTunnelNumber *channels,
623 const struct GNUNET_CADET_ConnectionTunnelIdentifier *connections,
624 unsigned int estate,
625 unsigned int cstate)
626{
627 unsigned int i;
628
629 if (NULL != peer)
630 {
631 FPRINTF (stdout, "Tunnel %s\n", GNUNET_i2s_full (peer));
632 FPRINTF (stdout, "\t%u channels\n", n_channels);
633 for (i = 0; i < n_channels; i++)
634 FPRINTF (stdout, "\t\t%X\n", ntohl (channels[i].cn));
635 FPRINTF (stdout, "\t%u connections\n", n_connections);
636 for (i = 0; i < n_connections; i++)
637 FPRINTF (stdout, "\t\t%s\n", GNUNET_sh2s (&connections[i].connection_of_tunnel));
638 FPRINTF (stdout, "\tencryption state: %s\n", enc_2s (estate));
639 FPRINTF (stdout, "\tconnection state: %s\n", conn_2s (cstate));
640 }
641 GNUNET_SCHEDULER_shutdown ();
642}
643
644
645/**
646 * Call CADET's meta API, get all peers known to a peer. 600 * Call CADET's meta API, get all peers known to a peer.
647 * 601 *
648 * @param cls Closure (unused). 602 * @param cls Closure (unused).
@@ -702,37 +656,6 @@ get_tunnels (void *cls)
702 656
703 657
704/** 658/**
705 * Call CADET's monitor API, get info of one tunnel.
706 *
707 * @param cls Closure (unused).
708 */
709static void
710show_tunnel (void *cls)
711{
712 struct GNUNET_PeerIdentity pid;
713
714 job = NULL;
715 if (GNUNET_OK !=
716 GNUNET_CRYPTO_eddsa_public_key_from_string (tunnel_id,
717 strlen (tunnel_id),
718 &pid.public_key))
719 {
720 fprintf (stderr,
721 _("Invalid tunnel owner `%s'\n"),
722 tunnel_id);
723 GNUNET_SCHEDULER_shutdown ();
724 return;
725 }
726#if FIXME5385
727 GNUNET_CADET_get_tunnel (my_cfg,
728 &pid,
729 &tunnel_callback,
730 NULL);
731#endif
732}
733
734
735/**
736 * Call CADET's monitor API, get info of one channel. 659 * Call CADET's monitor API, get info of one channel.
737 * 660 *
738 * @param cls Closure (unused). 661 * @param cls Closure (unused).
@@ -787,7 +710,6 @@ run (void *cls,
787 target_port = args[1]; 710 target_port = args[1];
788 711
789 if ( (0 != (request_peers | request_tunnels) 712 if ( (0 != (request_peers | request_tunnels)
790 || NULL != tunnel_id
791 || NULL != conn_id 713 || NULL != conn_id
792 || NULL != channel_id) 714 || NULL != channel_id)
793 && target_id != NULL) 715 && target_id != NULL)
@@ -805,13 +727,6 @@ run (void *cls,
805 job = GNUNET_SCHEDULER_add_now (&show_peer, 727 job = GNUNET_SCHEDULER_add_now (&show_peer,
806 NULL); 728 NULL);
807 } 729 }
808 else if (NULL != tunnel_id)
809 {
810 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
811 "Show tunnel\n");
812 job = GNUNET_SCHEDULER_add_now (&show_tunnel,
813 NULL);
814 }
815 else if (NULL != channel_id) 730 else if (NULL != channel_id)
816 { 731 {
817 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 732 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -959,11 +874,6 @@ main (int argc,
959 "peers", 874 "peers",
960 gettext_noop ("Provide information about all peers"), 875 gettext_noop ("Provide information about all peers"),
961 &request_peers), 876 &request_peers),
962 GNUNET_GETOPT_option_string ('t',
963 "tunnel",
964 "TUNNEL_ID",
965 gettext_noop ("Provide information about a particular tunnel"),
966 &tunnel_id),
967 GNUNET_GETOPT_option_flag ('T', 877 GNUNET_GETOPT_option_flag ('T',
968 "tunnels", 878 "tunnels",
969 gettext_noop ("Provide information about all tunnels"), 879 gettext_noop ("Provide information about all tunnels"),
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c
index ef5fa6d7e..97950a18a 100644
--- a/src/cadet/gnunet-service-cadet.c
+++ b/src/cadet/gnunet-service-cadet.c
@@ -998,109 +998,6 @@ handle_info_tunnels (void *cls,
998 998
999 999
1000/** 1000/**
1001 * Update the message with information about the connection.
1002 *
1003 * @param cls a `struct GNUNET_CADET_LocalInfoTunnel` message to update
1004 * @param ct a connection about which we should store information in @a cls
1005 */
1006static void
1007iter_connection (void *cls,
1008 struct CadetTConnection *ct)
1009{
1010 struct GNUNET_CADET_LocalInfoTunnel *msg = cls;
1011 struct CadetConnection *cc = ct->cc;
1012 struct GNUNET_CADET_ConnectionTunnelIdentifier *h;
1013
1014 h = (struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1];
1015 h[msg->connections++] = *(GCC_get_id (cc));
1016}
1017
1018
1019/**
1020 * Update the message with information about the channel.
1021 *
1022 * @param cls a `struct GNUNET_CADET_LocalInfoTunnel` message to update
1023 * @param ch a channel about which we should store information in @a cls
1024 */
1025static void
1026iter_channel (void *cls,
1027 struct CadetChannel *ch)
1028{
1029 struct GNUNET_CADET_LocalInfoTunnel *msg = cls;
1030 struct GNUNET_CADET_ConnectionTunnelIdentifier *h = (struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1];
1031 struct GNUNET_CADET_ChannelTunnelNumber *chn
1032 = (struct GNUNET_CADET_ChannelTunnelNumber *) &h[msg->connections];
1033
1034 chn[msg->channels++] = GCCH_get_id (ch);
1035}
1036
1037
1038/**
1039 * Handler for client's #GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNEL request.
1040 *
1041 * @param cls Identification of the client.
1042 * @param msg The actual message.
1043 */
1044static void
1045handle_info_tunnel (void *cls,
1046 const struct GNUNET_CADET_LocalInfo *msg)
1047{
1048 struct CadetClient *c = cls;
1049 struct GNUNET_MQ_Envelope *env;
1050 struct GNUNET_CADET_LocalInfoTunnel *resp;
1051 struct CadetTunnel *t;
1052 struct CadetPeer *p;
1053 unsigned int ch_n;
1054 unsigned int c_n;
1055
1056 p = GCP_get (&msg->peer,
1057 GNUNET_NO);
1058 t = GCP_get_tunnel (p,
1059 GNUNET_NO);
1060 if (NULL == t)
1061 {
1062 /* We don't know the tunnel */
1063 struct GNUNET_MQ_Envelope *env;
1064 struct GNUNET_CADET_LocalInfoTunnel *warn;
1065
1066 LOG (GNUNET_ERROR_TYPE_INFO,
1067 "Tunnel to %s unknown\n",
1068 GNUNET_i2s_full (&msg->peer));
1069 env = GNUNET_MQ_msg (warn,
1070 GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
1071 warn->destination = msg->peer;
1072 GNUNET_MQ_send (c->mq,
1073 env);
1074 GNUNET_SERVICE_client_continue (c->client);
1075 return;
1076 }
1077
1078 /* Initialize context */
1079 ch_n = GCT_count_channels (t);
1080 c_n = GCT_count_any_connections (t);
1081 env = GNUNET_MQ_msg_extra (resp,
1082 c_n * sizeof (struct GNUNET_CADET_ConnectionTunnelIdentifier) +
1083 ch_n * sizeof (struct GNUNET_CADET_ChannelTunnelNumber),
1084 GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL);
1085 resp->destination = msg->peer;
1086 /* Do not reorder! #iter_channel needs counters in HBO! */
1087 GCT_iterate_connections (t,
1088 &iter_connection,
1089 resp);
1090 GCT_iterate_channels (t,
1091 &iter_channel,
1092 resp);
1093 resp->connections = htonl (resp->connections);
1094 resp->channels = htonl (resp->channels);
1095 resp->cstate = htons (0);
1096 resp->estate = htons (GCT_get_estate (t));
1097 GNUNET_MQ_send (c->mq,
1098 env);
1099 GNUNET_SERVICE_client_continue (c->client);
1100}
1101
1102
1103/**
1104 * Callback called when a client connects to the service. 1001 * Callback called when a client connects to the service.
1105 * 1002 *
1106 * @param cls closure for the service 1003 * @param cls closure for the service
@@ -1438,10 +1335,6 @@ GNUNET_SERVICE_MAIN
1438 GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS, 1335 GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS,
1439 struct GNUNET_MessageHeader, 1336 struct GNUNET_MessageHeader,
1440 NULL), 1337 NULL),
1441 GNUNET_MQ_hd_fixed_size (info_tunnel,
1442 GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL,
1443 struct GNUNET_CADET_LocalInfo,
1444 NULL),
1445 GNUNET_MQ_handler_end ()); 1338 GNUNET_MQ_handler_end ());
1446 1339
1447/* end of gnunet-service-cadet-new.c */ 1340/* end of gnunet-service-cadet-new.c */
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index 82350ed32..ac3d11216 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -649,65 +649,6 @@ void *
649GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt); 649GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt);
650 650
651 651
652
653/**
654 * Method called to retrieve information about a specific tunnel the cadet peer
655 * has established, o`r is trying to establish.
656 *
657 * @param cls Closure.
658 * @param peer Peer towards whom the tunnel is directed.
659 * @param n_channels Number of channels.
660 * @param n_connections Number of connections.
661 * @param channels Channels.
662 * @param connections Connections.
663 * @param estate Encryption state.
664 * @param cstate Connectivity state.
665 */
666typedef void
667(*GNUNET_CADET_TunnelCB) (void *cls,
668 const struct GNUNET_PeerIdentity *peer,
669 unsigned int n_channels,
670 unsigned int n_connections,
671 const struct GNUNET_CADET_ChannelTunnelNumber *channels,
672 const struct GNUNET_CADET_ConnectionTunnelIdentifier *connections,
673 unsigned int estate,
674 unsigned int cstate);
675
676
677/**
678 * Operation handle.
679 */
680struct GNUNET_CADET_GetTunnel;
681
682
683/**
684 * Request information about a tunnel of the running cadet peer.
685 * The callback will be called for the tunnel once.
686 * Only one info request (of any kind) can be active at once.
687 *
688 * @param cfg configuration to use
689 * @param id Peer whose tunnel to examine.
690 * @param callback Function to call with the requested data.
691 * @param callback_cls Closure for @c callback.
692 * @return NULL on error
693 */
694struct GNUNET_CADET_GetTunnel *
695GNUNET_CADET_get_tunnel (const struct GNUNET_CONFIGURATION_Handle *cfg,
696 const struct GNUNET_PeerIdentity *id,
697 GNUNET_CADET_TunnelCB callback,
698 void *callback_cls);
699
700
701/**
702 * Cancel a monitor request. The monitor callback will not be called.
703 *
704 * @param lt operation handle
705 * @return Closure given to #GNUNET_CADET_get_tunnel(), if any.
706 */
707void *
708GNUNET_CADET_get_tunnel_cancel (struct GNUNET_CADET_GetTunnel *gt);
709
710
711#if 0 /* keep Emacsens' auto-indent happy */ 652#if 0 /* keep Emacsens' auto-indent happy */
712{ 653{
713#endif 654#endif
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 9d3280d36..1cd06de8d 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2862,29 +2862,29 @@ extern "C"
2862#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL 1031 2862#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL 1031
2863 2863
2864/** 2864/**
2865 * Local information about all tunnels of service. 2865 * End of local information of service about channels.
2866 */ 2866 */
2867#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS 1032 2867#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL_END 1032
2868 2868
2869/** 2869/**
2870 * Local information of service about a specific tunnel. 2870 * Request local information about all peers known to the service.
2871 */ 2871 */
2872#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL 1033 2872#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PEERS 1033
2873 2873
2874/** 2874/**
2875 * Local information about all connections of service. 2875 * Local information about all peers known to the service.
2876 */ 2876 */
2877#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTIONS 1034 2877#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS 1034
2878 2878
2879/** 2879/**
2880 * Local information of service about a specific connection. 2880 * End of local information about all peers known to the service.
2881 */ 2881 */
2882#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CONNECTION 1035 2882#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS_END 1035
2883 2883
2884/** 2884/**
2885 * Local information about all peers known to the service. 2885 * Request local information of service about paths to specific peer.
2886 */ 2886 */
2887#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS 1036 2887#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH 1036
2888 2888
2889/** 2889/**
2890 * Local information of service about a specific path. 2890 * Local information of service about a specific path.
@@ -2892,39 +2892,25 @@ extern "C"
2892#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH 1037 2892#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH 1037
2893 2893
2894/** 2894/**
2895 * End of local information of service about channels. 2895 * End of local information of service about a specific path.
2896 */
2897#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL_END 1038
2898
2899/**
2900 * End of local information about all peers known to the service.
2901 */
2902#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS_END 1039
2903
2904/**
2905 * Request local information about all peers known to the service.
2906 */ 2896 */
2907#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PEERS 1040 2897#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH_END 1038
2908 2898
2909/** 2899/**
2910 * End of local information of service about a specific path. 2900 * Request local information about all tunnels of service.
2911 */ 2901 */
2912#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PATH_END 1041 2902#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS 1039
2913 2903
2914/** 2904/**
2915 * Request local information of service about paths to specific peer. 2905 * Local information about all tunnels of service.
2916 */ 2906 */
2917#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH 1042 2907#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS 1040
2918 2908
2919/** 2909/**
2920 * End of local information about all tunnels of service. 2910 * End of local information about all tunnels of service.
2921 */ 2911 */
2922#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS_END 1043 2912#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS_END 1041
2923 2913
2924/**
2925 * Request local information about all tunnels of service.
2926 */
2927#define GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS 1044
2928 2914
2929/******************************** Application *******************************/ 2915/******************************** Application *******************************/
2930 2916