diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-01-26 21:18:06 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-01-26 21:18:06 +0100 |
commit | 8f884f001a70fee622fff0c0ac8c38a0634df789 (patch) | |
tree | cd8b0c45ab3209d73db6396dc2956cf569625b54 /src/cadet | |
parent | 7fc78674a6d3f2edb41e32cea59200908d0b344b (diff) | |
download | gnunet-8f884f001a70fee622fff0c0ac8c38a0634df789.tar.gz gnunet-8f884f001a70fee622fff0c0ac8c38a0634df789.zip |
more work on 5385
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/cadet_api_get_channel.c | 37 | ||||
-rw-r--r-- | src/cadet/cadet_api_get_peer.c | 140 | ||||
-rw-r--r-- | src/cadet/cadet_api_list_peers.c | 125 | ||||
-rw-r--r-- | src/cadet/cadet_api_list_tunnels.c | 39 |
4 files changed, 202 insertions, 139 deletions
diff --git a/src/cadet/cadet_api_get_channel.c b/src/cadet/cadet_api_get_channel.c index c36766a3f..cd90f5b78 100644 --- a/src/cadet/cadet_api_get_channel.c +++ b/src/cadet/cadet_api_get_channel.c | |||
@@ -48,28 +48,40 @@ struct GNUNET_CADET_ChannelMonitor | |||
48 | */ | 48 | */ |
49 | void *channel_cb_cls; | 49 | void *channel_cb_cls; |
50 | 50 | ||
51 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
52 | |||
53 | struct GNUNET_MQ_Handle *mq; | ||
54 | |||
55 | struct GNUNET_PeerIdentity peer; | ||
56 | |||
57 | uint32_t /* UGH */ channel_number; | ||
58 | |||
51 | }; | 59 | }; |
52 | 60 | ||
53 | 61 | ||
54 | /** | 62 | |
55 | * Send message of @a type to CADET service of @a h | ||
56 | * | ||
57 | * @param h handle to CADET service | ||
58 | * @param type message type of trivial information request to send | ||
59 | */ | ||
60 | static void | 63 | static void |
61 | send_info_request (struct GNUNET_CADET_Handle *h, | 64 | reconnect (void *cls) |
62 | uint16_t type) | ||
63 | { | 65 | { |
66 | struct GNUNET_CADET_ChannelMonitor *cm = cls; | ||
67 | struct GNUNET_MQ_MessageHandler *handlers[] = { | ||
68 | } | ||
64 | struct GNUNET_MessageHeader *msg; | 69 | struct GNUNET_MessageHeader *msg; |
65 | struct GNUNET_MQ_Envelope *env; | 70 | struct GNUNET_MQ_Envelope *env; |
66 | 71 | ||
72 | cm->mq = GNUNET_CLIENT_connect (cm->cfg, | ||
73 | "cadet", | ||
74 | handlers, | ||
75 | &error_handler, | ||
76 | cm); | ||
77 | |||
67 | env = GNUNET_MQ_msg (msg, | 78 | env = GNUNET_MQ_msg (msg, |
68 | type); | 79 | type); |
69 | GNUNET_MQ_send (h->mq, | 80 | GNUNET_MQ_send (cm->mq, |
70 | env); | 81 | env); |
71 | } | 82 | } |
72 | 83 | ||
84 | |||
73 | /** | 85 | /** |
74 | * Request information about a specific channel of the running cadet peer. | 86 | * Request information about a specific channel of the running cadet peer. |
75 | * | 87 | * |
@@ -82,7 +94,7 @@ send_info_request (struct GNUNET_CADET_Handle *h, | |||
82 | * @param callback_cls Closure for @c callback. | 94 | * @param callback_cls Closure for @c callback. |
83 | */ | 95 | */ |
84 | struct GNUNET_CADET_ChannelMonitor * | 96 | struct GNUNET_CADET_ChannelMonitor * |
85 | GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h, | 97 | GNUNET_CADET_get_channel (const struct GNUNET_CONFIGURATION_Handle *cfg, |
86 | struct GNUNET_PeerIdentity *peer, | 98 | struct GNUNET_PeerIdentity *peer, |
87 | uint32_t /* UGH */ channel_number, | 99 | uint32_t /* UGH */ channel_number, |
88 | GNUNET_CADET_ChannelCB callback, | 100 | GNUNET_CADET_ChannelCB callback, |
@@ -92,5 +104,6 @@ GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h, | |||
92 | 104 | ||
93 | 105 | ||
94 | void * | 106 | void * |
95 | GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm); | 107 | GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm) |
96 | 108 | { | |
109 | } | ||
diff --git a/src/cadet/cadet_api_get_peer.c b/src/cadet/cadet_api_get_peer.c index b29b66e1c..c7d6e324b 100644 --- a/src/cadet/cadet_api_get_peer.c +++ b/src/cadet/cadet_api_get_peer.c | |||
@@ -31,9 +31,8 @@ | |||
31 | #include "cadet_protocol.h" | 31 | #include "cadet_protocol.h" |
32 | 32 | ||
33 | 33 | ||
34 | |||
35 | /** | 34 | /** |
36 | * Ugly legacy hack. | 35 | * |
37 | */ | 36 | */ |
38 | struct GNUNET_CADET_GetPeer | 37 | struct GNUNET_CADET_GetPeer |
39 | { | 38 | { |
@@ -48,34 +47,18 @@ struct GNUNET_CADET_GetPeer | |||
48 | */ | 47 | */ |
49 | void *peer_cb_cls; | 48 | void *peer_cb_cls; |
50 | 49 | ||
50 | struct GNUNET_PeerIdentity id; | ||
51 | 51 | ||
52 | }; | 52 | struct GNUNET_MQ_Handle *mq; |
53 | |||
54 | |||
55 | /** | ||
56 | * Send message of @a type to CADET service of @a h | ||
57 | * | ||
58 | * @param h handle to CADET service | ||
59 | * @param type message type of trivial information request to send | ||
60 | */ | ||
61 | static void | ||
62 | send_info_request (struct GNUNET_CADET_Handle *h, | ||
63 | uint16_t type) | ||
64 | { | ||
65 | struct GNUNET_MessageHeader *msg; | ||
66 | struct GNUNET_MQ_Envelope *env; | ||
67 | 53 | ||
68 | env = GNUNET_MQ_msg (msg, | 54 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
69 | type); | 55 | }; |
70 | GNUNET_MQ_send (h->mq, | ||
71 | env); | ||
72 | } | ||
73 | 56 | ||
74 | 57 | ||
75 | /** | 58 | /** |
76 | * Check that message received from CADET service is well-formed. | 59 | * Check that message received from CADET service is well-formed. |
77 | * | 60 | * |
78 | * @param cls the `struct GNUNET_CADET_Handle` | 61 | * @param cls unused |
79 | * @param message the message we got | 62 | * @param message the message we got |
80 | * @return #GNUNET_OK if the message is well-formed, | 63 | * @return #GNUNET_OK if the message is well-formed, |
81 | * #GNUNET_SYSERR otherwise | 64 | * #GNUNET_SYSERR otherwise |
@@ -106,27 +89,25 @@ check_get_peer (void *cls, | |||
106 | /** | 89 | /** |
107 | * Process a local peer info reply, pass info to the user. | 90 | * Process a local peer info reply, pass info to the user. |
108 | * | 91 | * |
109 | * @param cls Closure (Cadet handle). | 92 | * @param cls Closure |
110 | * @param message Message itself. | 93 | * @param message Message itself. |
111 | */ | 94 | */ |
112 | static void | 95 | static void |
113 | handle_get_peer (void *cls, | 96 | handle_get_peer (void *cls, |
114 | const struct GNUNET_CADET_LocalInfoPeer *message) | 97 | const struct GNUNET_CADET_LocalInfoPeer *message) |
115 | { | 98 | { |
116 | struct GNUNET_CADET_Handle *h = cls; | 99 | struct GNUNET_CADET_GetPeer *gp = cls; |
117 | const struct GNUNET_PeerIdentity *paths_array; | 100 | const struct GNUNET_PeerIdentity *paths_array; |
118 | unsigned int paths; | 101 | unsigned int paths; |
119 | unsigned int path_length; | 102 | unsigned int path_length; |
120 | int neighbor; | 103 | int neighbor; |
121 | unsigned int peers; | 104 | unsigned int peers; |
122 | 105 | ||
123 | if (NULL == h->info_cb.peer_cb) | ||
124 | return; | ||
125 | 106 | ||
126 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 107 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
127 | "number of paths %u\n", | 108 | "number of paths %u\n", |
128 | ntohs (message->paths)); | 109 | ntohs (message->paths)); |
129 | 110 | ||
130 | paths = ntohs (message->paths); | 111 | paths = ntohs (message->paths); |
131 | paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; | 112 | paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; |
132 | peers = (ntohs (message->header.size) - sizeof (*message)) | 113 | peers = (ntohs (message->header.size) - sizeof (*message)) |
@@ -151,25 +132,50 @@ handle_get_peer (void *cls, | |||
151 | 132 | ||
152 | /* Call Callback with tunnel info. */ | 133 | /* Call Callback with tunnel info. */ |
153 | paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; | 134 | paths_array = (const struct GNUNET_PeerIdentity *) &message[1]; |
154 | h->info_cb.peer_cb (h->info_cls, | 135 | gp->peer_cb (gp->peer_cb_cls, |
155 | &message->destination, | 136 | &message->destination, |
156 | (int) ntohs (message->tunnel), | 137 | (int) ntohs (message->tunnel), |
157 | neighbor, | 138 | neighbor, |
158 | paths, | 139 | paths, |
159 | paths_array, | 140 | paths_array, |
160 | (int) ntohs (message->offset), | 141 | (int) ntohs (message->offset), |
161 | (int) ntohs (message->finished_with_paths)); | 142 | (int) ntohs (message->finished_with_paths)); |
143 | GNUNET_CADET_get_peer_cancel (gp); | ||
162 | } | 144 | } |
163 | 145 | ||
164 | 146 | ||
147 | static void | ||
148 | reconnect (void *cls) | ||
149 | { | ||
150 | struct GNUNET_CADET_GetPeer *gp = cls; | ||
151 | struct GNUNET_MQ_MessageHandler *handlers[] = { | ||
152 | GNUNET_MQ_hd_var_size (get_peer, | ||
153 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER, | ||
154 | struct GNUNET_CADET_LocalInfoPeer, | ||
155 | h), | ||
156 | GNUNET_MQ_handler_end () | ||
157 | } | ||
158 | struct GNUNET_CADET_LocalInfo *msg; | ||
159 | struct GNUNET_MQ_Envelope *env; | ||
160 | |||
161 | gp->mq = GNUNET_CLIENT_connect (gp->cfg, | ||
162 | "cadet", | ||
163 | handlers, | ||
164 | &error_handler, | ||
165 | gp); | ||
166 | if (NULL == gp->mq) | ||
167 | return; | ||
168 | env = GNUNET_MQ_msg (msg, | ||
169 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); | ||
170 | msg->peer = gp->id; | ||
171 | GNUNET_MQ_send (lt->mq, | ||
172 | env); | ||
173 | } | ||
165 | 174 | ||
166 | 175 | ||
167 | /** | 176 | /** |
168 | * Request information about a peer known to the running cadet peer. | 177 | * Request information about a peer known to the running cadet peer. |
169 | * The callback will be called for the tunnel once. | 178 | * The callback will be called for the tunnel once. |
170 | * Only one info request (of any kind) can be active at once. | ||
171 | * | ||
172 | * WARNING: unstable API, likely to change in the future! | ||
173 | * | 179 | * |
174 | * @param h Handle to the cadet peer. | 180 | * @param h Handle to the cadet peer. |
175 | * @param id Peer whose tunnel to examine. | 181 | * @param id Peer whose tunnel to examine. |
@@ -177,43 +183,43 @@ handle_get_peer (void *cls, | |||
177 | * @param callback_cls Closure for @c callback. | 183 | * @param callback_cls Closure for @c callback. |
178 | * @return #GNUNET_OK / #GNUNET_SYSERR | 184 | * @return #GNUNET_OK / #GNUNET_SYSERR |
179 | */ | 185 | */ |
180 | int | 186 | struct GNUNET_CADET_GetPeer * |
181 | GNUNET_CADET_get_peer (const struct GNUNET_CONFIGURATION_Handle *cfg, | 187 | GNUNET_CADET_get_peer (const struct GNUNET_CONFIGURATION_Handle *cfg, |
182 | const struct GNUNET_PeerIdentity *id, | 188 | const struct GNUNET_PeerIdentity *id, |
183 | GNUNET_CADET_PeerCB callback, | 189 | GNUNET_CADET_PeerCB callback, |
184 | void *callback_cls) | 190 | void *callback_cls) |
185 | { | 191 | { |
186 | struct GNUNET_CADET_LocalInfo *msg; | 192 | struct GNUNET_CADET_GetPeer *gp; |
187 | struct GNUNET_MQ_Envelope *env; | ||
188 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
189 | 193 | ||
190 | GNUNET_MQ_hd_var_size (get_peers, | 194 | if (NULL == callback) |
191 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS, | ||
192 | struct GNUNET_MessageHeader, | ||
193 | h), | ||
194 | GNUNET_MQ_hd_var_size (get_peer, | ||
195 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER, | ||
196 | struct GNUNET_CADET_LocalInfoPeer, | ||
197 | h), | ||
198 | GNUNET_MQ_handler_end () | ||
199 | |||
200 | |||
201 | if (NULL != h->info_cb.peer_cb) | ||
202 | { | 195 | { |
203 | GNUNET_break (0); | 196 | GNUNET_break (0); |
204 | return GNUNET_SYSERR; | 197 | return NULL; |
205 | } | 198 | } |
206 | env = GNUNET_MQ_msg (msg, | 199 | gp = GNUNET_new (struct GNUNET_CADET_GetPeer); |
207 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); | 200 | gp->peer_cb = callback; |
208 | msg->peer = *id; | 201 | gp->peer_cb_cls = callback_cls; |
209 | GNUNET_MQ_send (h->mq, | 202 | gp->cfg = cfg; |
210 | env); | 203 | gp->id = *id; |
211 | h->info_cb.peer_cb = callback; | 204 | reconnect (gp); |
212 | h->info_cls = callback_cls; | 205 | if (NULL == gp->mq) |
213 | return GNUNET_OK; | 206 | { |
207 | GNUNET_free (gp); | ||
208 | return NULL; | ||
209 | } | ||
210 | return gp; | ||
214 | } | 211 | } |
215 | 212 | ||
216 | 213 | ||
217 | 214 | ||
215 | void * | ||
216 | GNUNET_CADET_get_peer_cancel (struct GNUNET_CADET_GetPeer *gp) | ||
217 | { | ||
218 | void *ret = gp->peer_cb_cls; | ||
219 | |||
220 | GNUNET_MQ_disconnect (gp->mq); | ||
221 | GNUNET_free (gp); | ||
222 | return ret; | ||
223 | } | ||
218 | 224 | ||
219 | 225 | ||
diff --git a/src/cadet/cadet_api_list_peers.c b/src/cadet/cadet_api_list_peers.c index 4bdc8b961..f6563a290 100644 --- a/src/cadet/cadet_api_list_peers.c +++ b/src/cadet/cadet_api_list_peers.c | |||
@@ -71,55 +71,6 @@ send_info_request (struct GNUNET_CADET_Handle *h, | |||
71 | 71 | ||
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Request information about peers known to the running cadet service. | ||
75 | * The callback will be called for every peer known to the service. | ||
76 | * Only one info request (of any kind) can be active at once. | ||
77 | * | ||
78 | * WARNING: unstable API, likely to change in the future! | ||
79 | * | ||
80 | * @param h Handle to the cadet peer. | ||
81 | * @param callback Function to call with the requested data. | ||
82 | * @param callback_cls Closure for @c callback. | ||
83 | * @return #GNUNET_OK / #GNUNET_SYSERR | ||
84 | */ | ||
85 | int | ||
86 | GNUNET_CADET_list_peers (struct GNUNET_CADET_Handle *h, | ||
87 | GNUNET_CADET_PeersCB callback, | ||
88 | void *callback_cls) | ||
89 | { | ||
90 | if (NULL != h->info_cb.peers_cb) | ||
91 | { | ||
92 | GNUNET_break (0); | ||
93 | return GNUNET_SYSERR; | ||
94 | } | ||
95 | send_info_request (h, | ||
96 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); | ||
97 | h->info_cb.peers_cb = callback; | ||
98 | h->info_cls = callback_cls; | ||
99 | return GNUNET_OK; | ||
100 | } | ||
101 | |||
102 | |||
103 | /** | ||
104 | * Cancel a peer info request. The callback will not be called (anymore). | ||
105 | * | ||
106 | * WARNING: unstable API, likely to change in the future! | ||
107 | * | ||
108 | * @param h Cadet handle. | ||
109 | * @return Closure given to GNUNET_CADET_get_peers(). | ||
110 | */ | ||
111 | void * | ||
112 | GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_Handle *h) | ||
113 | { | ||
114 | void *cls = h->info_cls; | ||
115 | |||
116 | h->info_cb.peers_cb = NULL; | ||
117 | h->info_cls = NULL; | ||
118 | return cls; | ||
119 | } | ||
120 | |||
121 | |||
122 | /** | ||
123 | * Check that message received from CADET service is well-formed. | 74 | * Check that message received from CADET service is well-formed. |
124 | * | 75 | * |
125 | * @param cls the `struct GNUNET_CADET_Handle` | 76 | * @param cls the `struct GNUNET_CADET_Handle` |
@@ -174,6 +125,82 @@ handle_get_peers (void *cls, | |||
174 | } | 125 | } |
175 | 126 | ||
176 | 127 | ||
128 | static void | ||
129 | reconnect (void *cls) | ||
130 | { | ||
131 | struct GNUNET_CADET_ListTunnels *lt = cls; | ||
132 | struct GNUNET_MQ_MessageHandler *handlers[] = { | ||
133 | GNUNET_MQ_hd_var_size (get_peers, | ||
134 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS, | ||
135 | struct GNUNET_MessageHeader, | ||
136 | h), | ||
137 | GNUNET_MQ_handler_end () | ||
138 | } | ||
139 | struct GNUNET_MessageHeader *msg; | ||
140 | struct GNUNET_MQ_Envelope *env; | ||
141 | |||
142 | cm->mq = GNUNET_CLIENT_connect (cm->cfg, | ||
143 | "cadet", | ||
144 | handlers, | ||
145 | &error_handler, | ||
146 | cm); | ||
147 | |||
148 | env = GNUNET_MQ_msg (msg, | ||
149 | type); | ||
150 | GNUNET_MQ_send (cm->mq, | ||
151 | env); | ||
152 | } | ||
153 | |||
154 | |||
155 | /** | ||
156 | * Request information about peers known to the running cadet service. | ||
157 | * The callback will be called for every peer known to the service. | ||
158 | * Only one info request (of any kind) can be active at once. | ||
159 | * | ||
160 | * WARNING: unstable API, likely to change in the future! | ||
161 | * | ||
162 | * @param h Handle to the cadet peer. | ||
163 | * @param callback Function to call with the requested data. | ||
164 | * @param callback_cls Closure for @c callback. | ||
165 | * @return #GNUNET_OK / #GNUNET_SYSERR | ||
166 | */ | ||
167 | struct GNUNET_CADET_PeersLister * | ||
168 | GNUNET_CADET_list_peers (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
169 | GNUNET_CADET_PeersCB callback, | ||
170 | void *callback_cls) | ||
171 | { | ||
172 | if (NULL != h->info_cb.peers_cb) | ||
173 | { | ||
174 | GNUNET_break (0); | ||
175 | return GNUNET_SYSERR; | ||
176 | } | ||
177 | send_info_request (h, | ||
178 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); | ||
179 | h->info_cb.peers_cb = callback; | ||
180 | h->info_cls = callback_cls; | ||
181 | return GNUNET_OK; | ||
182 | } | ||
183 | |||
184 | |||
185 | /** | ||
186 | * Cancel a peer info request. The callback will not be called (anymore). | ||
187 | * | ||
188 | * WARNING: unstable API, likely to change in the future! | ||
189 | * | ||
190 | * @param h Cadet handle. | ||
191 | * @return Closure given to GNUNET_CADET_get_peers(). | ||
192 | */ | ||
193 | void * | ||
194 | GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_PeersLister *pl) | ||
195 | { | ||
196 | void *cls = h->info_cls; | ||
197 | |||
198 | h->info_cb.peers_cb = NULL; | ||
199 | h->info_cls = NULL; | ||
200 | return cls; | ||
201 | } | ||
202 | |||
203 | |||
177 | 204 | ||
178 | 205 | ||
179 | 206 | ||
diff --git a/src/cadet/cadet_api_list_tunnels.c b/src/cadet/cadet_api_list_tunnels.c index da5f85aa0..96343bf4d 100644 --- a/src/cadet/cadet_api_list_tunnels.c +++ b/src/cadet/cadet_api_list_tunnels.c | |||
@@ -127,6 +127,33 @@ handle_get_tunnels (void *cls, | |||
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | static void | ||
131 | reconnect (void *cls) | ||
132 | { | ||
133 | struct GNUNET_CADET_ListTunnels *lt = cls; | ||
134 | struct GNUNET_MQ_MessageHandler *handlers[] = { | ||
135 | GNUNET_MQ_hd_var_size (get_tunnels, | ||
136 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS, | ||
137 | struct GNUNET_MessageHeader, | ||
138 | h), | ||
139 | GNUNET_MQ_handler_end () | ||
140 | } | ||
141 | struct GNUNET_MessageHeader *msg; | ||
142 | struct GNUNET_MQ_Envelope *env; | ||
143 | |||
144 | cm->mq = GNUNET_CLIENT_connect (cm->cfg, | ||
145 | "cadet", | ||
146 | handlers, | ||
147 | &error_handler, | ||
148 | cm); | ||
149 | |||
150 | env = GNUNET_MQ_msg (msg, | ||
151 | type); | ||
152 | GNUNET_MQ_send (cm->mq, | ||
153 | env); | ||
154 | } | ||
155 | |||
156 | |||
130 | /** | 157 | /** |
131 | * Request information about tunnels of the running cadet peer. | 158 | * Request information about tunnels of the running cadet peer. |
132 | * The callback will be called for every tunnel of the service. | 159 | * The callback will be called for every tunnel of the service. |
@@ -139,22 +166,12 @@ handle_get_tunnels (void *cls, | |||
139 | * @param callback_cls Closure for @c callback. | 166 | * @param callback_cls Closure for @c callback. |
140 | * @return #GNUNET_OK / #GNUNET_SYSERR | 167 | * @return #GNUNET_OK / #GNUNET_SYSERR |
141 | */ | 168 | */ |
142 | int | 169 | struct GNUNET_CADET_ListTunnels * |
143 | GNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg, | 170 | GNUNET_CADET_list_tunnels (const struct GNUNET_CONFIGURATION_Handle *cfg, |
144 | GNUNET_CADET_TunnelsCB callback, | 171 | GNUNET_CADET_TunnelsCB callback, |
145 | void *callback_cls) | 172 | void *callback_cls) |
146 | { | 173 | { |
147 | 174 | ||
148 | GNUNET_MQ_hd_var_size (get_tunnels, | ||
149 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS, | ||
150 | struct GNUNET_MessageHeader, | ||
151 | h), | ||
152 | GNUNET_MQ_hd_var_size (get_tunnel, | ||
153 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL, | ||
154 | struct GNUNET_CADET_LocalInfoTunnel, | ||
155 | h), | ||
156 | GNUNET_MQ_handler_end () | ||
157 | |||
158 | if (NULL != h->info_cb.tunnels_cb) | 175 | if (NULL != h->info_cb.tunnels_cb) |
159 | { | 176 | { |
160 | GNUNET_break (0); | 177 | GNUNET_break (0); |