diff options
Diffstat (limited to 'src/mesh/mesh_api.c')
-rw-r--r-- | src/mesh/mesh_api.c | 666 |
1 files changed, 333 insertions, 333 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 4c69c6afd..aa5c67329 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -16,18 +16,18 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * @file mesh/mesh_api.c | 19 | * @file cadet/cadet_api.c |
20 | * @brief mesh api: client implementation of new mesh service | 20 | * @brief cadet api: client implementation of new cadet service |
21 | * @author Bartlomiej Polot | 21 | * @author Bartlomiej Polot |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_util_lib.h" | 25 | #include "gnunet_util_lib.h" |
26 | #include "gnunet_mesh_service.h" | 26 | #include "gnunet_cadet_service.h" |
27 | #include "mesh.h" | 27 | #include "cadet.h" |
28 | #include "mesh_protocol.h" | 28 | #include "cadet_protocol.h" |
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "mesh-api",__VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "cadet-api",__VA_ARGS__) |
31 | 31 | ||
32 | /******************************************************************************/ | 32 | /******************************************************************************/ |
33 | /************************ DATA STRUCTURES ****************************/ | 33 | /************************ DATA STRUCTURES ****************************/ |
@@ -36,23 +36,23 @@ | |||
36 | /** | 36 | /** |
37 | * Transmission queue to the service | 37 | * Transmission queue to the service |
38 | */ | 38 | */ |
39 | struct GNUNET_MESH_TransmitHandle | 39 | struct GNUNET_CADET_TransmitHandle |
40 | { | 40 | { |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Double Linked list | 43 | * Double Linked list |
44 | */ | 44 | */ |
45 | struct GNUNET_MESH_TransmitHandle *next; | 45 | struct GNUNET_CADET_TransmitHandle *next; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Double Linked list | 48 | * Double Linked list |
49 | */ | 49 | */ |
50 | struct GNUNET_MESH_TransmitHandle *prev; | 50 | struct GNUNET_CADET_TransmitHandle *prev; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Channel this message is sent on / for (may be NULL for control messages). | 53 | * Channel this message is sent on / for (may be NULL for control messages). |
54 | */ | 54 | */ |
55 | struct GNUNET_MESH_Channel *channel; | 55 | struct GNUNET_CADET_Channel *channel; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Callback to obtain the message to transmit, or NULL if we | 58 | * Callback to obtain the message to transmit, or NULL if we |
@@ -86,39 +86,39 @@ struct GNUNET_MESH_TransmitHandle | |||
86 | size_t size; | 86 | size_t size; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | union MeshInfoCB { | 89 | union CadetInfoCB { |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Channel callback. | 92 | * Channel callback. |
93 | */ | 93 | */ |
94 | GNUNET_MESH_ChannelCB channel_cb; | 94 | GNUNET_CADET_ChannelCB channel_cb; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Monitor callback | 97 | * Monitor callback |
98 | */ | 98 | */ |
99 | GNUNET_MESH_PeersCB peers_cb; | 99 | GNUNET_CADET_PeersCB peers_cb; |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Monitor callback | 102 | * Monitor callback |
103 | */ | 103 | */ |
104 | GNUNET_MESH_PeerCB peer_cb; | 104 | GNUNET_CADET_PeerCB peer_cb; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Monitor callback | 107 | * Monitor callback |
108 | */ | 108 | */ |
109 | GNUNET_MESH_TunnelsCB tunnels_cb; | 109 | GNUNET_CADET_TunnelsCB tunnels_cb; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Tunnel callback. | 112 | * Tunnel callback. |
113 | */ | 113 | */ |
114 | GNUNET_MESH_TunnelCB tunnel_cb; | 114 | GNUNET_CADET_TunnelCB tunnel_cb; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | 117 | ||
118 | /** | 118 | /** |
119 | * Opaque handle to the service. | 119 | * Opaque handle to the service. |
120 | */ | 120 | */ |
121 | struct GNUNET_MESH_Handle | 121 | struct GNUNET_CADET_Handle |
122 | { | 122 | { |
123 | 123 | ||
124 | /** | 124 | /** |
@@ -129,7 +129,7 @@ struct GNUNET_MESH_Handle | |||
129 | /** | 129 | /** |
130 | * Set of handlers used for processing incoming messages in the channels | 130 | * Set of handlers used for processing incoming messages in the channels |
131 | */ | 131 | */ |
132 | const struct GNUNET_MESH_MessageHandler *message_handlers; | 132 | const struct GNUNET_CADET_MessageHandler *message_handlers; |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * Number of handlers in the handlers array. | 135 | * Number of handlers in the handlers array. |
@@ -149,22 +149,22 @@ struct GNUNET_MESH_Handle | |||
149 | /** | 149 | /** |
150 | * Double linked list of the channels this client is connected to, head. | 150 | * Double linked list of the channels this client is connected to, head. |
151 | */ | 151 | */ |
152 | struct GNUNET_MESH_Channel *channels_head; | 152 | struct GNUNET_CADET_Channel *channels_head; |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Double linked list of the channels this client is connected to, tail. | 155 | * Double linked list of the channels this client is connected to, tail. |
156 | */ | 156 | */ |
157 | struct GNUNET_MESH_Channel *channels_tail; | 157 | struct GNUNET_CADET_Channel *channels_tail; |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * Callback for inbound channel creation | 160 | * Callback for inbound channel creation |
161 | */ | 161 | */ |
162 | GNUNET_MESH_InboundChannelNotificationHandler *new_channel; | 162 | GNUNET_CADET_InboundChannelNotificationHandler *new_channel; |
163 | 163 | ||
164 | /** | 164 | /** |
165 | * Callback for inbound channel disconnection | 165 | * Callback for inbound channel disconnection |
166 | */ | 166 | */ |
167 | GNUNET_MESH_ChannelEndHandler *cleaner; | 167 | GNUNET_CADET_ChannelEndHandler *cleaner; |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Handle to cancel pending transmissions in case of disconnection | 170 | * Handle to cancel pending transmissions in case of disconnection |
@@ -179,21 +179,21 @@ struct GNUNET_MESH_Handle | |||
179 | /** | 179 | /** |
180 | * Messages to send to the service, head. | 180 | * Messages to send to the service, head. |
181 | */ | 181 | */ |
182 | struct GNUNET_MESH_TransmitHandle *th_head; | 182 | struct GNUNET_CADET_TransmitHandle *th_head; |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Messages to send to the service, tail. | 185 | * Messages to send to the service, tail. |
186 | */ | 186 | */ |
187 | struct GNUNET_MESH_TransmitHandle *th_tail; | 187 | struct GNUNET_CADET_TransmitHandle *th_tail; |
188 | 188 | ||
189 | /** | 189 | /** |
190 | * chid of the next channel to create (to avoid reusing IDs often) | 190 | * chid of the next channel to create (to avoid reusing IDs often) |
191 | */ | 191 | */ |
192 | MESH_ChannelNumber next_chid; | 192 | CADET_ChannelNumber next_chid; |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Have we started the task to receive messages from the service | 195 | * Have we started the task to receive messages from the service |
196 | * yet? We do this after we send the 'MESH_LOCAL_CONNECT' message. | 196 | * yet? We do this after we send the 'CADET_LOCAL_CONNECT' message. |
197 | */ | 197 | */ |
198 | int in_receive; | 198 | int in_receive; |
199 | 199 | ||
@@ -215,7 +215,7 @@ struct GNUNET_MESH_Handle | |||
215 | /** | 215 | /** |
216 | * Callback for an info task (only one active at a time). | 216 | * Callback for an info task (only one active at a time). |
217 | */ | 217 | */ |
218 | union MeshInfoCB info_cb; | 218 | union CadetInfoCB info_cb; |
219 | 219 | ||
220 | /** | 220 | /** |
221 | * Info callback closure for @c info_cb. | 221 | * Info callback closure for @c info_cb. |
@@ -227,7 +227,7 @@ struct GNUNET_MESH_Handle | |||
227 | /** | 227 | /** |
228 | * Description of a peer | 228 | * Description of a peer |
229 | */ | 229 | */ |
230 | struct GNUNET_MESH_Peer | 230 | struct GNUNET_CADET_Peer |
231 | { | 231 | { |
232 | /** | 232 | /** |
233 | * ID of the peer in short form | 233 | * ID of the peer in short form |
@@ -237,35 +237,35 @@ struct GNUNET_MESH_Peer | |||
237 | /** | 237 | /** |
238 | * Channel this peer belongs to | 238 | * Channel this peer belongs to |
239 | */ | 239 | */ |
240 | struct GNUNET_MESH_Channel *t; | 240 | struct GNUNET_CADET_Channel *t; |
241 | }; | 241 | }; |
242 | 242 | ||
243 | 243 | ||
244 | /** | 244 | /** |
245 | * Opaque handle to a channel. | 245 | * Opaque handle to a channel. |
246 | */ | 246 | */ |
247 | struct GNUNET_MESH_Channel | 247 | struct GNUNET_CADET_Channel |
248 | { | 248 | { |
249 | 249 | ||
250 | /** | 250 | /** |
251 | * DLL next | 251 | * DLL next |
252 | */ | 252 | */ |
253 | struct GNUNET_MESH_Channel *next; | 253 | struct GNUNET_CADET_Channel *next; |
254 | 254 | ||
255 | /** | 255 | /** |
256 | * DLL prev | 256 | * DLL prev |
257 | */ | 257 | */ |
258 | struct GNUNET_MESH_Channel *prev; | 258 | struct GNUNET_CADET_Channel *prev; |
259 | 259 | ||
260 | /** | 260 | /** |
261 | * Handle to the mesh this channel belongs to | 261 | * Handle to the cadet this channel belongs to |
262 | */ | 262 | */ |
263 | struct GNUNET_MESH_Handle *mesh; | 263 | struct GNUNET_CADET_Handle *cadet; |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * Local ID of the channel | 266 | * Local ID of the channel |
267 | */ | 267 | */ |
268 | MESH_ChannelNumber chid; | 268 | CADET_ChannelNumber chid; |
269 | 269 | ||
270 | /** | 270 | /** |
271 | * Port number. | 271 | * Port number. |
@@ -290,7 +290,7 @@ struct GNUNET_MESH_Channel | |||
290 | /** | 290 | /** |
291 | * Channel options: reliability, etc. | 291 | * Channel options: reliability, etc. |
292 | */ | 292 | */ |
293 | enum GNUNET_MESH_ChannelOption options; | 293 | enum GNUNET_CADET_ChannelOption options; |
294 | 294 | ||
295 | /** | 295 | /** |
296 | * Are we allowed to send to the service? | 296 | * Are we allowed to send to the service? |
@@ -301,20 +301,20 @@ struct GNUNET_MESH_Channel | |||
301 | 301 | ||
302 | 302 | ||
303 | /** | 303 | /** |
304 | * Implementation state for mesh's message queue. | 304 | * Implementation state for cadet's message queue. |
305 | */ | 305 | */ |
306 | struct MeshMQState | 306 | struct CadetMQState |
307 | { | 307 | { |
308 | /** | 308 | /** |
309 | * The current transmit handle, or NULL | 309 | * The current transmit handle, or NULL |
310 | * if no transmit is active. | 310 | * if no transmit is active. |
311 | */ | 311 | */ |
312 | struct GNUNET_MESH_TransmitHandle *th; | 312 | struct GNUNET_CADET_TransmitHandle *th; |
313 | 313 | ||
314 | /** | 314 | /** |
315 | * Channel to send the data over. | 315 | * Channel to send the data over. |
316 | */ | 316 | */ |
317 | struct GNUNET_MESH_Channel *channel; | 317 | struct GNUNET_CADET_Channel *channel; |
318 | }; | 318 | }; |
319 | 319 | ||
320 | 320 | ||
@@ -327,7 +327,7 @@ struct MeshMQState | |||
327 | * "buf" will be NULL and "size" zero if the socket was closed for writing in | 327 | * "buf" will be NULL and "size" zero if the socket was closed for writing in |
328 | * the meantime. | 328 | * the meantime. |
329 | * | 329 | * |
330 | * @param cls closure, the mesh handle | 330 | * @param cls closure, the cadet handle |
331 | * @param size number of bytes available in buf | 331 | * @param size number of bytes available in buf |
332 | * @param buf where the callee should write the connect message | 332 | * @param buf where the callee should write the connect message |
333 | * @return number of bytes written to buf | 333 | * @return number of bytes written to buf |
@@ -346,10 +346,10 @@ send_callback (void *cls, size_t size, void *buf); | |||
346 | * @param th Transmission handle. | 346 | * @param th Transmission handle. |
347 | * | 347 | * |
348 | * @return GNUNET_YES if it is a payload packet, | 348 | * @return GNUNET_YES if it is a payload packet, |
349 | * GNUNET_NO if it is a mesh management packet. | 349 | * GNUNET_NO if it is a cadet management packet. |
350 | */ | 350 | */ |
351 | static int | 351 | static int |
352 | th_is_payload (struct GNUNET_MESH_TransmitHandle *th) | 352 | th_is_payload (struct GNUNET_CADET_TransmitHandle *th) |
353 | { | 353 | { |
354 | return (th->notify != NULL) ? GNUNET_YES : GNUNET_NO; | 354 | return (th->notify != NULL) ? GNUNET_YES : GNUNET_NO; |
355 | } | 355 | } |
@@ -358,16 +358,16 @@ th_is_payload (struct GNUNET_MESH_TransmitHandle *th) | |||
358 | /** | 358 | /** |
359 | * Check whether there is any message ready in the queue and find the size. | 359 | * Check whether there is any message ready in the queue and find the size. |
360 | * | 360 | * |
361 | * @param h Mesh handle. | 361 | * @param h Cadet handle. |
362 | * | 362 | * |
363 | * @return The size of the first ready message in the queue, | 363 | * @return The size of the first ready message in the queue, |
364 | * 0 if there is none. | 364 | * 0 if there is none. |
365 | */ | 365 | */ |
366 | static size_t | 366 | static size_t |
367 | message_ready_size (struct GNUNET_MESH_Handle *h) | 367 | message_ready_size (struct GNUNET_CADET_Handle *h) |
368 | { | 368 | { |
369 | struct GNUNET_MESH_TransmitHandle *th; | 369 | struct GNUNET_CADET_TransmitHandle *th; |
370 | struct GNUNET_MESH_Channel *ch; | 370 | struct GNUNET_CADET_Channel *ch; |
371 | 371 | ||
372 | for (th = h->th_head; NULL != th; th = th->next) | 372 | for (th = h->th_head; NULL != th; th = th->next) |
373 | { | 373 | { |
@@ -389,14 +389,14 @@ message_ready_size (struct GNUNET_MESH_Handle *h) | |||
389 | 389 | ||
390 | /** | 390 | /** |
391 | * Get the channel handler for the channel specified by id from the given handle | 391 | * Get the channel handler for the channel specified by id from the given handle |
392 | * @param h Mesh handle | 392 | * @param h Cadet handle |
393 | * @param chid ID of the wanted channel | 393 | * @param chid ID of the wanted channel |
394 | * @return handle to the required channel or NULL if not found | 394 | * @return handle to the required channel or NULL if not found |
395 | */ | 395 | */ |
396 | static struct GNUNET_MESH_Channel * | 396 | static struct GNUNET_CADET_Channel * |
397 | retrieve_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid) | 397 | retrieve_channel (struct GNUNET_CADET_Handle *h, CADET_ChannelNumber chid) |
398 | { | 398 | { |
399 | struct GNUNET_MESH_Channel *ch; | 399 | struct GNUNET_CADET_Channel *ch; |
400 | 400 | ||
401 | ch = h->channels_head; | 401 | ch = h->channels_head; |
402 | while (ch != NULL) | 402 | while (ch != NULL) |
@@ -410,29 +410,29 @@ retrieve_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid) | |||
410 | 410 | ||
411 | 411 | ||
412 | /** | 412 | /** |
413 | * Create a new channel and insert it in the channel list of the mesh handle | 413 | * Create a new channel and insert it in the channel list of the cadet handle |
414 | * | 414 | * |
415 | * @param h Mesh handle | 415 | * @param h Cadet handle |
416 | * @param chid Desired chid of the channel, 0 to assign one automatically. | 416 | * @param chid Desired chid of the channel, 0 to assign one automatically. |
417 | * | 417 | * |
418 | * @return Handle to the created channel. | 418 | * @return Handle to the created channel. |
419 | */ | 419 | */ |
420 | static struct GNUNET_MESH_Channel * | 420 | static struct GNUNET_CADET_Channel * |
421 | create_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid) | 421 | create_channel (struct GNUNET_CADET_Handle *h, CADET_ChannelNumber chid) |
422 | { | 422 | { |
423 | struct GNUNET_MESH_Channel *ch; | 423 | struct GNUNET_CADET_Channel *ch; |
424 | 424 | ||
425 | ch = GNUNET_new (struct GNUNET_MESH_Channel); | 425 | ch = GNUNET_new (struct GNUNET_CADET_Channel); |
426 | GNUNET_CONTAINER_DLL_insert (h->channels_head, h->channels_tail, ch); | 426 | GNUNET_CONTAINER_DLL_insert (h->channels_head, h->channels_tail, ch); |
427 | ch->mesh = h; | 427 | ch->cadet = h; |
428 | if (0 == chid) | 428 | if (0 == chid) |
429 | { | 429 | { |
430 | ch->chid = h->next_chid; | 430 | ch->chid = h->next_chid; |
431 | while (NULL != retrieve_channel (h, h->next_chid)) | 431 | while (NULL != retrieve_channel (h, h->next_chid)) |
432 | { | 432 | { |
433 | h->next_chid++; | 433 | h->next_chid++; |
434 | h->next_chid &= ~GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; | 434 | h->next_chid &= ~GNUNET_CADET_LOCAL_CHANNEL_ID_SERV; |
435 | h->next_chid |= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI; | 435 | h->next_chid |= GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; |
436 | } | 436 | } |
437 | } | 437 | } |
438 | else | 438 | else |
@@ -457,11 +457,11 @@ create_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid) | |||
457 | * @return Handle to the required channel or NULL if not found. | 457 | * @return Handle to the required channel or NULL if not found. |
458 | */ | 458 | */ |
459 | static void | 459 | static void |
460 | destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner) | 460 | destroy_channel (struct GNUNET_CADET_Channel *ch, int call_cleaner) |
461 | { | 461 | { |
462 | struct GNUNET_MESH_Handle *h; | 462 | struct GNUNET_CADET_Handle *h; |
463 | struct GNUNET_MESH_TransmitHandle *th; | 463 | struct GNUNET_CADET_TransmitHandle *th; |
464 | struct GNUNET_MESH_TransmitHandle *next; | 464 | struct GNUNET_CADET_TransmitHandle *next; |
465 | 465 | ||
466 | LOG (GNUNET_ERROR_TYPE_DEBUG, " destroy_channel %X\n", ch->chid); | 466 | LOG (GNUNET_ERROR_TYPE_DEBUG, " destroy_channel %X\n", ch->chid); |
467 | 467 | ||
@@ -470,7 +470,7 @@ destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner) | |||
470 | GNUNET_break (0); | 470 | GNUNET_break (0); |
471 | return; | 471 | return; |
472 | } | 472 | } |
473 | h = ch->mesh; | 473 | h = ch->cadet; |
474 | 474 | ||
475 | GNUNET_CONTAINER_DLL_remove (h->channels_head, h->channels_tail, ch); | 475 | GNUNET_CONTAINER_DLL_remove (h->channels_head, h->channels_tail, ch); |
476 | 476 | ||
@@ -501,7 +501,7 @@ destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner) | |||
501 | GNUNET_free (th); | 501 | GNUNET_free (th); |
502 | } | 502 | } |
503 | 503 | ||
504 | /* if there are no more pending requests with mesh service, cancel active request */ | 504 | /* if there are no more pending requests with cadet service, cancel active request */ |
505 | /* Note: this should be unnecessary... */ | 505 | /* Note: this should be unnecessary... */ |
506 | if ((0 == message_ready_size (h)) && (NULL != h->th)) | 506 | if ((0 == message_ready_size (h)) && (NULL != h->th)) |
507 | { | 507 | { |
@@ -525,20 +525,20 @@ destroy_channel (struct GNUNET_MESH_Channel *ch, int call_cleaner) | |||
525 | static void | 525 | static void |
526 | timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 526 | timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
527 | { | 527 | { |
528 | struct GNUNET_MESH_TransmitHandle *th = cls; | 528 | struct GNUNET_CADET_TransmitHandle *th = cls; |
529 | struct GNUNET_MESH_Handle *mesh; | 529 | struct GNUNET_CADET_Handle *cadet; |
530 | 530 | ||
531 | mesh = th->channel->mesh; | 531 | cadet = th->channel->cadet; |
532 | GNUNET_CONTAINER_DLL_remove (mesh->th_head, mesh->th_tail, th); | 532 | GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th); |
533 | th->channel->packet_size = 0; | 533 | th->channel->packet_size = 0; |
534 | if (GNUNET_YES == th_is_payload (th)) | 534 | if (GNUNET_YES == th_is_payload (th)) |
535 | th->notify (th->notify_cls, 0, NULL); | 535 | th->notify (th->notify_cls, 0, NULL); |
536 | GNUNET_free (th); | 536 | GNUNET_free (th); |
537 | if ((0 == message_ready_size (mesh)) && (NULL != mesh->th)) | 537 | if ((0 == message_ready_size (cadet)) && (NULL != cadet->th)) |
538 | { | 538 | { |
539 | /* nothing ready to transmit, no point in asking for transmission */ | 539 | /* nothing ready to transmit, no point in asking for transmission */ |
540 | GNUNET_CLIENT_notify_transmit_ready_cancel (mesh->th); | 540 | GNUNET_CLIENT_notify_transmit_ready_cancel (cadet->th); |
541 | mesh->th = NULL; | 541 | cadet->th = NULL; |
542 | } | 542 | } |
543 | } | 543 | } |
544 | 544 | ||
@@ -547,12 +547,12 @@ timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
547 | * Add a transmit handle to the transmission queue and set the | 547 | * Add a transmit handle to the transmission queue and set the |
548 | * timeout if needed. | 548 | * timeout if needed. |
549 | * | 549 | * |
550 | * @param h mesh handle with the queue head and tail | 550 | * @param h cadet handle with the queue head and tail |
551 | * @param th handle to the packet to be transmitted | 551 | * @param th handle to the packet to be transmitted |
552 | */ | 552 | */ |
553 | static void | 553 | static void |
554 | add_to_queue (struct GNUNET_MESH_Handle *h, | 554 | add_to_queue (struct GNUNET_CADET_Handle *h, |
555 | struct GNUNET_MESH_TransmitHandle *th) | 555 | struct GNUNET_CADET_TransmitHandle *th) |
556 | { | 556 | { |
557 | GNUNET_CONTAINER_DLL_insert_tail (h->th_head, h->th_tail, th); | 557 | GNUNET_CONTAINER_DLL_insert_tail (h->th_head, h->th_tail, th); |
558 | if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == th->timeout.abs_value_us) | 558 | if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == th->timeout.abs_value_us) |
@@ -568,14 +568,14 @@ add_to_queue (struct GNUNET_MESH_Handle *h, | |||
568 | * Takes care of creating a new queue element, copying the message and | 568 | * Takes care of creating a new queue element, copying the message and |
569 | * calling the tmt_rdy function if necessary. | 569 | * calling the tmt_rdy function if necessary. |
570 | * | 570 | * |
571 | * @param h mesh handle | 571 | * @param h cadet handle |
572 | * @param msg message to transmit | 572 | * @param msg message to transmit |
573 | * @param channel channel this send is related to (NULL if N/A) | 573 | * @param channel channel this send is related to (NULL if N/A) |
574 | */ | 574 | */ |
575 | static void | 575 | static void |
576 | send_packet (struct GNUNET_MESH_Handle *h, | 576 | send_packet (struct GNUNET_CADET_Handle *h, |
577 | const struct GNUNET_MessageHeader *msg, | 577 | const struct GNUNET_MessageHeader *msg, |
578 | struct GNUNET_MESH_Channel *channel); | 578 | struct GNUNET_CADET_Channel *channel); |
579 | 579 | ||
580 | 580 | ||
581 | /** | 581 | /** |
@@ -584,16 +584,16 @@ send_packet (struct GNUNET_MESH_Handle *h, | |||
584 | * @param ch Channel on which to send the ACK. | 584 | * @param ch Channel on which to send the ACK. |
585 | */ | 585 | */ |
586 | static void | 586 | static void |
587 | send_ack (struct GNUNET_MESH_Channel *ch) | 587 | send_ack (struct GNUNET_CADET_Channel *ch) |
588 | { | 588 | { |
589 | struct GNUNET_MESH_LocalAck msg; | 589 | struct GNUNET_CADET_LocalAck msg; |
590 | 590 | ||
591 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending ACK on channel %X\n", ch->chid); | 591 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Sending ACK on channel %X\n", ch->chid); |
592 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK); | 592 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); |
593 | msg.header.size = htons (sizeof (msg)); | 593 | msg.header.size = htons (sizeof (msg)); |
594 | msg.channel_id = htonl (ch->chid); | 594 | msg.channel_id = htonl (ch->chid); |
595 | 595 | ||
596 | send_packet (ch->mesh, &msg.header, ch); | 596 | send_packet (ch->cadet, &msg.header, ch); |
597 | return; | 597 | return; |
598 | } | 598 | } |
599 | 599 | ||
@@ -602,7 +602,7 @@ send_ack (struct GNUNET_MESH_Channel *ch) | |||
602 | /** | 602 | /** |
603 | * Reconnect callback: tries to reconnect again after a failer previous | 603 | * Reconnect callback: tries to reconnect again after a failer previous |
604 | * reconnecttion | 604 | * reconnecttion |
605 | * @param cls closure (mesh handle) | 605 | * @param cls closure (cadet handle) |
606 | * @param tc task context | 606 | * @param tc task context |
607 | */ | 607 | */ |
608 | static void | 608 | static void |
@@ -613,25 +613,25 @@ reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
613 | * Send a connect packet to the service with the applications and types | 613 | * Send a connect packet to the service with the applications and types |
614 | * requested by the user. | 614 | * requested by the user. |
615 | * | 615 | * |
616 | * @param h The mesh handle. | 616 | * @param h The cadet handle. |
617 | * | 617 | * |
618 | */ | 618 | */ |
619 | static void | 619 | static void |
620 | send_connect (struct GNUNET_MESH_Handle *h) | 620 | send_connect (struct GNUNET_CADET_Handle *h) |
621 | { | 621 | { |
622 | size_t size; | 622 | size_t size; |
623 | 623 | ||
624 | size = sizeof (struct GNUNET_MESH_ClientConnect); | 624 | size = sizeof (struct GNUNET_CADET_ClientConnect); |
625 | size += h->n_ports * sizeof (uint32_t); | 625 | size += h->n_ports * sizeof (uint32_t); |
626 | { | 626 | { |
627 | char buf[size] GNUNET_ALIGN; | 627 | char buf[size] GNUNET_ALIGN; |
628 | struct GNUNET_MESH_ClientConnect *msg; | 628 | struct GNUNET_CADET_ClientConnect *msg; |
629 | uint32_t *ports; | 629 | uint32_t *ports; |
630 | uint16_t i; | 630 | uint16_t i; |
631 | 631 | ||
632 | /* build connection packet */ | 632 | /* build connection packet */ |
633 | msg = (struct GNUNET_MESH_ClientConnect *) buf; | 633 | msg = (struct GNUNET_CADET_ClientConnect *) buf; |
634 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT); | 634 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT); |
635 | msg->header.size = htons (size); | 635 | msg->header.size = htons (size); |
636 | ports = (uint32_t *) &msg[1]; | 636 | ports = (uint32_t *) &msg[1]; |
637 | for (i = 0; i < h->n_ports; i++) | 637 | for (i = 0; i < h->n_ports; i++) |
@@ -652,12 +652,12 @@ send_connect (struct GNUNET_MESH_Handle *h) | |||
652 | * Reconnect to the service, retransmit all infomation to try to restore the | 652 | * Reconnect to the service, retransmit all infomation to try to restore the |
653 | * original state. | 653 | * original state. |
654 | * | 654 | * |
655 | * @param h handle to the mesh | 655 | * @param h handle to the cadet |
656 | * | 656 | * |
657 | * @return GNUNET_YES in case of sucess, GNUNET_NO otherwise (service down...) | 657 | * @return GNUNET_YES in case of sucess, GNUNET_NO otherwise (service down...) |
658 | */ | 658 | */ |
659 | static int | 659 | static int |
660 | do_reconnect (struct GNUNET_MESH_Handle *h) | 660 | do_reconnect (struct GNUNET_CADET_Handle *h) |
661 | { | 661 | { |
662 | LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n"); | 662 | LOG (GNUNET_ERROR_TYPE_DEBUG, "*****************************\n"); |
663 | LOG (GNUNET_ERROR_TYPE_DEBUG, "******* RECONNECT *******\n"); | 663 | LOG (GNUNET_ERROR_TYPE_DEBUG, "******* RECONNECT *******\n"); |
@@ -677,7 +677,7 @@ do_reconnect (struct GNUNET_MESH_Handle *h) | |||
677 | } | 677 | } |
678 | 678 | ||
679 | /* connect again */ | 679 | /* connect again */ |
680 | h->client = GNUNET_CLIENT_connect ("mesh", h->cfg); | 680 | h->client = GNUNET_CLIENT_connect ("cadet", h->cfg); |
681 | if (h->client == NULL) | 681 | if (h->client == NULL) |
682 | { | 682 | { |
683 | h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, | 683 | h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, |
@@ -703,13 +703,13 @@ do_reconnect (struct GNUNET_MESH_Handle *h) | |||
703 | /** | 703 | /** |
704 | * Reconnect callback: tries to reconnect again after a failer previous | 704 | * Reconnect callback: tries to reconnect again after a failer previous |
705 | * reconnecttion | 705 | * reconnecttion |
706 | * @param cls closure (mesh handle) | 706 | * @param cls closure (cadet handle) |
707 | * @param tc task context | 707 | * @param tc task context |
708 | */ | 708 | */ |
709 | static void | 709 | static void |
710 | reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 710 | reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
711 | { | 711 | { |
712 | struct GNUNET_MESH_Handle *h = cls; | 712 | struct GNUNET_CADET_Handle *h = cls; |
713 | 713 | ||
714 | h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 714 | h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
715 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 715 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
@@ -722,15 +722,15 @@ reconnect_cbk (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
722 | * Reconnect to the service, retransmit all infomation to try to restore the | 722 | * Reconnect to the service, retransmit all infomation to try to restore the |
723 | * original state. | 723 | * original state. |
724 | * | 724 | * |
725 | * @param h handle to the mesh | 725 | * @param h handle to the cadet |
726 | * | 726 | * |
727 | * @return GNUNET_YES in case of sucess, GNUNET_NO otherwise (service down...) | 727 | * @return GNUNET_YES in case of sucess, GNUNET_NO otherwise (service down...) |
728 | */ | 728 | */ |
729 | static void | 729 | static void |
730 | reconnect (struct GNUNET_MESH_Handle *h) | 730 | reconnect (struct GNUNET_CADET_Handle *h) |
731 | { | 731 | { |
732 | struct GNUNET_MESH_Channel *ch; | 732 | struct GNUNET_CADET_Channel *ch; |
733 | struct GNUNET_MESH_Channel *next; | 733 | struct GNUNET_CADET_Channel *next; |
734 | 734 | ||
735 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 735 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
736 | "Requested RECONNECT, destroying all channels\n"); | 736 | "Requested RECONNECT, destroying all channels\n"); |
@@ -753,21 +753,21 @@ reconnect (struct GNUNET_MESH_Handle *h) | |||
753 | /** | 753 | /** |
754 | * Process the new channel notification and add it to the channels in the handle | 754 | * Process the new channel notification and add it to the channels in the handle |
755 | * | 755 | * |
756 | * @param h The mesh handle | 756 | * @param h The cadet handle |
757 | * @param msg A message with the details of the new incoming channel | 757 | * @param msg A message with the details of the new incoming channel |
758 | */ | 758 | */ |
759 | static void | 759 | static void |
760 | process_channel_created (struct GNUNET_MESH_Handle *h, | 760 | process_channel_created (struct GNUNET_CADET_Handle *h, |
761 | const struct GNUNET_MESH_ChannelMessage *msg) | 761 | const struct GNUNET_CADET_ChannelMessage *msg) |
762 | { | 762 | { |
763 | struct GNUNET_MESH_Channel *ch; | 763 | struct GNUNET_CADET_Channel *ch; |
764 | MESH_ChannelNumber chid; | 764 | CADET_ChannelNumber chid; |
765 | uint32_t port; | 765 | uint32_t port; |
766 | 766 | ||
767 | chid = ntohl (msg->channel_id); | 767 | chid = ntohl (msg->channel_id); |
768 | port = ntohl (msg->port); | 768 | port = ntohl (msg->port); |
769 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating incoming channel %X:%u\n", chid, port); | 769 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating incoming channel %X:%u\n", chid, port); |
770 | if (chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) | 770 | if (chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV) |
771 | { | 771 | { |
772 | GNUNET_break (0); | 772 | GNUNET_break (0); |
773 | return; | 773 | return; |
@@ -779,7 +779,7 @@ process_channel_created (struct GNUNET_MESH_Handle *h, | |||
779 | ch = create_channel (h, chid); | 779 | ch = create_channel (h, chid); |
780 | ch->allow_send = GNUNET_NO; | 780 | ch->allow_send = GNUNET_NO; |
781 | ch->peer = GNUNET_PEER_intern (&msg->peer); | 781 | ch->peer = GNUNET_PEER_intern (&msg->peer); |
782 | ch->mesh = h; | 782 | ch->cadet = h; |
783 | ch->chid = chid; | 783 | ch->chid = chid; |
784 | ch->port = port; | 784 | ch->port = port; |
785 | ch->options = ntohl (msg->opt); | 785 | ch->options = ntohl (msg->opt); |
@@ -792,12 +792,12 @@ process_channel_created (struct GNUNET_MESH_Handle *h, | |||
792 | } | 792 | } |
793 | else | 793 | else |
794 | { | 794 | { |
795 | struct GNUNET_MESH_ChannelMessage d_msg; | 795 | struct GNUNET_CADET_ChannelMessage d_msg; |
796 | 796 | ||
797 | LOG (GNUNET_ERROR_TYPE_DEBUG, "No handler for incoming channels\n"); | 797 | LOG (GNUNET_ERROR_TYPE_DEBUG, "No handler for incoming channels\n"); |
798 | 798 | ||
799 | d_msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY); | 799 | d_msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); |
800 | d_msg.header.size = htons (sizeof (struct GNUNET_MESH_ChannelMessage)); | 800 | d_msg.header.size = htons (sizeof (struct GNUNET_CADET_ChannelMessage)); |
801 | d_msg.channel_id = msg->channel_id; | 801 | d_msg.channel_id = msg->channel_id; |
802 | memset (&d_msg.peer, 0, sizeof (struct GNUNET_PeerIdentity)); | 802 | memset (&d_msg.peer, 0, sizeof (struct GNUNET_PeerIdentity)); |
803 | d_msg.port = 0; | 803 | d_msg.port = 0; |
@@ -812,15 +812,15 @@ process_channel_created (struct GNUNET_MESH_Handle *h, | |||
812 | /** | 812 | /** |
813 | * Process the channel destroy notification and free associated resources | 813 | * Process the channel destroy notification and free associated resources |
814 | * | 814 | * |
815 | * @param h The mesh handle | 815 | * @param h The cadet handle |
816 | * @param msg A message with the details of the channel being destroyed | 816 | * @param msg A message with the details of the channel being destroyed |
817 | */ | 817 | */ |
818 | static void | 818 | static void |
819 | process_channel_destroy (struct GNUNET_MESH_Handle *h, | 819 | process_channel_destroy (struct GNUNET_CADET_Handle *h, |
820 | const struct GNUNET_MESH_ChannelMessage *msg) | 820 | const struct GNUNET_CADET_ChannelMessage *msg) |
821 | { | 821 | { |
822 | struct GNUNET_MESH_Channel *ch; | 822 | struct GNUNET_CADET_Channel *ch; |
823 | MESH_ChannelNumber chid; | 823 | CADET_ChannelNumber chid; |
824 | 824 | ||
825 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel Destroy received from service\n"); | 825 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel Destroy received from service\n"); |
826 | chid = ntohl (msg->channel_id); | 826 | chid = ntohl (msg->channel_id); |
@@ -839,23 +839,23 @@ process_channel_destroy (struct GNUNET_MESH_Handle *h, | |||
839 | /** | 839 | /** |
840 | * Process the incoming data packets, call appropriate handlers. | 840 | * Process the incoming data packets, call appropriate handlers. |
841 | * | 841 | * |
842 | * @param h The mesh handle | 842 | * @param h The cadet handle |
843 | * @param message A message encapsulating the data | 843 | * @param message A message encapsulating the data |
844 | */ | 844 | */ |
845 | static void | 845 | static void |
846 | process_incoming_data (struct GNUNET_MESH_Handle *h, | 846 | process_incoming_data (struct GNUNET_CADET_Handle *h, |
847 | const struct GNUNET_MessageHeader *message) | 847 | const struct GNUNET_MessageHeader *message) |
848 | { | 848 | { |
849 | const struct GNUNET_MessageHeader *payload; | 849 | const struct GNUNET_MessageHeader *payload; |
850 | const struct GNUNET_MESH_MessageHandler *handler; | 850 | const struct GNUNET_CADET_MessageHandler *handler; |
851 | struct GNUNET_MESH_LocalData *dmsg; | 851 | struct GNUNET_CADET_LocalData *dmsg; |
852 | struct GNUNET_MESH_Channel *ch; | 852 | struct GNUNET_CADET_Channel *ch; |
853 | size_t size; | 853 | size_t size; |
854 | unsigned int i; | 854 | unsigned int i; |
855 | uint16_t type; | 855 | uint16_t type; |
856 | 856 | ||
857 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a data message!\n"); | 857 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a data message!\n"); |
858 | dmsg = (struct GNUNET_MESH_LocalData *) message; | 858 | dmsg = (struct GNUNET_CADET_LocalData *) message; |
859 | ch = retrieve_channel (h, ntohl (dmsg->id)); | 859 | ch = retrieve_channel (h, ntohl (dmsg->id)); |
860 | if (NULL == ch) | 860 | if (NULL == ch) |
861 | { | 861 | { |
@@ -865,7 +865,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h, | |||
865 | 865 | ||
866 | payload = (struct GNUNET_MessageHeader *) &dmsg[1]; | 866 | payload = (struct GNUNET_MessageHeader *) &dmsg[1]; |
867 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n", | 867 | LOG (GNUNET_ERROR_TYPE_DEBUG, " %s data on channel %s [%X]\n", |
868 | GM_f2s (ch->chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV), | 868 | GM_f2s (ch->chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV), |
869 | GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), ntohl (dmsg->id)); | 869 | GNUNET_i2s (GNUNET_PEER_resolve2 (ch->peer)), ntohl (dmsg->id)); |
870 | 870 | ||
871 | size = ntohs (message->size); | 871 | size = ntohs (message->size); |
@@ -891,7 +891,7 @@ process_incoming_data (struct GNUNET_MESH_Handle *h, | |||
891 | handler->callback (h->cls, ch, &ch->ctx, payload)) | 891 | handler->callback (h->cls, ch, &ch->ctx, payload)) |
892 | { | 892 | { |
893 | LOG (GNUNET_ERROR_TYPE_DEBUG, "callback caused disconnection\n"); | 893 | LOG (GNUNET_ERROR_TYPE_DEBUG, "callback caused disconnection\n"); |
894 | GNUNET_MESH_channel_destroy (ch); | 894 | GNUNET_CADET_channel_destroy (ch); |
895 | return; | 895 | return; |
896 | } | 896 | } |
897 | else | 897 | else |
@@ -909,19 +909,19 @@ process_incoming_data (struct GNUNET_MESH_Handle *h, | |||
909 | * Process a local ACK message, enabling the client to send | 909 | * Process a local ACK message, enabling the client to send |
910 | * more data to the service. | 910 | * more data to the service. |
911 | * | 911 | * |
912 | * @param h Mesh handle. | 912 | * @param h Cadet handle. |
913 | * @param message Message itself. | 913 | * @param message Message itself. |
914 | */ | 914 | */ |
915 | static void | 915 | static void |
916 | process_ack (struct GNUNET_MESH_Handle *h, | 916 | process_ack (struct GNUNET_CADET_Handle *h, |
917 | const struct GNUNET_MessageHeader *message) | 917 | const struct GNUNET_MessageHeader *message) |
918 | { | 918 | { |
919 | struct GNUNET_MESH_LocalAck *msg; | 919 | struct GNUNET_CADET_LocalAck *msg; |
920 | struct GNUNET_MESH_Channel *ch; | 920 | struct GNUNET_CADET_Channel *ch; |
921 | MESH_ChannelNumber chid; | 921 | CADET_ChannelNumber chid; |
922 | 922 | ||
923 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK!\n"); | 923 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an ACK!\n"); |
924 | msg = (struct GNUNET_MESH_LocalAck *) message; | 924 | msg = (struct GNUNET_CADET_LocalAck *) message; |
925 | chid = ntohl (msg->channel_id); | 925 | chid = ntohl (msg->channel_id); |
926 | ch = retrieve_channel (h, chid); | 926 | ch = retrieve_channel (h, chid); |
927 | if (NULL == ch) | 927 | if (NULL == ch) |
@@ -944,14 +944,14 @@ process_ack (struct GNUNET_MESH_Handle *h, | |||
944 | /* | 944 | /* |
945 | * Process a local reply about info on all channels, pass info to the user. | 945 | * Process a local reply about info on all channels, pass info to the user. |
946 | * | 946 | * |
947 | * @param h Mesh handle. | 947 | * @param h Cadet handle. |
948 | * @param message Message itself. | 948 | * @param message Message itself. |
949 | */ | 949 | */ |
950 | // static void | 950 | // static void |
951 | // process_get_channels (struct GNUNET_MESH_Handle *h, | 951 | // process_get_channels (struct GNUNET_CADET_Handle *h, |
952 | // const struct GNUNET_MessageHeader *message) | 952 | // const struct GNUNET_MessageHeader *message) |
953 | // { | 953 | // { |
954 | // struct GNUNET_MESH_LocalInfo *msg; | 954 | // struct GNUNET_CADET_LocalInfo *msg; |
955 | // | 955 | // |
956 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Get Channels messasge received\n"); | 956 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Get Channels messasge received\n"); |
957 | // | 957 | // |
@@ -961,16 +961,16 @@ process_ack (struct GNUNET_MESH_Handle *h, | |||
961 | // return; | 961 | // return; |
962 | // } | 962 | // } |
963 | // | 963 | // |
964 | // msg = (struct GNUNET_MESH_LocalInfo *) message; | 964 | // msg = (struct GNUNET_CADET_LocalInfo *) message; |
965 | // if (ntohs (message->size) != | 965 | // if (ntohs (message->size) != |
966 | // (sizeof (struct GNUNET_MESH_LocalInfo) + | 966 | // (sizeof (struct GNUNET_CADET_LocalInfo) + |
967 | // sizeof (struct GNUNET_PeerIdentity))) | 967 | // sizeof (struct GNUNET_PeerIdentity))) |
968 | // { | 968 | // { |
969 | // GNUNET_break_op (0); | 969 | // GNUNET_break_op (0); |
970 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 970 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
971 | // "Get channels message: size %hu - expected %u\n", | 971 | // "Get channels message: size %hu - expected %u\n", |
972 | // ntohs (message->size), | 972 | // ntohs (message->size), |
973 | // sizeof (struct GNUNET_MESH_LocalInfo)); | 973 | // sizeof (struct GNUNET_CADET_LocalInfo)); |
974 | // return; | 974 | // return; |
975 | // } | 975 | // } |
976 | // h->channels_cb (h->channels_cls, | 976 | // h->channels_cb (h->channels_cls, |
@@ -984,14 +984,14 @@ process_ack (struct GNUNET_MESH_Handle *h, | |||
984 | /* | 984 | /* |
985 | * Process a local monitor_channel reply, pass info to the user. | 985 | * Process a local monitor_channel reply, pass info to the user. |
986 | * | 986 | * |
987 | * @param h Mesh handle. | 987 | * @param h Cadet handle. |
988 | * @param message Message itself. | 988 | * @param message Message itself. |
989 | */ | 989 | */ |
990 | // static void | 990 | // static void |
991 | // process_show_channel (struct GNUNET_MESH_Handle *h, | 991 | // process_show_channel (struct GNUNET_CADET_Handle *h, |
992 | // const struct GNUNET_MessageHeader *message) | 992 | // const struct GNUNET_MessageHeader *message) |
993 | // { | 993 | // { |
994 | // struct GNUNET_MESH_LocalInfo *msg; | 994 | // struct GNUNET_CADET_LocalInfo *msg; |
995 | // size_t esize; | 995 | // size_t esize; |
996 | // | 996 | // |
997 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Show Channel messasge received\n"); | 997 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Show Channel messasge received\n"); |
@@ -1003,8 +1003,8 @@ process_ack (struct GNUNET_MESH_Handle *h, | |||
1003 | // } | 1003 | // } |
1004 | // | 1004 | // |
1005 | // /* Verify message sanity */ | 1005 | // /* Verify message sanity */ |
1006 | // msg = (struct GNUNET_MESH_LocalInfo *) message; | 1006 | // msg = (struct GNUNET_CADET_LocalInfo *) message; |
1007 | // esize = sizeof (struct GNUNET_MESH_LocalInfo); | 1007 | // esize = sizeof (struct GNUNET_CADET_LocalInfo); |
1008 | // if (ntohs (message->size) != esize) | 1008 | // if (ntohs (message->size) != esize) |
1009 | // { | 1009 | // { |
1010 | // GNUNET_break_op (0); | 1010 | // GNUNET_break_op (0); |
@@ -1030,14 +1030,14 @@ process_ack (struct GNUNET_MESH_Handle *h, | |||
1030 | /** | 1030 | /** |
1031 | * Process a local reply about info on all tunnels, pass info to the user. | 1031 | * Process a local reply about info on all tunnels, pass info to the user. |
1032 | * | 1032 | * |
1033 | * @param h Mesh handle. | 1033 | * @param h Cadet handle. |
1034 | * @param message Message itself. | 1034 | * @param message Message itself. |
1035 | */ | 1035 | */ |
1036 | static void | 1036 | static void |
1037 | process_get_peers (struct GNUNET_MESH_Handle *h, | 1037 | process_get_peers (struct GNUNET_CADET_Handle *h, |
1038 | const struct GNUNET_MessageHeader *message) | 1038 | const struct GNUNET_MessageHeader *message) |
1039 | { | 1039 | { |
1040 | struct GNUNET_MESH_LocalInfoPeer *msg; | 1040 | struct GNUNET_CADET_LocalInfoPeer *msg; |
1041 | uint16_t size; | 1041 | uint16_t size; |
1042 | 1042 | ||
1043 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Peer messasge received\n"); | 1043 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Peer messasge received\n"); |
@@ -1049,7 +1049,7 @@ process_get_peers (struct GNUNET_MESH_Handle *h, | |||
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | size = ntohs (message->size); | 1051 | size = ntohs (message->size); |
1052 | if (sizeof (struct GNUNET_MESH_LocalInfoPeer) > size) | 1052 | if (sizeof (struct GNUNET_CADET_LocalInfoPeer) > size) |
1053 | { | 1053 | { |
1054 | h->info_cb.peers_cb (h->info_cls, NULL, -1, 0, 0); | 1054 | h->info_cb.peers_cb (h->info_cls, NULL, -1, 0, 0); |
1055 | h->info_cb.peers_cb = NULL; | 1055 | h->info_cb.peers_cb = NULL; |
@@ -1057,7 +1057,7 @@ process_get_peers (struct GNUNET_MESH_Handle *h, | |||
1057 | return; | 1057 | return; |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | msg = (struct GNUNET_MESH_LocalInfoPeer *) message; | 1060 | msg = (struct GNUNET_CADET_LocalInfoPeer *) message; |
1061 | h->info_cb.peers_cb (h->info_cls, &msg->destination, | 1061 | h->info_cb.peers_cb (h->info_cls, &msg->destination, |
1062 | (int) ntohs (msg->tunnel), | 1062 | (int) ntohs (msg->tunnel), |
1063 | (unsigned int ) ntohs (msg->paths), | 1063 | (unsigned int ) ntohs (msg->paths), |
@@ -1068,20 +1068,20 @@ process_get_peers (struct GNUNET_MESH_Handle *h, | |||
1068 | /** | 1068 | /** |
1069 | * Process a local peer info reply, pass info to the user. | 1069 | * Process a local peer info reply, pass info to the user. |
1070 | * | 1070 | * |
1071 | * @param h Mesh handle. | 1071 | * @param h Cadet handle. |
1072 | * @param message Message itself. | 1072 | * @param message Message itself. |
1073 | */ | 1073 | */ |
1074 | static void | 1074 | static void |
1075 | process_get_peer (struct GNUNET_MESH_Handle *h, | 1075 | process_get_peer (struct GNUNET_CADET_Handle *h, |
1076 | const struct GNUNET_MessageHeader *message) | 1076 | const struct GNUNET_MessageHeader *message) |
1077 | { | 1077 | { |
1078 | struct GNUNET_MESH_LocalInfoTunnel *msg; | 1078 | struct GNUNET_CADET_LocalInfoTunnel *msg; |
1079 | size_t esize; | 1079 | size_t esize; |
1080 | size_t msize; | 1080 | size_t msize; |
1081 | unsigned int ch_n; | 1081 | unsigned int ch_n; |
1082 | unsigned int c_n; | 1082 | unsigned int c_n; |
1083 | struct GNUNET_MESH_Hash *conns; | 1083 | struct GNUNET_CADET_Hash *conns; |
1084 | MESH_ChannelNumber *chns; | 1084 | CADET_ChannelNumber *chns; |
1085 | 1085 | ||
1086 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n"); | 1086 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n"); |
1087 | if (NULL == h->info_cb.tunnel_cb) | 1087 | if (NULL == h->info_cb.tunnel_cb) |
@@ -1091,9 +1091,9 @@ process_get_peer (struct GNUNET_MESH_Handle *h, | |||
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | /* Verify message sanity */ | 1093 | /* Verify message sanity */ |
1094 | msg = (struct GNUNET_MESH_LocalInfoTunnel *) message; | 1094 | msg = (struct GNUNET_CADET_LocalInfoTunnel *) message; |
1095 | msize = ntohs (message->size); | 1095 | msize = ntohs (message->size); |
1096 | esize = sizeof (struct GNUNET_MESH_LocalInfoTunnel); | 1096 | esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel); |
1097 | if (esize > msize) | 1097 | if (esize > msize) |
1098 | { | 1098 | { |
1099 | GNUNET_break_op (0); | 1099 | GNUNET_break_op (0); |
@@ -1102,23 +1102,23 @@ process_get_peer (struct GNUNET_MESH_Handle *h, | |||
1102 | } | 1102 | } |
1103 | ch_n = ntohl (msg->channels); | 1103 | ch_n = ntohl (msg->channels); |
1104 | c_n = ntohl (msg->connections); | 1104 | c_n = ntohl (msg->connections); |
1105 | esize += ch_n * sizeof (MESH_ChannelNumber); | 1105 | esize += ch_n * sizeof (CADET_ChannelNumber); |
1106 | esize += c_n * sizeof (struct GNUNET_MESH_Hash); | 1106 | esize += c_n * sizeof (struct GNUNET_CADET_Hash); |
1107 | if (msize != esize) | 1107 | if (msize != esize) |
1108 | { | 1108 | { |
1109 | GNUNET_break_op (0); | 1109 | GNUNET_break_op (0); |
1110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m:%u, e: %u (%u ch, %u conn)\n", | 1110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m:%u, e: %u (%u ch, %u conn)\n", |
1111 | msize, esize, ch_n, c_n); | 1111 | msize, esize, ch_n, c_n); |
1112 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u (%u ch, %u conn)\n", | 1112 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u (%u ch, %u conn)\n", |
1113 | sizeof (struct GNUNET_MESH_LocalInfoTunnel), | 1113 | sizeof (struct GNUNET_CADET_LocalInfoTunnel), |
1114 | sizeof (MESH_ChannelNumber), sizeof (struct GNUNET_HashCode)); | 1114 | sizeof (CADET_ChannelNumber), sizeof (struct GNUNET_HashCode)); |
1115 | h->info_cb.tunnel_cb (h->info_cls, NULL, 0, 0, NULL, NULL, 0, 0); | 1115 | h->info_cb.tunnel_cb (h->info_cls, NULL, 0, 0, NULL, NULL, 0, 0); |
1116 | goto clean_cls; | 1116 | goto clean_cls; |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | /* Call Callback with tunnel info. */ | 1119 | /* Call Callback with tunnel info. */ |
1120 | conns = (struct GNUNET_MESH_Hash *) &msg[1]; | 1120 | conns = (struct GNUNET_CADET_Hash *) &msg[1]; |
1121 | chns = (MESH_ChannelNumber *) &conns[c_n]; | 1121 | chns = (CADET_ChannelNumber *) &conns[c_n]; |
1122 | h->info_cb.tunnel_cb (h->info_cls, &msg->destination, | 1122 | h->info_cb.tunnel_cb (h->info_cls, &msg->destination, |
1123 | ch_n, c_n, chns, conns, | 1123 | ch_n, c_n, chns, conns, |
1124 | ntohs (msg->estate), ntohs (msg->cstate)); | 1124 | ntohs (msg->estate), ntohs (msg->cstate)); |
@@ -1132,14 +1132,14 @@ process_get_peer (struct GNUNET_MESH_Handle *h, | |||
1132 | /** | 1132 | /** |
1133 | * Process a local reply about info on all tunnels, pass info to the user. | 1133 | * Process a local reply about info on all tunnels, pass info to the user. |
1134 | * | 1134 | * |
1135 | * @param h Mesh handle. | 1135 | * @param h Cadet handle. |
1136 | * @param message Message itself. | 1136 | * @param message Message itself. |
1137 | */ | 1137 | */ |
1138 | static void | 1138 | static void |
1139 | process_get_tunnels (struct GNUNET_MESH_Handle *h, | 1139 | process_get_tunnels (struct GNUNET_CADET_Handle *h, |
1140 | const struct GNUNET_MessageHeader *message) | 1140 | const struct GNUNET_MessageHeader *message) |
1141 | { | 1141 | { |
1142 | struct GNUNET_MESH_LocalInfoTunnel *msg; | 1142 | struct GNUNET_CADET_LocalInfoTunnel *msg; |
1143 | uint16_t size; | 1143 | uint16_t size; |
1144 | 1144 | ||
1145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnels messasge received\n"); | 1145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnels messasge received\n"); |
@@ -1151,7 +1151,7 @@ process_get_tunnels (struct GNUNET_MESH_Handle *h, | |||
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | size = ntohs (message->size); | 1153 | size = ntohs (message->size); |
1154 | if (sizeof (struct GNUNET_MESH_LocalInfoTunnel) > size) | 1154 | if (sizeof (struct GNUNET_CADET_LocalInfoTunnel) > size) |
1155 | { | 1155 | { |
1156 | h->info_cb.tunnels_cb (h->info_cls, NULL, 0, 0, 0, 0); | 1156 | h->info_cb.tunnels_cb (h->info_cls, NULL, 0, 0, 0, 0); |
1157 | h->info_cb.tunnels_cb = NULL; | 1157 | h->info_cb.tunnels_cb = NULL; |
@@ -1159,7 +1159,7 @@ process_get_tunnels (struct GNUNET_MESH_Handle *h, | |||
1159 | return; | 1159 | return; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | msg = (struct GNUNET_MESH_LocalInfoTunnel *) message; | 1162 | msg = (struct GNUNET_CADET_LocalInfoTunnel *) message; |
1163 | h->info_cb.tunnels_cb (h->info_cls, &msg->destination, | 1163 | h->info_cb.tunnels_cb (h->info_cls, &msg->destination, |
1164 | ntohl (msg->channels), ntohl (msg->connections), | 1164 | ntohl (msg->channels), ntohl (msg->connections), |
1165 | ntohs (msg->estate), ntohs (msg->cstate)); | 1165 | ntohs (msg->estate), ntohs (msg->cstate)); |
@@ -1170,20 +1170,20 @@ process_get_tunnels (struct GNUNET_MESH_Handle *h, | |||
1170 | /** | 1170 | /** |
1171 | * Process a local tunnel info reply, pass info to the user. | 1171 | * Process a local tunnel info reply, pass info to the user. |
1172 | * | 1172 | * |
1173 | * @param h Mesh handle. | 1173 | * @param h Cadet handle. |
1174 | * @param message Message itself. | 1174 | * @param message Message itself. |
1175 | */ | 1175 | */ |
1176 | static void | 1176 | static void |
1177 | process_get_tunnel (struct GNUNET_MESH_Handle *h, | 1177 | process_get_tunnel (struct GNUNET_CADET_Handle *h, |
1178 | const struct GNUNET_MessageHeader *message) | 1178 | const struct GNUNET_MessageHeader *message) |
1179 | { | 1179 | { |
1180 | struct GNUNET_MESH_LocalInfoTunnel *msg; | 1180 | struct GNUNET_CADET_LocalInfoTunnel *msg; |
1181 | size_t esize; | 1181 | size_t esize; |
1182 | size_t msize; | 1182 | size_t msize; |
1183 | unsigned int ch_n; | 1183 | unsigned int ch_n; |
1184 | unsigned int c_n; | 1184 | unsigned int c_n; |
1185 | struct GNUNET_MESH_Hash *conns; | 1185 | struct GNUNET_CADET_Hash *conns; |
1186 | MESH_ChannelNumber *chns; | 1186 | CADET_ChannelNumber *chns; |
1187 | 1187 | ||
1188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n"); | 1188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Get Tunnel messasge received\n"); |
1189 | if (NULL == h->info_cb.tunnel_cb) | 1189 | if (NULL == h->info_cb.tunnel_cb) |
@@ -1193,9 +1193,9 @@ process_get_tunnel (struct GNUNET_MESH_Handle *h, | |||
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | /* Verify message sanity */ | 1195 | /* Verify message sanity */ |
1196 | msg = (struct GNUNET_MESH_LocalInfoTunnel *) message; | 1196 | msg = (struct GNUNET_CADET_LocalInfoTunnel *) message; |
1197 | msize = ntohs (message->size); | 1197 | msize = ntohs (message->size); |
1198 | esize = sizeof (struct GNUNET_MESH_LocalInfoTunnel); | 1198 | esize = sizeof (struct GNUNET_CADET_LocalInfoTunnel); |
1199 | if (esize > msize) | 1199 | if (esize > msize) |
1200 | { | 1200 | { |
1201 | GNUNET_break_op (0); | 1201 | GNUNET_break_op (0); |
@@ -1204,23 +1204,23 @@ process_get_tunnel (struct GNUNET_MESH_Handle *h, | |||
1204 | } | 1204 | } |
1205 | ch_n = ntohl (msg->channels); | 1205 | ch_n = ntohl (msg->channels); |
1206 | c_n = ntohl (msg->connections); | 1206 | c_n = ntohl (msg->connections); |
1207 | esize += ch_n * sizeof (MESH_ChannelNumber); | 1207 | esize += ch_n * sizeof (CADET_ChannelNumber); |
1208 | esize += c_n * sizeof (struct GNUNET_MESH_Hash); | 1208 | esize += c_n * sizeof (struct GNUNET_CADET_Hash); |
1209 | if (msize != esize) | 1209 | if (msize != esize) |
1210 | { | 1210 | { |
1211 | GNUNET_break_op (0); | 1211 | GNUNET_break_op (0); |
1212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m:%u, e: %u (%u ch, %u conn)\n", | 1212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "m:%u, e: %u (%u ch, %u conn)\n", |
1213 | msize, esize, ch_n, c_n); | 1213 | msize, esize, ch_n, c_n); |
1214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u (%u ch, %u conn)\n", | 1214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%u (%u ch, %u conn)\n", |
1215 | sizeof (struct GNUNET_MESH_LocalInfoTunnel), | 1215 | sizeof (struct GNUNET_CADET_LocalInfoTunnel), |
1216 | sizeof (MESH_ChannelNumber), sizeof (struct GNUNET_HashCode)); | 1216 | sizeof (CADET_ChannelNumber), sizeof (struct GNUNET_HashCode)); |
1217 | h->info_cb.tunnel_cb (h->info_cls, NULL, 0, 0, NULL, NULL, 0, 0); | 1217 | h->info_cb.tunnel_cb (h->info_cls, NULL, 0, 0, NULL, NULL, 0, 0); |
1218 | goto clean_cls; | 1218 | goto clean_cls; |
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | /* Call Callback with tunnel info. */ | 1221 | /* Call Callback with tunnel info. */ |
1222 | conns = (struct GNUNET_MESH_Hash *) &msg[1]; | 1222 | conns = (struct GNUNET_CADET_Hash *) &msg[1]; |
1223 | chns = (MESH_ChannelNumber *) &conns[c_n]; | 1223 | chns = (CADET_ChannelNumber *) &conns[c_n]; |
1224 | h->info_cb.tunnel_cb (h->info_cls, &msg->destination, | 1224 | h->info_cb.tunnel_cb (h->info_cls, &msg->destination, |
1225 | ch_n, c_n, chns, conns, | 1225 | ch_n, c_n, chns, conns, |
1226 | ntohs (msg->estate), ntohs (msg->cstate)); | 1226 | ntohs (msg->estate), ntohs (msg->cstate)); |
@@ -1240,13 +1240,13 @@ clean_cls: | |||
1240 | static void | 1240 | static void |
1241 | msg_received (void *cls, const struct GNUNET_MessageHeader *msg) | 1241 | msg_received (void *cls, const struct GNUNET_MessageHeader *msg) |
1242 | { | 1242 | { |
1243 | struct GNUNET_MESH_Handle *h = cls; | 1243 | struct GNUNET_CADET_Handle *h = cls; |
1244 | uint16_t type; | 1244 | uint16_t type; |
1245 | 1245 | ||
1246 | if (msg == NULL) | 1246 | if (msg == NULL) |
1247 | { | 1247 | { |
1248 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1248 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1249 | "Mesh service disconnected, reconnecting\n", h); | 1249 | "Cadet service disconnected, reconnecting\n", h); |
1250 | reconnect (h); | 1250 | reconnect (h); |
1251 | return; | 1251 | return; |
1252 | } | 1252 | } |
@@ -1257,39 +1257,39 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1257 | switch (type) | 1257 | switch (type) |
1258 | { | 1258 | { |
1259 | /* Notify of a new incoming channel */ | 1259 | /* Notify of a new incoming channel */ |
1260 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: | 1260 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: |
1261 | process_channel_created (h, (struct GNUNET_MESH_ChannelMessage *) msg); | 1261 | process_channel_created (h, (struct GNUNET_CADET_ChannelMessage *) msg); |
1262 | break; | 1262 | break; |
1263 | /* Notify of a channel disconnection */ | 1263 | /* Notify of a channel disconnection */ |
1264 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: /* TODO separate(gid problem)*/ | 1264 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: /* TODO separate(gid problem)*/ |
1265 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_NACK: | 1265 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_NACK: |
1266 | process_channel_destroy (h, (struct GNUNET_MESH_ChannelMessage *) msg); | 1266 | process_channel_destroy (h, (struct GNUNET_CADET_ChannelMessage *) msg); |
1267 | break; | 1267 | break; |
1268 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA: | 1268 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA: |
1269 | process_incoming_data (h, msg); | 1269 | process_incoming_data (h, msg); |
1270 | break; | 1270 | break; |
1271 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK: | 1271 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK: |
1272 | process_ack (h, msg); | 1272 | process_ack (h, msg); |
1273 | break; | 1273 | break; |
1274 | // case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNELS: | 1274 | // case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS: |
1275 | // process_get_channels (h, msg); | 1275 | // process_get_channels (h, msg); |
1276 | // break; | 1276 | // break; |
1277 | // case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL: | 1277 | // case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL: |
1278 | // process_show_channel (h, msg); | 1278 | // process_show_channel (h, msg); |
1279 | // break; | 1279 | // break; |
1280 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS: | 1280 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS: |
1281 | process_get_peers (h, msg); | 1281 | process_get_peers (h, msg); |
1282 | break; | 1282 | break; |
1283 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER: | 1283 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER: |
1284 | process_get_peer (h, msg); | 1284 | process_get_peer (h, msg); |
1285 | break; | 1285 | break; |
1286 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS: | 1286 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS: |
1287 | process_get_tunnels (h, msg); | 1287 | process_get_tunnels (h, msg); |
1288 | break; | 1288 | break; |
1289 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL: | 1289 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL: |
1290 | process_get_tunnel (h, msg); | 1290 | process_get_tunnel (h, msg); |
1291 | break; | 1291 | break; |
1292 | // case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL: | 1292 | // case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL: |
1293 | // process_show_channel (h, msg); | 1293 | // process_show_channel (h, msg); |
1294 | // break; | 1294 | // break; |
1295 | default: | 1295 | default: |
@@ -1321,7 +1321,7 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1321 | * "buf" will be NULL and "size" zero if the socket was closed for writing in | 1321 | * "buf" will be NULL and "size" zero if the socket was closed for writing in |
1322 | * the meantime. | 1322 | * the meantime. |
1323 | * | 1323 | * |
1324 | * @param cls closure, the mesh handle | 1324 | * @param cls closure, the cadet handle |
1325 | * @param size number of bytes available in buf | 1325 | * @param size number of bytes available in buf |
1326 | * @param buf where the callee should write the connect message | 1326 | * @param buf where the callee should write the connect message |
1327 | * @return number of bytes written to buf | 1327 | * @return number of bytes written to buf |
@@ -1329,10 +1329,10 @@ msg_received (void *cls, const struct GNUNET_MessageHeader *msg) | |||
1329 | static size_t | 1329 | static size_t |
1330 | send_callback (void *cls, size_t size, void *buf) | 1330 | send_callback (void *cls, size_t size, void *buf) |
1331 | { | 1331 | { |
1332 | struct GNUNET_MESH_Handle *h = cls; | 1332 | struct GNUNET_CADET_Handle *h = cls; |
1333 | struct GNUNET_MESH_TransmitHandle *th; | 1333 | struct GNUNET_CADET_TransmitHandle *th; |
1334 | struct GNUNET_MESH_TransmitHandle *next; | 1334 | struct GNUNET_CADET_TransmitHandle *next; |
1335 | struct GNUNET_MESH_Channel *ch; | 1335 | struct GNUNET_CADET_Channel *ch; |
1336 | char *cbuf = buf; | 1336 | char *cbuf = buf; |
1337 | size_t tsize; | 1337 | size_t tsize; |
1338 | size_t psize; | 1338 | size_t psize; |
@@ -1355,7 +1355,7 @@ send_callback (void *cls, size_t size, void *buf) | |||
1355 | ch = th->channel; | 1355 | ch = th->channel; |
1356 | if (GNUNET_YES == th_is_payload (th)) | 1356 | if (GNUNET_YES == th_is_payload (th)) |
1357 | { | 1357 | { |
1358 | struct GNUNET_MESH_LocalData *dmsg; | 1358 | struct GNUNET_CADET_LocalData *dmsg; |
1359 | struct GNUNET_MessageHeader *mh; | 1359 | struct GNUNET_MessageHeader *mh; |
1360 | 1360 | ||
1361 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# payload\n"); | 1361 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# payload\n"); |
@@ -1367,18 +1367,18 @@ send_callback (void *cls, size_t size, void *buf) | |||
1367 | } | 1367 | } |
1368 | ch->packet_size = 0; | 1368 | ch->packet_size = 0; |
1369 | GNUNET_assert (size >= th->size); | 1369 | GNUNET_assert (size >= th->size); |
1370 | dmsg = (struct GNUNET_MESH_LocalData *) cbuf; | 1370 | dmsg = (struct GNUNET_CADET_LocalData *) cbuf; |
1371 | mh = (struct GNUNET_MessageHeader *) &dmsg[1]; | 1371 | mh = (struct GNUNET_MessageHeader *) &dmsg[1]; |
1372 | psize = th->notify (th->notify_cls, | 1372 | psize = th->notify (th->notify_cls, |
1373 | size - sizeof (struct GNUNET_MESH_LocalData), | 1373 | size - sizeof (struct GNUNET_CADET_LocalData), |
1374 | mh); | 1374 | mh); |
1375 | if (psize > 0) | 1375 | if (psize > 0) |
1376 | { | 1376 | { |
1377 | psize += sizeof (struct GNUNET_MESH_LocalData); | 1377 | psize += sizeof (struct GNUNET_CADET_LocalData); |
1378 | GNUNET_assert (size >= psize); | 1378 | GNUNET_assert (size >= psize); |
1379 | dmsg->header.size = htons (psize); | 1379 | dmsg->header.size = htons (psize); |
1380 | dmsg->id = htonl (ch->chid); | 1380 | dmsg->id = htonl (ch->chid); |
1381 | dmsg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA); | 1381 | dmsg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA); |
1382 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# payload type %s\n", | 1382 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# payload type %s\n", |
1383 | GM_m2s (ntohs (mh->type))); | 1383 | GM_m2s (ntohs (mh->type))); |
1384 | ch->allow_send = GNUNET_NO; | 1384 | ch->allow_send = GNUNET_NO; |
@@ -1394,7 +1394,7 @@ send_callback (void *cls, size_t size, void *buf) | |||
1394 | { | 1394 | { |
1395 | struct GNUNET_MessageHeader *mh = (struct GNUNET_MessageHeader *) &th[1]; | 1395 | struct GNUNET_MessageHeader *mh = (struct GNUNET_MessageHeader *) &th[1]; |
1396 | 1396 | ||
1397 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# mesh internal traffic, type %s\n", | 1397 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# cadet internal traffic, type %s\n", |
1398 | GM_m2s (ntohs (mh->type))); | 1398 | GM_m2s (ntohs (mh->type))); |
1399 | memcpy (cbuf, &th[1], th->size); | 1399 | memcpy (cbuf, &th[1], th->size); |
1400 | psize = th->size; | 1400 | psize = th->size; |
@@ -1444,22 +1444,22 @@ send_callback (void *cls, size_t size, void *buf) | |||
1444 | * Takes care of creating a new queue element, copying the message and | 1444 | * Takes care of creating a new queue element, copying the message and |
1445 | * calling the tmt_rdy function if necessary. | 1445 | * calling the tmt_rdy function if necessary. |
1446 | * | 1446 | * |
1447 | * @param h mesh handle | 1447 | * @param h cadet handle |
1448 | * @param msg message to transmit | 1448 | * @param msg message to transmit |
1449 | * @param channel channel this send is related to (NULL if N/A) | 1449 | * @param channel channel this send is related to (NULL if N/A) |
1450 | */ | 1450 | */ |
1451 | static void | 1451 | static void |
1452 | send_packet (struct GNUNET_MESH_Handle *h, | 1452 | send_packet (struct GNUNET_CADET_Handle *h, |
1453 | const struct GNUNET_MessageHeader *msg, | 1453 | const struct GNUNET_MessageHeader *msg, |
1454 | struct GNUNET_MESH_Channel *channel) | 1454 | struct GNUNET_CADET_Channel *channel) |
1455 | { | 1455 | { |
1456 | struct GNUNET_MESH_TransmitHandle *th; | 1456 | struct GNUNET_CADET_TransmitHandle *th; |
1457 | size_t msize; | 1457 | size_t msize; |
1458 | 1458 | ||
1459 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Sending message to service: %s\n", | 1459 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Sending message to service: %s\n", |
1460 | GM_m2s(ntohs(msg->type))); | 1460 | GM_m2s(ntohs(msg->type))); |
1461 | msize = ntohs (msg->size); | 1461 | msize = ntohs (msg->size); |
1462 | th = GNUNET_malloc (sizeof (struct GNUNET_MESH_TransmitHandle) + msize); | 1462 | th = GNUNET_malloc (sizeof (struct GNUNET_CADET_TransmitHandle) + msize); |
1463 | th->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; | 1463 | th->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; |
1464 | th->size = msize; | 1464 | th->size = msize; |
1465 | th->channel = channel; | 1465 | th->channel = channel; |
@@ -1480,22 +1480,22 @@ send_packet (struct GNUNET_MESH_Handle *h, | |||
1480 | /********************** API CALL DEFINITIONS *************************/ | 1480 | /********************** API CALL DEFINITIONS *************************/ |
1481 | /******************************************************************************/ | 1481 | /******************************************************************************/ |
1482 | 1482 | ||
1483 | struct GNUNET_MESH_Handle * | 1483 | struct GNUNET_CADET_Handle * |
1484 | GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, | 1484 | GNUNET_CADET_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, |
1485 | GNUNET_MESH_InboundChannelNotificationHandler new_channel, | 1485 | GNUNET_CADET_InboundChannelNotificationHandler new_channel, |
1486 | GNUNET_MESH_ChannelEndHandler cleaner, | 1486 | GNUNET_CADET_ChannelEndHandler cleaner, |
1487 | const struct GNUNET_MESH_MessageHandler *handlers, | 1487 | const struct GNUNET_CADET_MessageHandler *handlers, |
1488 | const uint32_t *ports) | 1488 | const uint32_t *ports) |
1489 | { | 1489 | { |
1490 | struct GNUNET_MESH_Handle *h; | 1490 | struct GNUNET_CADET_Handle *h; |
1491 | 1491 | ||
1492 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_MESH_connect()\n"); | 1492 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_CADET_connect()\n"); |
1493 | h = GNUNET_new (struct GNUNET_MESH_Handle); | 1493 | h = GNUNET_new (struct GNUNET_CADET_Handle); |
1494 | LOG (GNUNET_ERROR_TYPE_DEBUG, " addr %p\n", h); | 1494 | LOG (GNUNET_ERROR_TYPE_DEBUG, " addr %p\n", h); |
1495 | h->cfg = cfg; | 1495 | h->cfg = cfg; |
1496 | h->new_channel = new_channel; | 1496 | h->new_channel = new_channel; |
1497 | h->cleaner = cleaner; | 1497 | h->cleaner = cleaner; |
1498 | h->client = GNUNET_CLIENT_connect ("mesh", cfg); | 1498 | h->client = GNUNET_CLIENT_connect ("cadet", cfg); |
1499 | if (h->client == NULL) | 1499 | if (h->client == NULL) |
1500 | { | 1500 | { |
1501 | GNUNET_break (0); | 1501 | GNUNET_break (0); |
@@ -1505,7 +1505,7 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, | |||
1505 | h->cls = cls; | 1505 | h->cls = cls; |
1506 | h->message_handlers = handlers; | 1506 | h->message_handlers = handlers; |
1507 | h->ports = ports; | 1507 | h->ports = ports; |
1508 | h->next_chid = GNUNET_MESH_LOCAL_CHANNEL_ID_CLI; | 1508 | h->next_chid = GNUNET_CADET_LOCAL_CHANNEL_ID_CLI; |
1509 | h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; | 1509 | h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS; |
1510 | h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 1510 | h->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
1511 | 1511 | ||
@@ -1529,25 +1529,25 @@ GNUNET_MESH_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void *cls, | |||
1529 | ports && ports[h->n_ports]; | 1529 | ports && ports[h->n_ports]; |
1530 | h->n_ports++) ; | 1530 | h->n_ports++) ; |
1531 | send_connect (h); | 1531 | send_connect (h); |
1532 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_MESH_connect() END\n"); | 1532 | LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_CADET_connect() END\n"); |
1533 | return h; | 1533 | return h; |
1534 | } | 1534 | } |
1535 | 1535 | ||
1536 | 1536 | ||
1537 | void | 1537 | void |
1538 | GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) | 1538 | GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle) |
1539 | { | 1539 | { |
1540 | struct GNUNET_MESH_Channel *ch; | 1540 | struct GNUNET_CADET_Channel *ch; |
1541 | struct GNUNET_MESH_Channel *aux; | 1541 | struct GNUNET_CADET_Channel *aux; |
1542 | struct GNUNET_MESH_TransmitHandle *th; | 1542 | struct GNUNET_CADET_TransmitHandle *th; |
1543 | 1543 | ||
1544 | LOG (GNUNET_ERROR_TYPE_DEBUG, "MESH DISCONNECT\n"); | 1544 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET DISCONNECT\n"); |
1545 | 1545 | ||
1546 | ch = handle->channels_head; | 1546 | ch = handle->channels_head; |
1547 | while (NULL != ch) | 1547 | while (NULL != ch) |
1548 | { | 1548 | { |
1549 | aux = ch->next; | 1549 | aux = ch->next; |
1550 | if (ch->chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) | 1550 | if (ch->chid < GNUNET_CADET_LOCAL_CHANNEL_ID_SERV) |
1551 | { | 1551 | { |
1552 | GNUNET_break (0); | 1552 | GNUNET_break (0); |
1553 | LOG (GNUNET_ERROR_TYPE_DEBUG, "channel %X not destroyed\n", ch->chid); | 1553 | LOG (GNUNET_ERROR_TYPE_DEBUG, "channel %X not destroyed\n", ch->chid); |
@@ -1566,15 +1566,15 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) | |||
1566 | msg = (struct GNUNET_MessageHeader *) &th[1]; | 1566 | msg = (struct GNUNET_MessageHeader *) &th[1]; |
1567 | switch (ntohs(msg->type)) | 1567 | switch (ntohs(msg->type)) |
1568 | { | 1568 | { |
1569 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT: | 1569 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT: |
1570 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE: | 1570 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE: |
1571 | case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY: | 1571 | case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY: |
1572 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNELS: | 1572 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNELS: |
1573 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL: | 1573 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL: |
1574 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER: | 1574 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER: |
1575 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS: | 1575 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS: |
1576 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL: | 1576 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL: |
1577 | case GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS: | 1577 | case GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS: |
1578 | break; | 1578 | break; |
1579 | default: | 1579 | default: |
1580 | GNUNET_break (0); | 1580 | GNUNET_break (0); |
@@ -1609,26 +1609,26 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) | |||
1609 | * Create a new channel towards a remote peer. | 1609 | * Create a new channel towards a remote peer. |
1610 | * | 1610 | * |
1611 | * If the destination port is not open by any peer or the destination peer | 1611 | * If the destination port is not open by any peer or the destination peer |
1612 | * does not accept the channel, #GNUNET_MESH_ChannelEndHandler will be called | 1612 | * does not accept the channel, #GNUNET_CADET_ChannelEndHandler will be called |
1613 | * for this channel. | 1613 | * for this channel. |
1614 | * | 1614 | * |
1615 | * @param h mesh handle | 1615 | * @param h cadet handle |
1616 | * @param channel_ctx client's channel context to associate with the channel | 1616 | * @param channel_ctx client's channel context to associate with the channel |
1617 | * @param peer peer identity the channel should go to | 1617 | * @param peer peer identity the channel should go to |
1618 | * @param port Port number. | 1618 | * @param port Port number. |
1619 | * @param options MeshOption flag field, with all desired option bits set to 1. | 1619 | * @param options CadetOption flag field, with all desired option bits set to 1. |
1620 | * | 1620 | * |
1621 | * @return handle to the channel | 1621 | * @return handle to the channel |
1622 | */ | 1622 | */ |
1623 | struct GNUNET_MESH_Channel * | 1623 | struct GNUNET_CADET_Channel * |
1624 | GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, | 1624 | GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle *h, |
1625 | void *channel_ctx, | 1625 | void *channel_ctx, |
1626 | const struct GNUNET_PeerIdentity *peer, | 1626 | const struct GNUNET_PeerIdentity *peer, |
1627 | uint32_t port, | 1627 | uint32_t port, |
1628 | enum GNUNET_MESH_ChannelOption options) | 1628 | enum GNUNET_CADET_ChannelOption options) |
1629 | { | 1629 | { |
1630 | struct GNUNET_MESH_Channel *ch; | 1630 | struct GNUNET_CADET_Channel *ch; |
1631 | struct GNUNET_MESH_ChannelMessage msg; | 1631 | struct GNUNET_CADET_ChannelMessage msg; |
1632 | 1632 | ||
1633 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1633 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1634 | "Creating new channel to %s:%u\n", | 1634 | "Creating new channel to %s:%u\n", |
@@ -1638,8 +1638,8 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, | |||
1638 | LOG (GNUNET_ERROR_TYPE_DEBUG, " number %X\n", ch->chid); | 1638 | LOG (GNUNET_ERROR_TYPE_DEBUG, " number %X\n", ch->chid); |
1639 | ch->ctx = channel_ctx; | 1639 | ch->ctx = channel_ctx; |
1640 | ch->peer = GNUNET_PEER_intern (peer); | 1640 | ch->peer = GNUNET_PEER_intern (peer); |
1641 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE); | 1641 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_CREATE); |
1642 | msg.header.size = htons (sizeof (struct GNUNET_MESH_ChannelMessage)); | 1642 | msg.header.size = htons (sizeof (struct GNUNET_CADET_ChannelMessage)); |
1643 | msg.channel_id = htonl (ch->chid); | 1643 | msg.channel_id = htonl (ch->chid); |
1644 | msg.port = htonl (port); | 1644 | msg.port = htonl (port); |
1645 | msg.peer = *peer; | 1645 | msg.peer = *peer; |
@@ -1651,17 +1651,17 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, | |||
1651 | 1651 | ||
1652 | 1652 | ||
1653 | void | 1653 | void |
1654 | GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel) | 1654 | GNUNET_CADET_channel_destroy (struct GNUNET_CADET_Channel *channel) |
1655 | { | 1655 | { |
1656 | struct GNUNET_MESH_Handle *h; | 1656 | struct GNUNET_CADET_Handle *h; |
1657 | struct GNUNET_MESH_ChannelMessage msg; | 1657 | struct GNUNET_CADET_ChannelMessage msg; |
1658 | struct GNUNET_MESH_TransmitHandle *th; | 1658 | struct GNUNET_CADET_TransmitHandle *th; |
1659 | 1659 | ||
1660 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Destroying channel\n"); | 1660 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Destroying channel\n"); |
1661 | h = channel->mesh; | 1661 | h = channel->cadet; |
1662 | 1662 | ||
1663 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY); | 1663 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY); |
1664 | msg.header.size = htons (sizeof (struct GNUNET_MESH_ChannelMessage)); | 1664 | msg.header.size = htons (sizeof (struct GNUNET_CADET_ChannelMessage)); |
1665 | msg.channel_id = htonl (channel->chid); | 1665 | msg.channel_id = htonl (channel->chid); |
1666 | memset (&msg.peer, 0, sizeof (struct GNUNET_PeerIdentity)); | 1666 | memset (&msg.peer, 0, sizeof (struct GNUNET_PeerIdentity)); |
1667 | msg.port = 0; | 1667 | msg.port = 0; |
@@ -1669,7 +1669,7 @@ GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel) | |||
1669 | th = h->th_head; | 1669 | th = h->th_head; |
1670 | while (th != NULL) | 1670 | while (th != NULL) |
1671 | { | 1671 | { |
1672 | struct GNUNET_MESH_TransmitHandle *aux; | 1672 | struct GNUNET_CADET_TransmitHandle *aux; |
1673 | if (th->channel == channel) | 1673 | if (th->channel == channel) |
1674 | { | 1674 | { |
1675 | aux = th->next; | 1675 | aux = th->next; |
@@ -1693,31 +1693,31 @@ GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel) | |||
1693 | * Get information about a channel. | 1693 | * Get information about a channel. |
1694 | * | 1694 | * |
1695 | * @param channel Channel handle. | 1695 | * @param channel Channel handle. |
1696 | * @param option Query (GNUNET_MESH_OPTION_*). | 1696 | * @param option Query (GNUNET_CADET_OPTION_*). |
1697 | * @param ... dependant on option, currently not used | 1697 | * @param ... dependant on option, currently not used |
1698 | * | 1698 | * |
1699 | * @return Union with an answer to the query. | 1699 | * @return Union with an answer to the query. |
1700 | */ | 1700 | */ |
1701 | const union GNUNET_MESH_ChannelInfo * | 1701 | const union GNUNET_CADET_ChannelInfo * |
1702 | GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel, | 1702 | GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, |
1703 | enum GNUNET_MESH_ChannelOption option, ...) | 1703 | enum GNUNET_CADET_ChannelOption option, ...) |
1704 | { | 1704 | { |
1705 | static int bool_flag; | 1705 | static int bool_flag; |
1706 | const union GNUNET_MESH_ChannelInfo *ret; | 1706 | const union GNUNET_CADET_ChannelInfo *ret; |
1707 | 1707 | ||
1708 | switch (option) | 1708 | switch (option) |
1709 | { | 1709 | { |
1710 | case GNUNET_MESH_OPTION_NOBUFFER: | 1710 | case GNUNET_CADET_OPTION_NOBUFFER: |
1711 | case GNUNET_MESH_OPTION_RELIABLE: | 1711 | case GNUNET_CADET_OPTION_RELIABLE: |
1712 | case GNUNET_MESH_OPTION_OOORDER: | 1712 | case GNUNET_CADET_OPTION_OOORDER: |
1713 | if (0 != (option & channel->options)) | 1713 | if (0 != (option & channel->options)) |
1714 | bool_flag = GNUNET_YES; | 1714 | bool_flag = GNUNET_YES; |
1715 | else | 1715 | else |
1716 | bool_flag = GNUNET_NO; | 1716 | bool_flag = GNUNET_NO; |
1717 | ret = (const union GNUNET_MESH_ChannelInfo *) &bool_flag; | 1717 | ret = (const union GNUNET_CADET_ChannelInfo *) &bool_flag; |
1718 | break; | 1718 | break; |
1719 | case GNUNET_MESH_OPTION_PEER: | 1719 | case GNUNET_CADET_OPTION_PEER: |
1720 | ret = (const union GNUNET_MESH_ChannelInfo *) GNUNET_PEER_resolve2 (channel->peer); | 1720 | ret = (const union GNUNET_CADET_ChannelInfo *) GNUNET_PEER_resolve2 (channel->peer); |
1721 | break; | 1721 | break; |
1722 | default: | 1722 | default: |
1723 | GNUNET_break (0); | 1723 | GNUNET_break (0); |
@@ -1727,79 +1727,79 @@ GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel, | |||
1727 | return ret; | 1727 | return ret; |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | struct GNUNET_MESH_TransmitHandle * | 1730 | struct GNUNET_CADET_TransmitHandle * |
1731 | GNUNET_MESH_notify_transmit_ready (struct GNUNET_MESH_Channel *channel, int cork, | 1731 | GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, int cork, |
1732 | struct GNUNET_TIME_Relative maxdelay, | 1732 | struct GNUNET_TIME_Relative maxdelay, |
1733 | size_t notify_size, | 1733 | size_t notify_size, |
1734 | GNUNET_CONNECTION_TransmitReadyNotify notify, | 1734 | GNUNET_CONNECTION_TransmitReadyNotify notify, |
1735 | void *notify_cls) | 1735 | void *notify_cls) |
1736 | { | 1736 | { |
1737 | struct GNUNET_MESH_TransmitHandle *th; | 1737 | struct GNUNET_CADET_TransmitHandle *th; |
1738 | 1738 | ||
1739 | GNUNET_assert (NULL != channel); | 1739 | GNUNET_assert (NULL != channel); |
1740 | LOG (GNUNET_ERROR_TYPE_DEBUG, "MESH NOTIFY TRANSMIT READY\n"); | 1740 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY\n"); |
1741 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->chid); | 1741 | LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", channel->chid); |
1742 | LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send); | 1742 | LOG (GNUNET_ERROR_TYPE_DEBUG, " allow_send %d\n", channel->allow_send); |
1743 | if (channel->chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) | 1743 | if (channel->chid >= GNUNET_CADET_LOCAL_CHANNEL_ID_SERV) |
1744 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to origin\n"); | 1744 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to origin\n"); |
1745 | else | 1745 | else |
1746 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to destination\n"); | 1746 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to destination\n"); |
1747 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload size %u\n", notify_size); | 1747 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload size %u\n", notify_size); |
1748 | GNUNET_assert (NULL != notify); | 1748 | GNUNET_assert (NULL != notify); |
1749 | GNUNET_assert (0 == channel->packet_size); // Only one data packet allowed | 1749 | GNUNET_assert (0 == channel->packet_size); // Only one data packet allowed |
1750 | th = GNUNET_new (struct GNUNET_MESH_TransmitHandle); | 1750 | th = GNUNET_new (struct GNUNET_CADET_TransmitHandle); |
1751 | th->channel = channel; | 1751 | th->channel = channel; |
1752 | th->timeout = GNUNET_TIME_relative_to_absolute (maxdelay); | 1752 | th->timeout = GNUNET_TIME_relative_to_absolute (maxdelay); |
1753 | th->size = notify_size + sizeof (struct GNUNET_MESH_LocalData); | 1753 | th->size = notify_size + sizeof (struct GNUNET_CADET_LocalData); |
1754 | channel->packet_size = th->size; | 1754 | channel->packet_size = th->size; |
1755 | LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size); | 1755 | LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size); |
1756 | th->notify = notify; | 1756 | th->notify = notify; |
1757 | th->notify_cls = notify_cls; | 1757 | th->notify_cls = notify_cls; |
1758 | add_to_queue (channel->mesh, th); | 1758 | add_to_queue (channel->cadet, th); |
1759 | if (NULL != channel->mesh->th) | 1759 | if (NULL != channel->cadet->th) |
1760 | return th; | 1760 | return th; |
1761 | if (GNUNET_NO == channel->allow_send) | 1761 | if (GNUNET_NO == channel->allow_send) |
1762 | return th; | 1762 | return th; |
1763 | LOG (GNUNET_ERROR_TYPE_DEBUG, " call client notify tmt rdy\n"); | 1763 | LOG (GNUNET_ERROR_TYPE_DEBUG, " call client notify tmt rdy\n"); |
1764 | channel->mesh->th = | 1764 | channel->cadet->th = |
1765 | GNUNET_CLIENT_notify_transmit_ready (channel->mesh->client, th->size, | 1765 | GNUNET_CLIENT_notify_transmit_ready (channel->cadet->client, th->size, |
1766 | GNUNET_TIME_UNIT_FOREVER_REL, | 1766 | GNUNET_TIME_UNIT_FOREVER_REL, |
1767 | GNUNET_YES, &send_callback, | 1767 | GNUNET_YES, &send_callback, |
1768 | channel->mesh); | 1768 | channel->cadet); |
1769 | LOG (GNUNET_ERROR_TYPE_DEBUG, "MESH NOTIFY TRANSMIT READY END\n"); | 1769 | LOG (GNUNET_ERROR_TYPE_DEBUG, "CADET NOTIFY TRANSMIT READY END\n"); |
1770 | return th; | 1770 | return th; |
1771 | } | 1771 | } |
1772 | 1772 | ||
1773 | 1773 | ||
1774 | void | 1774 | void |
1775 | GNUNET_MESH_notify_transmit_ready_cancel (struct GNUNET_MESH_TransmitHandle *th) | 1775 | GNUNET_CADET_notify_transmit_ready_cancel (struct GNUNET_CADET_TransmitHandle *th) |
1776 | { | 1776 | { |
1777 | struct GNUNET_MESH_Handle *mesh; | 1777 | struct GNUNET_CADET_Handle *cadet; |
1778 | 1778 | ||
1779 | th->channel->packet_size = 0; | 1779 | th->channel->packet_size = 0; |
1780 | mesh = th->channel->mesh; | 1780 | cadet = th->channel->cadet; |
1781 | if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK) | 1781 | if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK) |
1782 | GNUNET_SCHEDULER_cancel (th->timeout_task); | 1782 | GNUNET_SCHEDULER_cancel (th->timeout_task); |
1783 | GNUNET_CONTAINER_DLL_remove (mesh->th_head, mesh->th_tail, th); | 1783 | GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th); |
1784 | GNUNET_free (th); | 1784 | GNUNET_free (th); |
1785 | if ((0 == message_ready_size (mesh)) && (NULL != mesh->th)) | 1785 | if ((0 == message_ready_size (cadet)) && (NULL != cadet->th)) |
1786 | { | 1786 | { |
1787 | /* queue empty, no point in asking for transmission */ | 1787 | /* queue empty, no point in asking for transmission */ |
1788 | GNUNET_CLIENT_notify_transmit_ready_cancel (mesh->th); | 1788 | GNUNET_CLIENT_notify_transmit_ready_cancel (cadet->th); |
1789 | mesh->th = NULL; | 1789 | cadet->th = NULL; |
1790 | } | 1790 | } |
1791 | } | 1791 | } |
1792 | 1792 | ||
1793 | 1793 | ||
1794 | void | 1794 | void |
1795 | GNUNET_MESH_receive_done (struct GNUNET_MESH_Channel *channel) | 1795 | GNUNET_CADET_receive_done (struct GNUNET_CADET_Channel *channel) |
1796 | { | 1796 | { |
1797 | send_ack (channel); | 1797 | send_ack (channel); |
1798 | } | 1798 | } |
1799 | 1799 | ||
1800 | 1800 | ||
1801 | static void | 1801 | static void |
1802 | send_info_request (struct GNUNET_MESH_Handle *h, uint16_t type) | 1802 | send_info_request (struct GNUNET_CADET_Handle *h, uint16_t type) |
1803 | { | 1803 | { |
1804 | struct GNUNET_MessageHeader msg; | 1804 | struct GNUNET_MessageHeader msg; |
1805 | 1805 | ||
@@ -1810,22 +1810,22 @@ send_info_request (struct GNUNET_MESH_Handle *h, uint16_t type) | |||
1810 | 1810 | ||
1811 | 1811 | ||
1812 | /** | 1812 | /** |
1813 | * Request information about peers known to the running mesh service. | 1813 | * Request information about peers known to the running cadet service. |
1814 | * The callback will be called for every peer known to the service. | 1814 | * The callback will be called for every peer known to the service. |
1815 | * Only one info request (of any kind) can be active at once. | 1815 | * Only one info request (of any kind) can be active at once. |
1816 | * | 1816 | * |
1817 | * | 1817 | * |
1818 | * WARNING: unstable API, likely to change in the future! | 1818 | * WARNING: unstable API, likely to change in the future! |
1819 | * | 1819 | * |
1820 | * @param h Handle to the mesh peer. | 1820 | * @param h Handle to the cadet peer. |
1821 | * @param callback Function to call with the requested data. | 1821 | * @param callback Function to call with the requested data. |
1822 | * @param callback_cls Closure for @c callback. | 1822 | * @param callback_cls Closure for @c callback. |
1823 | * | 1823 | * |
1824 | * @return #GNUNET_OK / #GNUNET_SYSERR | 1824 | * @return #GNUNET_OK / #GNUNET_SYSERR |
1825 | */ | 1825 | */ |
1826 | int | 1826 | int |
1827 | GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h, | 1827 | GNUNET_CADET_get_peers (struct GNUNET_CADET_Handle *h, |
1828 | GNUNET_MESH_PeersCB callback, | 1828 | GNUNET_CADET_PeersCB callback, |
1829 | void *callback_cls) | 1829 | void *callback_cls) |
1830 | { | 1830 | { |
1831 | if (NULL != h->info_cb.peers_cb) | 1831 | if (NULL != h->info_cb.peers_cb) |
@@ -1833,7 +1833,7 @@ GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h, | |||
1833 | GNUNET_break (0); | 1833 | GNUNET_break (0); |
1834 | return GNUNET_SYSERR; | 1834 | return GNUNET_SYSERR; |
1835 | } | 1835 | } |
1836 | send_info_request (h, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEERS); | 1836 | send_info_request (h, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS); |
1837 | h->info_cb.peers_cb = callback; | 1837 | h->info_cb.peers_cb = callback; |
1838 | h->info_cls = callback_cls; | 1838 | h->info_cls = callback_cls; |
1839 | return GNUNET_OK; | 1839 | return GNUNET_OK; |
@@ -1845,12 +1845,12 @@ GNUNET_MESH_get_peers (struct GNUNET_MESH_Handle *h, | |||
1845 | * | 1845 | * |
1846 | * WARNING: unstable API, likely to change in the future! | 1846 | * WARNING: unstable API, likely to change in the future! |
1847 | * | 1847 | * |
1848 | * @param h Mesh handle. | 1848 | * @param h Cadet handle. |
1849 | * | 1849 | * |
1850 | * @return Closure given to GNUNET_MESH_get_peers. | 1850 | * @return Closure given to GNUNET_CADET_get_peers. |
1851 | */ | 1851 | */ |
1852 | void * | 1852 | void * |
1853 | GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h) | 1853 | GNUNET_CADET_get_peers_cancel (struct GNUNET_CADET_Handle *h) |
1854 | { | 1854 | { |
1855 | void *cls; | 1855 | void *cls; |
1856 | 1856 | ||
@@ -1862,13 +1862,13 @@ GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h) | |||
1862 | 1862 | ||
1863 | 1863 | ||
1864 | /** | 1864 | /** |
1865 | * Request information about a peer known to the running mesh peer. | 1865 | * Request information about a peer known to the running cadet peer. |
1866 | * The callback will be called for the tunnel once. | 1866 | * The callback will be called for the tunnel once. |
1867 | * Only one info request (of any kind) can be active at once. | 1867 | * Only one info request (of any kind) can be active at once. |
1868 | * | 1868 | * |
1869 | * WARNING: unstable API, likely to change in the future! | 1869 | * WARNING: unstable API, likely to change in the future! |
1870 | * | 1870 | * |
1871 | * @param h Handle to the mesh peer. | 1871 | * @param h Handle to the cadet peer. |
1872 | * @param id Peer whose tunnel to examine. | 1872 | * @param id Peer whose tunnel to examine. |
1873 | * @param callback Function to call with the requested data. | 1873 | * @param callback Function to call with the requested data. |
1874 | * @param callback_cls Closure for @c callback. | 1874 | * @param callback_cls Closure for @c callback. |
@@ -1876,12 +1876,12 @@ GNUNET_MESH_get_peers_cancel (struct GNUNET_MESH_Handle *h) | |||
1876 | * @return #GNUNET_OK / #GNUNET_SYSERR | 1876 | * @return #GNUNET_OK / #GNUNET_SYSERR |
1877 | */ | 1877 | */ |
1878 | int | 1878 | int |
1879 | GNUNET_MESH_get_peer (struct GNUNET_MESH_Handle *h, | 1879 | GNUNET_CADET_get_peer (struct GNUNET_CADET_Handle *h, |
1880 | const struct GNUNET_PeerIdentity *id, | 1880 | const struct GNUNET_PeerIdentity *id, |
1881 | GNUNET_MESH_PeerCB callback, | 1881 | GNUNET_CADET_PeerCB callback, |
1882 | void *callback_cls) | 1882 | void *callback_cls) |
1883 | { | 1883 | { |
1884 | struct GNUNET_MESH_LocalInfo msg; | 1884 | struct GNUNET_CADET_LocalInfo msg; |
1885 | 1885 | ||
1886 | if (NULL != h->info_cb.peer_cb) | 1886 | if (NULL != h->info_cb.peer_cb) |
1887 | { | 1887 | { |
@@ -1891,7 +1891,7 @@ GNUNET_MESH_get_peer (struct GNUNET_MESH_Handle *h, | |||
1891 | 1891 | ||
1892 | memset (&msg, 0, sizeof (msg)); | 1892 | memset (&msg, 0, sizeof (msg)); |
1893 | msg.header.size = htons (sizeof (msg)); | 1893 | msg.header.size = htons (sizeof (msg)); |
1894 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER); | 1894 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER); |
1895 | msg.peer = *id; | 1895 | msg.peer = *id; |
1896 | send_packet (h, &msg.header, NULL); | 1896 | send_packet (h, &msg.header, NULL); |
1897 | h->info_cb.peer_cb = callback; | 1897 | h->info_cb.peer_cb = callback; |
@@ -1901,21 +1901,21 @@ GNUNET_MESH_get_peer (struct GNUNET_MESH_Handle *h, | |||
1901 | 1901 | ||
1902 | 1902 | ||
1903 | /** | 1903 | /** |
1904 | * Request information about tunnels of the running mesh peer. | 1904 | * Request information about tunnels of the running cadet peer. |
1905 | * The callback will be called for every tunnel of the service. | 1905 | * The callback will be called for every tunnel of the service. |
1906 | * Only one info request (of any kind) can be active at once. | 1906 | * Only one info request (of any kind) can be active at once. |
1907 | * | 1907 | * |
1908 | * WARNING: unstable API, likely to change in the future! | 1908 | * WARNING: unstable API, likely to change in the future! |
1909 | * | 1909 | * |
1910 | * @param h Handle to the mesh peer. | 1910 | * @param h Handle to the cadet peer. |
1911 | * @param callback Function to call with the requested data. | 1911 | * @param callback Function to call with the requested data. |
1912 | * @param callback_cls Closure for @c callback. | 1912 | * @param callback_cls Closure for @c callback. |
1913 | * | 1913 | * |
1914 | * @return #GNUNET_OK / #GNUNET_SYSERR | 1914 | * @return #GNUNET_OK / #GNUNET_SYSERR |
1915 | */ | 1915 | */ |
1916 | int | 1916 | int |
1917 | GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h, | 1917 | GNUNET_CADET_get_tunnels (struct GNUNET_CADET_Handle *h, |
1918 | GNUNET_MESH_TunnelsCB callback, | 1918 | GNUNET_CADET_TunnelsCB callback, |
1919 | void *callback_cls) | 1919 | void *callback_cls) |
1920 | { | 1920 | { |
1921 | if (NULL != h->info_cb.tunnels_cb) | 1921 | if (NULL != h->info_cb.tunnels_cb) |
@@ -1923,7 +1923,7 @@ GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h, | |||
1923 | GNUNET_break (0); | 1923 | GNUNET_break (0); |
1924 | return GNUNET_SYSERR; | 1924 | return GNUNET_SYSERR; |
1925 | } | 1925 | } |
1926 | send_info_request (h, GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); | 1926 | send_info_request (h, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS); |
1927 | h->info_cb.tunnels_cb = callback; | 1927 | h->info_cb.tunnels_cb = callback; |
1928 | h->info_cls = callback_cls; | 1928 | h->info_cls = callback_cls; |
1929 | return GNUNET_OK; | 1929 | return GNUNET_OK; |
@@ -1933,12 +1933,12 @@ GNUNET_MESH_get_tunnels (struct GNUNET_MESH_Handle *h, | |||
1933 | /** | 1933 | /** |
1934 | * Cancel a monitor request. The monitor callback will not be called. | 1934 | * Cancel a monitor request. The monitor callback will not be called. |
1935 | * | 1935 | * |
1936 | * @param h Mesh handle. | 1936 | * @param h Cadet handle. |
1937 | * | 1937 | * |
1938 | * @return Closure given to GNUNET_MESH_get_tunnels. | 1938 | * @return Closure given to GNUNET_CADET_get_tunnels. |
1939 | */ | 1939 | */ |
1940 | void * | 1940 | void * |
1941 | GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h) | 1941 | GNUNET_CADET_get_tunnels_cancel (struct GNUNET_CADET_Handle *h) |
1942 | { | 1942 | { |
1943 | void *cls; | 1943 | void *cls; |
1944 | 1944 | ||
@@ -1952,13 +1952,13 @@ GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h) | |||
1952 | 1952 | ||
1953 | 1953 | ||
1954 | /** | 1954 | /** |
1955 | * Request information about a tunnel of the running mesh peer. | 1955 | * Request information about a tunnel of the running cadet peer. |
1956 | * The callback will be called for the tunnel once. | 1956 | * The callback will be called for the tunnel once. |
1957 | * Only one info request (of any kind) can be active at once. | 1957 | * Only one info request (of any kind) can be active at once. |
1958 | * | 1958 | * |
1959 | * WARNING: unstable API, likely to change in the future! | 1959 | * WARNING: unstable API, likely to change in the future! |
1960 | * | 1960 | * |
1961 | * @param h Handle to the mesh peer. | 1961 | * @param h Handle to the cadet peer. |
1962 | * @param id Peer whose tunnel to examine. | 1962 | * @param id Peer whose tunnel to examine. |
1963 | * @param callback Function to call with the requested data. | 1963 | * @param callback Function to call with the requested data. |
1964 | * @param callback_cls Closure for @c callback. | 1964 | * @param callback_cls Closure for @c callback. |
@@ -1966,12 +1966,12 @@ GNUNET_MESH_get_tunnels_cancel (struct GNUNET_MESH_Handle *h) | |||
1966 | * @return #GNUNET_OK / #GNUNET_SYSERR | 1966 | * @return #GNUNET_OK / #GNUNET_SYSERR |
1967 | */ | 1967 | */ |
1968 | int | 1968 | int |
1969 | GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h, | 1969 | GNUNET_CADET_get_tunnel (struct GNUNET_CADET_Handle *h, |
1970 | const struct GNUNET_PeerIdentity *id, | 1970 | const struct GNUNET_PeerIdentity *id, |
1971 | GNUNET_MESH_TunnelCB callback, | 1971 | GNUNET_CADET_TunnelCB callback, |
1972 | void *callback_cls) | 1972 | void *callback_cls) |
1973 | { | 1973 | { |
1974 | struct GNUNET_MESH_LocalInfo msg; | 1974 | struct GNUNET_CADET_LocalInfo msg; |
1975 | 1975 | ||
1976 | if (NULL != h->info_cb.tunnel_cb) | 1976 | if (NULL != h->info_cb.tunnel_cb) |
1977 | { | 1977 | { |
@@ -1981,7 +1981,7 @@ GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h, | |||
1981 | 1981 | ||
1982 | memset (&msg, 0, sizeof (msg)); | 1982 | memset (&msg, 0, sizeof (msg)); |
1983 | msg.header.size = htons (sizeof (msg)); | 1983 | msg.header.size = htons (sizeof (msg)); |
1984 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNEL); | 1984 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL); |
1985 | msg.peer = *id; | 1985 | msg.peer = *id; |
1986 | send_packet (h, &msg.header, NULL); | 1986 | send_packet (h, &msg.header, NULL); |
1987 | h->info_cb.tunnel_cb = callback; | 1987 | h->info_cb.tunnel_cb = callback; |
@@ -1991,12 +1991,12 @@ GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h, | |||
1991 | 1991 | ||
1992 | 1992 | ||
1993 | /** | 1993 | /** |
1994 | * Request information about a specific channel of the running mesh peer. | 1994 | * Request information about a specific channel of the running cadet peer. |
1995 | * | 1995 | * |
1996 | * WARNING: unstable API, likely to change in the future! | 1996 | * WARNING: unstable API, likely to change in the future! |
1997 | * FIXME Add destination option. | 1997 | * FIXME Add destination option. |
1998 | * | 1998 | * |
1999 | * @param h Handle to the mesh peer. | 1999 | * @param h Handle to the cadet peer. |
2000 | * @param initiator ID of the owner of the channel. | 2000 | * @param initiator ID of the owner of the channel. |
2001 | * @param channel_number Channel number. | 2001 | * @param channel_number Channel number. |
2002 | * @param callback Function to call with the requested data. | 2002 | * @param callback Function to call with the requested data. |
@@ -2005,13 +2005,13 @@ GNUNET_MESH_get_tunnel (struct GNUNET_MESH_Handle *h, | |||
2005 | * @return #GNUNET_OK / #GNUNET_SYSERR | 2005 | * @return #GNUNET_OK / #GNUNET_SYSERR |
2006 | */ | 2006 | */ |
2007 | int | 2007 | int |
2008 | GNUNET_MESH_show_channel (struct GNUNET_MESH_Handle *h, | 2008 | GNUNET_CADET_show_channel (struct GNUNET_CADET_Handle *h, |
2009 | struct GNUNET_PeerIdentity *initiator, | 2009 | struct GNUNET_PeerIdentity *initiator, |
2010 | unsigned int channel_number, | 2010 | unsigned int channel_number, |
2011 | GNUNET_MESH_ChannelCB callback, | 2011 | GNUNET_CADET_ChannelCB callback, |
2012 | void *callback_cls) | 2012 | void *callback_cls) |
2013 | { | 2013 | { |
2014 | struct GNUNET_MESH_LocalInfo msg; | 2014 | struct GNUNET_CADET_LocalInfo msg; |
2015 | 2015 | ||
2016 | if (NULL != h->info_cb.channel_cb) | 2016 | if (NULL != h->info_cb.channel_cb) |
2017 | { | 2017 | { |
@@ -2020,7 +2020,7 @@ GNUNET_MESH_show_channel (struct GNUNET_MESH_Handle *h, | |||
2020 | } | 2020 | } |
2021 | 2021 | ||
2022 | msg.header.size = htons (sizeof (msg)); | 2022 | msg.header.size = htons (sizeof (msg)); |
2023 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_CHANNEL); | 2023 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL); |
2024 | msg.peer = *initiator; | 2024 | msg.peer = *initiator; |
2025 | msg.channel_id = htonl (channel_number); | 2025 | msg.channel_id = htonl (channel_number); |
2026 | // msg.reserved = 0; | 2026 | // msg.reserved = 0; |
@@ -2043,11 +2043,11 @@ GNUNET_MESH_show_channel (struct GNUNET_MESH_Handle *h, | |||
2043 | * @return number of bytes written to buf | 2043 | * @return number of bytes written to buf |
2044 | */ | 2044 | */ |
2045 | static size_t | 2045 | static size_t |
2046 | mesh_mq_ntr (void *cls, size_t size, | 2046 | cadet_mq_ntr (void *cls, size_t size, |
2047 | void *buf) | 2047 | void *buf) |
2048 | { | 2048 | { |
2049 | struct GNUNET_MQ_Handle *mq = cls; | 2049 | struct GNUNET_MQ_Handle *mq = cls; |
2050 | struct MeshMQState *state = GNUNET_MQ_impl_state (mq); | 2050 | struct CadetMQState *state = GNUNET_MQ_impl_state (mq); |
2051 | const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq); | 2051 | const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq); |
2052 | uint16_t msize; | 2052 | uint16_t msize; |
2053 | 2053 | ||
@@ -2074,19 +2074,19 @@ mesh_mq_ntr (void *cls, size_t size, | |||
2074 | * @param impl_state state of the implementation | 2074 | * @param impl_state state of the implementation |
2075 | */ | 2075 | */ |
2076 | static void | 2076 | static void |
2077 | mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq, | 2077 | cadet_mq_send_impl (struct GNUNET_MQ_Handle *mq, |
2078 | const struct GNUNET_MessageHeader *msg, void *impl_state) | 2078 | const struct GNUNET_MessageHeader *msg, void *impl_state) |
2079 | { | 2079 | { |
2080 | struct MeshMQState *state = impl_state; | 2080 | struct CadetMQState *state = impl_state; |
2081 | 2081 | ||
2082 | GNUNET_assert (NULL == state->th); | 2082 | GNUNET_assert (NULL == state->th); |
2083 | state->th = | 2083 | state->th = |
2084 | GNUNET_MESH_notify_transmit_ready (state->channel, | 2084 | GNUNET_CADET_notify_transmit_ready (state->channel, |
2085 | /* FIXME: add option for corking */ | 2085 | /* FIXME: add option for corking */ |
2086 | GNUNET_NO, | 2086 | GNUNET_NO, |
2087 | GNUNET_TIME_UNIT_FOREVER_REL, | 2087 | GNUNET_TIME_UNIT_FOREVER_REL, |
2088 | ntohs (msg->size), | 2088 | ntohs (msg->size), |
2089 | mesh_mq_ntr, mq); | 2089 | cadet_mq_ntr, mq); |
2090 | 2090 | ||
2091 | } | 2091 | } |
2092 | 2092 | ||
@@ -2101,19 +2101,19 @@ mesh_mq_send_impl (struct GNUNET_MQ_Handle *mq, | |||
2101 | * @param impl_state state of the implementation | 2101 | * @param impl_state state of the implementation |
2102 | */ | 2102 | */ |
2103 | static void | 2103 | static void |
2104 | mesh_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state) | 2104 | cadet_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state) |
2105 | { | 2105 | { |
2106 | struct MeshMQState *state = impl_state; | 2106 | struct CadetMQState *state = impl_state; |
2107 | 2107 | ||
2108 | if (NULL != state->th) | 2108 | if (NULL != state->th) |
2109 | GNUNET_MESH_notify_transmit_ready_cancel (state->th); | 2109 | GNUNET_CADET_notify_transmit_ready_cancel (state->th); |
2110 | 2110 | ||
2111 | GNUNET_free (state); | 2111 | GNUNET_free (state); |
2112 | } | 2112 | } |
2113 | 2113 | ||
2114 | 2114 | ||
2115 | /** | 2115 | /** |
2116 | * Create a message queue for a mesh channel. | 2116 | * Create a message queue for a cadet channel. |
2117 | * The message queue can only be used to transmit messages, | 2117 | * The message queue can only be used to transmit messages, |
2118 | * not to receive them. | 2118 | * not to receive them. |
2119 | * | 2119 | * |
@@ -2121,16 +2121,16 @@ mesh_mq_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state) | |||
2121 | * @return a message queue to messages over the channel | 2121 | * @return a message queue to messages over the channel |
2122 | */ | 2122 | */ |
2123 | struct GNUNET_MQ_Handle * | 2123 | struct GNUNET_MQ_Handle * |
2124 | GNUNET_MESH_mq_create (struct GNUNET_MESH_Channel *channel) | 2124 | GNUNET_CADET_mq_create (struct GNUNET_CADET_Channel *channel) |
2125 | { | 2125 | { |
2126 | struct GNUNET_MQ_Handle *mq; | 2126 | struct GNUNET_MQ_Handle *mq; |
2127 | struct MeshMQState *state; | 2127 | struct CadetMQState *state; |
2128 | 2128 | ||
2129 | state = GNUNET_new (struct MeshMQState); | 2129 | state = GNUNET_new (struct CadetMQState); |
2130 | state->channel = channel; | 2130 | state->channel = channel; |
2131 | 2131 | ||
2132 | mq = GNUNET_MQ_queue_for_callbacks (mesh_mq_send_impl, | 2132 | mq = GNUNET_MQ_queue_for_callbacks (cadet_mq_send_impl, |
2133 | mesh_mq_destroy_impl, | 2133 | cadet_mq_destroy_impl, |
2134 | NULL, /* FIXME: cancel impl. */ | 2134 | NULL, /* FIXME: cancel impl. */ |
2135 | state, | 2135 | state, |
2136 | NULL, /* no msg handlers */ | 2136 | NULL, /* no msg handlers */ |